ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
wifi_hal_console.c File Reference

Bounded console formatters for the HAL Wi-Fi join application. More...

#include <stddef.h>
#include <stdint.h>
#include "ra8_board_ek_ra8d2.h"
#include "ra8_c6link.h"
#include "ra8_wifi.h"
#include "wifi_hal_join.h"
Include dependency graph for wifi_hal_console.c:

Go to the source code of this file.

Functions

void wifi_hal_puts (const char *text)
 Write a NUL-terminated string to the console, bounded.
void wifi_hal_put_u32 (uint32_t value)
 Implementation of wifi_hal_put_u32() – reversed division loop.
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)
 Implementation of wifi_hal_put_ip() – four octets, dot-separated.
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.

Detailed Description

Bounded console formatters for the HAL Wi-Fi join application.

Tag
[Ring 6 / APP] {World: S}

Small serialisers – string, unsigned decimal, hexadecimal, IPv4 dotted quad and MAC address – plus the banner. They exist so the application can narrate itself without dragging newlib's printf (and its heap) into a bare-metal image that has no heap at all. Every loop here is bounded by a constant from wifi_hal_join.h (NASA Power of 10 Rule 2).

Since
0.1.0

Definition in file wifi_hal_console.c.

Function Documentation

◆ wifi_hal_print_banner()

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.

Parameters
[in]cpuclk_hzCPUCLK0 rate in hertz.
[in]pclka_hzPCLKA rate in hertz.
Returns
Nothing.
Precondition
The console has been initialised.
Both rates are the live cached values.
Postcondition
One multi-line banner was emitted.
No state beyond the UART is touched.
Note
Not thread-safe.
See also
wifi_hal_puts
Since
0.1.0

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().

◆ wifi_hal_put_hex()

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.

Parameters
[in]valueValue whose low nibbles are printed.
[in]digitsHex digits to print; 1..k_wifi_hal_hex_digits.
Returns
Nothing.
Precondition
digits is in range, else the call is a no-op.
The console has been initialised.
Postcondition
Exactly digits characters were emitted on the valid path.
No state beyond the UART is touched.
Note
Not thread-safe.
See also
wifi_hal_put_u32
Since
0.1.0

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().

◆ wifi_hal_put_ip()

void wifi_hal_put_ip ( uint32_t ip)

Implementation of wifi_hal_put_ip() – four octets, dot-separated.

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().

◆ wifi_hal_put_mac()

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.

Parameters
[in]macAddress to print, or null for a no-op.
Returns
Nothing.
Precondition
mac, when non-null, holds k_ra8_wifi_mac_bytes octets.
The console has been initialised.
Postcondition
Six octets separated by colons were emitted on the valid path.
No state beyond the UART is touched.
Note
Not thread-safe.
See also
wifi_hal_put_hex
Since
0.1.0

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().

◆ wifi_hal_put_u32()

void wifi_hal_put_u32 ( uint32_t value)

Implementation of wifi_hal_put_u32() – reversed division loop.

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().

◆ wifi_hal_puts()

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.

Parameters
[in]textString to write, or null for a no-op; at most k_wifi_hal_str_max octets are emitted.
Returns
Nothing.
Precondition
text is NUL-terminated within k_wifi_hal_str_max octets.
The console has been initialised.
Postcondition
At most k_wifi_hal_str_max octets were written.
No state beyond the UART is touched.
Note
Not thread-safe; call from one context.
See also
wifi_hal_put_u32
Since
0.1.0

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().