137typedef enum : uint8_t {
207typedef enum : uint16_t {
466[[nodiscard]]
ra8_err_t ra8_eth_test_inject_rx(
const uint8_t* payload, uint32_t len);
Error Code Definitions for ra8-firmware.
ra8_err_codes_t ra8_err_t
Canonical error-return type used by every ra8-firmware API.
void(* ra8_eth_event_fn_t)(void *ctx, uint32_t status_mask)
Ethernet switch event callback.
ra8_err_t ra8_eth_enter_stop(void)
Put the ethernet switch into MSTP-gated stop.
ra8_err_t ra8_eth_get_status(uint32_t *out_mask)
Read the ESWM_STS status register.
ra8_err_t ra8_eth_close(void)
Close the NIC: gate clocks and idle the descriptor rings.
ra8_eth_mii_port_t
ESWM media-interface port selector (m = 0, 1).
@ k_ra8_eth_mii_port_0
ESWM media port 0 (RMAC0 / ETHA0).
@ k_ra8_eth_mii_port_1
ESWM media port 1 (RMAC1 / ETHA1).
@ k_ra8_eth_mii_port_count
Number of media-interface ports.
ra8_err_t ra8_eth_get_stats(ra8_eth_stats_t *out_stats)
Read the NIC software counters.
ra8_err_t ra8_eth_exit_stop(void)
Exit MSTP-gated stop.
void ra8_eth_dispatch(void)
Dispatch an ESWM event – snapshot + fire callback.
ra8_err_t ra8_eth_write(const uint8_t *buf, uint32_t len)
Transmit a frame through the GWCA TX queue.
ra8_err_t ra8_eth_link_status(ra8_eth_link_t *out_status)
Query the PHY link state via MIIM (RMAC MDIO Clause-22).
ra8_eth_limits_t
Compile-time NIC ring sizing constants.
@ k_ra8_eth_buf_size
Per-descriptor buffer size in bytes.
@ k_ra8_eth_max_frame
Maximum 802.3 untagged frame.
@ k_ra8_eth_num_rx_desc
Number of RX descriptors in the ring.
@ k_ra8_eth_desc_align
Descriptor / buffer alignment in bytes.
@ k_ra8_eth_mac_len
Length of an Ethernet MAC address.
@ k_ra8_eth_num_tx_desc
Number of TX descriptors in the ring.
@ k_ra8_eth_min_frame
Minimum 802.3 frame (excl.
ra8_err_t ra8_eth_open(const ra8_eth_cfg_t *cfg)
Open the NIC: bring up the controller stack and the descriptor rings.
void ra8_eth_attach_handler(ra8_eth_event_fn_t fn, void *ctx)
Replace the shared Ethernet event callback.
ra8_err_t ra8_eth_deinit(void)
Tear down the ESWM block.
ra8_err_t ra8_eth_rgmii_select(ra8_eth_mii_port_t port)
Select RGMII on a port's ESWM media-interface mux and enable it.
ra8_err_t ra8_eth_init(void)
Initialise the ESWM block (MSTP enable + reset regs).
ra8_err_t ra8_eth_read(uint8_t *buf, uint32_t max_len, uint32_t *got_len)
Pop the next received frame from the RX descriptor ring.
ra8_err_t ra8_eth_clear_status(uint32_t mask)
Clear bits in ESWM_STS via ESWM_ICLR.
Per-channel NIC configuration.
uint16_t buffer_size
Buffer size per descriptor.
uint8_t mac_address[6]
Local MAC address (octets 0..5).
uint8_t channel
Logical channel index (0..1).
uint16_t num_tx_descriptors
Active TX descriptors (<=8, 0=def).
uint16_t num_rx_descriptors
Active RX descriptors (<=8, 0=def).
uint16_t bmsr
Raw BMSR (PHY register 0x01) snapshot.
uint8_t full_duplex
1 if full duplex, 0 if half.
uint16_t speed_mbps
Negotiated PHY speed (10/100/1000).
uint8_t link_up
1 if BMSR.LINK_STATUS asserted, else 0.
uint32_t rx_ok
Frames successfully received.
uint32_t tx_ok
Frames successfully enqueued.
uint32_t rx_err
RX failures (no data, etc.).
uint32_t tx_err
TX failures (ring full, etc.).