31#include "font_fixture.h"
42typedef enum : uint32_t {
62 "<html><body><h1 style=\"text-align:center\">Aligned</h1>"
63 "<p style=\"text-align:right\">Right aligned paragraph flush to the margin.</p>"
64 "<p style=\"text-align:center\">Centred paragraph line in the column.</p>"
65 "<p style=\"text-align:justify\">aa bb cc dd ee ff gg hh ii jj kk ll mm nn oo "
66 "pp qq rr ss tt uu vv ww xx yy zz</p>"
67 "<p>Plain left paragraph as the default baseline.</p></body></html>";
69static const uint8_t
k_msg_boot[] =
"ereader-align-hil: boot\r\n";
70static const uint8_t
k_msg_fail[] =
"ereader-align-hil: FAIL init\r\n";
71static const uint8_t
k_msg_lerr[] =
"ereader-align-hil: FAIL layout\r\n";
72static const uint8_t
k_msg_pre[] =
"ereader-align-hil: glyphs=";
77static void al_print(
const uint8_t* msg, uint32_t len)
86 __asm__
volatile(
"bkpt #0");
88 __asm__
volatile(
"wfi");
114 buf[n] = (uint8_t)(
'0' + (value % (uint32_t)
k_al_dec_ten));
118 for (uint32_t i = 0U; i < n; i++) {
127 const size_t nbytes =
sizeof(int32_t) * 2U;
128 for (uint32_t g = 0U; g <
s_engine.glyph_count; g++) {
130 const uint8_t* p = (
const uint8_t*)coords;
131 for (
size_t i = 0U; i < nbytes; i++) {
141 uint32_t cpuclk0_hz = 0U;
195 __asm__
volatile(
"wfi");
void main(void)
Secure fallback main entry point.
static const uint8_t k_msg_pre[]
static const uint8_t k_msg_boot[]
static const uint8_t k_msg_fail[]
static reflow_t s_engine
Reflow engine (glyph / page / token / text pools live inside).
static const uint8_t k_msg_eol[]
static const uint8_t k_msg_geom[]
static const uint8_t k_msg_lerr[]
al_consts_t
Viewport / console / hash knobs (no magic numbers).
@ k_al_ink
Body ink colour (ARGB).
@ k_al_hex_nibbles
Hex digits in a 32-bit value.
@ k_al_view_w
Layout viewport width, pixels.
@ k_al_uart_baud
Console baud.
@ k_al_font_px
Body font size, pixels.
@ k_al_link_col
Anchor colour (ARGB).
@ k_al_fnv_prime
FNV-1a-32 prime.
@ k_al_dec_ten
Hex digit / decimal split.
@ k_al_fnv_offset
FNV-1a-32 offset basis.
@ k_al_view_h
Layout viewport height, pixels.
@ k_al_nibble_mask
Low-nibble mask.
@ k_al_nibble_bits
Bits per hex nibble.
static void al_setup_or_halt(void)
Bring up clocks/MSTP/time + the SCI8 console; halt on failure.
static void al_print(const uint8_t *msg, uint32_t len)
Emit a byte run on the SCI8 console.
static uint32_t al_geom_hash(void)
FNV-1a-32 over every laid-out glyph's (x, y) position.
static const char k_al_chapter[]
Baked chapter: right, centre, justified, and default-left paragraphs.
static void al_panic_halt(const uint8_t *msg, uint32_t len)
Print the fail banner and trap (ra8_emulator halts on the BKPT).
static void al_print_uint(uint32_t value)
Print a small unsigned integer in decimal.
static void al_print_hex(uint32_t value)
Print a 32-bit value as 8 upper-case hex digits.
static const uint8_t k_ahem_ttf[]
Ahem TTF bytes.
static const uint32_t k_ahem_ttf_len
Length of k_ahem_ttf in bytes.
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.
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.
HTML / CSS reflow + paginate engine for the ra8d2 ereader.
ra8_err_t reflow_layout_chapter(reflow_t *engine, const uint8_t *xhtml_buf, size_t xhtml_len, uint32_t *out_total_pages)
Parse + lay out one chapter of XHTML.
ra8_err_t reflow_init(uint16_t viewport_w, uint16_t viewport_h, const uint8_t *font_data, size_t font_len, uint16_t font_px, uint32_t body_color, uint32_t link_color, reflow_t *out_engine)
Initialise a reflow engine for a given viewport / font.
Reflow / pagination engine state.