42typedef enum : uint64_t {
58typedef enum : uint32_t {
67typedef enum : uint32_t {
75typedef enum : uint32_t {
82typedef enum : uint32_t {
99typedef enum : uint16_t {
106typedef enum : uint32_t {
163 if ((channel >= (uint32_t)
k_sci_count) || (data ==
nullptr)) {
167 for (uint32_t i = 0U; i < len; i++) {
191 for (uint32_t ch = 0U; ch < (uint32_t)
k_sci_count; ch++) {
192 total +=
s_sci[ch].transmitted;
294 if (
byte == (uint8_t)
'\n') {
463 for (uint32_t ch = 0U; ch < (uint32_t)
k_sci_count; ch++) {
478 for (uint32_t i = 0U; i < (uint32_t)
k_sci_count; i++) {
500 for (uint32_t ch = 0U; ch < (uint32_t)
k_sci_count; ch++) {
501 if ((
s_sci[ch].transmitted > 0U) || (
s_sci[ch].received > 0U)) {
502 (void)
priv_emu_io_errf(
" SCI%u UART : TX %u bytes RX %u bytes (RX dropped %u)\n",
504 s_sci[ch].transmitted,
506 s_sci[ch].rx_dropped);
524 .name =
"SCI_B UART",
Multi-channel console log store backing the board view's tabbed console.
void board_console_push(board_console_ch_t ch, const char *line)
Append one completed line to a channel ring and the ALL ring.
@ k_board_console_ch_uart
SCI_B serial console ([uart] SCIn:).
Register-accurate peripheral-model framework for the board emulator.
Decentralized peripheral-block registry for the board emulator core.
void board_periph_icu_raise_event(uc_engine *uc, uint16_t event)
Raise a peripheral ELC event through the core's ICU -> NVIC path.
void board_periph_register_block(const board_periph_block_t *block)
Register a peripheral block's descriptor with the core registry.
@ k_block_order_sci
SCI_B UART.
bool board_periph_trace(void)
Whether –trace is active (blocks log transitions when true).
Cellular AT-modem device model for ra8_emulator (attached to SCI7 UART).
void board_modem_reset(void)
Clear the modem's parser state (keeps the attached flag).
uint8_t board_modem_channel(void)
SCI channel the modem is wired to (RXD7 / TXD7 = SCI7).
uint32_t board_modem_feed_tx(uint8_t tx, uint8_t *out, uint32_t out_cap)
Feed one firmware-transmitted byte into the modem and drain a reply.
bool board_modem_attached(void)
Report whether the AT modem model is currently attached.
void board_modem_report(void)
Print a one-line end-of-run summary if the modem was exercised.
static RA8_INTERNAL void internal_sci_report(void)
Print one line per SCI channel that moved any bytes.
sci_tune_t
SCI_B model sizing and the EK-RA8D2 console channel.
@ k_sci_rx_queue_len
Per-channel host->firmware RX capacity.
@ k_sci_modem_resp_cap
Scratch for one AT-modem reply burst.
@ k_sci_sd_ch
EK-RA8D2 Pmod2 microSD = SCI0 Simple-SPI.
@ k_sci_data_mask
RDR/TDR data field is 8 bits.
@ k_sci_spi_cipo_idle
CIPO idles high (0xFF) on an empty SPI bus.
@ k_sci_console_ch
EK-RA8D2 console = SCI8 (PD02/PD03).
@ k_uart_line_cap
Captured last-TX-line buffer capacity.
sci_map_t
SCI_B block geometry (ra8_sci_regs.h, 32-bit-register variant).
@ k_sci_off_cfclr
CFCLR common flag clear (W1C).
@ k_sci_off_rdr
RDR receive data (RDAT[7:0]).
@ k_sci_off_ffclr
FFCLR FIFO flag clear (W1C).
@ k_sci_off_tdr
TDR transmit data (TDAT[7:0]).
@ k_sci_off_csr
CSR (TDRE/TEND/RDRF + errors).
@ k_sci_stride
Bytes per SCI channel.
@ k_sci_off_ccr0
CCR0 (TE/RE/RIE/TIE/TEIE).
@ k_sci_off_frsr
FRSR FIFO receive status.
@ k_sci_off_ftsr
FTSR FIFO transmit status.
@ k_sci_base
SCI0 base (Secure alias).
void board_periph_sci_feed_rx(uint8_t channel, const uint8_t *data, uint32_t len)
Queue host->firmware bytes for a channel's receive path.
static char s_uart_pend[k_uart_line_cap]
Line being accumulated.
static RA8_INTERNAL void internal_sci_reset(void)
Clear all SCI channel state and the captured last-line buffers.
sci_elc_event_t
SCI8 ELC event numbers the console channel raises (FSP ra8d2 bsp_elc).
@ k_event_sci8_rxi
SCI8 RXI receive-data-full event.
@ k_event_sci8_txi
SCI8 TXI transmit-data-empty event.
@ k_event_sci8_tei
SCI8 TEI transmit-end event.
static RA8_INTERNAL uint64_t internal_sci_read(uc_engine *uc, uint64_t addr, unsigned size)
MMIO read inside the SCI window: route to the addressed channel.
static RA8_INTERNAL void internal_sci_tick_channel(uc_engine *uc, uint32_t ch)
Raise this channel's enabled SCI interrupts through the ICU.
static void(* s_sci_tx_sink)(uint8_t channel, uint8_t byte)
Host sink for transmitted bytes (main.c installs the descriptor-backed output sink).
const char * board_periph_uart_last_line(void)
The most recent complete line the firmware transmitted over any SCI.
static RA8_INTERNAL void internal_sci_capture_tx_line(uint8_t byte)
Accumulate one transmitted byte into the captured last-line buffer.
static char s_uart_last[k_uart_line_cap]
Last completed TX line.
uint8_t board_periph_sci_console_channel(void)
The SCI channel the EK-RA8D2 console (J-Link OB VCOM) uses.
sci_clr_bit_t
CFCLR / FFCLR write-1-to-clear bits this model honours.
@ k_sci_cfclr_rdrfc
RDRFC clear CSR.RDRF (bit 31).
@ k_sci_ffclr_drc
DRC clear FRSR.DR (bit 0).
static RA8_INTERNAL uint32_t internal_sci_csr_value(const sci_state_t *s)
Build the CSR value: TX always drained, RDRF reflects the RX queue.
void board_periph_sci_set_tx_sink(void(*sink)(uint8_t channel, uint8_t byte))
Wire a host sink that receives every byte the firmware transmits.
static sci_state_t s_sci[k_sci_count]
uint32_t board_periph_uart_tx_total(void)
Total bytes the firmware has transmitted over all SCI channels.
static RA8_INTERNAL void internal_sci_reg_write(uint32_t ch, uint64_t off, uint32_t value)
Dispatch an SCI write; TDR is captured, CCR0 shadowed, clears no-op.
sci_ccr0_bit_t
SCI_B CCR0 interrupt/enable bits (ra8_sci_ccr0_bit_t).
@ k_sci_ccr0_rie
RIE receive-interrupt enable (16).
@ k_sci_ccr0_teie
TEIE transmit-end int enable (21).
@ k_sci_ccr0_re
RE receive enable (bit 0).
@ k_sci_ccr0_tie
TIE transmit-interrupt enable (20).
@ k_sci_ccr0_te
TE transmit enable (bit 4).
static uint32_t s_uart_pend_len
Chars buffered in s_uart_pend.
sci_fifo_bit_t
SCI_B FIFO status bits used by reads of FRSR / FTSR.
@ k_sci_frsr_dr
FRSR.DR receive-data-ready (bit 0).
@ k_sci_ftsr_tdfe
FTSR.TDFE transmit-FIFO-empty (6).
@ k_sci_frsr_rdf
FRSR.RDF receive-FIFO-data-full (6).
static RA8_INTERNAL bool internal_sci_rx_available(const sci_state_t *s)
True iff the channel has a queued, unread host RX byte.
static RA8_INTERNAL void internal_sci_write(uc_engine *uc, uint64_t addr, unsigned size, uint64_t value)
MMIO write inside the SCI window: route to the addressed channel.
static RA8_INTERNAL void internal_sci_tick(uc_engine *uc)
Service every SCI channel once per emulation chunk.
static const board_periph_block_t s_k_sci_block
This block's descriptor (static lifetime; the core keeps the pointer).
static RA8_INTERNAL void internal_board_periph_sci_register(void)
Self-register the SCI block before main runs (decentralized).
sci_csr_bit_t
SCI_B CSR status bits (ra8_sci_csr_bit_t).
@ k_sci_csr_tend
TEND transmit-end (bit 30).
@ k_sci_csr_rxdmon
RXDMON RXD pin monitor (bit 15).
@ k_sci_csr_tdre
TDRE transmit-data-empty (bit 29).
@ k_sci_csr_rdrf
RDRF receive-data-full (bit 31).
static RA8_INTERNAL uint64_t internal_sci_reg_read(uint32_t ch, uint64_t off)
Dispatch an SCI read for channel ch at byte offset off.
SD-card-over-SPI device model for ra8_emulator (attached to SPI_B).
bool board_sd_attached(void)
Report whether an SD-card image is currently attached.
uint8_t board_sd_exchange(uint8_t tx)
Exchange one full-duplex SPI byte with the modelled card.
Bounded raw-descriptor I/O seam for the RA8 emulator.
emu_io_result_t priv_emu_io_errf(const char *format,...)
Format bounded text and write it to the injected error descriptor.
#define RA8_INTERNAL
Marker that a function is intended to be static (file-local).
A modelled peripheral block's self-description for the core registry.
One SCI_B channel: control shadow + a host-fed RX byte queue.
uint32_t ccr0
CCR0 shadow (TE/RE/RIE/TIE/TEIE).
uint32_t rx_head
Next byte the firmware will read.
uint8_t rx[k_sci_rx_queue_len]
Host->firmware byte ring.
uint32_t received
Bytes the firmware read from RDR.
uint32_t transmitted
Bytes captured from TDR writes.
uint32_t rx_dropped
Bytes dropped on a full RX ring.
uint32_t rx_tail
Next free slot for a queued byte.