82typedef enum : uint16_t {
101typedef enum : uint32_t {
125typedef enum : uint16_t {
140typedef enum : uint32_t {
176typedef enum : uint8_t {
197 {.title =
"Neuromancer",
204static const char*
const s_nav_items[] = {
"Library",
"Store",
"Settings"};
227static void wd_fill(
void* user, int32_t x, int32_t y, int32_t w, int32_t h, uint32_t color)
249static void wd_text(
void* user, int32_t x, int32_t y,
const char* str, uint32_t fg, uint32_t bg)
269static void wd_size(
void* user,
const char* str, int32_t* out_w, int32_t* out_h)
293 .left =
"widget-chrome-demo Library",
305 .on_search =
nullptr,
338 .on_select =
nullptr,
365static const uint8_t
k_wd_msg_fchk[] =
"widget-chrome-demo: FAIL selfcheck\r\n";
379static void wd_print(
const uint8_t* msg, uint32_t len)
389 __asm__
volatile(
"wfi");
415 buf[n] = (uint8_t)(
'0' + (value % (uint32_t)
k_wd_dec_ten));
419 for (uint32_t i = 0U; i < n; i++) {
430 for (
size_t i = 0U; i < n; i++) {
456 for (uint32_t i = 0U; i < n; i++) {
514 for (uint16_t i = 0U; i < (uint16_t)
k_wd_root_n; i++) {
572 if ((dmg->
w <= 0) || (dmg->
h <= 0)) {
576 .y = (uint16_t)dmg->
y,
577 .w = (uint16_t)dmg->
w,
578 .h = (uint16_t)dmg->
h};
626 if ((dmg.
x != 0) || (dmg.
y != 0) || (dmg.
w != (int32_t)
k_wd_fb_w)) {
641static bool wd_selfcheck(uint32_t* crc0, uint16_t* d0, uint32_t* crc1, uint16_t* d1)
649 return (*crc0 != *crc1);
660 uint32_t cpuclk0_hz = 0U;
void main(void)
Secure fallback main entry point.
static display_handle_t * s_display
static uint16_t s_framebuffer[(size_t) k_panel_height_px *(size_t) k_panel_width_px]
1024x600 RGB565 framebuffer in external SDRAM (GLCDC scans this).
static ra8_app_nav_t s_nav
Navigation back-stack layered over s_reg.
static const uint8_t k_wd_msg_fchk[]
@ k_wd_w_status
Status bar (fixed).
static const display_cfg_t k_wd_display_cfg
Display PAL config: GLCDC LCD backend bound to the SRAM framebuffer.
static const uint8_t k_wd_msg_fpanl[]
static const uint8_t k_wd_msg_boot[]
static void wd_print_uint(uint32_t value)
Print a small unsigned integer in decimal.
static void wd_setup_or_halt(void)
Bring up clocks/MSTP/time, the console, and the SW1/SW2 inputs.
static bool wd_selfcheck(uint32_t *out_lib, uint32_t *out_rdr)
Run the whole deterministic surface; return the two composites' hashes.
static void wd_print(const uint8_t *msg, uint32_t len)
Emit a byte run on the SCI8 console.
static void wd_print_banner(uint32_t lib_crc, uint32_t rdr_crc)
Emit the PASS banner once the self-check holds.
static void wd_print_hex(uint32_t value)
Print value as 8 uppercase hex digits.
wd_geom_t
Framebuffer + band geometry (no magic numbers).
@ k_wd_fb_h
Framebuffer height, pixels.
@ k_wd_status_h
Status-bar band height, pixels.
@ k_wd_pad
Inner text padding, pixels.
@ k_wd_fb_w
Framebuffer width, pixels.
static void wd_fail_halt(const uint8_t *msg, uint32_t len)
Print a fail banner and park forever in WFI.
static uint32_t wd_framebuffer_hash(void)
FNV-1a-32 over the composited framebuffer bytes.
static bool wd_panel_up(void)
Bring up the GLCDC panel and bind ra8_gfx to its framebuffer.
wd_color_t
0xRRGGBB palette (ra8_gfx packs to RGB565).
@ k_wd_col_dim
Secondary text (gray).
@ k_wd_col_clear
Whole-frame clear (near black).
static const uint8_t k_wd_msg_pre[]
@ k_wd_frame_ms
Input poll period (ms).
@ k_wd_hex_nibbles
Hex digits per 32-bit.
@ k_wd_dec_ten
Hex/decimal split + buf.
@ k_wd_fnv_prime
FNV-1a-32 prime.
@ k_wd_nibble_bits
Bits per hex nibble.
@ k_wd_nibble_mask
Low-nibble mask.
@ k_wd_fnv_offset
FNV-1a-32 offset basis.
@ k_wd_uart_baud
Console baud.
static const uint8_t k_wd_msg_pass[]
static const uint8_t k_wd_msg_finit[]
static void wd_fill(void *user, int32_t x, int32_t y, int32_t w, int32_t h, uint32_t color)
Paint backend: fill a rectangle through ra8_gfx.
static ra8_widget_status_bar_t s_status
static const ra8_widget_paint_t k_wd_paint
The single paint backend the chrome widgets share.
static const uint8_t k_wd_msg_tail[]
static bool wd_check_partial(uint32_t *out_crc, uint16_t *out_dirty)
Assert the partial compose: status-only damage, fast hint.
static const uint8_t k_wd_msg_d1[]
static bool wd_build_tree(void)
Assemble the chrome panel tree; return false on a bind error.
static void wd_flush_rect(const ra8_ui_rect_t *dmg, ra8_widget_refresh_t hint)
Flush only dmg to the panel with the mapped refresh hint.
static bool wd_check_full(uint32_t *out_crc, uint16_t *out_dirty)
Assert the full compose: all 5 chrome bands dirty, full-frame quality.
@ k_wd_gap
Grid gap, pixels.
@ k_wd_label_h
Card title / author row height.
@ k_wd_nav_h
Nav-strip band height, pixels.
@ k_wd_bar_h
Card progress-bar height.
@ k_wd_count_w
Toolbar count-chip width.
@ k_wd_toolbar_h
Toolbar band height, pixels.
@ k_wd_prog_h
Overall progress band height, pixels.
static ra8_widget_panel_t s_root_panel
Root column-panel descriptor tiling the five chrome bands.
static const uint8_t k_wd_msg_crc0[]
static ra8_widget_book_grid_t s_grid
static display_refresh_hint_t wd_map_hint(ra8_widget_refresh_t hint)
Map a widget refresh hint to the display PAL refresh hint.
static void wd_tick_live(void)
Advance the clock and partial-flush only the status band.
@ k_wd_col_cover_c
Cover swatch C.
@ k_wd_col_track
Progress track.
@ k_wd_col_cover_a
Cover swatch A.
@ k_wd_col_ink
Primary ink.
@ k_wd_col_fill
Progress fill (amber).
@ k_wd_col_status
Status-bar fill (slate).
@ k_wd_col_toolbar
Toolbar fill (dark).
@ k_wd_col_white
White text.
@ k_wd_col_field
Search-field fill.
@ k_wd_col_paper
Grid / page background.
@ k_wd_col_cover_d
Cover swatch D.
@ k_wd_col_nav
Nav-strip fill.
@ k_wd_col_cover_b
Cover swatch B.
@ k_wd_col_rule
Hairline / border.
wd_data_t
Book count + progress + console constants.
@ k_wd_clock_len
"NNNNN" clock buffer + NUL.
@ k_wd_grid_cols
Grid columns.
@ k_wd_prog_total
Overall progress full-scale.
@ k_wd_book_count
Book records in the grid.
@ k_wd_prog_value
Overall progress value.
wd_child_idx_t
Index of each chrome band within the root panel array.
@ k_wd_root_cap
Root ra8_box scratch (count + 1).
@ k_wd_w_nav
Root child 4: nav strip (fixed).
@ k_wd_w_toolbar
Root child 1: toolbar (fixed).
@ k_wd_w_grid
Root child 2: book grid (flex).
@ k_wd_w_prog
Root child 3: progress (fixed).
@ k_wd_root_n
Root child count.
static const uint8_t k_wd_msg_ftree[]
static void wd_invalidate_all(ra8_widget_refresh_t refresh)
Mark every chrome band dirty so the next compose repaints the tree.
static ra8_widget_t s_root_kids[k_wd_root_n]
The five chrome bands.
static void wd_size(void *user, const char *str, int32_t *out_w, int32_t *out_h)
Paint backend: measure a string's pixel size through ra8_gfx.
static void wd_clock_fmt(void)
Reformat s_clock as the decimal s_clock_val (bounded, NUL-term).
static void wd_leaf_init(ra8_widget_t *w, const ra8_widget_vtable_t *vt, void *ctx, int16_t fixed, uint16_t flex)
Build a leaf widget bound to a vtable + context.
static uint32_t s_clock_val
Monotonic clock counter shown in the status bar.
static ra8_box_t s_root_scratch[k_wd_root_cap]
Root layout scratch.
wd_book_pct_t
Sample reading-progress percentages for the four demo books.
@ k_wd_pct_dune
"Dune" read progress, percent.
@ k_wd_pct_solaris
"Solaris" read progress, percent.
@ k_wd_pct_1984
"1984" read progress, percent.
@ k_wd_pct_neuromancer
"Neuromancer" read progress, percent.
static ra8_widget_t s_root
The root panel widget (composed each frame).
static ra8_widget_toolbar_t s_toolbar
static ra8_err_t wd_compose(ra8_ui_rect_t *dmg, ra8_widget_refresh_t *hint, uint16_t *dirty)
Compose the chrome tree into the framebuffer; report the flush rect.
static void wd_text(void *user, int32_t x, int32_t y, const char *str, uint32_t fg, uint32_t bg)
Paint backend: draw ASCII text through ra8_gfx.
static const char *const s_nav_items[]
Nav-strip destinations.
static ra8_widget_progress_bar_t s_prog
static const uint8_t k_wd_msg_crc1[]
static const ra8_widget_book_t s_books[k_wd_book_count]
The four book records shown in the grid.
Board-support layer for the Renesas EK-RA8D2 v1 evaluation kit.
ra8_err_t ra8_board_uart_console_write(const uint8_t *data, size_t len)
Polled blocking write to the J-Link OB VCOM console.
ra8_err_t ra8_board_uart_console_init(uint32_t baud)
Configure SCI8 + PD02/PD03 as the debug-console UART.
Boot entry points shared between a vector table and its startup code.
Bounded, allocation-free box-model layout for e-reader chrome.
High-level Clock Generation Circuit driver.
ra8_err_t ra8_cgc_get_clock_hz(ra8_clock_id_t id, uint32_t *out_hz)
Query the current frequency of a clock-tree domain.
@ k_ra8_clock_id_cpuclk0
Cortex-M85 CPUCLK0.
ra8_err_t ra8_cgc_init(void)
Configure the clock tree to a safe default.
Display Platform Abstraction Layer for the RA8D2.
@ k_display_pixfmt_rgb565
16 bpp, 5/6/5 packed.
ra8_err_t display_get_framebuffer(const display_handle_t *d, display_fb_t *out)
Return the framebuffer descriptor the backend is targeting.
ra8_err_t display_flush(const display_handle_t *d, display_rect_t rect, display_refresh_hint_t hint)
Commit pending framebuffer changes to the panel.
struct display_handle display_handle_t
ra8_err_t display_init(const display_cfg_t *cfg, display_handle_t **out_handle)
Initialise the display PAL and bring the selected backend up to a state where display_flush succeeds.
display_refresh_hint_t
Intent passed into display_flush; backends map this onto whatever waveform/mode their controller offe...
@ k_display_refresh_fast
Prioritise latency.
@ k_display_refresh_quality
Prioritise final quality.
LCD backend (ra8_glcdc) for the display PAL.
const display_backend_iface_t k_display_backend_lcd_ra8_glcdc
LCD backend vtable – pass its address through display_cfg_t.iface to drive the EK-RA8D2 panel.
Error Code Definitions for ra8-firmware.
@ k_ra8_ok
Success – operation completed with all postconditions satisfied.
ra8_err_codes_t ra8_err_t
Canonical error-return type used by every ra8-firmware API.
static ra8_fs_clock_t s_clock
The installed calendar binding; meaningful only when s_clock_bound.
Software 2D graphics primitives layered on top of a caller-ownedframebuffer (DRW / D/AVE 2D / GLCDC r...
@ k_ra8_gfx_format_rgb565
16-bit RGB565, little-endian in memory.
ra8_err_t ra8_gfx_clear(uint32_t color)
Fill the bound framebuffer's clip region with a single colour.
ra8_err_t ra8_gfx_text_size(const char *str, const ra8_gfx_font_t *font, uint32_t *out_w, uint32_t *out_h)
Compute rendered pixel dimensions of a string.
ra8_err_t ra8_gfx_text_out(int32_t x, int32_t y, const char *str, const ra8_gfx_font_t *font, uint32_t fg_color, uint32_t bg_color)
Render a NUL-terminated ASCII string.
ra8_err_t ra8_gfx_init(void *fb, uint16_t width, uint16_t height, ra8_gfx_format_t format)
Bind ra8_gfx to a caller-owned framebuffer.
ra8_err_t ra8_gfx_rect(int32_t x, int32_t y, int32_t w, int32_t h, uint32_t color, bool filled)
Draw an axis-aligned rectangle.
Bitmap font descriptor + bundled font handles for ra8_gfx.
const ra8_gfx_font_t ra8_gfx_font_8x16
Bundled 8x16 IBM PC VGA bitmap font, ASCII 0x20..0x7E.
Graphics LCD Controller driver (two-layer with alpha blending).
NVIC + ICU IELSR allocator.
void ra8_isr_globals_enable(void)
Globally enable maskable interrupts (PRIMASK = 0).
Ref-counted Module Stop Control wrapper for the RA8D2.
ra8_err_t ra8_mstp_init(void)
Re-establish the ra8_mstp ref-count table from current hardware state.
Active display-panel descriptor for the EK-RA8D2 (ER-TFT070-6).
@ k_ra8_board_fb_align_bytes
GLCDC AXI burst alignment, in bytes.
EK-RA8D2 panel timing as the HAL's ra8_glcdc_timing_t (ER-TFT070-6).
static const ra8_glcdc_timing_t s_ra8_panel_ek_ra8d2_timing
EK-RA8D2 ER-TFT070-6 RGB timing for ra8_glcdc_init / the LCD backend.
SysTick-based tick counter, delay and timestamp helpers.
ra8_err_t ra8_time_init(uint32_t cpu_hz)
Initialise SysTick for a 1 kHz tick interrupt.
void ra8_delay_ms(uint32_t ms)
Busy-wait for at least ms milliseconds.
Bounded UI interaction core: hit-testing, screen stack, paging.
Configuration descriptor passed into display_init.
Framebuffer descriptor returned by display_get_framebuffer.
void * pixels
Base of pixel data (RGB565 unless noted).
Rectangle in framebuffer coordinates passed into display_flush.
One node in a box tree (caller-owned).
Axis-aligned rectangle in framebuffer pixel coordinates.
int32_t w
Width (pixels, >= 0).
int32_t h
Height (pixels, >= 0).
int32_t x
Left edge (pixels).
int32_t y
Top edge (pixels).