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

src/-local shared surface for the ra8_sci driver TUs. More...

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

Go to the source code of this file.

Data Structures

struct  ra8_sci_state_t
 Per-channel dispatch state. More...

Enumerations

enum  ra8_sci_limits_inner_t : uint8_t {
  k_ra8_sci_channel_max_index = 9U ,
  k_ra8_sci_channel_count_val = 10U
}
 File-local bounds and channel-table sizing. More...

Variables

ra8_sci_state_t s_sci_state [k_ra8_sci_channel_count_val]
 Per-channel allocation + dispatch table.

Detailed Description

src/-local shared surface for the ra8_sci driver TUs.

Tag
[Ring 3 / HAL] {World: NS}

The SCI_B driver is split across two translation units that share a single per-channel dispatch table: ra8_sci.c (configuration, polling, attach, runtime reconfigure, async byte-stream) defines the table, while ra8_sci_dma_isr.c (DMA TX/RX descriptor build + ISR dispatch) consumes it. This private header carries the channel-count enum, the ra8_sci_state_t layout, and an extern declaration of the shared s_sci_state array so both TUs agree on the storage.

Not a public API: only the ra8_sci source files include this.

Since
0.1.0

Definition in file ra8_sci_internal.h.

Enumeration Type Documentation

◆ ra8_sci_limits_inner_t

enum ra8_sci_limits_inner_t : uint8_t

File-local bounds and channel-table sizing.

Shared between the two ra8_sci TUs so the channel index validation and the s_sci_state array sizing stay in lock-step.

Invariant
k_ra8_sci_channel_count_val == k_ra8_sci_channel_max_index + 1.
See also
s_sci_state
Since
0.1.0
Enumerator
k_ra8_sci_channel_max_index 

SCI0..SCI9.

k_ra8_sci_channel_count_val 

Total channels tracked.

Definition at line 49 of file ra8_sci_internal.h.

Variable Documentation

◆ s_sci_state

Per-channel allocation + dispatch table.

Per-channel allocation + dispatch table (defined in ra8_sci.c).

Canonical definition of the cross-TU dispatch table declared extern in ra8_sci_internal.h; ra8_sci_dma_isr.c reads and mutates the same storage from the ISR dispatch path.

The canonical storage lives in ra8_sci.c; ra8_sci_dma_isr.c references it through this extern declaration so the ISR dispatch path sees the same in-flight async TX/RX state the configuration path mutates.

Note
Not thread-safe by itself. Its async TX/RX fields are published and torn down by the mainline runtime APIs (ra8_sci_write / read / abort / read_stop / deinit / the attach_*_handler pair) from inside an ra8_register_guard PRIMASK critical section, and are also mutated from the TXI/RXI ISR dispatch path in ra8_sci_dma_isr.c. The critical section (cpsid i + a "memory" clobber) both serialises the read-modify-write against a same-core ISR and prevents the compiler from reordering the descriptor publish past the interrupt enable (#176 / T1-02). ra8_sci_init publishes the initial zeroed state during single-threaded bring-up, before the channel IRQ is armed.
Warning
Do not redefine; the single definition is owned by ra8_sci.c.
Since
0.1.0

Definition at line 94 of file ra8_sci.c.

Referenced by ra8_sci_abort(), ra8_sci_attach_rx_handler(), ra8_sci_attach_tx_handler(), ra8_sci_deinit(), ra8_sci_dispatch_rxi(), ra8_sci_dispatch_txi(), ra8_sci_init(), ra8_sci_read(), ra8_sci_read_stop(), and ra8_sci_write().