ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
board_net.h File Reference

Virtual network peer for ra8_emulator – talks TCP/IP to the firmware. More...

#include <stdint.h>
Include dependency graph for board_net.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void board_net_init (bool trace)
 Reset the virtual network peer to its initial state.
void board_net_on_tx (const uint8_t *frame, uint32_t len)
 Hand one frame the firmware transmitted to the peer (ra8_eth_write).
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_tick (void)
 Advance the peer's state machine one tick (ARP -> ping -> TCP echo).
void board_net_report (void)
 Print the end-of-run network summary (link / ARP / ping / TCP).

Detailed Description

Virtual network peer for ra8_emulator – talks TCP/IP to the firmware.

ra8_emulator shims the firmware's ra8_eth frame API (ra8_eth_write / ra8_eth_read / ra8_eth_link_status – the same seam the NetX Duo driver uses) and routes the Ethernet frames here. This module is the "other host on the wire": a tiny userspace TCP/IP stack (Ethernet + ARP + IPv4 + ICMP + TCP) that resolves the firmware (192.168.1.42), pings it, and connects to its echo server – so a NetX networking example runs end-to-end with no hardware and no host network setup. main.c marshals guest memory to/from the plain byte buffers here, so this code is portable, AppKit-free C.

Since
0.1.0

Definition in file board_net.h.

Function Documentation

◆ board_net_init()

void board_net_init ( bool trace)

Reset the virtual network peer to its initial state.

Parameters
[in]traceMirror per-frame activity to injected error sink when true.

Reset the virtual network peer to its initial state; this step is contained within the board net model and uses bounded caller or module-owned storage.

Precondition
Arguments satisfy the ranges documented for board net init.
The call executes on the emulator's single owning thread.
Postcondition
State changes remain confined to the board net model and documented output objects.
Ownership of caller-supplied storage is unchanged.
Note
The operation is synchronous and does not transfer heap ownership.
Since
0.1.0

Definition at line 786 of file board_net.c.

References k_net_init, memset(), s_arp_replies, s_delivered, s_fw_mac, s_fw_mac_known, s_ping_seq, s_pings, s_polls, s_rxq_head, s_rxq_tail, s_state, s_tcp_echoed, s_tcp_estab_wait, s_tcp_match, s_tcp_need_data, s_tcp_our_seq, s_tcp_their_seq, s_trace, s_tx_frames, and s_wait.

Referenced by internal_main_bringup_peripherals(), and warm_reboot().

◆ board_net_on_tx()

void board_net_on_tx ( const uint8_t * frame,
uint32_t len )

Hand one frame the firmware transmitted to the peer (ra8_eth_write).

Parameters
[in]frameEthernet frame bytes (no FCS).
[in]lenFrame length in bytes.

Hand one frame the firmware transmitted to the peer (ra8_eth_write); this step is contained within the board net model and uses bounded caller or module-owned storage.

Precondition
Arguments satisfy the ranges documented for board net on tx.
The call executes on the emulator's single owning thread.
Postcondition
State changes remain confined to the board net model and documented output objects.
Ownership of caller-supplied storage is unchanged.
Note
The operation is synchronous and does not transfer heap ownership.
Since
0.1.0

Definition at line 710 of file board_net.c.

References board_console_push(), internal_get16(), internal_net_rx_arp(), internal_net_rx_ipv4(), k_board_console_ch_net, k_eth_arp, k_eth_ethertype_off, k_eth_hdr, k_eth_ipv4, k_net_console_line_cap, priv_emu_io_errf(), s_trace, and s_tx_frames.

Referenced by internal_eth_tx_kick_queue().

◆ board_net_poll_rx()

uint32_t board_net_poll_rx ( uint8_t * buf,
uint32_t max )

Fetch the next frame the peer wants the firmware to receive.

Parameters
[out]bufDestination for the frame bytes.
[in]maxCapacity of buf.
Returns
Frame length copied (0 if the peer has nothing queued).

Fetch the next frame the peer wants the firmware to receive; this step is contained within the board net model and uses bounded caller or module-owned storage.

Return values
valueThe operation-specific board net poll rx value.
Precondition
Arguments satisfy the ranges documented for board net poll rx.
The call executes on the emulator's single owning thread.
Postcondition
State changes remain confined to the board net model and documented output objects.
Ownership of caller-supplied storage is unchanged.
Note
The operation is synchronous and does not transfer heap ownership.
Since
0.1.0

Definition at line 733 of file board_net.c.

References board_console_push(), k_board_console_ch_net, k_net_console_line_cap, k_net_qdepth, memcpy(), s_delivered, s_polls, s_rxq, s_rxq_head, s_rxq_len, and s_rxq_tail.

Referenced by internal_eth_rx_drain_peer().

◆ board_net_report()

void board_net_report ( void )

Print the end-of-run network summary (link / ARP / ping / TCP).

Print the end-of-run network summary (link / arp / ping / tcp); this step is contained within the board net model and uses bounded caller or module-owned storage.

Precondition
Arguments satisfy the ranges documented for board net report.
The call executes on the emulator's single owning thread.
Postcondition
State changes remain confined to the board net model and documented output objects.
Ownership of caller-supplied storage is unchanged.
Note
The operation is synchronous and does not transfer heap ownership.
Since
0.1.0

Definition at line 829 of file board_net.c.

References internal_net_echo_state(), k_net_estab, k_net_init, k_net_syn, priv_emu_io_errf(), s_delivered, s_fw_mac_known, s_pings, s_polls, s_state, s_tcp_echoed, and s_tx_frames.

Referenced by internal_run_print_stop_summary().

◆ board_net_tick()

void board_net_tick ( void )

Advance the peer's state machine one tick (ARP -> ping -> TCP echo).

Advance the peer's state machine one tick (arp -> ping -> tcp echo); this step is contained within the board net model and uses bounded caller or module-owned storage.

Precondition
Arguments satisfy the ranges documented for board net tick.
The call executes on the emulator's single owning thread.
Postcondition
State changes remain confined to the board net model and documented output objects.
Ownership of caller-supplied storage is unchanged.
Note
The operation is synchronous and does not transfer heap ownership.
Since
0.1.0

< Net data delay.

< Net retry.

Definition at line 753 of file board_net.c.

References internal_net_send_arp_request(), internal_net_send_data(), internal_net_send_ping(), internal_net_send_syn(), k_net_arp, k_net_estab, k_net_init, k_net_ping, k_net_syn, s_state, s_tcp_estab_wait, s_tcp_need_data, and s_wait.

Referenced by internal_run_loop_tick_inputs().