158 __asm__
volatile(
"wfi");
249 uint32_t blocks = 0U;
311 uint32_t cpuclk0_hz = 0U;
312 uint32_t pclka_hz = 0U;
344#ifndef RA8_OFF_TARGET
386 (void)first_unused_memory;
421#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 TX_THREAD s_device_thread
ThreadX TCB for the USBX device-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 ra8_err_t sdmsc_card_up(uint32_t pclka_hz)
Bring the live SD card up and latch its full CSD capacity.
static void sdmsc_route_usb_or_halt(void)
Route the four USB-FS pins for the device role.
static void sdmsc_panic_halt(void)
Halt forever in WFI – panic stop on init failure.
static const ra8_port_pin_t k_sdmsc_pin_fs_vbus
USBFS VBUS sense pin (P4_07, PSEL = usb_fs).
static const ra8_port_pin_t k_sdmsc_pin_fs_dp
USBFS D+ (P8_14).
static void sdmsc_setup_or_halt(void)
Bring CGC + USBFS clock + SysTick + SCI8 + LEDs + SD + pins up.
static const ra8_port_pin_t k_sdmsc_pin_fs_vbusen
USBFS VBUSEN (P5_00) – GPIO LOW for the device role.
static const ra8_port_pin_t k_sdmsc_pin_fs_dm
USBFS D- (P8_15).
static volatile uint32_t s_dbg_sd_err
SD bring-up result: 0 = card enumerated OK, else the error code.
static ra8_err_t sdmsc_print_card_banner(uint32_t blocks)
Print "usb_msc_sdcard: card <N> blocks (<M> MiB)" at boot.
Board-support layer for the Renesas EK-RA8D2 v1 evaluation kit.
@ k_ra8_board_pmod2_spi_cipo
Pmod2.3 CIPO (CIPO0_B), P602.
@ k_ra8_board_pmod2_spi_cs
Pmod2.1 CS (SS0_B), P604.
@ k_ra8_board_pmod2_spi_copi
Pmod2.2 COPI (COPI0_B), P603.
@ k_ra8_board_pmod2_spi_sck
Pmod2.4 SCK (SCK0_B), P601.
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_uart_console_init(uint32_t baud)
Configure SCI8 + PD02/PD03 as the debug-console UART.
@ 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.
@ k_ra8_clock_id_pclka
PCLKA.
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).
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.
PSEL codes for peripheral pin routing on the RA8D2.
@ k_ra8_psel_usb_fs
10011b: USB Full-Speed.
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_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.
SD card driver in SPI-mode (PMOD-attached cards).
ra8_err_t ra8_sdmmc_spi_transport_sci(uint8_t sci_channel, uint32_t pclk_hz, const ra8_sdmmc_spi_sci_pins_t *pins, ra8_sdmmc_spi_transport_t *out)
Build the standard EK-RA8D2 SCI Simple-SPI transport for an SD card.
ra8_err_t ra8_sdmmc_spi_get_capacity(uint32_t *out_blocks)
Return the card capacity in 512-byte blocks.
ra8_err_t ra8_sdmmc_spi_init(const ra8_sdmmc_spi_transport_t *transport)
Run the SD SPI-mode identification sequence on a card.
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.
unsigned int UINT
ThreadX-compatible unsigned int (host stub).
char CHAR
ThreadX-compatible CHAR (host stub).
Opaque thread stand-in for the host build.
The four bus pins of an SCI Simple-SPI SD slot.
Driver-to-bus binding (Dependency Inversion seam).
examples/ek_ra8d2/hw_pending/manual/usb_msc_sdcard/inc/usb_msc_sdcard_steps.h
ra8_err_t sdmsc_print(const char *text)
Print a NUL-terminated ASCII string over the SCI8 console.
VOID sdmsc_device_worker(ULONG arg)
Device worker: bring the live-SD read/write MSC device up, then park.
ra8_err_t sdmsc_print_dec(uint32_t value)
Print a uint32_t as ASCII decimal over the SCI8 console.
volatile uint32_t s_usb_msc_sdcard_blocks
Live SD card capacity in 512-byte blocks (0 = no card).
ra8_err_t sdmsc_print_fail(const char *what, ra8_err_t err)
Print "FAIL <what> err=0xNNNNNNNN" on its own console line.
@ k_sdmsc_blocks_per_mib
512-B blocks per MiB.
@ k_sdmsc_baud
J-Link OB CDC log baud.
@ k_sdmsc_thread_stack
Device worker stack (bytes).
@ k_sdmsc_dev_priority
Device bring-up worker priority.
@ k_sdmsc_sd_spi_channel
SCI0 Simple-SPI -> Pmod2 microSD.
USBX device-controller-driver (DCD) bridge to ra8_usb.