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

Shared SCI8 console + text formatters for the soak self-test. More...

#include <stdint.h>
#include "ra8_err.h"
Include dependency graph for usb_selftest_console.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

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 an unsigned 32-bit value in decimal.
ra8_err_t selftest_print_hex (uint32_t value, uint8_t digits)
 Print the low digits hex nibbles of value (upper-case).
ra8_err_t selftest_print_fail (const char *what, ra8_err_t err)
 Print a "FAIL <what> err=0x..." diagnostic line.

Detailed Description

Shared SCI8 console + text formatters for the soak self-test.

The host worker prints all its verdicts through these helpers, which wrap polled SCI8 (the J-Link OB CDC bridge) with heap-free decimal / hex / fail formatters. Defined in usb_selftest_console.c.

Since
0.1.0

Definition in file usb_selftest_console.h.

Function Documentation

◆ selftest_print()

ra8_err_t selftest_print ( const char * text)
nodiscard

Print a NUL-terminated ASCII string over the console.

Parameters
[in]textNUL-terminated ASCII (bounded by k_selftest_print_cap).
Returns
ra8_err_t passthrough from the SCI write.
Since
0.1.0

Length-bounded by the bounded string-length scan.

Parameters
[in]textString to print (CR/LF included by the caller).
Returns
ra8_err_t propagated from the SCI helper.
Return values
k_ra8_okAll bytes queued.
Precondition
SCI8 init already ran; text is non-NULL.
text is NUL-terminated within k_selftest_print_cap bytes.
Postcondition
The string bytes are in the SCI8 TX FIFO.
No other state changes.
Note
Blocking polled TX.
Since
0.1.0

Length-bounded by selftest_str_len.

Parameters
[in]textString to print (CR/LF included by the caller).
Returns
ra8_err_t propagated from the SCI helper.
Return values
k_ra8_okAll bytes queued.
Precondition
SCI8 init already ran; text is non-NULL.
text is NUL-terminated within k_selftest_print_cap bytes.
Postcondition
The string bytes are in the SCI8 TX FIFO.
No other state changes.
Note
Blocking polled TX.
Since
0.1.0

Definition at line 423 of file usb_selftest_ospi_format.c.

References selftest_sci_write(), and selftest_str_len().

Referenced by selftest_print_fail().

◆ selftest_print_dec()

ra8_err_t selftest_print_dec ( uint32_t value)
nodiscard

Print an unsigned 32-bit value in decimal.

Parameters
[in]valueValue to print (no leading zeros; "0" for zero).
Returns
ra8_err_t passthrough from the SCI write.
Since
0.1.0

Print an unsigned 32-bit value in decimal.

Digit-reversal into a bounded scratch buffer.

Parameters
[in]valueValue to print.
Returns
ra8_err_t propagated from the SCI helper.
Return values
k_ra8_okAll bytes queued.
Precondition
SCI8 init already ran.
None beyond console readiness.
Postcondition
One ASCII decimal token is in the SCI8 TX FIFO.
No other state changes.
Note
Blocking polled TX.
Since
0.1.0

Definition at line 428 of file usb_selftest_ospi_format.c.

References k_selftest_dec_chars_u32, k_selftest_dec_radix, and selftest_sci_write().

◆ selftest_print_fail()

ra8_err_t selftest_print_fail ( const char * what,
ra8_err_t err )
nodiscard

Print a "FAIL <what> err=0x..." diagnostic line.

Parameters
[in]whatShort ASCII label for the failing step.
[in]errError code to render in hex.
Returns
ra8_err_t passthrough from the SCI writes.
Since
0.1.0

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.

Parameters
[in]whatShort description of the failed step.
[in]errError code returned by the step.
Returns
ra8_err_t propagated from the SCI helpers.
Return values
k_ra8_okThe diagnostic line is queued.
Precondition
SCI8 init already ran.
what is NUL-terminated within the print cap.
Postcondition
One diagnostic line is in the SCI8 TX FIFO.
No other state changes.
Note
Blocking polled TX.
Since
0.1.0

Definition at line 466 of file usb_selftest_ospi_format.c.

References k_ra8_ok, k_selftest_hex_chars_u32, selftest_print(), and selftest_print_hex().

◆ selftest_print_hex()

ra8_err_t selftest_print_hex ( uint32_t value,
uint8_t digits )
nodiscard

Print the low digits hex nibbles of value (upper-case).

Parameters
[in]valueValue to print.
[in]digitsNumber of hex digits to emit (e.g. 4 or 8).
Returns
ra8_err_t passthrough from the SCI write.
Since
0.1.0

Print the low digits hex nibbles of value (upper-case).

Width is clamped to 8 hex digits.

Parameters
[in]valueValue to print.
[in]digitsHex digit count (4 for u16, 8 for u32).
Returns
ra8_err_t propagated from the SCI helper.
Return values
k_ra8_okAll bytes queued.
Precondition
SCI8 init already ran.
digits is at most k_selftest_hex_chars_u32.
Postcondition
One fixed-width hex token is in the SCI8 TX FIFO.
No other state changes.
Note
Blocking polled TX.
Since
0.1.0

Definition at line 452 of file usb_selftest_ospi_format.c.

References k_selftest_hex_chars_u32, k_selftest_nibble_bits, k_selftest_nibble_mask, selftest_nibble_to_hex(), and selftest_sci_write().

Referenced by selftest_print_fail().