|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
examples/ek_ra8d2/hw_pending/manual/usb_msc_sdcard/src/usb_msc_sdcard_console.c More...
#include <stddef.h>#include <stdint.h>#include "ra8_board_ek_ra8d2.h"#include "ra8_err.h"#include "usb_msc_sdcard_steps.h"Go to the source code of this file.
Functions | |
| static uint8_t | sdmsc_nibble_to_hex (uint32_t nibble) |
| Format one nibble (0..15) into an uppercase hex character. | |
| static uint32_t | sdmsc_str_len (const char *text) |
| Bounded ASCII string length (cap k_sdmsc_print_cap). | |
| static ra8_err_t | sdmsc_sci_write (const uint8_t *data, uint32_t len) |
| Push a literal block over the J-Link OB CDC console polled. | |
| ra8_err_t | sdmsc_print (const char *text) |
| Print a NUL-terminated ASCII string over the SCI8 console. | |
| ra8_err_t | sdmsc_print_dec (uint32_t value) |
| Implementation of sdmsc_print_dec() – digit-reversal scratch. | |
| ra8_err_t | sdmsc_print_hex (uint32_t value, uint8_t digits) |
| Implementation of sdmsc_print_hex() – width clamped to 8. | |
| ra8_err_t | sdmsc_print_fail (const char *what, ra8_err_t err) |
| Print "FAIL <what> err=0xNNNNNNNN" on its own console line. | |
examples/ek_ra8d2/hw_pending/manual/usb_msc_sdcard/src/usb_msc_sdcard_console.c
SCI8 (J-Link OB CDC) console formatters for the live-SD MSC device
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 sdmsc_print* entry points are declared in usb_msc_sdcard_steps.h and consumed by both main.c and the device-worker sibling.
Definition in file usb_msc_sdcard_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 54 of file usb_msc_sdcard_console.c.
References k_sdmsc_hex_digit_split.
Referenced by sdmsc_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_sdmsc_print_cap bytes. Definition at line 117 of file usb_msc_sdcard_console.c.
References sdmsc_sci_write(), and sdmsc_str_len().
Referenced by sdmsc_print_card_banner(), sdmsc_print_fail(), and sdmsc_print_ready().
|
nodiscard |
Implementation of sdmsc_print_dec() – digit-reversal scratch.
Print a uint32_t as ASCII decimal over the SCI8 console.
Definition at line 123 of file usb_msc_sdcard_console.c.
References k_sdmsc_dec_chars_u32, k_sdmsc_dec_radix, and sdmsc_sci_write().
Referenced by sdmsc_print_card_banner(), and sdmsc_print_ready().
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 162 of file usb_msc_sdcard_console.c.
References k_ra8_ok, k_sdmsc_hex_chars_u32, sdmsc_print(), and sdmsc_print_hex().
Referenced by sdmsc_card_up(), and sdmsc_device_worker().
|
nodiscard |
Implementation of sdmsc_print_hex() – width clamped to 8.
Print a value as fixed-width uppercase hex over the SCI8 console.
Definition at line 148 of file usb_msc_sdcard_console.c.
References k_sdmsc_hex_chars_u32, k_sdmsc_nibble_bits, k_sdmsc_nibble_mask, sdmsc_nibble_to_hex(), and sdmsc_sci_write().
Referenced by sdmsc_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 112 of file usb_msc_sdcard_console.c.
References ra8_board_uart_console_write().
Referenced by sdmsc_print(), sdmsc_print_dec(), and sdmsc_print_hex().
|
static |
Bounded ASCII string length (cap k_sdmsc_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 80 of file usb_msc_sdcard_console.c.
References k_sdmsc_print_cap.
Referenced by sdmsc_print().