73typedef enum : uint32_t {
94typedef enum : uint16_t {
112typedef enum : uint8_t {
264static const uint8_t
k_msg_fail[] =
"ereader-zoom: FAIL init\r\n";
266static const uint8_t
k_msg_scene[] =
"ereader-zoom: FAIL scene\r\n";
268static const uint8_t
k_msg_rend[] =
"ereader-zoom: FAIL render\r\n";
270static const uint8_t
k_msg_pre[] =
"ereader-zoom: page ";
297static void ez_print(
const uint8_t* msg, uint32_t len)
307 __asm__
volatile(
"bkpt #0");
309 __asm__
volatile(
"wfi");
335 buf[n] = (uint8_t)(
'0' + (value % (uint32_t)
k_ez_dec_ten));
339 for (uint32_t i = 0U; i < n; ++i) {
347 uint32_t cpuclk0_hz = 0U;
398 .x = (uint16_t)plan->
rect.
x,
399 .y = (uint16_t)plan->
rect.
y,
400 .w = (uint16_t)plan->
rect.
w,
401 .h = (uint16_t)plan->
rect.
h,
466 const bool touching = (got > 0U);
467 if (touching && !(*was_touching)) {
472 *was_touching = touching;
527 bool was_touching =
false;
void main(void)
Secure fallback main entry point.
static const uint8_t k_msg_pre[]
static const uint8_t k_msg_ok[]
static const uint8_t k_msg_boot[]
static const uint8_t k_msg_fail[]
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 const uint8_t k_msg_tile[]
static const uint8_t k_msg_x[]
static ra8_tile_key_t s_keys[(size_t) k_ls_cells]
Cache key storage.
static longstrip_t s_strip
Opened longstrip scroll state.
static int32_t s_buckets[(size_t) k_ls_buckets]
Cache hash buckets.
static ra8_keycache_cell_t s_meta[(size_t) k_ls_cells]
Cache link metadata.
static ra8_tile_dims_t s_dims[(size_t) k_ls_cells]
Cache dim storage.
static const uint8_t k_msg_rend[]
static uint8_t s_cell_mem[(size_t) k_mg_cells *(size_t) k_mg_cell_bytes]
Tile-cache cell storage (k_mg_cells gray8 256x256 tiles, SDRAM).
static void ez_bringup_clocks(void)
Bring up clocks, MSTP, system tick, LEDs and the SCI console.
static const uint8_t k_msg_cells[]
Console banner fragment: cache cell-count label.
static const uint8_t k_msg_miss[]
Console banner fragment: cache miss counter label.
ez_print_t
Decimal / hexadecimal formatting constants for the banner.
@ k_ez_hex_nibbles
Hex digits in a 32-bit value.
@ k_ez_dec_ten
Decimal radix.
@ k_ez_nibble_bits
Bits per hex nibble.
@ k_ez_nibble_mask
Low-nibble mask.
static void ez_print_uint(uint32_t value)
Print a small unsigned integer in decimal.
static const uint8_t k_msg_z2[]
Console banner fragment: 2x render hash label.
static uint8_t s_packed[k_ez_packed_bytes]
Composite scratch: the dithered strip packed to 4 bpp (SRAM).
static void ez_bringup_touch(void)
Open the GT911 touch controller (best-effort, polled).
static void ez_flush(const ez_present_t *plan)
Flush a scene plan through the PAL with the waveform it asked for.
static const uint8_t k_msg_evict[]
Console banner fragment: cache eviction counter label.
static const uint8_t k_msg_scene[]
Console banner fragment: scene wiring failure.
static bool ez_setup_scene(void)
Wire the scene over the SDRAM cache storage and the SRAM scratch.
static ez_scene_t s_scene
The demo scene: tiled page, zoom viewport and loupe.
ez_boot_t
Boot, console and touch knobs.
@ k_ez_uart_baud
Console baud.
@ k_ez_settle_ms
PLL / SDRAM / panel-POR settle.
@ k_ez_led_every
Heartbeat LED toggle sub-cadence.
@ k_ez_touch_max_points
One contact = one tap.
@ k_ez_frame_ms
Input poll period, ms.
static void ez_print(const uint8_t *msg, uint32_t len)
Emit a byte run on the console.
static const uint8_t k_msg_hit[]
Console banner fragment: cache hit counter label.
static const uint8_t k_msg_pan[]
Console banner fragment: panned render hash label.
static void ez_bringup_panel(void)
Bring up SDRAM + the GLCDC panel, then bind ra8_gfx to the FB.
static bool ez_redraw(void)
Render, then flush whatever the scene says changed.
static void ez_print_banner(const ez_selftest_t *st)
Print the deterministic boot banner (geometry + the four hashes).
static const uint8_t k_msg_z1[]
Console banner fragment: 1:1 render hash label.
static void ez_poll_touch(bool *was_touching)
Poll the GT911 once; on a fresh tap, mutate + redraw the viewport.
static const uint8_t k_msg_lens[]
Console banner fragment: loupe render hash label.
static void ez_panic_halt(const uint8_t *msg, uint32_t len)
Print a fail banner, then trap (ra8_emulator halts on the BKPT).
static void ez_print_hex(uint32_t value)
Print a 32-bit value as 8 upper-case hex digits.
static const display_cfg_t k_ez_display_cfg
Display PAL configuration: LCD/GLCDC backend over the SDRAM framebuffer.
static const uint8_t k_msg_warm[]
Console banner fragment: prefetch counter label.
static uint8_t s_row[k_ez_row_bytes]
Composite scratch: one source row at the widest viewport (SRAM).
ez_fb_t
Framebuffer geometry (mirrors the EK-RA8D2 panel).
@ k_ez_fb_h
Framebuffer height, pixels.
@ k_ez_fb_w
Framebuffer width, pixels.
Tap-to-zoom demo scene: tiled 12 MP page, zoom viewport, loupe (#478).
ra8_ui_rect_t ez_content_rect(int32_t fb_w, int32_t fb_h)
The content rectangle: the panel less the status bar.
bool ez_scene_tick(ez_scene_t *s, uint32_t now_ms)
Advance both views' settle timers; report whether a repaint is due.
@ k_ez_page_w
Source page width, pixels.
@ k_ez_tile_edge
Tile edge, pixels (gray8 => 64 KiB/tile).
@ k_ez_page_h
Source page height, pixels.
ra8_err_t ez_scene_selftest(ez_scene_t *s, ez_selftest_t *out)
Drive the scene through the scripted boot self-check.
ra8_err_t ez_scene_present(ez_scene_t *s, ez_present_t *out)
Take the pending flush plan for whichever view changed.
ra8_err_t ez_scene_render(ez_scene_t *s)
Repaint the content area, the loupe (when open) and the status bar.
@ k_ez_row_bytes
One source row at the widest viewport.
@ k_ez_strip_bytes
gray8 destination strip (16 rows).
@ k_ez_packed_bytes
The strip packed to 4 bpp.
@ k_ez_buckets
Cache hash buckets (>= cells).
@ k_ez_cell_bytes
One gray8 tile, bytes.
ra8_err_t ez_scene_init(ez_scene_t *s, const ez_scene_cfg_t *cfg)
Wire the tile cache, the tiled source and both viewports.
bool ez_scene_tap(ez_scene_t *s, int32_t x, int32_t y, uint32_t now_ms)
Apply a tap to the scene.
Board-support layer for the Renesas EK-RA8D2 v1 evaluation kit.
ra8_err_t ra8_board_led_toggle(ra8_board_led_id_t led)
Toggle led's output state.
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.
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.
One-call bring-up of the EK-RA8D2 panel's GoodIX GT911 touch controller.
ra8_err_t ra8_board_touch_open(const ra8_board_touch_cfg_t *cfg)
Bring the on-board GT911 up and open the touch driver against it.
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.
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.
ra8_err_t display_flush(const display_handle_t *d, display_rect_t rect, display_refresh_hint_t hint)
Commit pending framebuffer changes to the panel.
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.
@ k_display_refresh_fast
Prioritise latency.
@ k_display_refresh_quality
Prioritise final quality.
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.
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_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.
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.
uint32_t ra8_time_ms(void)
Get the current 1 kHz tick count.
Multi-touch input driver – GoodIX GT911 backend.
ra8_err_t ra8_touch_read(ra8_touch_point_t *out_points, uint8_t max_count, uint8_t *got_count)
Drain the current touch frame.
@ k_ra8_touch_irq_pin_unset
Sentinel for "no IRQ pin attached".
Configuration descriptor passed into display_init.
Framebuffer descriptor returned by display_get_framebuffer.
Rectangle in framebuffer coordinates passed into display_flush.
What the scene asks the panel to flush, and how well.
ra8_ui_rect_t rect
Panel rectangle to flush.
bool quality
True: full 16-level GC16.
bool present
False: nothing changed; do not flush.
Everything ez_scene_init needs: storage and framebuffer geometry.
The whole demo: one tiled page, one zoom viewport, one loupe.
Deterministic boot self-check results (the app's golden numbers).
uint32_t misses
Tile-cache misses (decodes).
uint32_t crc_1x
Hash after the opening 1:1 render.
uint32_t crc_pan
Hash after one right-pan step at 1:1.
uint32_t evictions
Tile-cache evictions.
uint32_t crc_2x
Hash after zooming to 2x at a fixed point.
uint32_t crc_lens
Hash after opening the 4x loupe.
uint16_t warmed
Tiles warmed by the pan read-ahead.
uint32_t hits
Tile-cache hits over the whole sequence.
The two touch settings that are an APPLICATION choice, not a board fact.
Per-cell link metadata (one caller-owned array entry per cell).
Per-cell user descriptor: the decoded tile dimensions.
Identifies one decoded image tile.
One decoded touch contact.
uint16_t x
Panel X coordinate.
uint16_t y
Panel Y coordinate.
int32_t w
Width (pixels, >= 0).
int32_t h
Height (pixels, >= 0).
int32_t x
Left edge (pixels).
int32_t y
Top edge (pixels).