ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
board_input.h File Reference

Host-side keystroke FIFO: window / CLI key source -> UART RX sink. More...

#include <stdint.h>
Include dependency graph for board_input.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void board_input_push_key (char ch)
 Push one keystroke byte into the input FIFO.
bool board_input_pop_key (char *out)
 Pop the oldest buffered keystroke, if any.

Detailed Description

Host-side keystroke FIFO: window / CLI key source -> UART RX sink.

A tiny plain-C ring buffer that decouples the keystroke SOURCE from the SINK so the interactive keyboard input is deterministically testable. The source is either the live --view window (its Cocoa keyDown handler pushes each typed character) or the headless --keys flag (which pushes a scripted string); the sink is the run loop, which drains the FIFO every chunk into the console UART RX – the same SCI channel --input targets. Keeping the FIFO here in plain C (not inside the Objective-C view) lets --keys exercise the exact push -> drain -> SCI path on any host with no window and no OS key events, so the keyboard path is verifiable headlessly and in CI – not only by typing into a window. Single-threaded harness use; not thread-safe.

Since
0.1.0

Definition in file board_input.h.

Function Documentation

◆ board_input_pop_key()

bool board_input_pop_key ( char * out)

Pop the oldest buffered keystroke, if any.

Parameters
[out]outReceives one keystroke byte when true is returned.
Returns
true if a byte was dequeued (and consumed); false if empty / out is NULL.
Note
Not thread-safe; single-threaded harness use.
Since
0.1.0

Pop the oldest buffered keystroke, if any; this step is contained within the board input model and uses bounded caller or module-owned storage.

Return values
trueThe board input pop key condition holds or completed successfully; false otherwise.
Precondition
Arguments satisfy the ranges documented for board input pop key.
The call executes on the emulator's single owning thread.
Postcondition
State changes remain confined to the board input model and documented output objects.
Ownership of caller-supplied storage is unchanged.

Definition at line 37 of file board_input.c.

References k_key_ring_cap, s_head, s_ring, and s_tail.

Referenced by internal_run_loop_tick_inputs().

◆ board_input_push_key()

void board_input_push_key ( char ch)

Push one keystroke byte into the input FIFO.

Appends ch to the ring; on overflow the newest key is dropped (the firmware draining the FIFO is the slow consumer). Called by the window keyDown handler and by the --keys injector alike, so both reach the UART through one path.

Parameters
[in]chKeystroke byte to enqueue.
Returns
Nothing.
Note
Not thread-safe; single-threaded harness use.
Since
0.1.0
Precondition
Arguments satisfy the ranges documented for board input push key.
The call executes on the emulator's single owning thread.
Postcondition
State changes remain confined to the board input model and documented output objects.
Ownership of caller-supplied storage is unchanged.

Definition at line 28 of file board_input.c.

References k_key_ring_cap, s_head, s_ring, and s_tail.

Referenced by internal_main_feed_inputs().