31#include "nxd_dhcp_client.h"
51typedef enum : uint32_t {
89 if (s != NX_SUCCESS) {
92 s = nx_ip_create(&
s_ip,
94 IP_ADDRESS(0, 0, 0, 0),
95 IP_ADDRESS(0, 0, 0, 0),
101 if (s != NX_SUCCESS) {
105 if (s != NX_SUCCESS) {
108 s = nx_udp_enable(&
s_ip);
109 if (s != NX_SUCCESS) {
112 return nx_icmp_enable(&
s_ip);
119 if (s != NX_SUCCESS) {
122 s = nx_dhcp_start(&
s_dhcp);
123 if (s != NX_SUCCESS) {
127 s = nx_ip_status_check(&
s_ip,
128 (
ULONG)NX_IP_ADDRESS_RESOLVED,
131 if (s != NX_SUCCESS) {
138 (void)nx_ip_address_get(&
s_ip, &ip, &mask);
139 (void)nx_ip_gateway_address_get(&
s_ip, &gw);
140 (void)nx_dhcp_server_address_get(&
s_dhcp, &server);
141 out->
ip = (uint32_t)ip;
142 out->
mask = (uint32_t)mask;
155 NX_PACKET* resp = NX_NULL;
162 if (s == NX_SUCCESS) {
163 if (resp != NX_NULL) {
164 (void)nx_packet_release(resp);
175 if ((link ==
nullptr) || (mac ==
nullptr) || (out ==
nullptr)) {
182 nx_system_initialize();
static CHAR s_dhcp_name[]
static uint8_t s_pool_mem[k_c6_cam_net_pool_bytes]
static CHAR s_pool_name[]
Shared contract for the C6 Wi-Fi join + DHCP + reachability app.
@ k_c6_join_dhcp_wait_ms
DHCP lease wait budget, milliseconds/ticks.
@ k_c6_join_ping_gap_ms
Gap between echoes, milliseconds.
@ k_c6_join_ping_tries
ICMP echoes sent to the gateway.
@ k_c6_join_ping_wait_ms
Per-echo reply timeout, milliseconds/ticks.
struct c6_join_lease c6_join_lease_t
static char s_ping_payload[k_c6_join_ping_len]
Fixed ICMP echo payload.
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.
c6_join_net_size_t
Static sizing for the NetX Duo objects this app owns.
@ k_c6_join_ip_prio
NetX IP helper-thread priority.
@ k_c6_join_ping_len
ICMP echo payload length, in octets.
@ k_c6_join_arp_bytes
ARP cache backing store, in octets.
@ k_c6_join_ip_stack
NetX IP helper-thread stack, in octets.
@ k_c6_join_pool_bytes
Packet-pool backing store, in octets.
@ k_c6_join_pkt_payload
Per-packet payload, in octets.
static UINT priv_net_dhcp(c6_join_lease_t *out)
static UINT priv_net_create_ip(void)
static bool priv_net_ping(uint32_t gateway)
static ULONG s_ip_stack[k_demo_ip_stack/sizeof(ULONG)]
static ULONG s_arp_cache[k_demo_arp_cache/sizeof(ULONG)]
NetX Duo network driver shim that bridges onto the ESP32-C6 link.
void nx_ether_driver_c6_bind(ra8_c6link_t *link)
Bind an open C6 link handle to the driver and arm its mutex.
void nx_ether_driver_c6(NX_IP_DRIVER *driver_req)
NetX Duo link driver entry point for the ESP32-C6 Wi-Fi station.
void nx_ether_driver_c6_set_mac(const uint8_t mac[6])
Tell the driver the station MAC address to stamp on outgoing frames.
The single integration boundary between this firmware and the ESP32-C6.
struct ra8_c6link_mac ra8_c6link_mac_t
struct ra8_c6link ra8_c6link_t
Error Code Definitions for ra8-firmware.
@ k_ra8_err_not_initialized
Module not initialized – _init() not yet called successfully.
@ k_ra8_ok
Success – operation completed with all postconditions satisfied.
@ k_ra8_err_null_ptr
Pointer was NULL where a valid pointer was required.
@ k_ra8_err_timeout
Operation exceeded its time budget.
ra8_err_codes_t ra8_err_t
Canonical error-return type used by every ra8-firmware API.
static ra8_esp_hosted_pool_state_t s_pool
Singleton state of the memory and queue half.
unsigned int UINT
ThreadX-compatible unsigned int (host stub).
char CHAR
ThreadX-compatible CHAR (host stub).
unsigned long ULONG
ThreadX-compatible unsigned long (host stub).
uint32_t gateway
Default gateway from the lease; the ping target.
uint32_t mask
Subnet mask from the lease.
uint32_t dhcp_server
Address of the DHCP server that answered.
bool ping_ok
A gateway ICMP echo reply was received.
uint32_t ip
Leased station address, or zero on failure.
uint8_t octet[k_ra8_c6link_mac_bytes]
Address octets, first on the wire first.