|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
examples/ek_ra8d2/hw_pending/manual/usb_msc_sdcard/inc/usb_msc_sdcard_steps.h More...
Go to the source code of this file.
Enumerations | |
| enum | sdmsc_config_t : uint32_t { k_sdmsc_thread_stack = 4096U , k_sdmsc_usbx_pool_bytes = 32768U , k_sdmsc_idle_ticks = 50U , k_sdmsc_baud = 115200U , k_sdmsc_sd_spi_channel = 0U , k_sdmsc_print_cap = 160U , k_sdmsc_dev_priority = 8U , k_sdmsc_block_size = 512U , k_sdmsc_blocks_per_mib = 2048U } |
| Compile-time settings: thread, pool, console, SD bus, cadence. More... | |
| enum | sdmsc_hex_t : uint8_t { k_sdmsc_hex_chars_u32 = 8U , k_sdmsc_dec_chars_u32 = 10U , k_sdmsc_nibble_bits = 4U , k_sdmsc_hex_digit_split = 10U } |
| Hex/decimal text-formatter sizing constants. More... | |
| enum | sdmsc_mask_t : uint32_t { k_sdmsc_nibble_mask = 0xFU , k_sdmsc_dec_radix = 10U } |
| Bit-mask constants used by the text formatters. More... | |
| enum | sdmsc_dev_step_t : uint32_t { k_sdmsc_dev_step_stack = 1U , k_sdmsc_dev_step_class = 2U , k_sdmsc_dev_step_dcd = 3U , k_sdmsc_dev_step_attach = 4U , k_sdmsc_dev_step_parked = 5U } |
| J-Link probe values marking device-worker bring-up progress. More... | |
| enum | scsi_sense_code_t : uint8_t { k_scsi_sense_illegal_request = 0x05U , k_scsi_asc_lba_out_of_range = 0x21U , k_scsi_sense_medium_error = 0x03U , k_scsi_asc_unrecovered_read = 0x11U , k_scsi_asc_write_fault = 0x03U , k_scsi_ascq_none = 0x00U } |
| SCSI sense triples (key / ASC / ASCQ) the media callbacks report. More... | |
| enum | usb_langid_byte_t : uint8_t { k_usb_langid_en_us_lo = 0x09U , k_usb_langid_en_us_hi = 0x04U } |
| USBX LANGID descriptor 0x0409 (English-US), little-endian pair. More... | |
Functions | |
| 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) |
| Print a uint32_t as ASCII decimal over the SCI8 console. | |
| ra8_err_t | sdmsc_print_hex (uint32_t value, uint8_t digits) |
| Print a value as fixed-width uppercase hex over the SCI8 console. | |
| ra8_err_t | sdmsc_print_fail (const char *what, ra8_err_t err) |
| Print "FAIL <what> err=0xNNNNNNNN" on its own console line. | |
| VOID | sdmsc_device_worker (ULONG arg) |
| Device worker: bring the live-SD read/write MSC device up, then park. | |
Variables | |
| volatile uint32_t | s_usb_msc_sdcard_blocks |
| Live SD card capacity in 512-byte blocks (0 = no card). | |
examples/ek_ra8d2/hw_pending/manual/usb_msc_sdcard/inc/usb_msc_sdcard_steps.h
Shared contract for the live-SD USB MSC device console + worker steps
Declares the constants, the cross-translation-unit card-capacity probe, and the function prototypes shared between main.c and the helper siblings usb_msc_sdcard_console.c (SCI8 console formatters) and usb_msc_sdcard_steps.c (USBX device worker plus the read/write MSC media callbacks that drive the live SD card). 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 point is only declared when the firmware (on-target) USB stack is compiled in.
Definition in file usb_msc_sdcard_steps.h.
| enum scsi_sense_code_t : uint8_t |
SCSI sense triples (key / ASC / ASCQ) the media callbacks report.
Per SPC-4 / SBC-3: an out-of-range LBA is ILLEGAL REQUEST with "LOGICAL BLOCK ADDRESS OUT OF RANGE"; a failed card read is MEDIUM ERROR with "UNRECOVERED READ ERROR"; a failed card write is MEDIUM ERROR with "PERIPHERAL DEVICE WRITE FAULT". The class stores the triple into the LUN's REQUEST SENSE data, so the host sees the true failure cause.
Definition at line 90 of file usb_msc_sdcard_steps.h.
| enum sdmsc_config_t : uint32_t |
Compile-time settings: thread, pool, console, SD bus, cadence.
Definition at line 36 of file usb_msc_sdcard_steps.h.
| enum sdmsc_dev_step_t : uint32_t |
J-Link probe values marking device-worker bring-up progress.
Definition at line 72 of file usb_msc_sdcard_steps.h.
| enum sdmsc_hex_t : uint8_t |
Hex/decimal text-formatter sizing constants.
Definition at line 52 of file usb_msc_sdcard_steps.h.
| enum sdmsc_mask_t : uint32_t |
Bit-mask constants used by the text formatters.
| Enumerator | |
|---|---|
| k_sdmsc_nibble_mask | 4-bit nibble mask. |
| k_sdmsc_dec_radix | Base for decimal conversion. |
Definition at line 63 of file usb_msc_sdcard_steps.h.
| enum usb_langid_byte_t : uint8_t |
USBX LANGID descriptor 0x0409 (English-US), little-endian pair.
| Enumerator | |
|---|---|
| k_usb_langid_en_us_lo | LANGID 0x0409 low byte. |
| k_usb_langid_en_us_hi | LANGID 0x0409 high byte. |
Definition at line 103 of file usb_msc_sdcard_steps.h.
| VOID sdmsc_device_worker | ( | ULONG | arg | ) |
Device worker: bring the live-SD read/write MSC device up, then park.
USBX system + device stack + MSC class (1 writable LUN sized from s_usb_msc_sdcard_blocks) + DCD bridge on the USBFS controller, then DPRPU attach and the READY banner. USBX runs the SCSI/BBB state machine on its own class threads after this; the media callbacks stream the live card via ra8_sdmmc_spi_read_blocks / ra8_sdmmc_spi_write_blocks.
| [in] | arg | ThreadX entry argument (unused). |
Definition at line 516 of file usb_msc_sdcard_steps.c.
References k_ra8_err_invalid_state, k_ra8_ok, k_ra8_usb_speed_fs, k_sdmsc_dev_step_attach, k_sdmsc_dev_step_class, k_sdmsc_dev_step_dcd, k_sdmsc_dev_step_parked, k_sdmsc_dev_step_stack, k_sdmsc_idle_ticks, ra8_usb_device_attach(), s_dbg_dev_err, s_dbg_dev_step, s_usb_msc_sdcard_blocks, sdmsc_class_register(), sdmsc_print_fail(), sdmsc_print_ready(), sdmsc_usbx_stack_up(), tx_thread_sleep, and ux_dcd_ra8_usb_initialize().
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_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 |
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 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 |
Print a value as fixed-width uppercase hex over the SCI8 console.
| [in] | value | Value to print. |
| [in] | digits | Hex digit count (up to 8). |
| k_ra8_ok | All bytes queued. |
digits is at most k_sdmsc_hex_chars_u32. 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().
|
extern |
Live SD card capacity in 512-byte blocks (0 = no card).
Defined in main.c and stamped once during the pre-kernel SD bring-up from ra8_sdmmc_spi_get_capacity (CSD-derived). Read by the worker in usb_msc_sdcard_steps.c to size the MSC LUN and by the media callbacks to bounds-check every SCSI request.
Stamped here once during the pre-kernel SD bring-up from ra8_sdmmc_spi_get_capacity (CSD-derived) and consumed by the worker + media callbacks in usb_msc_sdcard_steps.c.
Definition at line 136 of file main.c.
Referenced by sdmsc_card_up(), sdmsc_class_register(), sdmsc_device_worker(), sdmsc_msc_read(), sdmsc_msc_write(), and sdmsc_print_ready().