File syn_usb.c¶
FileList > drivers > syn_usb.c
Go to the source code of this file
Zero-Heap Modular USB 2.0 Device Core Protocol Engine Implementation.
#include "syntropic/drivers/syn_usb.h"#include <string.h>
Public Static Attributes¶
| Type | Name |
|---|---|
| const uint8_t | CONFIG_HEADER_TEMPLATE = /* multi line expression */ |
Public Functions¶
| Type | Name |
|---|---|
| SYN_Status | syn_usb_init (SYN_USB_Device * dev, const uint8_t * device_desc) Initialize USB Device Core with standard 18-byte Device Descriptor. |
| bool | syn_usb_is_configured (const SYN_USB_Device * dev) Check if USB device is in CONFIGURED state. |
| SYN_Status | syn_usb_process_setup (SYN_USB_Device * dev, const SYN_USB_SetupPacket * pkt, uint8_t * resp, uint16_t * rlen) Process Control Setup packet from Host (EP0). |
| SYN_Status | syn_usb_register_class (SYN_USB_Device * dev, const SYN_USB_ClassDriver * cls, const uint8_t * iface_desc, uint16_t iface_desc_len) Register a class driver and append its interface descriptors. |
| SYN_Status | syn_usb_set_raw_config_desc (SYN_USB_Device * dev, const uint8_t * desc, uint16_t len) Set raw configuration descriptor pointer (overrides auto-assembly). |
| SYN_Status | syn_usb_set_string_desc (SYN_USB_Device * dev, uint8_t index, const uint8_t * desc) Set string descriptor pointer for a given index. |
Public Static Attributes Documentation¶
variable CONFIG_HEADER_TEMPLATE¶
Standard Configuration Descriptor Header Template (9 bytes)
Public Functions Documentation¶
function syn_usb_init¶
Initialize USB Device Core with standard 18-byte Device Descriptor.
Parameters:
devPointer to USB device instance.device_descPointer to 18-byte standard USB device descriptor.
Returns:
SYN_OK on success.
function syn_usb_is_configured¶
Check if USB device is in CONFIGURED state.
Parameters:
devPointer to USB device context.
Returns:
true if device is configured.
function syn_usb_process_setup¶
Process Control Setup packet from Host (EP0).
SYN_Status syn_usb_process_setup (
SYN_USB_Device * dev,
const SYN_USB_SetupPacket * pkt,
uint8_t * resp,
uint16_t * rlen
)
Parameters:
devPointer to USB device context.pktPointer to received Setup Packet.respOutput buffer for data stage response.rlenOutput pointer to receive response byte length.
Returns:
SYN_OK on success.
function syn_usb_register_class¶
Register a class driver and append its interface descriptors.
SYN_Status syn_usb_register_class (
SYN_USB_Device * dev,
const SYN_USB_ClassDriver * cls,
const uint8_t * iface_desc,
uint16_t iface_desc_len
)
Parameters:
devPointer to USB device context.clsClass driver vtable and binding context.iface_descPointer to class interface descriptor payload.iface_desc_lenLength of interface descriptor payload.
Returns:
SYN_OK on success.
function syn_usb_set_raw_config_desc¶
Set raw configuration descriptor pointer (overrides auto-assembly).
Parameters:
devPointer to USB device context.descPointer to raw configuration descriptor.lenLength in bytes.
Returns:
SYN_OK on success.
function syn_usb_set_string_desc¶
Set string descriptor pointer for a given index.
Parameters:
devPointer to USB device context.indexString index (0=Language ID, 1=Manufacturer, 2=Product, etc).descPointer to UNICODE string descriptor.
Returns:
SYN_OK on success.
The documentation for this class was generated from the following file src/syntropic/drivers/syn_usb.c