ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
ra8_usb_composite.h
Go to the documentation of this file.
1
56
57#pragma once
58
59#ifdef __cplusplus
60extern "C" {
61#endif
62
63#include <stdint.h>
64
65#include "ra8_err.h"
66#include "ra8_usb.h"
67
68/* =============================================================================
69 * Constants
70 * =============================================================================
71 */
72
87
104
105/* =============================================================================
106 * Class-layer interface
107 * =============================================================================
108 */
109
119
129typedef ra8_err_t (*ra8_usb_composite_setup_fn_t)(void* ctx, const ra8_usb_setup_t* setup);
130
140
180
181/* =============================================================================
182 * Lifecycle
183 * =============================================================================
184 */
185
218
240[[nodiscard]] ra8_err_t ra8_usb_composite_close(void);
241
242/* =============================================================================
243 * Class registration
244 * =============================================================================
245 */
246
287[[nodiscard]] ra8_err_t
289
290/* =============================================================================
291 * Descriptors
292 * =============================================================================
293 */
294
326[[nodiscard]] ra8_err_t ra8_usb_composite_set_descriptors(const uint8_t* device_desc,
327 const uint8_t* config_desc);
328
329/* =============================================================================
330 * Dispatch
331 * =============================================================================
332 */
333
362[[nodiscard]] ra8_err_t ra8_usb_composite_step(void);
363
364/* =============================================================================
365 * Test / introspection helpers
366 * =============================================================================
367 */
368
403 uint8_t* out_handler_class);
404
422[[nodiscard]] ra8_err_t ra8_usb_composite_get_class_count(uint8_t* out_count);
423
442[[nodiscard]] ra8_err_t ra8_usb_composite_get_device_descriptor(const uint8_t** out_desc);
443
463[[nodiscard]] ra8_err_t ra8_usb_composite_get_config_descriptor(const uint8_t** out_desc);
464
465#ifdef __cplusplus
466}
467#endif
Error Code Definitions for ra8-firmware.
ra8_err_codes_t ra8_err_t
Canonical error-return type used by every ra8-firmware API.
Definition ra8_err.h:546
Native USB controller driver public API (device + host modes).
ra8_err_t(* ra8_usb_composite_init_fn_t)(void *ctx)
Class-layer initialise hook.
ra8_err_t ra8_usb_composite_dispatch_setup(const ra8_usb_setup_t *setup, uint8_t *out_handler_class)
Inject a SETUP packet directly into the dispatch logic.
ra8_err_t ra8_usb_composite_get_class_count(uint8_t *out_count)
Read back the number of currently-registered class layers.
ra8_err_t(* ra8_usb_composite_setup_fn_t)(void *ctx, const ra8_usb_setup_t *setup)
Class-layer SETUP-handler hook.
ra8_err_t ra8_usb_composite_init(ra8_usb_speed_t speed)
Bring up the composite-class driver on a chosen USB controller.
ra8_err_t ra8_usb_composite_step(void)
Drive the composite dispatch state machine forward by one step.
ra8_err_t(* ra8_usb_composite_close_fn_t)(void *ctx)
Class-layer teardown hook.
ra8_usb_composite_limits_t
Static ceilings for the composite registry.
@ k_ra8_usb_composite_max_classes
Registered class ceiling.
@ k_ra8_usb_composite_max_ifs
Highest IF number tracked.
ra8_usb_composite_iad_t
Interface Association Descriptor (IAD) constants.
@ k_ra8_usb_composite_class_misc
Miscellaneous class.
@ k_ra8_usb_composite_descriptor_type_iad
bDescriptorType = IAD.
@ k_ra8_usb_composite_protocol_iad
IAD protocol.
@ k_ra8_usb_composite_subclass_common
Common subclass.
ra8_err_t ra8_usb_composite_get_device_descriptor(const uint8_t **out_desc)
Read back the cached device descriptor pointer.
ra8_err_t ra8_usb_composite_set_descriptors(const uint8_t *device_desc, const uint8_t *config_desc)
Cache caller-owned device + configuration descriptor pointers.
ra8_err_t ra8_usb_composite_get_config_descriptor(const uint8_t **out_desc)
Read back the cached configuration descriptor pointer.
ra8_err_t ra8_usb_composite_close(void)
Tear down the composite-class driver and release the controller.
ra8_err_t ra8_usb_composite_register_class(const ra8_usb_composite_class_t *class_layer)
Register a single class layer with the composite driver.
ra8_usb_speed_t
Selects which controller instance the call targets.
Caller-owned class-layer registration record.
ra8_usb_composite_setup_fn_t handle_setup
setup callback (non-NULL).
uint8_t interface_number_count
IF count (CDC=2, HID=1...).
ra8_usb_composite_init_fn_t init
init callback (non-NULL).
void * ctx
Opaque context.
uint8_t interface_number_first
First IF this class owns.
ra8_usb_composite_close_fn_t close
close callback (non-NULL).
Decoded 8-byte USB SETUP packet.