|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
Shared contract for the ra8_c6link facade bring-up application. More...
Go to the source code of this file.
Enumerations | |
| enum | c6_wifi_cfg_t : uint32_t { k_c6_wifi_uart_baud = 115200U , k_c6_wifi_sck_hz = 5000000U , k_c6_wifi_edge_poll_ms = 2U , k_c6_wifi_boot_wait_ms = 200U , k_c6_wifi_heartbeat_ms = 5000U , k_c6_wifi_worker_stack = 8192U , k_c6_wifi_worker_prio = 8U , k_c6_wifi_arena_bytes = 4096U } |
| Link, thread and pacing parameters this application chooses. More... | |
| enum | c6_wifi_fmt_t : uint16_t { k_c6_wifi_str_max = 256U , k_c6_wifi_dec_radix = 10U , k_c6_wifi_dec_digits = 10U , k_c6_wifi_hex_digits = 8U , k_c6_wifi_hex_bits = 4U , k_c6_wifi_hex_mask = 0x0FU , k_c6_wifi_hex_alpha = 10U , k_c6_wifi_hex_byte = 2U , k_c6_wifi_text_max = 32U } |
| Bounds for the console formatters in src/c6_wifi_console.c. More... | |
Functions | |
| void | c6_wifi_puts (const char *text) |
| Write a NUL-terminated string to the board console. | |
| void | c6_wifi_put_u32 (uint32_t value) |
| Emit an unsigned 32-bit value in decimal. | |
| void | c6_wifi_put_i32 (int32_t value) |
| Emit a signed 32-bit value in decimal. | |
| void | c6_wifi_put_hex (uint32_t value, uint8_t digits) |
| Emit a value as a fixed-width lower-case hexadecimal field. | |
| void | c6_wifi_put_text (const char *text, size_t len) |
| Emit a NUL-terminated co-processor string as printable text. | |
| void | c6_wifi_put_mac (const ra8_c6link_mac_t *mac) |
| Emit an IEEE 802 address as six colon-separated hexadecimal octets. | |
| void | c6_wifi_print_banner (uint32_t cpuclk_hz, uint32_t pclka_hz) |
| Print the banner: identity, clocks and link parameters. | |
| void | c6_wifi_print_stats (const char *label, const ra8_c6link_stats_t *stats) |
| Print what one facade poll did, as one console line. | |
Shared contract for the ra8_c6link facade bring-up application.
c6_fw_version proved one esp-hosted RPC round-trip by hand-building the request inside the application. This application proves the same wire through libs/ra8_c6link, the facade every consumer is meant to use, and then goes one step further: it brings the co-processor's Wi-Fi station up and reads back its MAC address. That is the first thing #492's NetX Duo glue will do, and it is the part of the control plane a host test cannot settle – whether the Req_WifiInit configuration this host transmits is one the co-processor's own build accepts.
Two modules, both driven by main.c:
Everything protocol-shaped lives in the facade. This file holds only what an application genuinely owns: pacing, buffer bounds and formatter widths.
Definition in file c6_wifi.h.
| enum c6_wifi_cfg_t : uint32_t |
Link, thread and pacing parameters this application chooses.
Only values an application owns live here. NASA Power of 10 Rule 3 forbids allocation after initialisation and this image has no heap, so the worker stack and the decode arena are sized here alongside the link timing.
| enum c6_wifi_fmt_t : uint16_t |
Bounds for the console formatters in src/c6_wifi_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, which is what satisfies NASA Power of 10 Rule 2.
| void c6_wifi_print_banner | ( | uint32_t | cpuclk_hz, |
| uint32_t | pclka_hz ) |
Print the banner: identity, clocks and link parameters.
| [in] | cpuclk_hz | Live CPUCLK0 rate in hertz. |
| [in] | pclka_hz | Live PCLKA rate in hertz, the SCI baud-clock source. |
Definition at line 140 of file c6_wifi_console.c.
References c6_wifi_put_u32(), c6_wifi_puts(), k_c6_wifi_sck_hz, k_ra8_board_pmod1_sci_channel, k_ra8_c6link_frame_bytes, and k_ra8_c6link_max_payload.
Referenced by main().
| void c6_wifi_print_stats | ( | const char * | label, |
| const ra8_c6link_stats_t * | stats ) |
Print what one facade poll did, as one console line.
| [in] | label | Field name printed before the counters; null prints nothing at all rather than being dereferenced. |
| [in] | stats | Counters filled in by ra8_c6link_poll; null prints nothing. |
stats came from a completed poll. Definition at line 159 of file c6_wifi_console.c.
References ra8_c6link_stats::bad_checksum, c6_wifi_put_u32(), c6_wifi_puts(), ra8_c6link_stats::data, ra8_c6link_stats::eth_in, ra8_c6link_stats::events, ra8_c6link_stats::hs_timeouts, ra8_c6link_stats::idle, ra8_c6link_stats::malformed, ra8_c6link_stats::rpc_in, ra8_c6link_stats::transfers, ra8_c6link_stats::undecodable, and ra8_c6link_stats::unrouted.
Referenced by c6_wifi_phase_station().
| void c6_wifi_put_hex | ( | uint32_t | value, |
| uint8_t | digits ) |
Emit a value as a fixed-width lower-case hexadecimal field.
| [in] | value | Value to print. |
| [in] | digits | Field width, 1..k_c6_wifi_hex_digits; an out-of-range width prints nothing rather than overrunning the output array. |
digits is within 1..k_c6_wifi_hex_digits. digits characters were emitted, or none on a bad width. digits (NASA Rule 2). Definition at line 94 of file c6_wifi_console.c.
References k_c6_wifi_hex_alpha, k_c6_wifi_hex_bits, k_c6_wifi_hex_digits, k_c6_wifi_hex_mask, and ra8_board_uart_console_write().
Referenced by c6_wifi_phase_identity(), and c6_wifi_put_mac().
| void c6_wifi_put_i32 | ( | int32_t | value | ) |
Emit a signed 32-bit value in decimal.
| [in] | value | Value to print, including INT32_MIN. |
Emit a signed 32-bit value in decimal.
Definition at line 84 of file c6_wifi_console.c.
References c6_wifi_put_u32(), and c6_wifi_puts().
Referenced by c6_wifi_on_event(), and c6_wifi_report_fault().
| void c6_wifi_put_mac | ( | const ra8_c6link_mac_t * | mac | ) |
Emit an IEEE 802 address as six colon-separated hexadecimal 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 127 of file c6_wifi_console.c.
References c6_wifi_put_hex(), c6_wifi_puts(), k_c6_wifi_hex_byte, k_ra8_c6link_mac_bytes, and ra8_c6link_mac::octet.
Referenced by c6_wifi_phase_station().
| void c6_wifi_put_text | ( | const char * | text, |
| size_t | len ) |
Emit a NUL-terminated co-processor string as printable text.
The co-processor supplies the bytes, so nothing about them is trusted: the string is truncated to k_c6_wifi_text_max and every byte outside printable ASCII is replaced with a full stop. A protocol field is evidence, and evidence that can reprogram a terminal is not evidence.
| [in] | text | Bytes to emit; null prints nothing. |
| [in] | len | Number of bytes available at text. |
len bytes are readable at text. Emit a NUL-terminated co-processor string as printable text.
Definition at line 111 of file c6_wifi_console.c.
References k_c6_wifi_ascii_high, k_c6_wifi_ascii_low, k_c6_wifi_ascii_sub, k_c6_wifi_text_max, and ra8_board_uart_console_write().
Referenced by c6_wifi_on_event(), and c6_wifi_phase_identity().
| void c6_wifi_put_u32 | ( | uint32_t | value | ) |
Emit an unsigned 32-bit value in decimal.
| [in] | value | Value to print; the whole 32-bit range is representable. |
Emit an unsigned 32-bit value in decimal.
Definition at line 65 of file c6_wifi_console.c.
References k_c6_wifi_dec_digits, k_c6_wifi_dec_radix, and ra8_board_uart_console_write().
Referenced by c6_wifi_heartbeat(), c6_wifi_on_event(), c6_wifi_phase_identity(), c6_wifi_print_banner(), c6_wifi_print_stats(), c6_wifi_put_i32(), c6_wifi_report_fault(), and c6_wifi_worker_entry().
| void c6_wifi_puts | ( | const char * | text | ) |
Write a NUL-terminated string to the board console.
| [in] | text | String to emit; null is ignored rather than dereferenced and the length is capped at k_c6_wifi_str_max. |
text is NUL-terminated within k_c6_wifi_str_max bytes. Definition at line 52 of file c6_wifi_console.c.
References k_c6_wifi_str_max, and ra8_board_uart_console_write().
Referenced by c6_wifi_heartbeat(), c6_wifi_on_event(), c6_wifi_phase_identity(), c6_wifi_phase_ready(), c6_wifi_phase_station(), c6_wifi_print_banner(), c6_wifi_print_stats(), c6_wifi_put_i32(), c6_wifi_put_mac(), c6_wifi_report_fault(), c6_wifi_worker_entry(), main(), and tx_application_define().