Functions
Usb_api

Functions

void USBWrapperEnableInt (uint32_t ulBase)
 This API enables the USB Interrupts through subsystem specific wrapper registers. More...
 
static void USBIndexWrite (uint32_t ulBase, uint32_t ulEndpoint, uint32_t ulIndexedReg, uint32_t ulValue, uint32_t ulSize)
 
static uint32_t USBIndexRead (uint32_t ulBase, uint32_t ulEndpoint, uint32_t ulIndexedReg, uint32_t ulSize)
 
void USBHostSuspend (uint32_t ulBase)
 
void USBHostReset (uint32_t ulBase, uint32_t bStart)
 
void USBHostResume (uint32_t ulBase, uint32_t bStart)
 
uint32_t USBHostSpeedGet (uint32_t ulBase)
 
uint32_t USBIntStatus (uint32_t ulBase)
 
void USBIntDisable (uint32_t ulBase, uint32_t ulFlags)
 
void USBIntEnable (uint32_t ulBase, uint32_t ulFlags)
 
void USBIntDisableControl (uint32_t ulBase, uint32_t ulFlags)
 
void USBIntEnableControl (uint32_t ulBase, uint32_t ulFlags)
 
uint32_t USBIntStatusControl (uint32_t ulBase)
 
void USBIntDisableEndpoint (uint32_t ulBase, uint32_t ulFlags)
 
void USBIntEnableEndpoint (uint32_t ulBase, uint32_t ulFlags)
 
uint32_t USBIntStatusEndpoint (uint32_t ulBase)
 
uint32_t USBEndpointStatus (uint32_t ulBase, uint32_t ulEndpoint)
 
void USBHostEndpointStatusClear (uint32_t ulBase, uint32_t ulEndpoint, uint32_t ulFlags)
 
void USBDevEndpointStatusClear (uint32_t ulBase, uint32_t ulEndpoint, uint32_t ulFlags)
 
void USBHostEndpointDataToggle (uint32_t ulBase, uint32_t ulEndpoint, uint32_t bDataToggle, uint32_t ulFlags)
 
void USBEndpointDataToggleClear (uint32_t ulBase, uint32_t ulEndpoint, uint32_t ulFlags)
 
void USBDevEndpointStall (uint32_t ulBase, uint32_t ulEndpoint, uint32_t ulFlags)
 
void USBDevEndpointStallClear (uint32_t ulBase, uint32_t ulEndpoint, uint32_t ulFlags)
 
void USBDevConnect (uint32_t ulBase)
 
void USBDevDisconnect (uint32_t ulBase)
 
void USBDevAddrSet (uint32_t ulBase, uint32_t ulAddress)
 
uint32_t USBDevAddrGet (uint32_t ulBase)
 
void USBHostEndpointConfig (uint32_t ulBase, uint32_t ulEndpoint, uint32_t ulMaxPayload, uint32_t ulNAKPollInterval, uint32_t ulTargetEndpoint, uint32_t ulFlags)
 
void USBDevEndpointConfigSet (uint32_t ulBase, uint32_t ulEndpoint, uint32_t ulMaxPacketSize, uint32_t ulFlags)
 
void USBDevEndpointConfigGet (uint32_t ulBase, uint32_t ulEndpoint, uint32_t *pulMaxPacketSize, uint32_t *pulFlags)
 
void USBFIFOConfigSet (uint32_t ulBase, uint32_t ulEndpoint, uint32_t ulFIFOAddress, uint32_t ulFIFOSize, uint32_t ulFlags)
 
void USBFIFOConfigGet (uint32_t ulBase, uint32_t ulEndpoint, uint32_t *pulFIFOAddress, uint32_t *pulFIFOSize, uint32_t ulFlags)
 
void USBEndpointDMAEnable (uint32_t ulBase, uint32_t ulEndpoint, uint32_t ulFlags)
 
void USBEndpointDMADisable (uint32_t ulBase, uint32_t ulEndpoint, uint32_t ulFlags)
 
uint32_t USBEndpointDataAvail (uint32_t ulBase, uint32_t ulEndpoint)
 
int USBEndpointDataGet (uint32_t ulBase, uint32_t ulEndpoint, unsigned char *pucData, uint32_t *pulSize)
 
void USBDevEndpointDataAck (uint32_t ulBase, uint32_t ulEndpoint, uint32_t bIsLastPacket)
 
void USBHostEndpointDataAck (uint32_t ulBase, uint32_t ulEndpoint)
 
int USBEndpointDataPut (uint32_t ulBase, uint32_t ulEndpoint, unsigned char *pucData, uint32_t ulSize)
 
int USBEndpointDataSend (uint32_t ulBase, uint32_t ulEndpoint, uint32_t ulTransType)
 
void USBFIFOFlush (uint32_t ulBase, uint32_t ulEndpoint, uint32_t ulFlags)
 
void USBHostRequestIN (uint32_t ulBase, uint32_t ulEndpoint)
 
void USBHostRequestINClear (uint32_t ulBase, uint32_t ulEndpoint)
 
void USBHostAutoReqSet (uint32_t ulBase, uint32_t ulEndpoint)
 
void USBHostAutoReqClear (uint32_t ulBase, uint32_t ulEndpoint)
 
void USBHostRequestStatus (uint32_t ulBase)
 
void USBHostAddrSet (uint32_t ulBase, uint32_t ulEndpoint, uint32_t ulAddr, uint32_t ulFlags)
 
uint32_t USBHostAddrGet (uint32_t ulBase, uint32_t ulEndpoint, uint32_t ulFlags)
 
void USBHostHubAddrSet (uint32_t ulBase, uint32_t ulEndpoint, uint32_t ulAddr, uint32_t ulFlags)
 
uint32_t USBHostHubAddrGet (uint32_t ulBase, uint32_t ulEndpoint, uint32_t ulFlags)
 
void USBHostPwrConfig (uint32_t ulBase, uint32_t ulFlags)
 
void USBHostPwrFaultEnable (uint32_t ulBase)
 
void USBHostPwrFaultDisable (uint32_t ulBase)
 
void USBHostPwrEnable (uint32_t ulBase)
 
void USBHostPwrDisable (uint32_t ulBase)
 
uint32_t USBFrameNumberGet (uint32_t ulBase)
 
void USBOTGSessionRequest (uint32_t ulBase, uint32_t bStart)
 
uint32_t USBFIFOAddrGet (uint32_t ulBase, uint32_t ulEndpoint)
 
uint32_t USBModeGet (uint32_t ulBase)
 
void USBEndpointDMAChannel (uint32_t ulBase, uint32_t ulEndpoint, uint32_t ulChannel)
 
void USBEnableOtgIntr (uint32_t ulBase)
 
void USBReset (uint32_t ulBase)
 

Detailed Description

Function Documentation

uint32_t USBDevAddrGet ( uint32_t  ulBase)

Returns the current device address in device mode.

Parameters
ulBasespecifies the USB module base address.

This function will return the current device address. This address was set by a call to USBDevAddrSet().

Note
This function should only be called in device mode.
Returns
The current device address.
void USBDevAddrSet ( uint32_t  ulBase,
uint32_t  ulAddress 
)

Sets the address in device mode.

Parameters
ulBasespecifies the USB module base address.
ulAddressis the address to use for a device.

This function will set the device address on the USB bus. This address was likely received via a SET ADDRESS command from the host controller.

Note
This function should only be called in device mode.
Returns
None.
void USBDevConnect ( uint32_t  ulBase)

Connects the USB controller to the bus in device mode.

Parameters
ulBasespecifies the USB module base address.

This function will cause the soft connect feature of the USB controller to be enabled. Call USBDisconnect() to remove the USB device from the bus.

Note
This function should only be called in device mode.
Returns
None.
void USBDevDisconnect ( uint32_t  ulBase)

Removes the USB controller from the bus in device mode.

Parameters
ulBasespecifies the USB module base address.

This function will cause the soft connect feature of the USB controller to remove the device from the USB bus. A call to USBDevConnect() is needed to reconnect to the bus.

Note
This function should only be called in device mode.
Returns
None.
void USBDevEndpointConfigGet ( uint32_t  ulBase,
uint32_t  ulEndpoint,
uint32_t *  pulMaxPacketSize,
uint32_t *  pulFlags 
)

Gets the current configuration for an endpoint.

Parameters
ulBasespecifies the USB module base address.
ulEndpointis the endpoint to access.
pulMaxPacketSizeis a pointer which will be written with the maximum packet size for this endpoint.
pulFlagsis a pointer which will be written with the current endpoint settings. On entry to the function, this pointer must contain either USB_EP_DEV_IN or USB_EP_DEV_OUT to indicate whether the IN or OUT endpoint is to be queried.

This function will return the basic configuration for an endpoint in device mode. The values returned in *pulMaxPacketSize and *pulFlags are equivalent to the ulMaxPacketSize and ulFlags previously passed to USBDevEndpointConfigSet() for this endpoint.

Note
This function should only be called in device mode.
Returns
None.
void USBDevEndpointConfigSet ( uint32_t  ulBase,
uint32_t  ulEndpoint,
uint32_t  ulMaxPacketSize,
uint32_t  ulFlags 
)

Sets the configuration for an endpoint.

Parameters
ulBasespecifies the USB module base address.
ulEndpointis the endpoint to access.
ulMaxPacketSizeis the maximum packet size for this endpoint.
ulFlagsare used to configure other endpoint settings.

This function will set the basic configuration for an endpoint in device mode. Endpoint zero does not have a dynamic configuration, so this function should not be called for endpoint zero. The ulFlags parameter determines some of the configuration while the other parameters provide the rest.

The USB_EP_MODE_ flags define what the type is for the given endpoint.

  • USB_EP_MODE_CTRL is a control endpoint.
  • USB_EP_MODE_ISOC is an isochronous endpoint.
  • USB_EP_MODE_BULK is a bulk endpoint.
  • USB_EP_MODE_INT is an interrupt endpoint.

The USB_EP_DMA_MODE_ flags determines the type of DMA access to the endpoint data FIFOs. The choice of the DMA mode depends on how the DMA controller is configured and how it is being used. See the ``Using USB with the uDMA Controller'' section for more information on DMA configuration.

When configuring an IN endpoint, the USB_EP_AUTO_SET bit can be specified to cause the automatic transmission of data on the USB bus as soon as ulMaxPacketSize bytes of data are written into the FIFO for this endpoint. This is commonly used with DMA as no interaction is required to start the transmission of data.

When configuring an OUT endpoint, the USB_EP_AUTO_REQUEST bit is specified to trigger the request for more data once the FIFO has been drained enough to receive ulMaxPacketSize more bytes of data. Also for OUT endpoints, the USB_EP_AUTO_CLEAR bit can be used to clear the data packet ready flag automatically once the data has been read from the FIFO. If this is not used, this flag must be manually cleared via a call to USBDevEndpointStatusClear(). Both of these settings can be used to remove the need for extra calls when using the controller in DMA mode.

Note
This function should only be called in device mode.
Returns
None.
void USBDevEndpointDataAck ( uint32_t  ulBase,
uint32_t  ulEndpoint,
uint32_t  bIsLastPacket 
)

Acknowledge that data was read from the given endpoint's FIFO in device mode.

Parameters
ulBasespecifies the USB module base address.
ulEndpointis the endpoint to access.
bIsLastPacketindicates if this is the last packet.

This function acknowledges that the data was read from the endpoint's FIFO. The bIsLastPacket parameter is set to a true value if this is the last in a series of data packets on endpoint zero. The bIsLastPacket parameter is not used for endpoints other than endpoint zero. This call can be used if processing is required between reading the data and acknowledging that the data has been read.

Note
This function should only be called in device mode.
Returns
None.
void USBDevEndpointStall ( uint32_t  ulBase,
uint32_t  ulEndpoint,
uint32_t  ulFlags 
)

Stalls the specified endpoint in device mode.

Parameters
ulBasespecifies the USB module base address.
ulEndpointspecifies the endpoint to stall.
ulFlagsspecifies whether to stall the IN or OUT endpoint.

This function will cause to endpoint number passed in to go into a stall condition. If the ulFlags parameter is USB_EP_DEV_IN then the stall will be issued on the IN portion of this endpoint. If the ulFlags parameter is USB_EP_DEV_OUT then the stall will be issued on the OUT portion of this endpoint.

Note
This function should only be called in device mode.
Returns
None.
void USBDevEndpointStallClear ( uint32_t  ulBase,
uint32_t  ulEndpoint,
uint32_t  ulFlags 
)

Clears the stall condition on the specified endpoint in device mode.

Parameters
ulBasespecifies the USB module base address.
ulEndpointspecifies which endpoint to remove the stall condition.
ulFlagsspecifies whether to remove the stall condition from the IN or the OUT portion of this endpoint.

This function will cause the endpoint number passed in to exit the stall condition. If the ulFlags parameter is USB_EP_DEV_IN then the stall will be cleared on the IN portion of this endpoint. If the ulFlags parameter is USB_EP_DEV_OUT then the stall will be cleared on the OUT portion of this endpoint.

Note
This function should only be called in device mode.
Returns
None.
void USBDevEndpointStatusClear ( uint32_t  ulBase,
uint32_t  ulEndpoint,
uint32_t  ulFlags 
)

Clears the status bits in this endpoint in device mode.

Parameters
ulBasespecifies the USB module base address.
ulEndpointis the endpoint to access.
ulFlagsare the status bits that will be cleared.

This function will clear the status of any bits that are passed in the ulFlags parameter. The ulFlags parameter can take the value returned from the USBEndpointStatus() call.

Note
This function should only be called in device mode.
Returns
None.
void USBEnableOtgIntr ( uint32_t  ulBase)

Enables the USB interrupt at OTG level.

Parameters
None.
Returns
None.
uint32_t USBEndpointDataAvail ( uint32_t  ulBase,
uint32_t  ulEndpoint 
)

Determine the number of bytes of data available in a given endpoint's FIFO.

Parameters
ulBasespecifies the USB module base address.
ulEndpointis the endpoint to access.

This function will return the number of bytes of data currently available in the FIFO for the given receive (OUT) endpoint. It may be used prior to calling USBEndpointDataGet() to determine the size of buffer required to hold the newly-received packet.

Returns
This call will return the number of bytes available in a given endpoint FIFO.
int USBEndpointDataGet ( uint32_t  ulBase,
uint32_t  ulEndpoint,
unsigned char *  pucData,
uint32_t *  pulSize 
)

Retrieves data from the given endpoint's FIFO.

Parameters
ulBasespecifies the USB module base address.
ulEndpointis the endpoint to access.
pucDatais a pointer to the data area used to return the data from the FIFO.
pulSizeis initially the size of the buffer passed into this call via the pucData parameter. It will be set to the amount of data returned in the buffer.

This function will return the data from the FIFO for the given endpoint. The pulSize parameter should indicate the size of the buffer passed in the pulData parameter. The data in the pulSize parameter will be changed to match the amount of data returned in the pucData parameter. If a zero byte packet was received this call will not return a error but will instead just return a zero in the pulSize parameter. The only error case occurs when there is no data packet available.

Returns
This call will return 0, or -1 if no packet was received.
int USBEndpointDataPut ( uint32_t  ulBase,
uint32_t  ulEndpoint,
unsigned char *  pucData,
uint32_t  ulSize 
)

Puts data into the given endpoint's FIFO.

Parameters
ulBasespecifies the USB module base address.
ulEndpointis the endpoint to access.
pucDatais a pointer to the data area used as the source for the data to put into the FIFO.
ulSizeis the amount of data to put into the FIFO.

This function will put the data from the pucData parameter into the FIFO for this endpoint. If a packet is already pending for transmission then this call will not put any of the data into the FIFO and will return -1. Care should be taken to not write more data than can fit into the FIFO allocated by the call to USBFIFOConfig().

Returns
This call will return 0 on success, or -1 to indicate that the FIFO is in use and cannot be written.
int USBEndpointDataSend ( uint32_t  ulBase,
uint32_t  ulEndpoint,
uint32_t  ulTransType 
)

Starts the transfer of data from an endpoint's FIFO.

Parameters
ulBasespecifies the USB module base address.
ulEndpointis the endpoint to access.
ulTransTypeis set to indicate what type of data is being sent.

This function will start the transfer of data from the FIFO for a given endpoint. This is necessary if the USB_EP_AUTO_SET bit was not enabled for the endpoint. Setting the ulTransType parameter will allow the appropriate signaling on the USB bus for the type of transaction being requested. The ulTransType parameter should be one of the following:

  • USB_TRANS_OUT for OUT transaction on any endpoint in host mode.
  • USB_TRANS_IN for IN transaction on any endpoint in device mode.
  • USB_TRANS_IN_LAST for the last IN transactions on endpoint zero in a sequence of IN transactions.
  • USB_TRANS_SETUP for setup transactions on endpoint zero.
  • USB_TRANS_STATUS for status results on endpoint zero.
Returns
This call will return 0 on success, or -1 if a transmission is already in progress.
void USBEndpointDataToggleClear ( uint32_t  ulBase,
uint32_t  ulEndpoint,
uint32_t  ulFlags 
)

Sets the Data toggle on an endpoint to zero.

Parameters
ulBasespecifies the USB module base address.
ulEndpointspecifies the endpoint to reset the data toggle.
ulFlagsspecifies whether to access the IN or OUT endpoint.

This function will cause the controller to clear the data toggle for an endpoint. This call is not valid for endpoint zero and can be made with host or device controllers.

The ulFlags parameter should be one of USB_EP_HOST_OUT, USB_EP_HOST_IN, USB_EP_DEV_OUT, or USB_EP_DEV_IN.

Returns
None.
void USBEndpointDMAChannel ( uint32_t  ulBase,
uint32_t  ulEndpoint,
uint32_t  ulChannel 
)

Sets the DMA channel to use for a given endpoint.

Parameters
ulBasespecifies the USB module base address.
ulEndpointspecifies which endpoint's FIFO address to return.
ulChannelspecifies which DMA channel to use for which endpoint.

This function is used to configure which DMA channel to use with a given endpoint. Receive DMA channels can only be used with receive endpoints and transmit DMA channels can only be used with transmit endpoints. This allows the 3 receive and 3 transmit DMA channels to be mapped to any endpoint other than 0. The values that should be passed into the ulChannel value are the UDMA_CHANNEL_USBEP* values defined in udma.h.

Note
This function only has an effect on microcontrollers that have the ability to change the DMA channel for an endpoint. Calling this function on other devices will have no effect.
Returns
None.
void USBEndpointDMADisable ( uint32_t  ulBase,
uint32_t  ulEndpoint,
uint32_t  ulFlags 
)

Disable DMA on a given endpoint.

Parameters
ulBasespecifies the USB module base address.
ulEndpointis the endpoint to access.
ulFlagsspecifies which direction to disable.

This function will disable DMA on a given end point to allow non-DMA USB transactions to generate interrupts normally. The ulFlags should be USB_EP_DEV_IN or USB_EP_DEV_OUT all other bits are ignored.

Returns
None.
void USBEndpointDMAEnable ( uint32_t  ulBase,
uint32_t  ulEndpoint,
uint32_t  ulFlags 
)

Enable DMA on a given endpoint.

Parameters
ulBasespecifies the USB module base address.
ulEndpointis the endpoint to access.
ulFlagsspecifies which direction and what mode to use when enabling DMA.

This function will enable DMA on a given endpoint and set the mode according to the values in the ulFlags parameter. The ulFlags parameter should have USB_EP_DEV_IN or USB_EP_DEV_OUT set.

Returns
None.
uint32_t USBEndpointStatus ( uint32_t  ulBase,
uint32_t  ulEndpoint 
)

Returns the current status of an endpoint.

Parameters
ulBasespecifies the USB module base address.
ulEndpointis the endpoint to access.

This function will return the status of a given endpoint. If any of these status bits need to be cleared, then these these values must be cleared by calling the USBDevEndpointStatusClear() or USBHostEndpointStatusClear() functions.

The following are the status flags for host mode:

  • USB_HOST_IN_PID_ERROR - PID error on the given endpoint.
  • USB_HOST_IN_NOT_COMP - The device failed to respond to an IN request.
  • USB_HOST_IN_STALL - A stall was received on an IN endpoint.
  • USB_HOST_IN_DATA_ERROR - There was a CRC or bit-stuff error on an IN endpoint in Isochronous mode.
  • USB_HOST_IN_NAK_TO - NAKs received on this IN endpoint for more than the specified timeout period.
  • USB_HOST_IN_ERROR - Failed to communicate with a device using this IN endpoint.
  • USB_HOST_IN_FIFO_FULL - This IN endpoint's FIFO is full.
  • USB_HOST_IN_PKTRDY - Data packet ready on this IN endpoint.
  • USB_HOST_OUT_NAK_TO - NAKs received on this OUT endpoint for more than the specified timeout period.
  • USB_HOST_OUT_NOT_COMP - The device failed to respond to an OUT request.
  • USB_HOST_OUT_STALL - A stall was received on this OUT endpoint.
  • USB_HOST_OUT_ERROR - Failed to communicate with a device using this OUT endpoint.
  • USB_HOST_OUT_FIFO_NE - This endpoint's OUT FIFO is not empty.
  • USB_HOST_OUT_PKTPEND - The data transfer on this OUT endpoint has not completed.
  • USB_HOST_EP0_NAK_TO - NAKs received on endpoint zero for more than the specified timeout period.
  • USB_HOST_EP0_ERROR - The device failed to respond to a request on endpoint zero.
  • USB_HOST_EP0_IN_STALL - A stall was received on endpoint zero for an IN transaction.
  • USB_HOST_EP0_IN_PKTRDY - Data packet ready on endpoint zero for an IN transaction.

The following are the status flags for device mode:

  • USB_DEV_OUT_SENT_STALL - A stall was sent on this OUT endpoint.
  • USB_DEV_OUT_DATA_ERROR - There was a CRC or bit-stuff error on an OUT endpoint.
  • USB_DEV_OUT_OVERRUN - An OUT packet was not loaded due to a full FIFO.
  • USB_DEV_OUT_FIFO_FULL - The OUT endpoint's FIFO is full.
  • USB_DEV_OUT_PKTRDY - There is a data packet ready in the OUT endpoint's FIFO.
  • USB_DEV_IN_NOT_COMP - A larger packet was split up, more data to come.
  • USB_DEV_IN_SENT_STALL - A stall was sent on this IN endpoint.
  • USB_DEV_IN_UNDERRUN - Data was requested on the IN endpoint and no data was ready.
  • USB_DEV_IN_FIFO_NE - The IN endpoint's FIFO is not empty.
  • USB_DEV_IN_PKTPEND - The data transfer on this IN endpoint has not completed.
  • USB_DEV_EP0_SETUP_END - A control transaction ended before Data End condition was sent.
  • USB_DEV_EP0_SENT_STALL - A stall was sent on endpoint zero.
  • USB_DEV_EP0_IN_PKTPEND - The data transfer on endpoint zero has not completed.
  • USB_DEV_EP0_OUT_PKTRDY - There is a data packet ready in endpoint zero's OUT FIFO.
Returns
The current status flags for the endpoint depending on mode.
uint32_t USBFIFOAddrGet ( uint32_t  ulBase,
uint32_t  ulEndpoint 
)

Returns the absolute FIFO address for a given endpoint.

Parameters
ulBasespecifies the USB module base address.
ulEndpointspecifies which endpoint's FIFO address to return.

This function returns the actual physical address of the FIFO. This is needed when the USB is going to be used with the uDMA controller and the source or destination address needs to be set to the physical FIFO address for a given endpoint.

Returns
None.
void USBFIFOConfigGet ( uint32_t  ulBase,
uint32_t  ulEndpoint,
uint32_t *  pulFIFOAddress,
uint32_t *  pulFIFOSize,
uint32_t  ulFlags 
)

Returns the FIFO configuration for an endpoint.

Parameters
ulBasespecifies the USB module base address.
ulEndpointis the endpoint to access.
pulFIFOAddressis the starting address for the FIFO.
pulFIFOSizeis the size of the FIFO in bytes.
ulFlagsspecifies what information to retrieve from the FIFO configuration.

This function will return the starting address and size of the FIFO for a given endpoint. Endpoint zero does not have a dynamically configurable FIFO so this function should not be called for endpoint zero. The ulFlags parameter specifies whether the endpoint's OUT or IN FIFO should be read. If in host mode, the ulFlags parameter should be USB_EP_HOST_OUT or USB_EP_HOST_IN, and if in device mode the ulFlags parameter should be either USB_EP_DEV_OUT or USB_EP_DEV_IN.

Returns
None.
void USBFIFOConfigSet ( uint32_t  ulBase,
uint32_t  ulEndpoint,
uint32_t  ulFIFOAddress,
uint32_t  ulFIFOSize,
uint32_t  ulFlags 
)

Sets the FIFO configuration for an endpoint.

Parameters
ulBasespecifies the USB module base address.
ulEndpointis the endpoint to access.
ulFIFOAddressis the starting address for the FIFO.
ulFIFOSizeis the size of the FIFO in bytes.
ulFlagsspecifies what information to set in the FIFO configuration.

This function will set the starting FIFO RAM address and size of the FIFO for a given endpoint. Endpoint zero does not have a dynamically configurable FIFO so this function should not be called for endpoint zero. The ulFIFOSize parameter should be one of the values in the USB_FIFO_SZ_ values. If the endpoint is going to use double buffering it should use the values with the _DB at the end of the value. For example, use USB_FIFO_SZ_16_DB to configure an endpoint to have a 16 byte double buffered FIFO. If a double buffered FIFO is used, then the actual size of the FIFO will be twice the size indicated by the ulFIFOSize parameter. This means that the USB_FIFO_SZ_16_DB value will use 32 bytes of the USB controller's FIFO memory.

The ulFIFOAddress value should be a multiple of 8 bytes and directly indicates the starting address in the USB controller's FIFO RAM. For example, a value of 64 indicates that the FIFO should start 64 bytes into the USB controller's FIFO memory. The ulFlags value specifies whether the endpoint's OUT or IN FIFO should be configured. If in host mode, use USB_EP_HOST_OUT or USB_EP_HOST_IN, and if in device mode use USB_EP_DEV_OUT or USB_EP_DEV_IN.

Returns
None.
void USBFIFOFlush ( uint32_t  ulBase,
uint32_t  ulEndpoint,
uint32_t  ulFlags 
)

Forces a flush of an endpoint's FIFO.

Parameters
ulBasespecifies the USB module base address.
ulEndpointis the endpoint to access.
ulFlagsspecifies if the IN or OUT endpoint should be accessed.

This function will force the controller to flush out the data in the FIFO. The function can be called with either host or device controllers and requires the ulFlags parameter be one of USB_EP_HOST_OUT, USB_EP_HOST_IN, USB_EP_DEV_OUT, or USB_EP_DEV_IN.

Returns
None.
uint32_t USBFrameNumberGet ( uint32_t  ulBase)

Get the current frame number.

Parameters
ulBasespecifies the USB module base address.

This function returns the last frame number received.

Returns
The last frame number received.
uint32_t USBHostAddrGet ( uint32_t  ulBase,
uint32_t  ulEndpoint,
uint32_t  ulFlags 
)

Gets the current functional device address for an endpoint.

Parameters
ulBasespecifies the USB module base address.
ulEndpointis the endpoint to access.
ulFlagsdetermines if this is an IN or an OUT endpoint.

This function returns the current functional address that an endpoint is using to communicate with a device. The ulFlags parameter determines if the IN or OUT endpoint's device address is returned.

Note
This function should only be called in host mode.
Returns
Returns the current function address being used by an endpoint.
void USBHostAddrSet ( uint32_t  ulBase,
uint32_t  ulEndpoint,
uint32_t  ulAddr,
uint32_t  ulFlags 
)

Sets the functional address for the device that is connected to an endpoint in host mode.

Parameters
ulBasespecifies the USB module base address.
ulEndpointis the endpoint to access.
ulAddris the functional address for the controller to use for this endpoint.
ulFlagsdetermines if this is an IN or an OUT endpoint.

This function will set the functional address for a device that is using this endpoint for communication. This ulAddr parameter is the address of the target device that this endpoint will be used to communicate with. The ulFlags parameter indicates if the IN or OUT endpoint should be set.

Note
This function should only be called in host mode.
Returns
None.
void USBHostAutoReqClear ( uint32_t  ulBase,
uint32_t  ulEndpoint 
)

Donot autorequest for packet when FIFOs are empty. This is used to stop further requests during teardown process.

Parameters
ulBasespecifies the USB module base address.
ulEndpointis the endpoint to access.

This function will clear autoreq bit, which when set, will autorequest for packet when FIFOs are empty.

Note
This function should only be called in host mode.
Returns
None.
void USBHostAutoReqSet ( uint32_t  ulBase,
uint32_t  ulEndpoint 
)

Autorequest for packet when FIFOs are empty.

Parameters
ulBasespecifies the USB module base address.
ulEndpointis the endpoint to access.

This function will set autoreq bit, which when set, will autorequest for packet when FIFOs are empty.

Note
This function should only be called in host mode.
Returns
None.
void USBHostEndpointConfig ( uint32_t  ulBase,
uint32_t  ulEndpoint,
uint32_t  ulMaxPayload,
uint32_t  ulNAKPollInterval,
uint32_t  ulTargetEndpoint,
uint32_t  ulFlags 
)

Sets the base configuration for a host endpoint.

Parameters
ulBasespecifies the USB module base address.
ulEndpointis the endpoint to access.
ulMaxPayloadis the maximum payload for this endpoint.
ulNAKPollIntervalis the either the NAK timeout limit or the polling interval depending on the type of endpoint.
ulTargetEndpointis the endpoint that the host endpoint is targeting.
ulFlagsare used to configure other endpoint settings.

This function will set the basic configuration for the transmit or receive portion of an endpoint in host mode. The ulFlags parameter determines some of the configuration while the other parameters provide the rest. The ulFlags parameter determines whether this is an IN endpoint (USB_EP_HOST_IN or USB_EP_DEV_IN) or an OUT endpoint (USB_EP_HOST_OUT or USB_EP_DEV_OUT), whether this is a Full speed endpoint (USB_EP_SPEED_FULL) or a Low speed endpoint (USB_EP_SPEED_LOW).

The USB_EP_MODE_ flags control the type of the endpoint.

  • USB_EP_MODE_CTRL is a control endpoint.
  • USB_EP_MODE_ISOC is an isochronous endpoint.
  • USB_EP_MODE_BULK is a bulk endpoint.
  • USB_EP_MODE_INT is an interrupt endpoint.

The ulNAKPollInterval parameter has different meanings based on the USB_EP_MODE value and whether or not this call is being made for endpoint zero or another endpoint. For endpoint zero or any Bulk endpoints, this value always indicates the number of frames to allow a device to NAK before considering it a timeout. If this endpoint is an isochronous or interrupt endpoint, this value is the polling interval for this endpoint.

For interrupt endpoints the polling interval is simply the number of frames between polling an interrupt endpoint. For isochronous endpoints this value represents a polling interval of 2 ^ (ulNAKPollInterval - 1) frames. When used as a NAK timeout, the ulNAKPollInterval value specifies 2 ^ (ulNAKPollInterval - 1) frames before issuing a time out. There are two special time out values that can be specified when setting the ulNAKPollInterval value. The first is MAX_NAK_LIMIT which is the maximum value that can be passed in this variable. The other is DISABLE_NAK_LIMIT which indicates that there should be no limit on the number of NAKs.

The USB_EP_DMA_MODE_ flags enables the type of DMA used to access the endpoint's data FIFOs. The choice of the DMA mode depends on how the DMA controller is configured and how it is being used. See the ``Using USB with the uDMA Controller'' section for more information on DMA configuration.

When configuring the OUT portion of an endpoint, the USB_EP_AUTO_SET bit is specified to cause the transmission of data on the USB bus to start as soon as the number of bytes specified by ulMaxPayload have been written into the OUT FIFO for this endpoint.

When configuring the IN portion of an endpoint, the USB_EP_AUTO_REQUEST bit can be specified to trigger the request for more data once the FIFO has been drained enough to fit ulMaxPayload bytes. The USB_EP_AUTO_CLEAR bit can be used to clear the data packet ready flag automatically once the data has been read from the FIFO. If this is not used, this flag must be manually cleared via a call to USBDevEndpointStatusClear() or USBHostEndpointStatusClear().

Note
This function should only be called in host mode.
Returns
None.
void USBHostEndpointDataAck ( uint32_t  ulBase,
uint32_t  ulEndpoint 
)

Acknowledge that data was read from the given endpoint's FIFO in host mode.

Parameters
ulBasespecifies the USB module base address.
ulEndpointis the endpoint to access.

This function acknowledges that the data was read from the endpoint's FIFO. This call is used if processing is required between reading the data and acknowledging that the data has been read.

Note
This function should only be called in host mode.
Returns
None.
void USBHostEndpointDataToggle ( uint32_t  ulBase,
uint32_t  ulEndpoint,
uint32_t  bDataToggle,
uint32_t  ulFlags 
)

Sets the value data toggle on an endpoint in host mode.

Parameters
ulBasespecifies the USB module base address.
ulEndpointspecifies the endpoint to reset the data toggle.
bDataTogglespecifies whether to set the state to DATA0 or DATA1.
ulFlagsspecifies whether to set the IN or OUT endpoint.

This function is used to force the state of the data toggle in host mode. If the value passed in the bDataToggle parameter is false, then the data toggle will be set to the DATA0 state, and if it is true it will be set to the DATA1 state. The ulFlags parameter can be USB_EP_HOST_IN or USB_EP_HOST_OUT to access the desired portion of this endpoint. The ulFlags parameter is ignored for endpoint zero.

Note
This function should only be called in host mode.
Returns
None.
void USBHostEndpointStatusClear ( uint32_t  ulBase,
uint32_t  ulEndpoint,
uint32_t  ulFlags 
)

Clears the status bits in this endpoint in host mode.

Parameters
ulBasespecifies the USB module base address.
ulEndpointis the endpoint to access.
ulFlagsare the status bits that will be cleared.

This function will clear the status of any bits that are passed in the ulFlags parameter. The ulFlags parameter can take the value returned from the USBEndpointStatus() call.

Note
This function should only be called in host mode.
Returns
None.
uint32_t USBHostHubAddrGet ( uint32_t  ulBase,
uint32_t  ulEndpoint,
uint32_t  ulFlags 
)

Get the current device hub address for this endpoint.

Parameters
ulBasespecifies the USB module base address.
ulEndpointis the endpoint to access.
ulFlagsdetermines if this is an IN or an OUT endpoint.

This function will return the current hub address that an endpoint is using to communicate with a device. The ulFlags parameter determines if the device address for the IN or OUT endpoint is returned.

Note
This function should only be called in host mode.
Returns
This function returns the current hub address being used by an endpoint.
void USBHostHubAddrSet ( uint32_t  ulBase,
uint32_t  ulEndpoint,
uint32_t  ulAddr,
uint32_t  ulFlags 
)

Set the hub address for the device that is connected to an endpoint.

Parameters
ulBasespecifies the USB module base address.
ulEndpointis the endpoint to access.
ulAddris the hub address for the device using this endpoint.
ulFlagsdetermines if this is an IN or an OUT endpoint.

This function will set the hub address for a device that is using this endpoint for communication. The ulFlags parameter determines if the device address for the IN or the OUT endpoint is set by this call.

Note
This function should only be called in host mode.
Returns
None.
void USBHostPwrConfig ( uint32_t  ulBase,
uint32_t  ulFlags 
)

Sets the configuration for USB power fault.

Parameters
ulBasespecifies the USB module base address.
ulFlagsspecifies the configuration of the power fault.

This function controls how the USB controller uses its external power control pins(USBnPFTL and USBnEPEN). The flags specify the power fault level sensitivity, the power fault action, and the power enable level and source.

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

  • USB_HOST_PWRFLT_LOW - An external power fault is indicated by the pin being driven low.
  • USB_HOST_PWRFLT_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:

  • USB_HOST_PWRFLT_EP_NONE - No automatic action when power fault detected.
  • USB_HOST_PWRFLT_EP_TRI - Automatically Tri-state the USBnEPEN pin on a power fault.
  • USB_HOST_PWRFLT_EP_LOW - Automatically drive USBnEPEN pin low on a power fault.
  • USB_HOST_PWRFLT_EP_HIGH - Automatically drive USBnEPEN pin high on a power fault.

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

  • USB_HOST_PWREN_MAN_LOW - USBEPEN is driven low by the USB controller when USBHostPwrEnable() is called.
  • USB_HOST_PWREN_MAN_HIGH - USBEPEN is driven high by the USB controller when USBHostPwrEnable() is called.
  • USB_HOST_PWREN_AUTOLOW - USBEPEN is driven low by the USB controller automatically if USBOTGSessionRequest() has enabled a session.
  • USB_HOST_PWREN_AUTOHIGH - USBEPEN is driven high by the USB controller automatically if USBOTGSessionRequest() has enabled a session.

On devices that support the VBUS glitch filter, the USB_HOST_PWREN_FILTER can be added to ignore small short drops in VBUS level caused by high power consumption. This is mainly used to avoid causing VBUS errors caused by devices with high in-rush current.

Note
The following values have been deprecated and should no longer be used.
  • USB_HOST_PWREN_LOW - Automatically drive USBnEPEN low when power is enabled.
  • USB_HOST_PWREN_HIGH - Automatically drive USBnEPEN high when power is enabled.
  • USB_HOST_PWREN_VBLOW - Automatically drive USBnEPEN low when power is enabled.
  • USB_HOST_PWREN_VBHIGH - Automatically drive USBnEPEN high when power is enabled.
This function should only be called on microcontrollers that support host mode or OTG operation.
Returns
None.
void USBHostPwrDisable ( uint32_t  ulBase)

Disables the external power pin.

Parameters
ulBasespecifies the USB module base address.

This function disables the USBEPEN signal to disable an external power supply in host mode operation.

Note
This function should only be called in host mode.
Returns
None.
void USBHostPwrEnable ( uint32_t  ulBase)

Enables the external power pin.

Parameters
ulBasespecifies the USB module base address.

This function enables the USBEPEN signal to enable an external power supply in host mode operation.

Note
This function should only be called in host mode.
Returns
None.
void USBHostPwrFaultDisable ( uint32_t  ulBase)

Disables power fault detection.

Parameters
ulBasespecifies the USB module base address.

This function disables power fault detection in the USB controller.

Note
This function should only be called in host mode.
Returns
None.
void USBHostPwrFaultEnable ( uint32_t  ulBase)

Enables power fault detection.

Parameters
ulBasespecifies the USB module base address.

This function enables power fault detection in the USB controller. If the USBPFLT pin is not in use this function should not be used.

Note
This function should only be called in host mode.
Returns
None.
void USBHostRequestIN ( uint32_t  ulBase,
uint32_t  ulEndpoint 
)

Schedules a request for an IN transaction on an endpoint in host mode.

Parameters
ulBasespecifies the USB module base address.
ulEndpointis the endpoint to access.

This function will schedule a request for an IN transaction. When the USB device being communicated with responds the data, the data can be retrieved by calling USBEndpointDataGet() or via a DMA transfer.

Note
This function should only be called in host mode.
Returns
None.
void USBHostRequestINClear ( uint32_t  ulBase,
uint32_t  ulEndpoint 
)

Stop any request for an IN transaction on an endpoint in host mode. This is used to stop further requests during teardown process.

Parameters
ulBasespecifies the USB module base address.
ulEndpointis the endpoint to access.

This function will stop further requests for an IN transaction. When the USB device being communicated with responds the data, the data can be retrieved by calling USBEndpointDataGet() or via a DMA transfer.

Note
This function should only be called in host mode.
Returns
None.
void USBHostRequestStatus ( uint32_t  ulBase)

Issues a request for a status IN transaction on endpoint zero.

Parameters
ulBasespecifies the USB module base address.

This function is used to cause a request for an status IN transaction from a device on endpoint zero. This function can only be used with endpoint zero as that is the only control endpoint that supports this ability. This is used to complete the last phase of a control transaction to a device and an interrupt will be signaled when the status packet has been received.

Returns
None.
void USBHostReset ( uint32_t  ulBase,
uint32_t  bStart 
)

Handles the USB bus reset condition.

Parameters
ulBasespecifies the USB module base address.
bStartspecifies whether to start or stop signaling reset on the USB bus.

When this function is called with the bStart parameter set to true, this function will cause the start of a reset condition on the USB bus. The caller should then delay at least 20ms before calling this function again with the bStart parameter set to false.

Note
This function should only be called in host mode.
Returns
None.
void USBHostResume ( uint32_t  ulBase,
uint32_t  bStart 
)

Handles the USB bus resume condition.

Parameters
ulBasespecifies the USB module base address.
bStartspecifies if the USB controller is entering or leaving the resume signaling state.

When in device mode this function will bring the USB controller out of the suspend state. This call should first be made with the bStart parameter set to true to start resume signaling. The device application should then delay at least 10ms but not more than 15ms before calling this function with the bStart parameter set to false.

When in host mode this function will signal devices to leave the suspend state. This call should first be made with the bStart parameter set to true to start resume signaling. The host application should then delay at least 20ms before calling this function with the bStart parameter set to false. This will cause the controller to complete the resume signaling on the USB bus.

Returns
None.
uint32_t USBHostSpeedGet ( uint32_t  ulBase)

Returns the current speed of the USB device connected.

Parameters
ulBasespecifies the USB module base address.

This function will return the current speed of the USB bus.

Note
This function should only be called in host mode.
Returns
Returns either USB_LOW_SPEED, USB_FULL_SPEED, or USB_UNDEF_SPEED.
void USBHostSuspend ( uint32_t  ulBase)

Puts the USB bus in a suspended state.

Parameters
ulBasespecifies the USB module base address.

When used in host mode, this function will put the USB bus in the suspended state.

Note
This function should only be called in host mode.
Returns
None.
static uint32_t USBIndexRead ( uint32_t  ulBase,
uint32_t  ulEndpoint,
uint32_t  ulIndexedReg,
uint32_t  ulSize 
)
static

Reads one of the indexed registers.

Parameters
ulBasespecifies the USB module base address.
ulEndpointis the endpoint index to target for this write.
ulIndexedRegis the indexed register to write to.

This function is used interally to access the indexed registers for each endpoint. The only registers that are indexed are the FIFO configuration registers which are not used after configuration.

Returns
The value in the register requested.
static void USBIndexWrite ( uint32_t  ulBase,
uint32_t  ulEndpoint,
uint32_t  ulIndexedReg,
uint32_t  ulValue,
uint32_t  ulSize 
)
static

Sets one of the indexed registers.

Parameters
ulBasespecifies the USB module base address.
ulEndpointis the endpoint index to target for this write.
ulIndexedRegis the indexed register to write to.
ucValueis the value to write to the register.

This function is used to access the indexed registers for each endpoint. The only registers that are indexed are the FIFO configuration registers which are not used after configuration.

Returns
None.
void USBIntDisable ( uint32_t  ulBase,
uint32_t  ulFlags 
)

Disables the sources for USB interrupts.

Parameters
ulBasespecifies the USB module base address.
ulFlagsspecifies which interrupts to disable.

This function will disable the USB controller from generating the interrupts indicated by the ulFlags parameter. There are three groups of interrupt sources, IN Endpoints, OUT Endpoints, and general status changes, specified by USB_INT_HOST_IN, USB_INT_HOST_OUT, USB_INT_DEV_IN, USB_INT_DEV_OUT, and USB_INT_STATUS. If USB_INT_ALL is specified then all interrupts will be disabled.

Note
WARNING: This API cannot be used on endpoint numbers greater than endpoint 3 so USBIntDisableControl() or USBIntDisableEndpoint() should be used instead.
Returns
None.
void USBIntDisableControl ( uint32_t  ulBase,
uint32_t  ulFlags 
)

Disable control interrupts on a given USB controller.

Parameters
ulBasespecifies the USB module base address.
ulFlagsspecifies which control interrupts to disable.

This function will disable the control interrupts for the USB controller specified by the ulBase parameter. The ulFlags parameter specifies which control interrupts to disable. The flags passed in the ulFlags parameters should be the definitions that start with USB_INTCTRL_* and not any other USB_INT flags.

Returns
None.
void USBIntDisableEndpoint ( uint32_t  ulBase,
uint32_t  ulFlags 
)

Disable endpoint interrupts on a given USB controller.

Parameters
ulBasespecifies the USB module base address.
ulFlagsspecifies which endpoint interrupts to disable.

This function will disable endpoint interrupts for the USB controller specified by the ulBase parameter. The ulFlags parameter specifies which endpoint interrupts to disable. The flags passed in the ulFlags parameters should be the definitions that start with USB_INTEP_* and not any other USB_INT flags.

Returns
None.
void USBIntEnable ( uint32_t  ulBase,
uint32_t  ulFlags 
)

Enables the sources for USB interrupts.

Parameters
ulBasespecifies the USB module base address.
ulFlagsspecifies which interrupts to enable.

This function will enable the USB controller's ability to generate the interrupts indicated by the ulFlags parameter. There are three groups of interrupt sources, IN Endpoints, OUT Endpoints, and general status changes, specified by USB_INT_HOST_IN, USB_INT_HOST_OUT, USB_INT_DEV_IN, USB_INT_DEV_OUT, and USB_STATUS. If USB_INT_ALL is specified then all interrupts will be enabled.

Note
A call must be made to enable the interrupt in the main interrupt controller to receive interrupts. The USBIntRegister() API performs this controller level interrupt enable. However if static interrupt handlers are used then then a call to IntEnable() must be made in order to allow any USB interrupts to occur.
WARNING: This API cannot be used on endpoint numbers greater than endpoint 3 so USBIntEnableControl() or USBIntEnableEndpoint() should be used instead.
Returns
None.
void USBIntEnableControl ( uint32_t  ulBase,
uint32_t  ulFlags 
)

Enable control interrupts on a given USB controller.

Parameters
ulBasespecifies the USB module base address.
ulFlagsspecifies which control interrupts to enable.

This function will enable the control interrupts for the USB controller specified by the ulBase parameter. The ulFlags parameter specifies which control interrupts to enable. The flags passed in the ulFlags parameters should be the definitions that start with USB_INTCTRL_* and not any other USB_INT flags.

Returns
None.
void USBIntEnableEndpoint ( uint32_t  ulBase,
uint32_t  ulFlags 
)

Enable endpoint interrupts on a given USB controller.

Parameters
ulBasespecifies the USB module base address.
ulFlagsspecifies which endpoint interrupts to enable.

This function will enable endpoint interrupts for the USB controller specified by the ulBase parameter. The ulFlags parameter specifies which endpoint interrupts to enable. The flags passed in the ulFlags parameters should be the definitions that start with USB_INTEP_* and not any other USB_INT flags.

Returns
None.
uint32_t USBIntStatus ( uint32_t  ulBase)

Returns the status of the USB interrupts.

Parameters
ulBasespecifies the USB module base address.

This function will read the source of the interrupt for the USB controller. There are three groups of interrupt sources, IN Endpoints, OUT Endpoints, and general status changes. This call will return the current status for all of these interrupts. The bit values returned should be compared against the USB_HOST_IN, USB_HOST_OUT, USB_HOST_EP0, USB_DEV_IN, USB_DEV_OUT, and USB_DEV_EP0 values.

Note
This call will clear the source of all of the general status interrupts.
WARNING: This API cannot be used on endpoint numbers greater than endpoint 3 so USBIntStatusControl() or USBIntStatusEndpoint() should be used instead.
Returns
Returns the status of the sources for the USB controller's interrupt.
uint32_t USBIntStatusControl ( uint32_t  ulBase)

Returns the control interrupt status on a given USB controller.

Parameters
ulBasespecifies the USB module base address.

This function will read control interrupt status for a USB controller. This call will return the current status for control interrupts only, the endpoint interrupt status is retrieved by calling USBIntStatusEndpoint(). The bit values returned should be compared against the USB_INTCTRL_* values.

The following are the meanings of all USB_INCTRL_ flags and the modes for which they are valid. These values apply to any calls to USBIntStatusControl(), USBIntEnableControl(), and USBIntDisableConrol(). Some of these flags are only valid in the following modes as indicated in the parenthesis: Host, Device, and OTG.

  • USB_INTCTRL_ALL - A full mask of all control interrupt sources.
  • USB_INTCTRL_VBUS_ERR - A VBUS error has occurred (Host Only).
  • USB_INTCTRL_SESSION - Session Start Detected on A-side of cable (OTG Only).
  • USB_INTCTRL_SESSION_END - Session End Detected (Device Only)
  • USB_INTCTRL_DISCONNECT - Device Disconnect Detected (Host Only)
  • USB_INTCTRL_CONNECT - Device Connect Detected (Host Only)
  • USB_INTCTRL_SOF - Start of Frame Detected.
  • USB_INTCTRL_BABBLE - USB controller detected a device signalling past the end of a frame. (Host Only)
  • USB_INTCTRL_RESET - Reset signalling detected by device. (Device Only)
  • USB_INTCTRL_RESUME - Resume signalling detected.
  • USB_INTCTRL_SUSPEND - Suspend signalling detected by device (Device Only)
  • USB_INTCTRL_MODE_DETECT - OTG cable mode detection has completed (OTG Only)
  • USB_INTCTRL_POWER_FAULT - Power Fault detected. (Host Only)
Note
This call will clear the source of all of the control status interrupts.
Returns
Returns the status of the control interrupts for a USB controller.
uint32_t USBIntStatusEndpoint ( uint32_t  ulBase)

Returns the endpoint interrupt status on a given USB controller.

Parameters
ulBasespecifies the USB module base address.

This function will read endpoint interrupt status for a USB controller. This call will return the current status for endpoint interrupts only, the control interrupt status is retrieved by calling USBIntStatusControl(). The bit values returned should be compared against the USB_INTEP_* values. These are grouped into classes for USB_INTEP_HOST_* and USB_INTEP_DEV_* values to handle both host and device modes with all endpoints.

Note
This call will clear the source of all of the endpoint interrupts.
Returns
Returns the status of the endpoint interrupts for a USB controller.
uint32_t USBModeGet ( uint32_t  ulBase)

Returns the current operating mode of the controller.

Parameters
ulBasespecifies the USB module base address.

This function returns the current operating mode on USB controllers with OTG or Dual mode functionality.

For OTG controllers:

The function will return on of the following values on OTG controllers: USB_OTG_MODE_ASIDE_HOST, USB_OTG_MODE_ASIDE_DEV, USB_OTG_MODE_BSIDE_HOST, USB_OTG_MODE_BSIDE_DEV, USB_OTG_MODE_NONE.

USB_OTG_MODE_ASIDE_HOST indicates that the controller is in host mode on the A-side of the cable.

USB_OTG_MODE_ASIDE_DEV indicates that the controller is in device mode on the A-side of the cable.

USB_OTG_MODE_BSIDE_HOST indicates that the controller is in host mode on the B-side of the cable.

USB_OTG_MODE_BSIDE_DEV indicates that the controller is in device mode on the B-side of the cable. If and OTG session request is started with no cable in place this is the default mode for the controller.

USB_OTG_MODE_NONE indicates that the controller is not attempting to determine its role in the system.

For Dual Mode controllers:

The function will return on of the following values: USB_DUAL_MODE_HOST, USB_DUAL_MODE_DEVICE, or USB_DUAL_MODE_NONE.

USB_DUAL_MODE_HOST indicates that the controller is acting as a host.

USB_DUAL_MODE_DEVICE indicates that the controller acting as a device.

USB_DUAL_MODE_NONE indicates that the controller is not active as either a host or device.

Returns
Returns USB_OTG_MODE_ASIDE_HOST, USB_OTG_MODE_ASIDE_DEV, USB_OTG_MODE_BSIDE_HOST, USB_OTG_MODE_BSIDE_DEV, USB_OTG_MODE_NONE, USB_DUAL_MODE_HOST, USB_DUAL_MODE_DEVICE, or USB_DUAL_MODE_NONE.
void USBOTGSessionRequest ( uint32_t  ulBase,
uint32_t  bStart 
)

Starts or ends a session.

Parameters
ulBasespecifies the USB module base address.
bStartspecifies if this call starts or ends a session.

This function is used in OTG mode to start a session request or end a session. If the bStart parameter is set to true, then this function start a session and if it is false it will end a session.

Returns
None.
void USBReset ( uint32_t  ulBase)

Resets the USB Controller

Parameters
None.
Returns
None.
void USBWrapperEnableInt ( uint32_t  ulBase)

This API enables the USB Interrupts through subsystem specific wrapper registers.

Parameters
Baseaddress
Returns
None

Copyright 2016, Texas Instruments Incorporated