|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
Headless HIL gate: load a compiled .rabook and render it (small to large). More...
#include <stddef.h>#include <stdint.h>#include "book.h"#include "font_fixture.h"#include "ra8_board_ek_ra8d2.h"#include "ra8_boot_entry.h"#include "ra8_cgc.h"#include "ra8_err.h"#include "ra8_gfx.h"#include "ra8_isr.h"#include "ra8_mstp.h"#include "ra8_time.h"#include "rabook_fixture.h"#include "rabook_gray8_fixture.h"#include "reflow.h"Go to the source code of this file.
Enumerations | |
| enum | erb_consts_t : uint32_t { k_erb_fb_w = 128U , k_erb_fb_h = 160U , k_erb_font_px = 16U , k_erb_ink = 0xFF101010U , k_erb_link_col = 0xFF2A52BEU , k_erb_bg = 0xF4F0E8U , k_erb_xhtml_cap = 2048U , k_erb_uart_baud = 115200U , k_erb_fnv_offset = 2166136261U , k_erb_fnv_prime = 16777619U , k_erb_hex_nibbles = 8U , k_erb_nibble_bits = 4U , k_erb_nibble_mask = 0x0FU , k_erb_dec_ten = 10U } |
| Framebuffer / console / hash / buffer knobs. More... | |
| enum | erb_img_const_t : uint32_t { k_erb_gray4_levels = 16U , k_erb_level_count = 256U , k_erb_img_max_px = 96U * 48U } |
| Full-resolution gray8 figure check bounds (#476). More... | |
Functions | |
| static void | erb_print (const uint8_t *msg, uint32_t len) |
| Emit a byte run on the SCI8 console. | |
| static void | erb_panic_halt (const uint8_t *msg, uint32_t len) |
| Print the fail banner and trap (ra8_emulator halts on the BKPT). | |
| static void | erb_print_hex (uint32_t value) |
| Print a 32-bit value as 8 upper-case hex digits. | |
| static void | erb_print_uint (uint32_t value) |
| Print a small unsigned integer in decimal. | |
| static uint32_t | erb_hash_fb (uint32_t seed) |
| Fold the whole RGB565 framebuffer into a running FNV-1a-32. | |
| static uint32_t | erb_render_all (uint32_t *out_hash) |
| Render every laid-out page of the current chapter; fold an FNV over it. | |
| static void | erb_setup_or_halt (void) |
| Bring up clocks/MSTP/time + the SCI8 console; halt on failure. | |
| static void | erb_render_chapter (const void *book, uint32_t chapter_idx) |
| Lay out + render one chapter; emit chN p=<pages> crc=<hash>. | |
| static uint32_t | erb_distinct_levels (const uint8_t *px, uint32_t n) |
Count the distinct gray8 tone levels in px[0..n) (bounded scan). | |
| static void | erb_render_image (void) |
| Render the retained full-resolution gray8 figure and check it (#476). | |
| void | main (void) |
| App entry: validate the baked book, render each chapter, print. | |
Variables | |
| static uint16_t | s_framebuffer [(size_t) k_erb_fb_h *(size_t) k_erb_fb_w] |
| RGB565 framebuffer in internal SRAM (no panel attached). | |
| static reflow_t | s_engine |
| Reflow engine (large – file-scope, not on the stack). | |
| static char | s_xhtml [k_erb_xhtml_cap] |
| Scratch for one chapter's serialized XHTML (DOM -> renderer bridge). | |
| static const uint8_t | k_msg_boot [] = "ereader-rabook-hil: boot\r\n" |
| static const uint8_t | k_msg_fail [] = "ereader-rabook-hil: FAIL init\r\n" |
| static const uint8_t | k_msg_berr [] = "ereader-rabook-hil: FAIL book\r\n" |
| static const uint8_t | k_msg_lerr [] = "ereader-rabook-hil: FAIL layout\r\n" |
| static const uint8_t | k_msg_pre [] = "ereader-rabook-hil: chapters=" |
| static const uint8_t | k_msg_ch [] = " ch" |
| static const uint8_t | k_msg_p [] = " p=" |
| static const uint8_t | k_msg_crc [] = " crc=" |
| static const uint8_t | k_msg_img [] = " img " |
| static const uint8_t | k_msg_x [] = "x" |
| static const uint8_t | k_msg_g8 [] = " gray8" |
| static const uint8_t | k_msg_ok [] = " ok\r\n" |
Headless HIL gate: load a compiled .rabook and render it (small to large).
The on-silicon proof of the compiled-book path. A small two-chapter book, compiled by tools/epub_compile into the book format and baked (inflated) into rabook_fixture.h, is loaded the way the device loads any book:
The book's first chapter is short (a title + two paragraphs) and the second is longer (paginates further) – a small-to-large render in one book. The fixed-metric Ahem face makes pagination + render deterministic, so the banner on the SCI8 J-Link OB console is identical every boot and matches ra8_emulator:
ereader-rabook-hil: chapters=<N> ch0 p=<P> crc=<8hex> ch1 p=<P> crc=<8hex> img <W>x<H> gray8 ok
[Ring 7 / App] {World: NS}
Definition in file main.c.
| enum erb_consts_t : uint32_t |
Framebuffer / console / hash / buffer knobs.
| enum erb_img_const_t : uint32_t |
|
static |
Count the distinct gray8 tone levels in px[0..n) (bounded scan).
| [in] | px | Gray8 pixel bytes (non-NULL). |
| [in] | n | Pixel count (<= k_erb_img_max_px, the scan bound). |
Definition at line 234 of file main.c.
References k_erb_img_max_px, and k_erb_level_count.
Referenced by erb_render_image().
|
static |
Fold the whole RGB565 framebuffer into a running FNV-1a-32.
| [in] | seed | Running hash to extend (start from k_erb_fnv_offset). |
Definition at line 156 of file main.c.
References k_erb_fb_h, k_erb_fb_w, k_erb_fnv_prime, and s_framebuffer.
Referenced by erb_render_all().
|
static |
Print the fail banner and trap (ra8_emulator halts on the BKPT).
Definition at line 110 of file main.c.
References erb_print().
Referenced by erb_render_chapter(), erb_render_image(), erb_setup_or_halt(), and main().
|
static |
Emit a byte run on the SCI8 console.
Definition at line 104 of file main.c.
References ra8_board_uart_console_write().
Referenced by erb_panic_halt(), erb_print_hex(), erb_print_uint(), erb_render_chapter(), erb_render_image(), and main().
|
static |
Print a 32-bit value as 8 upper-case hex digits.
Definition at line 120 of file main.c.
References erb_print(), k_erb_dec_ten, k_erb_hex_nibbles, k_erb_nibble_bits, and k_erb_nibble_mask.
Referenced by erb_render_chapter().
|
static |
Print a small unsigned integer in decimal.
Definition at line 133 of file main.c.
References erb_print(), and k_erb_dec_ten.
Referenced by erb_render_chapter(), erb_render_image(), and main().
|
static |
Render every laid-out page of the current chapter; fold an FNV over it.
| [out] | out_hash | Receives the FNV-1a-32 over every page's framebuffer. |
Definition at line 172 of file main.c.
References erb_hash_fb(), k_erb_bg, k_erb_fnv_offset, ra8_gfx_clear(), reflow_get_page_count(), reflow_render_page(), s_engine, and s_framebuffer.
Referenced by erb_render_chapter().
|
static |
Lay out + render one chapter; emit chN p=<pages> crc=<hash>.
Definition at line 205 of file main.c.
References book_chapter_to_xhtml(), erb_panic_halt(), erb_print(), erb_print_hex(), erb_print_uint(), erb_render_all(), k_erb_xhtml_cap, k_msg_berr, k_msg_ch, k_msg_crc, k_msg_lerr, k_msg_p, k_ra8_ok, reflow_layout_chapter(), s_engine, and s_xhtml.
Referenced by main().
|
static |
Render the retained full-resolution gray8 figure and check it (#476).
The compiled-book path retains zoomable rasters at full source resolution in continuous-tone gray8, never a panel-quantised 4bpp copy. This is the on-silicon proof: a one-image .rabook (rabook_gray8_fixture.h) is validated, and its image is confirmed to be an 8bpp raster (raw_size == width * height) carrying MORE than the 16 distinct tones a gray4 store could ever hold – so a gray4 import would have destroyed it. The pixels are then blitted 1:1 (no downscale, no re-quantise) to prove they render at full resolution. Any failure halts on the FAIL banner; success emits the deterministic img <W>x<H> gray8.
Definition at line 264 of file main.c.
References book_header(), book_image_data(), book_image_pixfmt(), book_images(), book_validate(), erb_distinct_levels(), erb_panic_halt(), erb_print(), erb_print_uint(), book_image_t::format, book_image_t::height, book_header_t::image_count, k_book_image_gray4, k_book_pixfmt_gray8, k_erb_bg, k_erb_gray4_levels, k_erb_img_max_px, k_msg_berr, k_msg_g8, k_msg_img, k_msg_x, k_ra8_ok, k_rabook_gray8_fixture, k_rabook_gray8_fixture_len, ra8_gfx_blit_gray8(), ra8_gfx_clear(), book_image_t::raw_size, and book_image_t::width.
Referenced by main().
|
static |
Bring up clocks/MSTP/time + the SCI8 console; halt on failure.
Definition at line 187 of file main.c.
References erb_panic_halt(), k_erb_uart_baud, k_msg_fail, k_ra8_clock_id_cpuclk0, k_ra8_ok, ra8_board_uart_console_init(), ra8_cgc_get_clock_hz(), ra8_cgc_init(), ra8_mstp_init(), and ra8_time_init().
Referenced by main().
| void main | ( | void | ) |
App entry: validate the baked book, render each chapter, print.
The application entry point Reset_Handler hands control to.
Definition at line 308 of file main.c.
References book_header(), book_validate(), book_header_t::chapter_count, erb_panic_halt(), erb_print(), erb_print_uint(), erb_render_chapter(), erb_render_image(), erb_setup_or_halt(), k_ahem_ttf, k_ahem_ttf_len, k_erb_fb_h, k_erb_fb_w, k_erb_font_px, k_erb_ink, k_erb_link_col, k_msg_berr, k_msg_boot, k_msg_fail, k_msg_ok, k_msg_pre, k_ra8_gfx_format_rgb565, k_ra8_ok, k_rabook_fixture, k_rabook_fixture_len, ra8_gfx_init(), ra8_isr_globals_enable(), reflow_init(), s_engine, and s_framebuffer.
|
static |
Definition at line 85 of file main.c.
Referenced by erb_render_chapter(), erb_render_image(), and main().
|
static |
|
static |
|
static |
Definition at line 93 of file main.c.
Referenced by erb_render_image().
|
static |
Definition at line 91 of file main.c.
Referenced by erb_render_image().
|
static |
|
static |
Definition at line 89 of file main.c.
Referenced by erb_render_chapter().
|
static |
|
static |
|
static |
|
static |