|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
Ethernet Message Forwarding Engine (MFWD) driver. More...
Go to the source code of this file.
Typedefs | |
| typedef void(* | ra8_eth_mfwd_event_fn_t) (void *ctx, uint32_t status_mask) |
| MFWD event callback. | |
Functions | |
| ra8_err_t | ra8_eth_mfwd_init (void) |
| Initialise the MFWD block (MSTP enable + reset regs). | |
| ra8_err_t | ra8_eth_mfwd_deinit (void) |
| Tear down the MFWD block. | |
| ra8_err_t | ra8_eth_mfwd_get_status (uint32_t *out_mask) |
| Read the MFWD_STS status register. | |
| ra8_err_t | ra8_eth_mfwd_clear_status (uint32_t mask) |
| Clear bits in MFWD_STS via MFWD_ICLR. | |
| ra8_err_t | ra8_eth_mfwd_attach_handler (ra8_eth_mfwd_event_fn_t fn, void *ctx) |
| Attach the shared event handler. | |
| void | ra8_eth_mfwd_dispatch (void) |
| Dispatch an MFWD event. | |
| ra8_err_t | ra8_eth_mfwd_enter_stop (void) |
| Put MFWD into MSTP-gated stop. | |
| ra8_err_t | ra8_eth_mfwd_exit_stop (void) |
| Exit MSTP-gated stop. | |
| ra8_err_t | ra8_eth_mfwd_set_forwarding_masks (const uint8_t port_masks[3]) |
| Program the per-port forwarding-destination masks (FWPBFC0). | |
| ra8_err_t | ra8_eth_mfwd_route_queue (uint8_t port, uint8_t queue_index) |
| Route inbound frames from a GMAC port into a GWCA RX queue. | |
Ethernet Message Forwarding Engine (MFWD) driver.
driver for the RA8D2 MFWD block. The MFWD sits between the GMAC ports and the CPU Agent (GWCA), making per-frame forwarding decisions (port-to-port, port-to-host, multicast). This driver covers lifecycle + status + IRQ + power transition; the per-frame forwarding-table programming surface lands with the first routing-aware consumer.
Definition in file ra8_eth_mfwd.h.
| typedef void(* ra8_eth_mfwd_event_fn_t) (void *ctx, uint32_t status_mask) |
MFWD event callback.
Definition at line 35 of file ra8_eth_mfwd.h.
|
nodiscard |
Attach the shared event handler.
Definition at line 81 of file ra8_eth_mfwd.c.
References k_ra8_ok, s_mfwd_ctx, and s_mfwd_fn.
|
nodiscard |
Clear bits in MFWD_STS via MFWD_ICLR.
Definition at line 72 of file ra8_eth_mfwd.c.
References k_ra8_ok, r_mfwd_regs_t::MFWD_ICLR, r_mfwd_regs_t::MFWD_STS, and ra8_mfwd().
|
nodiscard |
Tear down the MFWD block.
Definition at line 53 of file ra8_eth_mfwd.c.
References k_ra8_mstp_eswm, r_mfwd_regs_t::MFWD_CTRL, r_mfwd_regs_t::MFWD_IE, ra8_mfwd(), ra8_mstp_disable(), s_mfwd_ctx, and s_mfwd_fn.
| void ra8_eth_mfwd_dispatch | ( | void | ) |
Dispatch an MFWD event.
See implementation.
Definition at line 89 of file ra8_eth_mfwd.c.
References r_mfwd_regs_t::MFWD_ICLR, r_mfwd_regs_t::MFWD_STS, ra8_mfwd(), s_mfwd_ctx, and s_mfwd_fn.
|
nodiscard |
Put MFWD into MSTP-gated stop.
Definition at line 103 of file ra8_eth_mfwd.c.
References k_ra8_mstp_eswm, r_mfwd_regs_t::MFWD_CTRL, ra8_mfwd(), and ra8_mstp_disable().
|
nodiscard |
Exit MSTP-gated stop.
Definition at line 110 of file ra8_eth_mfwd.c.
References k_ra8_mstp_eswm, and ra8_mstp_enable().
|
nodiscard |
Read the MFWD_STS status register.
Definition at line 64 of file ra8_eth_mfwd.c.
References k_ra8_ok, r_mfwd_regs_t::MFWD_STS, RA8_CHECK_NULL_PTR, ra8_mfwd(), and s_tag.
Referenced by l3_program_forwarding().
|
nodiscard |
Initialise the MFWD block (MSTP enable + reset regs).
Definition at line 35 of file ra8_eth_mfwd.c.
References k_ra8_mstp_eswm, k_ra8_ok, r_mfwd_regs_t::MFWD_CTRL, r_mfwd_regs_t::MFWD_ICLR, r_mfwd_regs_t::MFWD_IE, r_mfwd_regs_t::MFWD_STS, ra8_log_info, ra8_mfwd(), ra8_mstp_enable(), RA8_RETURN_ON_ERROR, and s_tag.
Referenced by l3_arm().
|
nodiscard |
Route inbound frames from a GMAC port into a GWCA RX queue.
Programs MFWD.FWPBFCSDC0[port].PBCSD = queue_index so the forwarding engine knows where to deliver port-to-host frames. Without this call the GWCA RX queue stays empty even when frames arrive on the wire. Per FSP r_layer3_switch_StartDescriptorQueue this MUST be programmed after the GWCA queue is in OPERATION and before the MAC is allowed to receive.
| [in] | port | GMAC port index (0..1 on RA8D2). |
| [in] | queue_index | GWCA queue index that receives the frames (<= 31). |
| k_ra8_ok | Routing programmed. |
| k_ra8_err_invalid_arg | port > 1 or queue_index > 31. |
Definition at line 177 of file ra8_eth_mfwd.c.
References internal_mfwd_fwpbfcsdc(), k_ra8_err_invalid_arg, k_ra8_mfwd_max_port, k_ra8_mfwd_max_queue, k_ra8_mfwd_pbcsd_mask, k_ra8_ok, ra8_log_error, and s_tag.
Referenced by internal_open_gwca_path(), and l3_program_forwarding().
|
nodiscard |
Program the per-port forwarding-destination masks (FWPBFC0).
Sets MFWD.FWPBFC0[i].PBDV = mask for each port i in 0..2 (the two GMAC ports + the host/GWCA port). PBDV is a 7-bit bitmask of destination ports a frame received on this port is allowed to reach. Per FSP r_layer3_switch_open this must be programmed BEFORE the GWCA mode transitions (alongside FWPC10/11/12.DDE).
The simplest permissive setting is 0x7F (all destinations allowed) on every port – that lets wire-to-host RX flow through the switch without any L3 filtering.
| [in] | port_masks | Array of three masks: index 0 = port 0, index 1 = port 1, index 2 = host port. Caller-owned; only the values are read. |
| k_ra8_ok | Masks programmed. |
| k_ra8_err_null_ptr | port_masks is null. |
Definition at line 163 of file ra8_eth_mfwd.c.
References k_ra8_mfwd_base_addr, k_ra8_mfwd_fwpbfcsdc_stride, k_ra8_mfwd_off_fwpbfc0_base, k_ra8_mfwd_pbdv_mask, k_ra8_mfwd_port_count, k_ra8_ok, RA8_CHECK_NULL_PTR, and s_tag.
Referenced by internal_open_gwca_path(), and l3_program_forwarding().