68typedef enum : uint64_t {
82typedef enum : uint32_t {
114typedef enum : uint16_t {
127typedef enum : uint32_t {
175 for (
unsigned i = 0U; (i < size) && ((off + (uint64_t)i) < (uint64_t)
k_eth_win_span); ++i) {
198 for (
unsigned i = 0U; (i < size) && ((off + (uint64_t)i) < (uint64_t)
k_eth_win_span); ++i) {
284 return (uint32_t)d8[0] |
411 if ((addr < base) || (addr >= top) || (((addr - base) % (uint64_t)
k_eth_reg32_bytes) != 0U)) {
438 return s_eth.phy[reg];
464 s_eth.phy[reg] = value;
532 if (
s_eth.linkfix_base == 0U) {
553 if (
emu_mem_read(uc, (uint64_t)buf, frame, (
size_t)len) != UC_ERR_OK) {
560 (void)snprintf(ln,
sizeof(ln),
"ETH tx q%u %uB", (
unsigned)queue, (
unsigned)len);
578 if ((bits & (1UL << i)) != 0U) {
608 uint32_t cur = chain;
619 if ((next == 0U) || (next == cur)) {
660 if ((buf == 0U) || (cap == 0U)) {
690 const uint64_t gwmc_woff =
763 return s_eth.tx_frames;
767 return s_eth.rx_frames;
806 s_eth.linkfix_base = (uint32_t)value;
817 s_eth.rx_queue = queue;
848 if ((
s_eth.tx_frames == 0U) && (
s_eth.rx_frames == 0U)) {
851 (void)
priv_emu_io_errf(
" R-Switch : TX %u frame(s) RX %u frame(s) via GWCA/ETHA/RMAC "
852 "regs; link 100M/FD (MDIO)\n",
867 .name =
"R-Switch(ETH)",
Multi-channel console log store backing the board view's tabbed console.
void board_console_push(board_console_ch_t ch, const char *line)
Append one completed line to a channel ring and the ALL ring.
@ k_board_console_ch_net
Ethernet / IPv4 / TCP packet summaries.
Virtual network peer for ra8_emulator – talks TCP/IP to the firmware.
uint32_t board_net_poll_rx(uint8_t *buf, uint32_t max)
Fetch the next frame the peer wants the firmware to receive.
void board_net_on_tx(const uint8_t *frame, uint32_t len)
Hand one frame the firmware transmitted to the peer (ra8_eth_write).
Decentralized peripheral-block registry for the board emulator core.
void board_periph_register_block(const board_periph_block_t *block)
Register a peripheral block's descriptor with the core registry.
static void internal_eth_desc_set_ds(uc_engine *uc, uint32_t addr, uint32_t ds)
Write the 12-bit DS field of the descriptor at address addr.
static void internal_eth_block_register(void)
Register the R-Switch block + seed the PHY file before main runs.
static void internal_eth_shadow_write(uint64_t off, unsigned size, uint64_t value)
Write up to size bytes little-endian into the register shadow.
static eth_state_t s_eth
Singleton R-Switch model state.
static bool internal_eth_is_rmac_reg(uint64_t addr, uint64_t off)
True if addr is the given off in either RMAC port window.
static void internal_eth_mpsm_exec(uint64_t mpsm_off, uint32_t value)
Execute an MPSM (PHY Station Management) transaction on write.
eth_order_t
Per-tick order slot: after the DTC/DMAC transfer engines.
@ k_eth_block_order
Report + tick order (just after DTC=55).
static uint16_t internal_eth_phy_read(uint32_t reg)
Read a modelled Clause-22 PHY register (out-of-range reads 0).
static bool internal_eth_is_etha_reg(uint64_t addr, uint64_t off)
True if addr is the given off in either ETHA port window.
static uint64_t internal_eth_shadow_read(uint64_t off, unsigned size)
Read up to size bytes little-endian from the register shadow.
static uint32_t internal_eth_shadow_u32(uint64_t off)
Read a 32-bit shadow register at window offset off.
static void internal_eth_rx_drain_peer(uc_engine *uc, uint32_t chain)
Drain waiting peer frames into free slots of the RX ring chain.
eth_model_const_t
Descriptor-byte layout, MDIO decode, and ring-walk bounds.
@ k_eth_gwarirm_ariog
GWARIRM.ARIOG AXI-init request.
@ k_eth_desc_ptr_off
PTR[31:0] at descriptor byte 4.
@ k_eth_desc_ds_hi
DS high-nibble mask.
@ k_eth_shift_byte
One-byte shift.
@ k_eth_ring_walk_max
Bound on a descriptor-ring scan.
@ k_eth_mpsm_mff
MPSM.MFF: 1 = Clause-45 frame format.
@ k_eth_byte_mask
Low 8 bits of a value.
@ k_eth_reg32_bytes
One 32-bit register.
@ k_eth_queue_none
"No RX queue configured yet" sentinel.
@ k_eth_rx_inject_max
Max frames injected into the ring / tick.
@ k_eth_desc_ds_keep
Byte-1 high-nibble kept on a DS set.
@ k_eth_desc_bytes
Basic-descriptor / LINKFIX entry size.
@ k_eth_desc_dt_shift
DT occupies bits [7:4] of that byte.
@ k_eth_rmac_off_mrfc
RMAC MRFC (RX total frame count).
@ k_eth_gwarirm_arr
GWARIRM.ARR AXI-init response.
@ k_eth_desc_dt_byte
DT lives in descriptor byte 2.
@ k_eth_desc_ds_byte1
DS[11:8] in low nibble of byte 1.
@ k_eth_desc_dt_lo
Low-nibble mask (bits kept on a DT set).
@ k_eth_frame_max
Marshal buffer cap (>= max 802.3 frame).
@ k_eth_console_cap
Console NET-tab line capacity.
static void internal_eth_desc_read(uc_engine *uc, uint32_t addr, uint8_t *out8)
Read an 8-byte descriptor header from emulated memory addr.
eth_win_geom_t
Absolute window the block owns (the contiguous R-Switch cluster).
@ k_eth_win_base
MFWD base = window base.
@ k_eth_win_span
MFWD..GWCA end.
static void internal_eth_tx_kick_queue(uc_engine *uc, uint32_t queue)
Move the frame queued on GWCA queue queue out to the peer.
static void internal_eth_write(uc_engine *uc, uint64_t addr, unsigned size, uint64_t value)
MMIO write handler for the R-Switch window.
static void internal_eth_desc_set_dt(uc_engine *uc, uint32_t addr, uint32_t dt)
Write the DT field of the descriptor at emulated address addr.
static void internal_eth_report(void)
End-of-run R-Switch section: frames moved through the register model.
static uint32_t internal_eth_desc_dt(const uint8_t *d8)
Decode the DT (descriptor type) field of an 8-byte header.
static uint32_t internal_eth_desc_ds(const uint8_t *d8)
Decode the 12-bit DS (descriptor size) field of an 8-byte header.
eth_phy_reg_t
Modelled Clause-22 PHY register indices, seed values, and mode bits.
@ k_eth_phy_bmsr_seed
100/10 abilities + AN done + LINK.
@ k_eth_phy_bmcr_anrst
BMCR.AN_RESTART (self-clearing).
@ k_eth_phy_reg_bmcr
BMCR (basic control).
@ k_eth_phy_anlpar_seed
100F/100H/10F/10H + selector.
@ k_eth_phy_bmcr_reset
BMCR.RESET (self-clearing).
@ k_eth_phy_reg_bmsr
BMSR (basic status).
@ k_eth_phy_bmcr_seed
AN enable + 100 Mb/s + full duplex.
@ k_eth_phy_reg_count
Clause-22 register-space size.
@ k_eth_phy_reg_anlpar
ANLPAR (link-partner ability).
static const board_periph_block_t s_k_eth_block
R-Switch cluster block descriptor.
static uint32_t internal_eth_desc_ptr(const uint8_t *d8)
Decode the 32-bit PTR (buffer / chain address) of an 8-byte header.
static bool internal_eth_is_gwdcc(uint64_t addr, uint32_t *queue)
True if addr is one of GWCA GWDCC[0..31]; sets *queue.
static bool internal_eth_rx_find_slot(uc_engine *uc, uint32_t chain, uint32_t *out_slot)
Walk an RX ring from chain for the next FEMPTY slot.
static void internal_eth_gwtrc_kick(uc_engine *uc, uint32_t bits, uint32_t base_queue)
Fire internal_eth_tx_kick_queue for every set bit of a GWTRC word.
static uint32_t internal_eth_bytes_u32(const uint8_t *p)
Assemble a little-endian 32-bit value from four bytes p[0..3].
static uint64_t internal_eth_read(uc_engine *uc, uint64_t addr, unsigned size)
MMIO read handler for the R-Switch window.
static void internal_eth_tick(uc_engine *uc)
Per-tick RX pump: stage peer frames once the GWCA is in OPERATION.
static void internal_eth_phy_write(uint32_t reg, uint16_t value)
Write a modelled Clause-22 PHY register (self-clearing BMCR bits).
static void internal_eth_reset(void)
Reset the R-Switch model and re-seed the modelled PHY register file.
Bounded raw-descriptor I/O seam for the RA8 emulator.
emu_io_result_t priv_emu_io_errf(const char *format,...)
Format bounded text and write it to the injected error descriptor.
uc_err emu_mem_read(uc_engine *uc, uint64_t address, void *bytes, size_t count)
Read guest memory through the central access seam.
uc_err emu_mem_write(uc_engine *uc, uint64_t address, const void *bytes, size_t count)
Write guest memory through the central access seam.
#define RA8_INTERNAL
Marker that a function is intended to be static (file-local).
Ethernet Agent (ETHA) per-port register layout for the RA8D2.
@ k_ra8_etha_off_eams
EAMS: Mode Status.
@ k_ra8_etha_off_eamc
EAMC: Mode Configuration.
@ k_ra8_etha_mask_ops
EAMS.OPS[1:0].
Ethernet controller base addresses for the Renesas RA8D2.
@ k_ra8_gwca_off_gwtrc0
TX Request Cfg, queues 0..31.
@ k_ra8_gwca_off_gwdcc_base
GWDCC[0]; stride 4 bytes.
@ k_ra8_gwca_off_gwmc
Mode Configuration.
@ k_ra8_gwca_off_gwdcbac1
Descriptor chain base addr 1 (lower).
@ k_ra8_gwca_off_gwms
Mode Status.
@ k_ra8_gwca_off_gwarirm
AXI RAM Init Req Monitoring (FSP-confirmed offset).
@ k_ra8_gwca_off_gwtrc1
TX Request Cfg, queues 32..63.
@ k_ra8_coma_off_cabpirm
Buf-pool Init/Reset (BPIOG / BPR).
@ k_ra8_gwdcc_dt_fsingle
FSINGLE – single-fragment frame.
@ k_ra8_gwdcc_dt_link
LINK – chain continuation.
@ k_ra8_gwdcc_dt_fempty
FEMPTY – empty, full frame slot.
@ k_ra8_gwdcc_dt_linkfix
LINKFIX – chain head pointer.
@ k_ra8_rmac1_base_addr
RA8 rmac1 base address.
@ k_ra8_mfwd_base_addr
RA8 mfwd base address.
@ k_ra8_gwca0_base_addr
RA8 gwca0 base address.
@ k_ra8_etha0_base_addr
RA8 etha0 base address.
@ k_ra8_rmac0_base_addr
RA8 rmac0 base address.
@ k_ra8_etha1_base_addr
RA8 etha1 base address.
@ k_ra8_coma_base_addr
RA8 coma base address.
@ k_ra8_gwdcc_balr
RA8 gwdcc balr.
@ k_ra8_gwdcc_dqt
0 = RX queue, 1 = TX queue.
@ k_ra8_coma_cabpirm_bpiog
CABPIRM.BPIOG – buf-pool init kick.
@ k_ra8_coma_cabpirm_bpr
CABPIRM.BPR – buf-pool ready flag.
@ k_ra8_gwmc_opc_mask
RA8 gwmc opc mask.
@ k_ra8_gwmc_opc_operation
OR: Operation request – frames flow.
Ethernet MAC (RMAC) per-port register layout for the RA8D2.
@ k_ra8_rmac_mdio_op_c22_read
10 – C22 read.
@ k_ra8_rmac_mdio_op_c22_write
01 – C22 write.
@ k_ra8_rmac_mask_mpsm_data
MPSM.PRD[31:16].
@ k_ra8_rmac_mask_mpsm_phy_reg
5-bit PHY reg/dev.
@ k_ra8_rmac_mask_mpsm_op
MPSM.POP[14:13].
@ k_ra8_rmac_mpsm_psme
PHY Station Management Enable / busy.
@ k_ra8_rmac_off_mpsm
PHY Station Management.
@ k_ra8_rmac_off_mrgfce
RX good E-frame cnt.
@ k_ra8_rmac_off_mtgfce
TX good E-frame cnt.
@ k_ra8_rmac_shift_mpsm_prd
MPSM.PRD[31:16].
@ k_ra8_rmac_shift_mpsm_pra
MPSM.PRA[12:8].
@ k_ra8_rmac_shift_mpsm_pop
MPSM.POP[14:13].
A modelled peripheral block's self-description for the core registry.
Runtime state of the R-Switch model.
uint32_t tx_frames
Frames moved firmware -> peer (MTGFCE).
uint16_t phy[k_eth_phy_reg_count]
Modelled PHY Clause-22 register file.
uint32_t linkfix_base
GWDCBAC descriptor-chain base address.
uint32_t rx_queue
Configured RX queue index (or NONE).
uint8_t win[k_eth_win_span]
Flat register shadow (config reflect).
uint32_t rx_frames
Frames moved peer -> firmware (MRFC).