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. | |
| #define IOT_USB_HOST_SUCCESS ( 0 ) |
Return values returned by this driver.
USB host operation completed successfully.
| #define IOT_USB_HOST_ERROR ( 1 ) |
USB host error.
| #define IOT_USB_HOST_BUSY ( 2 ) |
USB host busy.
| #define IOT_USB_HOST_INVALID_VALUE ( 3 ) |
At least one parameter is invalid.
| #define IOT_USB_HOST_WRITE_FAIL ( 4 ) |
USB host write operation failed.
| #define IOT_USB_HOST_READ_FAIL ( 5 ) |
USB host read operation failed.
| #define IOT_USB_HOST_CANCEL_FAILED ( 6 ) |
USB host cancel operation failed.
| #define IOT_USB_HOST_FUNCTION_NOT_SUPPORTED ( 7 ) |
USB host function not supported.
| #define IOT_USB_HOST_NOTHING_TO_CANCEL ( 8 ) |
No operation in progress to cancel.
| #define IOT_USB_HOST_MAX_ENDPOINTS ( 4 ) |
Maximum endpoint number for each interface.
| 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.
| [in] | pxUsbDevice | USB device handle, returned when new device attached and enumerated. |
| [in] | xEvent | USB host event. |
| [in] | pvUserContext | User Context passed when setting the callback. This is not used by the driver, but just passed back to the user in the 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.
| [in] | ucStatus | Usb host transfer status. |
| [in] | pvUserContext | User Context passed when setting the callback. This is not used by the driver, but just passed back to the user in the callback. |
| enum IotUsbHostEvent_t |
common host notify event types in host callback.
Ioctl standard device request for USB Host HAL.
| 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.
| [in] | lUsbHostControllerInstance | The instance of usb host controller to initialize. |
| 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.
| [in] | pxUsbHost | The usb host peripheral handle returned in the iot_usb_host_open() function. |
| [in] | xCallback | The callback function to be called on host event. |
| [in] | pvUserContext | The user context to be passed back when callback is called. |
| 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.
| [in] | pxUsbHost | The usb host peripheral handle returned in iot_usb_host_open() function. |
| [in] | pxPipe | The usb pipe to be operated. |
| [in] | xCallback | The callback function to be called on pipe transfer. |
| [in] | pvUserContext | The user context to be passed back when callback is called. |
| 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.
| [in] | pxUsbHost | The usb host peripheral handle returned in iot_usb_host_open() function. |
| [in] | ucDevAddress | The attached device address. |
| [in] | pxEpConfig | Given endpoint configuration. |
| int32_t iot_usb_host_pipe_close | ( | IotUsbHostHandle_t const | pxUsbHost, |
| IotPipeHandle_t | pxPipe | ||
| ) |
This function is used to close given pipe.
| [in] | pxUsbHost | The usb host peripheral handle returned in iot_usb_host_open() function. |
| [in] | pxPipe | The pipe handle to be closed. |
| 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.
| [in] | pxUsbHost | The usb host peripheral handle returned in iot_usb_host_open() function. |
| [in] | pxPipe | The pipe handle. |
| [out] | pvBuffer | The receive buffer to read the data into. |
| [in] | xBytes | The number of bytes to read. |
| 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.
| [in] | pxUsbHost | The usb host peripheral handle returned in iot_usb_host_open() function. |
| [in] | pxPipe | The pipe handle. |
| [out] | pvBuffer | The transmit buffer containing the data to be written. It must be allocated by caller and remain valid before write complete. |
| [in] | xBytes | The number of bytes to write. |
| 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.
| [in] | pxUsbHost | The usb host peripheral handle returned in iot_usb_host_open() function. |
| [in] | pxPipe | The pipe handle. |
| [out] | pvBuffer | The receive buffer to read the data into. |
| [in] | xBytes | The number of bytes to read. |
| 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.
| [in] | pxUsbHost | The usb host peripheral handle returned in iot_usb_host_open() function. |
| [in] | pxPipe | The pipe handle. |
| [out] | pvBuffer | The transmit buffer containing the data to be written. It must be allocated by caller and remain valid before write complete. |
| [in] | xBytes | The number of bytes to write. |
| int32_t iot_usb_host_cancel | ( | IotUsbHostHandle_t const | pxUsbHost, |
| IotPipeHandle_t | pxPipe | ||
| ) |
This function is used to cancel the current operation in progress.
| [in] | pxUsbHost | The USB Host peripheral handle returned in iot_usb_host_open() function. |
| [in] | pxPipe | The usb pipe on which user want to cancel operation. |
| int32_t iot_usb_host_ioctl | ( | IotUsbDeviceHandle_t | pxUsbDevice, |
| IotUsbHostIoctlRequest_t | xRequest, | ||
| void *const | pvBuffer | ||
| ) |
Used for various usb host control function.
| [in] | pxUsbDevice | The USB device peripheral handle for host to control. |
| [in] | xRequest | The request should be one of IotUsbHostIoctlRequest_t. |
| [in,out] | pvBuffer | The request values for the usb host. |
| 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.
| [in] | pxUsbHost | The USB Host peripheral handle returned in iot_usb_host_open() function. |
| [in] | pxPipe | The usb pipe on which we are operating. |
| [in] | pvSetup | Setup packet. |
| [in] | pucData | Data to be sent if needed. |
| int32_t iot_usb_host_close | ( | IotUsbHostHandle_t const | pxUsbHost | ) |
Close the USB host peripheral.
| [in] | pxUsbHost | The USB host handle returned in open() call. |