80typedef enum : uint16_t {
95typedef enum : uint32_t {
110typedef enum : uint16_t {
127typedef enum : uint32_t {
205static const uint8_t
k_wc_msg_fchk[] =
"widget-compose-demo: FAIL selfcheck\r\n";
219static void wc_print(
const uint8_t* msg, uint32_t len)
229 __asm__
volatile(
"wfi");
255 buf[n] = (uint8_t)(
'0' + (value % (uint32_t)
k_wc_dec_ten));
259 for (uint32_t i = 0U; i < n; i++) {
270 for (
size_t i = 0U; i < n; i++) {
284 static const char prefix[] =
"frame=";
286 for (uint32_t i = 0U; i < (uint32_t)(
sizeof(prefix) - 1U); i++) {
287 buf[pos] = prefix[i];
297 digits[n] = (char)(
'0' + (frame % (uint32_t)
k_wc_dec_ten));
301 for (uint32_t i = 0U; i < n; i++) {
302 buf[pos] = digits[n - 1U - i];
317 const int32_t tx = w->rect.x + (int32_t)
k_wc_pad;
320 "widget-compose-demo status bar",
337 (void)
ra8_gfx_rect(w->rect.x, w->rect.y, w->rect.w, w->rect.h, t->
bg,
true);
338 const int32_t tx = w->rect.x + (int32_t)
k_wc_pad;
348 "nested in the body panel",
362 "ra8_widget_panel: nested tree, damage-tracked flush",
371 .on_input =
nullptr};
374 .on_input =
nullptr};
377 .on_input =
nullptr};
418 for (uint16_t i = 0U; i < (uint16_t)
k_wc_root_n; i++) {
483 if ((dmg->
w <= 0) || (dmg->
h <= 0)) {
487 .y = (uint16_t)dmg->
y,
488 .w = (uint16_t)dmg->
w,
489 .h = (uint16_t)dmg->
h};
543 if ((dmg.
x != 0) || (dmg.
y != 0) || (dmg.
w != (int32_t)
k_wc_fb_w)) {
561static bool wc_selfcheck(uint32_t* crc0, uint16_t* d0, uint32_t* crc1, uint16_t* d1)
569 return (*crc0 != *crc1);
580 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_widget_status_bar_t s_status
static ra8_widget_panel_t s_root_panel
Root column-panel descriptor tiling the five chrome bands.
static ra8_widget_t s_root_kids[k_wd_root_n]
The five chrome bands.
static ra8_box_t s_root_scratch[k_wd_root_cap]
Root layout scratch.
static ra8_widget_t s_root
The root panel widget (composed each frame).
static bool wc_build_tree(void)
Assemble the nested widget tree; return false on a bind error.
static void wc_print(const uint8_t *msg, uint32_t len)
Emit a byte run on the board console.
wc_color_t
0xRRGGBB palette (ra8_gfx packs to RGB565).
@ k_wc_col_clear
Whole-frame clear (near black).
@ k_wc_col_footer_bg
Footer fill (dark).
@ k_wc_col_right_bg
Right tile (warm brown).
@ k_wc_col_dim
Secondary text (gray).
@ k_wc_col_left_bg
Left tile (deep blue).
@ k_wc_col_text
Primary text (white).
@ k_wc_col_status_bg
Status-bar fill (slate).
static const uint8_t k_wc_msg_pre[]
static ra8_box_t s_body_scratch[k_wc_body_cap]
Body layout scratch.
static const uint8_t k_wc_msg_fpanl[]
wc_widget_idx_t
Index of each widget within its parent array.
@ k_wc_w_body
Root child 1: nested body panel.
@ k_wc_w_right
Body child 1: right tile (flex).
@ k_wc_w_left
Body child 0: left tile (flex).
@ k_wc_w_footer
Root child 2: footer (fixed).
@ k_wc_body_n
Body child count.
@ k_wc_root_cap
Root ra8_box scratch (count + 1).
@ k_wc_body_cap
Body ra8_box scratch (count + 1).
@ k_wc_w_status
Root child 0: status bar (fixed).
@ k_wc_root_n
Root child count.
static bool wc_check_partial(uint32_t *out_crc, uint16_t *out_dirty)
Assert the partial compose: status-only damage, tiles untouched.
static void wc_footer_render(ra8_widget_t *w)
Footer render: fill + a one-line hint.
static const uint8_t k_wc_msg_finit[]
static void wc_invalidate_all(ra8_widget_refresh_t refresh)
Mark every root child dirty so the next compose repaints the tree.
static void wc_tile_render(ra8_widget_t *w)
Body-tile render: fill + label + a per-tile render counter.
static const uint8_t k_wc_msg_d1[]
static const uint8_t k_wc_msg_ftree[]
static const uint8_t k_wc_msg_crc1[]
static const ra8_widget_vtable_t k_wc_tile_vt
wc_console_t
Console baud + text-format constants.
@ k_wc_nibble_mask
Low-nibble mask.
@ k_wc_frame_buf
"frame=N" string buffer.
@ k_wc_uart_baud
Console baud.
@ k_wc_fnv_offset
FNV-1a-32 offset basis.
@ k_wc_dec_ten
Hex/decimal split + buf.
@ k_wc_frame_ms
Live status repaint (ms).
@ k_wc_nibble_bits
Bits per hex nibble.
@ k_wc_fnv_prime
FNV-1a-32 prime.
@ k_wc_hex_nibbles
Hex digits per 32-bit.
static const uint8_t k_wc_msg_fchk[]
static void wc_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 const uint8_t k_wc_msg_tail[]
static ra8_widget_panel_t s_body_panel
Body row-panel descriptor (the nested panel).
static bool wc_check_full(uint32_t *out_crc, uint16_t *out_dirty)
Assert the full compose: 3 dirty, full-frame quality, tiles drawn.
static void wc_print_uint(uint32_t value)
Print a small unsigned integer in decimal.
static const ra8_widget_vtable_t k_wc_status_vt
Status / footer / tiles are display-only (NULL on_input).
static void wc_tick_live(void)
Advance the frame counter and partial-flush only the status band.
static void wc_print_banner(uint16_t d0, uint32_t crc0, uint16_t d1, uint32_t crc1)
Emit the PASS banner once every self-check assertion holds.
static const uint8_t k_wc_msg_pass[]
static ra8_err_t wc_compose(ra8_ui_rect_t *dmg, ra8_widget_refresh_t *hint, uint16_t *dirty)
Compose the tree into the framebuffer; report the flush rect.
static wc_tile_ctx_t s_left
static const display_cfg_t k_wc_display_cfg
Display PAL config: GLCDC LCD backend bound to the SRAM framebuffer.
static const uint8_t k_wc_msg_boot[]
static void wc_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 const uint8_t k_wc_msg_crc0[]
static void wc_setup_or_halt(void)
Bring up clocks/MSTP/time and the console.
static bool wc_panel_up(void)
Bring up the GLCDC panel and bind ra8_gfx to its framebuffer.
static void wc_fmt_frame(char *buf, uint32_t frame)
Format "frame=<n>" into buf (>= k_wc_frame_buf bytes, NUL-term).
static void wc_print_hex(uint32_t value)
Print value as 8 uppercase hex digits.
static wc_tile_ctx_t s_right
static void wc_status_render(ra8_widget_t *w)
Status-bar render: fill + title over the live frame counter.
static const ra8_widget_vtable_t k_wc_footer_vt
static uint32_t wc_framebuffer_hash(void)
FNV-1a-32 over the composited framebuffer bytes.
static ra8_widget_t s_body_kids[k_wc_body_n]
[left tile, right tile].
wc_geom_t
Framebuffer + band geometry (no magic numbers).
@ k_wc_line_h
Text line pitch (16px glyph + 2).
@ k_wc_footer_h
Footer band height, pixels.
@ k_wc_fb_h
Framebuffer height, pixels.
@ k_wc_tile_gap
Gap between the two body tiles.
@ k_wc_pad
Inner text padding, pixels.
@ k_wc_fb_w
Framebuffer width, pixels.
@ k_wc_status_h
Status-bar band height, pixels.
static bool wc_selfcheck(uint32_t *crc0, uint16_t *d0, uint32_t *crc1, uint16_t *d1)
Run the whole deterministic surface; return both composites' CRCs.
static display_refresh_hint_t wc_map_hint(ra8_widget_refresh_t hint)
Map a widget refresh hint to the display PAL refresh hint.
static void wc_fail_halt(const uint8_t *msg, uint32_t len)
Print a fail banner and park forever in WFI.
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.
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_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).
Status-bar state: the live frame counter it renders.
uint32_t renders
Times the status render ran.
uint32_t frame
Frame counter shown in the status bar.
One body tile: a label over a coloured fill + a render counter.
uint32_t bg
Tile background colour.
uint32_t renders
Times this tile rendered.
const char * label
Tile heading.