55typedef enum : uint32_t {
79static const uint8_t
k_msg_boot[] =
"ereader-cover-hil: boot\r\n";
80static const uint8_t
k_msg_fail[] =
"ereader-cover-hil: FAIL init\r\n";
81static const uint8_t
k_msg_open[] =
"ereader-cover-hil: FAIL open\r\n";
82static const uint8_t
k_msg_cov[] =
"ereader-cover-hil: FAIL cover\r\n";
83static const uint8_t
k_msg_derr[] =
"ereader-cover-hil: FAIL decode\r\n";
84static const uint8_t
k_msg_pre[] =
"ereader-cover-hil: cover ";
90static void ec_print(
const uint8_t* msg, uint32_t len)
99 __asm__
volatile(
"bkpt #0");
101 __asm__
volatile(
"wfi");
111 for (
size_t i = 0U; i < n; i++) {
139 buf[n] = (uint8_t)(
'0' + (value % (uint32_t)
k_ec_dec_ten));
143 for (uint32_t i = 0U; i < n; i++) {
151 uint32_t cpuclk0_hz = 0U;
189 size_t cover_len = 0U;
248 __asm__
volatile(
"wfi");
void main(void)
Secure fallback main entry point.
EPUB (.epub) reader and chapter iterator for ra8-firmware.
ra8_err_t epub_get_cover_image(epub_book_t *book, uint8_t *out_buf, size_t max_len, size_t *got_len)
Copy the raw bytes of the cover image into the caller's buffer.
ra8_err_t epub_open(const void *media, const char *path, epub_book_t *out_book)
Open an EPUB book from an opaque media handle.
Baked minimal EPUB3 with a real PNG cover (cover-image manifest item).
static const uint8_t k_epub_cover_fixture[k_epub_cover_fixture_len]
Baked cover-art EPUB3 byte stream.
@ k_epub_cover_fixture_len
EPUB cover fixture length.
static epub_book_t s_book
Opened book (large – file-scope, not on the stack).
static const uint8_t k_msg_pre[]
static const uint8_t k_msg_ok[]
static const uint8_t k_msg_crc[]
static const uint8_t k_msg_boot[]
static const uint8_t k_msg_open[]
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_cov[]
static uint8_t s_img_arena[k_cm_arena_bytes]
Zero-heap bump arena in SDRAM backing the PNG page decode.
static void ec_print_uint(uint32_t value)
Print a small unsigned integer in decimal.
static void ec_print_hex(uint32_t value)
Print a 32-bit value as 8 upper-case hex digits.
static const uint8_t k_msg_derr[]
static uint32_t ec_framebuffer_hash(void)
FNV-1a hash over the rendered framebuffer.
static size_t ec_render_cover_or_halt(int32_t *out_w, int32_t *out_h)
Open the EPUB, extract the cover, decode+scale+blit it; return size.
static void ec_setup_or_halt(void)
Bring up clocks/MSTP/time + the SCI8 console; halt on failure.
static void ec_print(const uint8_t *msg, uint32_t len)
Emit a byte run on the SCI8 console.
static const uint8_t k_msg_x[]
static void ec_panic_halt(const uint8_t *msg, uint32_t len)
Print the fail banner and trap (ra8_emulator halts on the BKPT).
ec_consts_t
Console / render knobs (no magic numbers).
@ k_ec_nibble_bits
Bits per hex nibble.
@ k_ec_uart_baud
Console baud.
@ k_ec_col_bg
Framebuffer clear colour.
@ k_ec_nibble_mask
Low-nibble mask.
@ k_ec_hex_nibbles
Hex digits in a 32-bit value.
@ k_ec_fnv_prime
FNV-1a 32-bit prime.
@ k_ec_cover_cap
Cover-image read buffer capacity.
@ k_ec_fnv_offset
FNV-1a 32-bit offset basis.
@ k_ec_fb_w
Framebuffer width, pixels.
@ k_ec_fb_h
Framebuffer height, pixels.
@ k_ec_arena_bytes
Image decode scratch, bytes.
@ k_ec_dec_ten
Hex digit / decimal split.
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.
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_clear(uint32_t color)
Fill the bound framebuffer's clip region with a single colour.
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.
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.
Zero-heap raster image decode + scale + blit for reflow (#106).
ra8_err_t ra8_img_decode_blit(ra8_img_arena_t *arena, const uint8_t *bytes, size_t len, int32_t dst_x, int32_t dst_y, int32_t box_w, int32_t box_h, int32_t *out_w, int32_t *out_h)
Decode bytes and blit it, scaled to fit, into the bound framebuffer.
static uint8_t s_cover[k_sh_cover_cap]
Caller-owned bump arena backing a single image decode.