|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
examples/ek_ra8d2/hil_needs_revalidation/usb_selftest_wlun/inc/usb_selftest_wlun_steps.h More...
Go to the source code of this file.
Functions | |
| void | wlun_pattern_fill (uint32_t lun, uint32_t lba, UCHAR *out) |
| Fill one 512-byte sector with this LUN/LBA's deterministic bytes. | |
| uint8_t | wlun_nibble_to_hex (uint32_t nibble) |
| Format one nibble (0..15) into an uppercase hex character. | |
| uint32_t | wlun_str_len (const char *text) |
| Bounded ASCII string length (cap k_wlun_print_cap). | |
| ra8_err_t | wlun_sci_write (const uint8_t *data, uint32_t len) |
| Push a literal block over SCI8 polled. | |
| ra8_err_t | wlun_print (const char *text) |
| Print a NUL-terminated ASCII string over the console. | |
| ra8_err_t | wlun_print_dec (uint32_t value) |
| Print a uint32_t as ASCII decimal. | |
| ra8_err_t | wlun_print_hex (uint32_t value, uint8_t digits) |
| Print a value as fixed-width uppercase hex. | |
| ra8_err_t | wlun_print_fail (const char *what, ra8_err_t err) |
| Print "FAIL <what> err=0xNNNNNNNN" on its own line. | |
| VOID | wlun_host_worker (ULONG arg) |
| Host-side worker: retry the full pass until it succeeds. | |
examples/ek_ra8d2/hil_needs_revalidation/usb_selftest_wlun/inc/usb_selftest_wlun_steps.h
Shared seam for the USB writable-LUN self-loop: constants + helpers
Splits the writable-LUN self-loop example into cohesive translation units so each one stays under the per-file line cap. This header is the single shared contract between main.c (board bring-up + device side) and the two sibling units:
It carries the compile-time tunables, the geometry / pattern constants, the host-ladder phase markers, and the prototypes of every helper that is referenced across translation units. main.c keeps main(), the SysTick override, tx_application_define, the USB descriptors, the device-side media callbacks, and the device-worker bring-up.
Definition in file usb_selftest_wlun_steps.h.
| enum wlun_config_t : uint32_t |
Compile-time settings: threads, pool, console, cadence.
Definition at line 53 of file usb_selftest_wlun_steps.h.
| enum wlun_geom_t : uint32_t |
LUN geometry + verification constants.
Definition at line 91 of file usb_selftest_wlun_steps.h.
| enum wlun_hex_t : uint8_t |
Hex/decimal text-formatter sizing constants.
Definition at line 70 of file usb_selftest_wlun_steps.h.
| enum wlun_mask_t : uint32_t |
Bit-mask constants used by the text formatters.
| Enumerator | |
|---|---|
| k_wlun_nibble_mask | 4-bit nibble mask. |
| k_wlun_dec_radix | Base for decimal conversion. |
Definition at line 82 of file usb_selftest_wlun_steps.h.
| enum wlun_phase_t : uint32_t |
J-Link probe values marking host-ladder progress.
Definition at line 110 of file usb_selftest_wlun_steps.h.
| VOID wlun_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 / WRITE(10) / verify pass with a retry pause until the writable LUN verifies; afterwards parks so the verdict stays on the wire.
| [in] | arg | ThreadX entry argument (unused). |
Definition at line 298 of file usb_selftest_wlun_host.c.
References k_ra8_ok, k_wlun_boot_wait_ticks, k_wlun_idle_ticks, k_wlun_retry_ticks, tx_thread_sleep, and wlun_host_pass().
Referenced by tx_application_define().
| uint8_t wlun_nibble_to_hex | ( | uint32_t | nibble | ) |
Format one nibble (0..15) into an uppercase hex character.
Standard '0'-'9' then 'A'-'F' mapping.
| [in] | nibble | 4-bit value. |
| '0' | For a zero nibble. |
Definition at line 50 of file usb_selftest_wlun_console.c.
References k_wlun_hex_digit_split.
Referenced by wlun_print_hex().
| void wlun_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_wlun_block_size writable bytes. lun and lba are within the exposed geometry. out holds the sector's pattern bytes. Definition at line 37 of file usb_selftest_wlun_console.c.
References k_wlun_block_size, k_wlun_byte_mask, k_wlun_pat_bias, k_wlun_pat_lba_mul, and k_wlun_pat_lun_mul.
Referenced by wlun_verify_one(), and wlun_write_disk().
|
nodiscard |
Print a NUL-terminated ASCII string over the console.
Length-bounded by wlun_str_len.
| [in] | text | String to print (CR/LF included by the caller). |
| k_ra8_ok | All bytes queued. |
text is non-NULL. text is NUL-terminated within k_wlun_print_cap bytes. Definition at line 75 of file usb_selftest_wlun_console.c.
References wlun_sci_write(), and wlun_str_len().
Referenced by wlun_host_enumerate(), wlun_host_pass(), wlun_print_fail(), and wlun_print_lun_ok().
|
nodiscard |
Print a uint32_t as ASCII decimal.
Digit-reversal into a bounded scratch buffer.
| [in] | value | Value to print. |
| k_ra8_ok | All bytes queued. |
Definition at line 80 of file usb_selftest_wlun_console.c.
References k_wlun_dec_chars_u32, k_wlun_dec_radix, and wlun_sci_write().
Referenced by wlun_host_enumerate(), and wlun_print_lun_ok().
Print "FAIL <what> err=0xNNNNNNNN" on its own line.
One-line diagnostic; first failing chunk's code returned.
| [in] | what | Short description of the failed step. |
| [in] | err | Error code returned by the step. |
| k_ra8_ok | The diagnostic line is queued. |
what is NUL-terminated within the print cap. Definition at line 118 of file usb_selftest_wlun_console.c.
References k_ra8_ok, k_wlun_hex_chars_u32, wlun_print(), and wlun_print_hex().
Referenced by wlun_host_enumerate(), wlun_host_pass(), wlun_verify_one(), and wlun_write_disk().
|
nodiscard |
Print a value as fixed-width uppercase hex.
Width is clamped to 8 hex digits.
| [in] | value | Value to print. |
| [in] | digits | Hex digit count (4 for u16, 8 for u32). |
| k_ra8_ok | All bytes queued. |
digits is at most k_wlun_hex_chars_u32. Definition at line 104 of file usb_selftest_wlun_console.c.
References k_wlun_hex_chars_u32, k_wlun_nibble_bits, k_wlun_nibble_mask, wlun_nibble_to_hex(), and wlun_sci_write().
Referenced by wlun_host_enumerate(), and wlun_print_fail().
|
nodiscard |
Push a literal block over SCI8 polled.
Thin wrapper fixing the console channel.
| [in] | data | Buffer to send. |
| [in] | len | Byte count. |
| k_ra8_ok | All bytes queued. |
data is non-NULL; SCI8 init already ran. len excludes any NUL terminator. Definition at line 70 of file usb_selftest_wlun_console.c.
References ra8_board_uart_console_write().
Referenced by wlun_print(), wlun_print_dec(), and wlun_print_hex().
| uint32_t wlun_str_len | ( | const char * | text | ) |
Bounded ASCII string length (cap k_wlun_print_cap).
Linear scan with a hard upper bound.
| [in] | text | NUL-terminated string. |
| 0 | For an empty string. |
text is non-NULL. text points to readable storage of at least the length. Definition at line 58 of file usb_selftest_wlun_console.c.
References k_wlun_print_cap.
Referenced by wlun_print().