FreeRTOS:
Common I/O
AWS IoT Common I/O library
|
Return to main page ↑ |
File for the APIs of USB device 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 | IotUsbDeviceEndpointInfo_t |
Endpoint status structure. More... | |
Macros | |
#define | IOT_USB_DEVICE_SUCCESS ( 0 ) |
Return values used by this driver. More... | |
#define | IOT_USB_DEVICE_ERROR ( 1 ) |
#define | IOT_USB_DEVICE_BUSY ( 2 ) |
#define | IOT_USB_DEVICE_INVALID_VALUE ( 3 ) |
#define | IOT_USB_DEVICE_WRITE_FAILED ( 4 ) |
#define | IOT_USB_DEVICE_READ_FAILED ( 5 ) |
#define | IOT_USB_DEVICE_FUNCTION_NOT_SUPPORTED ( 6 ) |
#define | IOT_USB_DEVICE_NOTHING_TO_CANCEL ( 7 ) |
#define | IOT_USB_CONTROL_ENDPOINT (0U) |
Control endpoint index. | |
#define | IOT_USB_SETUP_PACKET_SIZE (8U) |
The setup packet size of USB control transfer. | |
#define | IOT_USB_ENDPOINT_NUMBER_MASK (0x0FU) |
USB endpoint mask. | |
#define | IOT_USB_UNINITIALIZED_VAL_32 (0xFFFFFFFFU) |
Default invalid value or the endpoint callback length of cancelled transfer. | |
Typedefs | |
typedef 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. | |
typedef 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_usb_device_set_callback API. It's called when one of the events (IotUsbDeviceEvent_t) happen. This callback is used by upper layer to set up upper layer callback by calling iot_usb_device_set_device_callback. It is used when the bus state changes and an event is generated, e.g. an bus reset event happened, usb class layer needs to know such event and react accordingly. More... | |
typedef 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 callback by iot_usb_device_set_endpoint_callback API. This callback is used to notify the upper layer about the endpoint tranafer result. More... | |
Functions | |
IotUsbDeviceHandle_t | iot_usb_device_open (int32_t lUsbDeviceControllerInstance) |
Initiates the usb device controller interface. More... | |
int32_t | iot_usb_device_connect (IotUsbDeviceHandle_t const pxUsbDevice) |
Connect the USB device. More... | |
int32_t | iot_usb_device_disconnect (IotUsbDeviceHandle_t const pxUsbDevice) |
Disconnect the USB device. More... | |
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. More... | |
int32_t | iot_usb_device_endpoint_open (IotUsbDeviceHandle_t const pxUsbDevice, IotUsbDeviceEndpointConfig_t *pxEpConfig) |
Initiates the usb device specific endpoint. More... | |
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. More... | |
int32_t | iot_usb_device_endpoint_close (IotUsbDeviceHandle_t const pxUsbDevice, uint8_t ucEndpointAddress) |
De-initializes the usb device specific endpoint. More... | |
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 endpoint. The STALL packet indicates that the endpoint has halted, or a control pipe does not support a certain request. A function uses the STALL handshake packet to indicate that it is unable to transmit or receive data. Besides the default control pipe, all of a function's endpoints are in an undefined state after the device issues a STALL handshake packet. The host must never issue a STALL handshake packet. Typically, the STALL handshake indicates a functional stall. A functional stall occurs when the halt feature of an endpoint is set. In this circumstance, host intervention is required via the default control pipe to clear the halt feature of the halted endpoint. Less often, the function returns a STALL handshake during a SETUP or DATA stage of a control transfer. This is called a protocol stall and is resolved when the host issues the next SETUP transaction. More... | |
int32_t | iot_usb_device_endpoint_unstall (IotUsbDeviceHandle_t const pxUsbDevice, uint8_t ucEndpointAddress) |
Unstall the usb device specific endpoint. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
int32_t | iot_usb_device_ioctl (IotUsbDeviceHandle_t const pxUsbDevice, IotUsbDeviceIoctlRequest_t xUsbDeviceRequest, void *const pvBuffer) |
Used for various USB device control function. More... | |
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. More... | |
int32_t | iot_usb_device_close (IotUsbDeviceHandle_t const pxUsbDevice) |
Close the USB device peripheral. More... | |
File for the APIs of USB device called by application or class layer.
#define IOT_USB_DEVICE_SUCCESS ( 0 ) |
Return values used by this driver.
USB operation completed successfully.
#define IOT_USB_DEVICE_ERROR ( 1 ) |
USB device error.
#define IOT_USB_DEVICE_BUSY ( 2 ) |
USB device busy.
#define IOT_USB_DEVICE_INVALID_VALUE ( 3 ) |
At least one parameter is invalid.
#define IOT_USB_DEVICE_WRITE_FAILED ( 4 ) |
USB device write operation failed.
#define IOT_USB_DEVICE_READ_FAILED ( 5 ) |
USB device read operation failed.
#define IOT_USB_DEVICE_FUNCTION_NOT_SUPPORTED ( 6 ) |
USB device function not supported.
#define IOT_USB_DEVICE_NOTHING_TO_CANCEL ( 7 ) |
No operation in progress to cancel.