|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
examples/ek_ra8d2/hw_validated/hil/usb_selftest_microsd/inc/usb_selftest_microsd_steps.h More...
Go to the source code of this file.
Functions | |
| 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) |
| Print a uint32_t as ASCII decimal over the SCI8 console. | |
| ra8_err_t | microsd_print_hex (uint32_t value, uint8_t digits) |
| Print a value as fixed-width uppercase hex over the SCI8 console. | |
| ra8_err_t | microsd_print_fail (const char *what, ra8_err_t err) |
| Print "FAIL <what> err=0xNNNNNNNN" on its own console line. | |
| VOID | microsd_device_worker (ULONG arg) |
| Device-side worker: bring the read-only SD FS device up, then park. | |
| VOID | microsd_host_worker (ULONG arg) |
| Host-side worker: retry the full pass until it succeeds. | |
Variables | |
| unsigned char | s_usb_selftest_microsd_sd_snapshot [(uint32_t) k_microsd_snap_bytes] |
| Read-only RAM snapshot of SD LBA 0..63, taken once at boot. | |
| volatile uint32_t | s_usb_selftest_microsd_dbg_bootsig |
| 1 = LBA0 carries the 0x55AA FAT/exFAT boot signature. | |
examples/ek_ra8d2/hw_validated/hil/usb_selftest_microsd/inc/usb_selftest_microsd_steps.h
Shared contract for the USB-microSD self-test console + worker steps
Declares the constants, the two cross-translation-unit J-Link probes, and the function prototypes shared between main.c and the helper siblings usb_selftest_microsd_console.c (SCI8 console formatters) and usb_selftest_microsd_steps.c (USBX device worker, read-only MSC media callbacks, and the polled host enumerate/verify ladder). The header is self-contained: it pulls in <stdint.h> for the typed-enum underlying types and ra8_err.h for ra8_err_t. The ThreadX worker entry points are only declared when the firmware (on-target) USB stack is compiled in.
Definition in file usb_selftest_microsd_steps.h.
| enum microsd_config_t : uint32_t |
Compile-time settings: threads, pool, console, cadence.
Definition at line 36 of file usb_selftest_microsd_steps.h.
| enum microsd_dev_step_t : uint32_t |
J-Link probe values marking device-worker bring-up progress.
Definition at line 105 of file usb_selftest_microsd_steps.h.
| enum microsd_geom_t : uint32_t |
LUN geometry + verification constants.
Definition at line 75 of file usb_selftest_microsd_steps.h.
| enum microsd_hex_t : uint8_t |
Hex/decimal text-formatter sizing constants.
Definition at line 54 of file usb_selftest_microsd_steps.h.
| enum microsd_mask_t : uint32_t |
Bit-mask constants used by the text formatters.
| Enumerator | |
|---|---|
| k_microsd_nibble_mask | 4-bit nibble mask. |
| k_microsd_dec_radix | Base for decimal conversion. |
Definition at line 66 of file usb_selftest_microsd_steps.h.
| enum microsd_phase_t : uint32_t |
J-Link probe values marking host-ladder progress.
Definition at line 93 of file usb_selftest_microsd_steps.h.
| enum scsi_sense_code_t : uint8_t |
SCSI sense triple for an unsupported / out-of-range request.
Definition at line 114 of file usb_selftest_microsd_steps.h.
| enum usb_langid_byte_t : uint8_t |
| Enumerator | |
|---|---|
| k_usb_langid_en_us_lo | LANGID 0x0409 low byte. |
| k_usb_langid_en_us_hi | LANGID 0x0409 high byte. |
Definition at line 123 of file usb_selftest_microsd_steps.h.
| VOID microsd_device_worker | ( | ULONG | arg | ) |
Device-side worker: bring the read-only SD FS device up, then park.
USBX system + device stack + MSC class (1 LUN) + DCD bridge on the USBFS controller, then DPRPU attach. USBX runs the SCSI/BBB state machine on its own class threads after this.
| [in] | arg | ThreadX entry argument (unused). |
Definition at line 459 of file usb_selftest_microsd_steps.c.
References k_microsd_dev_step_attach, k_microsd_dev_step_class, k_microsd_dev_step_dcd, k_microsd_dev_step_parked, k_microsd_dev_step_stack, k_microsd_idle_ticks, k_ra8_ok, k_ra8_usb_speed_fs, microsd_class_register(), microsd_usbx_stack_up(), ra8_usb_device_attach(), s_dbg_dev_err, s_dbg_dev_step, tx_thread_sleep, and ux_dcd_ra8_usb_initialize().
Referenced by tx_application_define().
| VOID microsd_host_worker | ( | ULONG | arg | ) |
Host-side worker: retry the full pass until it succeeds.
Waits for the device side to attach, then loops the full enumerate/verify pass with a retry pause until the SD LUN verifies; afterwards parks so the verdict stays on the wire.
| [in] | arg | ThreadX entry argument (unused). |
Definition at line 698 of file usb_selftest_microsd_steps.c.
References k_microsd_boot_wait_ticks, k_microsd_idle_ticks, k_microsd_retry_ticks, k_ra8_ok, microsd_host_pass(), and tx_thread_sleep.
Referenced by tx_application_define().
|
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 |
Print a uint32_t as ASCII decimal over the SCI8 console.
| [in] | value | Value to print. |
| k_ra8_ok | All bytes queued. |
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 |
Print a value as fixed-width uppercase hex over the SCI8 console.
| [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_microsd_hex_chars_u32. 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().
|
extern |
1 = LBA0 carries the 0x55AA FAT/exFAT boot signature.
Defined and stamped in main.c during SD bring-up; read by the host-side verify ladder to confirm the snapshot is a valid boot region before the READ(10) sweep.
Stamped here at SD bring-up and read by the host-side verify ladder in "usb_selftest_microsd_steps.c".
Definition at line 201 of file main.c.
Referenced by microsd_sd_snapshot(), and microsd_verify_one().
|
extern |
Read-only RAM snapshot of SD LBA 0..63, taken once at boot.
Defined in main.c (populated before the kernel starts by the SD bring-up step) and read by both the device-side media-read callback and the host-side verify ladder in usb_selftest_microsd_steps.c.
Populated here before the kernel starts; consumed by both the device-side media-read callback and the host-side verify ladder in "usb_selftest_microsd_steps.c".
Definition at line 215 of file main.c.
Referenced by microsd_msc_read(), microsd_sd_snapshot(), and microsd_verify_one().