|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
Ethernet MAC (RMAC) per-port register layout for the RA8D2. More...
Go to the source code of this file.
Data Structures | |
| struct | r_rmac_regs_t |
| Full RMAC per-port register window (HUM Ch 33.3, FSP R_RMAC0_Type). More... | |
Functions | |
| static volatile r_rmac_regs_t * | ra8_rmac (ra8_rmac_port_t port) |
| Compile-time check that the RMAC register window matches FSP. | |
Ethernet MAC (RMAC) per-port register layout for the RA8D2.
RMAC is the per-port Ethernet MAC block. One RMAC instance exists per Ethernet port (m = 0, 1) and the two instances are mapped 0x2000 apart, interleaved with the matching ETHA instance:
ETHA0 = 0x403C_A000 RMAC0 = 0x403C_B000 ETHA1 = 0x403C_C000 RMAC1 = 0x403C_D000
The base address constants live in ra8_ether_regs.h; this file only adds the per-port register window struct, the bit-field enums, and the register-window accessor used by the per-port driver in libs/ra8_hal/src/ra8_rmac.c.
The layout is derived against the FSP CMSIS RA8D2 header R7KA8D2KF_core0.h for the R_RMAC0_Type structure (Size = 0x530). Every offset has been cross-checked against HUM Ch 33.3 Table 33.4.
The full register surface is exposed: PHY MDIO (MPSM/MPIC/MPIM), I/O configuration (MIOC), TX frame format / pause / PFC config (MTFFC/MTPFC/MTPFC2/MTPFC3t), TX timestamp config (MTATCt/MTIM), RX general / address / filter / storm / size / PTP-filter / pause monitoring (MRGC/MRMAC0/1/MRAFC/MRSCE/P/MRSCC/MRFSCE/P/MTRC/MRPFM/ MPFCt), link verification (MLVC), Energy Efficient Ethernet (MEEEC), loopback (MLBC), 10G XGMII config + auto-negotiation (MXGMIIC/MPCH/MANM), error and monitoring interrupt status/enable/disable (MEIS/MEIE/MEID, MMIS0..2/MMIE0..2/MMID0..2), and the full statistic counter block (MMPFTCT..MTXBCPL).
PTP timestamping itself stays in ra8_eth_gptp – this header exposes the per-frame TX-capture filter table (MPFCt) so RMAC can flag PTP frames to the GPTP block, but the timestamp counters are owned by the GPTP driver.
Definition in file ra8_rmac_regs.h.
| enum ra8_rmac_duplex_t : uint8_t |
Duplex selection (programmed via MPIC.PIPP / MPIC.PIP).
| Enumerator | |
|---|---|
| k_ra8_rmac_duplex_half | Half duplex. |
| k_ra8_rmac_duplex_full | Full duplex. |
Definition at line 326 of file ra8_rmac_regs.h.
| enum ra8_rmac_lsc_t : uint8_t |
Link-speed selector for MPIC.LSC[5:3] (HUM Ch 33.4).
Definition at line 313 of file ra8_rmac_regs.h.
| enum ra8_rmac_mac_byte_idx_t : uint8_t |
Byte indices into a 6-byte MAC address (network byte order).
Definition at line 89 of file ra8_rmac_regs.h.
| enum ra8_rmac_mac_len_t : uint8_t |
Length of an Ethernet MAC address in bytes.
Six-byte / 48-bit IEEE 802 MAC address, split across MRMAC0 (high 16 bits in MAU field) and MRMAC1 (low 32 bits in MAL field) per HUM Ch 33.4.
| Enumerator | |
|---|---|
| k_ra8_rmac_mac_byte_count | Bytes in a unicast MAC. |
Definition at line 81 of file ra8_rmac_regs.h.
| enum ra8_rmac_mask_t : uint32_t |
Bit masks used across the RMAC register surface.
Definition at line 130 of file ra8_rmac_regs.h.
| enum ra8_rmac_mdio_op_t : uint8_t |
MPSM.POP[14:13] PHY MDIO operation selector.
For Clause-22 access the encoding maps to "read" / "write". For Clause-45 access the encoding additionally selects "address frame" vs "post-read-incr" – the driver wraps the lower-level operations into ra8_rmac_mdio_c45_* helpers.
Definition at line 341 of file ra8_rmac_regs.h.
| enum ra8_rmac_meeec_bit_t : uint32_t |
MEEEC Energy-Efficient-Ethernet bits.
| Enumerator | |
|---|---|
| k_ra8_rmac_meeec_lpitr | LPI transmit request. |
Definition at line 502 of file ra8_rmac_regs.h.
| enum ra8_rmac_meis_bit_t : uint32_t |
Per-bit names inside MEIS / MEIE / MEID (HUM Ch 33.4).
Definition at line 389 of file ra8_rmac_regs.h.
| enum ra8_rmac_mlbc_bit_t : uint32_t |
MLBC loopback bits (HUM Ch 33.4).
| Enumerator | |
|---|---|
| k_ra8_rmac_mlbc_lbme | Loopback mode enable. |
Definition at line 494 of file ra8_rmac_regs.h.
| enum ra8_rmac_mlvc_bit_t : uint32_t |
MLVC link-verification bits.
| Enumerator | |
|---|---|
| k_ra8_rmac_mlvc_pase | PHY auto-startup enable. |
| k_ra8_rmac_mlvc_plv | Perform link verification. |
Definition at line 519 of file ra8_rmac_regs.h.
| enum ra8_rmac_mmis0_bit_t : uint32_t |
MMIS0 monitoring-IRQ bits (HUM Ch 33.4).
Definition at line 420 of file ra8_rmac_regs.h.
| enum ra8_rmac_mmis1_bit_t : uint32_t |
MMIS1 PHY-station-management completion bits.
Definition at line 438 of file ra8_rmac_regs.h.
| enum ra8_rmac_mmis2_bit_t : uint32_t |
MMIS2 wake-on-LAN / EEE bits.
| Enumerator | |
|---|---|
| k_ra8_rmac_mmis2_mpdis | Magic-packet detect. |
| k_ra8_rmac_mmis2_lpiais | LPI assert IRQ. |
| k_ra8_rmac_mmis2_lpidis | LPI de-assert IRQ. |
Definition at line 463 of file ra8_rmac_regs.h.
| enum ra8_rmac_mpim_bit_t : uint32_t |
MPIM PHY-monitoring bits.
| Enumerator | |
|---|---|
| k_ra8_rmac_mpim_pls | PHY link status. |
| k_ra8_rmac_mpim_lpia | LPI active. |
Definition at line 510 of file ra8_rmac_regs.h.
| enum ra8_rmac_mpsm_bit_t : uint32_t |
MPSM (PHY Station Management Register) control bits.
HUM Ch 33.4.1.1 "MPSM" p 1707. PSME is the start/busy flag: software writes 1 to launch a PHY register transaction and the hardware self-clears it to 0 on completion. Writes to MPSM while PSME is asserted "have no effect" (HUM Note 2), so the driver must drain PSME to 0 before issuing a new transaction.
| Enumerator | |
|---|---|
| k_ra8_rmac_mpsm_psme | PHY Station Management Enable / busy. |
Definition at line 455 of file ra8_rmac_regs.h.
| enum ra8_rmac_mrafc_t : uint32_t |
MRAFC reception address filter mode bits (HUM Ch 33.4).
Bit layout (HUM Ch 33.4 "MRAFC : MAC Reception Address Filter Configuration Register" p 1707):
The MAC's receive filter passes a frame only when BOTH halves accept it: the hash-class enable AND the corresponding perfect-match enable. FSP's r_rmac.c::rmac_configure_reception_filter (commit 8b3f2c1) always programs the two halves in lockstep – e.g. enabling broadcast sets BCENE | BCENP together; enabling unicast sets UCENE | UCENP together. Setting only the low half silently drops every frame on real silicon.
To make the public enum impossible to misuse, the three primary class-enable constants below already bundle their high-half twin (the FSP-canonical pairing). The bare register-level bits are still exposed under the k_ra8_rmac_mrafc_perfect_* / k_ra8_rmac_mrafc_hash_* aliases for callers that need to drive the halves independently (e.g. address-hash-table maintenance).
Reference: FSP renesas/fsp r_rmac.c (RMAC_REG_MRAFC_PROMISCUOUS_VALUE and rmac_configure_reception_filter) for the canonical pairing.
Definition at line 250 of file ra8_rmac_regs.h.
| enum ra8_rmac_mrgc_bit_t : uint32_t |
MRGC RX-general-config bits (HUM Ch 33.4).
Definition at line 482 of file ra8_rmac_regs.h.
| enum ra8_rmac_mtffc_bit_t : uint32_t |
MTFFC TX-frame-format bits (HUM Ch 33.4).
| Enumerator | |
|---|---|
| k_ra8_rmac_mtffc_dpad | Disable padding. |
| k_ra8_rmac_mtffc_fcm | Frame-check mode (mCRC vs CRC). |
Definition at line 473 of file ra8_rmac_regs.h.
| enum ra8_rmac_mxgmiic_bit_t : uint32_t |
MXGMIIC 10G-XGMII bits.
| Enumerator | |
|---|---|
| k_ra8_rmac_mxgmiic_lfs_txrfs | TX remote-fault sig. |
| k_ra8_rmac_mxgmiic_lfs_txidle | TX local-fault idle. |
Definition at line 528 of file ra8_rmac_regs.h.
| enum ra8_rmac_offset_t : uint16_t |
RMAC per-port register offsets (HUM Ch 33.3 Table 33.4).
Provided as an enum so test code and trace tools can resolve any register name to its offset without grepping the struct.
Definition at line 161 of file ra8_rmac_regs.h.
| enum ra8_rmac_pause_mode_t : uint8_t |
Selects PFM bit in MTPFC2 – pause vs PFC frame.
| Enumerator | |
|---|---|
| k_ra8_rmac_pause_mode_802_3x | Classic IEEE 802.3x pause. |
| k_ra8_rmac_pause_mode_pfc | IEEE 802.1Qbb PFC frame. |
Definition at line 354 of file ra8_rmac_regs.h.
| enum ra8_rmac_pfc_group_t : uint8_t |
PFC priority group index (MTPFC3t, t = 0..1).
| Enumerator | |
|---|---|
| k_ra8_rmac_pfc_group_0 | Priority group 0. |
| k_ra8_rmac_pfc_group_1 | Priority group 1. |
| k_ra8_rmac_pfc_group_count | RA8 rmac pfc group count. |
Definition at line 363 of file ra8_rmac_regs.h.
| enum ra8_rmac_pfc_rx_idx_t : uint8_t |
PFC RX counter index (MPCFRCTt, t = 0..7).
| Enumerator | |
|---|---|
| k_ra8_rmac_pfc_rx_count | 8 PFC priority RX counters. |
Definition at line 381 of file ra8_rmac_regs.h.
| enum ra8_rmac_pis_t : uint8_t |
Physical interface selector for MPIC.PIS[2:0].
HUM Ch 33.4.1.2 "MPIC : PHY Interfaces Configuration Register" p 1707: MPIC.PIS[2:0] has only TWO defined encodings – 000b = MII and 010b = GMII. All other values are Reserved.
MPIC.PIS describes the internal xMII interface between the RMAC and the ESWM media mux. For an external RGMII link the ESWM (MIICRn.MIISEL = 01b, HUM Table 29.11) converts RGMII <-> internal GMII/MII, so the RMAC still sees MII or GMII. Per Table 29.11 the RMAC.MPIC.PIS value is purely a function of link speed:
| Enumerator | |
|---|---|
| k_ra8_rmac_pis_mii | MII (000b) – internal xMII for 10/100 Mbps. |
| k_ra8_rmac_pis_gmii | GMII (010b) – internal xMII for 1 Gbps. |
Definition at line 304 of file ra8_rmac_regs.h.
| enum ra8_rmac_port_t : uint8_t |
RMAC port index (m = 0, 1).
Used as the first argument to every ra8_rmac_* call. Maps directly to the per-port base addresses defined in ra8_ether_regs.h.
| Enumerator | |
|---|---|
| k_ra8_rmac_port_0 | RMAC port 0 (base 0x403C_B000). |
| k_ra8_rmac_port_1 | RMAC port 1 (base 0x403C_D000). |
| k_ra8_rmac_port_count | Number of RMAC ports. |
Definition at line 66 of file ra8_rmac_regs.h.
| enum ra8_rmac_ptp_filter_idx_t : uint8_t |
PTP filter table index for MPFCt (t = 0..15).
| Enumerator | |
|---|---|
| k_ra8_rmac_ptp_filter_count | 16 filter entries total. |
Definition at line 373 of file ra8_rmac_regs.h.
| enum ra8_rmac_rsv_words_t : uint8_t |
Reserved-word array sizes (in 32-bit words) used inside the RMAC per-port register block.
Names each reserved gap so the struct definition does not depend on raw integer literals. Cross-checked against HUM Table 33.4.
Definition at line 542 of file ra8_rmac_regs.h.
| enum ra8_rmac_shift_t : uint8_t |
Bit shifts used across the RMAC register surface.
Definition at line 102 of file ra8_rmac_regs.h.
| enum ra8_rmac_size_t : uint16_t |
RMAC register window total size (FSP R_RMAC0_Type).
| Enumerator | |
|---|---|
| k_ra8_rmac_window_bytes | Total MMIO window (FSP size). |
Definition at line 555 of file ra8_rmac_regs.h.
|
inlinestatic |
Compile-time check that the RMAC register window matches FSP.
FSP's R_RMAC0_Type is documented at "Size = 1328 (0x530)". If a future register addition perturbs the layout, this assertion fires before any test runs.
Compile-time offset insurance against silent layout drift.
Each named register's offset is asserted against the matching k_ra8_rmac_off_* constant (which is the source of truth from HUM Ch 33.3 Table 33.4). If a future edit perturbs a reserved gap or field width, the build fails before any silent frame corruption can hit the wire.
Get pointer to a per-port RMAC register block.
| [in] | port | Port identifier (k_ra8_rmac_port_0 or k_ra8_rmac_port_1). |
Definition at line 779 of file ra8_rmac_regs.h.
References k_ra8_rmac0_base_addr, k_ra8_rmac1_base_addr, and k_ra8_rmac_port_1.
Referenced by ra8_rmac_clear_status(), ra8_rmac_deinit(), ra8_rmac_dispatch(), ra8_rmac_enter_stop(), ra8_rmac_exit_stop(), ra8_rmac_get_status(), ra8_rmac_init(), ra8_rmac_mdio_c22_read(), ra8_rmac_mdio_c22_write(), ra8_rmac_mdio_c45_read(), ra8_rmac_mdio_c45_write(), ra8_rmac_read_stats(), ra8_rmac_set_frame_size(), ra8_rmac_set_link(), ra8_rmac_set_loopback(), ra8_rmac_set_lpi(), ra8_rmac_set_mac_address(), ra8_rmac_set_magic_packet(), ra8_rmac_set_pause_frame(), ra8_rmac_set_pfc_group(), ra8_rmac_set_ptp_filter(), ra8_rmac_set_rx_filter(), and ra8_rmac_set_vlan_framing().