|
NetBurner 3.5.7
PDF Version |
Classes | |
| struct | _usb_host_process_descriptor_param |
| For USB_REQUEST_STANDARD_GET_DESCRIPTOR and USB_REQUEST_STANDARD_SET_DESCRIPTOR. More... | |
| struct | _usb_host_process_feature_param |
| For USB_REQUEST_STANDARD_CLEAR_FEATURE and USB_REQUEST_STANDARD_SET_FEATURE. More... | |
| struct | _usb_host_get_interface_param |
| For USB_REQUEST_STANDARD_GET_INTERFACE. More... | |
| struct | _usb_host_get_status_param |
| For USB_REQUEST_STANDARD_GET_STATUS. More... | |
| struct | _usb_host_set_interface_param |
| For USB_REQUEST_STANDARD_SET_INTERFACE. More... | |
| struct | _usb_host_synch_frame_param |
| For USB_REQUEST_STANDARD_SYNCH_FRAME. More... | |
| struct | _usb_host_ep |
| USB host endpoint information structure. More... | |
| struct | _usb_host_interface |
| USB host interface information structure. More... | |
| struct | _usb_host_configuration |
| USB host configuration information structure. More... | |
| struct | _usb_host_pipe |
| USB host pipe common structure. More... | |
| struct | _usb_host_transfer |
| USB host transfer structure. More... | |
| struct | _usb_host_pipe_init |
| USB host pipe information structure for opening pipe. More... | |
| struct | _usb_host_cancel_param |
| Cancel transfer parameter structure. More... | |
| struct | _usb_host_device_instance |
| Device instance. More... | |
| struct | _usb_host_instance |
| USB host instance structure. More... | |
Typedefs | |
| typedef void * | usb_host_class_handle |
| USB host class handle type define. | |
| typedef void * | usb_host_controller_handle |
| USB host controller handle type define. | |
| typedef void * | usb_host_configuration_handle |
| USB host configuration handle type define. | |
| typedef void * | usb_host_interface_handle |
| USB host interface handle type define. | |
| typedef void * | usb_host_pipe_handle |
| USB host pipe handle type define. | |
| typedef enum _usb_host_event | usb_host_event_t |
| Event codes for device attach/detach. | |
| typedef enum _usb_host_dev_info | usb_host_dev_info_t |
| USB host device information code. | |
| typedef enum _usb_host_request_type | usb_host_request_type_t |
| Request type. | |
| typedef struct _usb_host_process_descriptor_param | usb_host_process_descriptor_param_t |
| For USB_REQUEST_STANDARD_GET_DESCRIPTOR and USB_REQUEST_STANDARD_SET_DESCRIPTOR. | |
| typedef struct _usb_host_process_feature_param | usb_host_process_feature_param_t |
| For USB_REQUEST_STANDARD_CLEAR_FEATURE and USB_REQUEST_STANDARD_SET_FEATURE. | |
| typedef struct _usb_host_get_interface_param | usb_host_get_interface_param_t |
| For USB_REQUEST_STANDARD_GET_INTERFACE. | |
| typedef struct _usb_host_get_status_param | usb_host_get_status_param_t |
| For USB_REQUEST_STANDARD_GET_STATUS. | |
| typedef struct _usb_host_set_interface_param | usb_host_set_interface_param_t |
| For USB_REQUEST_STANDARD_SET_INTERFACE. | |
| typedef struct _usb_host_synch_frame_param | usb_host_synch_frame_param_t |
| For USB_REQUEST_STANDARD_SYNCH_FRAME. | |
| typedef usb_status_t(* | host_callback_t) (usb_device_handle deviceHandle, usb_host_configuration_handle configurationHandle, uint32_t eventCode) |
| Host callback function typedef. | |
| typedef void(* | transfer_callback_t) (void *param, uint8_t *data, uint32_t dataLen, usb_status_t status) |
| Transfer callback function typedef. | |
| typedef void(* | host_inner_transfer_callback_t) (void *param, struct _usb_host_transfer *transfer, usb_status_t status) |
| Host stack inner transfer callback function typedef. | |
| typedef struct _usb_host_ep | usb_host_ep_t |
| USB host endpoint information structure. | |
| typedef struct _usb_host_interface | usb_host_interface_t |
| USB host interface information structure. | |
| typedef struct _usb_host_configuration | usb_host_configuration_t |
| USB host configuration information structure. | |
| typedef struct _usb_host_pipe | usb_host_pipe_t |
| USB host pipe common structure. | |
| typedef struct _usb_host_transfer | usb_host_transfer_t |
| USB host transfer structure. | |
| typedef struct _usb_host_pipe_init | usb_host_pipe_init_t |
| USB host pipe information structure for opening pipe. | |
| typedef struct _usb_host_cancel_param | usb_host_cancel_param_t |
| Cancel transfer parameter structure. | |
| typedef enum _usb_host_device_enumeration_status | usb_host_device_enumeration_status_t |
| States of device instances enumeration. | |
| typedef enum _usb_host_interface_state | usb_host_interface_state_t |
| States of device's interface. | |
| typedef enum _usb_host_device_state | usb_host_device_state_t |
| States of device. | |
| typedef struct _usb_host_device_instance | usb_host_device_instance_t |
| Device instance. | |
| typedef struct _usb_host_instance | usb_host_instance_t |
| USB host instance structure. | |
Functions | |
| usb_status_t | USB_HostAttachDevice (usb_host_handle hostHandle, uint8_t speed, uint8_t hubNumber, uint8_t portNumber, uint8_t level, usb_device_handle *deviceHandle) |
| Calls this function when device attach. | |
| usb_status_t | USB_HostDetachDevice (usb_host_handle hostHandle, uint8_t hubNumber, uint8_t portNumber) |
| Call this function when device detaches. | |
| usb_status_t | USB_HostDetachDeviceInternal (usb_host_handle hostHandle, usb_device_handle deviceHandle) |
| Call this function when device detaches. | |
| uint8_t | USB_HostGetDeviceAttachState (usb_device_handle deviceHandle) |
| Gets the device attach/detach state. | |
| usb_status_t | USB_HostValidateDevice (usb_host_handle hostHandle, usb_device_handle deviceHandle) |
| Determine whether the device is attached. | |
Variables | |
| usb_host_instance_t | g_UsbHostInstance [USB_HOST_CONFIG_MAX_HOST] |
| USB host instance resource. | |
USB host APIs Part 1 | |
The following APIs are recommended for application use. | |
| usb_status_t | USB_HostInit (uint8_t controllerId, usb_host_handle *hostHandle, host_callback_t callbackFn) |
| Initializes the USB host stack. | |
| usb_status_t | USB_HostDeinit (usb_host_handle hostHandle) |
| Deinitializes the USB host stack. | |
| usb_status_t | USB_HostHelperGetPeripheralInformation (usb_device_handle deviceHandle, uint32_t infoCode, uint32_t *infoValue) |
| Gets the device information. | |
| usb_status_t | USB_HostHelperParseAlternateSetting (usb_host_interface_handle interfaceHandle, uint8_t alternateSetting, usb_host_interface_t *interface) |
| Parses the alternate interface descriptor. | |
| usb_status_t | USB_HostRemoveDevice (usb_host_handle hostHandle, usb_device_handle deviceHandle) |
| Removes the attached device. | |
USB host APIs Part 2. | |
The following APIs are not recommended for application use. They are mainly used in the class driver. | |
| usb_status_t | USB_HostOpenPipe (usb_host_handle hostHandle, usb_host_pipe_handle *pipeHandle, usb_host_pipe_init_t *pipeInit) |
| Opens the USB host pipe. | |
| usb_status_t | USB_HostClosePipe (usb_host_handle hostHandle, usb_host_pipe_handle pipeHandle) |
| Closes the USB host pipe. | |
| usb_status_t | USB_HostSend (usb_host_handle hostHandle, usb_host_pipe_handle pipeHandle, usb_host_transfer_t *transfer) |
| Sends data to a pipe. | |
| usb_status_t | USB_HostSendSetup (usb_host_handle hostHandle, usb_host_pipe_handle pipeHandle, usb_host_transfer_t *transfer) |
| Sends a setup transfer to the pipe. | |
| usb_status_t | USB_HostRecv (usb_host_handle hostHandle, usb_host_pipe_handle pipeHandle, usb_host_transfer_t *transfer) |
| Receives the data from the pipe. | |
| usb_status_t | USB_HostCancelTransfer (usb_host_handle hostHandle, usb_host_pipe_handle pipeHandle, usb_host_transfer_t *transfer) |
| Cancel the pipe's transfers. | |
| usb_status_t | USB_HostMallocTransfer (usb_host_handle hostHandle, usb_host_transfer_t **transfer) |
| Allocates a transfer resource. | |
| usb_status_t | USB_HostFreeTransfer (usb_host_handle hostHandle, usb_host_transfer_t *transfer) |
| Frees a transfer resource. | |
| usb_status_t | USB_HostRequestControl (usb_device_handle deviceHandle, uint8_t usbRequest, usb_host_transfer_t *transfer, void *param) |
| Requests the USB standard request. | |
| usb_status_t | USB_HostOpenDeviceInterface (usb_device_handle deviceHandle, usb_host_interface_handle interfaceHandle) |
| Opens the interface. | |
| usb_status_t | USB_HostCloseDeviceInterface (usb_device_handle deviceHandle, usb_host_interface_handle interfaceHandle) |
| Closes an interface. | |
| void | USB_HostGetVersion (uint32_t *version) |
| Gets a host stack version function. | |
| typedef usb_status_t(* host_callback_t) (usb_device_handle deviceHandle, usb_host_configuration_handle configurationHandle, uint32_t eventCode) |
#include <usb_host.h>
Host callback function typedef.
This callback function is used to notify application device attach/detach event. This callback pointer is passed when initializing the host.
| deviceHandle | The device handle, which indicates the attached device. |
| configurationHandle | The configuration handle contains the attached device's configuration information. |
| event_code | The callback event code; See the enumeration host_event_t. |
| kStatus_USB_Success | Application handles the attached device successfully. |
| kStatus_USB_NotSupported | Application don't support the attached device. |
| kStatus_USB_Error | Application handles the attached device falsely. |
| typedef void(* host_inner_transfer_callback_t) (void *param, struct _usb_host_transfer *transfer, usb_status_t status) |
#include <usb_host.h>
Host stack inner transfer callback function typedef.
This callback function is used to notify the upper layer the result of a transfer. This callback pointer is passed when initializing the structure usb_host_transfer_t.
| param | The parameter pointer, which is passed when calling the send/receive APIs. |
| transfer | The transfer information; See the structure usb_host_transfer_t. |
| status | A USB error code or kStatus_USB_Success. |
| typedef void(* transfer_callback_t) (void *param, uint8_t *data, uint32_t dataLen, usb_status_t status) |
#include <usb_host.h>
Transfer callback function typedef.
This callback function is used to notify the upper layer the result of the transfer. This callback pointer is passed when calling the send/receive APIs.
| param | The parameter pointer, which is passed when calling the send/receive APIs. |
| data | The data buffer pointer. |
| data_len | The result data length. |
| status | A USB error code or kStatus_USB_Success. |
| enum _usb_host_dev_info |
#include <usb_host.h>
USB host device information code.
#include <usb_host_devices.h>
States of device instances enumeration.
| enum _usb_host_event |
#include <usb_host.h>
Event codes for device attach/detach.
|
extern |
#include <usb_host_devices.h>
Calls this function when device attach.
| hostHandle | Host instance handle. |
| speed | Device speed. |
| hubNumber | Device hub no. root device's hub no. is 0. |
| portNumber | Device port no. root device's port no. is 0. |
| level | Device level. root device's level is 1. |
| deviceHandle | Return device handle. |
|
extern |
#include <usb_host.h>
Cancel the pipe's transfers.
This function cancels all pipe's transfers when the parameter transfer is NULL or cancels the transfers altogether.
| [in] | hostHandle | The host handle. |
| [in] | pipeHandle | The receiving pipe handle. |
| [in] | transfer | The transfer information. |
| kStatus_USB_Success | Cancel successfully. |
| kStatus_USB_InvalidHandle | The hostHandle or pipeHandle is a NULL pointer. |
|
extern |
#include <usb_host.h>
Closes an interface.
This function opens an interface. It is used to notify the host driver the interface is not used by APP or class driver.
| [in] | deviceHandle | Removing device handle. |
| [in] | interfaceHandle | Opening interface handle. |
| kStatus_USB_Success | Close successfully. |
| kStatus_USB_InvalidHandle | The deviceHandle is a NULL pointer. |
|
extern |
#include <usb_host.h>
Closes the USB host pipe.
This function closes a pipe and frees the related resources.
| [in] | hostHandle | The host handle. |
| [in] | pipeHandle | The closing pipe handle. |
| kStatus_USB_Success | The host is initialized successfully. |
| kStatus_USB_InvalidHandle | The hostHandle or pipeHandle is a NULL pointer. |
|
extern |
#include <usb_host.h>
Deinitializes the USB host stack.
This function deinitializes the USB host module specified by the hostHandle.
| [in] | hostHandle | The host handle. |
| kStatus_USB_Success | The host is initialized successfully. |
| kStatus_USB_InvalidHandle | The hostHandle is a NULL pointer. |
| kStatus_USB_Error | Controller deinitialization fail. |
|
extern |
#include <usb_host_devices.h>
Call this function when device detaches.
| hostHandle | Host instance handle. |
| hubNumber | Device hub no. root device's hub no. is 0. |
| portNumber | Device port no. root device's port no. is 0. |
|
extern |
#include <usb_host_devices.h>
Call this function when device detaches.
| hostHandle | Host instance handle. |
| deviceHandle | Device handle. |
|
extern |
#include <usb_host.h>
Frees a transfer resource.
This function frees a transfer. This transfer is used to pass data information to a low level stack.
| [in] | hostHandle | The host handle. |
| [in] | transfer | Release the transfer. |
| kStatus_USB_Success | Free successfully. |
| kStatus_USB_InvalidHandle | The hostHandle or transfer is a NULL pointer. |
|
extern |
#include <usb_host_devices.h>
Gets the device attach/detach state.
| deviceHandle | Device handle. |
|
extern |
#include <usb_host.h>
Gets a host stack version function.
The function is used to get the host stack version.
| [out] | version | The version structure pointer to keep the host stack version. |
|
extern |
#include <usb_host.h>
Gets the device information.
This function gets the device information.
| [in] | deviceHandle | Removing device handle. |
| [in] | infoCode | See the enumeration host_dev_info_t. |
| [out] | infoValue | Return the information value. |
| kStatus_USB_Success | Close successfully. |
| kStatus_USB_InvalidParameter | The deviceHandle or info_value is a NULL pointer. |
| kStatus_USB_Error | The info_code is not the host_dev_info_t value. |
|
extern |
#include <usb_host.h>
Parses the alternate interface descriptor.
This function parses the alternate interface descriptor and returns an interface information through the structure usb_host_interface_t.
| [in] | interfaceHandle | The whole interface handle. |
| [in] | alternateSetting | Alternate setting value. |
| [out] | interface | Return interface information. |
| kStatus_USB_Success | Close successfully. |
| kStatus_USB_InvalidHandle | The interfaceHandle is a NULL pointer. |
| kStatus_USB_InvalidParameter | The alternateSetting is 0. |
| kStatus_USB_Error | The interface descriptor is wrong. |
|
extern |
#include <usb_host.h>
Initializes the USB host stack.
This function initializes the USB host module specified by the controllerId.
| [in] | controllerId | The controller ID of the USB IP. See the enumeration usb_controller_index_t. |
| [out] | hostHandle | Returns the host handle. |
| [in] | callbackFn | Host callback function notifies device attach/detach. |
| kStatus_USB_Success | The host is initialized successfully. |
| kStatus_USB_InvalidHandle | The hostHandle is a NULL pointer. |
| kStatus_USB_ControllerNotFound | Cannot find the controller according to the controller ID. |
| kStatus_USB_AllocFail | Allocation memory fail. |
| kStatus_USB_Error | Host mutex create fail; KHCI/EHCI mutex or KHCI/EHCI event create fail, or, KHCI/EHCI IP initialize fail. |
|
extern |
#include <usb_host.h>
Allocates a transfer resource.
This function allocates a transfer. This transfer is used to pass data information to a low level stack.
| [in] | hostHandle | The host handle. |
| [out] | transfer | Return the transfer. |
| kStatus_USB_Success | Allocate successfully. |
| kStatus_USB_InvalidHandle | The hostHandle or transfer is a NULL pointer. |
| kStatus_USB_Error | There is no idle transfer. |
|
extern |
#include <usb_host.h>
Opens the interface.
This function opens the interface. It is used to notify the host driver the interface is used by APP or class driver.
| [in] | deviceHandle | Removing device handle. |
| [in] | interfaceHandle | Opening interface handle. |
| kStatus_USB_Success | Open successfully. |
| kStatus_USB_InvalidHandle | The deviceHandle or interfaceHandle is a NULL pointer. |
|
extern |
#include <usb_host.h>
Opens the USB host pipe.
This function opens a pipe according to the pipe_init_ptr parameter.
| [in] | hostHandle | The host handle. |
| [out] | pipeHandle | The pipe handle pointer used to return the pipe handle. |
| [in] | pipeInit | Used to initialize the pipe. |
| kStatus_USB_Success | The host is initialized successfully. |
| kStatus_USB_InvalidHandle | The hostHandle or pipe_handle_ptr is a NULL pointer. |
| kStatus_USB_Error | There is no idle pipe. Or, there is no idle QH for EHCI. Or, bandwidth allocate fail for EHCI. |
|
extern |
#include <usb_host.h>
Receives the data from the pipe.
This function requests to receive the transfer from the specified pipe.
| [in] | hostHandle | The host handle. |
| [in] | pipeHandle | The receiving pipe handle. |
| [in] | transfer | The transfer information. |
| kStatus_USB_Success | Receive successfully. |
| kStatus_USB_InvalidHandle | The hostHandle, pipeHandle or transfer is a NULL pointer. |
| kStatus_USB_LackSwapBuffer | There is no swap buffer for KHCI. |
| kStatus_USB_Error | There is no idle QTD/ITD/SITD for EHCI. |
|
extern |
#include <usb_host.h>
Removes the attached device.
This function removes the attached device. This function should not be used all the time.
| [in] | hostHandle | The host handle. |
| [in] | deviceHandle | Removing device handle. |
| kStatus_USB_Success | Remove successfully. |
| kStatus_USB_InvalidHandle | The hostHandle or deviceHandle is a NULL pointer. |
| kStatus_USB_InvalidParameter | The deviceHandle instance don't belong to hostHandle instance. |
|
extern |
#include <usb_host.h>
Requests the USB standard request.
This function sends the USB standard request packet.
| [in] | deviceHandle | The device handle for control transfer. |
| [in] | usbRequest | A USB standard request code. See the usb_spec.h. |
| [in] | transfer | The used transfer. |
| [in] | param | The parameter structure is different for different request, see usb_host_framework.h. |
| kStatus_USB_Success | Send successfully. |
| kStatus_USB_InvalidHandle | The deviceHandle is a NULL pointer. |
| kStatus_USB_LackSwapBuffer | There is no swap buffer for KHCI. |
| kStatus_USB_Error | There is no idle QTD/ITD/SITD for EHCI, Or, the request is not standard request. |
|
extern |
#include <usb_host.h>
Sends data to a pipe.
This function requests to send the transfer to the specified pipe.
| [in] | hostHandle | The host handle. |
| [in] | pipeHandle | The sending pipe handle. |
| [in] | transfer | The transfer information. |
| kStatus_USB_Success | Send successfully. |
| kStatus_USB_InvalidHandle | The hostHandle, pipeHandle or transfer is a NULL pointer. |
| kStatus_USB_LackSwapBuffer | There is no swap buffer for KHCI. |
| kStatus_USB_Error | There is no idle QTD/ITD/SITD for EHCI. |
|
extern |
#include <usb_host.h>
Sends a setup transfer to the pipe.
This function request to send the setup transfer to the specified pipe.
| [in] | hostHandle | The host handle. |
| [in] | pipeHandle | The sending pipe handle. |
| [in] | transfer | The transfer information. |
| kStatus_USB_Success | Send successfully. |
| kStatus_USB_InvalidHandle | The hostHandle, pipeHandle or transfer is a NULL pointer. |
| kStatus_USB_LackSwapBuffer | There is no swap buffer for KHCI. |
| kStatus_USB_Error | There is no idle QTD/ITD/SITD for EHCI. |
|
extern |
#include <usb_host_devices.h>
Determine whether the device is attached.
| hostHandle | Host instance pointer. |
| deviceHandle | Device handle. |