USBLibAPIGuide  1.00.00.01
Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
Usblib_hcd

Data Structures

struct  tUSBHostClassDriver
 

Macros

#define USBHCD_PIPE_UNUSED   0x00100000
 
#define USBHCD_PIPE_CONTROL   0x00130000
 
#define USBHCD_PIPE_BULK_OUT   0x00210000
 
#define USBHCD_PIPE_BULK_IN   0x00220000
 
#define USBHCD_PIPE_INTR_OUT   0x00410000
 
#define USBHCD_PIPE_INTR_IN   0x00420000
 
#define USBHCD_PIPE_ISOC_OUT   0x00810000
 
#define USBHCD_PIPE_ISOC_IN   0x00820000
 
#define USBHCD_PIPE_ISOC_OUT_DMA   0x01810000
 
#define USBHCD_PIPE_ISOC_IN_DMA   0x01820000
 
#define USBHCD_PIPE_BULK_OUT_DMA   0x01210000
 
#define USBHCD_PIPE_BULK_IN_DMA   0x01220000
 
#define USBHCD_FAULT_LOW   0x00000010
 
#define USBHCD_FAULT_HIGH   0x00000030
 
#define USBHCD_FAULT_VBUS_NONE   0x00000000
 
#define USBHCD_FAULT_VBUS_TRI   0x00000140
 
#define USBHCD_FAULT_VBUS_DIS   0x00000400
 
#define USBHCD_VBUS_MANUAL   0x00000004
 
#define USBHCD_VBUS_AUTO_LOW   0x00000002
 
#define USBHCD_VBUS_AUTO_HIGH   0x00000003
 
#define USBHCD_VBUS_FILTER   0x00010000
 
#define USBHCD_LPM_AVAIL   0x00000000
 
#define USBHCD_LPM_ERROR   0x00000001
 
#define USBHCD_LPM_PENDING   0x00000002
 
#define DECLARE_EVENT_DRIVER(VarName, pfnOpen, pfnClose, pfnEvent)
 
#define USB_HOST_PWREN_AUTO   0x00000002
 
#define INT_EVENT_VBUS_ERR   0x01
 
#define INT_EVENT_CONNECT   0x02
 
#define INT_EVENT_DISCONNECT   0x04
 
#define INT_EVENT_POWER_FAULT   0x08
 
#define INT_EVENT_SOF   0x10
 
#define INT_EVENT_ENUM   0x20
 
#define INT_EVENT_LPM_PEND   0x40
 
#define INT_EVENT_LPM   0x80
 
#define USBHDEV_FLAG_NOTIFYINT   0x00000001
 
#define USBHDEV_FLAG_LPMPEND   0x00000002
 
#define USBHDEV_FLAG_LPMERROR   0x00000004
 
#define USBHDEV_FLAG_ALLOCATED   0x80000000
 
#define MAX_NUM_PIPES   15
 
#define MAX_NUM_DMA_CHANNELS   6
 
#define USBHCD_DMA_UNUSED   0xff
 
#define EP_PIPE_TYPE_LOW_SPEED   0x02000000
 
#define EP_PIPE_USE_UDMA   0x01000000
 
#define EP_PIPE_TYPE_ISOC   0x00800000
 
#define EP_PIPE_TYPE_INTR   0x00400000
 
#define EP_PIPE_TYPE_BULK   0x00200000
 
#define EP_PIPE_TYPE_CONTROL   0x00100000
 
#define EP_PIPE_TYPE_IN   0x00020000
 
#define EP_PIPE_TYPE_OUT   0x00010000
 
#define EP_PIPE_IDX_M   0x0000ffff
 
#define OUT_PIPE_HANDLE(ui32Idx)
 
#define IN_PIPE_HANDLE(ui32Idx)
 
#define EP_OFFSET(Endpoint)   (Endpoint - 0x10)
 

Typedefs

typedef void(* tHCDPipeCallback) (uint32_t ui32Pipe, uint32_t ui32Event)
 
typedef struct tUSBHostDevice tUSBHostDevice
 

Enumerations

enum  tEP0State {
  eUSBStateIdle, eUSBStateTx, eUSBStateTxConfig, eUSBStateRx,
  eUSBStateStatus, eUSBStateStall, eEP0StateIdle, eEP0StateSetupIN,
  eEP0StateSetupOUT, eEP0StateRx, eEP0StateStatus, eEP0StateStatusIN,
  eEP0StateStall, eEP0StateError
}
 
enum  tUSBHDeviceState {
  eHCDDevDisconnected, eHCDDevConnected, eHCDDevConnectedHub, eHCDDevRequest,
  eHCDDevReset, eHCDDevAddressed, eHCDDevConfigured, eHCDDevGetStrings,
  eHCDDevError, eHCDVBUSError, eHCDPowerFault, eHCDIdle
}
 

Functions

void OTGDeviceDisconnect (uint32_t ui32Index)
 
uint32_t ConfigDescAlloc (tUSBHostDevice *psDevice, uint32_t ui32Size)
 
void ConfigDescFree (tUSBHostDevice *psDevice)
 
int32_t USBHCDEventEnable (uint32_t ui32Index, void *pvEventDriver, uint32_t ui32Event)
 
int32_t USBHCDEventDisable (uint32_t ui32Index, void *pvEventDriver, uint32_t ui32Event)
 
uint32_t USBHCDPipeTransferSizeGet (uint32_t ui32Pipe)
 
uint32_t USBHCDPipeAllocSize (uint32_t ui32Index, uint32_t ui32EndpointType, tUSBHostDevice *psDevice, uint32_t ui32Size, tHCDPipeCallback pfnCallback)
 
uint32_t USBHCDPipeAlloc (uint32_t ui32Index, uint32_t ui32EndpointType, tUSBHostDevice *psDevice, tHCDPipeCallback pfnCallback)
 
uint32_t USBHCDPipeConfig (uint32_t ui32Pipe, uint32_t ui32MaxPayload, uint32_t ui32Interval, uint32_t ui32TargetEndpoint)
 
uint32_t USBHCDPipeStatus (uint32_t ui32Pipe)
 
uint32_t USBHCDPipeWrite (uint32_t ui32Pipe, uint8_t *pui8Data, uint32_t ui32Size)
 
uint32_t USBHCDPipeSchedule (uint32_t ui32Pipe, uint8_t *pui8Data, uint32_t ui32Size)
 
uint32_t USBHCDPipeReadNonBlocking (uint32_t ui32Pipe, uint8_t *pui8Data, uint32_t ui32Size)
 
void USBHCDPipeDataAck (uint32_t ui32Pipe)
 
uint32_t USBHCDPipeRead (uint32_t ui32Pipe, uint8_t *pui8Data, uint32_t ui32Size)
 
void USBHCDPipeFree (uint32_t ui32Pipe)
 
void USBHCDPowerConfigInit (uint32_t ui32Index, uint32_t ui32PwrConfig)
 
uint32_t USBHCDPowerConfigGet (uint32_t ui32Index)
 
uint32_t USBHCDPowerConfigSet (uint32_t ui32Index, uint32_t ui32Config)
 
uint32_t USBHCDPowerAutomatic (uint32_t ui32Index)
 
void USBHCDInit (uint32_t ui32Index, void *pvPool, uint32_t ui32PoolSize)
 
void USBHCDRegisterDrivers (uint32_t ui32Index, const tUSBHostClassDriver *const *ppsHClassDrvs, uint32_t ui32NumDrivers)
 
void USBHCDTerm (uint32_t ui32Index)
 
void USBHCDReset (uint32_t ui32Index)
 
void USBHCDSuspend (uint32_t ui32Index)
 
void USBHCDResume (uint32_t ui32Index)
 
uint32_t USBHCDStringDescriptorGet (tUSBHostDevice *psDevice, uint8_t *pui8Buffer, uint32_t ui32Size, uint32_t ui32LangID, uint32_t ui32StringIndex)
 
void USBHCDSetAddress (uint32_t ui32DevIndex, uint32_t ui32DevAddress)
 
void USBHCDSetConfig (uint32_t ui32Index, uint32_t ui32Device, uint32_t ui32Configuration)
 
void USBHCDSetInterface (uint32_t ui32Index, uint32_t ui32Device, uint32_t ui32Interface, uint32_t ui32AltSetting)
 
void USBHostCheckPipes (void)
 
void USBHostIntHandlerInternal (uint32_t ui32Index, uint32_t ui32Status)
 
void USB0_IRQHostHandler (void)
 
void InternalUSBHCDSendEvent (uint32_t ui32Index, tEventInfo *psEvent, uint32_t ui32EvFlag)
 
void USBHCDMain (void)
 
uint32_t USBHCDControlTransfer (uint32_t ui32Index, tUSBRequest *psSetupPacket, tUSBHostDevice *psDevice, uint8_t *pui8Data, uint32_t ui32Size, uint32_t ui32MaxPacketSize)
 
uint32_t USBHCDHubDeviceConnected (uint32_t ui32Index, uint8_t ui8Hub, uint8_t ui8Port, uint32_t ui32Speed)
 
void USBHCDHubDeviceDisconnected (uint32_t ui32Index, uint32_t ui32DevIndex)
 
uint8_t USBHCDDevHubPort (uint32_t ui32Instance)
 
uint8_t USBHCDDevAddress (uint32_t ui32Instance)
 
uint8_t USBHCDDevClass (uint32_t ui32Instance, uint32_t ui32Interface)
 
uint8_t USBHCDDevSubClass (uint32_t ui32Instance, uint32_t ui32Interface)
 
uint8_t USBHCDDevProtocol (uint32_t ui32Instance, uint32_t ui32Interface)
 
bool USBHCDFeatureSet (uint32_t ui32Index, uint32_t ui32Feature, void *pvFeature)
 
uint32_t USBHCDLPMStatus (tUSBHostDevice *psDevice)
 
uint32_t USBHCDLPMSleep (tUSBHostDevice *psDevice)
 
void USBHCDLPMResume (uint32_t ui32Index)
 

Variables

tUSBMode g_iUSBMode
 

Detailed Description

Macro Definition Documentation

§ USBHCD_PIPE_UNUSED

#define USBHCD_PIPE_UNUSED   0x00100000

§ USBHCD_PIPE_CONTROL

#define USBHCD_PIPE_CONTROL   0x00130000

§ USBHCD_PIPE_BULK_OUT

#define USBHCD_PIPE_BULK_OUT   0x00210000

§ USBHCD_PIPE_BULK_IN

#define USBHCD_PIPE_BULK_IN   0x00220000

§ USBHCD_PIPE_INTR_OUT

#define USBHCD_PIPE_INTR_OUT   0x00410000

§ USBHCD_PIPE_INTR_IN

#define USBHCD_PIPE_INTR_IN   0x00420000

§ USBHCD_PIPE_ISOC_OUT

#define USBHCD_PIPE_ISOC_OUT   0x00810000

§ USBHCD_PIPE_ISOC_IN

#define USBHCD_PIPE_ISOC_IN   0x00820000

§ USBHCD_PIPE_ISOC_OUT_DMA

#define USBHCD_PIPE_ISOC_OUT_DMA   0x01810000

§ USBHCD_PIPE_ISOC_IN_DMA

#define USBHCD_PIPE_ISOC_IN_DMA   0x01820000

§ USBHCD_PIPE_BULK_OUT_DMA

#define USBHCD_PIPE_BULK_OUT_DMA   0x01210000

§ USBHCD_PIPE_BULK_IN_DMA

#define USBHCD_PIPE_BULK_IN_DMA   0x01220000

§ USBHCD_FAULT_LOW

#define USBHCD_FAULT_LOW   0x00000010

§ USBHCD_FAULT_HIGH

#define USBHCD_FAULT_HIGH   0x00000030

§ USBHCD_FAULT_VBUS_NONE

#define USBHCD_FAULT_VBUS_NONE   0x00000000

§ USBHCD_FAULT_VBUS_TRI

#define USBHCD_FAULT_VBUS_TRI   0x00000140

§ USBHCD_FAULT_VBUS_DIS

#define USBHCD_FAULT_VBUS_DIS   0x00000400

§ USBHCD_VBUS_MANUAL

#define USBHCD_VBUS_MANUAL   0x00000004

§ USBHCD_VBUS_AUTO_LOW

#define USBHCD_VBUS_AUTO_LOW   0x00000002

§ USBHCD_VBUS_AUTO_HIGH

#define USBHCD_VBUS_AUTO_HIGH   0x00000003

§ USBHCD_VBUS_FILTER

#define USBHCD_VBUS_FILTER   0x00010000

§ USBHCD_LPM_AVAIL

#define USBHCD_LPM_AVAIL   0x00000000

Referenced by USBHCDLPMStatus().

§ USBHCD_LPM_ERROR

#define USBHCD_LPM_ERROR   0x00000001

Referenced by USBHCDLPMStatus().

§ USBHCD_LPM_PENDING

#define USBHCD_LPM_PENDING   0x00000002

Referenced by USBHCDLPMStatus().

§ DECLARE_EVENT_DRIVER

#define DECLARE_EVENT_DRIVER (   VarName,
  pfnOpen,
  pfnClose,
  pfnEvent 
)
Value:
void IntFn(void *pvData); \
const tUSBHostClassDriver VarName = \
{ \
USB_CLASS_EVENTS, \
0, \
0, \
pfnEvent \
}
Definition: usbhost.h:156

This macro is used to declare an instance of an Event driver for the USB library.

Parameters
VarNameis the name of the variable.
pfnOpenis the callback for the Open call to this driver. This value is currently reserved and should be set to 0.
pfnCloseis the callback for the Close call to this driver. This value is currently reserved and should be set to 0.
pfnEventis the callback that will be called for various USB events.

The first parameter is the actual name of the variable that will be declared by this macro. The second and third parameter are reserved for future functionality and are unused and should be set to zero. The last parameter is the actual callback function and is specified as a function pointer of the type:

//! void (*pfnEvent)(void *pvData);
//! 
When the \e pfnEvent function is called the void pointer that is passed in
as a parameter should be cast to a pointer to a structure of type
tEventInfo.  This will contain the event that caused the pfnEvent function
to be called.  

§ USB_HOST_PWREN_AUTO

#define USB_HOST_PWREN_AUTO   0x00000002

§ INT_EVENT_VBUS_ERR

#define INT_EVENT_VBUS_ERR   0x01

§ INT_EVENT_CONNECT

#define INT_EVENT_CONNECT   0x02

§ INT_EVENT_DISCONNECT

#define INT_EVENT_DISCONNECT   0x04

§ INT_EVENT_POWER_FAULT

#define INT_EVENT_POWER_FAULT   0x08

§ INT_EVENT_SOF

#define INT_EVENT_SOF   0x10

§ INT_EVENT_ENUM

#define INT_EVENT_ENUM   0x20

§ INT_EVENT_LPM_PEND

#define INT_EVENT_LPM_PEND   0x40

§ INT_EVENT_LPM

#define INT_EVENT_LPM   0x80

§ USBHDEV_FLAG_NOTIFYINT

#define USBHDEV_FLAG_NOTIFYINT   0x00000001

§ USBHDEV_FLAG_LPMPEND

#define USBHDEV_FLAG_LPMPEND   0x00000002

Referenced by USBHCDLPMStatus().

§ USBHDEV_FLAG_LPMERROR

#define USBHDEV_FLAG_LPMERROR   0x00000004

Referenced by USBHCDLPMStatus().

§ USBHDEV_FLAG_ALLOCATED

#define USBHDEV_FLAG_ALLOCATED   0x80000000

§ MAX_NUM_PIPES

#define MAX_NUM_PIPES   15

Referenced by USBHCDPipeAllocSize().

§ MAX_NUM_DMA_CHANNELS

#define MAX_NUM_DMA_CHANNELS   6

§ USBHCD_DMA_UNUSED

#define USBHCD_DMA_UNUSED   0xff

§ EP_PIPE_TYPE_LOW_SPEED

#define EP_PIPE_TYPE_LOW_SPEED   0x02000000

§ EP_PIPE_USE_UDMA

#define EP_PIPE_USE_UDMA   0x01000000

§ EP_PIPE_TYPE_ISOC

#define EP_PIPE_TYPE_ISOC   0x00800000

§ EP_PIPE_TYPE_INTR

#define EP_PIPE_TYPE_INTR   0x00400000

§ EP_PIPE_TYPE_BULK

#define EP_PIPE_TYPE_BULK   0x00200000

§ EP_PIPE_TYPE_CONTROL

#define EP_PIPE_TYPE_CONTROL   0x00100000

§ EP_PIPE_TYPE_IN

#define EP_PIPE_TYPE_IN   0x00020000

§ EP_PIPE_TYPE_OUT

#define EP_PIPE_TYPE_OUT   0x00010000

§ EP_PIPE_IDX_M

#define EP_PIPE_IDX_M   0x0000ffff

§ OUT_PIPE_HANDLE

#define OUT_PIPE_HANDLE (   ui32Idx)
Value:
(g_sUSBHCD.psUSBOUTPipes[ui32Idx].ui32Type | \
ui32Idx)

§ IN_PIPE_HANDLE

#define IN_PIPE_HANDLE (   ui32Idx)
Value:
(g_sUSBHCD.psUSBINPipes[ui32Idx].ui32Type | \
ui32Idx)

§ EP_OFFSET

#define EP_OFFSET (   Endpoint)    (Endpoint - 0x10)

Typedef Documentation

§ tHCDPipeCallback

typedef void(* tHCDPipeCallback) (uint32_t ui32Pipe, uint32_t ui32Event)

§ tUSBHostDevice

Enumeration Type Documentation

§ tEP0State

enum tEP0State
Enumerator
eUSBStateIdle 
eUSBStateTx 
eUSBStateTxConfig 
eUSBStateRx 
eUSBStateStatus 
eUSBStateStall 
eEP0StateIdle 
eEP0StateSetupIN 
eEP0StateSetupOUT 
eEP0StateRx 
eEP0StateStatus 
eEP0StateStatusIN 
eEP0StateStall 
eEP0StateError 

§ tUSBHDeviceState

Enumerator
eHCDDevDisconnected 
eHCDDevConnected 
eHCDDevConnectedHub 
eHCDDevRequest 
eHCDDevReset 
eHCDDevAddressed 
eHCDDevConfigured 
eHCDDevGetStrings 
eHCDDevError 
eHCDVBUSError 
eHCDPowerFault 
eHCDIdle 

Function Documentation

§ OTGDeviceDisconnect()

void OTGDeviceDisconnect ( uint32_t  ui32Index)

§ ConfigDescAlloc()

uint32_t ConfigDescAlloc ( tUSBHostDevice psDevice,
uint32_t  ui32Size 
)

§ ConfigDescFree()

void ConfigDescFree ( tUSBHostDevice psDevice)

§ USBHCDEventEnable()

int32_t USBHCDEventEnable ( uint32_t  ui32Index,
void *  pvEventDriver,
uint32_t  ui32Event 
)

This function is called to enable a specific USB HCD event notification.

Parameters
ui32Indexspecifies which USB controller to use.
pvEventDriveris the event driver structure that was passed into the USBHCDRegisterDrivers() function as part of the array of tUSBHostClassDriver structures.
ui32Eventis the event to enable.

This function is called to enable event callbacks for a specific USB HCD event. The requested event is passed in the ui32Event parameter. Not all events can be enables so the function will return zero if the event provided cannot be enabled. The pvEventDriver is a pointer to the event driver structure that the caller passed into the USBHCDRegisterDrivers() function. This structure is typically declared with the DECLARE_EVENT_DRIVER() macro and included as part of the array of pointers to tUSBHostClassDriver structures that is passed to the USBHCDRegisterDrivers() function.

Returns
This function returns a non-zero number if the event was successfully enabled and returns zero if the event cannot be enabled.

§ USBHCDEventDisable()

int32_t USBHCDEventDisable ( uint32_t  ui32Index,
void *  pvEventDriver,
uint32_t  ui32Event 
)

This function is called to disable a specific USB HCD event notification.

Parameters
ui32Indexspecifies which USB controller to use.
pvEventDriveris the event driver structure that was passed into the USBHCDRegisterDrivers() function as part of the array of tUSBHostClassDriver structures.
ui32Eventis the event to disable.

This function is called to disable event callbacks for a specific USB HCD event. The requested event is passed in the ui32Event parameter. Not all events can be enables so the function will return zero if the event provided cannot be enabled. The pvEventDriver is a pointer to the event driver structure that the caller passed into the USBHCDRegisterDrivers() function. This structure is typically declared with the DECLARE_EVENT_DRIVER() macro and included as part of the array of pointers to tUSBHostClassDriver structures that is passed to the USBHCDRegisterDrivers() function.

Returns
This function returns a non-zero number if the event was successfully disabled and returns zero if the event cannot be disabled.

§ USBHCDPipeTransferSizeGet()

uint32_t USBHCDPipeTransferSizeGet ( uint32_t  ui32Pipe)

This function returns the current byte count of a USB HCD pipe.

Parameters
ui32Pipeis the allocated endpoint to modify.

This call returns the current or last byte count for a transfer using the pipe specified by the ui32Pipe parameter. This is typically used to determine the actual byte count received when a USB_EVENT_RX_AVAILABLE occurs.

Returns
If the call was successful, this function returns the number of bytes transfered by the USB pipe.

References EP_PIPE_IDX_M.

§ USBHCDPipeAllocSize()

uint32_t USBHCDPipeAllocSize ( uint32_t  ui32Index,
uint32_t  ui32EndpointType,
tUSBHostDevice psDevice,
uint32_t  ui32Size,
tHCDPipeCallback  pfnCallback 
)

This function is used to allocate a USB HCD pipe.

Parameters
ui32Indexspecifies which USB controller to use.
ui32EndpointTypeis the type of endpoint that this pipe will be communicating with.
psDeviceis the device instance associated with this endpoint.
ui32Sizeis the size of the FIFO in bytes.
pfnCallbackis the function that will be called when events occur on this USB Pipe.

Since there are a limited number of USB HCD pipes that can be used in the host controller, this function is used to temporarily or permanently acquire one of the endpoints. Unlike the USBHCDPipeAlloc() function this function allows the caller to specify the size of the FIFO allocated to this endpoint in the ui32Size parameter. This function also provides a method to register a callback for status changes on this endpoint. If no callbacks are desired then the pfnCallback function should be set to 0. The callback should be used when using the USBHCDPipeSchedule() function so that the caller is notified when the action is complete.

Returns
This function returns a value indicating which pipe was reserved. If the value is 0 then there were no pipes currently available. This value should be passed to any USBHCDPipe APIs to indicate which pipe is being accessed.

References EP_PIPE_TYPE_OUT, and MAX_NUM_PIPES.

Referenced by USBHCDPipeAlloc().

§ USBHCDPipeAlloc()

uint32_t USBHCDPipeAlloc ( uint32_t  ui32Index,
uint32_t  ui32EndpointType,
tUSBHostDevice psDevice,
tHCDPipeCallback  pfnCallback 
)

This function is used to allocate a USB HCD pipe.

Parameters
ui32Indexspecifies which USB controller to use.
ui32EndpointTypeis the type of endpoint that this pipe will be communicating with.
psDeviceis the device instance associated with this endpoint.
pfnCallbackis the function that will be called when events occur on this USB Pipe.

Since there are a limited number of USB HCD pipes that can be used in the host controller, this function is used to temporarily or permanently acquire one of the endpoints. It also provides a method to register a callback for status changes on this endpoint. If no callbacks are desired then the pfnCallback function should be set to 0. The callback should be used when using the USBHCDPipeSchedule() function so that the caller is notified when the action is complete.

Returns
This function returns a value indicating which pipe was reserved. If the value is 0 then there were no pipes currently available. This value should be passed to any USBHCDPipe APIs to indicate which pipe is being accessed.

References USBHCDPipeAllocSize().

§ USBHCDPipeConfig()

uint32_t USBHCDPipeConfig ( uint32_t  ui32Pipe,
uint32_t  ui32MaxPayload,
uint32_t  ui32Interval,
uint32_t  ui32TargetEndpoint 
)

This function is used to configure a USB HCD pipe.

This should be called after allocating a USB pipe with a call to USBHCDPipeAlloc(). It is used to set the configuration associated with an endpoint like the max payload and target endpoint. The ui32MaxPayload parameter is typically read directly from the devices endpoint descriptor and is expressed in bytes.

Setting the ui32Interval parameter depends on the type of endpoint being configured. For endpoints that do not need to use the ui32Interval parameter ui32Interval should be set to 0. For Bulk ui32Interval is a value from 2-16 and will set the NAK timeout value as 2^(ui32Interval-1) frames. For interrupt endpoints ui32Interval is a value from 1-255 and is the count in frames between polling the endpoint. For isochronous endpoints ui32Interval ranges from 1-16 and is the polling interval in frames represented as 2^(ui32Interval-1) frames.

Parameters
ui32Pipeis the allocated endpoint to modify.
ui32MaxPayloadis maximum data that can be handled per transaction.
ui32Intervalis the polling interval for data transfers expressed in frames.
ui32TargetEndpointis the target endpoint on the device to communicate with.
Returns
If the call was successful, this function returns zero any other value indicates an error.

References EP_PIPE_IDX_M, EP_PIPE_TYPE_OUT, and tUSBHostDevice::ui32Flags.

§ USBHCDPipeStatus()

uint32_t USBHCDPipeStatus ( uint32_t  ui32Pipe)

This function is used to return the current status of a USB HCD pipe.

This function will return the current status for a given USB pipe. If there is no status to report this call will simply return USBHCD_PIPE_NO_CHANGE.

Parameters
ui32Pipeis the USB pipe for this status request.
Returns
This function returns the current status for the given endpoint. This will be one of the USBHCD_PIPE_* values.

§ USBHCDPipeWrite()

uint32_t USBHCDPipeWrite ( uint32_t  ui32Pipe,
uint8_t *  pui8Data,
uint32_t  ui32Size 
)

This function is used to write data to a USB HCD pipe.

Parameters
ui32Pipeis the USB pipe to put data into.
pui8Datais a pointer to the data to send.
ui32Sizeis the amount of data to send.

This function will block until it has sent as much data as was requested using the USB pipe's FIFO. The caller should have registered a callback with the USBHCDPipeAlloc() call in order to be informed when the data has been transmitted. The value returned by this function can be less than the ui32Size requested if the USB pipe has less space available than this request is making.

Returns
This function returns the number of bytes that were scheduled to be sent on the given USB pipe.

References EP_PIPE_IDX_M, and EP_PIPE_USE_UDMA.

Referenced by USBHCDCWriteData().

§ USBHCDPipeSchedule()

uint32_t USBHCDPipeSchedule ( uint32_t  ui32Pipe,
uint8_t *  pui8Data,
uint32_t  ui32Size 
)

This function is used to schedule and IN transaction on a USB HCD pipe.

Parameters
ui32Pipeis the USB pipe to read data from.
pui8Datais a pointer to store the data that is received.
ui32Sizeis the size in bytes of the buffer pointed to by pui8Data.

This function will not block depending on the type of pipe passed in will schedule either a send of data to the device or a read of data from the device. In either case the amount of data will be limited to what will fit in the FIFO for a given endpoint.

Returns
This function returns the number of bytes that were sent in the case of a transfer of data or it will return 0 for a request on a USB IN pipe.

References EP_PIPE_IDX_M, EP_PIPE_TYPE_OUT, and EP_PIPE_USE_UDMA.

Referenced by USBHostAudioPlay(), and USBHostAudioRecord().

§ USBHCDPipeReadNonBlocking()

uint32_t USBHCDPipeReadNonBlocking ( uint32_t  ui32Pipe,
uint8_t *  pui8Data,
uint32_t  ui32Size 
)

This function is used to read data from a USB HCD pipe.

Parameters
ui32Pipeis the USB pipe to read data from.
pui8Datais a pointer to store the data that is received.
ui32Sizeis the size in bytes of the buffer pointed to by pui8Data.

This function will not block and will only read as much data as requested or as much data is currently available from the USB pipe. The caller should have registered a callback with the USBHCDPipeAlloc() call in order to be informed when the data has been received. The value returned by this function can be less than the ui32Size requested if the USB pipe has less data available than was requested.

Returns
This function returns the number of bytes that were returned in the pui8Data buffer.

References EP_PIPE_IDX_M.

Referenced by USBHHIDGetReport().

§ USBHCDPipeDataAck()

void USBHCDPipeDataAck ( uint32_t  ui32Pipe)

This function acknowledges data received via an interrupt IN pipe.

Parameters
ui32Pipeis the USB INT pipe whose last packet is to be acknowledged.

This function is used to acknowledge reception of data on an interrupt IN pipe. A transfer on an interrupt IN endpoint is scheduled via a call to USBHCDPipeSchedule() and the application is notified when data is received using a USB_EVENT_RX_AVAILABLE event. In the handler for this event, the application must call USBHCDPipeDataAck() to have the USB controller ACK the data from the device and complete the transaction.

Returns
None.

References EP_PIPE_IDX_M.

§ USBHCDPipeRead()

uint32_t USBHCDPipeRead ( uint32_t  ui32Pipe,
uint8_t *  pui8Data,
uint32_t  ui32Size 
)

This function is used to read data from a USB HCD pipe.

Parameters
ui32Pipeis the USB pipe to read data from.
pui8Datais a pointer to store the data that is received.
ui32Sizeis the size in bytes of the buffer pointed to by pui8Data.

This function will block and will only return when it has read as much data as requested from the USB pipe. The caller must register a callback with the USBHCDPipeAlloc() call in order to be informed when the data has been received. If the caller provides a non-zero pointer in the pui8Data parameter then the data is copied into the buffer before the callback occurs. If the caller provides a zero in pui8Data parameter then the caller is responsible for reading the data out of the FIFO when the USB_EVENT_RX_AVAILABLE callback event occurs. The value returned by this function can be less than the ui32Size requested if the USB pipe has less data available than was requested.

Returns
This function returns the number of bytes that were returned in the pui8Data buffer.

References EP_PIPE_IDX_M.

Referenced by USBHCDCReadData().

§ USBHCDPipeFree()

void USBHCDPipeFree ( uint32_t  ui32Pipe)

This function is used to release a USB pipe.

Parameters
ui32Pipeis the allocated USB pipe to release.

This function is used to release a USB pipe that was allocated by a call to USBHCDPipeAlloc() for use by some other device endpoint in the system. Freeing an unallocated or invalid pipe will not generate an error and will instead simply return.

Returns
None.

References EP_PIPE_IDX_M, and EP_PIPE_TYPE_OUT.

§ USBHCDPowerConfigInit()

void USBHCDPowerConfigInit ( uint32_t  ui32Index,
uint32_t  ui32PwrConfig 
)

This function is used to set the power pin and power fault configuration.

Parameters
ui32Indexspecifies which USB controller to use.
ui32PwrConfigis the power configuration to use for the application.

This function must be called before HCDInit() is called so that the power pin configuration can be set before power is enabled. The ui32PwrConfig flags specify the power fault level sensitivity, the power fault action, and the power enable pin level and source.

One of the following can be selected as the power fault level sensitivity:

  • USBHCD_FAULT_LOW - An external power fault is indicated by the pin being driven low.
  • USBHCD_FAULT_HIGH - An external power fault is indicated by the pin being driven high.

One of the following can be selected as the power fault action:

  • USBHCD_FAULT_VBUS_NONE - No automatic action when power fault detected.
  • USBHCD_FAULT_VBUS_TRI - Automatically Tri-state the USBnEPEN pin on a power fault.
  • USBHCD_FAULT_VBUS_DIS - Automatically drive the USBnEPEN pin to it's inactive state on a power fault.

One of the following can be selected as the power enable level and source:

  • USBHCD_VBUS_MANUAL - Power control is completely managed by the application, the USB library will provide a power callback to request power state changes.
  • USBHCD_VBUS_AUTO_LOW - USBEPEN is driven low by the USB controller automatically if USBOTGSessionRequest() has enabled a session.
  • USBHCD_VBUS_AUTO_HIGH - USBEPEN is driven high by the USB controller automatically if USBOTGSessionRequest() has enabled a session.

If USBHCD_VBUS_MANUAL is used then the application must provide an event driver to receive the USB_EVENT_POWER_ENABLE and USB_EVENT_POWER_DISABLE events and enable and disable power to VBUS when requested by the USB library. The application should respond to a power control callback by enabling or disabling VBUS as soon as possible and before returning from the callback function.

Note
The following values should no longer be used with the USB library: USB_HOST_PWRFLT_LOW, USB_HOST_PWRFLT_HIGH, USB_HOST_PWRFLT_EP_NONE, USB_HOST_PWRFLT_EP_TRI, USB_HOST_PWRFLT_EP_LOW, USB_HOST_PWRFLT_EP_HIGH, USB_HOST_PWREN_LOW, USB_HOST_PWREN_HIGH, USB_HOST_PWREN_VBLOW, and USB_HOST_PWREN_VBHIGH.
Returns
None.

§ USBHCDPowerConfigGet()

uint32_t USBHCDPowerConfigGet ( uint32_t  ui32Index)

This function is used to get the power pin and power fault configuration.

Parameters
ui32Indexspecifies which USB controller to use.

This function will return the current power control pin configuration as set by the USBHCDPowerConfigInit() function or the defaults if not yet set. See the USBHCDPowerConfigInit() documentation for the meaning of the bits that are returned by this function.

Returns
The configuration of the power control pins.

Referenced by USBDualModeInit().

§ USBHCDPowerConfigSet()

uint32_t USBHCDPowerConfigSet ( uint32_t  ui32Index,
uint32_t  ui32Config 
)

This function is used to set the power pin and power fault configuration.

Parameters
ui32Indexspecifies which USB controller to use.
ui32Configspecifies which USB power configuration to use.

This function will set the current power control pin configuration as set by the USBHCDPowerConfigInit() function or the defaults if not yet set. See the USBHCDPowerConfigInit() documentation for the meaning of the bits that are set by this function.

Returns
Returns zero to indicate the power setting is now active.

§ USBHCDPowerAutomatic()

uint32_t USBHCDPowerAutomatic ( uint32_t  ui32Index)

This function returns if the current power settings will automatically handle enabling and disabling VBUS power.

Parameters
ui32Indexspecifies which USB controller to query.

This function returns if the current power control pin configuration will automatically apply power or whether it will be left to the application to turn on power when it is notified.

Returns
A non-zero value indicates that power is automatically applied and a value of zero indicates that the application must manually apply power.

Referenced by USB0_IRQOTGModeHandler(), and USBDualModeInit().

§ USBHCDInit()

void USBHCDInit ( uint32_t  ui32Index,
void *  pvPool,
uint32_t  ui32PoolSize 
)

This function is used to initialize the HCD code.

Parameters
ui32Indexspecifies which USB controller to use.
pvPoolis a pointer to the data to use as a memory pool for this controller.
ui32PoolSizeis the size in bytes of the buffer passed in as pvPool.

This function will perform all the necessary operations to allow the USB host controller to begin enumeration and communication with devices. This function should typically be called once at the start of an application once all of the device and class drivers are ready for normal operation. This call will start up the USB host controller and any connected device will immediately start the enumeration sequence.

The USBStackModeSet() function can be called with eUSBModeHost in order to cause the USB library to force the USB operating mode to a host controller. This allows the application to used the USBVBUS and USBID pins as GPIOs on devices that support forcing OTG to operate as a host only controller. By default the USB library will assume that the USBVBUS and USBID pins are configured as USB pins and not GPIOs.

The memory pool passed to this function must be at least as large as a typical configuration descriptor for devices that are to be supported. This value is application-dependent however it should never be less than 32 bytes and, in most cases, should be at least 64 bytes. If there is not sufficient memory to load a configuration descriptor from a device, the device will not be recognized by the USB library's host controller driver.

Returns
None.

References eUSBModeDevice, eUSBModeForceDevice, eUSBModeHost, eUSBModeNone, and g_iUSBMode.

§ USBHCDRegisterDrivers()

void USBHCDRegisterDrivers ( uint32_t  ui32Index,
const tUSBHostClassDriver *const *  ppsHClassDrvs,
uint32_t  ui32NumDrivers 
)

This function is used to initialize the HCD class driver list.

Parameters
ui32Indexspecifies which USB controller to use.
ppsHClassDrvsis an array of host class drivers that are supported on this controller.
ui32NumDriversis the number of entries in the pHostClassDrivers array.

This function will set the host classes supported by the host controller specified by the ui32Index parameter. This function should be called before enabling the host controller driver with the USBHCDInit() function.

Returns
None.

§ USBHCDTerm()

void USBHCDTerm ( uint32_t  ui32Index)

This function is used to terminate the HCD code.

Parameters
ui32Indexspecifies which USB controller to release.

This function will clean up the USB host controller and disable it in preparation for shutdown or a switch to USB device mode. Once this call is made, USBHCDInit() may be called to reinitialize the controller and prepare for host mode operation.

Returns
None.

§ USBHCDReset()

void USBHCDReset ( uint32_t  ui32Index)

This function generates reset signaling on the USB bus.

Parameters
ui32Indexspecifies which USB controller to use.

This function handles sending out reset signaling on the USB bus. After returning from this function, any attached device on the USB bus should have returned to it's reset state.

Returns
None.

§ USBHCDSuspend()

void USBHCDSuspend ( uint32_t  ui32Index)

This function will generate suspend signaling on the USB bus.

Parameters
ui32Indexspecifies which USB controller to use.

This function is used to generate suspend signaling on the USB bus. In order to leave the suspended state, the application should call USBHCDResume().

Returns
None.

§ USBHCDResume()

void USBHCDResume ( uint32_t  ui32Index)

This function will generate resume signaling on the USB bus.

Parameters
ui32Indexspecifies which USB controller to use.

This function is used to generate resume signaling on the USB bus in order to cause USB devices to leave their suspended state. This call should not be made unless a preceding call to USBHCDSuspend() has been made.

Returns
None.

§ USBHCDStringDescriptorGet()

uint32_t USBHCDStringDescriptorGet ( tUSBHostDevice psDevice,
uint8_t *  pui8Buffer,
uint32_t  ui32Size,
uint32_t  ui32LangID,
uint32_t  ui32StringIndex 
)

This function issues a request for a string descriptor from a device.

Parameters
psDeviceis the device for this request.
pui8Bufferis the pointer to the buffer to store the requested string descriptor.
ui32Sizeis the size of the buffer passed in the buffer that will be used for this request.
ui32LangIDis the ID of the language for the requested string.
ui32StringIndexis the index for the request.

This function will request a string descriptor from the device of the type specified in the ui32DescriptorType parameter. The pui8Descriptor pointer is the location where the request results will be stored. The ui32Size should be passed in to indicate the size of the pui8Descriptor buffer. The ui32DevAddress parameter is used to specify the device address to communicate with on the USB bus. This value should be specified as 0 for any non-configured device on the USB bus and be changed to the address set by a call to USBHCDSetAddress().

Returns
The number of bytes returned in the pui8Buffer due to the request. This value can be zero if the device did not respond.

References tUSBHostDevice::sDeviceDescriptor, USB_DTYPE_STRING, USB_RTYPE_DEVICE, USB_RTYPE_DIR_IN, USB_RTYPE_STANDARD, USBHCDControlTransfer(), and USBREQ_GET_DESCRIPTOR.

§ USBHCDSetAddress()

void USBHCDSetAddress ( uint32_t  ui32DevIndex,
uint32_t  ui32DevAddress 
)

This function is used to send the set address command to a device.

Parameters
ui32DevIndexis the index of the device whose address is to be set. This value must be 0 to indicate that the device is connected directly to the host controller. Higher values indicate devices connected via a hub.
ui32DevAddressis the new device address to use for a device.

The USBHCDSetAddress() function is used to set the USB device address, once a device has been discovered on the bus. This call is typically issued following a USB reset triggered by a call the USBHCDReset(). The address passed into this function via the ui32DevAddress parameter is used for all further communications with the device after this function returns.

Returns
None.

References USB_RTYPE_DEVICE, USB_RTYPE_DIR_OUT, USB_RTYPE_STANDARD, USBHCDControlTransfer(), and USBREQ_SET_ADDRESS.

§ USBHCDSetConfig()

void USBHCDSetConfig ( uint32_t  ui32Index,
uint32_t  ui32Device,
uint32_t  ui32Configuration 
)

This function is used to set the current configuration for a device.

Parameters
ui32Indexspecifies which USB controller to use.
ui32Deviceis the USB device for this function.
ui32Configurationis one of the devices valid configurations.

This function is used to set the current device configuration for a USB device. The ui32Configuration value must be one of the configuration indexes that was returned in the configuration descriptor from the device, or a value of 0. If 0 is passed in, the device will return to it's addressed state and no longer be in a configured state. If the value is non-zero then the device will change to the requested configuration.

Returns
None.

References USB_RTYPE_DEVICE, USB_RTYPE_DIR_OUT, USB_RTYPE_STANDARD, USBHCDControlTransfer(), and USBREQ_SET_CONFIG.

§ USBHCDSetInterface()

void USBHCDSetInterface ( uint32_t  ui32Index,
uint32_t  ui32Device,
uint32_t  ui32Interface,
uint32_t  ui32AltSetting 
)

This function is used to set the current interface and alternate setting for an interface on a device.

Parameters
ui32Indexspecifies which USB controller to use.
ui32Deviceis the USB device for this function.
ui32Interfaceis one of the valid interface numbers for a device.
ui32AltSettingis one of the valid alternate interfaces for the ui32Interface number.

This function is used to change the alternate setting for one of the valid interfaces on a USB device. The ui32Device specifies the device instance that was returned when the device was connected. This call will set the USB device's interface based on the ui32Interface and ui32AltSetting.

Example: Set the USB device interface 2 to alternate setting 1.

//! USBHCDSetInterface(0, ui32Device, 2, 1);
//! 
\return None.  

References tUSBHostDevice::ui32Interface, USB_RTYPE_DIR_OUT, USB_RTYPE_INTERFACE, USB_RTYPE_STANDARD, USBHCDControlTransfer(), and USBREQ_SET_INTERFACE.

Referenced by USBHostAudioPlay(), and USBHostAudioRecord().

§ USBHostCheckPipes()

void USBHostCheckPipes ( void  )

§ USBHostIntHandlerInternal()

void USBHostIntHandlerInternal ( uint32_t  ui32Index,
uint32_t  ui32Status 
)

§ USB0_IRQHostHandler()

void USB0_IRQHostHandler ( void  )

The USB host mode interrupt handler for controller index 0.

This the main USB interrupt handler entry point. This handler will branch the interrupt off to the appropriate handlers depending on the current status of the USB controller. This function must be placed in the interrupt table in order for the USB Library host stack to function.

Returns
None.

References USBHostIntHandlerInternal().

§ InternalUSBHCDSendEvent()

void InternalUSBHCDSendEvent ( uint32_t  ui32Index,
tEventInfo psEvent,
uint32_t  ui32EvFlag 
)

Referenced by USB0_IRQOTGModeHandler().

§ USBHCDMain()

void USBHCDMain ( void  )

This function is the main routine for the Host Controller Driver.

This function is the main routine for the host controller driver, and must be called periodically by the main application outside of a callback context. This allows for a simple cooperative system to access the the host controller driver interface without the need for an RTOS. All time critical operations are handled in interrupt context but all blocking operations are run from the this function to allow them to block and wait for completion without holding off other interrupts.

Returns
None.

§ USBHCDControlTransfer()

uint32_t USBHCDControlTransfer ( uint32_t  ui32Index,
tUSBRequest *  psSetupPacket,
tUSBHostDevice psDevice,
uint8_t *  pui8Data,
uint32_t  ui32Size,
uint32_t  ui32MaxPacketSize 
)

This function completes a control transaction to a device.

Parameters
ui32Indexis the controller index to use for this transfer.
psSetupPacketis the setup request to be sent.
psDeviceis the device instance pointer for this request.
pui8Datais the data to send for OUT requests or the receive buffer for IN requests.
ui32Sizeis the size of the buffer in pui8Data.
ui32MaxPacketSizeis the maximum packet size for the device for this request.

This function handles the state changes necessary to send a control transaction to a device. This function should not be called from within an interrupt callback as it is a blocking function.

Returns
The number of bytes of data that were sent or received as a result of this request.

Referenced by USBHCDCGetLineCoding(), USBHCDCSetControlLineState(), USBHCDCSetLineCoding(), USBHCDSetAddress(), USBHCDSetConfig(), USBHCDSetInterface(), USBHCDStringDescriptorGet(), USBHHIDGetReportDescriptor(), USBHHIDSetIdle(), USBHHIDSetProtocol(), USBHHIDSetReport(), and USBHostAudioVolumeSet().

§ USBHCDHubDeviceConnected()

uint32_t USBHCDHubDeviceConnected ( uint32_t  ui32Index,
uint8_t  ui8Hub,
uint8_t  ui8Port,
uint32_t  ui32Speed 
)

References DEBUG_OUTPUT, and MAX_USB_DEVICES.

§ USBHCDHubDeviceDisconnected()

void USBHCDHubDeviceDisconnected ( uint32_t  ui32Index,
uint32_t  ui32DevIndex 
)

References DEBUG_OUTPUT, and MAX_USB_DEVICES.

§ USBHCDDevHubPort()

uint8_t USBHCDDevHubPort ( uint32_t  ui32Instance)

This function returns the USB hub port for the requested device instance.

Parameters
ui32Instanceis a unique value indicating which device to query.

This function returns the USB hub port for the device that is associated with the ui32Instance parameter. The caller must use the value for ui32Instance was passed to the application when it receives a USB_EVENT_CONNECTED event. The function returns the USB hub port for the interface number specified by the ui32Interface parameter.

Returns
The USB hub port for the requested interface.

§ USBHCDDevAddress()

uint8_t USBHCDDevAddress ( uint32_t  ui32Instance)

This function will return the USB address for the requested device instance.

Parameters
ui32Instanceis a unique value indicating which device to query.

This function returns the USB address for the device that is associated with the ui32Instance parameter. The caller must use a value for ui32Instance have been passed to the application when it receives a USB_EVENT_CONNECTED event. The function will return the USB address for the interface number specified by the ui32Interface parameter.

Returns
The USB address for the requested interface.

§ USBHCDDevClass()

uint8_t USBHCDDevClass ( uint32_t  ui32Instance,
uint32_t  ui32Interface 
)

This function will return the USB class for the requested device instance.

Parameters
ui32Instanceis a unique value indicating which device to query.
ui32Interfaceis the interface number to query for the USB class.

This function returns the USB class for the device that is associated with the ui32Instance parameter. The caller must use a value for ui32Instance have been passed to the application when it receives a USB_EVENT_CONNECTED event. The function will return the USB class for the interface number specified by the ui32Interface parameter. If ui32Interface is set to 0xFFFFFFFF then the function will return the USB class for the first interface that is found in the device's USB descriptors.

Returns
The USB class for the requested interface.

§ USBHCDDevSubClass()

uint8_t USBHCDDevSubClass ( uint32_t  ui32Instance,
uint32_t  ui32Interface 
)

This function will return the USB subclass for the requested device instance.

Parameters
ui32Instanceis a unique value indicating which device to query.
ui32Interfaceis the interface number to query for the USB subclass.

This function returns the USB subclass for the device that is associated with the ui32Instance parameter. The caller must use a value for ui32Instance have been passed to the application when it receives a USB_EVENT_CONNECTED event. The function will return the USB subclass for the interface number specified by the ui32Interface parameter. If ui32Interface is set to 0xFFFFFFFF then the function will return the USB subclass for the first interface that is found in the device's USB descriptors.

Returns
The USB subclass for the requested interface.

§ USBHCDDevProtocol()

uint8_t USBHCDDevProtocol ( uint32_t  ui32Instance,
uint32_t  ui32Interface 
)

This function returns the USB protocol for the requested device instance.

Parameters
ui32Instanceis a unique value indicating which device to query.
ui32Interfaceis the interface number to query for the USB protocol.

This function returns the USB protocol for the device that is associated with the ui32Instance parameter. The caller must use a value for ui32Instance have been passed to the application when it receives a USB_EVENT_CONNECTED event. The function will return the USB protocol for the interface number specified by the ui32Interface parameter. If ui32Interface is set to 0xFFFFFFFF then the function will return the USB protocol for the first interface that is found in the device's USB descriptors.

Returns
The USB protocol for the requested interface.

§ USBHCDFeatureSet()

bool USBHCDFeatureSet ( uint32_t  ui32Index,
uint32_t  ui32Feature,
void *  pvFeature 
)

This function sets one of the USBLIB_FEATURE_ requests.

Parameters
ui32Indexis the index of the USB controller to access.
ui32Featureis one of the USBLIB_FEATURE_ defines.
pvFeatureis a pointer to the data for the USBLIB_FEATURE request.

This function sends the requested feature request to the USB library. Not all features are supported by all devices so see the documentation for the USBLIB_FEATURE_ to determine if the feature is supported.

Returns
Returns true if the feature was set and false if the feature is not supported or could not be changed to the requested value.

References USBLIB_FEATURE_CPUCLK.

Referenced by USBOTGFeatureSet().

§ USBHCDLPMStatus()

uint32_t USBHCDLPMStatus ( tUSBHostDevice psDevice)

This function returns the current status of an LPM request.

Parameters
psDeviceis the device to query.

This function returns the current status of LPM requests for a given device. This is called to determine if a previous request completed successfully or if there was an error.

Returns
This function returns the following values:
  • USBHCD_LPM_AVAIL - There are no pending LPM requests on this specific device or the last request completed successfully.
  • USBHCD_LPM_ERROR - The last LPM request for this device did not complete successfully.
  • USBHCD_LPM_PENDING - The last LPM request has not completed.

References tUSBHostDevice::ui32Flags, USBHCD_LPM_AVAIL, USBHCD_LPM_ERROR, USBHCD_LPM_PENDING, USBHDEV_FLAG_LPMERROR, and USBHDEV_FLAG_LPMPEND.

Referenced by USBHHIDLPMStatus(), USBHHubLPMStatus(), USBHMSCLPMStatus(), and USBHostAudioLPMStatus().

§ USBHCDLPMSleep()

uint32_t USBHCDLPMSleep ( tUSBHostDevice psDevice)

This function generates an LPM request for a device to enter L1 sleep state.

Parameters
psDeviceis the device to query.

This function sends a request to a device to enter the LPM L1 sleep state. The caller must check the return value to see if the request can be attempted at this time. If another LPM transaction is busy on another device this function will return USBHCD_LPM_PENDING or USBHCD_LPM_AVAIL if the LPM request was scheduled to be sent. The caller should check the USBHCDLPMStatus() function to determine if the request has completed.

Returns
This function returns the following values:
  • USBHCD_LPM_AVAIL - The transition to L1 state is scheduled to be sent.
  • USBHCD_LPM_PENDING - There is already an LPM request pending.

Referenced by USBHHIDLPMSleep(), USBHHubLPMSleep(), USBHMSCLPMSleep(), and USBHostAudioLPMSleep().

§ USBHCDLPMResume()

void USBHCDLPMResume ( uint32_t  ui32Index)

This function generates an LPM request for a device to exit L1 sleep state.

Parameters
ui32Indexspecifies which USB controller to use.

This function will start LPM resume signaling on the USB bus. This wakes all devices and is similar to USBHCDResume() call but is triggered by an LPM request.

Returns
None.

Variable Documentation

§ g_iUSBMode

tUSBMode g_iUSBMode
© Copyright 1995-2020, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale