ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
ra8_usb_pvnd.h
Go to the documentation of this file.
1
31
32#pragma once
33
34#ifdef __cplusplus
35extern "C" {
36#endif
37
38#include <stdint.h>
39
40#include "ra8_err.h"
41#include "ra8_usb.h"
42
43/* =============================================================================
44 * Constants
45 * =============================================================================
46 */
47
63
72
84
93typedef enum : uint8_t {
96
113
133typedef ra8_err_t (*ra8_usb_pvnd_setup_fn_t)(void* ctx, const ra8_usb_setup_t* setup);
134
135/* =============================================================================
136 * Lifecycle
137 * =============================================================================
138 */
139
167[[nodiscard]] ra8_err_t ra8_usb_pvnd_init(ra8_usb_speed_t speed);
168
184[[nodiscard]] ra8_err_t ra8_usb_pvnd_close(void);
185
186/* =============================================================================
187 * Descriptor handoff
188 * =============================================================================
189 */
190
214[[nodiscard]] ra8_err_t ra8_usb_pvnd_set_descriptors(const uint8_t* desc, uint16_t desc_len);
215
216/* =============================================================================
217 * Vendor data transport
218 * =============================================================================
219 */
220
240[[nodiscard]] ra8_err_t ra8_usb_pvnd_send(const uint8_t* data, uint16_t len);
241
263[[nodiscard]] ra8_err_t ra8_usb_pvnd_recv(uint8_t* buf, uint16_t max_len, uint16_t* got_len);
264
265/* =============================================================================
266 * Setup-handler attach
267 * =============================================================================
268 */
269
292 void* ctx);
293
294/* =============================================================================
295 * Vendor SETUP dispatch
296 * =============================================================================
297 */
298
325[[nodiscard]] ra8_err_t ra8_usb_pvnd_handle_setup(const ra8_usb_setup_t* setup);
326
327#ifdef __cplusplus
328}
329#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_usb_speed_t
Selects which controller instance the call targets.
ra8_err_t(* ra8_usb_pvnd_setup_fn_t)(void *ctx, const ra8_usb_setup_t *setup)
Caller-supplied vendor class-setup handler signature.
ra8_err_t ra8_usb_pvnd_set_descriptors(const uint8_t *desc, uint16_t desc_len)
Install the caller-supplied descriptor blob.
ra8_err_t ra8_usb_pvnd_recv(uint8_t *buf, uint16_t max_len, uint16_t *got_len)
Drain a payload from the vendor bulk-OUT endpoint.
ra8_err_t ra8_usb_pvnd_handle_setup(const ra8_usb_setup_t *setup)
Process a vendor-specific SETUP packet on EP0.
ra8_usb_pvnd_envelope_t
bmRequestType envelopes that are vendor-recipient SETUPs.
@ k_ra8_pvnd_bm_vendor_iface_in
Vendor | Interface | In.
@ k_ra8_pvnd_bm_vendor_ep_out
Vendor | Endpoint | Out.
@ k_ra8_pvnd_bm_vendor_dev_in
Vendor | Device | In.
@ k_ra8_pvnd_bm_vendor_iface_out
Vendor | Interface | Out.
@ k_ra8_pvnd_bm_vendor_dev_out
Vendor | Device | Out.
@ k_ra8_pvnd_bm_vendor_ep_in
Vendor | Endpoint | In.
ra8_err_t ra8_usb_pvnd_init(ra8_usb_speed_t speed)
Bring up the device-Vendor function on a chosen USB controller.
ra8_err_t ra8_usb_pvnd_attach_setup_handler(ra8_usb_pvnd_setup_fn_t setup_fn, void *ctx)
Register the application's vendor setup handler.
ra8_usb_pvnd_pipe_t
PIPE numbers used by the device-Vendor function for the local bulk endpoints.
@ k_ra8_pvnd_pipe_bulk_out
PIPE1 -> EP2 OUT (vendor OUT).
@ k_ra8_pvnd_pipe_bulk_in
PIPE5 -> EP1 IN (vendor IN).
ra8_err_t ra8_usb_pvnd_close(void)
Tear down the device-Vendor function and release the controller.
ra8_usb_pvnd_ep_t
USB endpoint addresses used by the device-Vendor function.
@ k_ra8_pvnd_ep_bulk_in_addr
EP1 IN address.
@ k_ra8_pvnd_ep_bulk_out_addr
EP2 OUT address.
ra8_usb_pvnd_class_t
Class / subclass / protocol triplet that identifies the local Vendor function in the configuration de...
@ k_ra8_pvnd_class_vendor
Vendor-specific interface class.
ra8_err_t ra8_usb_pvnd_send(const uint8_t *data, uint16_t len)
Push a payload on the vendor bulk-IN endpoint.
ra8_usb_pvnd_packet_t
Packet sizing for the bulk endpoints.
@ k_ra8_pvnd_bulk_max_packet_hs
Bulk size at HS.
@ k_ra8_pvnd_bulk_max_packet_fs
Bulk size at FS.
Decoded 8-byte USB SETUP packet.