218 const uint8_t* mram = (
const uint8_t*)(uintptr_t)((uint32_t)
k_mram_base_addr + offset);
364 uint64_t ms = total_ms;
436 uint64_t total_bytes = 0U;
437 uint64_t total_ms = 0U;
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.
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.
Minimal FAT12/FAT16/FAT32 filesystem adapter (read + write).
ra8_err_t ra8_fs_mount(const ra8_fs_backend_t *backend, ra8_fs_mount_t **out_handle)
Mount a FAT volume from a block-device backend, auto-selecting the first partition.
ra8_err_t ra8_fs_unmount(ra8_fs_mount_t *handle)
Unmount a previously mounted volume and release its slot.
ra8_fs_type_t
FAT variant detected from the BPB cluster-count rule.
@ k_ra8_fs_type_fat12
count_of_clusters < 4085.
@ k_ra8_fs_type_fat32
count_of_clusters >= 65525.
@ k_ra8_fs_type_exfat
exFAT (read + streaming write + format).
@ k_ra8_fs_type_fat16
4085 <= count_of_clusters < 65525.
@ k_ra8_fs_type_unknown
Not yet detected / mount failed.
ra8_io block-device fabric – one LBA vtable across every storage medium.
ra8_err_t ra8_io_blockdev_as_fs_backend(const ra8_io_blockdev_t *bd, ra8_fs_backend_t *out)
Expose a bound block device as an ra8_fs_backend_t for ra8_fs.
ra8_io block-device backend over a hosted USB mass-storage device.
ra8_err_t ra8_io_blockdev_usbmsc_init(ra8_io_blockdev_t *bd, ra8_io_blockdev_usbmsc_state_t *state, uint8_t lun)
Bind a hosted USB mass-storage backend into a caller-owned handle.
SysTick-based tick counter, delay and timestamp helpers.
uint32_t ra8_time_ms(void)
Get the current 1 kHz tick count.
@ 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_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.
Block-device interface that ra8_fs runs on top of.
Cached parse of one mounted FAT volume.
Caller-allocated block-device handle binding a backend to its context.
Caller-owned private state for a USB mass-storage block device.
Snapshot of the attached MSC device, passed to the attach callback.
uint16_t vendor_id
idVendor from device descriptor.
uint16_t product_id
idProduct from device descriptor.
@ k_selftest_hex_chars_u16
16-bit value -> "ABCD".
@ k_selftest_hex_chars_u32
32-bit value -> "ABCDEF01".
static ra8_err_t selftest_print_dec(uint32_t value)
Print a uint32_t as ASCII decimal.
static ra8_io_blockdev_usbmsc_state_t s_selftest_usb_state
Caller-owned backend state for s_selftest_usb_dev.
@ k_selftest_phase_wp
Write-protect rejection test.
@ k_selftest_phase_mount
Mounting the FAT16 volume.
@ k_selftest_phase_enum
Enumerating the FS device.
@ k_selftest_phase_pass
Full config A pass.
@ k_selftest_phase_host_init
ra8_usb_hmsc_init issued.
@ k_selftest_phase_verify
Streaming + comparing MRAM.BIN.
static ra8_err_t selftest_print_hex(uint32_t value, uint8_t digits)
Print a value as fixed-width uppercase hex.
static ra8_io_blockdev_t s_selftest_usb_dev
Block device fronting the hosted MSC volume for this ladder.
@ k_selftest_wp_probe_lba
Data-region LBA for WP test.
@ k_selftest_ms_per_sec
Milliseconds per second.
@ k_selftest_target_lun
Single-LUN device.
@ k_selftest_burst_bytes
8 x 512 B burst buffer size.
@ k_selftest_burst_blocks
Blocks per READ(10) burst.
@ k_selftest_no_mismatch
Probe: no mismatch found.
@ k_selftest_bytes_per_kib
Bytes per KiB (rate math).
static ra8_err_t selftest_print(const char *text)
Print a NUL-terminated ASCII string over the console.
static volatile uint32_t s_dbg_verified_bytes
Bytes content-verified so far this pass.
static ra8_err_t selftest_print_fail(const char *what, ra8_err_t err)
Print "FAIL <what> err=0xNNNNNNNN" on its own line.
static volatile uint32_t s_dbg_mismatch_off
First mismatching MRAM offset (k_selftest_no_mismatch = none).
static volatile uint32_t s_dbg_verify_ms
Milliseconds the 1 MiB verify streamed for.
@ k_fat_data_lba
First data sector (cluster 2).
@ k_fat_mram_clusters
Clusters backed by MRAM (1 MiB).
@ k_mram_base_addr
MRAM code window base address.
@ k_selftest_block_size
SCSI logical block size (bytes).
Shared constants for the usb_selftest_soak translation units.
@ k_selftest_soak_iters
Soak: 1 MiB verify repeats.
@ k_selftest_bytes_per_mib
Bytes per MiB (aggregate).
Shared SCI8 console + text formatters for the soak self-test.
static const char * selftest_fs_type_name(ra8_fs_type_t type)
Map a detected filesystem type to a printable name.
static ra8_err_t selftest_host_enumerate(ra8_usb_hmsc_device_t *out_device)
Bring the host controller up and enumerate the loop device.
ra8_err_t selftest_host_pass(void)
Soak pass: enumerate + mount once, then repeat the 1 MiB verify.
static ra8_err_t selftest_verify_mram_raw(void)
Raw multi-block READ(10) of the MRAM data region vs MRAM.
static ra8_err_t selftest_print_soak_verdict(uint64_t total_bytes, uint64_t total_ms)
Print the soak aggregate line (iterations + volume + rate).
static ra8_err_t selftest_write_protect_probe(void)
WRITE(10) into the read-only LUN must be rejected.
static ra8_err_t selftest_mount_volume(ra8_fs_mount_t **out_mount)
Mount the loop device's volume through the USB-MSC backend.
Host-side entry point of the soak self-test.
static volatile uint32_t s_dbg_phase
Host-ladder phase marker (wlun_phase_t).
static volatile uint32_t s_dbg_pass_count
Completed full passes (sticky success counter).