File syn_usb_host.c¶
FileList > drivers > syn_usb_host.c
Go to the source code of this file
Zero-Heap USB 2.0 Host Core Protocol Engine Implementation. More...
#include "syntropic/drivers/syn_usb_host.h"#include "port/syn_port_usb.h"#include "port/syn_port_usb_host.h"#include <string.h>
Public Functions¶
| Type | Name |
|---|---|
| const SYN_USB_HostDevInfo * | syn_usb_host_get_dev_info (const SYN_USB_Host * host) Get cached device information from last enumeration. |
| SYN_Status | syn_usb_host_init (SYN_USB_Host * host) Initialize USB Host Core. |
| bool | syn_usb_host_is_ready (const SYN_USB_Host * host) Check if USB Host has a device enumerated and ready. |
| SYN_Status | syn_usb_host_process (SYN_USB_Host * host) Process USB Host state machine (call each scheduler tick). |
| SYN_Status | syn_usb_host_register_class (SYN_USB_Host * host, const SYN_USB_HostClassDriver * cls) Register a host class driver for interface matching. |
Public Static Functions¶
| Type | Name |
|---|---|
| void | build_setup (SYN_USB_SetupPacket * pkt, uint8_t bmRequestType, uint8_t bRequest, uint16_t wValue, uint16_t wIndex, uint16_t wLength) Build a standard USB control Setup Packet. |
| SYN_Status | enumerate_step (SYN_USB_Host * host) Drive the enumeration sub-state machine. Non-blocking. Each call performs at most one HAL operation. |
| void | probe_class_drivers (SYN_USB_Host * host) Walk configuration descriptor and probe registered class drivers against each interface descriptor's class/subclass/protocol triple. |
Detailed Description¶
Tick-driven state machine handling device attach detection, bus reset, standard USB enumeration (Device/Config descriptor reads, SET_ADDRESS, SET_CONFIGURATION), and host class driver interface matching.
Public Functions Documentation¶
function syn_usb_host_get_dev_info¶
Get cached device information from last enumeration.
Parameters:
hostPointer to USB Host instance.
Returns:
Pointer to device info struct, or NULL if no device.
function syn_usb_host_init¶
Initialize USB Host Core.
Parameters:
hostPointer to USB Host instance.
Returns:
SYN_OK on success.
function syn_usb_host_is_ready¶
Check if USB Host has a device enumerated and ready.
Parameters:
hostPointer to USB Host instance.
Returns:
true if host state is READY.
function syn_usb_host_process¶
Process USB Host state machine (call each scheduler tick).
Drives attach detection, bus reset, enumeration, class probing, and detach handling. Non-blocking.
Parameters:
hostPointer to USB Host instance.
Returns:
SYN_OK on success, SYN_BUSY if transfer pending.
function syn_usb_host_register_class¶
Register a host class driver for interface matching.
Parameters:
hostPointer to USB Host instance.clsHost class driver vtable.
Returns:
SYN_OK on success.
Public Static Functions Documentation¶
function build_setup¶
Build a standard USB control Setup Packet.
static void build_setup (
SYN_USB_SetupPacket * pkt,
uint8_t bmRequestType,
uint8_t bRequest,
uint16_t wValue,
uint16_t wIndex,
uint16_t wLength
)
Parameters:
pktTarget Setup Packet pointer.bmRequestTypeRequest characteristics bitfield.bRequestSpecific request code.wValueWord-sized request parameter.wIndexWord-sized index or offset.wLengthTransfer byte length.
function enumerate_step¶
Drive the enumeration sub-state machine. Non-blocking. Each call performs at most one HAL operation.
Parameters:
hostPointer to USB Host instance.
Returns:
SYN_OK when enumeration complete, SYN_BUSY while in progress, SYN_ERROR on failure.
function probe_class_drivers¶
Walk configuration descriptor and probe registered class drivers against each interface descriptor's class/subclass/protocol triple.
Parameters:
hostPointer to USB Host instance.
The documentation for this class was generated from the following file src/syntropic/drivers/syn_usb_host.c