|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
Shared constants + cross-TU prototypes for usb_selftest_mlun. More...
#include <stdint.h>#include "tx_api.h"#include "ux_api.h"Go to the source code of this file.
Functions | |
| void | mlun_pattern_fill (uint32_t lun, uint32_t lba, UCHAR *out) |
| Fill one 512-byte sector with this LUN/LBA's deterministic bytes. | |
| VOID | mlun_host_worker (ULONG arg) |
| Host-side worker: retry the full pass until it succeeds. | |
Shared constants + cross-TU prototypes for usb_selftest_mlun.
The multi-LUN USB self-loop app is split into two translation units to keep each one under the per-file line cap: main.c owns boot, pin/clock bring-up, the device-side USBX MSC class, and the ThreadX entry hooks; the steps TU (usb_selftest_mlun_steps.c) owns the shared per-(LUN,LBA) pattern, the SCI8 console + text formatters, and the host-side enumerate / per-LUN verify / retry worker.
This header holds the typed-enum constants both TUs share (thread + pool sizing, the text-formatter widths, the LUN geometry, the host-ladder probe phases) plus prototypes for the two symbols that cross the TU boundary: mlun_pattern_fill (the device media-read in main.c calls it) and mlun_host_worker (tx_application_define in main.c spawns it). Every other moved helper stays file-static in the steps TU.
Definition in file usb_selftest_mlun_steps.h.
| enum mlun_config_t : uint32_t |
Compile-time settings: threads, pool, console, cadence.
Definition at line 38 of file usb_selftest_mlun_steps.h.
| enum mlun_geom_t : uint32_t |
LUN geometry + verification constants.
Definition at line 76 of file usb_selftest_mlun_steps.h.
| enum mlun_hex_t : uint8_t |
Hex/decimal text-formatter sizing constants.
Definition at line 55 of file usb_selftest_mlun_steps.h.
| enum mlun_mask_t : uint32_t |
Bit-mask constants used by the text formatters.
| Enumerator | |
|---|---|
| k_mlun_nibble_mask | 4-bit nibble mask. |
| k_mlun_dec_radix | Base for decimal conversion. |
Definition at line 67 of file usb_selftest_mlun_steps.h.
| enum mlun_phase_t : uint32_t |
J-Link probe values marking host-ladder progress.
Definition at line 95 of file usb_selftest_mlun_steps.h.
| VOID mlun_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 enumerate + per-LUN verify pass with a retry pause until both LUNs verify; afterwards parks so the verdict stays on the wire.
| [in] | arg | ThreadX entry argument (unused). |
Definition at line 497 of file usb_selftest_mlun_steps.c.
References k_mlun_boot_wait_ticks, k_mlun_idle_ticks, k_mlun_retry_ticks, k_ra8_ok, mlun_host_pass(), and tx_thread_sleep.
Referenced by tx_application_define().
| void mlun_pattern_fill | ( | uint32_t | lun, |
| uint32_t | lba, | ||
| UCHAR * | out ) |
Fill one 512-byte sector with this LUN/LBA's deterministic bytes.
Byte i = (lun*97 + lba*7 + i + 0x5A) & 0xFF. Distinct per LUN and per LBA so the host can prove it addressed the right logical unit and sector. The device media-read and the host verifier compute it identically.
| [in] | lun | The logical unit (0..1). |
| [in] | lba | The logical block address within the LUN. |
| [out] | out | 512-byte destination buffer. |
out has k_mlun_block_size writable bytes. lun and lba are within the exposed geometry. out holds the sector's pattern bytes. Definition at line 65 of file usb_selftest_mlun_steps.c.
References k_mlun_block_size, k_mlun_byte_mask, k_mlun_pat_bias, k_mlun_pat_lba_mul, and k_mlun_pat_lun_mul.
Referenced by mlun_msc_read(), and mlun_verify_one().