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

Host-side self-test ladder + console helpers shared with main.c. More...

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

Go to the source code of this file.

Enumerations

enum  cdc_config_t : uint32_t {
  k_cdc_thread_stack = 4096U ,
  k_cdc_host_stack = 8192U ,
  k_cdc_usbx_pool_bytes = 32768U ,
  k_cdc_idle_ticks = 50U ,
  k_cdc_boot_wait_ticks = 500U ,
  k_cdc_retry_ticks = 3000U ,
  k_cdc_baud = 115200U ,
  k_cdc_print_cap = 160U ,
  k_cdc_dev_priority = 8U ,
  k_cdc_host_priority = 24U
}
 Compile-time settings: threads, pool, console, cadence. More...
enum  cdc_geom_t : uint32_t {
  k_cdc_mps = 64U ,
  k_cdc_payload = 60U ,
  k_cdc_rounds = 8U ,
  k_cdc_echo_buf = 64U ,
  k_cdc_dev_addr = 1U ,
  k_cdc_ep_in_num = 1U ,
  k_cdc_ep_out_num = 2U ,
  k_cdc_pipe_in = 1U ,
  k_cdc_pipe_out = 2U ,
  k_cdc_no_mismatch = 0xFFFFFFFFU ,
  k_cdc_pat_round_mul = 97U ,
  k_cdc_pat_idx_mul = 7U ,
  k_cdc_pat_bias = 0x5AU ,
  k_cdc_byte_mask = 0xFFU
}
 Echo payload + bulk-pipe + pattern constants. More...

Functions

VOID cdc_host_worker (ULONG arg)
 Host-side worker: retry the full pass until it succeeds.

Detailed Description

Host-side self-test ladder + console helpers shared with main.c.

Tag
[Ring 6 / APP] {World: S}

Companion translation unit for the usb_selftest_cdc HIL example. It carries the host-side polled CDC enumerate + bulk-echo ladder, the SCI8 console formatters those routines print through, and the per-round echo pattern. main.c keeps the device-side USBX worker, the board bring-up, and the entry point, and only reaches into this unit through cdc_host_worker (the ThreadX entry it spawns in tx_application_define).

The enums declared here (cdc_config_t, cdc_geom_t) are the constants shared between the two units; the host-private constants live entirely in the companion .c.

Author
Brighton Sikarskie
Date
2026-06-13
Since
0.1.0

Definition in file usb_selftest_cdc_steps.h.

Enumeration Type Documentation

◆ cdc_config_t

enum cdc_config_t : uint32_t

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

Enumerator
k_cdc_thread_stack 

Device worker stack (bytes).

k_cdc_host_stack 

Host worker stack (bytes).

k_cdc_usbx_pool_bytes 

USBX memory pool (bytes).

k_cdc_idle_ticks 

Parked-loop back-off (ticks).

k_cdc_boot_wait_ticks 

Host start delay (1 ms ticks).

k_cdc_retry_ticks 

Pause between ladder retries.

k_cdc_baud 

J-Link OB CDC log baud.

k_cdc_print_cap 

Bound for console-string scans.

k_cdc_dev_priority 

Device bring-up worker priority.

k_cdc_host_priority 

Host worker priority (below USBX).

Definition at line 35 of file usb_selftest_cdc_steps.h.

◆ cdc_geom_t

enum cdc_geom_t : uint32_t

Echo payload + bulk-pipe + pattern constants.

Enumerator
k_cdc_mps 

Bulk endpoint wMaxPacketSize (FS).

k_cdc_payload 

Bytes per echo round (sub-MPS).

k_cdc_rounds 

Echo rounds the host runs.

k_cdc_echo_buf 

One-MPS scratch buffer (bytes).

k_cdc_dev_addr 

Address the host assigns.

k_cdc_ep_in_num 

Device bulk-IN endpoint number.

k_cdc_ep_out_num 

Device bulk-OUT endpoint number.

k_cdc_pipe_in 

Host pipe for the device bulk-IN.

k_cdc_pipe_out 

Host pipe for the device bulk-OUT.

k_cdc_no_mismatch 

Probe: no mismatch.

k_cdc_pat_round_mul 

Per-round pattern multiplier.

k_cdc_pat_idx_mul 

Per-index pattern multiplier.

k_cdc_pat_bias 

Pattern constant bias.

k_cdc_byte_mask 

Byte mask.

Definition at line 52 of file usb_selftest_cdc_steps.h.

Function Documentation

◆ cdc_host_worker()

VOID cdc_host_worker ( ULONG arg)

Host-side worker: retry the full pass until it succeeds.

Waits for the device side to attach, then loops the host pass with a retry pause until every echo round verifies; afterwards parks so the verdict stays on the wire. Spawned by tx_application_define in main.c as the host ThreadX entry.

Parameters
[in]argThreadX entry argument (unused).
Precondition
tx_application_define created this thread.
The HS host pins, expander switch, and PLL are up (main).
Postcondition
On success the pass counter and LED2 are latched.
Retries forever otherwise; each failure prints its step.
Note
Blocking calls; ms timeouts via ra8_time.
Since
0.1.0

Definition at line 787 of file usb_selftest_cdc_steps.c.

References cdc_host_pass(), k_cdc_boot_wait_ticks, k_cdc_idle_ticks, k_cdc_retry_ticks, k_ra8_ok, and tx_thread_sleep.

Referenced by tx_application_define().