68typedef enum : uint16_t {
74typedef enum : uint16_t {
80typedef enum : uint32_t {
92typedef enum : uint32_t {
102typedef enum : uint32_t {
128static const char k_sfr_body[] =
"<html><body><h1>SD font OK</h1>"
129 "<p>Read off the card.</p></body></html>";
202 __asm__
volatile(
"wfi");
209 uint32_t cpuclk0_hz = 0U;
271 .filename =
"FONT.OTF",
void main(void)
Secure fallback main entry point.
static uint32_t s_pclka_hz
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 reflow_t s_engine
Reflow engine (glyph / page / token / text pools live inside).
static uint8_t s_font_buf[k_pc_font_cap]
Font blob read off the card.
static void sfr_render_or_halt(void)
Reflow the body XHTML with the SD font into the framebuffer.
static void sfr_bringup_clocks(void)
Clocks, MSTP, SysTick, LEDs, then enable IRQs.
static const ra8_port_pin_t k_sfr_pin_sck
Pmod2 SPI pins (J25) – SCI0 Simple-SPI per HUM Table 20.13.
volatile uint32_t g_sfr_ink
Inked (non-paper) pixel count after render – liveness proof.
sfr_fb_dim_t
Framebuffer dimensions, sourced from the BSP panel descriptor.
@ k_sfr_fb_w
Framebuffer width (pixels).
@ k_sfr_fb_h
Framebuffer height (pixels).
static const ra8_port_pin_t k_sfr_pin_cipo
static void sfr_panic_halt(uint32_t stage)
Halt forever with the red board LED on (fatal init error marker).
sfr_reflow_cfg_t
Reflow + font-load tunables.
@ k_sfr_paper_rgb565
White paper in RGB565 (all bits set).
@ k_sfr_ink_argb
Body text colour (near-black ink).
@ k_sfr_spi_chan
Pmod2 / J25 = SCI0 Simple-SPI.
@ k_sfr_font_cap
Max font we will read off the card.
@ k_sfr_spi_idle
Idle byte clocked on read-only xfer.
@ k_sfr_font_px
Body font size in pixels.
@ k_sfr_link_argb
Anchor text colour (cerulean).
@ k_sfr_paper_argb
Page background the FB is cleared to.
static void sfr_bringup_panel(void)
External SDRAM + GLCDC panel + ra8_gfx binding.
volatile uint32_t g_sfr_source
Font provenance (ra8_sdfont_source_t): 0 = on-card, 1 = provisioned.
sfr_fb_misc_t
Framebuffer + pacing byte-math constants.
@ k_sfr_settle_ms
PLL / SDRAM / panel-POR settle.
@ k_sfr_frame_ms
Idle heartbeat pacing (ms).
static const ra8_port_pin_t k_sfr_pin_copi
volatile uint32_t g_sfr_err
Last ra8_err_t from ra8_sdfont_load (0 = k_ra8_ok), for SWD triage.
static const ra8_port_pin_t k_sfr_pin_cs
volatile uint32_t g_sfr_font_len
Bytes of font read off the card.
sfr_stage_t
Diagnostic stage codes stamped to g_sfr_stage (J-Link / emulator).
@ k_sfr_stage_boot
Pre-init.
@ k_sfr_stage_panel_ok
SDRAM + GLCDC + ra8_gfx up.
@ k_sfr_stage_mount_fail
FAT mount failed.
@ k_sfr_stage_mount_ok
ra8_fs mounted the FAT volume.
@ k_sfr_stage_layout_ok
reflow laid out the chapter.
@ k_sfr_stage_reflow_fail
Layout/render failed.
@ k_sfr_stage_card_fail
SD bring-up failed.
@ k_sfr_stage_card_ok
ra8_sdmmc_spi init succeeded.
@ k_sfr_stage_render_ok
Page rasterised to the FB.
@ k_sfr_stage_font_fail
Font open/read failed.
@ k_sfr_stage_font_ok
Font read off the card.
sfr_diag_fill_t
Constants for the stage-coded gray panic fill (diagnostic only).
@ k_sfr_diag_shift_g
Green byte position in ARGB.
@ k_sfr_diag_shift_r
Red byte position in ARGB.
@ k_sfr_diag_lvl_step
Gray step per stage code.
@ k_sfr_diag_lvl_mask
Low-nibble stage selector.
@ k_sfr_diag_argb_opaque
Opaque-alpha bits of an ARGB fill.
@ k_sfr_diag_lvl_base
Darkest panic gray level.
static void sfr_load_font_or_halt(void)
Load FONT.OTF off the Pmod2 card (self-provisioning) into s_font_buf.
volatile uint32_t g_sfr_heartbeat
Idle-loop heartbeat; advances only after a clean render (HIL gate).
volatile uint32_t g_sfr_pages
Pages produced by reflow_layout_chapter.
volatile uint32_t g_sfr_stage
Last stage reached (sfr_stage_t); read externally over SWD.
static const display_cfg_t k_sfr_display_cfg
Display PAL config – LCD/GLCDC backend over the SDRAM buffer.
static const char k_sfr_body[]
XHTML body the app reflows with the SD-loaded font.
Declaration of the Latin-1 Literata font baked into internal flash.
const unsigned int g_ra8_font_literata_latin1_len
Length of g_ra8_font_literata_latin1 in bytes.
const unsigned char g_ra8_font_literata_latin1[]
Baked Latin-1 subset of Literata Regular (TrueType/glyf), in flash.
Board-support layer for the Renesas EK-RA8D2 v1 evaluation kit.
@ k_ra8_board_pmod2_spi_cipo
Pmod2.3 CIPO (CIPO0_B), P602.
@ k_ra8_board_pmod2_spi_cs
Pmod2.1 CS (SS0_B), P604.
@ k_ra8_board_pmod2_spi_copi
Pmod2.2 COPI (COPI0_B), P603.
@ k_ra8_board_pmod2_spi_sck
Pmod2.4 SCK (SCK0_B), P601.
ra8_err_t ra8_board_led_init(ra8_board_led_id_t led)
Configure led as a digital output, initial level low (off).
ra8_err_t ra8_board_led_on(ra8_board_led_id_t led)
Drive led HIGH (light it).
@ k_ra8_board_led_blue
Convenience aliases by colour.
@ k_ra8_board_led_red
RA8 board led red.
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.
@ k_ra8_clock_id_pclka
PCLKA.
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.
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.
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_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.
Active display-panel descriptor for the EK-RA8D2 (ER-TFT070-6).
@ k_panel_height_px
Native height (pixels).
@ k_panel_width_px
Native width (pixels).
#define RA8_BOARD_PANEL_FRAMEBUFFER(name)
Declare a correctly aligned, sized and placed RGB565 framebuffer for the on-board panel.
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.
ra8_port_pin_t
Packed (port << 8) | pin pin identifier.
Load a TTF/OTF font off a Pmod SD card, self-provisioning if absent.
ra8_err_t ra8_sdfont_load(const ra8_sdfont_cfg_t *cfg, uint8_t *buf, uint32_t cap, uint32_t *out_len, ra8_sdfont_source_t *out_source)
Mount the Pmod SD card and load a font, provisioning it if absent.
ra8_sdfont_source_t
Provenance of the font bytes returned by ra8_sdfont_load.
@ k_ra8_sdfont_source_card
File already on the card; read as-is.
External SDRAM controller driver (framework).
ra8_err_t ra8_sdramc_init(void)
Initialise the external SDRAM at k_ra8_sdram_base_addr.
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.
HTML / CSS reflow + paginate engine for the ra8d2 ereader.
ra8_err_t reflow_render_page(const reflow_t *engine, uint32_t page_idx, void *framebuffer)
Render one page into the active ra8_gfx framebuffer.
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.
Configuration descriptor passed into display_init.
Framebuffer descriptor returned by display_get_framebuffer.
SD-card font-store bus description + provisioning policy.
Reflow / pagination engine state.