61static const char*
s_tag =
"drw_blend";
72typedef enum : uint32_t {
89typedef enum : uint32_t {
106typedef enum : uint32_t {
128typedef enum : uint16_t {
148[[gnu::aligned(4)]]
volatile uint32_t
179 __asm__
volatile(
"wfi");
186 uint32_t cpuclk0_hz = 0U;
233 .enable_caches =
false,
234 .enable_buffered_writes =
false,
270 .color_argb8888 = argb,
318 .use_alpha_channel =
true,
323 .src_factor_alpha =
true,
324 .dst_factor_alpha =
true,
325 .src_invert_alpha =
false,
326 .dst_invert_alpha =
true,
327 .use_color2_dst =
false,
338 for (uint32_t w = 0U; w < words; ++w) {
340 for (uint32_t b = 0U; b < (uint32_t)
sizeof(uint32_t); ++b) {
421 static const uint8_t k_hex[] =
"0123456789ABCDEF";
void main(void)
Secure fallback main entry point.
static ra8_err_t drw_blend_render(uint32_t *out_crc)
Render the three layers (background, sprite, blended foreground).
static const uint8_t k_drw_blend_pass_pfx[]
Success / failure banner text.
static void drw_blend_setup_or_halt(void)
Bring CGC + SysTick + SCI8 + LEDs + MSTP up.
drw_blend_geom_t
Framebuffer + layer rectangle geometry, in pixels.
@ k_drw_blend_fb_dim
32 x 32 framebuffer.
@ k_drw_blend_fg_wh
Foreground 16 x 16.
@ k_drw_blend_sp_xy
Sprite top-left (8, 8).
@ k_drw_blend_sp_wh
Sprite 16 x 16.
@ k_drw_blend_fg_xy
Foreground top-left (4, 4).
@ k_drw_blend_full_org
Full-FB origin (0, 0).
static ra8_err_t drw_blend_fill(int16_t x, int16_t y, uint16_t w, uint16_t h, uint32_t argb)
Issue one opaque ra8_drw_fill_rect and wait for the engine.
static uint32_t drw_blend_framebuffer_hash(void)
FNV-1a-32 over the rendered framebuffer bytes.
static void drw_blend_panic_halt(void)
Park forever after a fatal init failure.
volatile uint32_t g_drw_blend_err
Non-zero if a DRW call returned an error during the last render.
volatile uint32_t g_drw_blend_heartbeat
Bumps once per main-loop pass – liveness for headless probes.
drw_blend_hash_t
Byte / nibble constants for the FNV hash and hex banner formatting.
@ k_drw_blend_nib_mask
Low-nibble mask for the hex digit.
@ k_drw_blend_hex_digit
Hex digits in a 32-bit CRC.
@ k_drw_blend_byte_bits
Bits per byte (FNV shift step).
@ k_drw_blend_nib_bits
Bits per hex nibble.
@ k_drw_blend_hi_nibble
Index of the most-significant nibble.
@ k_drw_blend_byte_mask
Low-byte mask for the FNV input.
drw_blend_config_t
Compile-time scalar settings for the demo.
@ k_drw_blend_alpha
Global source-over alpha (128).
@ k_drw_blend_fnv_offset
FNV-1a-32 offset basis.
@ k_drw_blend_idle_budget
Bounded wait_idle poll budget.
@ k_drw_blend_fnv_prime
FNV-1a-32 prime.
@ k_drw_blend_period_ms
Delay between renders.
@ k_drw_blend_baud
SCI8 baud rate.
static const uint8_t k_drw_blend_fail_msg[]
static const uint8_t k_drw_blend_pass_sfx[]
static ra8_err_t drw_blend_arm(void)
Arm the blend unit for opaque-over (source-over) global-alpha mixing.
static void drw_blend_print_pass(uint32_t crc)
Emit the success banner: prefix + 8 hex CRC + " PASS\r\n".
drw_blend_color_t
ARGB8888 colours used by the three render layers.
@ k_drw_blend_fg_a80
Foreground at global alpha 0x80.
@ k_drw_blend_fg_argb
Red foreground source RGB.
@ k_drw_blend_bg_argb
Opaque dark-blue background.
@ k_drw_blend_sp_argb
Opaque green sprite.
volatile uint32_t g_drw_blend_crc
FNV-1a-32 hash of the last rendered framebuffer.
static void drw_blend_print_hex(uint32_t value)
Print one hex nibble's worth of the 32-bit CRC over the console.
static ra8_err_t drw_blend_configure(void)
Bring up the DRW engine pointed at g_drw_blend_fb.
volatile uint32_t g_drw_blend_fb[(uint32_t) k_drw_blend_fb_dim *(uint32_t) k_drw_blend_fb_dim]
32 x 32 ARGB8888 framebuffer the DRW composites into.
static const char * s_tag
Logging / check tag.
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).
@ k_ra8_board_led2
LED2, GREEN, P303 (jumper E26).
@ k_ra8_board_led1
LED1, BLUE, P600 (jumper E27).
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.
Validation and Error-Checking Macros for ra8-firmware.
#define RA8_CHECK_NULL_PTR(ptr, tag, message)
Reject nullptr pointer, returning k_ra8_err_null_ptr.
2D Drawing Engine (DRW / D/AVE 2D) HAL driver – public API
ra8_err_t ra8_drw_fill_rect(const ra8_drw_rect_t *rect)
Issue a solid-fill rectangle blit into the framebuffer.
ra8_err_t ra8_drw_init(const ra8_drw_config_t *cfg)
Power on the DRW block, install the supplied configuration, and arm the IRQ control register.
ra8_err_t ra8_drw_wait_idle(uint32_t poll_budget)
Poll STATUS until all "busy" bits clear or budget runs out.
ra8_err_t ra8_drw_set_gradient(const ra8_drw_gradient_t *grad)
Programme the COLOR1 and COLOR2 registers from a 2-stop gradient.
ra8_err_t ra8_drw_set_blend(const ra8_drw_blend_t *blend)
Configure the alpha-blend unit using ra8_drw_blend_t fields.
@ k_ra8_drw_writefmt_argb8888
32 bpp ARGB8888.
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.
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.
void ra8_delay_ms(uint32_t ms)
Busy-wait for at least ms milliseconds.
Per-pixel + global alpha blending parameters.
Minimal DRW configuration captured by ra8_drw_init.
COLOR1 + COLOR2 two-stop gradient.
Rectangle parameters for ra8_drw_fill_rect.