|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
Per-port Ethernet Agent (ETHA) driver implementation – HUM Ch 32. More...
#include "ra8_etha.h"#include <stdint.h>#include "ra8_attributes.h"#include "ra8_check.h"#include "ra8_err.h"#include "ra8_etha_internal.h"#include "ra8_etha_regs.h"#include "ra8_ether_regs.h"#include "ra8_hw_err.h"#include "ra8_log.h"#include "ra8_mstp.h"#include "ra8_mstp_regs.h"Go to the source code of this file.
Enumerations | |
| enum | etha_field_t : uint32_t { k_etha_vem_mask = 0x7U } |
| EAVCC field constants. More... | |
| enum | ra8_etha_local_mask_t : uint32_t { k_ra8_etha_local_all_bits_set = 0xFFFFFFFFUL , k_ra8_etha_local_byte_mask = 0xFFU , k_ra8_etha_local_9bit_mask = 0x1FFUL } |
| Local mask helpers used inside this driver. More... | |
Functions | |
| static bool | internal_tc_ok (ra8_etha_tc_t tc) |
| Range-check a traffic-class argument. | |
| static bool | internal_irq_block_ok (ra8_etha_irq_class_t block) |
| Range-check an error-IRQ block index. | |
| ra8_err_t | ra8_etha_init (ra8_etha_port_t port, const ra8_etha_config_t *cfg) |
| Initialise an ETHA port (MSTP gate + reset registers + initial mode). | |
| ra8_err_t | ra8_etha_deinit (ra8_etha_port_t port) |
| Tear down an ETHA port (drop into RESET, mask all IRQs). | |
| ra8_err_t | ra8_etha_get_status (ra8_etha_port_t port, ra8_etha_status_t *out) |
| Read a port's status snapshot (mode + 3x error IRQ status + TAS). | |
| ra8_err_t | ra8_etha_clear_status (ra8_etha_port_t port, ra8_etha_irq_class_t block, uint32_t mask) |
| Clear bits in EAEIS0 / EAEIS1 / EAEIS2 via EAEIDx. | |
| ra8_err_t | ra8_etha_enable_irq (ra8_etha_port_t port, ra8_etha_irq_class_t block, uint32_t mask) |
| Atomically enable specific error IRQ bits in one of the three blocks. | |
| ra8_err_t | ra8_etha_disable_irq (ra8_etha_port_t port, ra8_etha_irq_class_t block, uint32_t mask) |
| Atomically disable specific error IRQ bits in one of the three blocks. | |
| ra8_err_t | ra8_etha_attach_handler (ra8_etha_port_t port, ra8_etha_event_fn_t cb, void *ctx) |
| Attach a per-port event handler. | |
| void | ra8_etha_dispatch (ra8_etha_port_t port) |
| Snapshot all three EAEISx, clear them, then fire the per-port handler. | |
| ra8_err_t | ra8_etha_enter_stop (ra8_etha_port_t port) |
| Drop an ETHA port into low-power stop (DISABLE mode). | |
| ra8_err_t | ra8_etha_exit_stop (ra8_etha_port_t port) |
| Bring an ETHA port back from low-power stop (OPERATION mode). | |
| ra8_err_t | ra8_etha_reset (ra8_etha_port_t port) |
| Software-reset the port: drop to RESET, then re-enter CONFIG. | |
| static ra8_err_t | internal_etha_wait_for_mode (ra8_etha_port_t port, volatile r_etha_regs_t *reg, ra8_etha_opc_t mode) |
| Busy-wait until EAMS.OPS catches up to the requested EAMC.OPC. | |
| ra8_err_t | ra8_etha_set_mode (ra8_etha_port_t port, ra8_etha_opc_t mode) |
| Issue an explicit EAMC mode-change command. | |
| ra8_err_t | ra8_etha_set_queue_arb (ra8_etha_port_t port, ra8_etha_tc_t tc, uint8_t arb) |
| Configure the per-traffic-class TX queue arbitration weight. | |
| ra8_err_t | ra8_etha_set_queue_depth (ra8_etha_port_t port, ra8_etha_tc_t tc, uint16_t depth) |
| Set the TX descriptor queue depth for one traffic class. | |
| ra8_err_t | ra8_etha_get_queue_level (ra8_etha_port_t port, ra8_etha_tc_t tc, uint16_t *cur_level, uint16_t *peak) |
| Read the current and high-water-mark queue level for one class. | |
| ra8_err_t | ra8_etha_set_preemption (ra8_etha_port_t port, uint8_t preempt, uint8_t cut_thru, ra8_etha_afs_t afs) |
| Configure 802.3br TX preemption: which classes are pre-emptable. | |
| ra8_err_t | ra8_etha_set_max_frame_size (ra8_etha_port_t port, ra8_etha_tc_t tc, uint16_t max_bytes) |
| Set the maximum frame size for one traffic class (jumbo OK). | |
| ra8_err_t | ra8_etha_set_ipv_remap (ra8_etha_port_t port, const uint8_t *map) |
| Programme the IPV (PCP-to-internal-priority) remap table. | |
| ra8_err_t | ra8_etha_set_vlan_mode (ra8_etha_port_t port, ra8_etha_vim_t vim, ra8_etha_vem_t vem) |
| Configure VLAN tag insertion / extraction for the port. | |
| ra8_err_t | ra8_etha_set_vlan_tag (ra8_etha_port_t port, const ra8_etha_vlan_tag_t *c_tag, const ra8_etha_vlan_tag_t *s_tag_in) |
| Programme the C-VLAN and S-VLAN tag values used on TX insertion. | |
| ra8_err_t | ra8_etha_set_rx_tag_filter (ra8_etha_port_t port, uint32_t mask) |
| Configure the RX tag filter (multicast group + VLAN-tag filter). | |
| ra8_err_t | ra8_etha_configure_cut_through (ra8_etha_port_t port, uint16_t qd, uint8_t dqd) |
| Configure the cut-through TX queue (low-latency forwarding). | |
| ra8_err_t | ra8_etha_configure_cbs (ra8_etha_port_t port, ra8_etha_tc_t tc, uint8_t enable, const ra8_etha_cbs_param_t *param) |
| Configure the credit-based shaper (CBS) for one traffic class. | |
| ra8_err_t | ra8_etha_get_cbs_state (ra8_etha_port_t port, ra8_etha_tc_t tc, uint8_t *enabled, uint8_t *gate_open, ra8_etha_cbs_param_t *oper_param) |
| Read the operational CBS gate-state vector + per-class oper params. | |
| ra8_err_t | ra8_etha_read_stats (ra8_etha_port_t port, ra8_etha_stats_t *out) |
| Read the per-port MIB error counters. | |
| ra8_err_t | ra8_etha_clear_stats (ra8_etha_port_t port) |
| Clear the per-port MIB error counters in hardware. | |
Variables | |
| static const char * | s_tag = "ETHA" |
| Logger tag used by every ra8_etha_* call. | |
| volatile uint32_t | g_ra8_etha_diag_last_eams [2] = {0U, 0U} |
| Last EAMS.OPS value observed during the CONFIG-mode poll. | |
| 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 implementation – HUM Ch 32.
Round-3 driver for the RA8D2 ETHA block (HUM Ch 32, p 1627-1702). ETHA is the per-port "Ethernet Agent" that bridges the L3 switch fabric (ESWM, ra8_eth.c, HUM Ch 29) and the per-port MAC (RMAC, ra8_rmac.c, HUM Ch 33).
Pipeline: ESWM (top, switch) -> ETHA (per-port agent, this file) -> RMAC (per-port MAC) -> off-chip PHY (bottom).
The shared MSTP gate k_ra8_mstp_eswm is reference-counted by ra8_mstp, so init/deinit interleave safely with the other ethernet sub-drivers.
Coverage in this round:
The time-aware shaper (TAS / 802.1Qbv) lives in ra8_etha_tas.c, which follows the manual's multi-step setting, learn and read flows.
Every register access carries a HUM Ch 32 citation naming the register it touches and the page that register is described on.
Definition in file ra8_etha.c.
| enum etha_field_t : uint32_t |
EAVCC field constants.
| Enumerator | |
|---|---|
| k_etha_vem_mask | 3-bit VLAN egress mode field. |
Definition at line 89 of file ra8_etha.c.
| enum ra8_etha_local_mask_t : uint32_t |
Local mask helpers used inside this driver.
Names the wide bit-clear / single-byte / 9-bit-field literal masks used by the ETHA driver. Keeps the source file free of bare magic numbers so clang-tidy is happy.
| Enumerator | |
|---|---|
| k_ra8_etha_local_all_bits_set | W1C-all helper. |
| k_ra8_etha_local_byte_mask | 8-bit field mask. |
| k_ra8_etha_local_9bit_mask | 9-bit field mask. |
Definition at line 102 of file ra8_etha.c.
|
static |
Busy-wait until EAMS.OPS catches up to the requested EAMC.OPC.
HUM Ch 32.3.1.2 "EAMS : Mode Status Register" p 1631 – bench-confirmed that EAMS.OPS lags EAMC.OPC by milliseconds while the state machine settles, and the OPERATION -> DISABLE -> CONFIG sequence inside ra8_eth_open silently drops the CONFIG write if the DISABLE step has not yet landed. Poll EAMS on every transition so each EAMC write commits before the next one is issued. Updates g_ra8_etha_diag_last_eams[port] on each iteration as a bench debug seam; reads are bounded by a 500 ms ms-scale budget.
| [in] | port | Port whose ETHA state machine to wait on. |
| [in] | reg | MMIO pointer to that port's ETHA register window. |
| [in] | mode | Mode the caller just wrote into EAMC.OPC. |
| k_ra8_ok | EAMS.OPS reached the requested mode in budget. |
| k_ra8_err_hw_timeout | EAMS.OPS never caught up; chip is stuck. |
< Ms budget.
< Inner.
Definition at line 456 of file ra8_etha.c.
References r_etha_regs_t::EAMS, g_ra8_etha_diag_last_eams, k_ra8_err_hw_timeout, k_ra8_etha_mask_ops, k_ra8_etha_opc_config, k_ra8_etha_opc_disable, k_ra8_ok, ra8_log_error, and s_tag.
Referenced by ra8_etha_set_mode().
|
inlinestatic |
Range-check an error-IRQ block index.
| [in] | block | Block index to validate. |
See the matching header declaration for the full contract; this site adds no behaviour beyond what the public API documents.
| k_ra8_ok | Success path. |
| k_ra8_err_invalid_arg | Caller violated a precondition. |
Definition at line 162 of file ra8_etha.c.
References k_ra8_etha_irq_class_count.
Referenced by ra8_etha_clear_status(), ra8_etha_disable_irq(), and ra8_etha_enable_irq().
|
inlinestatic |
Range-check a traffic-class argument.
| [in] | tc | Traffic class to validate. |
See the matching header declaration for the full contract; this site adds no behaviour beyond what the public API documents.
| k_ra8_ok | Success path. |
| k_ra8_err_invalid_arg | Caller violated a precondition. |
Definition at line 138 of file ra8_etha.c.
References k_ra8_etha_tc_count.
Referenced by ra8_etha_configure_cbs(), ra8_etha_get_cbs_state(), ra8_etha_get_queue_level(), ra8_etha_set_max_frame_size(), ra8_etha_set_queue_arb(), and ra8_etha_set_queue_depth().
|
nodiscard |
Attach a per-port event handler.
| [in] | port | Port identifier. |
| [in] | cb | Callback to fire from::ra8_etha_dispatch (may be nullptr to detach). |
| [in] | ctx | Opaque cookie passed back to cb. |
| k_ra8_ok | Handler attached / detached. |
| k_ra8_err_invalid_arg | port out of range. |
Definition at line 343 of file ra8_etha.c.
References internal_port_ok(), k_ra8_err_invalid_arg, k_ra8_ok, ra8_log_error, s_etha_slots, and s_tag.
|
nodiscard |
Clear the per-port MIB error counters in hardware.
| [in] | port | Port identifier. |
| k_ra8_ok | All five counters zeroed. |
| k_ra8_err_invalid_arg | port out of range. |
Definition at line 767 of file ra8_etha.c.
References r_etha_regs_t::EADQOECN, r_etha_regs_t::EADQSECN, r_etha_regs_t::EAFSECN, r_etha_regs_t::EATFECN, r_etha_regs_t::EAUSMFSECN, internal_port_ok(), k_ra8_err_invalid_arg, k_ra8_ok, ra8_etha(), ra8_log_error, and s_tag.
|
nodiscard |
Clear bits in EAEIS0 / EAEIS1 / EAEIS2 via EAEIDx.
| [in] | port | Port identifier. |
| [in] | block | Which error-interrupt block (0/1/2). |
| [in] | mask | Bit mask to write to EAEIDx. |
| k_ra8_ok | Bits cleared. |
| k_ra8_err_invalid_arg | port or block out of range. |
Definition at line 255 of file ra8_etha.c.
References r_etha_regs_t::EAEID0, r_etha_regs_t::EAEID1, r_etha_regs_t::EAEID2, r_etha_regs_t::EAEIS0, r_etha_regs_t::EAEIS1, r_etha_regs_t::EAEIS2, internal_irq_block_ok(), internal_port_ok(), k_ra8_err_invalid_arg, k_ra8_etha_irq_class_0, k_ra8_etha_irq_class_1, k_ra8_etha_irq_class_2, k_ra8_etha_irq_class_count, k_ra8_ok, ra8_etha(), ra8_log_error, and s_tag.
|
nodiscard |
Configure the credit-based shaper (CBS) for one traffic class.
| [in] | port | Port identifier. |
| [in] | tc | Traffic class (0..7). |
| [in] | enable | Non-zero -> set EACAEC.CEtc and EACC.CCtc. |
| [in] | param | Pointer to CBS parameters (increment + upper-limit). |
| k_ra8_ok | CBS programmed. |
| k_ra8_err_null_ptr | param is nullptr (when enable != 0). |
| k_ra8_err_invalid_arg | port, tc, or values out of range. |
Definition at line 680 of file ra8_etha.c.
References r_etha_regs_t::EACAEC, r_etha_regs_t::EACAIVC, r_etha_regs_t::EACAULC, r_etha_regs_t::EACC, ra8_etha_cbs_param_t::increment, internal_port_ok(), internal_tc_ok(), k_ra8_err_invalid_arg, k_ra8_etha_mask_civ, k_ra8_etha_mask_cul, k_ra8_ok, RA8_CHECK_NULL_PTR, ra8_etha(), ra8_log_error, s_tag, and ra8_etha_cbs_param_t::upper_lim.
Referenced by tsn_program_cbs().
|
nodiscard |
Configure the cut-through TX queue (low-latency forwarding).
| [in] | port | Port identifier. |
| [in] | qd | 16-bit cut-through queue depth in bytes (CTQD). |
| [in] | dqd | 4-bit cut-through descriptor queue depth (CTDQD). |
| k_ra8_ok | EACTQC + EACTDQDC updated. |
| k_ra8_err_invalid_arg | port out of range. |
Definition at line 666 of file ra8_etha.c.
References r_etha_regs_t::EACTDQDC, r_etha_regs_t::EACTQC, internal_port_ok(), k_ra8_err_invalid_arg, k_ra8_etha_mask_ctdqd, k_ra8_etha_mask_ctqd, k_ra8_ok, ra8_etha(), ra8_log_error, and s_tag.
|
nodiscard |
Tear down an ETHA port (drop into RESET, mask all IRQs).
| [in] | port | Port identifier. |
| k_ra8_ok | Port returned to RESET mode. |
| k_ra8_err_invalid_arg | port out of range. |
Definition at line 203 of file ra8_etha.c.
References r_etha_regs_t::EAEIE0, r_etha_regs_t::EAEIE1, r_etha_regs_t::EAEIE2, r_etha_regs_t::EAMC, internal_port_ok(), k_ra8_err_invalid_arg, k_ra8_etha_opc_reset, k_ra8_ok, ra8_etha(), ra8_log_error, s_etha_slots, and s_tag.
Referenced by main().
|
nodiscard |
Atomically disable specific error IRQ bits in one of the three blocks.
| [in] | port | Port identifier. |
| [in] | block | Which IRQ block. |
| [in] | mask | Bits to OR into the corresponding EAEIDx. |
| k_ra8_ok | IRQ bits disabled. |
| k_ra8_err_invalid_arg | port or block out of range. |
Definition at line 316 of file ra8_etha.c.
References r_etha_regs_t::EAEIE0, r_etha_regs_t::EAEIE1, r_etha_regs_t::EAEIE2, internal_irq_block_ok(), internal_port_ok(), k_ra8_err_invalid_arg, k_ra8_etha_irq_class_0, k_ra8_etha_irq_class_1, k_ra8_etha_irq_class_2, k_ra8_etha_irq_class_count, k_ra8_ok, ra8_etha(), ra8_log_error, and s_tag.
| void ra8_etha_dispatch | ( | ra8_etha_port_t | port | ) |
Snapshot all three EAEISx, clear them, then fire the per-port handler.
Reads the three Ethernet-A error/event status registers EAEIS0/1/2 (HUM Ch 32 "ETHA error / event status registers EAEISn", p ~1408) for the given port, atomically writes back the captured bits to acknowledge them, then invokes the handler installed via ra8_etha_attach_handler() with the snapshot mask. Out-of-range ports and missing handlers are silently ignored.
| [in] | port | Port identifier. Out-of-range silently ignored. |
Definition at line 355 of file ra8_etha.c.
References r_etha_regs_t::EAEID0, r_etha_regs_t::EAEID1, r_etha_regs_t::EAEID2, r_etha_regs_t::EAEIS0, r_etha_regs_t::EAEIS1, r_etha_regs_t::EAEIS2, internal_port_ok(), ra8_etha(), and s_etha_slots.
|
nodiscard |
Atomically enable specific error IRQ bits in one of the three blocks.
| [in] | port | Port identifier. |
| [in] | block | Which IRQ block. |
| [in] | mask | Bits to OR into the corresponding EAEIEx. |
| k_ra8_ok | IRQ bits enabled. |
| k_ra8_err_invalid_arg | port or block out of range. |
Definition at line 289 of file ra8_etha.c.
References r_etha_regs_t::EAEIE0, r_etha_regs_t::EAEIE1, r_etha_regs_t::EAEIE2, internal_irq_block_ok(), internal_port_ok(), k_ra8_err_invalid_arg, k_ra8_etha_irq_class_0, k_ra8_etha_irq_class_1, k_ra8_etha_irq_class_2, k_ra8_etha_irq_class_count, k_ra8_ok, ra8_etha(), ra8_log_error, and s_tag.
|
nodiscard |
Drop an ETHA port into low-power stop (DISABLE mode).
| [in] | port | Port identifier. |
| k_ra8_ok | Port placed in DISABLE mode. |
| k_ra8_err_invalid_arg | port out of range. |
Definition at line 390 of file ra8_etha.c.
References r_etha_regs_t::EAMC, internal_port_ok(), k_ra8_err_invalid_arg, k_ra8_etha_opc_disable, k_ra8_ok, ra8_etha(), ra8_log_error, and s_tag.
|
nodiscard |
Bring an ETHA port back from low-power stop (OPERATION mode).
| [in] | port | Port identifier. |
| k_ra8_ok | Port returned to OPERATION mode. |
| k_ra8_err_invalid_arg | port out of range. |
Definition at line 401 of file ra8_etha.c.
References r_etha_regs_t::EAMC, internal_port_ok(), k_ra8_err_invalid_arg, k_ra8_etha_opc_operation, k_ra8_ok, ra8_etha(), ra8_log_error, and s_tag.
|
nodiscard |
Read the operational CBS gate-state vector + per-class oper params.
| [in] | port | Port identifier. |
| [in] | tc | Traffic class (0..7). |
| [out] | enabled | Non-zero if oper-enable mirror bit is set. |
| [out] | gate_open | Non-zero if EACGSM gate-state bit is asserted. |
| [out] | oper_param | Live oper-side increment + upper-limit values. |
| k_ra8_ok | Snapshot returned. |
| k_ra8_err_null_ptr | any out pointer is nullptr. |
| k_ra8_err_invalid_arg | port or tc out of range. |
Definition at line 718 of file ra8_etha.c.
References r_etha_regs_t::EACGSM, r_etha_regs_t::EACOEM, r_etha_regs_t::EACOIVM, r_etha_regs_t::EACOULM, ra8_etha_cbs_param_t::increment, internal_port_ok(), internal_tc_ok(), k_ra8_err_invalid_arg, k_ra8_etha_mask_civ, k_ra8_etha_mask_cul, k_ra8_ok, RA8_CHECK_NULL_PTR, ra8_etha(), ra8_log_error, s_tag, and ra8_etha_cbs_param_t::upper_lim.
Referenced by tsn_program_cbs().
|
nodiscard |
Read the current and high-water-mark queue level for one class.
| [in] | port | Port identifier. |
| [in] | tc | Traffic class (0..7). |
| [out] | cur_level | Current pending-descriptor count (DNQ). |
| [out] | peak | Peak pending-descriptor count since last clear (DMLQ). |
| k_ra8_ok | Snapshot returned. |
| k_ra8_err_null_ptr | cur_level or peak is nullptr. |
| k_ra8_err_invalid_arg | port or tc out of range. |
Definition at line 534 of file ra8_etha.c.
References r_etha_regs_t::EATDQM, r_etha_regs_t::EATDQMLM, internal_port_ok(), internal_tc_ok(), k_ra8_err_invalid_arg, k_ra8_etha_mask_dnq, k_ra8_ok, RA8_CHECK_NULL_PTR, ra8_etha(), ra8_log_error, and s_tag.
|
nodiscard |
Read a port's status snapshot (mode + 3x error IRQ status + TAS).
| [in] | port | Port identifier. |
| [out] | out | Destination for the status snapshot. |
| k_ra8_ok | Snapshot populated. |
| k_ra8_err_null_ptr | out is nullptr. |
| k_ra8_err_invalid_arg | port out of range. |
Definition at line 228 of file ra8_etha.c.
References r_etha_regs_t::EAEIS0, ra8_etha_status_t::eaeis0, r_etha_regs_t::EAEIS1, ra8_etha_status_t::eaeis1, r_etha_regs_t::EAEIS2, ra8_etha_status_t::eaeis2, r_etha_regs_t::EAMS, r_etha_regs_t::EATASCTM, internal_port_ok(), k_ra8_err_invalid_arg, k_ra8_etha_mask_ops, k_ra8_ok, ra8_etha_status_t::ops, RA8_CHECK_NULL_PTR, ra8_etha(), ra8_log_error, s_tag, and ra8_etha_status_t::tas_cycle.
Referenced by tsn_log_status().
|
nodiscard |
Initialise an ETHA port (MSTP gate + reset registers + initial mode).
| [in] | port | Port identifier (k_ra8_etha_port_0 or _1). |
| [in] | cfg | Per-port configuration. Must not be nullptr. |
| k_ra8_ok | Port brought up in the requested mode. |
| k_ra8_err_null_ptr | cfg is nullptr. |
| k_ra8_err_invalid_arg | port out of range. |
Definition at line 167 of file ra8_etha.c.
References r_etha_regs_t::EAEID0, r_etha_regs_t::EAEID1, r_etha_regs_t::EAEID2, r_etha_regs_t::EAEIE0, ra8_etha_config_t::eaeie0_mask, r_etha_regs_t::EAEIE1, ra8_etha_config_t::eaeie1_mask, r_etha_regs_t::EAEIE2, ra8_etha_config_t::eaeie2_mask, r_etha_regs_t::EAMC, ra8_etha_config_t::initial_mode, internal_port_ok(), k_ra8_err_invalid_arg, k_ra8_etha_local_all_bits_set, k_ra8_etha_mask_opc, k_ra8_mstp_eswm, k_ra8_ok, RA8_CHECK_NULL_PTR, ra8_etha(), ra8_log_error, ra8_log_info, ra8_mstp_enable(), RA8_RETURN_ON_ERROR, s_etha_slots, and s_tag.
Referenced by internal_eth_loopback_run_once(), priv_ra8_board_eth_etha_to_config(), and tsn_arm().
|
nodiscard |
Read the per-port MIB error counters.
| [in] | port | Port identifier. |
| [out] | out | Snapshot of all five counter registers. |
| k_ra8_ok | Snapshot returned. |
| k_ra8_err_null_ptr | out is nullptr. |
| k_ra8_err_invalid_arg | port out of range. |
Definition at line 745 of file ra8_etha.c.
References r_etha_regs_t::EADQOECN, r_etha_regs_t::EADQSECN, r_etha_regs_t::EAFSECN, r_etha_regs_t::EATFECN, r_etha_regs_t::EAUSMFSECN, ra8_etha_stats_t::frame_size_err, internal_port_ok(), k_ra8_err_invalid_arg, k_ra8_etha_mask_mfs, k_ra8_ok, ra8_etha_stats_t::queue_overflow_err, ra8_etha_stats_t::queue_security_err, RA8_CHECK_NULL_PTR, ra8_etha(), ra8_log_error, s_tag, ra8_etha_stats_t::switch_min_frame_err, and ra8_etha_stats_t::tag_filter_err.
|
nodiscard |
Software-reset the port: drop to RESET, then re-enter CONFIG.
| [in] | port | Port identifier. |
| k_ra8_ok | Reset sequence issued. |
| k_ra8_err_invalid_arg | port out of range. |
Definition at line 412 of file ra8_etha.c.
References r_etha_regs_t::EAMC, internal_port_ok(), k_ra8_err_invalid_arg, k_ra8_etha_opc_config, k_ra8_etha_opc_reset, k_ra8_ok, ra8_etha(), ra8_log_error, and s_tag.
|
nodiscard |
Programme the IPV (PCP-to-internal-priority) remap table.
| [in] | port | Port identifier. |
| [in] | map | 8-entry array, each value 0..7. ipv_map[i] is the internal priority for incoming PCP=i. |
| k_ra8_ok | EAIRC packed and written. |
| k_ra8_err_null_ptr | map is nullptr. |
| k_ra8_err_invalid_arg | port out of range or any map[i] > 7. |
Definition at line 583 of file ra8_etha.c.
References r_etha_regs_t::EAIRC, internal_port_ok(), k_ra8_err_invalid_arg, k_ra8_etha_mask_ipv, k_ra8_etha_tc_count, k_ra8_ok, RA8_CHECK_NULL_PTR, ra8_etha(), ra8_log_error, and s_tag.
|
nodiscard |
Set the maximum frame size for one traffic class (jumbo OK).
| [in] | port | Port identifier. |
| [in] | tc | Traffic class (0..7). |
| [in] | max_bytes | Frame size limit in bytes (16-bit, 64..16383 typical). |
| k_ra8_ok | EATMFSC[tc] updated. |
| k_ra8_err_invalid_arg | port or tc out of range. |
Definition at line 572 of file ra8_etha.c.
References r_etha_regs_t::EATMFSC, internal_port_ok(), internal_tc_ok(), k_ra8_err_invalid_arg, k_ra8_etha_mask_mfs, k_ra8_ok, ra8_etha(), ra8_log_error, and s_tag.
|
nodiscard |
Issue an explicit EAMC mode-change command.
| [in] | port | Port identifier. |
| [in] | mode | Target mode (one of::ra8_etha_opc_t). |
| k_ra8_ok | Command written. |
| k_ra8_err_invalid_arg | port out of range. |
Definition at line 494 of file ra8_etha.c.
References r_etha_regs_t::EAMC, internal_etha_wait_for_mode(), internal_port_ok(), k_ra8_err_invalid_arg, k_ra8_etha_mask_opc, ra8_etha(), ra8_log_error, and s_tag.
Referenced by internal_bring_up_rmac(), internal_eth_etha_to_operation(), internal_eth_loopback_run_once(), internal_program_mpic(), and priv_ra8_board_eth_etha_to_config().
|
nodiscard |
Configure 802.3br TX preemption: which classes are pre-emptable.
| [in] | port | Port identifier. |
| [in] | preempt | Bit-mask of pre-emptable classes (bit q -> class q). |
| [in] | cut_thru | Non-zero -> set TTQ8 (cut-through path is pre-emptable). |
| [in] | afs | Additional fragment size policy (ra8_etha_afs_t). |
| k_ra8_ok | EATPEC updated. |
| k_ra8_err_invalid_arg | port out of range. |
Definition at line 555 of file ra8_etha.c.
References r_etha_regs_t::EATPEC, internal_port_ok(), k_ra8_err_invalid_arg, k_ra8_etha_eatpec_afs_pos, k_ra8_etha_local_byte_mask, k_ra8_ok, ra8_etha(), ra8_log_error, and s_tag.
|
nodiscard |
Configure the per-traffic-class TX queue arbitration weight.
| [in] | port | Port identifier. |
| [in] | tc | Traffic class (0..7). |
| [in] | arb | Arbitration weight (4-bit field, 0=lowest, 15=highest). |
| k_ra8_ok | Field updated. |
| k_ra8_err_invalid_arg | port, tc, or arb out of range. |
Definition at line 506 of file ra8_etha.c.
References r_etha_regs_t::EATDQAC, internal_port_ok(), internal_tc_ok(), k_ra8_err_invalid_arg, k_ra8_etha_mask_tdqa, k_ra8_ok, ra8_etha(), ra8_log_error, and s_tag.
|
nodiscard |
Set the TX descriptor queue depth for one traffic class.
| [in] | port | Port identifier. |
| [in] | tc | Traffic class (0..7). |
| [in] | depth | Queue depth in descriptors (11-bit field, 1..2047). |
| k_ra8_ok | EATDQDC[tc] updated. |
| k_ra8_err_invalid_arg | port, tc, or depth out of range. |
Definition at line 523 of file ra8_etha.c.
References r_etha_regs_t::EATDQDC, internal_port_ok(), internal_tc_ok(), k_ra8_err_invalid_arg, k_ra8_etha_mask_dqd, k_ra8_ok, ra8_etha(), ra8_log_error, and s_tag.
|
nodiscard |
Configure the RX tag filter (multicast group + VLAN-tag filter).
| [in] | port | Port identifier. |
| [in] | mask | Bit mask written verbatim to EARTFC. Bit positions follow HUM Ch 32 EARTFC: NT, RT, CST, CSRT, CT, CRT, SCT, SCRT, UT. |
| k_ra8_ok | EARTFC = mask. |
| k_ra8_err_invalid_arg | port out of range. |
Definition at line 655 of file ra8_etha.c.
References r_etha_regs_t::EARTFC, internal_port_ok(), k_ra8_err_invalid_arg, k_ra8_etha_local_9bit_mask, k_ra8_ok, ra8_etha(), ra8_log_error, and s_tag.
|
nodiscard |
Configure VLAN tag insertion / extraction for the port.
| [in] | port | Port identifier. |
| [in] | vim | Insertion mode (ra8_etha_vim_t). |
| [in] | vem | Extraction mode (ra8_etha_vem_t). |
| k_ra8_ok | EAVCC updated. |
| k_ra8_err_invalid_arg | port out of range. |
Definition at line 609 of file ra8_etha.c.
References r_etha_regs_t::EAVCC, internal_port_ok(), k_etha_vem_mask, k_ra8_err_invalid_arg, k_ra8_etha_eavcc_vem_pos, k_ra8_ok, ra8_etha(), ra8_log_error, and s_tag.
|
nodiscard |
Programme the C-VLAN and S-VLAN tag values used on TX insertion.
| [in] | port | Port identifier. |
| [in] | c_tag | C-VLAN tag (inner). Pointer to descriptor. |
| [in] | s_tag_in | S-VLAN tag (outer). Pointer to descriptor. |
| k_ra8_ok | EAVTC packed and written. |
| k_ra8_err_null_ptr | c_tag or s_tag is nullptr. |
| k_ra8_err_invalid_arg | port out of range or vid/pcp out of range. |
Definition at line 623 of file ra8_etha.c.
References ra8_etha_vlan_tag_t::dei, r_etha_regs_t::EAVTC, internal_port_ok(), k_ra8_err_invalid_arg, k_ra8_etha_eavtc_ctd_pos, k_ra8_etha_eavtc_ctp_pos, k_ra8_etha_eavtc_ctv_pos, k_ra8_etha_eavtc_std_pos, k_ra8_etha_eavtc_stp_pos, k_ra8_etha_eavtc_stv_pos, k_ra8_etha_mask_vlan_dei, k_ra8_etha_mask_vlan_pcp, k_ra8_etha_mask_vlan_vid, k_ra8_ok, ra8_etha_vlan_tag_t::pcp, RA8_CHECK_NULL_PTR, ra8_etha(), ra8_log_error, s_tag, and ra8_etha_vlan_tag_t::vid.
| volatile uint32_t g_ra8_etha_diag_last_eams[2] = {0U, 0U} |
Last EAMS.OPS value observed during the CONFIG-mode poll.
Bench-only debug seam. Indexed by ETHA port (0 / 1). Read via JLink memprobe to confirm what state the chip's ETHA state machine actually reaches when ra8_etha_set_mode polls for CONFIG.
Definition at line 86 of file ra8_etha.c.
Referenced by internal_etha_wait_for_mode().
| ra8_etha_slot_t s_etha_slots[k_ra8_etha_port_count] |
Per-port handler table; index = ra8_etha_port_t.
Defined here and shared with the statistics TU (ra8_etha_stats.c) via the extern declaration in ra8_etha_internal.h.
Backing store for the per-port callback, cookie, and counter state. Defined once in ra8_etha.c and referenced from the split-out statistics TU via this declaration.
Definition at line 117 of file ra8_etha.c.
Referenced by ra8_etha_account_traffic(), ra8_etha_attach_handler(), ra8_etha_deinit(), ra8_etha_descriptor_ring_init(), ra8_etha_dispatch(), ra8_etha_get_stats(), and ra8_etha_init().
|
static |
Logger tag used by every ra8_etha_* call.
TU-local read-only logger tag. The statistics TU (ra8_etha_stats.c) keeps its own identical copy; the string is immutable so duplicating it avoids cross-TU external linkage.
Definition at line 72 of file ra8_etha.c.