![]() |
![]() |
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) |
| uint32_t USBDevAddrGet | ( | uint32_t | ulBase | ) |
Returns the current device address in device mode.
| ulBase | specifies the USB module base address. |
This function will return the current device address. This address was set by a call to USBDevAddrSet().
| void USBDevAddrSet | ( | uint32_t | ulBase, |
| uint32_t | ulAddress | ||
| ) |
Sets the address in device mode.
| ulBase | specifies the USB module base address. |
| ulAddress | is 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.
| void USBDevConnect | ( | uint32_t | ulBase | ) |
Connects the USB controller to the bus in device mode.
| ulBase | specifies 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.
| void USBDevDisconnect | ( | uint32_t | ulBase | ) |
Removes the USB controller from the bus in device mode.
| ulBase | specifies 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.
| void USBDevEndpointConfigGet | ( | uint32_t | ulBase, |
| uint32_t | ulEndpoint, | ||
| uint32_t * | pulMaxPacketSize, | ||
| uint32_t * | pulFlags | ||
| ) |
Gets the current configuration for an endpoint.
| ulBase | specifies the USB module base address. |
| ulEndpoint | is the endpoint to access. |
| pulMaxPacketSize | is a pointer which will be written with the maximum packet size for this endpoint. |
| pulFlags | is 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.
| void USBDevEndpointConfigSet | ( | uint32_t | ulBase, |
| uint32_t | ulEndpoint, | ||
| uint32_t | ulMaxPacketSize, | ||
| uint32_t | ulFlags | ||
| ) |
Sets the configuration for an endpoint.
| ulBase | specifies the USB module base address. |
| ulEndpoint | is the endpoint to access. |
| ulMaxPacketSize | is the maximum packet size for this endpoint. |
| ulFlags | are 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.
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.
| 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.
| ulBase | specifies the USB module base address. |
| ulEndpoint | is the endpoint to access. |
| bIsLastPacket | indicates 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.
| void USBDevEndpointStall | ( | uint32_t | ulBase, |
| uint32_t | ulEndpoint, | ||
| uint32_t | ulFlags | ||
| ) |
Stalls the specified endpoint in device mode.
| ulBase | specifies the USB module base address. |
| ulEndpoint | specifies the endpoint to stall. |
| ulFlags | specifies 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.
| void USBDevEndpointStallClear | ( | uint32_t | ulBase, |
| uint32_t | ulEndpoint, | ||
| uint32_t | ulFlags | ||
| ) |
Clears the stall condition on the specified endpoint in device mode.
| ulBase | specifies the USB module base address. |
| ulEndpoint | specifies which endpoint to remove the stall condition. |
| ulFlags | specifies 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.
| void USBDevEndpointStatusClear | ( | uint32_t | ulBase, |
| uint32_t | ulEndpoint, | ||
| uint32_t | ulFlags | ||
| ) |
Clears the status bits in this endpoint in device mode.
| ulBase | specifies the USB module base address. |
| ulEndpoint | is the endpoint to access. |
| ulFlags | are 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.
| void USBEnableOtgIntr | ( | uint32_t | ulBase | ) |
Enables the USB interrupt at OTG level.
| None. |
| uint32_t USBEndpointDataAvail | ( | uint32_t | ulBase, |
| uint32_t | ulEndpoint | ||
| ) |
Determine the number of bytes of data available in a given endpoint's FIFO.
| ulBase | specifies the USB module base address. |
| ulEndpoint | is 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.
| int USBEndpointDataGet | ( | uint32_t | ulBase, |
| uint32_t | ulEndpoint, | ||
| unsigned char * | pucData, | ||
| uint32_t * | pulSize | ||
| ) |
Retrieves data from the given endpoint's FIFO.
| ulBase | specifies the USB module base address. |
| ulEndpoint | is the endpoint to access. |
| pucData | is a pointer to the data area used to return the data from the FIFO. |
| pulSize | is 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.
| int USBEndpointDataPut | ( | uint32_t | ulBase, |
| uint32_t | ulEndpoint, | ||
| unsigned char * | pucData, | ||
| uint32_t | ulSize | ||
| ) |
Puts data into the given endpoint's FIFO.
| ulBase | specifies the USB module base address. |
| ulEndpoint | is the endpoint to access. |
| pucData | is a pointer to the data area used as the source for the data to put into the FIFO. |
| ulSize | is 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().
| int USBEndpointDataSend | ( | uint32_t | ulBase, |
| uint32_t | ulEndpoint, | ||
| uint32_t | ulTransType | ||
| ) |
Starts the transfer of data from an endpoint's FIFO.
| ulBase | specifies the USB module base address. |
| ulEndpoint | is the endpoint to access. |
| ulTransType | is 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:
| void USBEndpointDataToggleClear | ( | uint32_t | ulBase, |
| uint32_t | ulEndpoint, | ||
| uint32_t | ulFlags | ||
| ) |
Sets the Data toggle on an endpoint to zero.
| ulBase | specifies the USB module base address. |
| ulEndpoint | specifies the endpoint to reset the data toggle. |
| ulFlags | specifies 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.
| void USBEndpointDMAChannel | ( | uint32_t | ulBase, |
| uint32_t | ulEndpoint, | ||
| uint32_t | ulChannel | ||
| ) |
Sets the DMA channel to use for a given endpoint.
| ulBase | specifies the USB module base address. |
| ulEndpoint | specifies which endpoint's FIFO address to return. |
| ulChannel | specifies 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.
| void USBEndpointDMADisable | ( | uint32_t | ulBase, |
| uint32_t | ulEndpoint, | ||
| uint32_t | ulFlags | ||
| ) |
Disable DMA on a given endpoint.
| ulBase | specifies the USB module base address. |
| ulEndpoint | is the endpoint to access. |
| ulFlags | specifies 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.
| void USBEndpointDMAEnable | ( | uint32_t | ulBase, |
| uint32_t | ulEndpoint, | ||
| uint32_t | ulFlags | ||
| ) |
Enable DMA on a given endpoint.
| ulBase | specifies the USB module base address. |
| ulEndpoint | is the endpoint to access. |
| ulFlags | specifies 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.
| uint32_t USBEndpointStatus | ( | uint32_t | ulBase, |
| uint32_t | ulEndpoint | ||
| ) |
Returns the current status of an endpoint.
| ulBase | specifies the USB module base address. |
| ulEndpoint | is 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:
The following are the status flags for device mode:
| uint32_t USBFIFOAddrGet | ( | uint32_t | ulBase, |
| uint32_t | ulEndpoint | ||
| ) |
Returns the absolute FIFO address for a given endpoint.
| ulBase | specifies the USB module base address. |
| ulEndpoint | specifies 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.
| void USBFIFOConfigGet | ( | uint32_t | ulBase, |
| uint32_t | ulEndpoint, | ||
| uint32_t * | pulFIFOAddress, | ||
| uint32_t * | pulFIFOSize, | ||
| uint32_t | ulFlags | ||
| ) |
Returns the FIFO configuration for an endpoint.
| ulBase | specifies the USB module base address. |
| ulEndpoint | is the endpoint to access. |
| pulFIFOAddress | is the starting address for the FIFO. |
| pulFIFOSize | is the size of the FIFO in bytes. |
| ulFlags | specifies 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.
| void USBFIFOConfigSet | ( | uint32_t | ulBase, |
| uint32_t | ulEndpoint, | ||
| uint32_t | ulFIFOAddress, | ||
| uint32_t | ulFIFOSize, | ||
| uint32_t | ulFlags | ||
| ) |
Sets the FIFO configuration for an endpoint.
| ulBase | specifies the USB module base address. |
| ulEndpoint | is the endpoint to access. |
| ulFIFOAddress | is the starting address for the FIFO. |
| ulFIFOSize | is the size of the FIFO in bytes. |
| ulFlags | specifies 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.
| void USBFIFOFlush | ( | uint32_t | ulBase, |
| uint32_t | ulEndpoint, | ||
| uint32_t | ulFlags | ||
| ) |
Forces a flush of an endpoint's FIFO.
| ulBase | specifies the USB module base address. |
| ulEndpoint | is the endpoint to access. |
| ulFlags | specifies 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.
| uint32_t USBFrameNumberGet | ( | uint32_t | ulBase | ) |
Get the current frame number.
| ulBase | specifies the USB module base address. |
This function 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.
| ulBase | specifies the USB module base address. |
| ulEndpoint | is the endpoint to access. |
| ulFlags | determines 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.
| 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.
| ulBase | specifies the USB module base address. |
| ulEndpoint | is the endpoint to access. |
| ulAddr | is the functional address for the controller to use for this endpoint. |
| ulFlags | determines 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.
| 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.
| ulBase | specifies the USB module base address. |
| ulEndpoint | is the endpoint to access. |
This function will clear autoreq bit, which when set, will autorequest for packet when FIFOs are empty.
| void USBHostAutoReqSet | ( | uint32_t | ulBase, |
| uint32_t | ulEndpoint | ||
| ) |
Autorequest for packet when FIFOs are empty.
| ulBase | specifies the USB module base address. |
| ulEndpoint | is the endpoint to access. |
This function will set autoreq bit, which when set, will autorequest for packet when FIFOs are empty.
| 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.
| ulBase | specifies the USB module base address. |
| ulEndpoint | is the endpoint to access. |
| ulMaxPayload | is the maximum payload for this endpoint. |
| ulNAKPollInterval | is the either the NAK timeout limit or the polling interval depending on the type of endpoint. |
| ulTargetEndpoint | is the endpoint that the host endpoint is targeting. |
| ulFlags | are 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.
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().
| void USBHostEndpointDataAck | ( | uint32_t | ulBase, |
| uint32_t | ulEndpoint | ||
| ) |
Acknowledge that data was read from the given endpoint's FIFO in host mode.
| ulBase | specifies the USB module base address. |
| ulEndpoint | is 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.
| 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.
| ulBase | specifies the USB module base address. |
| ulEndpoint | specifies the endpoint to reset the data toggle. |
| bDataToggle | specifies whether to set the state to DATA0 or DATA1. |
| ulFlags | specifies 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.
| void USBHostEndpointStatusClear | ( | uint32_t | ulBase, |
| uint32_t | ulEndpoint, | ||
| uint32_t | ulFlags | ||
| ) |
Clears the status bits in this endpoint in host mode.
| ulBase | specifies the USB module base address. |
| ulEndpoint | is the endpoint to access. |
| ulFlags | are 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.
| uint32_t USBHostHubAddrGet | ( | uint32_t | ulBase, |
| uint32_t | ulEndpoint, | ||
| uint32_t | ulFlags | ||
| ) |
Get the current device hub address for this endpoint.
| ulBase | specifies the USB module base address. |
| ulEndpoint | is the endpoint to access. |
| ulFlags | determines 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.
| 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.
| ulBase | specifies the USB module base address. |
| ulEndpoint | is the endpoint to access. |
| ulAddr | is the hub address for the device using this endpoint. |
| ulFlags | determines 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.
| void USBHostPwrConfig | ( | uint32_t | ulBase, |
| uint32_t | ulFlags | ||
| ) |
Sets the configuration for USB power fault.
| ulBase | specifies the USB module base address. |
| ulFlags | specifies 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:
One of the following can be selected as the power fault action:
One of the following can be selected as the power enable level and source:
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.
| void USBHostPwrDisable | ( | uint32_t | ulBase | ) |
Disables the external power pin.
| ulBase | specifies the USB module base address. |
This function disables the USBEPEN signal to disable an external power supply in host mode operation.
| void USBHostPwrEnable | ( | uint32_t | ulBase | ) |
Enables the external power pin.
| ulBase | specifies the USB module base address. |
This function enables the USBEPEN signal to enable an external power supply in host mode operation.
| void USBHostPwrFaultDisable | ( | uint32_t | ulBase | ) |
Disables power fault detection.
| ulBase | specifies the USB module base address. |
This function disables power fault detection in the USB controller.
| void USBHostPwrFaultEnable | ( | uint32_t | ulBase | ) |
Enables power fault detection.
| ulBase | specifies 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.
| void USBHostRequestIN | ( | uint32_t | ulBase, |
| uint32_t | ulEndpoint | ||
| ) |
Schedules a request for an IN transaction on an endpoint in host mode.
| ulBase | specifies the USB module base address. |
| ulEndpoint | is 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.
| 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.
| ulBase | specifies the USB module base address. |
| ulEndpoint | is 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.
| void USBHostRequestStatus | ( | uint32_t | ulBase | ) |
Issues a request for a status IN transaction on endpoint zero.
| ulBase | specifies 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.
| void USBHostReset | ( | uint32_t | ulBase, |
| uint32_t | bStart | ||
| ) |
Handles the USB bus reset condition.
| ulBase | specifies the USB module base address. |
| bStart | specifies 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.
| void USBHostResume | ( | uint32_t | ulBase, |
| uint32_t | bStart | ||
| ) |
Handles the USB bus resume condition.
| ulBase | specifies the USB module base address. |
| bStart | specifies 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.
| uint32_t USBHostSpeedGet | ( | uint32_t | ulBase | ) |
Returns the current speed of the USB device connected.
| ulBase | specifies the USB module base address. |
This function will return the current speed of the USB bus.
| void USBHostSuspend | ( | uint32_t | ulBase | ) |
Puts the USB bus in a suspended state.
| ulBase | specifies the USB module base address. |
When used in host mode, this function will put the USB bus in the suspended state.
|
static |
Reads one of the indexed registers.
| ulBase | specifies the USB module base address. |
| ulEndpoint | is the endpoint index to target for this write. |
| ulIndexedReg | is 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.
|
static |
Sets one of the indexed registers.
| ulBase | specifies the USB module base address. |
| ulEndpoint | is the endpoint index to target for this write. |
| ulIndexedReg | is the indexed register to write to. |
| ucValue | is 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.
| void USBIntDisable | ( | uint32_t | ulBase, |
| uint32_t | ulFlags | ||
| ) |
Disables the sources for USB interrupts.
| ulBase | specifies the USB module base address. |
| ulFlags | specifies 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.
| void USBIntDisableControl | ( | uint32_t | ulBase, |
| uint32_t | ulFlags | ||
| ) |
Disable control interrupts on a given USB controller.
| ulBase | specifies the USB module base address. |
| ulFlags | specifies 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.
| void USBIntDisableEndpoint | ( | uint32_t | ulBase, |
| uint32_t | ulFlags | ||
| ) |
Disable endpoint interrupts on a given USB controller.
| ulBase | specifies the USB module base address. |
| ulFlags | specifies 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.
| void USBIntEnable | ( | uint32_t | ulBase, |
| uint32_t | ulFlags | ||
| ) |
Enables the sources for USB interrupts.
| ulBase | specifies the USB module base address. |
| ulFlags | specifies 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.
| void USBIntEnableControl | ( | uint32_t | ulBase, |
| uint32_t | ulFlags | ||
| ) |
Enable control interrupts on a given USB controller.
| ulBase | specifies the USB module base address. |
| ulFlags | specifies 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.
| void USBIntEnableEndpoint | ( | uint32_t | ulBase, |
| uint32_t | ulFlags | ||
| ) |
Enable endpoint interrupts on a given USB controller.
| ulBase | specifies the USB module base address. |
| ulFlags | specifies 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.
| uint32_t USBIntStatus | ( | uint32_t | ulBase | ) |
Returns the status of the USB interrupts.
| ulBase | specifies 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.
| uint32_t USBIntStatusControl | ( | uint32_t | ulBase | ) |
Returns the control interrupt status on a given USB controller.
| ulBase | specifies 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.
| uint32_t USBIntStatusEndpoint | ( | uint32_t | ulBase | ) |
Returns the endpoint interrupt status on a given USB controller.
| ulBase | specifies 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.
| uint32_t USBModeGet | ( | uint32_t | ulBase | ) |
Returns the current operating mode of the controller.
| ulBase | specifies 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.
| void USBOTGSessionRequest | ( | uint32_t | ulBase, |
| uint32_t | bStart | ||
| ) |
Starts or ends a session.
| ulBase | specifies the USB module base address. |
| bStart | specifies 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.
| void USBReset | ( | uint32_t | ulBase | ) |
Resets the USB Controller
| None. |
| void USBWrapperEnableInt | ( | uint32_t | ulBase | ) |
This API enables the USB Interrupts through subsystem specific wrapper registers.
| Base | address |