|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
SCI8 / J-Link OB CDC console + text formatters (see header). More...
#include "usb_selftest_console.h"#include <stdint.h>#include "ra8_board_ek_ra8d2.h"#include "ra8_err.h"#include "usb_selftest_common.h"Go to the source code of this file.
Functions | |
| static uint8_t | selftest_nibble_to_hex (uint32_t nibble) |
| static uint32_t | selftest_str_len (const char *text) |
| Bounded ASCII string length (cap k_selftest_print_cap). | |
| static ra8_err_t | selftest_sci_write (const uint8_t *data, uint32_t len) |
| Push a literal block over SCI8 polled. | |
| ra8_err_t | selftest_print (const char *text) |
| Print a NUL-terminated ASCII string over the console. | |
| ra8_err_t | selftest_print_dec (uint32_t value) |
| Print a uint32_t as ASCII decimal. | |
| ra8_err_t | selftest_print_hex (uint32_t value, uint8_t digits) |
| Print a value as fixed-width uppercase hex. | |
| ra8_err_t | selftest_print_fail (const char *what, ra8_err_t err) |
| Print "FAIL <what> err=0xNNNNNNNN" on its own line. | |
SCI8 / J-Link OB CDC console + text formatters (see header).
The shared console for the soak self-test: a thin wrapper over polled SCI8 writes plus minimal heap-free decimal / hex / fail-line formatters. Split out of main.c so every TU prints through one path.
Definition in file usb_selftest_console.c.
|
static |
Definition at line 23 of file usb_selftest_console.c.
References k_selftest_hex_digit_split.
Referenced by selftest_print_hex().
|
nodiscard |
Print a NUL-terminated ASCII string over the console.
Length-bounded by selftest_str_len.
| [in] | text | String to print (CR/LF included by the caller). |
| k_ra8_ok | All bytes queued. |
text is non-NULL. text is NUL-terminated within k_selftest_print_cap bytes. Definition at line 103 of file usb_selftest_console.c.
References selftest_sci_write(), selftest_sci_write(), selftest_str_len(), and selftest_str_len().
Referenced by selftest_print_fail().
|
nodiscard |
Print a uint32_t as ASCII decimal.
Print an unsigned 32-bit value in decimal.
Digit-reversal into a bounded scratch buffer.
| [in] | value | Value to print. |
| k_ra8_ok | All bytes queued. |
Definition at line 126 of file usb_selftest_console.c.
References k_selftest_dec_chars_u32, k_selftest_dec_radix, selftest_sci_write(), and selftest_sci_write().
Print "FAIL <what> err=0xNNNNNNNN" on its own line.
Print a "FAIL <what> err=0x..." diagnostic line.
One-line diagnostic; print errors inside are not recoverable anyway, so the first failing chunk's code is returned.
| [in] | what | Short description of the failed step. |
| [in] | err | Error code returned by the step. |
| k_ra8_ok | The diagnostic line is queued. |
what is NUL-terminated within the print cap. Definition at line 203 of file usb_selftest_console.c.
References k_ra8_ok, k_selftest_hex_chars_u32, selftest_print(), and selftest_print_hex().
|
nodiscard |
Print a value as fixed-width uppercase hex.
Print the low digits hex nibbles of value (upper-case).
Width is clamped to 8 hex digits.
| [in] | value | Value to print. |
| [in] | digits | Hex digit count (4 for u16, 8 for u32). |
| k_ra8_ok | All bytes queued. |
digits is at most k_selftest_hex_chars_u32. Definition at line 169 of file usb_selftest_console.c.
References k_selftest_hex_chars_u32, k_selftest_nibble_bits, k_selftest_nibble_mask, selftest_nibble_to_hex(), selftest_nibble_to_hex(), selftest_sci_write(), and selftest_sci_write().
Referenced by selftest_print_fail().
|
staticnodiscard |
Push a literal block over SCI8 polled.
Thin wrapper fixing the console channel.
| [in] | data | Buffer to send. |
| [in] | len | Byte count. |
| k_ra8_ok | All bytes queued. |
data is non-NULL; SCI8 init already ran. len excludes any NUL terminator. Definition at line 80 of file usb_selftest_console.c.
References ra8_board_uart_console_write().
Referenced by selftest_print(), selftest_print_dec(), and selftest_print_hex().
|
static |
Bounded ASCII string length (cap k_selftest_print_cap).
Linear scan with a hard upper bound.
| [in] | text | NUL-terminated string. |
| 0 | For an empty string. |
text is non-NULL. text points to readable storage of at least the returned length. Definition at line 49 of file usb_selftest_console.c.
References k_selftest_print_cap.
Referenced by selftest_print().