|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
Shared constants + device-side FAT16/MSC step declarations. More...
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. | |
| ra8_err_t | selftest_host_pass (void) |
| One full host-side pass: enumerate, mount, browse, verify, WP. | |
Shared constants + device-side FAT16/MSC step declarations.
Companion header for the usb_host_msc_browse self-loop app. It carries the volume-geometry and field-offset enums that BOTH main.c and the device-side step translation unit (usb_host_msc_browse_steps.c) reference, plus the prototypes for the three USBX storage media callbacks that the step TU defines but main.c's class-register helper still wires into the LUN.
The header is self-contained: it pulls in <stdint.h> for the typed-enum underlying types and, only in the on-target firmware build, ux_api.h for the USBX UINT/VOID/UCHAR/ULONG types used by the callback signatures.
Definition in file usb_host_msc_browse_steps.h.
| enum selftest_config_t : uint32_t |
Compile-time settings: threads, pool, console, retry cadence.
Definition at line 41 of file usb_host_msc_browse_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 81 of file usb_host_msc_browse_steps.h.
| enum selftest_fat_off_t : uint8_t |
Byte offsets inside the boot sector and directory entries.
Definition at line 104 of file usb_host_msc_browse_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 68 of file usb_host_msc_browse_steps.h.
|
nodiscard |
One full host-side pass: enumerate, mount, browse, verify, WP.
Drives the host-side ladder over the self-loop cable: brings the USBHS host up and enumerates the FS device, mounts and parses the FAT16 volume, browses the root directory, raw-verifies the 1 MiB MRAM data region with multi-block READ(10) bursts, then probes the write-protect rejection. Phases are mirrored into the J-Link progress probe for readout. On any failure the host controller is closed so the next retry starts from a clean attach. The host worker thread (in main.c) loops this until it returns k_ra8_ok.
| k_ra8_ok | The pass printed the BROWSE PASS banner. |
One full host-side pass: enumerate, mount, browse, verify, WP.
One full host-side pass: enumerate, mount, browse, verify, WP.
Enumerates and mounts to prove FAT parse, then runs selftest_verify_mram_raw k_selftest_soak_iters times back to back – every burst is still memcmp'd vs MRAM, so a single corrupted transfer anywhere in the soak fails the run. Aggregates volume + time for a stable throughput benchmark, then confirms the RO write rejection once. s_dbg_pass_count mirrors the completed-iteration count for J-Link.
| k_ra8_ok | All iterations matched; SOAK PASS printed. |
Definition at line 738 of file usb_host_msc_browse_host.c.
References k_ra8_board_led2, k_ra8_ok, k_selftest_phase_mount, k_selftest_phase_pass, k_selftest_phase_verify, k_selftest_phase_wp, ra8_board_led_on(), ra8_fs_unmount(), ra8_usb_hmsc_close(), s_dbg_pass_count, s_dbg_phase, selftest_browse_root(), selftest_host_enumerate(), selftest_mount_volume(), selftest_print(), selftest_print_verify_verdict(), selftest_verify_mram_raw(), and selftest_write_protect_probe().
Referenced by selftest_host_worker().
| 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 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.
References k_fat_total_sectors, k_ra8_board_led1, k_scsi_asc_lba_out_of_range, k_scsi_ascq_none, k_scsi_sense_illegal_request, k_selftest_block_size, ra8_board_led_toggle(), s_dbg_read_calls, and selftest_fat_fill_sector().
Referenced by selftest_msc_class_register(), selftest_msc_class_register(), and selftest_msc_class_register().
Storage media-status callback.
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.
Referenced by selftest_msc_class_register(), selftest_msc_class_register(), and selftest_msc_class_register().
| 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).
| [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.
References k_scsi_asc_write_protected, k_scsi_ascq_none, and k_scsi_sense_data_protect.
Referenced by selftest_msc_class_register(), selftest_msc_class_register(), and selftest_msc_class_register().