|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
Constants, console formatters and the DHCP provider for the HAL join. More...
Go to the source code of this file.
Data Structures | |
| struct | wifi_hal_result |
| The observable outcome of one wifi_hal_join_run, for the banner and the host test. More... | |
| struct | wifi_hal_run_cfg |
| Injected dependencies for the hardware-free wifi_hal_join_run. More... | |
Typedefs | |
| typedef struct wifi_hal_result | wifi_hal_result_t |
| typedef struct wifi_hal_run_cfg | wifi_hal_run_cfg_t |
Functions | |
| bool | wifi_hal_join_run (const wifi_hal_run_cfg_t *cfg, wifi_hal_result_t *out) |
| The example's whole network journey, hardware-free: init, join, DHCP. | |
| 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. | |
| void | wifi_hal_puts (const char *text) |
| Write a NUL-terminated string to the console, bounded. | |
| void | wifi_hal_put_u32 (uint32_t value) |
| Write an unsigned 32-bit value in decimal. | |
| void | wifi_hal_put_hex (uint32_t value, uint8_t digits) |
Write the low digits nibbles of a value in hexadecimal. | |
| void | wifi_hal_put_ip (uint32_t ip) |
| Write a packed IPv4 address as a dotted quad. | |
| void | wifi_hal_put_mac (const ra8_wifi_mac_t *mac) |
| Write a station MAC as colon-separated hex octets. | |
| void | wifi_hal_print_banner (uint32_t cpuclk_hz, uint32_t pclka_hz) |
| Print the start-up banner naming the clocks and the link geometry. | |
Variables | |
| const char | k_wifi_hal_pass_line [] |
| The exact PASS line the run prints; the HIL gate keys on it. | |
| const char | k_wifi_hal_fail_line [] |
| The summary FAIL line the run prints when it did not reach an IP. | |
Constants, console formatters and the DHCP provider for the HAL join.
The companion to main.c. It holds the build constants, the bounded console serialisers (so the image needs no printf and no heap), and the one function that is genuinely stack-specific: wifi_hal_ip_bind, the ra8_wifi_ip_bind_fn that runs a NetX Duo DHCP client to a lease. Everything Wi-Fi lives behind ra8_wifi.h – this header adds only what a bench application needs around it.
Definition in file wifi_hal_join.h.
| typedef struct wifi_hal_result wifi_hal_result_t |
| typedef struct wifi_hal_run_cfg wifi_hal_run_cfg_t |
| enum wifi_hal_cfg_t : uint32_t |
Clocking, pacing and RAM budgets the application sets.
The SPI bit rate and boot wait are the bench-proven figures the c6 examples settled on. The arena and worker stack size the one link and the one worker thread this image owns.
Definition at line 50 of file wifi_hal_join.h.
| enum wifi_hal_fmt_t : uint16_t |
Widths the bounded console formatters work to.
Restated locally so the console loops have named bounds (NASA Rule 2) without reaching into another example's header.
Definition at line 106 of file wifi_hal_join.h.
| enum wifi_hal_ip_shift_t : uint8_t |
Bit shifts that pick each octet out of a packed IPv4 address.
Separated from wifi_hal_fmt_t only to keep an 8-bit shift set in its own smallest type.
Definition at line 133 of file wifi_hal_join.h.
| enum wifi_hal_wait_t : uint32_t |
How long the application waits at each blocking step.
ra8_wifi_connect blocks internally, but a slow association may outlast its budget, so the application then pumps ra8_wifi_poll a bounded number of times. The DHCP wait is the NetX lease budget.
| Enumerator | |
|---|---|
| k_wifi_hal_assoc_polls | Extra association polls after connect. |
| k_wifi_hal_assoc_gap_ms | Gap between association polls. |
| k_wifi_hal_dhcp_wait_ms | DHCP lease wait budget, ticks. |
Definition at line 81 of file wifi_hal_join.h.
|
nodiscard |
The application's IP provider: a NetX Duo DHCP client to a lease.
The ra8_wifi_ip_bind_fn ra8_wifi_wait_ip calls. It binds the wireless NetX link driver to the open C6 link, creates the packet pool and IP instance, runs the vendored DHCP client to a bound lease, and copies the lease out. From here NetX Duo owns the wire.
| [in] | ip_ctx | The open ra8_c6link_t* this application passed as ra8_wifi_cfg::ip_ctx; must be non-null. |
| [in] | mac | The station MAC the IP stack must adopt; must be non-null. |
| [out] | out | Lease to fill; must be non-null. |
| k_ra8_ok | A lease was obtained and copied into out. |
| k_ra8_err_null_ptr | An argument was null. |
| k_ra8_err_not_initialized | The NetX objects could not be created. |
| k_ra8_err_timeout | DHCP did not bind within k_wifi_hal_dhcp_wait_ms. |
ip_ctx is the same open link the facade drives. out->bound is implied by a non-zero out->ip. out is cleared.Definition at line 147 of file wifi_hal_ip.c.
References ra8_wifi_lease::bound, ra8_wifi_lease::ip, 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_wifi_mac::octet, priv_net_create_ip(), and priv_net_dhcp().
Referenced by wifi_hal_make_cfg().
|
nodiscard |
The example's whole network journey, hardware-free: init, join, DHCP.
The wiring this example demonstrates, extracted so it is testable on the host exactly as it runs on the board. It initialises the facade, checks that runtime credentials are non-empty, connects, settles the association, reads the MAC and AP record, and obtains an IP – recording each fact in out and stopping at the first step that fails. It performs no I/O of its own; the caller prints from out.
| [in] | cfg | Injected dependencies; must be non-null with a facade config and handle. |
| [out] | out | Result to populate; must be non-null. |
out->passed). | true | The station associated and DHCP leased an address. |
| false | A step failed; out says how far it got. |
cfg->ssid is NUL-terminated. out is fully populated, including on every failure path. out->ip_bound and out->passed are true.Definition at line 71 of file wifi_hal_core.c.
References wifi_hal_result::ap, wifi_hal_result::associated, wifi_hal_result::connect_err, wifi_hal_result::init_err, wifi_hal_result::init_ok, wifi_hal_result::ip_bound, wifi_hal_result::ip_err, k_ra8_err_not_initialized, k_ra8_ok, wifi_hal_result::lease, wifi_hal_result::mac, wifi_hal_result::passed, wifi_hal_run_cfg::poll_budget, wifi_hal_run_cfg::psk, ra8_wifi_connect(), ra8_wifi_get_ap(), ra8_wifi_get_mac(), ra8_wifi_init(), ra8_wifi_wait_ip(), wifi_hal_run_cfg::ssid, wifi_hal_run_cfg::wifi, wifi_hal_run_cfg::wifi_cfg, and wifi_hal_settle().
Referenced by wifi_hal_run().
| void wifi_hal_print_banner | ( | uint32_t | cpuclk_hz, |
| uint32_t | pclka_hz ) |
Print the start-up banner naming the clocks and the link geometry.
Emits application identity, measured clock values, and immutable C6 transport bounds through the bounded console helpers.
| [in] | cpuclk_hz | CPUCLK0 rate in hertz. |
| [in] | pclka_hz | PCLKA rate in hertz. |
Definition at line 106 of file wifi_hal_console.c.
References k_ra8_board_pmod1_sci_channel, k_ra8_c6link_frame_bytes, k_wifi_hal_sck_hz, wifi_hal_put_u32(), and wifi_hal_puts().
Referenced by main().
| void wifi_hal_put_hex | ( | uint32_t | value, |
| uint8_t | digits ) |
Write the low digits nibbles of a value in hexadecimal.
Extracts each requested nibble from most to least significant position and translates it through an immutable lowercase alphabet.
| [in] | value | Value whose low nibbles are printed. |
| [in] | digits | Hex digits to print; 1..k_wifi_hal_hex_digits. |
digits is in range, else the call is a no-op. digits characters were emitted on the valid path. Definition at line 60 of file wifi_hal_console.c.
References k_wifi_hal_hex_alpha, k_wifi_hal_hex_bits, k_wifi_hal_hex_digits, k_wifi_hal_hex_mask, and ra8_board_uart_console_write().
Referenced by wifi_hal_put_mac().
| void wifi_hal_put_ip | ( | uint32_t | ip | ) |
Write a packed IPv4 address as a dotted quad.
Extracts the four host-order octets in display order and delegates decimal conversion while inserting fixed period separators.
| [in] | ip | Address in host order, high octet in the most significant byte. |
ip is host-order packed, as NetX returns it. Write a packed IPv4 address as a dotted quad.
Definition at line 77 of file wifi_hal_console.c.
References k_wifi_hal_ip_mask, k_wifi_hal_ip_octets, k_wifi_hal_ip_shift_0, k_wifi_hal_ip_shift_1, k_wifi_hal_ip_shift_2, k_wifi_hal_ip_shift_3, wifi_hal_put_u32(), and wifi_hal_puts().
Referenced by wifi_hal_print_lease().
| void wifi_hal_put_mac | ( | const ra8_wifi_mac_t * | mac | ) |
Write a station MAC as colon-separated hex octets.
Walks the fixed address extent in wire order and delegates each two-digit octet conversion while inserting colon separators.
| [in] | mac | Address to print, or null for a no-op. |
mac, when non-null, holds k_ra8_wifi_mac_bytes octets. Definition at line 93 of file wifi_hal_console.c.
References k_ra8_wifi_mac_bytes, k_wifi_hal_hex_byte, ra8_wifi_mac::octet, wifi_hal_put_hex(), and wifi_hal_puts().
Referenced by wifi_hal_report().
| void wifi_hal_put_u32 | ( | uint32_t | value | ) |
Write an unsigned 32-bit value in decimal.
Generates decimal digits into a fixed local buffer from the end toward the front, then emits only the populated suffix.
| [in] | value | Value to write. |
Write an unsigned 32-bit value in decimal.
Definition at line 42 of file wifi_hal_console.c.
References k_wifi_hal_dec_digits, k_wifi_hal_dec_radix, and ra8_board_uart_console_write().
Referenced by wifi_hal_print_banner(), wifi_hal_put_ip(), and wifi_hal_report().
| void wifi_hal_puts | ( | const char * | text | ) |
Write a NUL-terminated string to the console, bounded.
Measures the string within the application maximum and forwards exactly that byte extent to the initialized board console.
| [in] | text | String to write, or null for a no-op; at most k_wifi_hal_str_max octets are emitted. |
text is NUL-terminated within k_wifi_hal_str_max octets. Definition at line 29 of file wifi_hal_console.c.
References k_wifi_hal_str_max, and ra8_board_uart_console_write().
Referenced by main(), tx_application_define(), wifi_hal_heartbeat(), wifi_hal_print_banner(), wifi_hal_print_lease(), wifi_hal_put_ip(), wifi_hal_put_mac(), wifi_hal_report(), wifi_hal_run(), and wifi_hal_worker_entry().
|
extern |
The summary FAIL line the run prints when it did not reach an IP.
The counterpart to k_wifi_hal_pass_line; specific failures also print a diagnostic sub-line that HIL_EXPECT_NEGATIVE matches.
Definition at line 32 of file wifi_hal_core.c.
Referenced by wifi_hal_worker_entry().
|
extern |
The exact PASS line the run prints; the HIL gate keys on it.
Shared by the core (which selects it) and main.c (which prints it), so the string the host test asserts is the string that reaches the console on silicon. hil.conf's HIL_EXPECT is a substring of it.
Definition at line 30 of file wifi_hal_core.c.
Referenced by wifi_hal_worker_entry().