52typedef enum : uint32_t {
76typedef enum : uint32_t {
101static const uint8_t
k_msg_fail[] =
"ereader-hil: FAIL init\r\n";
102static const uint8_t
k_msg_pre[] =
"ereader-hil: chrome boxes=";
112static void ch_print(
const uint8_t* msg, uint32_t len)
122 __asm__
volatile(
"wfi");
148 buf[n] = (uint8_t)(
'0' + (value % (uint32_t)
k_ch_dec_ten));
152 for (uint32_t i = 0U; i < n; i++) {
179 const int16_t bar =
ra8_box_add(tree, root, &bar_n);
187 const int16_t grid =
ra8_box_add(tree, root, &grid_n);
197 const int16_t cell =
ra8_box_add(tree, grid, &cell_n);
206 for (int32_t row = 0; row < r->
h; row++) {
214 const int32_t x1 = r->
x + r->
w - 1;
215 const int32_t y1 = r->
y + r->
h - 1;
226 for (uint16_t i = 0U; i < tree->
count; i++) {
255 for (
size_t i = 0U; i < n; i++) {
269 uint32_t cpuclk0_hz = 0U;
317 __asm__
volatile(
"wfi");
void main(void)
Secure fallback main entry point.
static const uint8_t k_msg_pre[]
static const uint8_t k_msg_crc[]
static const uint8_t k_msg_boot[]
static const uint8_t k_msg_fail[]
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 const uint8_t k_msg_eol[]
static void ch_render(const ra8_box_tree_t *tree)
Render the laid-out tree: per node, fill + border + label.
static ra8_box_t s_box_nodes[k_ch_max_nodes]
Box-tree node storage.
static void ch_print_hex(uint32_t value)
Print value as 8 uppercase hex digits + a trailing EOL.
chrome_hil_cfg_t
Framebuffer + console + render geometry constants.
@ k_ch_cell_pad
Cell text inset, px.
@ k_ch_nibble_bits
Bits per hex nibble.
@ k_ch_fb_h
Framebuffer height, pixels.
@ k_ch_dec_ten
Hex digit / decimal split.
@ k_ch_uart_baud
Console baud.
@ k_ch_hex_nibbles
Hex digits in a 32-bit value.
@ k_ch_root_pad
Root padding, px.
@ k_ch_max_nodes
Box-tree node capacity.
@ k_ch_grid_pad
Grid padding, px.
@ k_ch_cell_count
Book cells in the grid.
@ k_ch_fnv_prime
FNV-1a-32 prime.
@ k_ch_nibble_mask
Low-nibble mask.
@ k_ch_status_h
Status-bar fixed height, px.
@ k_ch_border_w
Cell border width, px.
@ k_ch_fb_w
Framebuffer width, pixels.
@ k_ch_grid_gap
Grid inter-cell gap, px.
@ k_ch_fnv_offset
FNV-1a-32 offset basis.
static void ch_print_uint(uint32_t value)
Print a small unsigned integer in decimal.
static const char * s_label[k_ch_max_nodes]
Per-node label (NULL = no text), indexed by box-tree node.
static void ch_print(const uint8_t *msg, uint32_t len)
Emit a byte run on the SCI8 console.
static const char *const k_ch_titles[k_ch_cell_count]
Demo shelf titles (public-domain).
static void ch_fill(const ra8_ui_rect_t *r, uint32_t color)
Fill a rectangle by drawing h horizontal spans.
chrome_hil_color_t
Chrome palette (0xRRGGBB; ra8_gfx down-converts to RGB565).
@ k_ch_col_edge
Cell border (dark navy).
@ k_ch_col_page
Page / root background.
@ k_ch_col_bar
Status-bar fill (navy).
@ k_ch_col_ink
Cell label (near-black).
@ k_ch_col_bar_tx
Status-bar text (white).
@ k_ch_col_cell
Cell fill (light blue).
static int16_t ch_build_chrome(ra8_box_tree_t *tree)
Build the status-bar-over-grid chrome tree; return the root index.
static void ch_border(const ra8_ui_rect_t *r, uint32_t color)
Draw a 1-pixel border around a rectangle.
static uint32_t ch_framebuffer_hash(void)
FNV-1a-32 over the rendered framebuffer bytes.
static void ch_panic_halt(void)
Park forever in WFI after a fatal init error.
static void ch_setup_or_halt(void)
Bring up clocks/MSTP/time + the SCI8 console; halt on failure.
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.
ra8_err_t ra8_box_tree_init(ra8_box_tree_t *tree, ra8_box_t *storage, uint16_t cap)
Bind a tree builder to caller-owned node storage.
ra8_err_t ra8_box_layout(ra8_box_tree_t *tree, int16_t root, const ra8_ui_rect_t *frame)
Lay out the tree, filling every node's rect.
@ k_ra8_box_no_colour
Carried fill/border: absent.
@ k_ra8_box_none
No child / no sibling link.
int16_t ra8_box_add(ra8_box_tree_t *tree, int16_t parent, const ra8_box_t *node)
Append a node and link it as a child of parent.
@ k_ra8_box_stack_v
Vertical stack: children stack top->bottom.
@ k_ra8_box_grid
Fixed-column grid, row-major.
@ k_ra8_box_leaf
Terminal box (no children laid out).
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.
Error Code Definitions for ra8-firmware.
@ k_ra8_ok
Success – operation completed with all postconditions satisfied.
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_line(int32_t x0, int32_t y0, int32_t x1, int32_t y1, uint32_t color)
Draw a line from (x0,y0) to (x1,y1) with Bresenham's algorithm.
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.
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.
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.
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.
Bounded UI interaction core: hit-testing, screen stack, paging.
One node in a box tree (caller-owned).
Append-only builder over caller-owned node storage.
ra8_box_t * nodes
Caller storage.
uint16_t count
Nodes used.
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).