68#include "ux_device_class_storage.h"
69#include "ux_device_stack.h"
124#ifndef RA8_OFF_TARGET
215 (void)first_unused_memory;
260 __asm__
volatile(
"wfi");
328 uint32_t cpuclk0_hz = 0U;
376#ifndef RA8_OFF_TARGET
void main(void)
Secure fallback main entry point.
void tx_application_define(void *first_unused_memory)
ThreadX system-define hook: build worker thread + byte pool.
void _tx_timer_interrupt(void)
void SysTick_Handler(void)
SysTick exception handler – tail-calls the ThreadX timer.
static volatile bool s_tx_kernel_up
Set in tx_application_define; gates ThreadX tick delivery.
static UCHAR s_host_stack[k_wlun_host_stack]
Stack backing storage for s_host_thread.
static TX_THREAD s_device_thread
ThreadX TCB for the USBX device-side worker thread.
static CHAR s_host_thread_name[]
static TX_THREAD s_host_thread
ThreadX TCB for the host-side worker thread.
static UCHAR s_device_stack[k_wlun_thread_stack]
Stack backing storage for s_device_thread.
static CHAR s_device_thread_name[]
static const ra8_port_pin_t k_selftest_pin_fs_vbusen
USBFS VBUSEN (P5_00) – GPIO LOW for the device role.
static VOID selftest_device_worker(ULONG arg)
Device-side worker: bring the FS device stack up, then park.
static const ra8_port_pin_t k_selftest_pin_hs_vbus
USBHS_VBUS sense pin (P4_08, PSEL = 0x14).
static VOID selftest_host_worker(ULONG arg)
Host-side worker: retry the full pass until it succeeds.
static void selftest_setup_or_halt(void)
Bring CGC + both USB clocks + SysTick + SCI8 + LEDs + pins up.
static void selftest_panic_halt(void)
Halt forever in WFI – panic stop on init failure.
static const ra8_port_pin_t k_selftest_pin_fs_dm
USBFS D- (P8_15).
static const ra8_port_pin_t k_selftest_pin_hs_pwr
J7 host-power switch (PD07): HIGH = U18 supplies VBUS (UM 6.2).
static const ra8_port_pin_t k_selftest_pin_fs_dp
USBFS D+ (P8_14).
static void selftest_route_usb_or_halt(void)
Route both ports' pins: FS as device, HS as host.
static const ra8_port_pin_t k_selftest_pin_fs_vbus
USBFS VBUS sense pin (P4_07, PSEL = 0x13).
Board-support layer for the Renesas EK-RA8D2 v1 evaluation kit.
ra8_err_t ra8_board_led_init(ra8_board_led_id_t led)
Configure led as a digital output, initial level low (off).
@ k_ra8_board_led2
LED2, GREEN, P303 (jumper E26).
@ k_ra8_board_led1
LED1, BLUE, P600 (jumper E27).
ra8_err_t ra8_board_io_expander_set_usbhs_host_mode(void)
Drive the U15 I/O expander to select USB-HS HOST mode.
ra8_err_t ra8_board_uart_console_init(uint32_t baud)
Configure SCI8 + PD02/PD03 as the debug-console UART.
@ k_ra8_board_usbhs_pin_pwr
PD07 J7 host-power switch (HIGH = U18 drives 5 V VBUS).
@ k_ra8_board_usbhs_pin_vbus
P4_08 USBHS_VBUS sense.
@ k_ra8_board_usbfs_pin_dm
P8_15 D-.
@ k_ra8_board_usbfs_pin_vbusen
P5_00 VBUSEN GPIO.
@ k_ra8_board_usbfs_pin_vbus
P4_07 VBUS sense.
@ k_ra8_board_usbfs_pin_dp
P8_14 D+.
Boot entry points shared between a vector table and its startup code.
High-level Clock Generation Circuit driver.
ra8_err_t ra8_cgc_get_clock_hz(ra8_clock_id_t id, uint32_t *out_hz)
Query the current frequency of a clock-tree domain.
@ k_ra8_clock_id_cpuclk0
Cortex-M85 CPUCLK0.
ra8_err_t ra8_cgc_init(void)
Configure the clock tree to a safe default.
ra8_err_t ra8_cgc_usbfs_clock_enable(void)
Bring up the USB-FS module clock (USBCKCR / USBCKDIVCR).
ra8_err_t ra8_cgc_usbhs_pll_enable(void)
Bring up the USBHS PHY reference clock + module clock.
Error Code Definitions for ra8-firmware.
@ k_ra8_ok
Success – operation completed with all postconditions satisfied.
ra8_err_codes_t ra8_err_t
Canonical error-return type used by every ra8-firmware API.
Minimal FAT12/FAT16/FAT32 filesystem adapter (read + write).
PSEL codes for peripheral pin routing on the RA8D2.
@ k_ra8_psel_usb_fs
10011b: USB Full-Speed.
@ k_ra8_psel_usb_hs
10100b: USB High-Speed (e.g.
NVIC + ICU IELSR allocator.
void ra8_isr_globals_enable(void)
Globally enable maskable interrupts (PRIMASK = 0).
Typed Port / Pin Constants for the RA8D2 IOPORT Module.
ra8_port_pin_t
Packed (port << 8) | pin pin identifier.
@ k_ra8_level_high
Drive or read 1.
@ k_ra8_level_low
Drive or read 0.
High-level GPIO helpers on top of the PORT + PFS register layer.
ra8_err_t ra8_gpio_output_init(ra8_port_pin_t pin, ra8_level_t init_level)
Configure a pin as a digital output and drive it to an initial level.
ra8_err_t ra8_pfs_route_peripheral(ra8_port_pin_t pin, ra8_psel_t psel, const char *owner)
Route a pin to a non-IRQ peripheral function via PFS.PSEL.
void ux_dcd_ra8_usb_irq_reenable(void)
Storm-guard recovery: zero the run counter and re-enable the USB IRQ.
SysTick-based tick counter, delay and timestamp helpers.
ra8_err_t ra8_time_init(uint32_t cpu_hz)
Initialise SysTick for a 1 kHz tick interrupt.
void ra8_time_on_tick(void)
SysTick IRQ handler – called from the vector table.
Native USB controller driver public API (device + host modes).
Native USB host-side MSC (Mass Storage Class) class layer.
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.
ra8_err_t selftest_host_pass(void)
One full host-side pass: enumerate, mount, browse, verify, WP.
@ k_selftest_boot_wait_ticks
Host start delay (1 ms ticks).
@ k_selftest_thread_stack
Device worker stack (bytes).
@ k_selftest_idle_ticks
Parked-loop back-off (ticks).
@ k_selftest_retry_ticks
Pause between ladder retries.
@ k_selftest_host_priority
Host worker: BELOW the USBX storage class thread (UX_THREAD_PRIORITY_CLASS = 20).
@ k_selftest_dev_priority
Device bring-up worker priority.
@ k_selftest_host_stack
Host worker stack (bytes).
@ k_selftest_baud
J-Link OB CDC log baud.
Shared constants for the usb_selftest_soak translation units.
Shared SCI8 console + text formatters for the soak self-test.
Device-side worker entry of the soak self-test.
Host-side entry point of the soak self-test.
USBX device-controller-driver (DCD) bridge to ra8_usb.