62static const char*
s_tag =
"ETHA";
76typedef enum : uint32_t {
91typedef enum : uint32_t {
177 const uint16_t count = queues[queue].
count;
183 for (uint16_t index = 0U; index < count; ++index) {
189 total += (uint32_t)count;
227 uint32_t address = (uint32_t)base;
231 for (uint16_t index = 0U; index < queues[queue].
count; ++index) {
234 &queues[queue].entries[index]);
294 uint8_t initial_gate_states,
295 uint32_t cycle_time_ns,
315 uint8_t initial_gate_states,
316 uint32_t cycle_time_ns,
331 const uint32_t tasc = reg->
EATASC;
338 const bool already_enabled =
351 if (already_enabled) {
397 const uint32_t tasc = reg->
EATASC;
400 reg->
EATASC = (enable != 0U) ? (tasc | bit) : (tasc & ~bit);
static const char * s_tag
Logging / check tag.
Annotation-attribute framework macros for ra8-firmware.
#define RA8_LOOP_BOUND(ceiling)
NASA Power-of-10 Rule 2: bind ONE loop to a compile-time ceiling.
#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.
Error Code Definitions for ra8-firmware.
@ k_ra8_err_busy
Resource busy – blocking operation cannot proceed.
@ 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.
Per-port Ethernet Agent (ETHA) driver – HUM Ch 32 (p 1627-1702).
Cross-TU shared surface for the ra8_etha driver split.
static bool internal_port_ok(ra8_etha_port_t port)
Range-check a port argument.
Ethernet Agent (ETHA) per-port register layout for the RA8D2.
ra8_etha_port_t
ETHA port index (m = 0, 1).
@ k_ra8_etha_tc_count
Number of traffic classes per port.
@ k_ra8_etha_tas_entries_max
Max total entries across all queues.
static volatile r_etha_regs_t * ra8_etha(ra8_etha_port_t port)
Compile-time offset and size insurance for r_etha_regs_t.
@ k_ra8_etha_eatasc_tasca_pos
EATASC.TASCA[23:16].
@ k_ra8_etha_eatasc_tase_pos
EATASC.TASE.
@ k_ra8_etha_eatasc_tasci_pos
EATASC.TASCI.
@ k_ra8_etha_eatasc_tascc_pos
EATASC.TASCC.
@ k_ra8_etha_eatasglr_gl_pos
EATASGLR.GL: learn in progress.
@ k_ra8_etha_eatasrirm_tasriog_pos
EATASRIRM.TASRIOG: init ongoing.
@ k_ra8_etha_eatasgl1_tasgsl_pos
EATASGL1.TASGSL: entry gate state.
@ k_ra8_etha_eatasrirm_tasrr_pos
EATASRIRM.TASRR: TAS RAM ready.
@ k_ra8_etha_eatasgrr_gr_pos
EATASGRR.GR: read in progress.
@ k_ra8_etha_eatasgrr_tasgsr_pos
EATASGRR.TASGSR: read gate state.
@ k_ra8_etha_mask_tas_gal
EATASGL0.TASGAL[7:0].
@ k_ra8_etha_mask_tas_igs
EATASIGSC.TASIGS7..0.
@ k_ra8_etha_mask_tas_gtl
EATASGL1.TASGTL[27:0].
@ k_ra8_etha_mask_aen
EATASENC.TASAEN[8:0].
static ra8_err_t internal_tas_validate(const ra8_etha_tas_queue_t *queues)
Reject a schedule hardware could not hold before any of it is written.
static ra8_err_t internal_tas_learn_all(volatile r_etha_regs_t *reg, const ra8_etha_tas_queue_t *queues, uint8_t base)
Learn every queue's entries, laid out in queue order from base.
ra8_err_t ra8_etha_enable_tas(ra8_etha_port_t port, uint8_t enable)
Enable or disable the TAS scheduler (main switch).
ra8_err_t ra8_etha_tas_ram_reset(ra8_etha_port_t port)
Reset the TAS RAM and wait for it to report ready.
ra8_etha_tas_word_t
Word-width mask used when splitting the 64-bit cycle start time.
@ k_ra8_etha_tas_word_mask
All 32 bits of one register.
static void internal_tas_program_timing(volatile r_etha_regs_t *reg, const ra8_etha_tas_queue_t *queues, uint8_t initial_gate_states, uint32_t cycle_time_ns, uint64_t start_time)
Write the schedule's sizing and timing registers.
ra8_etha_tas_poll_t
Spin budgets for the two TAS flows that wait on hardware.
@ k_ra8_etha_tas_learn_spins
EATASGLR.GL / EATASGRR.GR budget.
@ k_ra8_etha_tas_ram_spins
EATASRIRM.TASRR budget.
static ra8_err_t internal_tas_learn_entry(volatile r_etha_regs_t *reg, uint8_t address, const ra8_etha_tas_entry_t *entry)
Learn one entry into the TAS RAM and wait for it to land.
ra8_err_t ra8_etha_set_tas_schedule(ra8_etha_port_t port, const ra8_etha_tas_queue_t *queues, uint8_t initial_gate_states, uint32_t cycle_time_ns, uint64_t start_time)
Programme the time-aware shaper (TAS / 802.1Qbv) gate lists.
ra8_err_t ra8_etha_read_tas_entry(ra8_etha_port_t port, uint8_t address, ra8_etha_tas_entry_t *out)
Read one TAS RAM entry back out of hardware.
Bounded wait-flag primitives for RA8D2 HAL drivers.
static ra8_err_t ra8_hw_wait_flag_set32(volatile const uint32_t *reg, uint32_t mask, uint32_t budget)
Spin until (*reg & mask) != 0 or budget runs out.
static ra8_err_t ra8_hw_wait_flag_clear32(volatile const uint32_t *reg, uint32_t mask, uint32_t budget)
Spin until (*reg & mask) == 0 or budget runs out.
Lightweight Logging Interface for ra8-firmware.
#define ra8_log_error(tag, message)
RA8 log error.
Full ETHA per-port register window (HUM Ch 32, FSP R_ETHA0_Type).
volatile uint32_t EATASENC[8]
+0x0320..0x033F TAS entry-num cfg.
volatile uint32_t EATASGLR
+0x03C8 TAS gate learn result.
volatile uint32_t EATASGR
+0x03D0 TAS gate read.
volatile uint32_t EATASCTC
+0x03B0 TAS cycle time configuration.
volatile uint32_t EATASIGSC
+0x0304 TAS initial gate state cfg.
volatile uint32_t EATASGL0
+0x03C0 TAS gate learn 0.
volatile uint32_t EATASCSTC0
+0x03A0 TAS cycle start time cfg lo.
volatile uint32_t EATASGL1
+0x03C4 TAS gate learn 1.
volatile uint32_t EATASRIRM
+0x03E4 TAS RAM-init register monitor.
volatile uint32_t EATASC
+0x0300 TAS configuration.
volatile uint32_t EATASGRR
+0x03D4 TAS gate read result.
volatile uint32_t EATASCSTC1
+0x03A4 TAS cycle start time cfg hi.
One TAS (802.1Qbv) RAM entry, exactly as HUM Table 32.6 defines it.
bool gate_open
TAS.GS – true opens this queue's gate.
uint32_t gate_time_ns
TAS.GT – entry duration in ns, 28 bits.
The gate-control list of one descriptor queue.
uint16_t count
Entries for this queue (EATASENCi).