94#include "ux_device_class_hid.h"
95#include "ux_device_stack.h"
128typedef enum : uint32_t {
141typedef enum : uint8_t {
156typedef enum : int8_t {
166typedef enum : uint8_t {
174#ifndef RA8_OFF_TARGET
448typedef enum : uint8_t {
515 hid_event->ux_device_class_hid_event_report_id = 0UL;
516 hid_event->ux_device_class_hid_event_report_type = (
ULONG)UX_DEVICE_CLASS_HID_REPORT_TYPE_INPUT;
585 return _ux_device_stack_initialize((UCHAR*)UX_NULL,
612 UX_SLAVE_CLASS_HID_PARAMETER hid_params = {
616 .ux_device_class_hid_parameter_report_id = 0UL,
618 .ux_device_class_hid_parameter_callback = UX_NULL,
621 static UCHAR s_class_name[] =
"ux_slave_class_hid";
623 return _ux_device_stack_class_register(s_class_name,
624 _ux_device_class_hid_entry,
645 UX_SLAVE_CLASS_HID_EVENT hid_event;
646 (void)
memset(&hid_event, 0,
sizeof(hid_event));
648 hid_event.ux_device_class_hid_event_report_id = 0UL;
649 hid_event.ux_device_class_hid_event_report_type = (
ULONG)UX_DEVICE_CLASS_HID_REPORT_TYPE_INPUT;
652 if (_ux_device_class_hid_event_set(
s_hid_class, &hid_event) == UX_SUCCESS) {
712 (void)first_unused_memory;
742 __asm__
volatile(
"wfi");
791 uint32_t cpuclk0_hz = 0U;
817#ifndef RA8_OFF_TARGET
void main(void)
Secure fallback main entry point.
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]
void tx_application_define(void *first_unused_memory)
ThreadX system-define hook: build worker thread + byte pool.
static UCHAR s_string_framework[]
USBX string descriptor table (vendor / product / serial).
static UCHAR s_usbx_pool[k_wlun_usbx_pool_bytes]
USBX memory pool (USBX uses tx_byte_pool internally).
@ k_usb_langid_en_us_lo
LANGID 0x0409 low byte.
@ k_usb_langid_en_us_hi
LANGID 0x0409 high byte.
static UCHAR s_device_framework_fs[]
static UCHAR s_language_id_framework[]
USBX language-id table – US English.
static void demo_panic_halt(void)
Halt forever in WFI – used as a panic stop on init failure.
static const ra8_port_pin_t k_demo_pin_vbus
USB_FS VBUS pin, packed ra8_port_pin_t.
static ra8_err_t demo_pins_init(void)
Route the four USB-FS pins to the USBFS controller.
static const ra8_port_pin_t k_demo_pin_dp
USB_FS D+ pin, packed ra8_port_pin_t.
static const ra8_port_pin_t k_demo_pin_vbusen
USB_FS VBUSEN pin, packed ra8_port_pin_t.
static const ra8_port_pin_t k_demo_pin_dm
USB_FS D- pin, packed ra8_port_pin_t.
static CHAR s_thread_name[]
static UINT demo_usbx_stack_up(void)
Brings USBX system + device stack up with the FS framework.
@ k_demo_usbx_pool_bytes
USBX pool: 32 KiB; CDC-ACM enum exhausts 16 KiB.
static VOID demo_worker(ULONG arg)
Worker thread entry.
demo_jiggle_t
Per-step cursor delta values for the autonomous jiggle.
@ k_demo_jiggle_zero
No motion on the inactive axis.
@ k_demo_jiggle_neg
Reverse of k_step.
@ k_demo_jiggle_step
Magnitude of each jiggle step.
static void demo_build_jiggle(demo_phase_t phase, UCHAR *report)
Build the boot-mouse report for one phase of the jiggle.
static UINT demo_hid_get_callback(UX_SLAVE_CLASS_HID *hid, UX_SLAVE_CLASS_HID_EVENT *hid_event)
HID GET_REPORT / SET_REPORT control-pipe callback.
volatile uint32_t g_usb_hid_match
HIL liveness counter – incremented on every successful _ux_device_class_hid_event_set (a HID report q...
demo_hid_report_t
Sizing for the boot-protocol mouse input report.
@ k_demo_hid_idx_dy
Byte offset for Y delta.
@ k_demo_hid_idx_dx
Byte offset for X delta.
@ k_demo_hid_report_bytes
Boot mouse report width.
@ k_demo_hid_idx_buttons
Byte offset for buttons.
@ k_demo_jiggle_period_ticks
ThreadX ticks between sends.
static VOID demo_hid_deactivate(VOID *hid_instance)
HID deactivate callback.
volatile uint32_t g_usb_hid_mismatch
HIL failure counter – incremented when _ux_device_class_hid_event_set returns a non-success status (q...
static VOID demo_hid_activate(VOID *hid_instance)
HID activate callback.
static UINT demo_hid_class_register(void)
Registers the HID class with the configured report descriptor.
demo_phase_t
Index into the four-step jiggle pattern.
@ k_demo_phase_count
Modulus.
@ k_demo_phase_left
-X, 0Y.
@ k_demo_phase_down
0X, +Y.
@ k_demo_phase_right
+X, 0Y.
static void demo_jiggle_send(demo_phase_t *phase)
Push a single HID jiggle event in the given phase.
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.
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_led1
LED1, BLUE, P600 (jumper E27).
@ 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).
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.
void * memset(void *dst, int value, size_t n)
Fill memory with a constant byte value.
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.
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.
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_fs
Full-Speed controller (USBFS @ 0x40250000).
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.
static UCHAR s_report_descriptor[]
static UX_SLAVE_CLASS_HID * s_hid_class
Active HID class instance, captured by the activate callback.
USBX device-controller-driver (DCD) bridge to ra8_usb.
ra8_err_t ux_dcd_ra8_usb_initialize(ra8_usb_speed_t speed)
Register the ra8_usb bridge as the active USBX DCD.