|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
Native USB host-side HID class layer implementation. More...
#include "ra8_usb_hhid.h"#include <stdint.h>#include "ra8_attributes.h"#include "ra8_check.h"#include "ra8_err.h"#include "ra8_log.h"#include "ra8_usb.h"#include "ra8_usb_regs.h"Go to the source code of this file.
Data Structures | |
| struct | ra8_usb_hhid_state_t |
| Singleton shadow state for the host-HID driver. More... | |
Functions | |
| static uint16_t | internal_intr_max_packet (ra8_usb_speed_t speed) |
| Pick the interrupt-max-packet ceiling for the negotiated speed. | |
| static ra8_err_t | internal_configure_pipes (void) |
| Configure the host-HID interrupt-IN pipe against the attached device's endpoint. | |
| static ra8_err_t | internal_setup_get_descriptor (uint8_t desc_type, uint16_t length) |
| Stage a chapter-9 GET_DESCRIPTOR SETUP request. | |
| static ra8_err_t | internal_setup_set_address (uint8_t address) |
| Stage a SET_ADDRESS SETUP request. | |
| static ra8_err_t | internal_setup_set_config (uint8_t config_value) |
| Stage a SET_CONFIGURATION SETUP request. | |
| static ra8_err_t | internal_setup_set_interface (void) |
| Stage a SET_INTERFACE (alt 0, iface 0) SETUP request. | |
| static ra8_err_t | internal_setup_get_report_descriptor (uint16_t length) |
| Stage a GET_DESCRIPTOR (Report descriptor) SETUP request. | |
| static void | internal_walk_config_descriptor (void) |
| Populate s_state.device with stub descriptor data. | |
| static ra8_err_t | internal_do_idle (void) |
| Step handler – bus-reset assert. | |
| static ra8_err_t | internal_do_bus_reset (void) |
| Step handler – bus-reset release + SETUP for SET_ADDRESS. | |
| static ra8_err_t | internal_do_set_address (void) |
| Step handler – store assigned address + SETUP for GET_DEVICE_DESCRIPTOR. | |
| static ra8_err_t | internal_do_get_dev_desc (void) |
| Step handler – SETUP for GET_CONFIGURATION_DESCRIPTOR. | |
| static ra8_err_t | internal_do_get_cfg_desc (void) |
| Step handler – SETUP for SET_CONFIGURATION. | |
| static ra8_err_t | internal_do_set_config (void) |
| Step handler – SETUP for SET_INTERFACE. | |
| static ra8_err_t | internal_do_set_interface (void) |
| Step handler – pure software descriptor walk. | |
| static ra8_err_t | internal_do_walk_desc (void) |
| Step handler – configure pipes + SETUP GET_DESCRIPTOR(Report). | |
| static ra8_err_t | internal_do_get_report_desc (void) |
| Step handler – finalise + fire attach callback. | |
| static ra8_err_t | internal_step_advance (void) |
| Drive the enumeration step machine forward by one step. | |
| static bool | internal_report_type_ok (ra8_usb_hhid_report_type_t t) |
| Validate that a ra8_usb_hhid_report_type_t value is in range. | |
| ra8_err_t | ra8_usb_hhid_init (ra8_usb_speed_t speed) |
| Bring up the host-HID driver on a chosen USB controller. | |
| ra8_err_t | ra8_usb_hhid_close (void) |
| Tear down the host-HID driver and release the controller. | |
| ra8_err_t | ra8_usb_hhid_attach_callback (ra8_usb_hhid_attach_fn_t on_attach, void *ctx) |
| Register (or detach) the attach callback. | |
| static volatile r_usb_regs_t * | internal_pick_regs (ra8_usb_speed_t speed) |
| Pick the controller register window for the active speed. | |
| static uint16_t | internal_dcp_in_drain (volatile r_usb_regs_t *reg, uint8_t *out, uint16_t max_len) |
| Drain the DCP (EP0) IN FIFO after a class GET_REPORT SETUP. | |
| ra8_err_t | ra8_usb_hhid_get_report (ra8_usb_hhid_report_type_t target_report_type, uint8_t target_report_id, uint8_t *out_buf, uint16_t max_len, uint16_t *got_len) |
| Issue GET_REPORT (USB HID 1.11 sec 7.2.1) over the DCP. | |
| ra8_err_t | ra8_usb_hhid_set_report (ra8_usb_hhid_report_type_t target_report_type, uint8_t target_report_id, const uint8_t *in_buf, uint16_t len) |
| Issue SET_REPORT (USB HID 1.11 sec 7.2.2) over the DCP. | |
| ra8_err_t | ra8_usb_hhid_set_idle (uint8_t duration, uint8_t report_id) |
| Issue SET_IDLE (USB HID 1.11 sec 7.2.4) over the DCP. | |
| ra8_err_t | ra8_usb_hhid_set_protocol (ra8_usb_hhid_protocol_select_t boot_or_report) |
| Issue SET_PROTOCOL (USB HID 1.11 sec 7.2.6) over the DCP. | |
| ra8_err_t | ra8_usb_hhid_get_input_report (uint8_t *out_buf, uint16_t max_len, uint16_t *got_len) |
| Drain the next input report from the interrupt-IN pipe. | |
| ra8_err_t | ra8_usb_hhid_step (void) |
| Drive the enumeration step machine forward by one step. | |
Variables | |
| static const char * | s_tag = "USBHHID" |
| static ra8_usb_hhid_state_t | s_state = {} |
Native USB host-side HID class layer implementation.
Glues the host-mode bring-up paths in ra8_usb to a USB HID peripheral - keyboard, mouse, gamepad - attached on the EK-RA8D2's USB-host port. This file is the native host-HID class layer; FSP's r_usb_hhid_driver.c and r_usb_hhid.c are reference material only – nothing is pulled in verbatim.
Mapping vs FSP (FSP function -> our entry point):
The starter does CPU-FIFO, single-device, no-hub. Enumeration is driven step-by-step from the controller's CTRT interrupt path (production) or directly via ra8_usb_hhid_step (tests). Each step issues exactly one chapter-9 SETUP request via ra8_usb_host_setup_request; the next CTRT advances the step.
Definition in file ra8_usb_hhid.c.
| enum ra8_usb_hhid_byte_shift_t : uint8_t |
Per-byte left-shift constants for wValue layout.
| Enumerator | |
|---|---|
| k_ra8_hhid_shift_byte0 | RA8 hhid shift byte0. |
| k_ra8_hhid_shift_byte1 | RA8 hhid shift byte1. |
Definition at line 118 of file ra8_usb_hhid.c.
| enum ra8_usb_hhid_dcp_t : uint16_t |
CFIFO programming constants used by the EP0 IN drain helper.
| Enumerator | |
|---|---|
| k_ra8_hhid_dcp_pipe_dcp | DCP / EP0 select. |
| k_ra8_hhid_fifo_poll_lim | FRDY-poll budget. |
Definition at line 719 of file ra8_usb_hhid.c.
| enum ra8_usb_hhid_setup_field_t : uint8_t |
Standard chapter-9 + HID class request encodings.
Definition at line 80 of file ra8_usb_hhid.c.
| enum ra8_usb_hhid_size_t : uint16_t |
Standard descriptor sizes and request payload sizes.
Definition at line 104 of file ra8_usb_hhid.c.
| enum ra8_usb_hhid_step_t : uint8_t |
Enumeration step machine states.
Mirrors FSP's host-HID enumeration sequence in r_usb_hhid_driver.c. Each step issues exactly one SETUP via ra8_usb_host_setup_request; the next CTRT interrupt advances.
Definition at line 63 of file ra8_usb_hhid.c.
|
static |
Configure the host-HID interrupt-IN pipe against the attached device's endpoint.
Mirrors FSP's usb_hhid_pipe_info. Only PIPE6 is mandatory (interrupt-IN). PIPE7 (interrupt-OUT) is configured only if the attached device advertises one.
| k_ra8_ok | Operation succeeded. |
Definition at line 191 of file ra8_usb_hhid.c.
References k_ra8_hhid_pipe_intr_in, k_ra8_hhid_pipe_intr_out, k_ra8_usb_ep_dir_in, k_ra8_usb_ep_dir_out, k_ra8_usb_ep_type_intr, RA8_RETURN_ON_ERROR, ra8_usb_configure_endpoint(), s_state, and s_tag.
Referenced by internal_do_walk_desc().
|
static |
Drain the DCP (EP0) IN FIFO after a class GET_REPORT SETUP.
Mirrors the FIFO-read path inside ra8_usb_queue_out but targets pipe 0 (the DCP), which the public API rejects.
Flow:
out, capped at max_len.See HUM Ch 36.2.5 "CFIFO" p 1973 and Ch 36.2.8 "CFIFOCTR" p 1979.
| [in] | reg | See implementation. |
| [in] | out | See implementation. |
| [in] | max_len | See implementation. |
| k_ra8_ok | Operation succeeded. |
< Byte bits.
< Byte mask.
Definition at line 768 of file ra8_usb_hhid.c.
References r_usb_regs_t::CFIFO, r_usb_regs_t::CFIFOCTR, r_usb_regs_t::CFIFOSEL, k_byte_bits, k_byte_mask, k_ra8_fifoctr_bclr, k_ra8_fifoctr_dtln, k_ra8_fifoctr_frdy, k_ra8_fifosel_curpipe, k_ra8_fifosel_isel, k_ra8_fifosel_mbw_16, k_ra8_hhid_dcp_pipe_dcp, and k_ra8_hhid_fifo_poll_lim.
Referenced by ra8_usb_hhid_get_report().
|
static |
Step handler – bus-reset release + SETUP for SET_ADDRESS.
See implementation.
| k_ra8_ok | Operation succeeded. |
Definition at line 424 of file ra8_usb_hhid.c.
References internal_setup_set_address(), k_ra8_hhid_assigned_address, k_ra8_hhid_step_set_address, RA8_RETURN_ON_ERROR, ra8_usb_host_bus_reset(), s_state, and s_tag.
Referenced by internal_step_advance().
|
static |
Step handler – SETUP for SET_CONFIGURATION.
See implementation.
| k_ra8_ok | Operation succeeded. |
Definition at line 493 of file ra8_usb_hhid.c.
References internal_setup_set_config(), k_ra8_hhid_default_config, k_ra8_hhid_step_set_config, and s_state.
Referenced by internal_step_advance().
|
static |
Step handler – SETUP for GET_CONFIGURATION_DESCRIPTOR.
See implementation.
| k_ra8_ok | Operation succeeded. |
Definition at line 473 of file ra8_usb_hhid.c.
References internal_setup_get_descriptor(), k_ra8_hhid_cfg_desc_len, k_ra8_hhid_desc_configuration, k_ra8_hhid_step_get_cfg_desc, and s_state.
Referenced by internal_step_advance().
|
static |
Step handler – finalise + fire attach callback.
See implementation.
| k_ra8_ok | Operation succeeded. |
Definition at line 576 of file ra8_usb_hhid.c.
References k_ra8_hhid_step_done, k_ra8_ok, and s_state.
Referenced by internal_step_advance().
|
static |
Step handler – bus-reset assert.
See implementation.
| k_ra8_ok | Operation succeeded. |
Definition at line 404 of file ra8_usb_hhid.c.
References k_ra8_hhid_step_bus_reset, ra8_usb_host_bus_reset(), and s_state.
Referenced by internal_step_advance().
|
static |
Step handler – store assigned address + SETUP for GET_DEVICE_DESCRIPTOR.
See implementation.
| k_ra8_ok | Operation succeeded. |
Definition at line 449 of file ra8_usb_hhid.c.
References internal_setup_get_descriptor(), k_ra8_hhid_assigned_address, k_ra8_hhid_desc_device, k_ra8_hhid_dev_desc_len, k_ra8_hhid_step_get_dev_desc, RA8_RETURN_ON_ERROR, ra8_usb_set_address(), s_state, and s_tag.
Referenced by internal_step_advance().
|
static |
Step handler – SETUP for SET_INTERFACE.
See implementation.
| k_ra8_ok | Operation succeeded. |
Definition at line 513 of file ra8_usb_hhid.c.
References internal_setup_set_interface(), k_ra8_hhid_step_set_interface, and s_state.
Referenced by internal_step_advance().
|
static |
Step handler – pure software descriptor walk.
See implementation.
| k_ra8_ok | Operation succeeded. |
Definition at line 533 of file ra8_usb_hhid.c.
References internal_walk_config_descriptor(), k_ra8_hhid_step_walk_desc, k_ra8_ok, and s_state.
Referenced by internal_step_advance().
|
static |
Step handler – configure pipes + SETUP GET_DESCRIPTOR(Report).
See implementation.
| k_ra8_ok | Operation succeeded. |
Definition at line 554 of file ra8_usb_hhid.c.
References internal_configure_pipes(), internal_setup_get_report_descriptor(), k_ra8_hhid_report_desc_max, k_ra8_hhid_step_get_report_desc, RA8_RETURN_ON_ERROR, s_state, and s_tag.
Referenced by internal_step_advance().
|
static |
Pick the interrupt-max-packet ceiling for the negotiated speed.
Selects the USBHS ceiling for HS and the USBFS ceiling otherwise.
| [in] | speed | Negotiated controller speed. |
| k_ra8_hhid_intr_max_packet_hs | HS controller ceiling. |
| k_ra8_hhid_intr_max_packet_default | FS controller ceiling. |
Definition at line 167 of file ra8_usb_hhid.c.
References k_ra8_hhid_intr_max_packet_default, k_ra8_hhid_intr_max_packet_hs, and k_ra8_usb_speed_hs.
Referenced by internal_walk_config_descriptor().
|
static |
Pick the controller register window for the active speed.
Definition at line 728 of file ra8_usb_hhid.c.
References k_ra8_usb_speed_fs, k_ra8_usb_speed_hs, ra8_usb_fs(), and ra8_usb_hs().
Referenced by ra8_usb_hhid_get_report().
|
static |
Validate that a ra8_usb_hhid_report_type_t value is in range.
See implementation.
| [in] | t | See implementation. |
| k_ra8_ok | Operation succeeded. |
Definition at line 645 of file ra8_usb_hhid.c.
References k_ra8_hhid_report_type_feature, k_ra8_hhid_report_type_input, and k_ra8_hhid_report_type_output.
Referenced by ra8_usb_hhid_get_report(), and ra8_usb_hhid_set_report().
|
static |
Stage a chapter-9 GET_DESCRIPTOR SETUP request.
See implementation.
| [in] | desc_type | See implementation. |
| [in] | length | See implementation. |
| k_ra8_ok | Operation succeeded. |
Definition at line 228 of file ra8_usb_hhid.c.
References k_ra8_hhid_bm_std_dev_in, k_ra8_hhid_breq_get_descriptor, k_ra8_hhid_shift_byte1, ra8_usb_host_setup_request(), and s_state.
Referenced by internal_do_get_dev_desc(), and internal_do_set_address().
|
static |
Stage a GET_DESCRIPTOR (Report descriptor) SETUP request.
Per USB HID 1.11 sec 7.1.1 the host fetches the HID Report descriptor with bmRequestType = 0x81 (Std | Interface | In), bRequest = 0x06 (GET_DESCRIPTOR), wValue high byte = 0x22 (Report descriptor type).
| [in] | length | See implementation. |
| k_ra8_ok | Operation succeeded. |
Definition at line 339 of file ra8_usb_hhid.c.
References k_ra8_hhid_bm_std_iface_in, k_ra8_hhid_breq_get_descriptor, k_ra8_hhid_desc_report, k_ra8_hhid_shift_byte1, ra8_usb_host_setup_request(), and s_state.
Referenced by internal_do_walk_desc().
|
static |
Stage a SET_ADDRESS SETUP request.
See implementation.
| [in] | address | See implementation. |
| k_ra8_ok | Operation succeeded. |
Definition at line 255 of file ra8_usb_hhid.c.
References k_ra8_hhid_bm_std_dev_out, k_ra8_hhid_breq_set_address, ra8_usb_host_setup_request(), and s_state.
Referenced by internal_do_bus_reset().
|
static |
Stage a SET_CONFIGURATION SETUP request.
See implementation.
| [in] | config_value | See implementation. |
| k_ra8_ok | Operation succeeded. |
Definition at line 282 of file ra8_usb_hhid.c.
References k_ra8_hhid_bm_std_dev_out, k_ra8_hhid_breq_set_config, ra8_usb_host_setup_request(), and s_state.
Referenced by internal_do_get_cfg_desc().
|
static |
Stage a SET_INTERFACE (alt 0, iface 0) SETUP request.
See implementation.
| k_ra8_ok | Operation succeeded. |
Definition at line 308 of file ra8_usb_hhid.c.
References k_ra8_hhid_bm_std_iface_out, k_ra8_hhid_breq_set_interface, ra8_usb_host_setup_request(), and s_state.
Referenced by internal_do_set_config().
|
static |
Drive the enumeration step machine forward by one step.
Invoked from ra8_usb_hhid_step (tests) or from the CTRT branch of ra8_usb_dispatch (production). Each call advances the step counter by one and dispatches to the appropriate handler.
| k_ra8_ok | Operation succeeded. |
Definition at line 603 of file ra8_usb_hhid.c.
References internal_do_bus_reset(), internal_do_get_cfg_desc(), internal_do_get_dev_desc(), internal_do_get_report_desc(), internal_do_idle(), internal_do_set_address(), internal_do_set_config(), internal_do_set_interface(), internal_do_walk_desc(), k_ra8_hhid_step_bus_reset, k_ra8_hhid_step_get_cfg_desc, k_ra8_hhid_step_get_dev_desc, k_ra8_hhid_step_get_report_desc, k_ra8_hhid_step_idle, k_ra8_hhid_step_set_address, k_ra8_hhid_step_set_config, k_ra8_hhid_step_set_interface, k_ra8_hhid_step_walk_desc, k_ra8_ok, and s_state.
Referenced by ra8_usb_hhid_step().
|
static |
Populate s_state.device with stub descriptor data.
In production this routine walks the configuration descriptor returned in the GET_CONFIG_DESCRIPTOR data stage and picks out the HID interface (class=0x03), its interrupt-IN endpoint, the optional interrupt-OUT endpoint, and the embedded HID class descriptor (descriptor type 0x21). The starter relies on the fact that a single boot-protocol HID device (keyboard or mouse) follows a near-universal layout: interrupt-IN at EP address 1, no interrupt- OUT, single interface 0, subclass 1 (boot), protocol 1 (kb) or 2 (mouse). If the attached device deviates, the production path will overwrite these defaults during the descriptor walk.
Definition at line 373 of file ra8_usb_hhid.c.
References internal_intr_max_packet(), k_ra8_hhid_assigned_address, k_ra8_hhid_protocol_keyboard, k_ra8_hhid_subclass_boot, and s_state.
Referenced by internal_do_set_interface().
|
nodiscard |
Register (or detach) the attach callback.
The supplied callback fires exactly once per attach event, after the descriptor walk identifies an HID interface (class=0x03) and the matching interrupt-IN endpoint and HID class descriptor are cached. Pass NULL to detach.
| [in] | on_attach | Callback. NULL detaches. |
| [in] | ctx | Context pointer threaded back into on_attach. |
| k_ra8_ok | Callback installed. |
| k_ra8_err_invalid_state | Driver was never initialized. |
Definition at line 700 of file ra8_usb_hhid.c.
References k_ra8_err_invalid_state, k_ra8_ok, and s_state.
|
nodiscard |
Tear down the host-HID driver and release the controller.
| k_ra8_ok | Released. |
| k_ra8_err_invalid_state | Driver was never initialized. |
Definition at line 679 of file ra8_usb_hhid.c.
References k_ra8_err_invalid_state, k_ra8_hhid_step_idle, ra8_usb_host_deinit(), ra8_usb_host_set_uact(), and s_state.
|
nodiscard |
Drain the next input report from the interrupt-IN pipe.
Polling / non-blocking. Pulls bytes from the configured PIPE6 (interrupt IN) into out_buf. Returns k_ra8_err_no_data if the pipe has no bytes ready.
| [out] | out_buf | Destination buffer. |
| [in] | max_len | Capacity of out_buf, > 0. |
| [out] | got_len | Receives the number of bytes actually placed. |
| k_ra8_ok | Bytes drained; *got_len reflects the count. |
| k_ra8_err_no_data | Pipe was empty. |
| k_ra8_err_null_ptr | out_buf or got_len was NULL. |
| k_ra8_err_invalid_state | Driver not initialized, or no device attached. |
| k_ra8_err_invalid_arg | max_len == 0. |
Definition at line 961 of file ra8_usb_hhid.c.
References k_ra8_err_invalid_arg, k_ra8_err_invalid_state, k_ra8_hhid_pipe_intr_in, k_ra8_ok, RA8_CHECK_NULL_PTR, ra8_usb_queue_out(), s_state, and s_tag.
|
nodiscard |
Issue GET_REPORT (USB HID 1.11 sec 7.2.1) over the DCP.
Builds an 8-byte SETUP packet with bmRequestType = 0xA1 (Class | Interface | Device-to-Host), bRequest = 0x01 (GET_REPORT), and wValue = (report_type << 8) | report_id. Hands it to ra8_usb_host_setup_request; the controller drives the data + status stages.
| [in] | target_report_type | Input / Output / Feature. |
| [in] | target_report_id | Report ID (0 if the device uses a single unnamed report). |
| [out] | out_buf | Destination buffer for the report payload. |
| [in] | max_len | Capacity of out_buf, > 0. |
| [out] | got_len | Receives the number of bytes actually received. |
| k_ra8_ok | Control transfer queued; on completion *got_len reflects the count. |
| k_ra8_err_null_ptr | out_buf or got_len was NULL. |
| k_ra8_err_invalid_state | Driver not initialized, or no device attached. |
| k_ra8_err_invalid_arg | Bogus target_report_type or max_len == 0. |
| k_ra8_err_busy | Controller busy with a prior SETUP. |
Definition at line 820 of file ra8_usb_hhid.c.
References internal_dcp_in_drain(), internal_pick_regs(), internal_report_type_ok(), k_ra8_err_invalid_arg, k_ra8_err_invalid_state, k_ra8_hhid_bm_class_iface_in, k_ra8_hhid_req_get_report, k_ra8_hhid_shift_byte1, k_ra8_ok, RA8_CHECK_NULL_PTR, ra8_usb_host_setup_request(), s_state, and s_tag.
|
nodiscard |
Bring up the host-HID driver on a chosen USB controller.
Initialises the underlying ra8_usb driver in HOST mode for speed, leaves the bus in the "wait for attach" state (UACT cleared), and arms the internal enumeration step machine.
| [in] | speed | Which USB controller (FS or HS). |
| k_ra8_ok | Host-HID ready, awaiting attach. |
| k_ra8_err_invalid_arg | speed out of range. |
| k_ra8_err_hw_init_failed | Underlying ra8_usb_host_init failed. |
Definition at line 656 of file ra8_usb_hhid.c.
References k_ra8_err_hw_init_failed, k_ra8_err_invalid_arg, k_ra8_hhid_step_idle, k_ra8_ok, k_ra8_usb_speed_fs, k_ra8_usb_speed_hs, ra8_log_error_val, ra8_log_info_val, ra8_usb_host_init(), s_state, and s_tag.
|
nodiscard |
Issue SET_IDLE (USB HID 1.11 sec 7.2.4) over the DCP.
Tells the device how often to silently re-send an unchanged input report. duration is in 4 ms units (0 = "only report on change"). Builds bmRequestType = 0x21, bRequest = 0x0A, wValue = (duration << 8) | report_id.
| [in] | duration | Idle rate, in 4 ms ticks (0..255). |
| [in] | report_id | Report ID, or 0 for "all reports". |
| k_ra8_ok | Control transfer queued. |
| k_ra8_err_invalid_state | Driver not initialized, or no device attached. |
| k_ra8_err_busy | Controller busy with a prior SETUP. |
Definition at line 910 of file ra8_usb_hhid.c.
References k_ra8_err_invalid_state, k_ra8_hhid_bm_class_iface_out, k_ra8_hhid_req_set_idle, k_ra8_hhid_shift_byte1, ra8_usb_host_setup_request(), and s_state.
|
nodiscard |
Issue SET_PROTOCOL (USB HID 1.11 sec 7.2.6) over the DCP.
Switches the device between boot protocol (wValue = 0) and report protocol (wValue = 1). Builds bmRequestType = 0x21, bRequest = 0x0B.
| [in] | boot_or_report | Boot or report protocol selector. |
| k_ra8_ok | Control transfer queued. |
| k_ra8_err_invalid_state | Driver not initialized, or no device attached. |
| k_ra8_err_invalid_arg | boot_or_report out of range. |
| k_ra8_err_busy | Controller busy with a prior SETUP. |
Definition at line 935 of file ra8_usb_hhid.c.
References k_ra8_err_invalid_arg, k_ra8_err_invalid_state, k_ra8_hhid_bm_class_iface_out, k_ra8_hhid_proto_boot, k_ra8_hhid_proto_report, k_ra8_hhid_req_set_protocol, ra8_usb_host_setup_request(), and s_state.
|
nodiscard |
Issue SET_REPORT (USB HID 1.11 sec 7.2.2) over the DCP.
Builds an 8-byte SETUP packet with bmRequestType = 0x21 (Class | Interface | Host-to-Device), bRequest = 0x09 (SET_REPORT), and wValue = (report_type << 8) | report_id. The data stage payload is in_buf[0..len-1].
| [in] | target_report_type | Input / Output / Feature. |
| [in] | target_report_id | Report ID. |
| [in] | in_buf | Report payload. |
| [in] | len | Payload length. |
| k_ra8_ok | Control transfer queued. |
| k_ra8_err_null_ptr | in_buf was NULL with non-zero len. |
| k_ra8_err_invalid_state | Driver not initialized, or no device attached. |
| k_ra8_err_invalid_arg | Bogus target_report_type. |
| k_ra8_err_busy | Controller busy with a prior SETUP. |
Definition at line 870 of file ra8_usb_hhid.c.
References internal_report_type_ok(), k_ra8_err_invalid_arg, k_ra8_err_invalid_state, k_ra8_err_null_ptr, k_ra8_hhid_bm_class_iface_out, k_ra8_hhid_req_set_report, k_ra8_hhid_shift_byte1, ra8_usb_host_setup_request(), and s_state.
|
nodiscard |
Drive the enumeration step machine forward by one step.
Test / debug entry point. The production path drives this from the ra8_usb_dispatch callback when the controller fires a CTRT or BRDY interrupt; tests call it directly to walk the state machine deterministically.
| k_ra8_ok | Step advanced. |
| k_ra8_err_invalid_state | Driver not initialized. |
Definition at line 990 of file ra8_usb_hhid.c.
References internal_step_advance(), k_ra8_err_invalid_state, and s_state.
|
static |
Definition at line 146 of file ra8_usb_hhid.c.
|
static |
Definition at line 48 of file ra8_usb_hhid.c.