|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
The same Wi-Fi join as c6_wifi_join, the HAL way, through ra8_wifi. More...
#include <stdint.h>#include "nx_ether_driver_c6.h"#include "ra8_board_ek_ra8d2.h"#include "ra8_boot_entry.h"#include "ra8_c6link.h"#include "ra8_cgc.h"#include "ra8_err.h"#include "ra8_esp_hosted_c6link.h"#include "ra8_esp_hosted_port.h"#include "ra8_isr.h"#include "ra8_mstp.h"#include "ra8_net_provision.h"#include "ra8_time.h"#include "ra8_wifi.h"#include "ra8_wifi_c6link.h"#include "tx_api.h"#include "wifi_hal_join.h"Go to the source code of this file.
Functions | |
| static void | wifi_hal_panic_halt (void) |
| Halt the processor after an unrecoverable start-up failure. | |
| static void | wifi_hal_setup_or_halt (void) |
| Initialize platform services required by the HAL join application. | |
| static ra8_err_t | wifi_hal_make_cfg (ra8_wifi_cfg_t *out) |
| Build the C6-backed Wi-Fi and NetX DHCP configuration. | |
| static void | wifi_hal_print_lease (const ra8_wifi_lease_t *lease) |
| Print the non-secret fields of one DHCP lease. | |
| static bool | wifi_hal_report (const wifi_hal_result_t *res, bool joined) |
| Report one completed HAL journey and derive its terminal verdict. | |
| static bool | wifi_hal_run (const ra8_net_credentials_t *credentials) |
| Execute the HAL network journey with runtime credentials. | |
| static void | wifi_hal_heartbeat (bool passed) |
| Preserve the terminal verdict as a periodic console heartbeat. | |
| static void | wifi_hal_worker_entry (ULONG thread_input) |
| Run runtime provisioning, the HAL journey, erasure, and heartbeat. | |
| void | tx_application_define (void *first_unused_memory) |
| ThreadX define hook: bring the port up and start the worker. | |
| void | main (void) |
| Application entry: clocks, console, banner, then ThreadX. | |
Variables | |
| static uint32_t | s_cpuclk_hz |
| Cached CPUCLK0 rate. | |
| static uint32_t | s_pclka_hz |
| Cached PCLKA rate. | |
| static ra8_err_t | s_init_err = k_ra8_err_not_initialized |
| Port-init result from tx_application_define. | |
| static TX_THREAD | s_worker |
| Application worker thread. | |
| static CHAR | s_worker_name [] = "wifi_hal_join" |
| Worker thread name. | |
| static UCHAR | s_worker_stack [k_wifi_hal_worker_stack] |
| Worker thread stack. | |
| static uint8_t | s_arena [k_wifi_hal_arena_bytes] |
| Decode arena handed to the backend. | |
| static ra8_c6link_t | s_link |
| The one C6 link handle this app owns. | |
| static ra8_wifi_c6link_t | s_c6 |
| The ESP32-C6 ra8_wifi backend context. | |
| static ra8_wifi_t | s_wifi |
| The Wi-Fi handle every operation goes through. | |
| static const ra8_net_provision_uart_t | s_provision_uart |
| Board-console binding for the shared runtime provisioner. | |
The same Wi-Fi join as c6_wifi_join, the HAL way, through ra8_wifi.
A deliberate side-by-side with c6_wifi_join (kept unchanged next door): both associate the ESP32-C6 station with the bench access point and obtain a DHCP lease, but this one does it through the ra8_wifi facade. The whole network journey is six calls – ra8_wifi_c6link_setup, ra8_wifi_init, ra8_wifi_connect, ra8_wifi_wait_ip, plus ra8_wifi_get_mac and ra8_wifi_get_ap for the printout – with no ra8_c6link handle poked, no RPC sequence, no event callback and no station config struct in sight. The one thing the facade cannot own, obtaining an IP, is a caller-supplied provider: wifi_hal_ip_bind wraps NetX Duo's DHCP client.
The credential-free image accepts one bounded runtime provisioning record over the board console and erases it after the synchronous network journey.
Definition in file main.c.
| void main | ( | void | ) |
Application entry: clocks, console, banner, then ThreadX.
The application entry point Reset_Handler hands control to.
Definition at line 396 of file main.c.
References ra8_isr_globals_enable(), s_cpuclk_hz, s_pclka_hz, wifi_hal_panic_halt(), wifi_hal_print_banner(), wifi_hal_puts(), and wifi_hal_setup_or_halt().
| void tx_application_define | ( | void * | first_unused_memory | ) |
ThreadX define hook: bring the port up and start the worker.
| [in] | first_unused_memory | Free RAM from the ThreadX port; unused, every object here is static. |
Definition at line 360 of file main.c.
References k_ra8_board_pmod1_sci_channel, k_wifi_hal_edge_poll_ms, k_wifi_hal_sck_hz, k_wifi_hal_worker_prio, ra8_esp_hosted_port_init(), s_init_err, s_pclka_hz, s_worker, s_worker_name, s_worker_stack, TX_AUTO_START, TX_NO_TIME_SLICE, TX_SUCCESS, tx_thread_create, wifi_hal_puts(), and wifi_hal_worker_entry().
|
static |
Preserve the terminal verdict as a periodic console heartbeat.
Emits the immutable pass or fail line and sleeps for the fixed heartbeat period forever after the Wi-Fi journey completes.
| [in] | passed | Final application verdict. |
Definition at line 291 of file main.c.
References k_wifi_hal_heartbeat_ms, tx_thread_sleep, and wifi_hal_puts().
Referenced by wifi_hal_worker_entry().
|
static |
Build the C6-backed Wi-Fi and NetX DHCP configuration.
Binds ESP-hosted transport into the fixed-arena C6 backend, connects that backend to the facade configuration, and installs DHCP binding.
| [out] | out | Wi-Fi facade configuration destination. |
| k_ra8_ok | The complete configuration was bound. |
| other | Transport binding or backend setup error propagated unchanged. |
Definition at line 142 of file main.c.
References ra8_wifi_c6link_cfg::arena, ra8_wifi_c6link_cfg::arena_bytes, ra8_wifi_cfg::ip_bind, ra8_wifi_cfg::ip_ctx, k_ra8_ok, ra8_wifi_c6link_cfg::link, nx_ether_driver_c6_rx(), ra8_esp_hosted_c6link_bind(), ra8_wifi_c6link_setup(), ra8_wifi_c6link_cfg::rx_cb, s_arena, s_c6, s_link, ra8_wifi_c6link_cfg::transport, and wifi_hal_ip_bind().
Referenced by wifi_hal_run().
|
static |
Halt the processor after an unrecoverable start-up failure.
Executes wait-for-interrupt forever so failed platform or kernel initialization cannot fall through into a partial network journey.
Definition at line 86 of file main.c.
Referenced by main(), and wifi_hal_setup_or_halt().
|
static |
Print the non-secret fields of one DHCP lease.
Emits address, mask, gateway, and DHCP server in dotted-quad form through bounded console helpers.
| [in] | lease | Bound lease record to print. |
Definition at line 175 of file main.c.
References ra8_wifi_lease::dhcp_server, ra8_wifi_lease::gateway, ra8_wifi_lease::ip, ra8_wifi_lease::mask, wifi_hal_put_ip(), and wifi_hal_puts().
Referenced by wifi_hal_report().
|
static |
Report one completed HAL journey and derive its terminal verdict.
Emits each non-secret stage result and lease while requiring the aggregate result to agree with its recorded successful stages.
| [in] | res | Completed join result record. |
| [in] | joined | Aggregate verdict returned by wifi_hal_join_run. |
| true | Every stage and the aggregate verdict succeeded. |
| false | Initialization, association, DHCP, or aggregate verdict failed. |
Definition at line 244 of file main.c.
References wifi_hal_result::ap, wifi_hal_result::associated, ra8_wifi_ap::channel, 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, wifi_hal_result::lease, wifi_hal_result::mac, ra8_err_to_str(), wifi_hal_print_lease(), wifi_hal_put_mac(), wifi_hal_put_u32(), and wifi_hal_puts().
Referenced by wifi_hal_run().
|
static |
Execute the HAL network journey with runtime credentials.
Builds the hardware configuration, passes the caller-owned runtime strings into the host-tested orchestration, and reports its result.
| [in] | credentials | Validated runtime SSID and PSK record. |
| true | Association and DHCP completed. |
| false | Hardware binding, initialization, association, or DHCP failed. |
Definition at line 205 of file main.c.
References k_ra8_ok, k_wifi_hal_assoc_polls, ra8_net_credentials::psk, ra8_err_to_str(), s_wifi, ra8_net_credentials::ssid, wifi_hal_join_run(), wifi_hal_make_cfg(), wifi_hal_puts(), and wifi_hal_report().
Referenced by wifi_hal_worker_entry().
|
static |
Initialize platform services required by the HAL join application.
Brings up clocks, caches live rates, enables module-stop control, initializes delay timing, and opens the console in dependency order.
Definition at line 105 of file main.c.
References k_ra8_clock_id_cpuclk0, k_ra8_clock_id_pclka, k_ra8_ok, k_wifi_hal_uart_baud, ra8_board_uart_console_init(), ra8_cgc_get_clock_hz(), ra8_cgc_init(), ra8_mstp_init(), ra8_time_init(), s_cpuclk_hz, s_pclka_hz, and wifi_hal_panic_halt().
Referenced by main().
|
static |
Run runtime provisioning, the HAL journey, erasure, and heartbeat.
Refuses a failed port, receives one bounded record, passes it through the synchronous HAL journey, erases it, and enters terminal heartbeat.
| [in] | thread_input | Unused ThreadX entry argument. |
Definition at line 312 of file main.c.
References k_ra8_net_provision_timeout_ms, k_ra8_ok, k_wifi_hal_boot_wait_ms, k_wifi_hal_fail_line, k_wifi_hal_pass_line, ra8_delay_ms(), ra8_err_to_str(), ra8_net_provision_clear(), ra8_net_provision_receive(), s_init_err, s_provision_uart, wifi_hal_heartbeat(), wifi_hal_puts(), and wifi_hal_run().
Referenced by tx_application_define().
|
static |
|
static |
The ESP32-C6 ra8_wifi backend context.
Definition at line 64 of file main.c.
Referenced by wifi_hal_make_cfg().
|
static |
|
static |
|
static |
Board-console binding for the shared runtime provisioner.
|
static |
The Wi-Fi handle every operation goes through.
Definition at line 66 of file main.c.
Referenced by wifi_hal_run().
|
static |
|
static |
|
static |