48static const char*
s_tag =
"ETHA";
54typedef enum : uint16_t {
109 if (inc > (UINT32_MAX - base)) {
118 uint16_t buffer_size)
130 s_etha_slots[(uint8_t)channel].stats.ring_buf = buffer_size;
135 uint16_t depth = num_tx;
201 enum : uint32_t { k_ra8_etha_mode_spin = 200000U };
206 for (uint32_t i = 0U; i < (uint32_t)k_ra8_etha_mode_spin; ++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_CHECK_NULL_PTR(ptr, tag, message)
Reject nullptr pointer, returning k_ra8_err_null_ptr.
Error Code Definitions for ra8-firmware.
@ k_ra8_err_invalid_arg
Invalid function argument.
@ k_ra8_err_hw_timeout
Hardware timed out waiting for a flag or handshake.
@ 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_etha_slot_t s_etha_slots[k_ra8_etha_port_count]
Per-port handler table; index = ra8_etha_port_t.
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_opc_operation
Enter OPERATION mode.
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_mask_dqd
EATDQDCq.DQD[10:0].
@ k_ra8_etha_mask_ops
EAMS.OPS[1:0].
static bool internal_ring_args_ok(uint16_t num_tx, uint16_t num_rx, uint16_t buffer_size)
Validate descriptor-ring sizing.
ra8_err_t ra8_etha_account_traffic(ra8_etha_port_t channel, uint32_t tx_ok, uint32_t tx_err, uint32_t rx_ok, uint32_t rx_err, uint32_t rx_drop)
Increment the per-port TX OK / TX err / RX OK / RX err / drop counters.
ra8_etha_ring_limits_t
Bound checks for ra8_etha_descriptor_ring_init arguments.
@ k_ra8_etha_ring_buf_min
IEEE 802.3 minimum frame.
@ k_ra8_etha_ring_buf_max
14-bit frame-size field cap.
@ k_ra8_etha_ring_count_max
Maximum descriptor ring depth.
@ k_ra8_etha_ring_count_min
Minimum descriptor ring depth.
static ra8_err_t internal_etha_to_operation(ra8_etha_port_t channel)
Transition ETHA channel into OPERATION and wait for EAMS.
ra8_err_t ra8_etha_open(ra8_etha_port_t channel, const ra8_etha_phy_open_t *phy, ra8_rmac_phy_link_t *out_link)
Bring an ETHA port + its off-chip PHY up to OPERATION mode.
ra8_err_t ra8_etha_descriptor_ring_init(ra8_etha_port_t channel, uint16_t num_tx, uint16_t num_rx, uint16_t buffer_size)
Configure the per-port descriptor-ring sizing.
static uint32_t internal_sat_add_u32(uint32_t base, uint32_t inc)
Saturating-add helper for the per-port traffic counters.
ra8_err_t ra8_etha_get_stats(ra8_etha_port_t channel, ra8_etha_port_stats_t *out_stats)
Snapshot the per-port software-maintained traffic counters.
Lightweight Logging Interface for ra8-firmware.
#define ra8_log_error(tag, message)
RA8 log error.
ra8_err_t ra8_rmac_phy_set_advertise(ra8_rmac_port_t port, uint8_t phy_addr, uint16_t capabilities)
Program the off-chip PHY's auto-negotiation advertisement.
ra8_err_t ra8_rmac_phy_auto_neg_start(ra8_rmac_port_t port, uint8_t phy_addr)
Kick off (or restart) auto-negotiation on the off-chip PHY.
ra8_err_t ra8_rmac_phy_reset(ra8_rmac_port_t port, uint8_t phy_addr)
Software-reset an off-chip PHY via Clause-22 MDIO.
ra8_err_t ra8_rmac_phy_auto_neg_wait(ra8_rmac_port_t port, uint8_t phy_addr, uint32_t timeout_ms, ra8_rmac_phy_link_t *out_link)
Block (with a bounded poll) until the PHY reports AN_COMPLETE.
ra8_rmac_port_t
RMAC port index (m = 0, 1).
Full ETHA per-port register window (HUM Ch 32, FSP R_ETHA0_Type).
volatile uint32_t EAMC
+0x0000 Mode command.
volatile uint32_t EATDQDC[8]
+0x0060..0x007F Per-class queue depth.
volatile uint32_t EAMS
+0x0004 Mode status.
PHY auto-negotiation parameters for ra8_etha_open.
uint32_t timeout_ms
Auto-neg wait timeout (0 = internal cap).
uint16_t advertise
OR of ra8_rmac_phy_advert_t bits.
uint8_t phy_addr
MDIO address of the off-chip PHY (0..31).
Per-port runtime traffic counters maintained by ra8_etha.
uint32_t tx_ok
Frames transmitted successfully.
uint32_t rx_drop
Frames dropped due to ring overflow.
uint32_t tx_err
Frames that failed to transmit.
uint32_t rx_ok
Frames received successfully.
uint32_t rx_err
Frames received with PHY/MAC/FCS error.
Resolved PHY link status snapshot.