|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
examples/ek_ra8d2/hw_validated/hil/usb_selftest_fs_host/inc/usb_selftest_fs_host_steps.h More...
#include <stdint.h>#include "tx_api.h"#include "ux_api.h"Go to the source code of this file.
Functions | |
| UINT | selftest_msc_read (VOID *storage, ULONG lun, UCHAR *data_pointer, ULONG number_blocks, ULONG lba, ULONG *media_status) |
| Storage media-read callback: synthesize sectors over MRAM. | |
| UINT | selftest_msc_write (VOID *storage, ULONG lun, UCHAR *data_pointer, ULONG number_blocks, ULONG lba, ULONG *media_status) |
| Storage media-write callback: always rejects (write-protected). | |
| UINT | selftest_msc_status (VOID *storage, ULONG lun, ULONG media_id, ULONG *media_status) |
| Storage media-status callback. | |
| VOID | selftest_device_worker (ULONG arg) |
| Device-side worker: bring the HS device stack up, then park. | |
| VOID | selftest_host_worker (ULONG arg) |
| Host-side worker: retry the full pass until it succeeds. | |
examples/ek_ra8d2/hw_validated/hil/usb_selftest_fs_host/inc/usb_selftest_fs_host_steps.h
Shared contract for the USB self-loop config B (FS host) example.
Splits the oversized main.c into three translation units while keeping the firmware behaviour byte-for-byte identical:
This header owns every compile-time constant the three units share, plus the prototypes of the five functions that cross a translation-unit boundary (the two ThreadX workers and the three USBX storage callbacks). All other helpers and file-static state stay private to their unit.
Definition in file usb_selftest_fs_host_steps.h.
| enum scsi_sense_code_t : uint8_t |
SCSI sense triple for an unsupported / out-of-range request.
| Enumerator | |
|---|---|
| k_scsi_sense_illegal_request | Sense key: ILLEGAL REQUEST. |
| k_scsi_asc_lba_out_of_range | ASC: LBA out of range. |
| k_scsi_ascq_none | ASCQ: none. |
Definition at line 129 of file usb_selftest_fs_host_steps.h.
| enum scsi_wp_sense_t : uint8_t |
SCSI sense triple for a write to the protected medium.
| Enumerator | |
|---|---|
| k_scsi_sense_data_protect | Sense key: DATA PROTECT. |
| k_scsi_asc_write_protected | ASC: WRITE PROTECTED. |
Definition at line 136 of file usb_selftest_fs_host_steps.h.
| enum selftest_config_t : uint32_t |
Compile-time settings: threads, pool, console, retry cadence.
Definition at line 47 of file usb_selftest_fs_host_steps.h.
| enum selftest_fat_boot_t : uint32_t |
Boot-sector field values (MS FAT spec 1.03 sec 3.1).
Definition at line 172 of file usb_selftest_fs_host_steps.h.
| enum selftest_fat_geom_t : uint32_t |
Synthesized FAT16 volume geometry (MS FAT spec 1.03).
Identical to usb_msc_mram: one 512-byte sector per cluster, data region padded to 4096 clusters to cross the FAT16 threshold, MRAM.BIN occupying clusters 2..2049.
Definition at line 149 of file usb_selftest_fs_host_steps.h.
| enum selftest_fat_off_t : uint8_t |
Byte offsets inside the boot sector and directory entries.
Definition at line 192 of file usb_selftest_fs_host_steps.h.
| enum selftest_hex_t : uint8_t |
Hex/decimal text-formatter sizing constants.
Definition at line 74 of file usb_selftest_fs_host_steps.h.
| enum selftest_mask_t : uint32_t |
Bit-mask constants used by the text formatters.
| Enumerator | |
|---|---|
| k_selftest_nibble_mask | 4-bit nibble mask. |
| k_selftest_dec_radix | Base for decimal conversion. |
Definition at line 86 of file usb_selftest_fs_host_steps.h.
| enum selftest_mram_t : uint32_t |
The MRAM window the device-side volume exposes.
| Enumerator | |
|---|---|
| k_mram_base_addr | MRAM code window base address. |
| k_mram_bytes | 1 MiB window size. |
Definition at line 123 of file usb_selftest_fs_host_steps.h.
| enum selftest_phase_t : uint32_t |
J-Link probe values marking host-ladder progress.
Definition at line 109 of file usb_selftest_fs_host_steps.h.
| enum selftest_verify_t : uint32_t |
Content-verification geometry over the device's FAT16 volume.
Definition at line 95 of file usb_selftest_fs_host_steps.h.
| enum selftest_word_pack_t : uint32_t |
32-bit little-endian split constants.
| Enumerator | |
|---|---|
| k_word_shift | Bits per half-word. |
| k_word_mask | Low half-word mask. |
Definition at line 225 of file usb_selftest_fs_host_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 236 of file usb_selftest_fs_host_steps.h.
| VOID selftest_device_worker | ( | ULONG | arg | ) |
Device-side worker: bring the HS device stack up, then park.
USBX system + device stack + MSC class + DCD bridge on the USBHS controller, then DPRPU attach. The FS host downstream forces a full-speed link, so the stack serves the FS-fallback framework. USBX runs the SCSI/BBB state machine on its own class threads after this. Defined in usb_selftest_fs_host_fatdisk.c; spawned by tx_application_define in main.c.
| [in] | arg | ThreadX entry argument (unused). |
USBX system + device stack + MSC class + DCD bridge on the USBHS controller, then DPRPU attach. The FS host downstream forces a full-speed link, so the stack serves the FS-fallback framework. USBX runs the SCSI/BBB state machine on its own class threads after this.
| [in] | arg | ThreadX entry argument (unused). |
Device-side worker: bring the HS device stack up, then park.
USBX system + device stack + MSC class + 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 761 of file usb_selftest_fs_host_fatdisk.c.
References k_ra8_ok, k_ra8_usb_speed_hs, ra8_usb_device_attach(), s_dbg_dev_state, s_dbg_framework, s_dbg_fw_fs_addr, s_dbg_fw_hs_addr, s_dbg_fw_len, s_dbg_state3_seen, s_dbg_thr_runs, s_dbg_thr_state, s_dbg_ux_speed, s_device_framework_fs, s_device_framework_hs, selftest_msc_class_register(), selftest_usbx_stack_up(), tx_thread_sleep, and ux_dcd_ra8_usb_initialize().
| VOID selftest_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 config B ladder with a retry pause until it passes; afterwards parks so the verdict stays on the wire. Defined in usb_selftest_fs_host_host.c; spawned by tx_application_define.
| [in] | arg | ThreadX entry argument (unused). |
Waits for the device side to attach, then loops selftest_host_pass with a retry pause until the whole config B ladder passes; afterwards parks so the verdict stays on the wire.
| [in] | arg | ThreadX entry argument (unused). |
Definition at line 718 of file usb_selftest_fs_host_host.c.
References k_ra8_ok, k_selftest_boot_wait_ticks, k_selftest_idle_ticks, k_selftest_retry_ticks, selftest_host_pass(), and tx_thread_sleep.
| UINT selftest_msc_read | ( | VOID * | storage, |
| ULONG | lun, | ||
| UCHAR * | data_pointer, | ||
| ULONG | number_blocks, | ||
| ULONG | lba, | ||
| ULONG * | media_status ) |
Storage media-read callback: synthesize sectors over MRAM.
Bound checks the request against the volume, then fills each block from the synthesized FAT16 layout. LED1 toggles per call so the self-loop traffic is visible on the board. Defined in usb_selftest_fs_host_fatdisk.c; referenced by main.c when it registers the USBX storage class.
| [in,out] | storage | USBX storage class instance (unused). |
| [in] | lun | Logical unit number (must be 0). |
| [out] | data_pointer | USBX-owned destination buffer. |
| [in] | number_blocks | Number of 512-byte blocks to produce. |
| [in] | lba | Starting LBA. |
| [out] | media_status | Filled with sense status word. |
| UX_SUCCESS | Read completed. |
| UX_ERROR | Out-of-range LBA / count. |
Bound checks the request against the volume, then fills each block via the FAT16 synthesizer. LED1 toggles per call so the self-loop traffic is visible on the board.
| [in,out] | storage | USBX storage class instance (unused). |
| [in] | lun | Logical unit number (must be 0). |
| [out] | data_pointer | USBX-owned destination buffer. |
| [in] | number_blocks | Number of 512-byte blocks to produce. |
| [in] | lba | Starting LBA. |
| [out] | media_status | Filled with sense status word. |
| UX_SUCCESS | Read completed. |
| UX_ERROR | Out-of-range LBA / count. |
Bound checks the request against the volume, then fills each block via selftest_fat_fill_sector. LED1 toggles per call so the self-loop traffic is visible on the board.
| [in,out] | storage | USBX storage class instance (unused). |
| [in] | lun | Logical unit number (must be 0). |
| [out] | data_pointer | USBX-owned destination buffer. |
| [in] | number_blocks | Number of 512-byte blocks to produce. |
| [in] | lba | Starting LBA. |
| [out] | media_status | Filled with sense status word. |
| UX_SUCCESS | Read completed. |
| UX_ERROR | Out-of-range LBA / count. |
Bound checks the request against the volume, then fills each block via the FAT16 synthesizer. LED1 toggles per call so the self-loop traffic is visible on the board.
| [in,out] | storage | USBX storage class instance (unused). |
| [in] | lun | Logical unit number (must be 0). |
| [out] | data_pointer | USBX-owned destination buffer. |
| [in] | number_blocks | Number of 512-byte blocks to produce. |
| [in] | lba | Starting LBA. |
| [out] | media_status | Filled with sense status word. |
| UX_SUCCESS | Read completed. |
| UX_ERROR | Out-of-range LBA / count. |
Bound checks the request against the volume, then fills each block via selftest_fat_fill_sector. LED1 toggles per call so the self-loop traffic is visible on the board.
| [in,out] | storage | USBX storage class instance (unused). |
| [in] | lun | Logical unit number (must be 0). |
| [out] | data_pointer | USBX-owned destination buffer. |
| [in] | number_blocks | Number of 512-byte blocks to produce. |
| [in] | lba | Starting LBA. |
| [out] | media_status | Filled with sense status word. |
| UX_SUCCESS | Read completed. |
| UX_ERROR | Out-of-range LBA / count. |
Definition at line 304 of file usb_host_msc_browse_steps.c.
Storage media-status callback.
Always reports media-present.
The synthesized volume cannot go away; status is constant 0. Defined in usb_selftest_fs_host_fatdisk.c.
| [in,out] | storage | USBX storage class instance (unused). |
| [in] | lun | Logical unit number (unused). |
| [in] | media_id | Media id (unused). |
| [out] | media_status | Filled with 0 (no fault). |
| UX_SUCCESS | Media is present and ready. |
Always reports media-present.
The synthesized volume cannot go away; status is constant 0.
| [in,out] | storage | USBX storage class instance (unused). |
| [in] | lun | Logical unit number (unused). |
| [in] | media_id | Media id (unused). |
| [out] | media_status | Filled with 0 (no fault). |
| UX_SUCCESS | Media is present and ready. |
Definition at line 347 of file usb_host_msc_browse_steps.c.
| UINT selftest_msc_write | ( | VOID * | storage, |
| ULONG | lun, | ||
| UCHAR * | data_pointer, | ||
| ULONG | number_blocks, | ||
| ULONG | lba, | ||
| ULONG * | media_status ) |
Storage media-write callback: always rejects (write-protected).
The host side of this very app probes exactly this rejection (WRITE(10) must fail with DATA PROTECT and the transport must keep working afterwards). Defined in usb_selftest_fs_host_fatdisk.c.
| [in,out] | storage | USBX storage class instance (unused). |
| [in] | lun | Logical unit number (unused). |
| [in] | data_pointer | USBX-owned source buffer (unused). |
| [in] | number_blocks | Number of blocks the host tried (unused). |
| [in] | lba | Starting LBA (unused). |
| [out] | media_status | Filled with DATA PROTECT sense. |
| UX_ERROR | The medium is write-protected. |
The host side of this very app probes exactly this rejection (WRITE(10) must fail with DATA PROTECT and the transport must keep working afterwards).
| [in,out] | storage | USBX storage class instance (unused). |
| [in] | lun | Logical unit number (unused). |
| [in] | data_pointer | USBX-owned source buffer (unused). |
| [in] | number_blocks | Number of blocks the host tried (unused). |
| [in] | lba | Starting LBA (unused). |
| [out] | media_status | Filled with DATA PROTECT sense. |
| UX_ERROR | The medium is write-protected. |
Definition at line 328 of file usb_host_msc_browse_steps.c.