77typedef enum : uint8_t {
97typedef enum : uint8_t {
108typedef enum : uint8_t {
118typedef enum : uint8_t {
141typedef enum : uint8_t {
299 const uint8_t desc_type = (uint8_t)(setup->
w_value >> 8U);
378 if (setup ==
nullptr) {
417 if (setup ==
nullptr) {
420 const bool is_iface =
425 return is_iface && is_known;
450 if ((out_desc ==
nullptr) || (out_len ==
nullptr)) {
485static inline uint16_t
pv_clamp_len(uint16_t available, uint16_t requested)
487 return (available < requested) ? available : requested;
Native USB controller driver public API (device + host modes).
Decoded 8-byte USB SETUP packet.
uint8_t b_request
bRequest code.
uint8_t bm_request_type
Request direction / type / recipient.
static pv_action_t pv_route_setup(const ra8_usb_setup_t *setup)
Classify an 8-byte SETUP envelope into a pv_action_t.
pv_std_request_t
Standard bRequest codes this device answers (USB 2.0 Table 9-4).
@ k_pv_std_get_descriptor
GET_DESCRIPTOR.
@ k_pv_std_set_address
SET_ADDRESS.
@ k_pv_std_set_configuration
SET_CONFIGURATION.
pv_printer_request_t
Printer class bRequest codes (USB Printer Class 1.1 sec 4.2).
@ k_pv_pprn_get_device_id
GET_DEVICE_ID.
@ k_pv_pprn_get_port_status
GET_PORT_STATUS.
@ k_pv_pprn_soft_reset
SOFT_RESET.
static const uint8_t g_pv_config_desc[]
55-byte CONFIGURATION descriptor: IF0 Printer + IF1 Vendor.
static pv_action_t pv_route_standard(const ra8_usb_setup_t *setup)
Route a standard request by its bRequest code.
static pv_action_t pv_route_get_descriptor(const ra8_usb_setup_t *setup)
Route a standard GET_DESCRIPTOR by its wValue high byte.
pv_req_field_t
Masks + values used to decode a SETUP bmRequestType byte.
@ k_pv_bm_type_vendor
Vendor request.
@ k_pv_bm_dir_mask
Direction bit 7 (1 = device->host).
@ k_pv_bm_recip_mask
Recipient field, bits 4:0.
@ k_pv_bm_recip_iface
Interface recipient.
@ k_pv_bm_type_mask
Request-type field, bits 6:5.
@ k_pv_bm_type_class
Class request.
@ k_pv_bm_dir_in
Device-to-host control read.
@ k_pv_bm_type_standard
Standard request.
static const uint8_t g_pv_device_desc[]
18-byte DEVICE descriptor for the composite printer + vendor gadget.
pv_desc_type_t
bDescriptorType values carried in the GET_DESCRIPTOR wValue high byte (USB 2.0 Table 9-5).
@ k_pv_dt_config
CONFIGURATION descriptor.
@ k_pv_dt_string
STRING descriptor.
@ k_pv_dt_device
DEVICE descriptor.
static bool pv_is_printer_class_request(const ra8_usb_setup_t *setup)
Recognise an interface-directed Printer class-specific request.
static uint16_t pv_clamp_len(uint16_t available, uint16_t requested)
Clamp a descriptor length to the host's advertised wLength.
pv_action_t
The decision pv_route_setup produces for a SETUP envelope.
@ k_pv_action_get_device_desc
Stage the DEVICE descriptor.
@ k_pv_action_get_config_desc
Stage the CONFIGURATION descriptor.
@ k_pv_action_vendor_class
Route to the Vendor class layer.
@ k_pv_action_get_string_desc
Stage the STRING (LANGID) descriptor.
@ k_pv_action_set_address
SET_ADDRESS: SIE-owned, ACK.
@ k_pv_action_stall
Unsupported: STALL EP0.
@ k_pv_action_set_configuration
SET_CONFIGURATION: ACK + go live.
@ k_pv_action_printer_class
Route to the Printer class layer.
static const uint8_t g_pv_string0_desc[]
STRING descriptor index 0 – the supported-language ID array.
static bool pv_descriptor(pv_action_t action, const uint8_t **out_desc, uint16_t *out_len)
Fetch the descriptor byte table + length for a descriptor action.