30#include "nxd_dhcp_client.h"
53typedef enum : uint32_t {
88 if (s != NX_SUCCESS) {
91 s = nx_ip_create(&
s_ip,
93 IP_ADDRESS(0, 0, 0, 0),
94 IP_ADDRESS(0, 0, 0, 0),
100 if (s != NX_SUCCESS) {
104 if (s != NX_SUCCESS) {
107 s = nx_udp_enable(&
s_ip);
108 if (s != NX_SUCCESS) {
111 return nx_icmp_enable(&
s_ip);
118 if (s != NX_SUCCESS) {
121 s = nx_dhcp_start(&
s_dhcp);
122 if (s != NX_SUCCESS) {
126 s = nx_ip_status_check(&
s_ip,
127 (
ULONG)NX_IP_ADDRESS_RESOLVED,
130 if (s != NX_SUCCESS) {
137 (void)nx_ip_address_get(&
s_ip, &ip, &mask);
138 (void)nx_ip_gateway_address_get(&
s_ip, &gw);
139 (void)nx_dhcp_server_address_get(&
s_dhcp, &server);
140 out->
ip = (uint32_t)ip;
141 out->
mask = (uint32_t)mask;
149 if ((ip_ctx ==
nullptr) || (mac ==
nullptr) || (out ==
nullptr)) {
157 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[]
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 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).
A small, uniform Wi-Fi facade: init, connect, get an IP, disconnect.
struct ra8_wifi_mac ra8_wifi_mac_t
struct ra8_wifi_lease ra8_wifi_lease_t
uint32_t dhcp_server
Address of the DHCP server that answered.
uint32_t gateway
Default gateway from the lease.
uint32_t mask
Subnet mask from the lease.
bool bound
A usable lease is held.
uint32_t ip
Leased station address, or zero if unbound.
uint8_t octet[k_ra8_wifi_mac_bytes]
Address octets, first on the wire first.
static UINT priv_net_dhcp(ra8_wifi_lease_t *out)
ra8_err_t wifi_hal_ip_bind(void *ip_ctx, const ra8_wifi_mac_t *mac, ra8_wifi_lease_t *out)
The application's IP provider: a NetX Duo DHCP client to a lease.
wifi_hal_net_size_t
Static sizing for the NetX Duo objects this application owns.
@ k_wifi_hal_ip_prio
NetX IP helper-thread priority.
@ k_wifi_hal_ip_stack
NetX IP helper-thread stack, in octets.
@ k_wifi_hal_pkt_payload
Per-packet payload, in octets.
@ k_wifi_hal_pool_bytes
Packet-pool backing store, in octets.
@ k_wifi_hal_arp_bytes
ARP cache backing store, in octets.
static UINT priv_net_create_ip(void)
Constants, console formatters and the DHCP provider for the HAL join.
@ k_wifi_hal_dhcp_wait_ms
DHCP lease wait budget, ticks.