Common IO - basic v1.0.0
Common IO - basic v1.0.0 Library
 
Loading...
Searching...
No Matches
iot_usb_host.h File Reference

File for the APIs of USB host called by application or class layer. More...

Go to the source code of this file.

Data Structures

struct  IotUsbDeviceEndpointConfig_t
 Endpoint configuration structure. More...
 
struct  IotUsbInterfaceInfo_t
 Attached device interface information. More...
 
struct  IotUsbConfigurationInfo_t
 Attached device configuration information. More...
 
struct  IotUsbDeviceInfo_t
 Attached device information. More...
 

Macros

#define IOT_USB_HOST_SUCCESS   ( 0 )
 Return values returned by this driver.
 
#define IOT_USB_HOST_ERROR   ( 1 )
 
#define IOT_USB_HOST_BUSY   ( 2 )
 
#define IOT_USB_HOST_INVALID_VALUE   ( 3 )
 
#define IOT_USB_HOST_WRITE_FAIL   ( 4 )
 
#define IOT_USB_HOST_READ_FAIL   ( 5 )
 
#define IOT_USB_HOST_CANCEL_FAILED   ( 6 )
 
#define IOT_USB_HOST_FUNCTION_NOT_SUPPORTED   ( 7 )
 
#define IOT_USB_HOST_NOTHING_TO_CANCEL   ( 8 )
 
#define IOT_USB_HOST_MAX_ENDPOINTS   ( 4 )
 

Typedefs

typedef struct IotUsbHost * IotUsbHostHandle_t
 IotUsbHostHandle_t is the handle type returned by calling iot_usb_host_open(). This is initialized in open and returned to caller. The caller must pass this pointer to the rest of APIs.
 
typedef struct IotUsbDevice * IotUsbDeviceHandle_t
 IotUsbDeviceHandle_t is the handle type returned when device attach and enumerated This device handle is needed for device operation.
 
typedef struct IotUsbConfiguration * IotUsbConfigHandle_t
 IotUsbConfigHandle_t is the configuration handle for device Only one configuration at run time.
 
typedef struct IotUsbInterface * IotUsbInterfaceHandle_t
 IotUsbInterfaceHandle_t is the interface handle, which can be extracted from config One device may have more than one interface to be used.
 
typedef struct IotUsbPipe * IotPipeHandle_t
 IotPipeHandle_t is the pipe handle, which will be used for data and control transfer.
 
typedef 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_host_set_host_callback.
 
typedef 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_set_pipe_callback.
 

Enumerations

enum  IotUsbHostEvent_t {
  eUSBHostAttachEvent , eUSBHostDetachEvent , eUSBHostEnumerationDoneEvent , eUSBHostResetEvent ,
  eUSBHostSuspendEvent , eUSBHostResumeEvent , eUSBHostRemoteWakeEvent
}
 common host notify event types in host callback. More...
 
enum  IotUsbHostIoctlRequest_t {
  eUSBHostGetHosthandle , eUSBHostGetDeviceControlPipe , eUSBHostGetDeviceAddress , eUSBHostOpenDeviceInterface ,
  eUSBHostCloseDeviceInterface , eUSBHostGetDeviceInfo , eUSBHostGetInterfaceInfo , eUSBHostGetInterfaceDescriptor ,
  eUSBHostGetConfigureHandle , eUSBHostGetInterfaceHandle
}
 Ioctl standard device request for USB Host HAL. More...
 

Functions

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 other usb host APIs.
 
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.
 
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.
 
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.
 
int32_t iot_usb_host_pipe_close (IotUsbHostHandle_t const pxUsbHost, IotPipeHandle_t pxPipe)
 This function is used to close given pipe.
 
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_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.
 
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.
 
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.
 
int32_t iot_usb_host_cancel (IotUsbHostHandle_t const pxUsbHost, IotPipeHandle_t pxPipe)
 This function is used to cancel the current operation in progress.
 
int32_t iot_usb_host_ioctl (IotUsbDeviceHandle_t pxUsbDevice, IotUsbHostIoctlRequest_t xRequest, void *const pvBuffer)
 Used for various usb host control function.
 
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_close (IotUsbHostHandle_t const pxUsbHost)
 Close the USB host peripheral.
 

Detailed Description

File for the APIs of USB host called by application or class layer.