|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
Serial Sound Interface Enhanced (SSIE / I2S) peripheral-block model. More...
#include <stdint.h>#include <stdio.h>#include "board_console.h"#include "board_periph_block.h"#include "emu_host_io_internal.h"Go to the source code of this file.
Data Structures | |
| struct | ssie_state_t |
| One SSIE channel: a flat register shadow + a TX sample tally. More... | |
Enumerations | |
| enum | ssie_console_t : uint32_t { k_ssie_console_line_cap = 48U } |
| Console-tap line buffer capacity for an I2S/SSIE summary. More... | |
| enum | ssie_map_t : uint64_t { k_ssie_base = 0x4025D000UL , k_ssie_stride = 0x100UL , k_ssie_count = 2UL , k_ssie_span = 0x100UL * 2UL , k_ssie_regs = 0x40UL } |
| SSIE block geometry (ra8_ssie_regs.h). More... | |
| enum | ssie_off_t : uint64_t { k_ssie_off_ssicr = 0x00UL , k_ssie_off_ssisr = 0x04UL , k_ssie_off_ssifcr = 0x10UL , k_ssie_off_ssifsr = 0x14UL , k_ssie_off_ssiftdr = 0x18UL , k_ssie_off_ssifrdr = 0x1CUL } |
| Per-channel register byte offsets (ra8_ssie_regs.h). More... | |
| enum | ssie_field_t : uint32_t { k_ssie_ren_ten = 0x00000003U , k_ssie_iirq = 0x02000000U , k_ssie_tde = 0x00010000U } |
| SSICR / SSISR / SSIFSR field masks used by the model. More... | |
| enum | ssie_order_t : uint32_t { k_ssie_block_order = 130U } |
| Per-tick order slot for the SSIE block (relative order only). More... | |
Functions | |
| static RA8_INTERNAL void | internal_ssie_reset (void) |
| Reset all SSIE channel shadows to power-on (zeroed) state. | |
| static RA8_INTERNAL uint64_t | internal_ssie_read (uc_engine *uc, uint64_t addr, unsigned size) |
| MMIO read inside the SSIE window: route to the addressed channel. | |
| static RA8_INTERNAL void | internal_ssie_write (uc_engine *uc, uint64_t addr, unsigned size, uint64_t value) |
| MMIO write inside the SSIE window: route to the addressed channel. | |
| static RA8_INTERNAL void | internal_ssie_report (void) |
| End-of-run SSIE section: per-channel enable state + TX tally. | |
| static RA8_INTERNAL void | internal_ssie_block_register (void) |
| Register the SSIE block before main (host constructor). | |
Variables | |
| static ssie_state_t | s_ssie [k_ssie_count] |
| static const board_periph_block_t | s_k_ssie_block |
| SSIE block descriptor (self-registered with the core). | |
Serial Sound Interface Enhanced (SSIE / I2S) peripheral-block model.
Models the RA8D2 SSIE (ra8_ssie_regs.h, ra8_ssie.c) closely enough that the ssie_audio_loop example runs on the emulator instead of bailing to its panic-halt. Two channels (SSIE0 0x4025D000, SSIE1 0x4025D100, 0x100 stride) are modelled as a per-channel register shadow with two read overrides that the driver's bring-up actually depends on:
ra8_ssie_start refuses to set REN/TEN unless it first reads SSISR with IIRQ asserted (otherwise k_ra8_err_busy). The model returns IIRQ set while the channel is idle (REN and TEN both clear) and clears it once REN/TEN are set, exactly as the real idle flag behaves, so the start sequence proceeds.ra8_ssie_write_sample writes SSIFTDR, which the model drains (counting samples for the end-of-run report) rather than backing up.Every other register is a faithful write/readback shadow, so a "configure then verify" read returns what was written (SSICR config, SSIFCR FIFO control, SSIRST, SSIOFR audio format). The model does not synthesise audio clocks or the I2S frame – it reproduces the controller handshake the firmware drives, matching the rest of board_periph (it validates "does the firmware program the SSIE correctly", not silicon timing).
Definition in file board_periph_ssie.c.
| enum ssie_console_t : uint32_t |
Console-tap line buffer capacity for an I2S/SSIE summary.
| Enumerator | |
|---|---|
| k_ssie_console_line_cap | Max chars in an "I2S ch.. tx=.." line. |
Definition at line 42 of file board_periph_ssie.c.
| enum ssie_field_t : uint32_t |
SSICR / SSISR / SSIFSR field masks used by the model.
| Enumerator | |
|---|---|
| k_ssie_ren_ten | SSICR REN | TEN. |
| k_ssie_iirq | SSISR IIRQ idle-mode flag (bit 25). |
| k_ssie_tde | SSIFSR TDE transmit-FIFO-empty. |
Definition at line 66 of file board_periph_ssie.c.
| enum ssie_map_t : uint64_t |
SSIE block geometry (ra8_ssie_regs.h).
| Enumerator | |
|---|---|
| k_ssie_base | SSIE0 base. |
| k_ssie_stride | Bytes per SSIE channel. |
| k_ssie_count | SSIE0, SSIE1. |
| k_ssie_span | Ssie span. |
| k_ssie_regs | Shadowed 32-bit words per channel (0x00..0xFC). |
Definition at line 47 of file board_periph_ssie.c.
| enum ssie_off_t : uint64_t |
Per-channel register byte offsets (ra8_ssie_regs.h).
Definition at line 56 of file board_periph_ssie.c.
| enum ssie_order_t : uint32_t |
Per-tick order slot for the SSIE block (relative order only).
| Enumerator | |
|---|---|
| k_ssie_block_order | After the existing blocks; report order. |
Definition at line 73 of file board_periph_ssie.c.
|
static |
Register the SSIE block before main (host constructor).
Definition at line 228 of file board_periph_ssie.c.
References board_periph_register_block(), RA8_INTERNAL, and s_k_ssie_block.
|
static |
MMIO read inside the SSIE window: route to the addressed channel.
MMIO read inside the ssie window: route to the addressed channel; this step is contained within the board periph SSIE model and uses bounded caller or module-owned storage.
| [in,out] | uc | Unicorn engine whose emulated state is read or updated. |
| [in] | addr | Guest address involved in the operation. |
| [in] | size | Size of the requested region or access in bytes. |
| value | The operation-specific SSIE read value. |
Definition at line 116 of file board_periph_ssie.c.
References k_ssie_base, k_ssie_count, k_ssie_iirq, k_ssie_off_ssicr, k_ssie_off_ssifrdr, k_ssie_off_ssifsr, k_ssie_off_ssisr, k_ssie_regs, k_ssie_ren_ten, k_ssie_stride, k_ssie_tde, RA8_INTERNAL, ssie_state_t::reg, and s_ssie.
|
static |
End-of-run SSIE section: per-channel enable state + TX tally.
End-of-run ssie section: per-channel enable state + tx tally; this step is contained within the board periph SSIE model and uses bounded caller or module-owned storage.
Definition at line 189 of file board_periph_ssie.c.
References board_console_push(), k_board_console_ch_i2s, k_ssie_console_line_cap, k_ssie_count, k_ssie_off_ssicr, priv_emu_io_errf(), RA8_INTERNAL, and s_ssie.
|
static |
Reset all SSIE channel shadows to power-on (zeroed) state.
Reset all ssie channel shadows to power-on (zeroed) state; this step is contained within the board periph SSIE model and uses bounded caller or module-owned storage.
Definition at line 93 of file board_periph_ssie.c.
References k_ssie_count, k_ssie_regs, RA8_INTERNAL, and s_ssie.
|
static |
MMIO write inside the SSIE window: route to the addressed channel.
MMIO write inside the ssie window: route to the addressed channel; this step is contained within the board periph SSIE model and uses bounded caller or module-owned storage.
| [in,out] | uc | Unicorn engine whose emulated state is read or updated. |
| [in] | addr | Guest address involved in the operation. |
| [in] | size | Size of the requested region or access in bytes. |
| [in] | value | Register or payload value involved in the operation. |
Definition at line 158 of file board_periph_ssie.c.
References k_ssie_base, k_ssie_count, k_ssie_off_ssiftdr, k_ssie_regs, k_ssie_stride, ssie_state_t::reg, s_ssie, and ssie_state_t::tx_samples.
|
static |
SSIE block descriptor (self-registered with the core).
Definition at line 215 of file board_periph_ssie.c.
Referenced by internal_ssie_block_register().
|
static |
Definition at line 83 of file board_periph_ssie.c.
Referenced by internal_ssie_read(), internal_ssie_report(), internal_ssie_reset(), and internal_ssie_write().