39typedef enum : uintptr_t {
44typedef enum : uint32_t {
55#include "ux_device_class_cdc_acm.h"
56#include "ux_device_stack.h"
171static UX_SLAVE_CLASS_CDC_ACM*
volatile s_cdc_acm = UX_NULL;
184 volatile uint32_t loop_iter;
185 volatile uint32_t loop_cdc_null;
186 volatile uint32_t loop_pre_read;
187 volatile uint32_t loop_post_read;
188 volatile uint32_t loop_read_ok;
189 volatile uint32_t loop_read_zero;
190 volatile uint32_t loop_pre_write;
191 volatile uint32_t loop_post_write;
288typedef enum : uint32_t {
332 s_cdc_acm = (UX_SLAVE_CLASS_CDC_ACM*)cdc_instance;
333 if (_ux_system_slave != UX_NULL) {
334 _ux_system_slave->ux_system_slave_device.ux_slave_device_state =
335 (
unsigned long)UX_DEVICE_CONFIGURED;
410 UX_NULL) == UX_SUCCESS;
433 static UCHAR s_class_name[] =
"ux_slave_class_cdc_acm";
435 UX_SLAVE_CLASS_CDC_ACM_PARAMETER cdc_params = {
438 .ux_slave_class_cdc_acm_parameter_change = UX_NULL,
441 return _ux_device_stack_class_register(s_class_name,
442 _ux_device_class_cdc_acm_entry,
445 &cdc_params) == UX_SUCCESS;
551 volatile const uint32_t*
const psarb_p = (
volatile const uint32_t*)
k_usbhs_psarb_addr;
552 volatile const uint32_t*
const pparb_p = (
volatile const uint32_t*)
k_usbhs_pparb_addr;
577 UX_SLAVE_CLASS_CDC_ACM* cdc_snap = (UX_SLAVE_CLASS_CDC_ACM*)
s_cdc_acm;
578 if (cdc_snap == UX_NULL) {
590 if (_ux_system_slave != UX_NULL) {
591 _ux_system_slave->ux_system_slave_device.ux_slave_device_state =
592 (
unsigned long)UX_DEVICE_CONFIGURED;
595 UINT read_status = _ux_device_class_cdc_acm_read(cdc_snap, buf,
sizeof(buf), &n);
597 if (read_status != UX_SUCCESS) {
607 if (_ux_device_class_cdc_acm_write(cdc_snap, buf, n, &n) != UX_SUCCESS) {
611 for (
ULONG i = 0UL; i < n; i++) {
685 static CHAR s_semaphore_name[] =
"cdc_active";
688 (void)first_unused_memory;
static TX_THREAD s_demo_thread
demo_config_t
Compile-time settings for the HTTPS client demo.
@ k_demo_thread_stack
Demo thread stack.
static UCHAR s_demo_stack[k_demo_thread_stack]
static UCHAR s_usbx_pool[k_wlun_usbx_pool_bytes]
USBX memory pool (USBX uses tx_byte_pool internally).
static CHAR s_thread_name[]
static UX_SLAVE_CLASS_CDC_ACM * s_cdc_acm
Active CDC-ACM class instance, captured by the activate callback.
static TX_SEMAPHORE s_cdc_active_sem
Posted by the activate callback so the echo worker blocks on it instead of polling s_cdc_acm with tx_...
volatile demo_diag_t s_demo_diag
Externally-readable counters for demo loop progress.
static VOID demo_cdc_activate(VOID *cdc_instance)
CDC-ACM activate callback.
@ k_demo_echo_buf_bytes
One bulk-FS packet per recv/send.
@ k_demo_idle_ticks
Idle back-off when no class active.
@ k_demo_usbx_pool_bytes
USBX pool: 32 KiB; CDC-ACM enum exhausts 16 KiB.
static VOID demo_worker(ULONG arg)
Worker thread entry.
static VOID demo_cdc_deactivate(VOID *cdc_instance)
CDC-ACM deactivate callback.
Board-support layer for the Renesas EK-RA8D2 v1 evaluation kit.
ra8_err_t ra8_board_led_toggle(ra8_board_led_id_t led)
Toggle led's output state.
@ k_ra8_board_led1
LED1, BLUE, P600 (jumper E27).
Error Code Definitions for ra8-firmware.
@ k_ra8_ok
Success – operation completed with all postconditions satisfied.
NVIC + ICU IELSR allocator.
Native USB controller driver public API (device + host modes).
ra8_err_t ra8_usb_device_attach(ra8_usb_speed_t speed, bool attached)
Raise / drop the D+ pull-up to advertise the device to the host.
@ k_ra8_usb_speed_hs
High-Speed controller (USBHS @ 0x40351000).
USB Full-Speed + High-Speed controller layout for the Renesas RA8D2.
static volatile uint16_t * ra8_usbhs_lpsts(void)
Get pointer to USBHS LPSTS register.
@ k_ra8_int0_full_mask
Device-mode event mask: BRDY | NRDY | BEMP | CTRT | DVST | VBSE.
static volatile r_usb_regs_t * ra8_usb_hs(void)
Get pointer to the USB HS controller register block.
unsigned int UINT
ThreadX-compatible unsigned int (host stub).
char CHAR
ThreadX-compatible CHAR (host stub).
unsigned long ULONG
ThreadX-compatible unsigned long (host stub).
Opaque thread stand-in for the host build.
Demo-loop counters; read via JLink to localise stalls.
USB FS / HS register window (device-mode subset).
volatile uint16_t INTENB0
+0x030 Interrupt Enable 0.
volatile uint16_t SYSCFG
+0x000 System Configuration.
volatile uint16_t s_lpsts_in_echo_loop
LPSTS snapshot on first echo-loop iteration.
static bool demo_worker_usbx_init(void)
Bring up USBX system + device stack with HS+FS frameworks.
volatile uint32_t s_pendsv_observed_run_count
static TX_THREAD s_intenb0_watchdog_thread
ThreadX TCB for the INTENB0 re-arm watchdog.
volatile uint32_t s_psar_state
Snapshot of R_PSCU->PSARB on entry to the echo loop.
VOID tx_application_define(VOID *first_unused_memory)
volatile uint32_t s_intenb0_watchdog_started
Set to 1 once the watchdog thread has begun polling.
boot_probe_step_t
Bisect-probe step values for s_boot_probe.
@ k_boot_probe_post_board_usbhs_init
after ra8_board_usbhs_device_init.
@ k_boot_probe_pre_dev_stack_init
before _ux_device_stack_init.
@ k_boot_probe_post_dev_attach
after ra8_usb_device_attach.
@ k_boot_probe_enter_echo_loop
entering echo while(1).
@ k_boot_probe_post_ux_dcd_init
after ux_dcd_ra8_usb_initialize.
@ k_boot_probe_thread_entry
worker entry.
@ k_boot_probe_pre_sys_init
before _ux_system_initialize.
@ k_boot_probe_pre_class_register
before _ux_device_stack_class_register.
@ k_boot_probe_pre_ux_dcd_init
before ux_dcd_ra8_usb_initialize.
@ k_boot_probe_pre_dev_attach
before ra8_usb_device_attach.
@ k_boot_probe_pre_board_usbhs_init
before ra8_board_usbhs_device_init.
volatile uint32_t s_ppar_state
Snapshot of R_PSCU->PPARB on entry to the echo loop.
usbhs_sec_reg_addr_t
USBHS security/privilege attribution register addresses.
@ k_usbhs_psarb_addr
Peripheral Security Attribution B.
@ k_usbhs_pparb_addr
Peripheral Privilege Attribution B.
volatile uint32_t s_intenb0_rearm_count
Number of times the watchdog has re-asserted INTENB0 = 0xFF00.
static bool demo_worker_start_dcd(void)
Plug the DCD bridge into the device stack and attach the bus.
volatile uint32_t s_cdc_activate_post_put
static VOID demo_cdc_activate(VOID *cdc_instance)
CDC-ACM activate callback.
static UCHAR s_intenb0_watchdog_stack[1024U]
Stack backing storage for the INTENB0 watchdog thread.
static VOID demo_worker(ULONG arg)
Worker thread entry.
volatile uint32_t s_host_kick_done
Set to 1 once the host-mode PHY analog kick has been applied.
static void demo_worker_spawn_intenb0_watchdog(void)
Spawn the INTENB0 re-arm watchdog thread.
static void demo_worker_echo_loop(void)
Run the CDC-ACM echo loop forever.
static void demo_worker_capture_echo_probes(void)
Capture bisect probes ONCE on entry to the echo loop.
static bool demo_worker_register_cdc(void)
Register the CDC-ACM class against configuration 1, interface 0.
volatile uint32_t s_cdc_activate_count
static VOID intenb0_watchdog_entry(ULONG arg)
Watchdog entry: re-asserts USBHS INTENB0 = 0xFF00 if cleared.
volatile uint16_t s_syscfg_in_echo_loop
SYSCFG snapshot taken on the FIRST iteration of the echo loop.
static VOID demo_cdc_deactivate(VOID *cdc_instance)
CDC-ACM deactivate callback.
static volatile uint32_t s_boot_probe
Temporary bisect probe for USBHS bring-up HardFault.
volatile uint32_t s_cdc_deactivate_count
examples/ek_ra8d2/hw_validated/manual/tz_secure_only_usb_hs/inc/tz_secure_only_usb_hs_steps....
UCHAR s_tz_secure_only_usb_hs_language_id_framework[k_tz_secure_only_usb_hs_language_id_framework_len]
USBX language-id table – US English (LANGID 0x0409).
UCHAR s_tz_secure_only_usb_hs_device_framework_fs[k_tz_secure_only_usb_hs_device_framework_fs_len]
Full-Speed CDC-ACM composite device framework (64-byte bulk MPS).
UCHAR s_tz_secure_only_usb_hs_string_framework[k_tz_secure_only_usb_hs_string_framework_len]
USBX string descriptor table (vendor / product / serial).
UCHAR s_tz_secure_only_usb_hs_device_framework_hs[k_tz_secure_only_usb_hs_device_framework_hs_len]
High-Speed CDC-ACM composite device framework (512-byte bulk MPS).
USBX device-controller-driver (DCD) bridge to ra8_usb.
void ux_dcd_ra8_usb_auto_echo_enable(uint8_t out_pipe, uint8_t in_pipe)
Enable ISR-side auto-echo from a bulk OUT pipe to a bulk IN pipe.
ra8_err_t ux_dcd_ra8_usb_initialize(ra8_usb_speed_t speed)
Register the ra8_usb bridge as the active USBX DCD.