|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
Virtual network peer (Ethernet/ARP/IPv4/ICMP/TCP) for ra8_emulator. More...
#include "board_net.h"#include <stdint.h>#include <stdio.h>#include <string.h>#include "board_console.h"#include "emu_host_io_internal.h"Go to the source code of this file.
Enumerations | |
| enum | board_net_frame_off_t : uint8_t { k_arp_plen_off = 5U , k_arp_spa_off = 14U , k_arp_tha_off = 18U , k_tcp_off_payload = 20U } |
| Offsets into the frames this stub synthesises (RFC 826 / RFC 793). More... | |
| enum | net_console_t : uint32_t { k_net_console_line_cap = 48U } |
| Console-tap line buffer capacity for a network packet summary. More... | |
| enum | net_addr_t : uint32_t { k_net_peer_ip = 0xC0A80101UL , k_net_fw_ip = 0xC0A8012AUL , k_net_echo_port = 7U , k_net_peer_port = 49152U } |
| Addressing + protocol constants for the peer and the firmware. More... | |
| enum | net_frame_t : uint32_t { k_eth_hdr = 14U , k_eth_arp = 0x0806U , k_eth_ipv4 = 0x0800U , k_arp_len = 28U , k_ip_hdr = 20U , k_icmp_hdr = 8U , k_ip_proto_icmp = 1U , k_ip_proto_tcp = 6U , k_mac_len = 6U , k_net_buf = 1600U } |
| Frame offsets / sizes (Ethernet II + ARP + IPv4 + ICMP + TCP). More... | |
| enum | net_proto_t : uint32_t { k_byte_mask = 0xFFU , k_u16_mask = 0xFFFFU , k_shift24 = 24U , k_peer_mac_b2 = 0x5EU , k_peer_mac_b4 = 0x53U , k_eth_ethertype_off = 12U , k_arp_plen = 4U , k_arp_tpa_off = 24U , k_ipv4_ver_ihl = 0x45U , k_ip_ident = 0x1234U , k_ip_flag_df = 0x4000U , k_ip_ttl = 64U , k_ip_proto_off = 9U , k_ip_csum_off = 10U , k_ip_src_off = 12U , k_ip_dst_off = 16U , k_ip_ihl_mask = 0x0FU , k_ihl_word = 4U , k_icmp_ident = 0xBEEFU , k_icmp_pat_base = 0x40U , k_tcp_hdr = 20U , k_tcp_payload_max = 64U , k_tcp_off_dataoff = 12U , k_tcp_off_flags = 13U , k_tcp_off_window = 14U , k_tcp_data_off = 0x50U , k_tcp_window = 2048U , k_tcp_isn = 1000U , k_tcp_doff_shift = 4U } |
| Protocol field offsets, masks, and well-known values for the frames board_net builds/parses (Ethernet / ARP / IPv4 / ICMP / TCP). More... | |
| enum | net_state_t : uint8_t { k_net_init = 0U , k_net_arp = 1U , k_net_ping = 2U , k_net_syn = 3U , k_net_estab = 4U , k_net_fin = 5U , k_net_done = 6U } |
| Peer state machine: ARP -> ping -> TCP connect / echo / close. More... | |
| enum | net_tcp_flag_t : uint8_t { k_tcp_fin = 0x01U , k_tcp_syn = 0x02U , k_tcp_rst = 0x04U , k_tcp_psh = 0x08U , k_tcp_ack = 0x10U } |
| TCP control-bit flags. More... | |
| enum | : uint32_t { k_net_tcp_payload_len = 23U } |
| Payload length the threadx_netx_tcp_echo hil.conf asserts. More... | |
| enum | : uint32_t { k_net_qdepth = 8U } |
Functions | |
| static RA8_INTERNAL void | internal_put16 (uint8_t *p, uint16_t v) |
Store a 16-bit value big-endian (network order) at p. | |
| static RA8_INTERNAL void | internal_put32 (uint8_t *p, uint32_t v) |
Store a 32-bit value big-endian at p. | |
| static RA8_INTERNAL uint16_t | internal_get16 (const uint8_t *p) |
Read a big-endian 16-bit value from p. | |
| static RA8_INTERNAL uint32_t | internal_get32 (const uint8_t *p) |
Read a big-endian 32-bit value from p. | |
| static RA8_INTERNAL uint16_t | internal_net_checksum (const uint8_t *d, uint32_t len, uint32_t seed) |
16-bit one's-complement checksum over len bytes at d. | |
| static RA8_INTERNAL void | internal_net_queue (const uint8_t *frame, uint32_t len) |
| Queue a built frame for the firmware to receive (drops if ring full). | |
| static RA8_INTERNAL void | internal_net_eth_hdr (uint8_t *f, const uint8_t *dst, uint16_t ethertype) |
Fill the 14-byte Ethernet header into f. | |
| static RA8_INTERNAL void | internal_net_send_arp_request (void) |
| Build + queue an ARP request asking who-has the firmware's IP. | |
| static RA8_INTERNAL void | internal_net_send_arp_reply (const uint8_t *to_mac, uint32_t to_ip) |
| Build + queue an ARP reply giving the peer's MAC to the firmware. | |
| static RA8_INTERNAL void | internal_net_ip_hdr (uint8_t *ip, uint8_t proto, uint16_t payload_len) |
| Fill a 20-byte IPv4 header (no options) + compute its checksum. | |
| static RA8_INTERNAL void | internal_net_send_ping (void) |
| Build + queue an ICMP echo request to the firmware. | |
| static RA8_INTERNAL void | internal_net_send_tcp (uint8_t flags, const uint8_t *payload, uint16_t payload_len) |
| Build + queue a TCP segment to the firmware echo port (flags+payload). | |
| static RA8_INTERNAL void | internal_net_send_syn (void) |
| Open the TCP connection: send SYN with our initial sequence number. | |
| static RA8_INTERNAL void | internal_net_send_data (void) |
| Send the test payload to the established echo connection. | |
| static RA8_INTERNAL void | internal_net_tcp_on_estab (uint32_t seq, const uint8_t *pdata, uint32_t plen) |
| ESTAB state: echo-match the payload, then start our active (FIN) close. | |
| static RA8_INTERNAL void | internal_net_rx_tcp (const uint8_t *t, uint32_t len) |
| Handle an inbound TCP segment: drive the connect / echo / close FSM. | |
| static RA8_INTERNAL void | internal_net_rx_arp (const uint8_t *a, uint32_t len) |
| Handle an inbound ARP frame (learn the firmware MAC / answer who-has). | |
| static RA8_INTERNAL void | internal_net_rx_icmp (const uint8_t *ic, uint32_t len) |
| Handle an inbound ICMP echo reply (count a successful ping). | |
| static RA8_INTERNAL void | internal_net_rx_ipv4 (const uint8_t *ip, uint32_t len) |
| Handle an inbound IPv4 frame, dispatching by protocol. | |
| 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_init (bool trace) |
| Reset the virtual network peer to its initial state. | |
| static RA8_INTERNAL const char * | internal_net_echo_state (void) |
| One-word verdict for the TCP echo leg of the run report. | |
| void | board_net_report (void) |
| Print the end-of-run network summary (link / ARP / ping / TCP). | |
Variables | |
| static const uint8_t | s_peer_mac [k_mac_len] |
| static bool | s_trace |
| static uint8_t | s_state |
| static uint8_t | s_fw_mac [k_mac_len] |
| Learned from ARP. | |
| static bool | s_fw_mac_known |
| static uint32_t | s_arp_replies |
| ARP replies received. | |
| static uint32_t | s_pings |
| ICMP echo replies received. | |
| static uint32_t | s_wait |
| Ticks since the last send. | |
| static uint16_t | s_ping_seq |
| ICMP echo sequence. | |
| static uint32_t | s_tx_frames |
| Frames the firmware sent. | |
| static uint32_t | s_polls |
| ra8_eth_read polls served. | |
| static uint32_t | s_delivered |
| Frames delivered to firmware. | |
| static uint32_t | s_tcp_our_seq |
| Our next TCP send sequence. | |
| static uint32_t | s_tcp_their_seq |
| Their next seq (our ack). | |
| static uint32_t | s_tcp_echoed |
| Echo payload bytes received. | |
| static bool | s_tcp_match |
| Echo matched what we sent. | |
| static bool | s_tcp_need_data |
| Payload queued to send post-handshake. | |
| static uint32_t | s_tcp_estab_wait |
| Ticks since the connection established. | |
| static const uint8_t | s_tcp_payload [] = "tcp echo probe payload\n" |
| Payload the peer sends to the firmware's TCP echo server. | |
| static uint8_t | s_rxq [k_net_qdepth][k_net_buf] |
| static uint16_t | s_rxq_len [k_net_qdepth] |
| static uint32_t | s_rxq_head |
| static uint32_t | s_rxq_tail |
Virtual network peer (Ethernet/ARP/IPv4/ICMP/TCP) for ra8_emulator.
Implements the "other host on the wire" behind the ra8_eth frame seam (see board_net.h). The peer is 192.168.1.1 (MAC 02:00:5E:00:53:01); the firmware is 192.168.1.42. Its state machine resolves the firmware over ARP, pings it (ICMP), then opens a TCP connection to the echo server on port 7, sends a payload, and verifies the echo – proving the NetX networking example runs end-to-end with no hardware. Frames are exchanged as plain byte buffers; main.c marshals them to/from guest memory.
Definition in file board_net.c.
| anonymous enum : uint32_t |
Payload length the threadx_netx_tcp_echo hil.conf asserts.
| Enumerator | |
|---|---|
| k_net_tcp_payload_len | sizeof(s_tcp_payload) - 1, pinned. |
Definition at line 158 of file board_net.c.
| anonymous enum : uint32_t |
| Enumerator | |
|---|---|
| k_net_qdepth | Net qdepth. |
Definition at line 169 of file board_net.c.
| enum board_net_frame_off_t : uint8_t |
Offsets into the frames this stub synthesises (RFC 826 / RFC 793).
Definition at line 29 of file board_net.c.
| enum net_addr_t : uint32_t |
Addressing + protocol constants for the peer and the firmware.
| Enumerator | |
|---|---|
| k_net_peer_ip | 192.168.1.1 (the peer). |
| k_net_fw_ip | 192.168.1.42 (the firmware). |
| k_net_echo_port | Firmware TCP echo server port. |
| k_net_peer_port | Peer ephemeral source port. |
Definition at line 42 of file board_net.c.
| enum net_console_t : uint32_t |
Console-tap line buffer capacity for a network packet summary.
| Enumerator | |
|---|---|
| k_net_console_line_cap | Max chars in a "NET tx eth=.." line. |
Definition at line 37 of file board_net.c.
| enum net_frame_t : uint32_t |
Frame offsets / sizes (Ethernet II + ARP + IPv4 + ICMP + TCP).
Definition at line 50 of file board_net.c.
| enum net_proto_t : uint32_t |
Protocol field offsets, masks, and well-known values for the frames board_net builds/parses (Ethernet / ARP / IPv4 / ICMP / TCP).
Definition at line 68 of file board_net.c.
| enum net_state_t : uint8_t |
Peer state machine: ARP -> ping -> TCP connect / echo / close.
Definition at line 101 of file board_net.c.
| enum net_tcp_flag_t : uint8_t |
TCP control-bit flags.
| Enumerator | |
|---|---|
| k_tcp_fin | TCP fin. |
| k_tcp_syn | TCP syn. |
| k_tcp_rst | TCP rst. |
| k_tcp_psh | TCP psh. |
| k_tcp_ack | TCP ack. |
Definition at line 112 of file board_net.c.
| void board_net_init | ( | bool | trace | ) |
Reset the virtual network peer to its initial state.
| [in] | trace | Mirror 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.
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().
| void board_net_on_tx | ( | const uint8_t * | frame, |
| uint32_t | len ) |
Hand one frame the firmware transmitted to the peer (ra8_eth_write).
| [in] | frame | Ethernet frame bytes (no FCS). |
| [in] | len | Frame 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.
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().
| uint32_t board_net_poll_rx | ( | uint8_t * | buf, |
| uint32_t | max ) |
Fetch the next frame the peer wants the firmware to receive.
| [out] | buf | Destination for the frame bytes. |
| [in] | max | Capacity of buf. |
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.
| value | The operation-specific board net poll rx value. |
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().
| 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.
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().
| 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.
< 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().
|
static |
Read a big-endian 16-bit value from p.
Read a big-endian 16-bit value from p; this step is contained within the board net model and uses bounded caller or module-owned storage.
| [in] | p | Module-owned state object processed by the operation. |
| value | The operation-specific get16 value. |
Definition at line 227 of file board_net.c.
References RA8_INTERNAL.
Referenced by board_net_on_tx(), internal_net_rx_arp(), internal_net_rx_ipv4(), and internal_net_rx_tcp().
|
static |
Read a big-endian 32-bit value from p.
Read a big-endian 32-bit value from p; this step is contained within the board net model and uses bounded caller or module-owned storage.
| [in] | p | Module-owned state object processed by the operation. |
| value | The operation-specific get32 value. |
Definition at line 243 of file board_net.c.
References k_shift24, and RA8_INTERNAL.
Referenced by internal_net_rx_arp(), and internal_net_rx_tcp().
|
static |
16-bit one's-complement checksum over len bytes at d.
16-bit one's-complement checksum over len bytes at d; this step is contained within the board net model and uses bounded caller or module-owned storage.
| [in] | d | D input used by the operation. |
| [in] | len | Number of payload bytes to process. |
| [in] | seed | Seed input used by the operation. |
| value | The operation-specific net checksum value. |
Definition at line 262 of file board_net.c.
References k_u16_mask, and RA8_INTERNAL.
Referenced by internal_net_ip_hdr(), internal_net_send_ping(), and internal_net_send_tcp().
|
static |
One-word verdict for the TCP echo leg of the run report.
Definition at line 818 of file board_net.c.
References RA8_INTERNAL, s_tcp_echoed, and s_tcp_match.
Referenced by board_net_report().
|
static |
Fill the 14-byte Ethernet header into f.
Fill the 14-byte ethernet header into f; this step is contained within the board net model and uses bounded caller or module-owned storage.
| [in,out] | f | F state or storage updated in place by the operation. |
| [in] | dst | Destination storage receiving the result. |
| [in] | ethertype | Ethertype input used by the operation. |
Definition at line 309 of file board_net.c.
References internal_put16(), k_eth_ethertype_off, k_mac_len, memcpy(), RA8_INTERNAL, and s_peer_mac.
Referenced by internal_net_send_arp_reply(), internal_net_send_arp_request(), internal_net_send_ping(), and internal_net_send_tcp().
|
static |
Fill a 20-byte IPv4 header (no options) + compute its checksum.
Fill a 20-byte ipv4 header (no options) + compute its checksum; this step is contained within the board net model and uses bounded caller or module-owned storage.
| [in,out] | ip | Ip state or storage updated in place by the operation. |
| [in] | proto | Proto input used by the operation. |
| [in] | payload_len | Bound for the payload data. |
Definition at line 396 of file board_net.c.
References internal_net_checksum(), internal_put16(), internal_put32(), k_ip_csum_off, k_ip_dst_off, k_ip_flag_df, k_ip_hdr, k_ip_ident, k_ip_proto_off, k_ip_src_off, k_ip_ttl, k_ipv4_ver_ihl, k_net_fw_ip, k_net_peer_ip, memset(), and RA8_INTERNAL.
Referenced by internal_net_send_ping(), and internal_net_send_tcp().
|
static |
Queue a built frame for the firmware to receive (drops if ring full).
Queue a built frame for the firmware to receive (drops if ring full); this step is contained within the board net model and uses bounded caller or module-owned storage.
| [in] | frame | Frame input used by the operation. |
| [in] | len | Number of payload bytes to process. |
Definition at line 287 of file board_net.c.
References k_net_buf, k_net_qdepth, memcpy(), RA8_INTERNAL, s_rxq, s_rxq_head, s_rxq_len, and s_rxq_tail.
Referenced by internal_net_send_arp_reply(), internal_net_send_arp_request(), internal_net_send_ping(), and internal_net_send_tcp().
|
static |
Handle an inbound ARP frame (learn the firmware MAC / answer who-has).
Handle an inbound arp frame (learn the firmware mac / answer who-has); this step is contained within the board net model and uses bounded caller or module-owned storage.
| [in] | a | A input used by the operation. |
| [in] | len | Number of payload bytes to process. |
Definition at line 623 of file board_net.c.
References internal_get16(), internal_get32(), internal_net_send_arp_reply(), internal_net_send_ping(), k_arp_len, k_mac_len, k_net_arp, k_net_fw_ip, k_net_peer_ip, k_net_ping, memcpy(), RA8_INTERNAL, s_arp_replies, s_fw_mac, s_fw_mac_known, s_state, and s_wait.
Referenced by board_net_on_tx().
|
static |
Handle an inbound ICMP echo reply (count a successful ping).
Handle an inbound icmp echo reply (count a successful ping); this step is contained within the board net model and uses bounded caller or module-owned storage.
| [in] | ic | Ic input used by the operation. |
| [in] | len | Number of payload bytes to process. |
Definition at line 658 of file board_net.c.
References internal_net_send_syn(), k_icmp_hdr, k_net_ping, k_net_syn, priv_emu_io_errf(), RA8_INTERNAL, s_pings, s_state, s_trace, and s_wait.
Referenced by internal_net_rx_ipv4().
|
static |
Handle an inbound IPv4 frame, dispatching by protocol.
Handle an inbound ipv4 frame, dispatching by protocol; this step is contained within the board net model and uses bounded caller or module-owned storage.
| [in] | ip | Ip input used by the operation. |
| [in] | len | Number of payload bytes to process. |
Definition at line 684 of file board_net.c.
References internal_get16(), internal_net_rx_icmp(), internal_net_rx_tcp(), k_ihl_word, k_ip_hdr, k_ip_ihl_mask, k_ip_proto_icmp, k_ip_proto_tcp, and RA8_INTERNAL.
Referenced by board_net_on_tx().
|
static |
Handle an inbound TCP segment: drive the connect / echo / close FSM.
Handle an inbound tcp segment: drive the connect / echo / close fsm; this step is contained within the board net model and uses bounded caller or module-owned storage.
| [in] | t | T input used by the operation. |
| [in] | len | Number of payload bytes to process. |
Definition at line 556 of file board_net.c.
References internal_get16(), internal_get32(), internal_net_send_tcp(), internal_net_tcp_on_estab(), k_ihl_word, k_ip_ihl_mask, k_net_done, k_net_echo_port, k_net_estab, k_net_fin, k_net_peer_port, k_net_syn, k_tcp_ack, k_tcp_doff_shift, k_tcp_fin, k_tcp_hdr, k_tcp_off_dataoff, k_tcp_syn, priv_emu_io_errf(), RA8_INTERNAL, s_state, s_tcp_estab_wait, s_tcp_need_data, s_tcp_our_seq, s_tcp_their_seq, and s_trace.
Referenced by internal_net_rx_ipv4().
|
static |
Build + queue an ARP reply giving the peer's MAC to the firmware.
Build + queue an arp reply giving the peer's mac to the firmware; this step is contained within the board net model and uses bounded caller or module-owned storage.
| [in] | to_mac | To mac input used by the operation. |
| [in] | to_ip | To ip input used by the operation. |
Definition at line 362 of file board_net.c.
References internal_net_eth_hdr(), internal_net_queue(), internal_put16(), internal_put32(), k_arp_len, k_arp_plen, k_arp_plen_off, k_arp_spa_off, k_arp_tha_off, k_arp_tpa_off, k_eth_arp, k_eth_hdr, k_eth_ipv4, k_mac_len, k_net_peer_ip, memcpy(), memset(), RA8_INTERNAL, and s_peer_mac.
Referenced by internal_net_rx_arp().
|
static |
Build + queue an ARP request asking who-has the firmware's IP.
Build + queue an arp request asking who-has the firmware's ip; this step is contained within the board net model and uses bounded caller or module-owned storage.
Definition at line 329 of file board_net.c.
References internal_net_eth_hdr(), internal_net_queue(), internal_put16(), internal_put32(), k_arp_len, k_arp_plen, k_arp_plen_off, k_arp_spa_off, k_arp_tpa_off, k_byte_mask, k_eth_arp, k_eth_hdr, k_eth_ipv4, k_mac_len, k_net_fw_ip, k_net_peer_ip, memcpy(), memset(), RA8_INTERNAL, and s_peer_mac.
Referenced by board_net_tick().
|
static |
Send the test payload to the established echo connection.
Send the test payload to the established echo connection; this step is contained within the board net model and uses bounded caller or module-owned storage.
Definition at line 512 of file board_net.c.
References internal_net_send_tcp(), k_tcp_ack, k_tcp_psh, RA8_INTERNAL, s_tcp_our_seq, and s_tcp_payload.
Referenced by board_net_tick().
|
static |
Build + queue an ICMP echo request to the firmware.
Build + queue an icmp echo request to the firmware; this step is contained within the board net model and uses bounded caller or module-owned storage.
Definition at line 418 of file board_net.c.
References internal_net_checksum(), internal_net_eth_hdr(), internal_net_ip_hdr(), internal_net_queue(), internal_put16(), k_eth_hdr, k_eth_ipv4, k_icmp_hdr, k_icmp_ident, k_icmp_pat_base, k_ip_hdr, k_ip_proto_icmp, memset(), RA8_INTERNAL, s_fw_mac, s_fw_mac_known, and s_ping_seq.
Referenced by board_net_tick(), and internal_net_rx_arp().
|
static |
Open the TCP connection: send SYN with our initial sequence number.
Open the tcp connection: send syn with our initial sequence number; this step is contained within the board net model and uses bounded caller or module-owned storage.
Definition at line 498 of file board_net.c.
References internal_net_send_tcp(), k_tcp_isn, k_tcp_syn, RA8_INTERNAL, and s_tcp_our_seq.
Referenced by board_net_tick(), and internal_net_rx_icmp().
|
static |
Build + queue a TCP segment to the firmware echo port (flags+payload).
Build + queue a tcp segment to the firmware echo port (flags+payload); this step is contained within the board net model and uses bounded caller or module-owned storage.
| [in] | flags | Flags input used by the operation. |
| [in] | payload | Payload input used by the operation. |
| [in] | payload_len | Bound for the payload data. |
Definition at line 457 of file board_net.c.
References internal_net_checksum(), internal_net_eth_hdr(), internal_net_ip_hdr(), internal_net_queue(), internal_put16(), internal_put32(), k_eth_hdr, k_eth_ipv4, k_ip_hdr, k_ip_proto_tcp, k_net_echo_port, k_net_fw_ip, k_net_peer_ip, k_net_peer_port, k_tcp_data_off, k_tcp_hdr, k_tcp_off_dataoff, k_tcp_off_flags, k_tcp_off_payload, k_tcp_off_window, k_tcp_payload_max, k_tcp_window, k_u16_mask, memcpy(), memset(), s_fw_mac, s_fw_mac_known, s_tcp_our_seq, and s_tcp_their_seq.
Referenced by internal_net_rx_tcp(), internal_net_send_data(), internal_net_send_syn(), and internal_net_tcp_on_estab().
|
static |
ESTAB state: echo-match the payload, then start our active (FIN) close.
Estab state: echo-match the payload, then start our active (fin) close; this step is contained within the board net model and uses bounded caller or module-owned storage.
| [in] | seq | Seq input used by the operation. |
| [in] | pdata | Pdata input used by the operation. |
| [in] | plen | Plen input used by the operation. |
Definition at line 531 of file board_net.c.
References internal_net_send_tcp(), k_net_fin, k_tcp_ack, k_tcp_fin, memcmp(), priv_emu_io_errf(), s_state, s_tcp_echoed, s_tcp_match, s_tcp_our_seq, s_tcp_payload, s_tcp_their_seq, and s_trace.
Referenced by internal_net_rx_tcp().
|
static |
Store a 16-bit value big-endian (network order) at p.
Store a 16-bit value big-endian (network order) at p; this step is contained within the board net model and uses bounded caller or module-owned storage.
| [in,out] | p | Module-owned state object processed by the operation. |
| [in] | v | Register or payload value processed by the operation. |
Definition at line 192 of file board_net.c.
References k_byte_mask, and RA8_INTERNAL.
Referenced by internal_net_eth_hdr(), internal_net_ip_hdr(), internal_net_send_arp_reply(), internal_net_send_arp_request(), internal_net_send_ping(), and internal_net_send_tcp().
|
static |
Store a 32-bit value big-endian at p.
Store a 32-bit value big-endian at p; this step is contained within the board net model and uses bounded caller or module-owned storage.
| [in,out] | p | Module-owned state object processed by the operation. |
| [in] | v | Register or payload value processed by the operation. |
Definition at line 208 of file board_net.c.
References k_byte_mask, k_shift24, and RA8_INTERNAL.
Referenced by internal_net_ip_hdr(), internal_net_send_arp_reply(), internal_net_send_arp_request(), and internal_net_send_tcp().
|
static |
ARP replies received.
Definition at line 127 of file board_net.c.
Referenced by board_net_init(), and internal_net_rx_arp().
|
static |
Frames delivered to firmware.
Definition at line 133 of file board_net.c.
Referenced by board_net_init(), board_net_poll_rx(), and board_net_report().
|
static |
Learned from ARP.
Definition at line 125 of file board_net.c.
Referenced by board_net_init(), internal_net_rx_arp(), internal_net_send_ping(), and internal_net_send_tcp().
|
static |
Definition at line 126 of file board_net.c.
Referenced by board_net_init(), board_net_report(), internal_net_rx_arp(), internal_net_send_ping(), and internal_net_send_tcp().
|
static |
Definition at line 120 of file board_net.c.
Referenced by internal_net_eth_hdr(), internal_net_send_arp_reply(), and internal_net_send_arp_request().
|
static |
ICMP echo sequence.
Definition at line 130 of file board_net.c.
Referenced by board_net_init(), and internal_net_send_ping().
|
static |
ICMP echo replies received.
Definition at line 128 of file board_net.c.
Referenced by board_net_init(), board_net_report(), and internal_net_rx_icmp().
|
static |
ra8_eth_read polls served.
Definition at line 132 of file board_net.c.
Referenced by board_net_init(), board_net_poll_rx(), and board_net_report().
|
static |
Definition at line 172 of file board_net.c.
Referenced by board_net_poll_rx(), and internal_net_queue().
|
static |
Definition at line 174 of file board_net.c.
Referenced by board_net_init(), board_net_poll_rx(), and internal_net_queue().
|
static |
Definition at line 173 of file board_net.c.
Referenced by board_net_poll_rx(), and internal_net_queue().
|
static |
Definition at line 175 of file board_net.c.
Referenced by board_net_init(), board_net_poll_rx(), and internal_net_queue().
|
static |
Definition at line 124 of file board_net.c.
|
static |
Echo payload bytes received.
Definition at line 136 of file board_net.c.
Referenced by board_net_init(), board_net_report(), internal_net_echo_state(), and internal_net_tcp_on_estab().
|
static |
Ticks since the connection established.
Definition at line 139 of file board_net.c.
Referenced by board_net_init(), board_net_tick(), and internal_net_rx_tcp().
|
static |
Echo matched what we sent.
Definition at line 137 of file board_net.c.
Referenced by board_net_init(), internal_net_echo_state(), and internal_net_tcp_on_estab().
|
static |
Payload queued to send post-handshake.
Definition at line 138 of file board_net.c.
Referenced by board_net_init(), board_net_tick(), and internal_net_rx_tcp().
|
static |
Our next TCP send sequence.
Definition at line 134 of file board_net.c.
Referenced by board_net_init(), internal_net_rx_tcp(), internal_net_send_data(), internal_net_send_syn(), internal_net_send_tcp(), and internal_net_tcp_on_estab().
|
static |
Payload the peer sends to the firmware's TCP echo server.
Its LENGTH is part of the EIL contract, not just an implementation detail: threadx_netx_tcp_echo echoes it and logs "[netx] echoed N bytes", and that exact line is the HIL_EXPECT its hil.conf asserts. So this string must not carry anything that gets renamed. It used to read "hello from board_sim\n" (21 bytes); the board_sim -> ra8_emulator rename silently made it 24 and broke that assertion, which nothing noticed because the app was parked outside the EIL run set at the time (#499). Hence a name-free literal and the static_assert below – change the text freely, but a change in length has to be made deliberately and mirrored in the hil.conf.
Definition at line 155 of file board_net.c.
Referenced by internal_net_send_data(), and internal_net_tcp_on_estab().
|
static |
Their next seq (our ack).
Definition at line 135 of file board_net.c.
Referenced by board_net_init(), internal_net_rx_tcp(), internal_net_send_tcp(), and internal_net_tcp_on_estab().
|
static |
Definition at line 123 of file board_net.c.
|
static |
Frames the firmware sent.
Definition at line 131 of file board_net.c.
Referenced by board_net_init(), board_net_on_tx(), and board_net_report().
|
static |
Ticks since the last send.
Definition at line 129 of file board_net.c.
Referenced by board_net_init(), board_net_tick(), internal_net_rx_arp(), and internal_net_rx_icmp().