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

USB self-loop: HS host DFU-downloads firmware to an FS DFU device, uploads + verifies. More...

#include <stdint.h>
#include <string.h>
#include "ra8_board_ek_ra8d2.h"
#include "ra8_boot_entry.h"
#include "ra8_cgc.h"
#include "ra8_err.h"
#include "ra8_gpio_constants.h"
#include "ra8_isr.h"
#include "ra8_port_constants.h"
#include "ra8_port_utils.h"
#include "ra8_time.h"
#include "ra8_usb.h"
#include "usb_selftest_dfu_steps.h"
#include "tx_api.h"
#include "ux_api.h"
#include "ux_dcd_ra8_usb.h"
#include "ux_device_class_dfu.h"
#include "ux_device_stack.h"
Include dependency graph for main.c:

Go to the source code of this file.

Typedefs

typedef UINT(* dfu_write_cb_t) (VOID *dfu, ULONG block_number, UCHAR *data, ULONG length, ULONG *media_status)
 Signature of the USBX DFU download-write callback field.

Enumerations

enum  usb_langid_byte_t : uint8_t {
  k_usb_langid_en_us_lo = 0x09U ,
  k_usb_langid_en_us_hi = 0x04U
}

Functions

void _tx_timer_interrupt (void)
 ThreadX 1 ms tick worker.
void SysTick_Handler (void)
 Service the SysTick exception selected by the linked application.
static VOID dfu_activate (VOID *dfu)
 DFU activate callback.
static VOID dfu_deactivate (VOID *dfu)
 DFU deactivate callback.
static UINT dfu_write (VOID *dfu, ULONG block_number, const UCHAR *data, ULONG length, ULONG *media_status)
 DFU write callback – store one downloaded block into the RAM image.
static UINT dfu_read (VOID *dfu, ULONG block_number, UCHAR *data, ULONG length, ULONG *actual_length)
 DFU read callback – serve one block of the RAM image on UPLOAD.
static UINT dfu_get_status (VOID *dfu, ULONG *media_status)
 DFU get-status callback – report the media always ready.
static UINT dfu_notify (VOID *dfu, ULONG notification)
 DFU notify callback – accept begin/end/manifest notifications.
static UINT dfu_usbx_stack_up (void)
 Bring USBX system + device stack up with the DFU framework.
static UINT dfu_class_register (void)
 Register the DFU class against configuration 1, interface 0.
static VOID dfu_device_worker (ULONG arg)
 Device-side worker: bring the DFU device up, then park.
static VOID dfu_host_worker (ULONG arg)
 Host-side worker: retry the full pass until it succeeds, then park.
VOID tx_application_define (VOID *first_unused_memory)
 ThreadX application-define hook.
static void dfu_panic_halt (void)
 Halt forever in WFI – panic stop on init failure.
static void dfu_route_usb_or_halt (void)
 Route both ports' pins: FS as device, HS as host.
static void dfu_setup_or_halt (void)
 Bring CGC + both USB clocks + SysTick + console + LEDs + pins up.
void main (void)
 Application entry: bring the board up, then hand off to ThreadX.

Variables

static volatile bool s_tx_kernel_up = false
 Set in tx_application_define; gates ThreadX tick delivery so a pre-kernel SysTick (the U15 expander I2C blocks for ms during setup) cannot feed ThreadX's zeroed timer state.
static const ra8_port_pin_t k_dfu_pin_fs_vbus = (ra8_port_pin_t)k_ra8_board_usbfs_pin_vbus
 USBFS VBUS sense pin (P4_07, PSEL = 0x13).
static const ra8_port_pin_t k_dfu_pin_fs_vbusen = (ra8_port_pin_t)k_ra8_board_usbfs_pin_vbusen
 USBFS VBUSEN (P5_00) – GPIO LOW for the device role.
static const ra8_port_pin_t k_dfu_pin_fs_dp = (ra8_port_pin_t)k_ra8_board_usbfs_pin_dp
 USBFS D+ (P8_14).
static const ra8_port_pin_t k_dfu_pin_fs_dm = (ra8_port_pin_t)k_ra8_board_usbfs_pin_dm
 USBFS D- (P8_15).
static const ra8_port_pin_t k_dfu_pin_hs_vbus = (ra8_port_pin_t)k_ra8_board_usbhs_pin_vbus
 USBHS_VBUS sense pin (P4_08, PSEL = 0x14).
static const ra8_port_pin_t k_dfu_pin_hs_pwr = (ra8_port_pin_t)k_ra8_board_usbhs_pin_pwr
 J7 host-power switch (PD07): HIGH = U18 supplies VBUS.
static TX_THREAD s_device_thread
 ThreadX TCB for the USBX device-side worker thread.
static UCHAR s_device_stack [k_dfu_thread_stack]
 Stack backing storage for s_device_thread.
static TX_THREAD s_host_thread
 ThreadX TCB for the host-side worker thread.
static UCHAR s_host_stack [k_dfu_host_stack]
 Stack backing storage for s_host_thread.
static UCHAR s_usbx_pool [k_dfu_usbx_pool_bytes]
 USBX memory pool (USBX uses tx_byte_pool internally).
static UCHAR s_dfu_image [k_dfu_image_bytes]
 Device-side RAM "firmware" image: the DFU write callback stores each downloaded block here; the read callback serves it back on upload.
static volatile uint32_t s_dfu_image_len
 Highest byte offset the device has captured (download high-water mark).
static volatile uint32_t s_dbg_dev_writes
 Device-side download block-write count.
static volatile uint32_t s_dbg_dev_step
 Device worker progress: 1 stack, 2 class, 3 dcd, 4 attach.
static volatile uint32_t s_dbg_host_err
 Host-ladder first failing return code (0 = none).
static UCHAR s_device_framework []
static UCHAR s_string_framework []
 USBX string descriptor table (vendor / product / serial).
static UCHAR s_language_id_framework [] = {k_usb_langid_en_us_lo, k_usb_langid_en_us_hi}
 USBX language-id table – US English.

Detailed Description

USB self-loop: HS host DFU-downloads firmware to an FS DFU device, uploads + verifies.

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

Rehearses a firmware-update-over-USB path entirely on-chip. The two USB ports are cabled to EACH OTHER and one image runs both stacks:

  • USBFS (J11) = DEVICE: a ThreadX + USBX DFU class in DFU mode (bInterfaceProtocol 0x02, so it enumerates straight into dfuIDLE – no runtime/detach round-trip). Its write callback captures each downloaded block into a RAM "firmware" image; its read callback serves the image back on UPLOAD. DFU runs entirely over EP0 control transfers (no data endpoints).
  • USBHS (J7) = HOST: a self-contained polled host on the first-party ra8_usb_host_* primitives. It enumerates the device, DFU_DNLOADs a deterministic multi-block image (with DFU_GETSTATUS polling + the zero-length manifest block), then DFU_UPLOADs it back and byte-checks it – proving the control-OUT firmware path round-trips intact.

The download exercises the host control-OUT data stage added to ra8_usb_host_control_xfer for this app (DFU_DNLOAD carries the firmware block in the SETUP data stage host -> device).

Verdicts stream over SCI8 (J-Link OB CDC console, 115200) and are mirrored in J-Link-readable probes (s_dbg_*).

Pinout

FS device: P4_07 VBUS sense, P5_00 VBUSEN GPIO LOW (device role), P8_14 D+, P8_15 D- (PSEL usb_fs). HS host: SW4-8 to Host via the U15 expander, PD07 HIGH (U18 supplies J7 VBUS), P4_08 USBHS_VBUS (PSEL usb_hs). Console: PD_02/ PD_03 SCI8 (PSEL sci_async).

Author
Brighton Sikarskie
Date
2026-06-15
Since
0.1.0

Definition in file main.c.

Typedef Documentation

◆ dfu_write_cb_t

typedef UINT( * dfu_write_cb_t) (VOID *dfu, ULONG block_number, UCHAR *data, ULONG length, ULONG *media_status)

Signature of the USBX DFU download-write callback field.

Mirrors ::UX_SLAVE_CLASS_DFU_PARAMETER::ux_slave_class_dfu_parameter_write, whose vendored prototype takes a non-const UCHAR* payload. Our dfu_write keeps the payload const (it never mutates the block), so the assignment is funnelled through this typedef with a single explicit cast that narrows only the const qualifier of the data pointer – a layout-identical function-pointer conversion.

Note
Used solely at the dfu_class_register assignment site.
Since
0.1.0

Definition at line 478 of file main.c.

Enumeration Type Documentation

◆ usb_langid_byte_t

enum usb_langid_byte_t : uint8_t
Enumerator
k_usb_langid_en_us_lo 

LANGID 0x0409 low byte.

k_usb_langid_en_us_hi 

LANGID 0x0409 high byte.

Definition at line 287 of file main.c.

Function Documentation

◆ _tx_timer_interrupt()

void _tx_timer_interrupt ( void )
extern

ThreadX 1 ms tick worker.

◆ dfu_activate()

VOID dfu_activate ( VOID * dfu)
static

DFU activate callback.

The captured image lives at file scope.

Parameters
[in]dfuUnused (single instance).
Returns
void.
Precondition
Called from the USBX class thread on SET_CONFIGURATION.
The device entered DFU mode (descriptor protocol 0x02).
Postcondition
The device is ready to accept DFU_DNLOAD / DFU_UPLOAD.
No other state changes.
Note
USBX serializes this with deactivate.
Since
0.1.0

Definition at line 310 of file main.c.

Referenced by dfu_class_register().

◆ dfu_class_register()

UINT dfu_class_register ( void )
static

Register the DFU class against configuration 1, interface 0.

Returns
UINT UX_SUCCESS on success, propagated USBX error otherwise.
Return values
UX_SUCCESSClass registered.
Precondition
dfu_usbx_stack_up has succeeded.
The DFU callbacks are defined.
Postcondition
The DFU class is bound; activate fires on SET_CONFIGURATION.
No other class is registered.
Note
Not re-entrant.
Since
0.1.0

Definition at line 492 of file main.c.

References dfu_activate(), dfu_deactivate(), dfu_get_status(), dfu_notify(), dfu_read(), dfu_write(), and s_device_framework.

Referenced by dfu_device_worker().

◆ dfu_deactivate()

VOID dfu_deactivate ( VOID * dfu)
static

DFU deactivate callback.

Parameters
[in]dfuUnused.
Returns
void.
Precondition
Called from the USBX class thread on de-configuration.
The DFU class is being torn down.
Postcondition
No state changes (the captured image is retained for inspection).
Safe to re-activate later.
Note
USBX serializes this with activate.
Since
0.1.0

Definition at line 326 of file main.c.

Referenced by dfu_class_register().

◆ dfu_device_worker()

VOID dfu_device_worker ( ULONG arg)
static

Device-side worker: bring the DFU device up, then park.

Parameters
[in]argThreadX entry argument (unused).
Returns
Never returns.
Precondition
tx_application_define created this thread.
USB-FS pins + 48 MHz clock are up (main did both).
Postcondition
The FS device is attached in DFU mode; the DFU class services EP0.
On any bring-up failure the thread exits (s_dbg_dev_step frozen).
Note
The DFU class runs its own thread; this worker only brings it up.
Since
0.1.0

Definition at line 528 of file main.c.

References dfu_class_register(), dfu_usbx_stack_up(), k_dfu_idle_ticks, k_ra8_ok, k_ra8_usb_speed_fs, ra8_usb_device_attach(), s_dbg_dev_step, s_dbg_host_err, tx_thread_sleep, and ux_dcd_ra8_usb_initialize().

◆ dfu_get_status()

UINT dfu_get_status ( VOID * dfu,
ULONG * media_status )
static

DFU get-status callback – report the media always ready.

Parameters
[in]dfuUnused.
[out]media_statusReceives ::UX_SLAVE_CLASS_DFU_MEDIA_STATUS_OK.
Returns
UINT UX_SUCCESS.
Return values
UX_SUCCESSMedia OK.
Precondition
Called from the USBX class thread on DFU_GETSTATUS.
The RAM image media is always writable.
Postcondition
media_status is OK.
No global state changes.
Note
Single instance.
Since
0.1.0

Definition at line 411 of file main.c.

Referenced by dfu_class_register().

◆ dfu_host_worker()

VOID dfu_host_worker ( ULONG arg)
static

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

Parameters
[in]argThreadX entry argument (unused).
Returns
Never returns.
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 572 of file main.c.

References dfu_host_pass(), k_dfu_boot_wait_ticks, k_dfu_idle_ticks, k_dfu_retry_ticks, k_ra8_ok, s_dbg_host_err, and tx_thread_sleep.

◆ dfu_notify()

UINT dfu_notify ( VOID * dfu,
ULONG notification )
static

DFU notify callback – accept begin/end/manifest notifications.

Parameters
[in]dfuUnused.
[in]notificationThe DFU notification code.
Returns
UINT UX_SUCCESS.
Return values
UX_SUCCESSNotification accepted.
Precondition
Called from the USBX class thread at download/manifest boundaries.
No long-running work is required (RAM image).
Postcondition
The state machine proceeds.
No global state changes.
Note
Single instance.
Since
0.1.0

Definition at line 431 of file main.c.

Referenced by dfu_class_register().

◆ dfu_panic_halt()

void dfu_panic_halt ( void )
static

Halt forever in WFI – panic stop on init failure.

Returns
void.
Precondition
Called only after a fatal boot error.
Interrupts may be in any state.
Postcondition
CPU is parked.
No further code runs.
Note
Not reachable post-boot.
Since
0.1.0

Definition at line 645 of file main.c.

◆ dfu_read()

UINT dfu_read ( VOID * dfu,
ULONG block_number,
UCHAR * data,
ULONG length,
ULONG * actual_length )
static

DFU read callback – serve one block of the RAM image on UPLOAD.

Parameters
[in]dfuUnused.
[in]block_numberDFU block sequence number (byte offset = n * 64).
[out]dataDestination for the block payload.
[in]lengthBytes the host can accept (wTransferSize).
[out]actual_lengthReceives the bytes returned (0 ends the upload).
Returns
UINT UX_SUCCESS.
Return values
UX_SUCCESSBlock (or short/zero end-of-image) returned.
Precondition
data holds length bytes; called from the USBX class thread.
s_dfu_image_len reflects the captured image.
Postcondition
actual_length holds min(remaining, length); a short block ends the upload.
No global state changes.
Note
Single-reader (the USBX DFU thread).
Since
0.1.0

Definition at line 381 of file main.c.

References k_dfu_xfer_size, memcpy(), s_dfu_image, and s_dfu_image_len.

Referenced by dfu_class_register().

◆ dfu_route_usb_or_halt()

void dfu_route_usb_or_halt ( void )
static

Route both ports' pins: FS as device, HS as host.

Returns
void.
Precondition
IOPORT and the U15 expander are reachable.
Called once from dfu_setup_or_halt.
Postcondition
FS pins carry the device role, HS pins the host role, PD07 HIGH.
Panic-halts on any routing failure.
Note
Panic-halts on any routing failure.
Since
0.1.0

Definition at line 662 of file main.c.

References dfu_panic_halt(), k_dfu_pin_fs_dm, k_dfu_pin_fs_dp, k_dfu_pin_fs_vbus, k_dfu_pin_fs_vbusen, k_dfu_pin_hs_pwr, k_dfu_pin_hs_vbus, k_ra8_level_high, k_ra8_level_low, k_ra8_ok, k_ra8_psel_usb_fs, k_ra8_psel_usb_hs, ra8_board_io_expander_set_usbhs_host_mode(), ra8_gpio_output_init(), and ra8_pfs_route_peripheral().

◆ dfu_setup_or_halt()

void dfu_setup_or_halt ( void )
static

Bring CGC + both USB clocks + SysTick + console + LEDs + pins up.

Returns
void.
Precondition
Reset_Handler finished C runtime init.
SystemInit has run.
Postcondition
Console works; both USB ports' pins and clocks are live.
Panic-halts on any failure.
Note
Called once from main.
Since
0.1.0

Definition at line 697 of file main.c.

References dfu_panic_halt(), dfu_route_usb_or_halt(), k_dfu_baud, k_ra8_board_led1, k_ra8_board_led2, k_ra8_clock_id_cpuclk0, k_ra8_ok, ra8_board_led_init(), ra8_board_uart_console_init(), ra8_cgc_get_clock_hz(), ra8_cgc_init(), ra8_cgc_usbfs_clock_enable(), ra8_cgc_usbhs_pll_enable(), and ra8_time_init().

◆ dfu_usbx_stack_up()

UINT dfu_usbx_stack_up ( void )
static

Bring USBX system + device stack up with the DFU framework.

Returns
UINT UX_SUCCESS on success.
Return values
UX_SUCCESSStack ready.
Precondition
File-scope pool reserved; thread context.
The DFU framework is valid.
Postcondition
Device stack accepts class registrations.
On failure USBX state is undefined.
Note
Single-call; not idempotent.
Since
0.1.0

Definition at line 449 of file main.c.

References k_dfu_usbx_pool_bytes, s_device_framework, s_language_id_framework, s_string_framework, and s_usbx_pool.

Referenced by dfu_device_worker().

◆ dfu_write()

UINT dfu_write ( VOID * dfu,
ULONG block_number,
const UCHAR * data,
ULONG length,
ULONG * media_status )
static

DFU write callback – store one downloaded block into the RAM image.

Parameters
[in]dfuUnused.
[in]block_numberDFU block sequence number (byte offset = n * 64).
[in]dataBlock payload from the control-OUT data stage.
[in]lengthBlock length in bytes (0 ends the download).
[out]media_statusReceives ::UX_SLAVE_CLASS_DFU_MEDIA_STATUS_OK.
Returns
UINT UX_SUCCESS on success.
Return values
UX_SUCCESSBlock stored (or zero-length end-of-download accepted).
Precondition
data holds length bytes; called from the USBX class thread.
block_number * 64 + length fits s_dfu_image.
Postcondition
On a non-empty block the bytes are in s_dfu_image and the high-water mark advanced.
media_status is OK so the DFU state machine advances to DNLOAD_IDLE.
Note
Single-writer (the USBX DFU thread).
Since
0.1.0

Definition at line 349 of file main.c.

References k_dfu_xfer_size, memcpy(), s_dbg_dev_writes, s_dfu_image, and s_dfu_image_len.

Referenced by dfu_class_register().

◆ main()

void main ( void )

Application entry: bring the board up, then hand off to ThreadX.

The application entry point Reset_Handler hands control to.

Precondition
Reset_Handler copied .data and zeroed .bss.
SystemInit set VTOR, FPU, priority grouping.
Postcondition
On clean entry the CPU stays in tx_kernel_enter forever.
On any HAL init failure the function halts in WFI.
Note
Single entry point; not re-entrant.
Since
0.1.0

Definition at line 736 of file main.c.

References dfu_panic_halt(), dfu_setup_or_halt(), and ra8_isr_globals_enable().

◆ SysTick_Handler()

void SysTick_Handler ( void )

Service the SysTick exception selected by the linked application.

Service one SysTick event for the core timebase.

Service one SysTick event for the core timebase.

Resolves to the weak core timebase handler unless a strong RTOS or application handler overrides it. The vector table references the selected implementation without owning its subsystem policy.

Precondition
Entered for a SysTick exception with a valid exception frame.
The selected handler's timebase or scheduler state is initialised.
Postcondition
The selected implementation has processed one SysTick event.
The vector table itself remains unchanged.
Note
Runs in handler mode; thread-safety follows the selected implementation.
Since
0.1.0

The weak firmware implementation advances the millisecond counter, then services linked ThreadX and USB hooks when their weak symbols and readiness state permit. The host-test implementation advances only the counter. An application may replace either weak definition with a strong handler.

Precondition
The handler is entered for one SysTick event or a host-test equivalent.
On target, ra8_time_init() configured the SysTick period.
Postcondition
s_tick_ms has advanced by exactly one.
Optional subsystem hooks run only when linked and ready.
Note
IRQ-safe; the weak symbol may be overridden by an application handler.
Since
0.1.0

Service the SysTick exception selected by the linked application.

The weak firmware implementation advances the millisecond counter, then services linked ThreadX and USB hooks when their weak symbols and readiness state permit. The host-test implementation advances only the counter. An application may replace either weak definition with a strong handler.

Precondition
The handler is entered for one SysTick event or a host-test equivalent.
On target, ra8_time_init() configured the SysTick period.
Postcondition
s_tick_ms has advanced by exactly one.
Optional subsystem hooks run only when linked and ready.
Note
IRQ-safe; the weak symbol may be overridden by an application handler.
Since
0.1.0

Service the SysTick exception selected by the linked application.

Precondition
Called from exception context (IPSR == 15).
_tx_initialize_low_level has programmed SysTick.
Postcondition
One ThreadX tick elapsed; PendSV may be pending.

Definition at line 79 of file main.c.

References _tx_timer_interrupt(), ra8_time_on_tick(), s_tx_kernel_up, and ux_dcd_ra8_usb_irq_reenable().

◆ tx_application_define()

VOID tx_application_define ( VOID * first_unused_memory)

ThreadX application-define hook.

Spawns both workers.

Parameters
[in]first_unused_memorySentinel (unused; static stacks).
Returns
void.
Precondition
Called from tx_kernel_enter after scheduler init.
Static stacks are reserved at file scope.
Postcondition
Two auto-start workers are queued; s_tx_kernel_up is true.
The scheduler runs the device DFU bring-up + the host DFU ladder.
Note
Called once at boot; not thread-safe.
Since
0.1.0

Definition at line 601 of file main.c.

References dfu_device_worker(), dfu_host_worker(), k_dfu_dev_priority, k_dfu_host_priority, k_dfu_host_stack, k_dfu_thread_stack, s_device_stack, s_device_thread, s_device_thread_name, s_host_stack, s_host_thread, s_host_thread_name, s_tx_kernel_up, TX_AUTO_START, TX_NO_TIME_SLICE, and tx_thread_create.

Variable Documentation

◆ k_dfu_pin_fs_dm

const ra8_port_pin_t k_dfu_pin_fs_dm = (ra8_port_pin_t)k_ra8_board_usbfs_pin_dm
static

USBFS D- (P8_15).

Definition at line 103 of file main.c.

◆ k_dfu_pin_fs_dp

const ra8_port_pin_t k_dfu_pin_fs_dp = (ra8_port_pin_t)k_ra8_board_usbfs_pin_dp
static

USBFS D+ (P8_14).

Definition at line 100 of file main.c.

◆ k_dfu_pin_fs_vbus

const ra8_port_pin_t k_dfu_pin_fs_vbus = (ra8_port_pin_t)k_ra8_board_usbfs_pin_vbus
static

USBFS VBUS sense pin (P4_07, PSEL = 0x13).

Definition at line 94 of file main.c.

◆ k_dfu_pin_fs_vbusen

const ra8_port_pin_t k_dfu_pin_fs_vbusen = (ra8_port_pin_t)k_ra8_board_usbfs_pin_vbusen
static

USBFS VBUSEN (P5_00) – GPIO LOW for the device role.

Definition at line 97 of file main.c.

◆ k_dfu_pin_hs_pwr

const ra8_port_pin_t k_dfu_pin_hs_pwr = (ra8_port_pin_t)k_ra8_board_usbhs_pin_pwr
static

J7 host-power switch (PD07): HIGH = U18 supplies VBUS.

Definition at line 109 of file main.c.

◆ k_dfu_pin_hs_vbus

const ra8_port_pin_t k_dfu_pin_hs_vbus = (ra8_port_pin_t)k_ra8_board_usbhs_pin_vbus
static

USBHS_VBUS sense pin (P4_08, PSEL = 0x14).

Definition at line 106 of file main.c.

◆ s_dbg_dev_step

volatile uint32_t s_dbg_dev_step
static

Device worker progress: 1 stack, 2 class, 3 dcd, 4 attach.

Definition at line 162 of file main.c.

◆ s_dbg_dev_writes

volatile uint32_t s_dbg_dev_writes
static

Device-side download block-write count.

Definition at line 160 of file main.c.

◆ s_dbg_host_err

volatile uint32_t s_dbg_host_err
static

Host-ladder first failing return code (0 = none).

Definition at line 164 of file main.c.

◆ s_device_framework

UCHAR s_device_framework[]
static

Definition at line 175 of file main.c.

◆ s_device_stack

UCHAR s_device_stack[k_dfu_thread_stack]
static

Stack backing storage for s_device_thread.

Definition at line 127 of file main.c.

◆ s_device_thread

TX_THREAD s_device_thread
static

ThreadX TCB for the USBX device-side worker thread.

Definition at line 125 of file main.c.

◆ s_dfu_image

UCHAR s_dfu_image[k_dfu_image_bytes]
static

Device-side RAM "firmware" image: the DFU write callback stores each downloaded block here; the read callback serves it back on upload.

Note
Written by the USBX DFU class thread; read by the same on upload.
Since
0.1.0

Definition at line 142 of file main.c.

◆ s_dfu_image_len

volatile uint32_t s_dfu_image_len
static

Highest byte offset the device has captured (download high-water mark).

Since
0.1.0

Definition at line 149 of file main.c.

◆ s_host_stack

UCHAR s_host_stack[k_dfu_host_stack]
static

Stack backing storage for s_host_thread.

Definition at line 131 of file main.c.

◆ s_host_thread

TX_THREAD s_host_thread
static

ThreadX TCB for the host-side worker thread.

Definition at line 129 of file main.c.

◆ s_language_id_framework

UCHAR s_language_id_framework[] = {k_usb_langid_en_us_lo, k_usb_langid_en_us_hi}
static

USBX language-id table – US English.

Definition at line 293 of file main.c.

◆ s_string_framework

UCHAR s_string_framework[]
static

USBX string descriptor table (vendor / product / serial).

Since
0.1.0

Definition at line 233 of file main.c.

◆ s_tx_kernel_up

volatile bool s_tx_kernel_up = false
static

Set in tx_application_define; gates ThreadX tick delivery so a pre-kernel SysTick (the U15 expander I2C blocks for ms during setup) cannot feed ThreadX's zeroed timer state.

Since
0.1.0

Definition at line 76 of file main.c.

◆ s_usbx_pool

UCHAR s_usbx_pool[k_dfu_usbx_pool_bytes]
static

USBX memory pool (USBX uses tx_byte_pool internally).

Definition at line 133 of file main.c.