ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
usb_selftest_common.h File Reference

Shared constants for the usb_selftest_soak translation units. More...

#include <stdint.h>
Include dependency graph for usb_selftest_common.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Enumerations

enum  selftest_config_t : uint32_t {
  k_selftest_thread_stack = 4096U ,
  k_selftest_host_stack = 8192U ,
  k_selftest_usbx_pool_bytes = 32768U ,
  k_selftest_block_size = 512U ,
  k_selftest_idle_ticks = 50U ,
  k_selftest_boot_wait_ticks = 500U ,
  k_selftest_retry_ticks = 5000U ,
  k_selftest_baud = 115200U ,
  k_selftest_print_cap = 160U ,
  k_selftest_dev_priority = 8U ,
  k_selftest_host_priority = 24U
}
 Compile-time settings: threads, pool, console, retry cadence. More...
enum  selftest_hex_t : uint8_t {
  k_selftest_hex_chars_u16 = 4U ,
  k_selftest_hex_chars_u32 = 8U ,
  k_selftest_dec_chars_u32 = 10U ,
  k_selftest_nibble_bits = 4U ,
  k_selftest_hex_digit_split = 10U
}
 Hex/decimal text-formatter sizing constants. More...
enum  selftest_mask_t : uint32_t {
  k_selftest_nibble_mask = 0xFU ,
  k_selftest_dec_radix = 10U
}
 Bit-mask constants used by the text formatters. More...
enum  selftest_verify_t : uint32_t {
  k_selftest_burst_blocks = 8U ,
  k_selftest_burst_bytes = 4096U ,
  k_selftest_target_lun = 0U ,
  k_selftest_wp_probe_lba = 50U ,
  k_selftest_no_mismatch = 0xFFFFFFFFU ,
  k_selftest_ms_per_sec = 1000U ,
  k_selftest_bytes_per_kib = 1024U ,
  k_selftest_soak_iters = 16U ,
  k_selftest_bytes_per_mib = 1048576U
}
 Content-verification geometry over the device's FAT16 volume. More...
enum  selftest_phase_t : uint32_t {
  k_selftest_phase_boot = 0U ,
  k_selftest_phase_host_init = 1U ,
  k_selftest_phase_enum = 2U ,
  k_selftest_phase_mount = 3U ,
  k_selftest_phase_verify = 4U ,
  k_selftest_phase_wp = 5U ,
  k_selftest_phase_pass = 6U
}
 J-Link probe values marking host-ladder progress. More...
enum  selftest_mram_t : uint32_t {
  k_mram_base_addr = 0x02000000U ,
  k_mram_bytes = 0x00100000U
}
 The MRAM window the device-side volume exposes. More...
enum  scsi_sense_code_t : uint8_t {
  k_scsi_sense_illegal_request = 0x05U ,
  k_scsi_asc_lba_out_of_range = 0x21U ,
  k_scsi_ascq_none = 0x00U
}
 SCSI sense triple for an unsupported / out-of-range request. More...
enum  scsi_wp_sense_t : uint8_t {
  k_scsi_sense_data_protect = 0x07U ,
  k_scsi_asc_write_protected = 0x27U
}
 SCSI sense triple for a write to the protected medium. More...
enum  selftest_fat_geom_t : uint32_t {
  k_fat_reserved_sectors = 1U ,
  k_fat_num_fats = 1U ,
  k_fat_fat_sectors = 17U ,
  k_fat_root_entries = 512U ,
  k_fat_root_sectors = 32U ,
  k_fat_data_sectors = 4096U ,
  k_fat_fat_lba = 1U ,
  k_fat_root_lba = 18U ,
  k_fat_data_lba = 50U ,
  k_fat_total_sectors = 4146U ,
  k_fat_first_cluster = 2U ,
  k_fat_mram_clusters = 2048U ,
  k_fat_last_mram_clus = 2049U ,
  k_fat_entries_per_sec = 256U ,
  k_fat_eoc = 0xFFFFU ,
  k_fat_entry0 = 0xFFF8U
}
 Synthesized FAT16 volume geometry (MS FAT spec 1.03). More...
enum  selftest_fat_boot_t : uint32_t {
  k_boot_jmp0 = 0xEBU ,
  k_boot_jmp1 = 0x3CU ,
  k_boot_jmp2 = 0x90U ,
  k_boot_media = 0xF8U ,
  k_boot_sec_per_trk = 32U ,
  k_boot_num_heads = 16U ,
  k_boot_drive_num = 0x80U ,
  k_boot_ext_sig = 0x29U ,
  k_boot_volume_id = 0x52A8D20AU ,
  k_boot_sig_lo = 0x55U ,
  k_boot_sig_hi = 0xAAU ,
  k_boot_sig_lo_off = 510U ,
  k_boot_sig_hi_off = 511U
}
 Boot-sector field values (MS FAT spec 1.03 sec 3.1). More...
enum  selftest_fat_off_t : uint8_t {
  k_bpb_off_jmp = 0U ,
  k_bpb_off_oem = 3U ,
  k_bpb_off_bps = 11U ,
  k_bpb_off_spc = 13U ,
  k_bpb_off_rsvd = 14U ,
  k_bpb_off_nfats = 16U ,
  k_bpb_off_rootent = 17U ,
  k_bpb_off_totsec16 = 19U ,
  k_bpb_off_media = 21U ,
  k_bpb_off_fatsz16 = 22U ,
  k_bpb_off_spt = 24U ,
  k_bpb_off_heads = 26U ,
  k_bpb_off_drvnum = 36U ,
  k_bpb_off_bootsig = 38U ,
  k_bpb_off_volid = 39U ,
  k_bpb_off_label = 43U ,
  k_bpb_off_fstype = 54U ,
  k_dir_entry_bytes = 32U ,
  k_dir_off_attr = 11U ,
  k_dir_off_cluster_lo = 26U ,
  k_dir_off_size = 28U ,
  k_dir_attr_volume = 0x08U ,
  k_dir_attr_read_only = 0x01U ,
  k_dir_name_bytes = 11U ,
  k_byte_shift = 8U ,
  k_byte_mask = 0xFFU
}
 Byte offsets inside the boot sector and directory entries. More...
enum  selftest_word_pack_t : uint32_t {
  k_word_shift = 16U ,
  k_word_mask = 0xFFFFU
}
 32-bit little-endian split constants. More...

Detailed Description

Shared constants for the usb_selftest_soak translation units.

The soak app is split into focused TUs (console / device / host / main); this header holds the typed-enum constants they share – thread + pool sizing, the text-formatter widths, the verify/soak geometry, the J-Link probe phases, the MRAM window, the SCSI sense triples, and the synthesized FAT16 layout. Plain compile-time constants only (no state), so every TU can include it freely.

Since
0.1.0

Definition in file usb_selftest_common.h.

Enumeration Type Documentation

◆ scsi_sense_code_t

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 109 of file usb_selftest_common.h.

◆ scsi_wp_sense_t

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 116 of file usb_selftest_common.h.

◆ selftest_config_t

enum selftest_config_t : uint32_t

Compile-time settings: threads, pool, console, retry cadence.

Enumerator
k_selftest_thread_stack 

Device worker stack (bytes).

k_selftest_host_stack 

Host worker stack (bytes).

k_selftest_usbx_pool_bytes 

USBX memory pool (bytes).

k_selftest_block_size 

SCSI logical block size (bytes).

k_selftest_idle_ticks 

Parked-loop back-off (ticks).

k_selftest_boot_wait_ticks 

Host start delay (1 ms ticks).

k_selftest_retry_ticks 

Pause between ladder retries.

k_selftest_baud 

J-Link OB CDC log baud.

k_selftest_print_cap 

Bound for console-string scans.

k_selftest_dev_priority 

Device bring-up worker priority.

k_selftest_host_priority 

Host worker: BELOW the USBX storage class thread (UX_THREAD_PRIORITY_CLASS = 20).

The polled host loop busy-waits for device data; if it outranked the class thread, that thread could never run selftest_msc_read and every bulk read would time out (enumeration still works – device SETUP is ISR-driven).

Definition at line 25 of file usb_selftest_common.h.

◆ selftest_fat_boot_t

enum selftest_fat_boot_t : uint32_t

Boot-sector field values (MS FAT spec 1.03 sec 3.1).

Enumerator
k_boot_jmp0 

Short JMP opcode.

k_boot_jmp1 

JMP displacement.

k_boot_jmp2 

NOP.

k_boot_media 

Fixed-disk media byte.

k_boot_sec_per_trk 

Geometry filler.

k_boot_num_heads 

Geometry filler.

k_boot_drive_num 

BIOS drive number.

k_boot_ext_sig 

Extended boot signature.

k_boot_volume_id 

Arbitrary volume serial.

k_boot_sig_lo 

Boot signature low byte.

k_boot_sig_hi 

Boot signature high byte.

k_boot_sig_lo_off 

Signature low-byte offset.

k_boot_sig_hi_off 

Signature high-byte offset.

Definition at line 152 of file usb_selftest_common.h.

◆ selftest_fat_geom_t

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.

Enumerator
k_fat_reserved_sectors 

Boot sector only.

k_fat_num_fats 

Single FAT copy.

k_fat_fat_sectors 

FAT16 size for 4098 entries.

k_fat_root_entries 

Root directory entries.

k_fat_root_sectors 

512 entries x 32 B / 512 B.

k_fat_data_sectors 

Padded data region (>= 4085).

k_fat_fat_lba 

First FAT sector.

k_fat_root_lba 

First root-directory sector.

k_fat_data_lba 

First data sector (cluster 2).

k_fat_total_sectors 

1 + 17 + 32 + 4096.

k_fat_first_cluster 

FAT data area starts at cluster 2.

k_fat_mram_clusters 

Clusters backed by MRAM (1 MiB).

k_fat_last_mram_clus 

Last cluster of MRAM.BIN.

k_fat_entries_per_sec 

FAT16 entries per 512-byte sector.

k_fat_eoc 

End-of-chain marker.

k_fat_entry0 

FAT[0]: media F8 + filler.

Definition at line 129 of file usb_selftest_common.h.

◆ selftest_fat_off_t

enum selftest_fat_off_t : uint8_t

Byte offsets inside the boot sector and directory entries.

Enumerator
k_bpb_off_jmp 

Jump instruction.

k_bpb_off_oem 

OEM name (8 bytes).

k_bpb_off_bps 

Bytes per sector.

k_bpb_off_spc 

Sectors per cluster.

k_bpb_off_rsvd 

Reserved sector count.

k_bpb_off_nfats 

Number of FATs.

k_bpb_off_rootent 

Root entry count.

k_bpb_off_totsec16 

Total sectors (16-bit).

k_bpb_off_media 

Media descriptor.

k_bpb_off_fatsz16 

Sectors per FAT.

k_bpb_off_spt 

Sectors per track.

k_bpb_off_heads 

Head count.

k_bpb_off_drvnum 

Drive number.

k_bpb_off_bootsig 

Extended boot signature.

k_bpb_off_volid 

Volume serial (4 bytes).

k_bpb_off_label 

Volume label (11 bytes).

k_bpb_off_fstype 

Filesystem type (8 bytes).

k_dir_entry_bytes 

Directory entry size.

k_dir_off_attr 

Attribute byte.

k_dir_off_cluster_lo 

First cluster (low word).

k_dir_off_size 

File size (32-bit LE).

k_dir_attr_volume 

Volume-label attribute.

k_dir_attr_read_only 

Read-only attribute.

k_dir_name_bytes 

8.3 name field length.

k_byte_shift 

Bits per byte for LE packing.

k_byte_mask 

Low-byte mask.

Definition at line 172 of file usb_selftest_common.h.

◆ selftest_hex_t

enum selftest_hex_t : uint8_t

Hex/decimal text-formatter sizing constants.

Enumerator
k_selftest_hex_chars_u16 

16-bit value -> "ABCD".

k_selftest_hex_chars_u32 

32-bit value -> "ABCDEF01".

k_selftest_dec_chars_u32 

Max digits for a 32-bit count.

k_selftest_nibble_bits 

Bits per hex nibble.

k_selftest_hex_digit_split 

Threshold between '0-9'/'A-F'.

Definition at line 52 of file usb_selftest_common.h.

◆ selftest_mask_t

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 64 of file usb_selftest_common.h.

◆ selftest_mram_t

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 103 of file usb_selftest_common.h.

◆ selftest_phase_t

enum selftest_phase_t : uint32_t

J-Link probe values marking host-ladder progress.

Enumerator
k_selftest_phase_boot 

Host thread not yet started.

k_selftest_phase_host_init 

ra8_usb_hmsc_init issued.

k_selftest_phase_enum 

Enumerating the FS device.

k_selftest_phase_mount 

Mounting the FAT16 volume.

k_selftest_phase_verify 

Streaming + comparing MRAM.BIN.

k_selftest_phase_wp 

Write-protect rejection test.

k_selftest_phase_pass 

Full config A pass.

Definition at line 89 of file usb_selftest_common.h.

◆ selftest_verify_t

enum selftest_verify_t : uint32_t

Content-verification geometry over the device's FAT16 volume.

Enumerator
k_selftest_burst_blocks 

Blocks per READ(10) burst.

k_selftest_burst_bytes 

8 x 512 B burst buffer size.

k_selftest_target_lun 

Single-LUN device.

k_selftest_wp_probe_lba 

Data-region LBA for WP test.

k_selftest_no_mismatch 

Probe: no mismatch found.

k_selftest_ms_per_sec 

Milliseconds per second.

k_selftest_bytes_per_kib 

Bytes per KiB (rate math).

k_selftest_soak_iters 

Soak: 1 MiB verify repeats.

k_selftest_bytes_per_mib 

Bytes per MiB (aggregate).

Definition at line 73 of file usb_selftest_common.h.

◆ selftest_word_pack_t

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 205 of file usb_selftest_common.h.