NetBurner 3.5.7
PDF Version
Usb_host_drv

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.
 

Enumerations

enum  _usb_host_event {
  kUSB_HostEventAttach = 1U , kUSB_HostEventDetach , kUSB_HostEventEnumerationDone , kUSB_HostEventNotSupported ,
  kUSB_HostEventEnumerationFail
}
 Event codes for device attach/detach. More...
 
enum  _usb_host_dev_info {
  kUSB_HostGetDeviceAddress = 1U , kUSB_HostGetDeviceHubNumber , kUSB_HostGetDevicePortNumber , kUSB_HostGetDeviceSpeed ,
  kUSB_HostGetDeviceHSHubNumber , kUSB_HostGetDeviceHSHubPort , kUSB_HostGetDeviceLevel , kUSB_HostGetHostHandle ,
  kUSB_HostGetDeviceControlPipe , kUSB_HostGetDevicePID , kUSB_HostGetDeviceVID , kUSB_HostGetHubThinkTime ,
  kUSB_HostGetDeviceConfigIndex , kUSB_HostGetConfigurationDes , kUSB_HostGetConfigurationLength
}
 USB host device information code. More...
 
enum  _usb_host_request_type { kRequestDevice = 1U , kRequestInterface , kRequestEndpoint }
 Request type. More...
 
enum  _usb_host_device_enumeration_status {
  kStatus_DEV_Notinit = 0 , kStatus_DEV_Initial , kStatus_DEV_GetDes8 , kStatus_DEV_SetAddress ,
  kStatus_DEV_GetDes , kStatus_DEV_GetCfg9 , kStatus_DEV_GetCfg , kStatus_DEV_SetCfg ,
  kStatus_DEV_EnumDone , kStatus_DEV_AppUsed
}
 States of device instances enumeration. More...
 
enum  _usb_host_interface_state { kStatus_interface_Attached = 1 , kStatus_interface_Opened , kStatus_interface_Detached }
 States of device's interface. More...
 
enum  _usb_host_device_state { kStatus_device_Detached = 0 , kStatus_device_Attached }
 States of device. More...
 

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.
 

Detailed Description

Typedef Documentation

◆ host_callback_t

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.

Parameters
deviceHandleThe device handle, which indicates the attached device.
configurationHandleThe configuration handle contains the attached device's configuration information.
event_codeThe callback event code; See the enumeration host_event_t.
Returns
A USB error code or kStatus_USB_Success.
Return values
kStatus_USB_SuccessApplication handles the attached device successfully.
kStatus_USB_NotSupportedApplication don't support the attached device.
kStatus_USB_ErrorApplication handles the attached device falsely.

◆ host_inner_transfer_callback_t

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.

Parameters
paramThe parameter pointer, which is passed when calling the send/receive APIs.
transferThe transfer information; See the structure usb_host_transfer_t.
statusA USB error code or kStatus_USB_Success.

◆ transfer_callback_t

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.

Parameters
paramThe parameter pointer, which is passed when calling the send/receive APIs.
dataThe data buffer pointer.
data_lenThe result data length.
statusA USB error code or kStatus_USB_Success.

Enumeration Type Documentation

◆ _usb_host_dev_info

#include <usb_host.h>

USB host device information code.

Enumerator
kUSB_HostGetDeviceAddress 

Device's address

kUSB_HostGetDeviceHubNumber 

Device's first hub address

kUSB_HostGetDevicePortNumber 

Device's first hub port number

kUSB_HostGetDeviceSpeed 

Device's speed

kUSB_HostGetDeviceHSHubNumber 

Device's first high-speed hub address

kUSB_HostGetDeviceHSHubPort 

Device's first high-speed hub number

kUSB_HostGetDeviceLevel 

Device's hub level

kUSB_HostGetHostHandle 

Device's host handle

kUSB_HostGetDeviceControlPipe 

Device's control pipe handle

kUSB_HostGetDevicePID 

Device's PID

kUSB_HostGetDeviceVID 

Device's VID

kUSB_HostGetHubThinkTime 

Device's hub total think time

kUSB_HostGetDeviceConfigIndex 

Device's running zero-based config index

kUSB_HostGetConfigurationDes 

Device's configuration descriptor pointer

kUSB_HostGetConfigurationLength 

Device's configuration descriptor pointer

◆ _usb_host_device_enumeration_status

#include <usb_host_devices.h>

States of device instances enumeration.

Enumerator
kStatus_DEV_Notinit 

Device is invalid

kStatus_DEV_Initial 

Device has been processed by host driver

kStatus_DEV_GetDes8 

Enumeration process: get 8 bytes' device descriptor

kStatus_DEV_SetAddress 

Enumeration process: set device address

kStatus_DEV_GetDes 

Enumeration process: get device descriptor

kStatus_DEV_GetCfg9 

Enumeration process: get 9 bytes' configuration descriptor

kStatus_DEV_GetCfg 

Enumeration process: get configuration descriptor

kStatus_DEV_SetCfg 

Enumeration process: set configuration

kStatus_DEV_EnumDone 

Enumeration is done

kStatus_DEV_AppUsed 

This device has been used by application

◆ _usb_host_device_state

#include <usb_host_devices.h>

States of device.

Enumerator
kStatus_device_Detached 

Device is used by application

kStatus_device_Attached 

Device's default status

◆ _usb_host_event

#include <usb_host.h>

Event codes for device attach/detach.

Enumerator
kUSB_HostEventAttach 

Device is attached

kUSB_HostEventDetach 

Device is detached

kUSB_HostEventEnumerationDone 

Device's enumeration is done and the device is supported

kUSB_HostEventNotSupported 

Device's enumeration is done and the device is not supported

kUSB_HostEventEnumerationFail 

Device's enumeration failed due to errors fail reason is put in the high 2 bytes of callback event code. kStatus_USB_TransferFailed - the transfer failed. kStatus_USB_TransferCancel - transfer is canceled by application. kStatus_USB_Error - parsing descriptor failed, the power cannot satisfy device's requirement, device addresss allocation failed, transfer is not enough or the transfer API failed. kStatus_USB_AllocFail - malloc failed.

◆ _usb_host_interface_state

#include <usb_host_devices.h>

States of device's interface.

Enumerator
kStatus_interface_Attached 

Interface's default status

kStatus_interface_Opened 

Interface is used by application

kStatus_interface_Detached 

Interface is not used by application

◆ _usb_host_request_type

#include <usb_host.h>

Request type.

Enumerator
kRequestDevice 

Control request object is device

kRequestInterface 

Control request object is interface

kRequestEndpoint 

Control request object is endpoint

Function Documentation

◆ USB_HostAttachDevice()

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 )
extern

#include <usb_host_devices.h>

Calls this function when device attach.

Parameters
hostHandleHost instance handle.
speedDevice speed.
hubNumberDevice hub no. root device's hub no. is 0.
portNumberDevice port no. root device's port no. is 0.
levelDevice level. root device's level is 1.
deviceHandleReturn device handle.
Returns
kStatus_USB_Success or error codes.

◆ USB_HostCancelTransfer()

usb_status_t USB_HostCancelTransfer ( usb_host_handle hostHandle,
usb_host_pipe_handle pipeHandle,
usb_host_transfer_t * transfer )
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.

Parameters
[in]hostHandleThe host handle.
[in]pipeHandleThe receiving pipe handle.
[in]transferThe transfer information.
Return values
kStatus_USB_SuccessCancel successfully.
kStatus_USB_InvalidHandleThe hostHandle or pipeHandle is a NULL pointer.

◆ USB_HostCloseDeviceInterface()

usb_status_t USB_HostCloseDeviceInterface ( usb_device_handle deviceHandle,
usb_host_interface_handle interfaceHandle )
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.

Parameters
[in]deviceHandleRemoving device handle.
[in]interfaceHandleOpening interface handle.
Return values
kStatus_USB_SuccessClose successfully.
kStatus_USB_InvalidHandleThe deviceHandle is a NULL pointer.

◆ USB_HostClosePipe()

usb_status_t USB_HostClosePipe ( usb_host_handle hostHandle,
usb_host_pipe_handle pipeHandle )
extern

#include <usb_host.h>

Closes the USB host pipe.

This function closes a pipe and frees the related resources.

Parameters
[in]hostHandleThe host handle.
[in]pipeHandleThe closing pipe handle.
Return values
kStatus_USB_SuccessThe host is initialized successfully.
kStatus_USB_InvalidHandleThe hostHandle or pipeHandle is a NULL pointer.

◆ USB_HostDeinit()

usb_status_t USB_HostDeinit ( usb_host_handle hostHandle)
extern

#include <usb_host.h>

Deinitializes the USB host stack.

This function deinitializes the USB host module specified by the hostHandle.

Parameters
[in]hostHandleThe host handle.
Return values
kStatus_USB_SuccessThe host is initialized successfully.
kStatus_USB_InvalidHandleThe hostHandle is a NULL pointer.
kStatus_USB_ErrorController deinitialization fail.

◆ USB_HostDetachDevice()

usb_status_t USB_HostDetachDevice ( usb_host_handle hostHandle,
uint8_t hubNumber,
uint8_t portNumber )
extern

#include <usb_host_devices.h>

Call this function when device detaches.

Parameters
hostHandleHost instance handle.
hubNumberDevice hub no. root device's hub no. is 0.
portNumberDevice port no. root device's port no. is 0.
Returns
kStatus_USB_Success or error codes.

◆ USB_HostDetachDeviceInternal()

usb_status_t USB_HostDetachDeviceInternal ( usb_host_handle hostHandle,
usb_device_handle deviceHandle )
extern

#include <usb_host_devices.h>

Call this function when device detaches.

Parameters
hostHandleHost instance handle.
deviceHandleDevice handle.
Returns
kStatus_USB_Success or error codes.

◆ USB_HostFreeTransfer()

usb_status_t USB_HostFreeTransfer ( usb_host_handle hostHandle,
usb_host_transfer_t * transfer )
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.

Parameters
[in]hostHandleThe host handle.
[in]transferRelease the transfer.
Return values
kStatus_USB_SuccessFree successfully.
kStatus_USB_InvalidHandleThe hostHandle or transfer is a NULL pointer.

◆ USB_HostGetDeviceAttachState()

uint8_t USB_HostGetDeviceAttachState ( usb_device_handle deviceHandle)
extern

#include <usb_host_devices.h>

Gets the device attach/detach state.

Parameters
deviceHandleDevice handle.
Returns
0x01 - attached; 0x00 - detached.

◆ USB_HostGetVersion()

void USB_HostGetVersion ( uint32_t * version)
extern

#include <usb_host.h>

Gets a host stack version function.

The function is used to get the host stack version.

Parameters
[out]versionThe version structure pointer to keep the host stack version.

◆ USB_HostHelperGetPeripheralInformation()

usb_status_t USB_HostHelperGetPeripheralInformation ( usb_device_handle deviceHandle,
uint32_t infoCode,
uint32_t * infoValue )
extern

#include <usb_host.h>

Gets the device information.

This function gets the device information.

Parameters
[in]deviceHandleRemoving device handle.
[in]infoCodeSee the enumeration host_dev_info_t.
[out]infoValueReturn the information value.
Return values
kStatus_USB_SuccessClose successfully.
kStatus_USB_InvalidParameterThe deviceHandle or info_value is a NULL pointer.
kStatus_USB_ErrorThe info_code is not the host_dev_info_t value.

◆ USB_HostHelperParseAlternateSetting()

usb_status_t USB_HostHelperParseAlternateSetting ( usb_host_interface_handle interfaceHandle,
uint8_t alternateSetting,
usb_host_interface_t * interface )
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.

Parameters
[in]interfaceHandleThe whole interface handle.
[in]alternateSettingAlternate setting value.
[out]interfaceReturn interface information.
Return values
kStatus_USB_SuccessClose successfully.
kStatus_USB_InvalidHandleThe interfaceHandle is a NULL pointer.
kStatus_USB_InvalidParameterThe alternateSetting is 0.
kStatus_USB_ErrorThe interface descriptor is wrong.

◆ USB_HostInit()

usb_status_t USB_HostInit ( uint8_t controllerId,
usb_host_handle * hostHandle,
host_callback_t callbackFn )
extern

#include <usb_host.h>

Initializes the USB host stack.

This function initializes the USB host module specified by the controllerId.

Parameters
[in]controllerIdThe controller ID of the USB IP. See the enumeration usb_controller_index_t.
[out]hostHandleReturns the host handle.
[in]callbackFnHost callback function notifies device attach/detach.
Return values
kStatus_USB_SuccessThe host is initialized successfully.
kStatus_USB_InvalidHandleThe hostHandle is a NULL pointer.
kStatus_USB_ControllerNotFoundCannot find the controller according to the controller ID.
kStatus_USB_AllocFailAllocation memory fail.
kStatus_USB_ErrorHost mutex create fail; KHCI/EHCI mutex or KHCI/EHCI event create fail, or, KHCI/EHCI IP initialize fail.

◆ USB_HostMallocTransfer()

usb_status_t USB_HostMallocTransfer ( usb_host_handle hostHandle,
usb_host_transfer_t ** transfer )
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.

Parameters
[in]hostHandleThe host handle.
[out]transferReturn the transfer.
Return values
kStatus_USB_SuccessAllocate successfully.
kStatus_USB_InvalidHandleThe hostHandle or transfer is a NULL pointer.
kStatus_USB_ErrorThere is no idle transfer.

◆ USB_HostOpenDeviceInterface()

usb_status_t USB_HostOpenDeviceInterface ( usb_device_handle deviceHandle,
usb_host_interface_handle interfaceHandle )
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.

Parameters
[in]deviceHandleRemoving device handle.
[in]interfaceHandleOpening interface handle.
Return values
kStatus_USB_SuccessOpen successfully.
kStatus_USB_InvalidHandleThe deviceHandle or interfaceHandle is a NULL pointer.

◆ USB_HostOpenPipe()

usb_status_t USB_HostOpenPipe ( usb_host_handle hostHandle,
usb_host_pipe_handle * pipeHandle,
usb_host_pipe_init_t * pipeInit )
extern

#include <usb_host.h>

Opens the USB host pipe.

This function opens a pipe according to the pipe_init_ptr parameter.

Parameters
[in]hostHandleThe host handle.
[out]pipeHandleThe pipe handle pointer used to return the pipe handle.
[in]pipeInitUsed to initialize the pipe.
Return values
kStatus_USB_SuccessThe host is initialized successfully.
kStatus_USB_InvalidHandleThe hostHandle or pipe_handle_ptr is a NULL pointer.
kStatus_USB_ErrorThere is no idle pipe. Or, there is no idle QH for EHCI. Or, bandwidth allocate fail for EHCI.

◆ USB_HostRecv()

usb_status_t USB_HostRecv ( usb_host_handle hostHandle,
usb_host_pipe_handle pipeHandle,
usb_host_transfer_t * transfer )
extern

#include <usb_host.h>

Receives the data from the pipe.

This function requests to receive the transfer from the specified pipe.

Parameters
[in]hostHandleThe host handle.
[in]pipeHandleThe receiving pipe handle.
[in]transferThe transfer information.
Return values
kStatus_USB_SuccessReceive successfully.
kStatus_USB_InvalidHandleThe hostHandle, pipeHandle or transfer is a NULL pointer.
kStatus_USB_LackSwapBufferThere is no swap buffer for KHCI.
kStatus_USB_ErrorThere is no idle QTD/ITD/SITD for EHCI.

◆ USB_HostRemoveDevice()

usb_status_t USB_HostRemoveDevice ( usb_host_handle hostHandle,
usb_device_handle deviceHandle )
extern

#include <usb_host.h>

Removes the attached device.

This function removes the attached device. This function should not be used all the time.

Parameters
[in]hostHandleThe host handle.
[in]deviceHandleRemoving device handle.
Return values
kStatus_USB_SuccessRemove successfully.
kStatus_USB_InvalidHandleThe hostHandle or deviceHandle is a NULL pointer.
kStatus_USB_InvalidParameterThe deviceHandle instance don't belong to hostHandle instance.

◆ USB_HostRequestControl()

usb_status_t USB_HostRequestControl ( usb_device_handle deviceHandle,
uint8_t usbRequest,
usb_host_transfer_t * transfer,
void * param )
extern

#include <usb_host.h>

Requests the USB standard request.

This function sends the USB standard request packet.

Parameters
[in]deviceHandleThe device handle for control transfer.
[in]usbRequestA USB standard request code. See the usb_spec.h.
[in]transferThe used transfer.
[in]paramThe parameter structure is different for different request, see usb_host_framework.h.
Return values
kStatus_USB_SuccessSend successfully.
kStatus_USB_InvalidHandleThe deviceHandle is a NULL pointer.
kStatus_USB_LackSwapBufferThere is no swap buffer for KHCI.
kStatus_USB_ErrorThere is no idle QTD/ITD/SITD for EHCI, Or, the request is not standard request.

◆ USB_HostSend()

usb_status_t USB_HostSend ( usb_host_handle hostHandle,
usb_host_pipe_handle pipeHandle,
usb_host_transfer_t * transfer )
extern

#include <usb_host.h>

Sends data to a pipe.

This function requests to send the transfer to the specified pipe.

Parameters
[in]hostHandleThe host handle.
[in]pipeHandleThe sending pipe handle.
[in]transferThe transfer information.
Return values
kStatus_USB_SuccessSend successfully.
kStatus_USB_InvalidHandleThe hostHandle, pipeHandle or transfer is a NULL pointer.
kStatus_USB_LackSwapBufferThere is no swap buffer for KHCI.
kStatus_USB_ErrorThere is no idle QTD/ITD/SITD for EHCI.

◆ USB_HostSendSetup()

usb_status_t USB_HostSendSetup ( usb_host_handle hostHandle,
usb_host_pipe_handle pipeHandle,
usb_host_transfer_t * transfer )
extern

#include <usb_host.h>

Sends a setup transfer to the pipe.

This function request to send the setup transfer to the specified pipe.

Parameters
[in]hostHandleThe host handle.
[in]pipeHandleThe sending pipe handle.
[in]transferThe transfer information.
Return values
kStatus_USB_SuccessSend successfully.
kStatus_USB_InvalidHandleThe hostHandle, pipeHandle or transfer is a NULL pointer.
kStatus_USB_LackSwapBufferThere is no swap buffer for KHCI.
kStatus_USB_ErrorThere is no idle QTD/ITD/SITD for EHCI.

◆ USB_HostValidateDevice()

usb_status_t USB_HostValidateDevice ( usb_host_handle hostHandle,
usb_device_handle deviceHandle )
extern

#include <usb_host_devices.h>

Determine whether the device is attached.

Parameters
hostHandleHost instance pointer.
deviceHandleDevice handle.
Returns
kStatus_USB_Success or error codes.