FreeRTOS:
Common I/O
AWS IoT Common I/O library
|
Return to main page ↑ |
Data Structures | |
struct | IotUsbDeviceEndpointConfig_t |
Endpoint configuration structure. More... | |
struct | IotUsbDeviceEndpointInfo_t |
Endpoint status structure. More... | |
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... | |
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.
[in] | pxUsbDevice | The usb device peripheral handle returned in the open() call. |
[in] | ulDeviceEvent | USB device asynchronous event. |
[in] | pvUserContext | User Context passed when setting the callback. This is not used or modified by the driver. The context is provided by the caller when setting the callback, and is passed back to the caller in the callback. |
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.
[out] | xStatus | Usb device asynchronous operation status. |
[in] | pvUserContext | User Context passed when setting the callback. This is not used or modified by the driver. The context is provided by the caller when setting the callback, and is passed back to the caller in the callback. |
enum IotUsbDeviceEvent_t |
common notify event types in device callback.
Ioctl request types.
enum IotUsbDeviceState_t |
USB device state.
IotUsbDeviceHandle_t iot_usb_device_open | ( | int32_t | lUsbDeviceControllerInstance | ) |
Initiates the usb device controller interface.
The instance of USB device controller to initialize.
int32_t iot_usb_device_connect | ( | IotUsbDeviceHandle_t const | pxUsbDevice | ) |
Connect the USB device.
The function enables the device functionality, so that the device can be recognized by the host when the device detects that it has been connected to a host.
[in] | pxUsbDevice | The usb device peripheral handle returned in the open() call. |
int32_t iot_usb_device_disconnect | ( | IotUsbDeviceHandle_t const | pxUsbDevice | ) |
Disconnect the USB device.
The function disables the device functionality, after this function called, even the device is attached to the host, and the device can't work.
[in] | pxUsbDevice | The usb device peripheral handle returned in the open() call. |
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.
[in] | pxUsbDevice | The usb device peripheral handle returned in the open() call. |
[in] | xCallback | The callback function to be called on device event. |
[in] | pvUserContext | The user context to be passed back when callback is called. |
int32_t iot_usb_device_endpoint_open | ( | IotUsbDeviceHandle_t const | pxUsbDevice, |
IotUsbDeviceEndpointConfig_t * | pxEpConfig | ||
) |
Initiates the usb device specific endpoint.
[in] | pxUsbDevice | The USB device handle returned in open() call. |
[in] | pxEpConfig | Endpoint configuration. |
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.
[in] | pxUsbDevice | The usb device peripheral handle returned in the open() call. |
[in] | ucEndpointAddress | Endpoint Address. |
[in] | xCallback | The callback function to be called on endpoint transfer. |
[in] | pvUserContext | The user context to be passed back when callback is called. |
int32_t iot_usb_device_endpoint_close | ( | IotUsbDeviceHandle_t const | pxUsbDevice, |
uint8_t | ucEndpointAddress | ||
) |
De-initializes the usb device specific endpoint.
[in] | pxUsbDevice | The USB device handle returned in open() call. |
[in] | ucEndpointAddress | Endpoint Address. |
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.
[in] | pxUsbDevice | The USB device handle returned in open() call. |
[in] | ucEndpointAddress | Endpoint Address. |
int32_t iot_usb_device_endpoint_unstall | ( | IotUsbDeviceHandle_t const | pxUsbDevice, |
uint8_t | ucEndpointAddress | ||
) |
Unstall the usb device specific endpoint.
[in] | pxUsbDevice | The USB device handle returned in open() call. |
[in] | ucEndpointAddress | Endpoint Address. |
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.
[in] | pxUsbDevice | The USB device handle returned in open() call. |
[in] | ucEndpointAddress | Endpoint index |
[out] | pvBuffer | The receive buffer to read the data into |
[in] | xBytes | The number of bytes to read. |
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.
note: this function will block until all xBytes have been written.
[in] | pxUsbDevice | The USB device handle returned in open() call. |
[in] | ucEndpointAddress | Endpoint index |
[out] | pvBuffer | The receive buffer to read the data into |
[in] | xBytes | The number of bytes to read. |
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.
[in] | pxUsbDevice | The USB device handle returned in open() call. |
[in] | ucEndpointAddress | Endpoint index |
[out] | pvBuffer | The receive buffer to read the data into |
[in] | xBytes | The number of bytes to read. |
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.
[in] | pxUsbDevice | The USB device handle returned in open() call. |
[in] | ucEndpointAddress | Endpoint index |
[out] | pvBuffer | The receive buffer to read the data into |
[in] | xBytes | The number of bytes to read. |
int32_t iot_usb_device_ioctl | ( | IotUsbDeviceHandle_t const | pxUsbDevice, |
IotUsbDeviceIoctlRequest_t | xUsbDeviceRequest, | ||
void *const | pvBuffer | ||
) |
Used for various USB device control function.
[in] | pxUsbDevice | The USB device handle returned in open() call. |
[in] | xUsbDeviceRequest | Should be one of IotUsbDeviceIoctlRequest_t. |
[in,out] | pvBuffer | The configuration values for the IOCTL request. |
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.
[in] | pxUsbDevice | The USB device handle returned in open() call. |
[in] | ucEndpointAddress | Endpoint Address. |
int32_t iot_usb_device_close | ( | IotUsbDeviceHandle_t const | pxUsbDevice | ) |
Close the USB device peripheral.
[in] | pxUsbDevice | The USB device handle returned in open() call. |