|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
NetX Duo IP bring-up over the C6 link: DHCP lease + ICMP reachability. More...
#include <stdint.h>#include <string.h>#include "c6_join.h"#include "nx_api.h"#include "nx_ether_driver_c6.h"#include "nxd_dhcp_client.h"#include "ra8_c6link.h"#include "ra8_err.h"#include "tx_api.h"Go to the source code of this file.
Enumerations | |
| enum | c6_join_net_size_t : uint32_t { k_c6_join_pkt_payload = 1568U , k_c6_join_pool_bytes = 40960U , k_c6_join_ip_stack = 2048U , k_c6_join_arp_bytes = 1040U , k_c6_join_ip_prio = 3U , k_c6_join_ping_len = 12U } |
| Static sizing for the NetX Duo objects this app owns. More... | |
Functions | |
| static UINT | priv_net_create_ip (void) |
| static UINT | priv_net_dhcp (c6_join_lease_t *out) |
| static bool | priv_net_ping (uint32_t gateway) |
| ra8_err_t | c6_join_net_up (ra8_c6link_t *link, const ra8_c6link_mac_t *mac, c6_join_lease_t *out) |
| Bring the IP layer up over the associated C6 link and prove traffic. | |
Variables | |
| static NX_PACKET_POOL | s_pool |
| NetX packet pool control block. | |
| static uint8_t | s_pool_mem [k_c6_join_pool_bytes] |
| Packet-pool backing store. | |
| static NX_IP | s_ip |
| NetX IP instance driven over the C6 link. | |
| static uint8_t | s_ip_stack [k_c6_join_ip_stack] |
| NetX IP helper-thread stack. | |
| static uint8_t | s_arp_cache [k_c6_join_arp_bytes] |
| ARP cache backing store. | |
| static NX_DHCP | s_dhcp |
| NetX DHCP client control block. | |
| static char | s_ping_payload [k_c6_join_ping_len] = "ra8-c6-ping" |
| Fixed ICMP echo payload. | |
| static CHAR | s_pool_name [] = "c6_join_pool" |
| Mutable pool name (NetX takes CHAR*). | |
| static CHAR | s_ip_name [] = "c6_join_ip" |
| Mutable IP-instance name. | |
| static CHAR | s_dhcp_name [] = "c6_join_dhcp" |
| Mutable DHCP-client name. | |
NetX Duo IP bring-up over the C6 link: DHCP lease + ICMP reachability.
Implements c6_join_net_up. Once the C6 station has associated, this creates the NetX Duo packet pool and IP instance on top of nx_ether_driver_c6, enables ARP / UDP / ICMP, runs the vendored DHCP client to a bound lease, and pings the leased gateway. All of it is the host side of the stack: the C6 is a pure L2 bridge, so DHCP, ARP and ICMP are answered by the RA8, not the co-processor.
The heavy NetX objects are file-scope statics because this image has no heap (NASA Power of 10 Rule 3). c6_join_net_up runs exactly once, on the application worker thread.
Definition in file c6_join_net.c.
| enum c6_join_net_size_t : uint32_t |
Static sizing for the NetX Duo objects this app owns.
Sized for full 1514-octet Ethernet frames plus DHCP and ICMP working set, with a comfortable packet count so a DHCP retransmit never starves ARP.
Definition at line 51 of file c6_join_net.c.
| ra8_err_t c6_join_net_up | ( | ra8_c6link_t * | link, |
| const ra8_c6link_mac_t * | mac, | ||
| c6_join_lease_t * | out ) |
Bring the IP layer up over the associated C6 link and prove traffic.
Binds nx_ether_driver_c6 to link, hands it the station MAC, creates the NetX Duo packet pool and IP instance, enables ARP / UDP / ICMP, runs the DHCP client to a bound lease, then pings the gateway. It performs no ra8_c6link calls itself after nx_ip_create – from that point the driver's RX worker owns the wire – so the caller must not poll the link directly once this runs.
| [in] | link | Open, associated C6 link handle; must be non-null. |
| [in] | mac | Station MAC read with ra8_c6link_wifi_mac; must be non-null. |
| [out] | out | Lease and reachability result; must be non-null. |
| k_ra8_ok | A lease was obtained; out->ping_ok reports reachability. |
| k_ra8_err_null_ptr | link, mac or out was null. |
| k_ra8_err_not_initialized | A NetX object could not be created. |
| k_ra8_err_timeout | No DHCP lease arrived within the budget. |
out holds a non-zero address; on failure out is cleared. Definition at line 173 of file c6_join_net.c.
References c6_join_lease::gateway, k_ra8_err_not_initialized, k_ra8_err_null_ptr, k_ra8_err_timeout, k_ra8_ok, nx_ether_driver_c6_bind(), nx_ether_driver_c6_set_mac(), ra8_c6link_mac::octet, c6_join_lease::ping_ok, priv_net_create_ip(), priv_net_dhcp(), and priv_net_ping().
Referenced by c6_join_phase_ip().
|
static |
Definition at line 82 of file c6_join_net.c.
References k_c6_join_ip_prio, k_c6_join_pkt_payload, nx_ether_driver_c6(), s_arp_cache, s_ip, s_ip_name, s_ip_stack, s_pool, s_pool_mem, and s_pool_name.
Referenced by c6_join_net_up().
|
static |
Definition at line 116 of file c6_join_net.c.
References c6_join_lease::dhcp_server, c6_join_lease::gateway, c6_join_lease::ip, k_c6_join_dhcp_wait_ms, c6_join_lease::mask, s_dhcp, s_dhcp_name, and s_ip.
Referenced by c6_join_net_up().
|
static |
Definition at line 149 of file c6_join_net.c.
References k_c6_join_ping_gap_ms, k_c6_join_ping_len, k_c6_join_ping_tries, k_c6_join_ping_wait_ms, s_ip, s_ping_payload, and tx_thread_sleep.
Referenced by c6_join_net_up().
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
Fixed ICMP echo payload.
Definition at line 73 of file c6_join_net.c.
Referenced by priv_net_ping().
|
static |
|
static |
|
static |