123 uint32_t block_count = 0U;
124 uint32_t block_size = 0U;
179 return wlun_print(
" OK (64 sectors, write+read verified)\r\n");
213 err =
wlun_print(
"ra8d2 wlun: enumerated pid=0x");
270 for (uint32_t lun = 0U; lun < (uint32_t)
k_wlun_count; lun++) {
290 err =
wlun_print(
"ra8d2 wlun: USB SELFTEST WRITABLE-LUN PASS\r\n");
Board-support layer for the Renesas EK-RA8D2 v1 evaluation kit.
ra8_err_t ra8_board_led_on(ra8_board_led_id_t led)
Drive led HIGH (light it).
@ k_ra8_board_led2
LED2, GREEN, P303 (jumper E26).
Error Code Definitions for ra8-firmware.
@ k_ra8_err_invalid_state
Module in wrong state for requested operation.
@ k_ra8_ok
Success – operation completed with all postconditions satisfied.
@ k_ra8_err_invalid_size
Invalid size parameter (too large, too small, or misaligned).
ra8_err_codes_t ra8_err_t
Canonical error-return type used by every ra8-firmware API.
int memcmp(const void *a, const void *b, size_t n)
Compare bytes in two memory areas.
@ k_ra8_usb_speed_hs
High-Speed controller (USBHS @ 0x40351000).
Native USB host-side MSC (Mass Storage Class) class layer.
ra8_err_t ra8_usb_hmsc_read_capacity(uint8_t target_lun, uint32_t *block_count, uint32_t *block_size)
Issue a SCSI READ CAPACITY(10) (opcode 0x25) over BBB.
ra8_err_t ra8_usb_hmsc_read10(uint8_t target_lun, uint32_t lba, uint16_t block_count, uint8_t *out_buf)
Issue a SCSI READ(10) (opcode 0x28) over BBB.
ra8_err_t ra8_usb_hmsc_enumerate(ra8_usb_hmsc_device_t *out_device)
Enumerate the attached MSC device end to end (polled).
ra8_err_t ra8_usb_hmsc_close(void)
Tear down the host-MSC driver and release the controller.
ra8_err_t ra8_usb_hmsc_init(ra8_usb_speed_t speed)
Bring up the host-MSC driver on a chosen USB controller.
ra8_err_t ra8_usb_hmsc_write10(uint8_t target_lun, uint32_t lba, uint16_t block_count, const uint8_t *in_buf)
Issue a SCSI WRITE(10) (opcode 0x2A) over BBB.
unsigned long ULONG
ThreadX-compatible unsigned long (host stub).
Snapshot of the attached MSC device, passed to the attach callback.
uint8_t max_lun
Get-Max-LUN response (0..15).
uint16_t product_id
idProduct from device descriptor.
static ra8_err_t wlun_host_pass(void)
One full host-side pass: enumerate, WRITE(10) then verify.
static volatile uint32_t s_dbg_phase
Host-ladder phase marker (wlun_phase_t).
static ra8_err_t wlun_host_enumerate(ra8_usb_hmsc_device_t *device)
Enumerate the looped device and print its PID + GET_MAX_LUN.
static volatile uint32_t s_dbg_luns_ok
Sectors that read back correctly after the write pass.
static ra8_err_t wlun_verify_one(uint32_t lun)
Read + verify one LUN's full sector range against its pattern.
static volatile uint32_t s_dbg_pass_count
Completed full passes (sticky success counter).
static ra8_err_t wlun_print_lun_ok(uint32_t lun)
Print "LUN n OK" for the verified writable unit.
static volatile uint32_t s_dbg_mismatch
First mismatching sector, or k_wlun_no_mismatch.
static volatile uint32_t s_dbg_max_lun
Device-reported GET_MAX_LUN value (expect 0, single LUN).
VOID wlun_host_worker(ULONG arg)
Host-side worker: retry the full pass until it succeeds.
static ra8_err_t wlun_write_disk(uint32_t lun)
WRITE(10) the per-LBA pattern across the whole RAM disk.
examples/ek_ra8d2/hil_needs_revalidation/usb_selftest_wlun/inc/usb_selftest_wlun_steps....
void wlun_pattern_fill(uint32_t lun, uint32_t lba, UCHAR *out)
Fill one 512-byte sector with this LUN/LBA's deterministic bytes.
ra8_err_t wlun_print_hex(uint32_t value, uint8_t digits)
Print a value as fixed-width uppercase hex.
@ k_wlun_block_size
SCSI logical block size.
@ k_wlun_burst_blocks
Blocks per READ(10) burst.
@ k_wlun_mismatch_lun_shift
s_dbg_mismatch: LUN in bits 31:24.
@ k_wlun_sectors
512-byte sectors (RAM disk = 32 KiB).
@ k_wlun_no_mismatch
Probe: no mismatch.
@ k_wlun_burst_bytes
8 x 512 B burst buffer.
@ k_wlun_count
Logical units exposed (single writable).
ra8_err_t wlun_print(const char *text)
Print a NUL-terminated ASCII string over the console.
@ k_wlun_hex_chars_u16
16-bit value -> "ABCD".
@ k_wlun_idle_ticks
Parked-loop back-off (ticks).
@ k_wlun_retry_ticks
Pause between ladder retries.
@ k_wlun_boot_wait_ticks
Host start delay (1 ms ticks).
ra8_err_t wlun_print_fail(const char *what, ra8_err_t err)
Print "FAIL <what> err=0xNNNNNNNN" on its own line.
ra8_err_t wlun_print_dec(uint32_t value)
Print a uint32_t as ASCII decimal.
@ k_wlun_phase_enum
Enumerating.
@ k_wlun_phase_init
ra8_usb_hmsc_init issued.
@ k_wlun_phase_pass
All LUNs verified.
@ k_wlun_phase_verify
Reading + checking LUNs.