30 #ifndef _IOT_USB_DEVICE_H_ 31 #define _IOT_USB_DEVICE_H_ 36 #define IOT_USB_DEVICE_SUCCESS ( 0 ) 37 #define IOT_USB_DEVICE_ERROR ( 1 ) 38 #define IOT_USB_DEVICE_BUSY ( 2 ) 39 #define IOT_USB_DEVICE_INVALID_VALUE ( 3 ) 40 #define IOT_USB_DEVICE_WRITE_FAILED ( 4 ) 41 #define IOT_USB_DEVICE_READ_FAILED ( 5 ) 42 #define IOT_USB_DEVICE_FUNCTION_NOT_SUPPORTED ( 6 ) 43 #define IOT_USB_DEVICE_NOTHING_TO_CANCEL ( 7 ) 48 #define IOT_USB_CONTROL_ENDPOINT (0U) 53 #define IOT_USB_SETUP_PACKET_SIZE (8U) 58 #define IOT_USB_ENDPOINT_NUMBER_MASK (0x0FU) 63 #define IOT_USB_UNINITIALIZED_VAL_32 (0xFFFFFFFFU) 301 void * pvUserContext );
340 void * pvUserContext );
355 uint8_t ucEndpointAddress );
383 uint8_t ucEndpointAddress );
398 uint8_t ucEndpointAddress );
421 uint8_t ucEndpointAddress,
422 uint8_t *
const pvBuffer,
446 uint8_t ucEndpointAddress,
447 uint8_t *
const pvBuffer,
473 uint8_t ucEndpointAddress,
474 uint8_t *
const pvBuffer,
500 uint8_t ucEndpointAddress,
501 uint8_t *
const pvBuffer,
527 void *
const pvBuffer );
Definition: iot_usb_device.h:103
int32_t iot_usb_device_read_sync(IotUsbDeviceHandle_t const pxUsbDevice, uint8_t ucEndpointAddress, uint8_t *const pvBuffer, size_t xBytes)
Starts the USB device read operation in blocking mode.
IotUsbDeviceEvent_t
common notify event types in device callback.
Definition: iot_usb_device.h:73
IotUsbDeviceIoctlRequest_t
Ioctl request types.
Definition: iot_usb_device.h:96
Definition: iot_usb_device.h:111
IotUsbDeviceOperationStatus_t
USB device driver operation status.
Definition: iot_usb_device.h:154
Definition: iot_usb_device.h:82
Definition: iot_usb_device.h:108
int32_t iot_usb_device_endpoint_cancel_transfer(IotUsbDeviceHandle_t const pxUsbDevice, uint8_t ucEndpointAddress)
This function is used to cancel the pending transfer for given endpoint.
Definition: iot_usb_device.h:100
Definition: iot_usb_device.h:124
IotUsbDeviceEndpointStatus_t
Defines endpoint state.
Definition: iot_usb_device.h:132
int32_t iot_usb_device_connect(IotUsbDeviceHandle_t const pxUsbDevice)
Connect the USB device.
Definition: iot_usb_device.h:145
Definition: iot_usb_device.h:135
Definition: iot_usb_device.h:148
Definition: iot_usb_device.h:109
int32_t iot_usb_device_write_async(IotUsbDeviceHandle_t const pxUsbDevice, uint8_t ucEndpointAddress, uint8_t *const pvBuffer, size_t xBytes)
Starts the USB device write operation in non-blocking mode.
Definition: iot_usb_device.h:90
Definition: iot_usb_device.h:98
Definition: iot_usb_device.h:157
int32_t iot_usb_device_write_sync(IotUsbDeviceHandle_t const pxUsbDevice, uint8_t ucEndpointAddress, uint8_t *const pvBuffer, size_t xBytes)
Starts the USB device write operation in blocking mode.
Definition: iot_usb_device.h:125
Definition: iot_usb_device.h:113
int32_t iot_usb_device_close(IotUsbDeviceHandle_t const pxUsbDevice)
Close the USB device peripheral.
Definition: iot_usb_device.h:88
uint16_t usEndpointStatus
Definition: iot_usb_device.h:240
Definition: iot_usb_device.h:110
Definition: iot_usb_device.h:80
Definition: iot_usb_device.h:86
Definition: iot_usb_device.h:75
Endpoint configuration structure.
Definition: iot_usb_device.h:208
int32_t iot_usb_device_ioctl(IotUsbDeviceHandle_t const pxUsbDevice, IotUsbDeviceIoctlRequest_t xUsbDeviceRequest, void *const pvBuffer)
Used for various USB device control function.
Definition: iot_usb_device.h:114
int32_t iot_usb_device_endpoint_stall(IotUsbDeviceHandle_t const pxUsbDevice, uint8_t ucEndpointAddress)
Stall the usb device specific endpoint. This function is to set stall conditions for the specific end...
Definition: iot_usb_device.h:84
uint8_t ucEndpointAddress
Definition: iot_usb_device.h:239
Definition: iot_usb_device.h:158
Definition: iot_usb_device.h:104
Endpoint status structure.
Definition: iot_usb_device.h:237
uint8_t ucZlt
Definition: iot_usb_device.h:230
IotUsbHostController_t
Define device controller ID.
Definition: iot_usb_device.h:143
Definition: iot_usb_device.h:112
Definition: iot_usb_device.h:78
Definition: iot_usb_device.h:147
Definition: iot_usb_device.h:76
uint8_t ucInterval
Definition: iot_usb_device.h:231
Definition: iot_usb_device.h:102
uint8_t ucEndpointAddress
Definition: iot_usb_device.h:227
Definition: iot_usb_device.h:107
Definition: iot_usb_device.h:101
Definition: iot_usb_device.h:136
Definition: iot_usb_device.h:99
Definition: iot_usb_device.h:156
#define IOT_USB_DEVICE_WRITE_FAILED
Definition: iot_usb_device.h:40
struct IotUsbDevice * IotUsbDeviceHandle_t
IotUsbDeviceHandle_t is the handle type returned by calling iot_usb_device_open(). This is initialized in open and returned to caller. The caller must pass this pointer to the rest of APIs.
Definition: iot_usb_device.h:171
Definition: iot_usb_device.h:126
uint8_t ucTransferType
Definition: iot_usb_device.h:228
int32_t iot_usb_device_endpoint_unstall(IotUsbDeviceHandle_t const pxUsbDevice, uint8_t ucEndpointAddress)
Unstall the usb device specific endpoint.
Definition: iot_usb_device.h:137
int32_t iot_usb_device_read_async(IotUsbDeviceHandle_t const pxUsbDevice, uint8_t ucEndpointAddress, uint8_t *const pvBuffer, size_t xBytes)
Starts the USB device read operation in non-blocking mode.
IotUsbDeviceState_t
USB device state.
Definition: iot_usb_device.h:120
#define IOT_USB_DEVICE_SUCCESS
Return values used by this driver.
Definition: iot_usb_device.h:36
uint16_t usMaxPacketSize
Definition: iot_usb_device.h:210
Definition: iot_usb_device.h:122
void iot_usb_device_set_device_callback(IotUsbDeviceHandle_t const pxUsbDevice, IotUsbDeviceCallback_t xCallback, void *pvUserContext)
Sets the application callback to be called on device event.
Definition: iot_usb_device.h:105
int32_t iot_usb_device_endpoint_close(IotUsbDeviceHandle_t const pxUsbDevice, uint8_t ucEndpointAddress)
De-initializes the usb device specific endpoint.
#define IOT_USB_DEVICE_READ_FAILED
Definition: iot_usb_device.h:41
void iot_usb_device_set_endpoint_callback(IotUsbDeviceHandle_t const pxUsbDevice, uint8_t ucEndpointAddress, IotUsbDeviceEndpointCallbackFn_t xCallback, void *pvUserContext)
Sets the endpoint callback to be called on endpoint transfer.
Definition: iot_usb_device.h:89
Definition: iot_usb_device.h:123
int32_t(* IotUsbDeviceCallback_t)(IotUsbDeviceHandle_t const pxUsbDevice, uint32_t ulDeviceEvent, void *pvUserContext)
The callback function for USB device event operation. This callback is passed to driver by using iot_...
Definition: iot_usb_device.h:189
int32_t(* IotUsbDeviceEndpointCallbackFn_t)(IotUsbDeviceOperationStatus_t xStatus, void *pvUserContext)
The callback typedef for USB device endpoint. For each endpoint, it's passed when user set endpoint c...
Definition: iot_usb_device.h:203
Definition: iot_usb_device.h:134
int32_t iot_usb_device_endpoint_open(IotUsbDeviceHandle_t const pxUsbDevice, IotUsbDeviceEndpointConfig_t *pxEpConfig)
Initiates the usb device specific endpoint.
Definition: iot_usb_device.h:146
IotUsbDeviceHandle_t iot_usb_device_open(int32_t lUsbDeviceControllerInstance)
Initiates the usb device controller interface.
int32_t iot_usb_device_disconnect(IotUsbDeviceHandle_t const pxUsbDevice)
Disconnect the USB device.