|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
examples/ek_ra8d2/hw_validated/hil/usb_selftest_microsd/src/usb_selftest_microsd_console.c More...
#include <stddef.h>#include <stdint.h>#include "ra8_board_ek_ra8d2.h"#include "ra8_err.h"#include "usb_selftest_microsd_steps.h"Go to the source code of this file.
Functions | |
| static uint8_t | microsd_nibble_to_hex (uint32_t nibble) |
| Format one nibble (0..15) into an uppercase hex character. | |
| static uint32_t | microsd_str_len (const char *text) |
| Bounded ASCII string length (cap k_microsd_print_cap). | |
| static ra8_err_t | microsd_sci_write (const uint8_t *data, uint32_t len) |
| Push a literal block over the J-Link OB CDC console polled. | |
| ra8_err_t | microsd_print (const char *text) |
| Print a NUL-terminated ASCII string over the SCI8 console. | |
| ra8_err_t | microsd_print_dec (uint32_t value) |
| Implementation of microsd_print_dec() – digit-reversal scratch. | |
| ra8_err_t | microsd_print_hex (uint32_t value, uint8_t digits) |
| Implementation of microsd_print_hex() – width clamped to 8. | |
| ra8_err_t | microsd_print_fail (const char *what, ra8_err_t err) |
| Print "FAIL <what> err=0xNNNNNNNN" on its own console line. | |
examples/ek_ra8d2/hw_validated/hil/usb_selftest_microsd/src/usb_selftest_microsd_console.c
SCI8 (J-Link OB CDC) console formatters for the USB-microSD self-test
Split out of main.c to keep every translation unit under the line-count cap. Holds the bounded string/hex/decimal text formatters that stream verdicts over SCI8 at 115200 to the J-Link OB CDC bridge. The internal nibble/length/byte-write helpers stay file-static here; the public microsd_print* entry points are declared in usb_selftest_microsd_steps.h and consumed by both main.c and the host/device worker sibling.
Definition in file usb_selftest_microsd_console.c.
|
static |
Format one nibble (0..15) into an uppercase hex character.
Standard '0'-'9' then 'A'-'F' mapping.
| [in] | nibble | 4-bit value. |
| '0' | For a zero nibble. |
Definition at line 56 of file usb_selftest_microsd_console.c.
References k_microsd_hex_digit_split.
Referenced by microsd_print_hex().
|
nodiscard |
Print a NUL-terminated ASCII string over the SCI8 console.
| [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_microsd_print_cap bytes. Definition at line 119 of file usb_selftest_microsd_console.c.
References microsd_sci_write(), and microsd_str_len().
Referenced by microsd_host_enumerate(), microsd_host_pass(), microsd_print_fail(), and microsd_print_lun_ok().
|
nodiscard |
Implementation of microsd_print_dec() – digit-reversal scratch.
Print a uint32_t as ASCII decimal over the SCI8 console.
Definition at line 125 of file usb_selftest_microsd_console.c.
References k_microsd_dec_chars_u32, k_microsd_dec_radix, and microsd_sci_write().
Referenced by microsd_host_enumerate(), and microsd_print_lun_ok().
Print "FAIL <what> err=0xNNNNNNNN" on its own console line.
| [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 164 of file usb_selftest_microsd_console.c.
References k_microsd_hex_chars_u32, k_ra8_ok, microsd_print(), and microsd_print_hex().
Referenced by microsd_host_enumerate(), microsd_host_pass(), and microsd_verify_one().
|
nodiscard |
Implementation of microsd_print_hex() – width clamped to 8.
Print a value as fixed-width uppercase hex over the SCI8 console.
Definition at line 150 of file usb_selftest_microsd_console.c.
References k_microsd_hex_chars_u32, k_microsd_nibble_bits, k_microsd_nibble_mask, microsd_nibble_to_hex(), and microsd_sci_write().
Referenced by microsd_host_enumerate(), and microsd_print_fail().
|
staticnodiscard |
Push a literal block over the J-Link OB CDC console polled.
Thin wrapper fixing the console channel onto the EK-RA8D2 BSP SCI8 console transport.
| [in] | data | Buffer to send. |
| [in] | len | Byte count. |
| k_ra8_ok | All bytes queued. |
data is non-NULL; the BSP console init already ran. len excludes any NUL terminator. Definition at line 114 of file usb_selftest_microsd_console.c.
References ra8_board_uart_console_write().
Referenced by microsd_print(), microsd_print_dec(), and microsd_print_hex().
|
static |
Bounded ASCII string length (cap k_microsd_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 length. Definition at line 82 of file usb_selftest_microsd_console.c.
References k_microsd_print_cap.
Referenced by microsd_print().