38static const char*
s_tag =
"SCI";
109 uint8_t* out_dma_channel)
122 (uintptr_t)®->
TDR,
139 uint8_t* out_dma_channel)
169 if (reg ==
nullptr) {
184 reg->
TDR = (uint32_t)
byte;
190 (void)cb(ctx, &echo);
210 if (cb(ctx, &
byte)) {
212 reg->
TDR = (uint32_t)
byte;
225 if (reg ==
nullptr) {
static const char * s_tag
Logging / check tag.
Annotation-attribute framework macros for ra8-firmware.
#define RA8_ISR_SAFE
The function is callable from interrupt context.
#define RA8_INTERNAL
Marker that a function is intended to be static (file-local).
Validation and Error-Checking Macros for ra8-firmware.
#define RA8_CHECK_NULL_PTR(ptr, tag, message)
Reject nullptr pointer, returning k_ra8_err_null_ptr.
Generic DMA transfer substrate (DMAC engine).
ra8_err_t ra8_dma_request(const ra8_dma_request_t *req, uint8_t *out_channel)
Allocate a DMAC channel, programme it, and start the trigger wiring.
void(* ra8_dma_complete_fn_t)(void *ctx)
Caller-supplied completion callback.
8-channel DMA controller (DMAC0) driver
@ k_ra8_dmac_width_byte
8-bit transfers (DMTMD.SZ = 00b).
ra8_elc_event_t
Partial list of ELC events (populate as drivers need them).
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.
ra8_sci_state_t s_sci_state[k_ra8_sci_channel_count_val]
Per-channel allocation + dispatch table.
Full-featured Serial Communications Interface driver.
bool(* ra8_sci_tx_fn_t)(void *ctx, uint8_t *byte)
TX-empty interrupt callback signature.
ra8_err_t ra8_sci_clear_errors(uint8_t channel)
Clear the SSR error flags via write-zero.
void(* ra8_sci_rx_fn_t)(void *ctx, uint8_t byte)
RX interrupt callback signature.
ra8_err_t ra8_sci_write_dma(uint8_t channel, const uint8_t *data, uint16_t len, ra8_dma_complete_fn_t on_complete, void *ctx, uint8_t *out_dma_channel)
Kick off a DMA-backed TX transfer.
static ra8_dma_request_t internal_make_dma_request(uintptr_t src, uintptr_t dst, uint16_t len, bool src_inc, bool dst_inc, ra8_dma_complete_fn_t on_complete, void *ctx)
void ra8_sci_dispatch_eri(uint8_t channel)
ERI dispatch – clear SSR error flags, invoke optional error callback (none in reserved for 3....
ra8_err_t ra8_sci_read_dma(uint8_t channel, uint8_t *out_buf, uint16_t len, ra8_dma_complete_fn_t on_complete, void *ctx, uint8_t *out_dma_channel)
Kick off a DMA-backed RX transfer.
static ra8_err_t internal_dma_args_ok(const volatile r_sci_regs_t *reg, uint16_t len)
Report whether a DMA entry point's channel register and length are usable.
void ra8_sci_dispatch_rxi(uint8_t channel)
RXI dispatch – hand a received byte to the RX callback.
void ra8_sci_dispatch_txi(uint8_t channel)
TXI dispatch – advance the TX callback.
src/-local shared surface for the ra8_sci driver TUs.
@ k_ra8_sci_channel_max_index
SCI0..SCI9.
SCI_B (Serial Communication Interface, B variant) register layoutfor the RA8D2.
static volatile r_sci_regs_t * ra8_sci(uint8_t channel)
Get pointer to SCI_B channel N (0..9).
@ k_ra8_sci_ccr0_bit_tie
Transmit Interrupt Enable.
@ k_ra8_sci_ccr0_bit_rie
Receive Interrupt Enable.
@ k_ra8_sci_rdr_mask_data8
RDAT[7:0] for 8-bit reception.
Per-channel SCI_B register window.
volatile uint32_t RDR
+0x00 Receive Data.
volatile uint32_t TDR
+0x04 Transmit Data.
volatile uint32_t CCR0
+0x08 Common Control 0.
Descriptor for a single DMA transfer.
ra8_dma_complete_fn_t on_complete
On complete.
uintptr_t dst_addr
Dst address.
ra8_dmac_width_t width
Width.
uintptr_t src_addr
Src address.
ra8_elc_event_t trigger
Trigger.