|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
Shared contract for the C6 Wi-Fi join + DHCP + reachability app. More...
Go to the source code of this file.
Data Structures | |
| struct | c6_join_lease |
| What the DHCP bring-up learned, for the verdict and the console. More... | |
Typedefs | |
| typedef struct c6_join_lease | c6_join_lease_t |
Functions | |
| 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. | |
| void | c6_join_puts (const char *text) |
| Write a NUL-terminated string to the board console. | |
| void | c6_join_put_u32 (uint32_t value) |
| Emit an unsigned 32-bit value in decimal. | |
| void | c6_join_put_hex (uint32_t value, uint8_t digits) |
| Emit a value as a fixed-width lower-case hexadecimal field. | |
| void | c6_join_put_ip (uint32_t ip) |
| Emit a packed IPv4 address as a dotted quad. | |
| void | c6_join_put_mac (const ra8_c6link_mac_t *mac) |
| Emit an IEEE 802 address as six colon-separated hexadecimal octets. | |
| void | c6_join_print_banner (uint32_t cpuclk_hz, uint32_t pclka_hz) |
| Print the banner: identity, clocks and link parameters. | |
Shared contract for the C6 Wi-Fi join + DHCP + reachability app.
c6_wifi_link took the ESP32-C6's Wi-Fi station up through ra8_c6link and read its MAC, but joined no network – that was left to #492. This application is #492: it associates the station with the bench access point, runs a NetX Duo DHCP client over the nx_ether_driver_c6 link driver to obtain a lease, and then proves the path carries traffic by pinging the lease's gateway.
Three modules, driven by main.c:
The image and build graph contain no SSID or passphrase. The worker accepts one bounded versioned provisioning line over the debug UART after boot and explicitly erases the decoded record after association.
Definition in file c6_join.h.
| typedef struct c6_join_lease c6_join_lease_t |
| enum c6_join_cfg_t : uint32_t |
Link, thread and pacing parameters this application chooses.
Only values an application owns live here. This image has no heap (NASA Power of 10 Rule 3), so the worker stack and the decode arena are sized here alongside the link timing. The SPI rate matches the rate the C6 RPC round-trip and c6_wifi_link both ran at on silicon.
| enum c6_join_fmt_t : uint16_t |
Bounds for the console formatters in src/c6_join_console.c.
The image links no newlib printf, so the serialisers do their own digit extraction; every loop they run is bounded by a value from this enumeration (NASA Power of 10 Rule 2).
| enum c6_join_ip_shift_t : uint8_t |
Byte shifts that split a packed IPv4 address into its four octets.
A NetX ULONG IP address is big-endian in value: octet one is the most-significant byte. These shifts pull each octet for dotted-quad printing.
| enum c6_join_net_t : uint32_t |
Timing and retry bounds for association, DHCP and the ping.
The three waits an IP bring-up performs, all bounded so no loop can spin forever (NASA Power of 10 Rule 2). ThreadX runs at one tick per millisecond in this tree, so a millisecond value doubles as a tick count.
| 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().
| void c6_join_print_banner | ( | uint32_t | cpuclk_hz, |
| uint32_t | pclka_hz ) |
Print the banner: identity, clocks and link parameters.
Emits the application identity followed by measured CPU and peripheral clocks and immutable C6 transport geometry.
| [in] | cpuclk_hz | Live CPUCLK0 rate in hertz. |
| [in] | pclka_hz | Live PCLKA rate in hertz, the SCI baud-clock source. |
Definition at line 104 of file c6_join_console.c.
References c6_join_put_u32(), c6_join_puts(), k_c6_join_sck_hz, k_ra8_board_pmod1_sci_channel, k_ra8_c6link_frame_bytes, and k_ra8_c6link_max_payload.
Referenced by main().
| void c6_join_put_hex | ( | uint32_t | value, |
| uint8_t | digits ) |
Emit a value as a fixed-width lower-case hexadecimal field.
Extracts one nibble per requested digit from most to least significant position and emits a fixed local character buffer.
| [in] | value | Value to print. |
| [in] | digits | Field width, 1..k_c6_join_hex_digits; an out-of-range width prints nothing rather than overrunning the array. |
digits is within 1..k_c6_join_hex_digits. digits characters were emitted, or none on a bad width. digits (NASA Rule 2). Definition at line 58 of file c6_join_console.c.
References k_c6_join_hex_alpha, k_c6_join_hex_bits, k_c6_join_hex_digits, k_c6_join_hex_mask, and ra8_board_uart_console_write().
Referenced by c6_join_phase_ready(), and c6_join_put_mac().
| void c6_join_put_ip | ( | uint32_t | ip | ) |
Emit a packed IPv4 address as a dotted quad.
Extracts each bounded network octet from most to least significant position and separates decimal forms with periods.
| [in] | ip | NetX host-order packed IPv4 address. |
ip is a NetX ULONG address, most-significant octet first. Emit a packed IPv4 address as a dotted quad.
Definition at line 75 of file c6_join_console.c.
References c6_join_put_u32(), c6_join_puts(), k_c6_join_ip_mask, k_c6_join_ip_octets, k_c6_join_ip_shift_0, k_c6_join_ip_shift_1, k_c6_join_ip_shift_2, and k_c6_join_ip_shift_3.
Referenced by c6_join_phase_ip().
| void c6_join_put_mac | ( | const ra8_c6link_mac_t * | mac | ) |
Emit an IEEE 802 address as six colon-separated hexadecimal octets.
Walks the fixed address extent in wire order, printing two hex digits per octet and a colon between adjacent octets.
| [in] | mac | Address to print; null prints nothing. |
mac was filled by ra8_c6link_wifi_mac or is the zero address. Definition at line 91 of file c6_join_console.c.
References c6_join_put_hex(), c6_join_puts(), k_c6_join_hex_byte, k_ra8_c6link_mac_bytes, and ra8_c6link_mac::octet.
Referenced by c6_join_phase_associate().
| void c6_join_put_u32 | ( | uint32_t | value | ) |
Emit an unsigned 32-bit value in decimal.
Converts digits into a fixed local buffer in reverse order, then emits the used suffix without allocation or stdio.
| [in] | value | Value to print; the whole 32-bit range is representable. |
Emit an unsigned 32-bit value in decimal.
Definition at line 40 of file c6_join_console.c.
References k_c6_join_dec_digits, k_c6_join_dec_radix, and ra8_board_uart_console_write().
Referenced by c6_join_phase_associate(), c6_join_phase_ready(), c6_join_print_banner(), c6_join_put_ip(), and c6_join_worker_entry().
| void c6_join_puts | ( | const char * | text | ) |
Write a NUL-terminated string to the board console.
Measures at most the fixed string bound and forwards the resulting byte extent to the initialized board-console transmitter.
| [in] | text | String to emit; null is ignored and the length is capped at k_c6_join_str_max. |
text is NUL-terminated within k_c6_join_str_max bytes. Definition at line 27 of file c6_join_console.c.
References k_c6_join_str_max, and ra8_board_uart_console_write().
Referenced by c6_join_heartbeat(), c6_join_phase_associate(), c6_join_phase_ip(), c6_join_phase_ready(), c6_join_print_banner(), c6_join_put_ip(), c6_join_put_mac(), c6_join_report_fault(), c6_join_worker_entry(), main(), and tx_application_define().