43typedef enum : int32_t {
61static const uint8_t
k_msg_boot[] =
"keyboard-hil: boot\r\n";
62static const uint8_t
k_msg_fail[] =
"keyboard-hil: FAIL init\r\n";
63static const uint8_t
k_msg_lay[] =
"kbd: FAIL layout\r\n";
64static const uint8_t
k_msg_miss[] =
"kbd: FAIL mismatch\r\n";
71static void kb_print(
const uint8_t* msg, uint32_t len)
80 __asm__
volatile(
"bkpt #0");
82 __asm__
volatile(
"wfi");
96 buf[n] = (uint8_t)(
'0' + (value % (uint32_t)
k_kb_dec_ten));
100 for (uint32_t i = 0U; i < n; i++) {
108 for (uint8_t i = 0U; i <
s_kb.count; i++) {
119 for (uint8_t i = 0U; i <
s_kb.count; i++) {
120 if (
s_kb.keys[i].kind == kind) {
131 const int32_t cx = r->
x + (r->
w / (int32_t)
k_kb_half);
132 const int32_t cy = r->
y + (r->
h / (int32_t)
k_kb_half);
141 uint32_t cpuclk0_hz = 0U;
201 for (uint32_t i = 0U; i < (uint32_t)(
sizeof(
k_kb_word) - 1U); i++) {
222 __asm__
volatile(
"wfi");
void main(void)
Secure fallback main entry point.
ra8_kbd_layout_t s_kb
On-screen keyboard grid.
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 const uint8_t k_msg_miss[]
Console banner fragment: cache miss counter label.
static const uint8_t k_msg_mid[]
static void kb_print(const uint8_t *msg, uint32_t len)
Emit a byte run on the SCI8 console.
static void kb_tap(ra8_kbd_text_t *t, uint8_t idx, uint32_t *taps)
Tap key idx's centre through hit-test + apply; count the tap.
static void kb_panic_halt(const uint8_t *msg, uint32_t len)
Print the fail banner and trap (ra8_emulator halts on the BKPT).
static bool kb_streq(const char *a, const char *b)
Compare two NUL-terminated strings for equality.
static uint8_t kb_key_of_kind(ra8_kbd_key_kind_t kind)
Find the first key of a non-char kind, or k_ra8_kbd_no_hit.
static const uint8_t k_msg_taps[]
static const char k_kb_expected[]
Expected query after the SHIFT / SPACE / 123-layer / digit sequence.
static void kb_setup_or_halt(void)
Bring up clocks/MSTP/time + the SCI8 console; halt on failure.
static const uint8_t k_msg_lay[]
static const char k_kb_word[]
Lowercase letters typed (with SHIFT before the first) -> "Hi".
static uint8_t kb_key_of(char ch)
Find the key index of printable ch, or k_ra8_kbd_no_hit.
static void kb_print_uint(uint32_t value)
Print a small unsigned integer in decimal.
kb_consts_t
Console / frame knobs (no magic numbers).
@ k_kb_frame_w
Keyboard frame: width.
@ k_kb_dec_ten
Decimal radix / small-buf cap.
@ k_kb_half
Centre divisor.
@ k_kb_frame_h
Keyboard frame: height.
@ k_kb_uart_baud
Console baud.
@ k_kb_frame_x
Keyboard frame: left.
@ k_kb_frame_y
Keyboard frame: top (lower panel).
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).
On-screen keyboard widget – iOS-style layers, shift, hit-test.
uint8_t ra8_kbd_hit(const ra8_kbd_layout_t *kb, int32_t px, int32_t py)
Map a tap to a key index.
ra8_err_t ra8_kbd_text_init(ra8_kbd_text_t *t)
Reset a text buffer to empty / uncommitted.
ra8_err_t ra8_kbd_apply(ra8_kbd_text_t *t, ra8_kbd_layout_t *kb, uint8_t key_idx)
Apply key key_idx to the text buffer, SHIFT, and active layer.
ra8_kbd_key_kind_t
What a key does when tapped.
@ k_ra8_kbd_key_space
Append a space.
@ k_ra8_kbd_key_layer
Switch to the layer in aux.
@ k_ra8_kbd_key_enter
Commit the query (RETURN).
@ k_ra8_kbd_key_char
Append the shift-correct char.
@ k_ra8_kbd_key_shift
Toggle the one-shot SHIFT.
ra8_err_t ra8_kbd_layout_init(ra8_kbd_layout_t *kb, const ra8_ui_rect_t *frame)
Lay the letters layer into frame; clear SHIFT.
@ k_ra8_kbd_no_hit
ra8_kbd_hit "no key" sentinel.
@ k_ra8_kbd_text_max
Text buffer capacity incl.
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.
Bounded UI interaction core: hit-testing, screen stack, paging.
The key grid for the active layer, plus SHIFT / layer / frame state.
The typed query buffer + commit state.
char buf[k_ra8_kbd_text_max]
NUL-terminated query.
uint8_t len
Chars before the NUL.
bool committed
RETURN was applied.
Axis-aligned rectangle in framebuffer pixel coordinates.
int32_t w
Width (pixels, >= 0).
int32_t h
Height (pixels, >= 0).
int32_t x
Left edge (pixels).
int32_t y
Top edge (pixels).