46static const char*
s_tag =
"SSIE";
73 if (!*want_tx && !*want_rx) {
107 .src = (uint32_t)(uintptr_t)dma->
tx_buffer,
108 .dst = (uint32_t)(uintptr_t)®->
SSIFTDR,
143 .src = (uint32_t)(uintptr_t)®->
SSIFRDR,
144 .dst = (uint32_t)(uintptr_t)dma->
rx_buffer,
228 if (reg ==
nullptr) {
232 bool want_tx =
false;
233 bool want_rx =
false;
289 if (reg ==
nullptr) {
295 while (sent < samples) {
318 if (reg ==
nullptr) {
323 for (uint16_t i = 0U; i < max_samples; ++i) {
static const char * s_tag
Logging / check tag.
Annotation-attribute framework macros for ra8-firmware.
#define RA8_INTERNAL
Marker that a function is intended to be static (file-local).
Validation and Error-Checking Macros for ra8-firmware.
#define RA8_RETURN_ON_ERROR(err, tag, message)
Early return on error, propagating the code upward.
#define RA8_CHECK_NULL_PTR(ptr, tag, message)
Reject nullptr pointer, returning k_ra8_err_null_ptr.
8-channel DMA controller (DMAC0) driver
@ k_ra8_dmac_width_word
32-bit transfers (DMTMD.SZ = 10b).
ra8_err_t ra8_dmac_stop(uint8_t channel)
Disable a DMAC0 channel and drop its MSTP reference.
ra8_err_t ra8_dmac_start(uint8_t channel, const ra8_dmac_config_t *cfg)
Programme and enable a DMAC0 channel.
Error Code Definitions for ra8-firmware.
@ k_ra8_err_invalid_arg
Invalid function argument.
@ 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.
Cross-translation-unit private helpers shared inside ra8_hal.
volatile r_ssie_regs_t * priv_ra8_ssie_internal_regs(uint8_t channel)
Validate an SSIE channel index and return its register block.
@ k_ra8_ssie_dma_ch_unused
Sentinel: no DMA channel.
@ k_ra8_ssie_dma_max_ch
DMAC channel count (0..7).
ra8_ssie_runtime_t g_ssie_runtime[k_ra8_ssie_channel_count]
Per-channel SSIE runtime state, shared across the ra8_ssie split.
Serial Sound Interface Enhanced (SSIE / I2S audio) driver.
Serial Sound Interface Enhanced (SSIE) register layout for the RA8D2.
@ k_ra8_ssie_shift_tdc
TDC[5:0] starts at bit 24.
@ k_ra8_ssie_shift_rdc
RDC[5:0] starts at bit 8.
@ k_ra8_ssie_channel_count
SSIE0 + SSIE1.
@ k_ra8_ssie_fifo_depth
32-stage FIFO per dir.
@ k_ra8_ssie_mask_tde_clear
Keep RDF while clearing TDE.
@ k_ra8_ssie_mask_rdf_clear
Keep TDE while clearing RDF.
@ k_ra8_ssie_mask_tdc
TDC[5:0] @ [29:24].
@ k_ra8_ssie_mask_rdc
RDC[5:0] @ [13:8].
static ra8_err_t internal_start_rx_dma(volatile r_ssie_regs_t *reg, uint8_t channel, const ra8_ssie_dma_cfg_t *dma)
Kick off the RX DMAC for an SSIE channel.
ra8_err_t ra8_ssie_detach_dma(uint8_t channel)
Tear down DMAC channels attached to the SSIE FIFOs.
static ra8_err_t internal_attach_dma_dirs(volatile r_ssie_regs_t *reg, uint8_t channel, const ra8_ssie_dma_cfg_t *dma, bool want_tx, bool want_rx)
Run the per-direction DMA setup (TX then RX) with rollback.
ra8_err_t ra8_ssie_attach_dma(uint8_t channel, const ra8_ssie_dma_cfg_t *dma)
Attach DMAC channels to the SSIE TX and/or RX FIFOs.
ra8_err_t ra8_ssie_send_iso(uint8_t channel, const uint32_t *buffer, uint16_t samples)
Block-mode isochronous send.
ra8_err_t ra8_ssie_attach_dma_pair(uint8_t channel, uint8_t tx_dma_channel, uint8_t rx_dma_channel)
Pair an SSIE channel's TX + RX FIFOs to DMAC channels.
static ra8_err_t internal_validate_dma_cfg(const ra8_ssie_dma_cfg_t *dma, bool *want_tx, bool *want_rx)
Validate the DMA-attach descriptor against TX/RX intent.
ra8_err_t ra8_ssie_recv_iso(uint8_t channel, uint32_t *buffer, uint16_t max_samples, uint16_t *out_got)
Block-mode isochronous receive.
static void internal_unwind_tx_dma(uint8_t channel, uint8_t tx_dma_channel)
Roll back a TX DMAC start when the RX side fails.
static ra8_err_t internal_start_tx_dma(volatile r_ssie_regs_t *reg, uint8_t channel, const ra8_ssie_dma_cfg_t *dma)
Kick off the TX DMAC for an SSIE channel.
Per-channel SSIE register window.
volatile uint32_t SSIFTDR
+0x18 Transmit FIFO data.
volatile uint32_t SSIFSR
+0x14 FIFO status register.
volatile uint32_t SSIFRDR
+0x1C Receive FIFO data.
DMAC channel configuration.
DMA pump descriptor for ra8_ssie_attach_dma.
uint8_t rx_dma_channel
DMAC channel to feed RX (>=8 = unused).
uint16_t rx_samples
RX sample count (must be > 0 if rx).
uint32_t * tx_buffer
Source buffer for TX (32-bit samples).
uint32_t * rx_buffer
Destination buffer for RX.
uint16_t tx_samples
TX sample count (must be > 0 if tx).
uint8_t tx_dma_channel
DMAC channel to drain TX (>=8 = unused).
Per-channel runtime bookkeeping.
uint8_t tx_dma_channel
DMAC channel pumping TX (or unused).
bool dma_attached
true after ra8_ssie_attach_dma.
uint8_t rx_dma_channel
DMAC channel pumping RX (or unused).