|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
E-reader device chrome – Library + Reading screens. More...
#include <stddef.h>#include <stdint.h>#include <string.h>#include "er_pageturn.h"#include "ereader_ui_steps.h"#include "literata_latin1.h"#include "ra8_app.h"#include "ra8_batt.h"#include "ra8_board_ek_ra8d2.h"#include "ra8_board_ek_ra8d2_touch.h"#include "ra8_boot_entry.h"#include "ra8_box.h"#include "ra8_cgc.h"#include "ra8_display_pal.h"#include "ra8_display_pal_lcd.h"#include "ra8_display_pal_policy.h"#include "ra8_err.h"#include "ra8_gfx.h"#include "ra8_isr.h"#include "ra8_mstp.h"#include "ra8_panel_timing.h"#include "ra8_port_constants.h"#include "ra8_port_utils.h"#include "ra8_sdfont.h"#include "ra8_sdramc.h"#include "ra8_time.h"#include "ra8_touch.h"#include "ra8_ui.h"#include "reflow.h"Go to the source code of this file.
Enumerations | |
| enum | : uint16_t { k_er_clean_every = 8U } |
| Default clean-refresh cadence: a GC16 every N fast turns. More... | |
Functions | |
| RA8_BOARD_PANEL_FRAMEBUFFER (s_framebuffer) | |
| static void | app_panic_halt (void) |
| Halt forever with the red board LED on. | |
| static void | app_bringup_clocks (void) |
| Bring up clocks, MSTP, system tick, and the two board LEDs. | |
| static void | app_bringup_panel (void) |
| Bring up external SDRAM and the GLCDC panel, then cache the FB. | |
| static void | app_bringup_gfx (void) |
| Bind ra8_gfx to the panel framebuffer. | |
| static void | app_bringup_touch (void) |
| Open the GT911 touch controller (best-effort, polled). | |
| static void | er_try_load_font (void) |
| Best-effort: load FONT.OTF off the Pmod2 SD card into s_font_buf. | |
| static void | er_app_render (const ra8_app_t *a) |
| App render trampoline: dispatch to the screen render by app id. | |
| static void | er_apps_init (void) |
| Register the e-reader screen-apps into s_app_reg. | |
| void | er_render_current (void) |
| Render whichever screen is on top of the navigation stack. | |
| void | er_render_nag_region (void) |
| Repaint only the low-battery banner rect (dirty-region update). | |
| void | er_flush_event (display_turn_event_t event) |
| Flush the panel for a refresh event through the cadence policy (#78). | |
| void | main (void) |
| The application entry point Reset_Handler hands control to. | |
Variables | |
| const char | k_er_wordmark [6] = "PAPYR" |
| Wordmark / status text. | |
| const char | k_er_lib_heading [] = "PAPYR Library" |
| Library heading text. | |
| const char | k_er_status_right [] = "10:24 98%" |
| Status-bar right text. | |
| const char | k_er_search_hint [] = "Search" |
| Search placeholder. | |
| const char | k_er_count_text [] = "6 books" |
| Book-count chip text. | |
| const char | k_er_book_title [] = "The Time Machine" |
| Reading title text. | |
| const char | k_er_page_label [] = "Page 12 of 248" |
| Reading page label. | |
| const char | k_er_chapter [] = "I" |
| Bitmap-fallback heading. | |
| const char *const | k_er_nav_items [] = {"Library", "Store", "Notes", "Settings"} |
| Bottom-nav destinations. | |
| const er_book_t | k_er_books [] |
| Demo shelf (public-domain works). | |
| const char *const | k_er_body_lines [] |
| Reading-view body paragraph lines (pre-wrapped for the font). | |
| static const char | k_er_chapter_xhtml [] |
| Reading-view chapter as XHTML, reflowed by reflow when an SD font is present (the same prose as k_er_body_lines, but laid out live at the proportional type scale instead of pre-wrapped bitmap lines). | |
| static const char | k_er_chapter2_xhtml [] |
| Reading-view chapter two (cross-chapter <a href> link target). | |
| const er_chapter_t | k_er_spine [] |
| Two-chapter mock spine for in-content cross-chapter navigation (#110). | |
| uint32_t | s_chapter_idx |
| Index of the chapter currently shown in the Reading view. | |
| static const ra8_port_pin_t | k_er_pin_sck = (ra8_port_pin_t)k_ra8_board_pmod2_spi_sck |
| Pmod2 SPI pins (J25) – SCI0 Simple-SPI, per sd_font_render. | |
| static const ra8_port_pin_t | k_er_pin_cipo = (ra8_port_pin_t)k_ra8_board_pmod2_spi_cipo |
| static const ra8_port_pin_t | k_er_pin_copi = (ra8_port_pin_t)k_ra8_board_pmod2_spi_copi |
| static const ra8_port_pin_t | k_er_pin_cs = (ra8_port_pin_t)k_ra8_board_pmod2_spi_cs |
| static const display_cfg_t | k_er_display_cfg |
| Display PAL config – LCD/GLCDC backend over the SDRAM buffer. | |
| static display_handle_t * | s_display = nullptr |
| PAL handle returned by display_init. | |
| display_fb_t | s_fb |
| Mutable copy of the FB descriptor; populated at boot. | |
| ra8_ui_nav_t | s_nav |
| Navigation stack (which screen is shown). | |
| ra8_ui_target_t | s_targets [k_er_max_targets] |
| Tap targets for the current screen (rect + action id). | |
| uint16_t | s_target_count |
| Number of tap targets currently populated. | |
| ra8_kbd_layout_t | s_kb |
| On-screen keyboard grid (built by er_render_keyboard, read on tap). | |
| ra8_kbd_text_t | s_query |
| Live search query typed on the keyboard; filters the Library shelf. | |
| uint32_t | s_reading_page |
| Reading view: current reflow page index (0-based). | |
| uint32_t | s_reading_pages = 1U |
| Reading view: total reflow pages from the last layout (>= 1). | |
| ra8_batt_monitor_t | s_batt_mon |
| Low-battery nag policy state (edge-triggered, see ra8_batt). | |
| ra8_batt_nag_t | s_batt_nag = k_ra8_batt_nag_none |
| Nag currently shown over the chrome (none = no banner). | |
| uint8_t | s_batt_soc = 0U |
| Last fuel-gauge SOC percent (for the banner text). | |
| bool | s_nag_region_only = false |
| Set by er_handle_tap when a tap only toggled the nag (incremental repaint). | |
| static display_policy_t | s_policy |
| Refresh-cadence policy driving e-ink page-turn waveforms (#78). | |
| display_turn_event_t | s_pending_event = k_display_event_chapter |
| Pending refresh event for the next flush (set by a tap/button handler). | |
| volatile uint32_t | g_er_cur_page |
| SWD / --dump-sym telemetry for the headless page-turn HIL (#78). | |
| volatile uint32_t | g_er_turns |
| Count of page turns applied since boot. | |
| volatile uint32_t | g_er_last_hint |
| Last display_refresh_hint_t flushed. | |
| volatile uint32_t | g_er_loop_ticks |
| Free-running main-loop counter – HIL liveness. | |
| er_loc_t | s_loc_back [k_er_page_back_cap] |
| Reading back-stack for link round-trips (footnote + chapter) (#110). | |
| uint32_t | s_loc_back_count |
| Entries used in s_loc_back. | |
| uint8_t | s_font_buf [k_er_font_cap] |
| Font blob read off the SD card – lives in SDRAM (hundreds of KiB). | |
| uint8_t | s_img_arena_buf [k_er_img_arena] |
| Image-decode bump arena in SDRAM (covers / figures are megabytes). | |
| reflow_t | s_reflow_engine |
| reflow engine for the Reading body (page / glyph / token pools). | |
| bool | s_reflow_open = false |
| True while s_reflow_engine holds a laid-out chapter (cache valid). | |
| uint32_t | s_reflow_chapter = (uint32_t)k_er_chapter_none |
| Chapter index currently laid out in s_reflow_engine (cache key). | |
| int32_t | s_reflow_w = 0 |
| Body geometry the cached layout was paginated for (cache key). | |
| int32_t | s_reflow_h = 0 |
| Body height the layout used. | |
| uint32_t | s_font_len |
| Bytes of font read off the card (0 if none). | |
| bool | s_have_font |
| True once an SD font is loaded; gates the reflow body render. | |
| static uint32_t | s_pclka_hz |
| Cached PCLKA rate (Hz) for the SD SPI clock shim. | |
| static const ra8_widget_vtable_t | k_er_nag_vt = {.render = er_nag_render} |
| Nag banner overlay widget vtable (renderer lives in the input TU). | |
| static ra8_app_t | s_app_library |
| Library / Reading / Keyboard (+ optional Settings) app instances. | |
| static ra8_app_t | s_app_reader |
| static ra8_app_t | s_app_keyboard |
| static ra8_app_t * | s_app_slots [4] |
| App registry storage (4 slots: 3 core + an optional Settings). | |
| static ra8_app_registry_t | s_app_reg |
| static const ra8_app_vtable_t | k_er_app_vt |
| Vtable shared by every screen-app (render-only; nav owns transitions). | |
E-reader device chrome – Library + Reading screens.
E-reader UI chrome (issue #80). The application shell is laid out by the bounded box-model engine libs/ra8_box (the #80 box model: stacks, a fixed-column grid, padding/gap, fixed vs flex sizing), rendered into the GLCDC framebuffer through libs/ra8_gfx in the flat 16-level-grayscale language of the verified "PAPYR" proof-of-concept, and navigated through the libs/ra8_ui screen stack. The Reading body renders real reflowed book text through apps/shared_libs/reflow when a font is present on the microSD (FONT.OTF); with no card it falls back to the bundled ra8_gfx bitmap font (#83).
Two screens:
Boot: clocks/MSTP/SysTick/LEDs, then SDRAM + GLCDC (the 1024x600 RGB565 framebuffer lives in external SDRAM), then ra8_gfx bound to it. Layout is resolution-adaptive from the framebuffer the backend reports.
The screen rendering, in-content navigation, on-screen keyboard, battery nag and input polling live in the per-aspect helper translation units under src/ (ereader_ui_screens.c + ereader_ui_input.c); this file keeps boot, the app-framework screen dispatch, and the main loop. See src/ereader_ui_steps.h for the shared contract.
Definition in file main.c.
| anonymous enum : uint16_t |
|
static |
Bring up clocks, MSTP, system tick, and the two board LEDs.
Same boot order the other full-panel manual demos use.
Definition at line 337 of file main.c.
References app_panic_halt(), k_ra8_board_led_blue, k_ra8_board_led_red, k_ra8_clock_id_cpuclk0, k_ra8_ok, ra8_board_led_init(), ra8_cgc_get_clock_hz(), ra8_cgc_init(), ra8_isr_globals_enable(), ra8_mstp_init(), and ra8_time_init().
|
static |
Bind ra8_gfx to the panel framebuffer.
After this, all chrome drawing goes through ra8_gfx primitives.
Definition at line 403 of file main.c.
References app_panic_halt(), k_ra8_gfx_format_rgb565, k_ra8_ok, ra8_gfx_init(), and s_fb.
|
static |
Bring up external SDRAM and the GLCDC panel, then cache the FB.
Settle delay, ra8_sdramc_init (the framebuffer lives at 0x68000000), then display_init (panel power + GLCDC routing). Caches the FB.
Definition at line 376 of file main.c.
References app_panic_halt(), display_get_framebuffer(), display_init(), k_er_display_cfg, k_er_settle_ms, k_ra8_ok, ra8_delay_ms(), ra8_sdramc_init(), s_display, and s_fb.
|
static |
Open the GT911 touch controller (best-effort, polled).
Brings the app-owned IIC_B peripheral up in I2C-compat mode, binds it through the ra8_io facade into the driver's injected seam, then opens the driver. The fuel-gauge reads in ereader_ui_input.c share this bus bring-up. Boards / emulator runs without the GT911 simply return an error from ra8_touch_open; the UI still renders, just without touch input, so this is non-fatal (no panic).
Definition at line 430 of file main.c.
References k_er_touch_max_points, k_ra8_touch_irq_pin_unset, and ra8_board_touch_open().
|
static |
Halt forever with the red board LED on.
Stuck red LED is the visual sign of a fatal init error.
Definition at line 316 of file main.c.
References k_ra8_board_led_red, and ra8_board_led_on().
|
static |
App render trampoline: dispatch to the screen render by app id.
Definition at line 535 of file main.c.
References er_render_keyboard(), er_render_library(), er_render_reading(), k_er_screen_keyboard, k_er_screen_reading, and k_er_screen_settings.
|
static |
Register the e-reader screen-apps into s_app_reg.
Definition at line 556 of file main.c.
References k_er_app_vt, k_er_screen_keyboard, k_er_screen_library, k_er_screen_reading, k_er_screen_settings, ra8_app_register(), ra8_app_registry_init(), s_app_keyboard, s_app_library, s_app_reader, s_app_reg, and s_app_slots.
Referenced by main().
| void er_flush_event | ( | display_turn_event_t | event | ) |
Flush the panel for a refresh event through the cadence policy (#78).
| [in] | event | The page-transition that occurred (open / turn / chapter). |
Definition at line 623 of file main.c.
References display_flush(), display_full_rect(), display_policy_decide(), display_policy_full_rect(), g_er_cur_page, g_er_last_hint, display_policy_decision_t::hint, k_display_refresh_quality, k_ra8_ok, s_display, s_fb, s_policy, and s_reading_page.
Referenced by er_poll_battery(), er_poll_buttons(), er_poll_touch(), and main().
| void er_render_current | ( | void | ) |
Render whichever screen is on top of the navigation stack.
Definition at line 585 of file main.c.
References k_er_nag_vt, k_er_screen_library, k_ra8_batt_nag_none, ra8_app_launch(), ra8_app_render(), ra8_ui_nav_top(), ra8_widget_render_dirty(), s_app_reg, s_batt_nag, and s_nav.
Referenced by er_poll_buttons(), er_poll_touch(), er_render_nag_region(), and main().
| void er_render_nag_region | ( | void | ) |
Repaint only the low-battery banner rect (dirty-region update).
Definition at line 602 of file main.c.
References er_render_current(), k_er_nag_h, k_er_nag_margin, k_er_nag_top, k_er_nag_vt, k_er_screen_library, k_ra8_batt_nag_none, k_ra8_ok, ra8_app_launch(), ra8_app_render(), ra8_gfx_reset_clip(), ra8_gfx_set_clip(), ra8_ui_nav_top(), ra8_widget_render_dirty(), s_app_reg, s_batt_nag, s_fb, and s_nav.
Referenced by er_poll_battery(), and er_poll_touch().
|
static |
Best-effort: load FONT.OTF off the Pmod2 SD card into s_font_buf.
Delegates the Pmod2 SPI bring-up, FAT mount, and font read to ra8_sdfont_load. Entirely non-fatal: any failure (no Pmod, no card, no FONT.OTF) leaves s_have_font false and the Reading view falls back to the baked Latin-1 font (or the bundled bitmap), so the chrome is never broken by the absence of an SD card. Provisioning is left disabled (NULL blob): the e-reader reads whatever the user's card already holds and never writes to it – unlike sd_font_render, which self-provisions a blank card.
Definition at line 462 of file main.c.
References k_er_font_cap, k_er_pin_cipo, k_er_pin_copi, k_er_pin_cs, k_er_pin_sck, k_er_spi_chan, k_ra8_clock_id_pclka, k_ra8_ok, ra8_cgc_get_clock_hz(), ra8_sdfont_load(), s_font_buf, s_font_len, s_have_font, and s_pclka_hz.
Referenced by main().
| void main | ( | void | ) |
The application entry point Reset_Handler hands control to.
Returns void, not int. This is a freestanding image: there is no hosted C environment, no process and nothing to report an exit status to. ISO C fixes main at int only for a hosted implementation; for a freestanding one (C23 5.1.2.1) the startup function's name and type are implementation-defined, and this is that definition. Reset_Handler discards no value because there is none to discard, and if main ever does return, startup halts the CPU rather than resuming anything.
The firmware lane is compiled -ffreestanding (see cmake/ra8_add_app.cmake) and the flag and this signature travel together: without it both GCC and clang reject a non-int main (-Wmain / -Wmain-return-type). Do not remove one without the other.
That coupling is why the declaration sits behind __STDC_HOSTED__ == 0, which -ffreestanding sets and a hosted build does not. The guard is not defensive dressing: this header is reachable from host builds (the unit tests compile ra8_core natively), and an unguarded void main(void); makes every hosted translation unit that includes it fail with conflicting types for 'main' against its own ISO int main. The declaration therefore exists exactly where its contract does.
Hosted first-party code – everything under tests/ and tools/ – uses the ISO int main(...) contract instead, because it genuinely does run under an OS that reads the exit status. scripts/checks/check_entry_points.py holds each domain to its own contract (#707).
Declared here, once, for the same reason SystemInit is: every vector_table.c used to restate it as a local extern int32_t main(void);, sixteen copies that no compiler ever compared against the definition – and roughly thirty of them had silently drifted out of agreement with the main they called.
The application entry point Reset_Handler hands control to.
Brings up CGC + BSP audio then plays blocks.
The application entry point Reset_Handler hands control to.
Brings up CGC + GPT triple, runs sweep.
The application entry point Reset_Handler hands control to.
Brings up clocks + UART + RMII pins, then ThreadX.
The application entry point Reset_Handler hands control to.
Brings up clocks + UART, then enters ThreadX.
The application entry point Reset_Handler hands control to.
Brings up LED, console, SDHI pins, then ThreadX.
The application entry point Reset_Handler hands control to.
Brings up CGC + USB-FS + UAC1, then enters the iso-IN feed loop forever.
The application entry point Reset_Handler hands control to.
The application entry point Reset_Handler hands control to.
See file header.
The application entry point Reset_Handler hands control to.
The application entry point Reset_Handler hands control to.
The application entry point Reset_Handler hands control to.
The application entry point Reset_Handler hands control to.
The application entry point Reset_Handler hands control to.
The application entry point Reset_Handler hands control to.
The application entry point Reset_Handler hands control to.
Profiles power modes once a second.
The application entry point Reset_Handler hands control to.
The application entry point Reset_Handler hands control to.
Brings up the clocks, console, SPI, and SD card, then runs the shared ra8_io VFS round-trip over the SD-over-SPI block device. On success it prints the exact PASS banner the HIL runner and ra8_emulator smoke gate scrape for; on any failure it prints FAIL and parks the core.
The application entry point Reset_Handler hands control to.
Initialises logging and the console, brings up the OSPI NOR volume, runs the erase-before-write round-trip, and prints a single PASS/FAIL verdict line over SCI8 before parking in an infinite loop.
The application entry point Reset_Handler hands control to.
The application entry point Reset_Handler hands control to.
The application entry point Reset_Handler hands control to.
The application entry point Reset_Handler hands control to.
Both USB controllers' clocks and pins come up before the kernel so the workers only deal with stack bring-up.
The application entry point Reset_Handler hands control to.
Brings up logging and the clock tree, releases the Cortex-M33 (which then blinks LED1 via ra8_pcntr_set_output()), and idles. See the file header.
The application entry point Reset_Handler hands control to.
The application entry point Reset_Handler hands control to.
Brings up logging, the clock tree, and the VCOM console, runs the cacheable-SRAM round-trip with the D-cache that SystemInit() enabled through ra8_cache_dcache_enable(), emits the matching PASS / FAIL banner over the console and ra8_log, then parks in WFI. Every byte the self-test touches runs with the L1 caches + MPU enabled by the shared boot (RA8_BOOT_ENABLE_CACHE_MPU + RA8_BOOT_CACHE_VIA_HAL).
The application entry point Reset_Handler hands control to.
Publishes the mailbox, releases the Cortex-M33 into the emitter, yields until it signals done, validates the blob the M33 built, then logs the PASS/FAIL verdict and the chapter count read back from the blob. See the file header for the offload narrative.
The application entry point Reset_Handler hands control to.
The application entry point Reset_Handler hands control to.
The application entry point Reset_Handler hands control to.
The application entry point Reset_Handler hands control to.
The application entry point Reset_Handler hands control to.
The application entry point Reset_Handler hands control to.
Publishes the mailbox, arms the IPC0 wake and configures the LPM block, releases the Cortex-M33 into the reader, waits for the first held page, logs the page-0 verdict, then runs the #150 mode-switch cycle – parking in low-power WFI and waking on the M33's page-turn pokes – before logging the handoff verdict and parking for good. See the file header for the narrative.
The application entry point Reset_Handler hands control to.
The application entry point Reset_Handler hands control to.
Brings up the timebase then measures forever.
The application entry point Reset_Handler hands control to.
Arms the RIIC1 target and polls the dispatcher.
The application entry point Reset_Handler hands control to.
The application entry point Reset_Handler hands control to.
The application entry point Reset_Handler hands control to.
Brings up the LIN commander then drives frames.
The application entry point Reset_Handler hands control to.
Brings up logging, "renders" page 0 into the shared mailbox, releases the Cortex-M33 into its hold loop, and parks the M85 in low-power WFI sleep. See the file header for the power-saving narrative.
The application entry point Reset_Handler hands control to.
The USB clock, pins, console, and the SD card all come up before the kernel so the worker only deals with USB stack bring-up.
The application entry point Reset_Handler hands control to.
The application entry point Reset_Handler hands control to.
The application entry point Reset_Handler hands control to.
The application entry point Reset_Handler hands control to.
Brings up logging, the clock tree, and the VCOM console, runs the three-step self-test (MPU enabled, canonical boot map, Device MMIO), emits the matching PASS / FAIL banner over the console and ra8_log, then parks in WFI.
The application entry point Reset_Handler hands control to.
The application entry point Reset_Handler hands control to.
Initialises logging + console, brings up the MRAM volume, runs the wear-levelling + power-cycle-survival flow, and prints a single PASS/FAIL verdict.
The application entry point Reset_Handler hands control to.
Initialises logging + console, brings up the MRAM volume, runs the program/erase round-trip, and prints a single PASS/FAIL verdict.
The application entry point Reset_Handler hands control to.
Brings up the clocks, console, and SDHI bus pins, runs the native SD card identification, fills the payload, then runs the full ra8_io VFS round-trip over the native-SDHI block device. On success it prints the exact PASS banner the HIL runner and ra8_emulator smoke gate scrape for; on any failure it prints FAIL and parks the core.
The application entry point Reset_Handler hands control to.
Brings up the console and both stdio sinks, retargets the engine's stdio to the in-RAM capture sink, runs the two-backend swap, replays the RAM capture out of the UART, and prints a single PASS/FAIL verdict per abstraction before parking in an infinite loop.
The application entry point Reset_Handler hands control to.
Brings up the clocks, console, and SDHI bus pins, runs the native SD card identification, fills the payload, then writes + reads + compares one raw 512-byte block straight against ra8_sdcard. On success it prints the exact PASS banner; on any failure it prints FAIL and parks the core.
The application entry point Reset_Handler hands control to.
The application entry point Reset_Handler hands control to.
Brings up clocks + UART + RMII + RSIP, then ThreadX.
The application entry point Reset_Handler hands control to.
The application entry point Reset_Handler hands control to.
The application entry point Reset_Handler hands control to.
The application entry point Reset_Handler hands control to.
The application entry point Reset_Handler hands control to.
The application entry point Reset_Handler hands control to.
Initializes and arms ADC_B, formats each successful channel sample without variadic I/O, emits the verdict, toggles LED1, and delays.
The application entry point Reset_Handler hands control to.
The application entry point Reset_Handler hands control to.
Brings up logging, releases the Cortex-M33 (which then blinks LED1), and idles. See the file header for the teaching narrative.
The application entry point Reset_Handler hands control to.
The application entry point Reset_Handler hands control to.
See the file header for the full behaviour summary.
The application entry point Reset_Handler hands control to.
Brings up logging, the clock tree, and the VCOM console, runs the three-step self-test (cacheable SRAM, RO MRAM const, Device MMIO), emits the matching PASS / FAIL banner over the console and ra8_log, then parks in WFI. Every byte the self-test touches runs with the L1 caches and MPU enabled by the shared boot (RA8_BOOT_ENABLE_CACHE_MPU).
The application entry point Reset_Handler hands control to.
The application entry point Reset_Handler hands control to.
Lights HOCO + PLL, then runs a 1 Hz blink.
The application entry point Reset_Handler hands control to.
See file header for behaviour summary.
The application entry point Reset_Handler hands control to.
The application entry point Reset_Handler hands control to.
The application entry point Reset_Handler hands control to.
The application entry point Reset_Handler hands control to.
The application entry point Reset_Handler hands control to.
Initializes the demo, executes one comparison per period, increments the exported match or mismatch counter, and toggles the matching LED.
The application entry point Reset_Handler hands control to.
Brings up the clock tree, MSTP, ISR/ELC, and the VCOM console, programs a software-triggered DTC block copy, runs it with the L1 caches + MPU enabled by the shared boot (RA8_BOOT_ENABLE_CACHE_MPU), emits the matching PASS / FAIL banner over the console and ra8_log, then parks in WFI.
The application entry point Reset_Handler hands control to.
Brings up logging, zeros the shared control block, releases the Cortex-M33, waits for its boot signature, then yields while the M33 counts autonomously to k_bg_target_count. After the M33 sets done, the M85 reads the counter and logs the PASS/FAIL verdict.
The application entry point Reset_Handler hands control to.
Brings up logging, releases the Cortex-M33, confirms it booted, runs k_m85_demo_rounds narrated mailbox rounds, then drops into the idle heartbeat. See the file header for the teaching narrative.
The application entry point Reset_Handler hands control to.
Fires ELC software events once a second.
The application entry point Reset_Handler hands control to.
The application entry point Reset_Handler hands control to.
The application entry point Reset_Handler hands control to.
The application entry point Reset_Handler hands control to.
The application entry point Reset_Handler hands control to.
The application entry point Reset_Handler hands control to.
The application entry point Reset_Handler hands control to.
Definition at line 638 of file main.c.
References app_bringup_clocks(), app_bringup_gfx(), app_bringup_panel(), app_bringup_touch(), display_policy_init(), er_apps_init(), er_flush_event(), er_poll_battery(), er_poll_buttons(), er_poll_touch(), er_render_current(), er_try_load_font(), g_er_loop_ticks, k_display_event_open, k_display_policy_fast_clean, k_er_clean_every, k_er_frame_ms, k_er_led_every, k_er_screen_library, k_ra8_board_led_blue, k_ra8_board_sw1, k_ra8_board_sw2, ra8_batt_monitor_init(), ra8_board_led_toggle(), ra8_board_sw_init(), ra8_delay_ms(), ra8_ui_nav_init(), s_batt_mon, s_nav, and s_policy.
| RA8_BOARD_PANEL_FRAMEBUFFER | ( | s_framebuffer | ) |
References s_framebuffer.
| volatile uint32_t g_er_cur_page |
SWD / --dump-sym telemetry for the headless page-turn HIL (#78).
Current reading page after the last turn.
Definition at line 254 of file main.c.
Referenced by er_flush_event().
| volatile uint32_t g_er_last_hint |
Last display_refresh_hint_t flushed.
Definition at line 256 of file main.c.
Referenced by er_flush_event().
| volatile uint32_t g_er_loop_ticks |
| volatile uint32_t g_er_turns |
Count of page turns applied since boot.
Definition at line 255 of file main.c.
Referenced by er_apply_pageturn().
|
static |
Vtable shared by every screen-app (render-only; nav owns transitions).
Definition at line 551 of file main.c.
Referenced by er_apps_init().
| const char* const k_er_body_lines[] |
Reading-view body paragraph lines (pre-wrapped for the font).
Definition at line 110 of file main.c.
Referenced by er_draw_reading_body().
| const char k_er_book_title[] = "The Time Machine" |
Reading title text.
Definition at line 86 of file main.c.
Referenced by er_read_footer_render(), and er_read_sb_render().
| const er_book_t k_er_books[] |
Demo shelf (public-domain works).
Definition at line 96 of file main.c.
Referenced by er_build_library().
| const char k_er_chapter[] = "I" |
Bitmap-fallback heading.
Definition at line 88 of file main.c.
Referenced by er_draw_reading_body().
|
static |
Reading-view chapter two (cross-chapter <a href> link target).
|
static |
Reading-view chapter as XHTML, reflowed by reflow when an SD font is present (the same prose as k_er_body_lines, but laid out live at the proportional type scale instead of pre-wrapped bitmap lines).
Kept short so the software glyph rasteriser stays quick under the ra8_emulator CPU emulator.
| const char k_er_count_text[] = "6 books" |
|
static |
Display PAL config – LCD/GLCDC backend over the SDRAM buffer.
Definition at line 197 of file main.c.
Referenced by app_bringup_panel().
| const char k_er_lib_heading[] = "PAPYR Library" |
|
static |
Nag banner overlay widget vtable (renderer lives in the input TU).
Definition at line 297 of file main.c.
Referenced by er_render_current(), and er_render_nag_region().
| const char* const k_er_nav_items[] = {"Library", "Store", "Notes", "Settings"} |
Bottom-nav destinations.
Bottom-nav destinations (Library / Store / Notes / Settings).
Definition at line 91 of file main.c.
Referenced by er_build_nav().
| const char k_er_page_label[] = "Page 12 of 248" |
|
static |
Definition at line 182 of file main.c.
Referenced by er_try_load_font().
|
static |
Definition at line 183 of file main.c.
Referenced by er_try_load_font().
|
static |
Definition at line 184 of file main.c.
Referenced by er_try_load_font().
|
static |
Pmod2 SPI pins (J25) – SCI0 Simple-SPI, per sd_font_render.
Definition at line 181 of file main.c.
Referenced by er_try_load_font().
| const char k_er_search_hint[] = "Search" |
Search placeholder.
Definition at line 84 of file main.c.
Referenced by er_build_toolbar(), and er_kbd_search_render().
| const er_chapter_t k_er_spine[] |
Two-chapter mock spine for in-content cross-chapter navigation (#110).
Definition at line 164 of file main.c.
Referenced by er_nav_chapter(), and er_reflow_relayout().
| const char k_er_status_right[] = "10:24 98%" |
Status-bar right text.
Definition at line 83 of file main.c.
Referenced by er_lib_sb_render(), and er_read_sb_render().
| const char k_er_wordmark[6] = "PAPYR" |
Wordmark / status text.
Complete bound so er_read_sb_render can take sizeof to advance past it (a static_assert in main.c pins the size).
Definition at line 80 of file main.c.
Referenced by er_read_sb_render().
|
static |
Definition at line 525 of file main.c.
Referenced by er_apps_init().
|
static |
Library / Reading / Keyboard (+ optional Settings) app instances.
Definition at line 523 of file main.c.
Referenced by er_apps_init().
|
static |
Definition at line 524 of file main.c.
Referenced by er_apps_init().
|
static |
Definition at line 532 of file main.c.
Referenced by er_apps_init(), er_render_current(), and er_render_nag_region().
|
static |
App registry storage (4 slots: 3 core + an optional Settings).
Definition at line 531 of file main.c.
Referenced by er_apps_init().
| ra8_batt_monitor_t s_batt_mon |
Low-battery nag policy state (edge-triggered, see ra8_batt).
Low-battery nag policy state.
Definition at line 235 of file main.c.
Referenced by er_poll_battery(), and main().
| ra8_batt_nag_t s_batt_nag = k_ra8_batt_nag_none |
Nag currently shown over the chrome (none = no banner).
Nag currently shown over the chrome.
Definition at line 237 of file main.c.
Referenced by er_handle_tap(), er_nag_render(), er_poll_battery(), er_render_current(), and er_render_nag_region().
| uint8_t s_batt_soc = 0U |
Last fuel-gauge SOC percent (for the banner text).
Last fuel-gauge SOC percent.
Definition at line 239 of file main.c.
Referenced by er_nag_render(), and er_poll_battery().
| uint32_t s_chapter_idx |
Index of the chapter currently shown in the Reading view.
Reading chapter index.
Definition at line 178 of file main.c.
Referenced by er_apply_pageturn(), er_draw_reading_body_reflow(), er_handle_reading_tap(), er_handle_tap(), er_nav_chapter(), er_push_loc(), and er_reflow_relayout().
|
static |
| display_fb_t s_fb |
| uint8_t s_font_buf[k_er_font_cap] |
| uint32_t s_font_len |
Bytes of font read off the card (0 if none).
Bytes of font read off the card.
Definition at line 288 of file main.c.
Referenced by er_draw_reading_body_reflow(), and er_try_load_font().
| bool s_have_font |
True once an SD font is loaded; gates the reflow body render.
True once an SD font is loaded.
Definition at line 291 of file main.c.
Referenced by er_draw_reading_body_reflow(), and er_try_load_font().
| uint8_t s_img_arena_buf[k_er_img_arena] |
Image-decode bump arena in SDRAM (covers / figures are megabytes).
Image-decode bump arena in SDRAM.
Definition at line 274 of file main.c.
Referenced by er_reflow_relayout().
| ra8_kbd_layout_t s_kb |
On-screen keyboard grid (built by er_render_keyboard, read on tap).
On-screen keyboard grid.
Definition at line 223 of file main.c.
Referenced by er_draw_key(), er_handle_keyboard_tap(), er_kbd_keys_render(), er_kbd_label(), kb_key_of(), kb_key_of_kind(), kb_tap(), and main().
| er_loc_t s_loc_back[k_er_page_back_cap] |
Reading back-stack for link round-trips (footnote + chapter) (#110).
Reading back-stack for link jumps.
Definition at line 265 of file main.c.
Referenced by er_handle_reading_tap(), and er_push_loc().
| uint32_t s_loc_back_count |
Entries used in s_loc_back.
Entries used in s_loc_back.
Definition at line 268 of file main.c.
Referenced by er_handle_reading_tap(), er_handle_tap(), and er_push_loc().
| bool s_nag_region_only = false |
Set by er_handle_tap when a tap only toggled the nag (incremental repaint).
True when a tap only toggled the nag.
Definition at line 241 of file main.c.
Referenced by er_handle_tap(), and er_poll_touch().
| ra8_ui_nav_t s_nav |
|
static |
| display_turn_event_t s_pending_event = k_display_event_chapter |
Pending refresh event for the next flush (set by a tap/button handler).
Pending refresh event for next flush.
Defaults to a clean chapter-boundary refresh for any screen change; a same-chapter page turn lowers it to k_display_event_turn.
Definition at line 251 of file main.c.
Referenced by er_apply_pageturn(), er_handle_tap(), er_poll_buttons(), and er_poll_touch().
|
static |
Refresh-cadence policy driving e-ink page-turn waveforms (#78).
Definition at line 244 of file main.c.
Referenced by er_flush_event(), and main().
| ra8_kbd_text_t s_query |
Live search query typed on the keyboard; filters the Library shelf.
Live search query.
Definition at line 226 of file main.c.
Referenced by er_book_matches(), er_handle_keyboard_tap(), er_handle_tap(), and er_kbd_search_render().
| uint32_t s_reading_page |
Reading view: current reflow page index (0-based).
Reading current reflow page.
Definition at line 229 of file main.c.
Referenced by er_apply_pageturn(), er_draw_reading_body_reflow(), er_flush_event(), er_handle_reading_tap(), er_handle_tap(), er_nav_chapter(), er_nav_fragment(), er_push_loc(), er_read_footer_render(), and er_reading_link_tap().
| uint32_t s_reading_pages = 1U |
Reading view: total reflow pages from the last layout (>= 1).
Reading total reflow pages (>= 1).
Definition at line 232 of file main.c.
Referenced by er_apply_pageturn(), er_draw_reading_body_reflow(), er_read_footer_render(), and er_reflow_relayout().
| uint32_t s_reflow_chapter = (uint32_t)k_er_chapter_none |
Chapter index currently laid out in s_reflow_engine (cache key).
Chapter laid out (cache key).
Definition at line 282 of file main.c.
Referenced by er_draw_reading_body_reflow(), and er_reflow_relayout().
| reflow_t s_reflow_engine |
reflow engine for the Reading body (page / glyph / token pools).
reflow engine for the body.
Definition at line 277 of file main.c.
Referenced by er_bind_glyph_atlas(), er_draw_reading_body_reflow(), er_nav_chapter(), er_nav_fragment(), er_reading_link_tap(), and er_reflow_relayout().
| int32_t s_reflow_h = 0 |
Body height the layout used.
Definition at line 285 of file main.c.
Referenced by er_draw_reading_body_reflow(), and er_reflow_relayout().
| bool s_reflow_open = false |
True while s_reflow_engine holds a laid-out chapter (cache valid).
True while the engine holds a layout.
Definition at line 280 of file main.c.
Referenced by er_draw_reading_body_reflow(), and er_reflow_relayout().
| int32_t s_reflow_w = 0 |
Body geometry the cached layout was paginated for (cache key).
Body width the layout used.
Definition at line 284 of file main.c.
Referenced by er_draw_reading_body_reflow(), and er_reflow_relayout().
| uint16_t s_target_count |
Number of tap targets currently populated.
Tap targets currently populated.
Definition at line 220 of file main.c.
Referenced by er_collect_targets(), er_handle_keyboard_tap(), er_handle_tap(), and er_kbd_keys_render().
| ra8_ui_target_t s_targets[k_er_max_targets] |
Tap targets for the current screen (rect + action id).
Tap targets for the current screen.
Definition at line 217 of file main.c.
Referenced by er_collect_targets(), er_handle_keyboard_tap(), er_handle_tap(), and er_kbd_keys_render().