31#ifndef _IOT_USB_HOST_H_
32#define _IOT_USB_HOST_H_
42#define IOT_USB_HOST_SUCCESS ( 0 )
43#define IOT_USB_HOST_ERROR ( 1 )
44#define IOT_USB_HOST_BUSY ( 2 )
45#define IOT_USB_HOST_INVALID_VALUE ( 3 )
46#define IOT_USB_HOST_WRITE_FAIL ( 4 )
47#define IOT_USB_HOST_READ_FAIL ( 5 )
48#define IOT_USB_HOST_CANCEL_FAILED ( 6 )
49#define IOT_USB_HOST_FUNCTION_NOT_SUPPORTED ( 7 )
50#define IOT_USB_HOST_NOTHING_TO_CANCEL ( 8 )
52#define IOT_USB_HOST_MAX_ENDPOINTS ( 4 )
94struct IotUsbConfiguration;
95struct IotUsbInterface;
140 void * pvUserContext );
159 uint16_t usMaxPacketSize;
176 uint8_t ucEndpointAddress;
177 uint8_t ucTransferType;
186typedef struct IotUsbInterfaceInfo
197typedef struct IotUsbConfigurationInfo
206typedef struct IotUsbDeviceInfo
240 void * pvUserContext );
256 void * pvUserContext );
273 uint8_t ucDevAddress,
314 void *
const pvBuffer,
341 void *
const pvBuffer,
366 void *
const pvBuffer,
392 void *
const pvBuffer,
430 void *
const pvBuffer );
struct IotUsbDevice * IotUsbDeviceHandle_t
IotUsbDeviceHandle_t is the handle type returned by calling iot_usb_device_open()....
Definition: iot_usb_device.h:171
struct IotUsbHost * IotUsbHostHandle_t
IotUsbHostHandle_t is the handle type returned by calling iot_usb_host_open(). This is initialized in...
Definition: iot_usb_host.h:103
IotUsbHostHandle_t iot_usb_host_open(int32_t lUsbHostControllerInstance)
iot_usb_host_open is used to initialize the usb host driver. This must be called before using any oth...
int32_t iot_usb_host_send_setup(IotUsbHostHandle_t const pxUsbHost, IotPipeHandle_t pxPipe, void *pvSetup, uint8_t *pucData)
Send setup packet to the pipe.
int32_t iot_usb_host_read_sync(IotUsbHostHandle_t const pxUsbHost, IotPipeHandle_t pxPipe, void *const pvBuffer, size_t xBytes)
Starts the usb host read operation in blocking mode.
struct IotUsbPipe * IotPipeHandle_t
IotPipeHandle_t is the pipe handle, which will be used for data and control transfer.
Definition: iot_usb_host.h:126
int32_t iot_usb_host_write_sync(IotUsbHostHandle_t const pxUsbHost, IotPipeHandle_t pxPipe, void *const pvBuffer, size_t xBytes)
Starts the usb host write operation in blocking mode.
IotUsbHostEvent_t
common host notify event types in host callback.
Definition: iot_usb_host.h:58
int32_t iot_usb_host_pipe_close(IotUsbHostHandle_t const pxUsbHost, IotPipeHandle_t pxPipe)
This function is used to close given pipe.
void(* IotUsbHostCallback_t)(IotUsbDeviceHandle_t const pxUsbDevice, IotUsbHostEvent_t xEvent, void *pvUserContext)
USB Host attach/detach notify callback type. This callback is passed to the driver by calling iot_usb...
Definition: iot_usb_host.h:138
int32_t iot_usb_host_write_async(IotUsbHostHandle_t const pxUsbHost, IotPipeHandle_t pxPipe, void *const pvBuffer, size_t xBytes)
Starts the usb host write operation in non-blocking mode.
struct IotUsbInterface * IotUsbInterfaceHandle_t
IotUsbInterfaceHandle_t is the interface handle, which can be extracted from config One device may ha...
Definition: iot_usb_host.h:121
int32_t iot_usb_host_close(IotUsbHostHandle_t const pxUsbHost)
Close the USB host peripheral.
struct IotUsbConfiguration * IotUsbConfigHandle_t
IotUsbConfigHandle_t is the configuration handle for device Only one configuration at run time.
Definition: iot_usb_host.h:115
void(* IotUsbHostTransferCallback_t)(void *pvUserContext, uint8_t ucStatus)
USB Host pipe transfer callback type. This callback is passed to the driver by calling iot_usb_host_s...
Definition: iot_usb_host.h:151
void iot_usb_host_set_host_callback(IotUsbHostHandle_t const pxUsbHost, IotUsbHostCallback_t xCallback, void *pvUserContext)
Set up usb host callback to be called on host event.
#define IOT_USB_HOST_MAX_ENDPOINTS
Definition: iot_usb_host.h:52
int32_t iot_usb_host_cancel(IotUsbHostHandle_t const pxUsbHost, IotPipeHandle_t pxPipe)
This function is used to cancel the current operation in progress.
void iot_usb_host_set_pipe_callback(IotUsbHostHandle_t const pxUsbHost, IotPipeHandle_t pxPipe, IotUsbHostTransferCallback_t xCallback, void *pvUserContext)
set up usb pipe callback to be called on pipe transfer.
IotUsbHostIoctlRequest_t
Ioctl standard device request for USB Host HAL.
Definition: iot_usb_host.h:72
int32_t iot_usb_host_read_async(IotUsbHostHandle_t const pxUsbHost, IotPipeHandle_t pxPipe, void *const pvBuffer, size_t xBytes)
Starts the usb host read operation in non-blocking mode.
int32_t iot_usb_host_ioctl(IotUsbDeviceHandle_t pxUsbDevice, IotUsbHostIoctlRequest_t xRequest, void *const pvBuffer)
Used for various usb host control function.
IotPipeHandle_t iot_usb_host_pipe_open(IotUsbHostHandle_t const pxUsbHost, uint8_t ucDevAddress, IotUsbDeviceEndpointConfig_t *pxEpConfig)
This function is used to open a pipe per given device and endpoint descriptor.
struct IotUsbDevice * IotUsbDeviceHandle_t
IotUsbDeviceHandle_t is the handle type returned when device attach and enumerated This device handle...
Definition: iot_usb_host.h:109
@ eUSBHostDetachEvent
Definition: iot_usb_host.h:60
@ eUSBHostResumeEvent
Definition: iot_usb_host.h:64
@ eUSBHostAttachEvent
Definition: iot_usb_host.h:59
@ eUSBHostResetEvent
Definition: iot_usb_host.h:62
@ eUSBHostEnumerationDoneEvent
Definition: iot_usb_host.h:61
@ eUSBHostSuspendEvent
Definition: iot_usb_host.h:63
@ eUSBHostRemoteWakeEvent
Definition: iot_usb_host.h:65
@ eUSBHostGetDeviceControlPipe
Definition: iot_usb_host.h:74
@ eUSBHostGetDeviceInfo
Definition: iot_usb_host.h:78
@ eUSBHostGetDeviceAddress
Definition: iot_usb_host.h:75
@ eUSBHostGetInterfaceDescriptor
Definition: iot_usb_host.h:80
@ eUSBHostOpenDeviceInterface
Definition: iot_usb_host.h:76
@ eUSBHostGetInterfaceHandle
Definition: iot_usb_host.h:82
@ eUSBHostCloseDeviceInterface
Definition: iot_usb_host.h:77
@ eUSBHostGetInterfaceInfo
Definition: iot_usb_host.h:79
@ eUSBHostGetHosthandle
Definition: iot_usb_host.h:73
@ eUSBHostGetConfigureHandle
Definition: iot_usb_host.h:81
Attached device configuration information.
Definition: iot_usb_host.h:198
IotUsbInterfaceInfo_t * pxInterface
Definition: iot_usb_host.h:199
uint8_t ucInterfaceCount
Definition: iot_usb_host.h:200
Endpoint configuration structure.
Definition: iot_usb_device.h:212
Attached device information.
Definition: iot_usb_host.h:207
uint16_t usPid
Definition: iot_usb_host.h:210
uint8_t ucDevAddress
Definition: iot_usb_host.h:209
uint16_t usVid
Definition: iot_usb_host.h:211
uint8_t ucSpeed
Definition: iot_usb_host.h:208
Attached device interface information.
Definition: iot_usb_host.h:187
uint8_t ucEpCount
Definition: iot_usb_host.h:190
uint8_t ucAlternateSettingNumber
Definition: iot_usb_host.h:191
uint8_t ucInterfaceIndex
Definition: iot_usb_host.h:189