Functions | |
void | USBHostLPMSend (uint32_t ui32Base, uint32_t ui32Address, uint32_t ui32Endpoint) |
void | USBHostLPMConfig (uint32_t ui32Base, uint32_t ui32ResumeTime, uint32_t ui32Config) |
void | USBHostLPMResume (uint32_t ui32Base) |
void | USBDevLPMRemoteWake (uint32_t ui32Base) |
void | USBDevLPMConfig (uint32_t ui32Base, uint32_t ui32Config) |
void | USBDevLPMEnable (uint32_t ui32Base) |
void | USBDevLPMDisable (uint32_t ui32Base) |
uint32_t | USBLPMLinkStateGet (uint32_t ui32Base) |
uint32_t | USBLPMEndpointGet (uint32_t ui32Base) |
bool | USBLPMRemoteWakeEnabled (uint32_t ui32Base) |
uint32_t | USBLPMIntStatus (uint32_t ui32Base) |
void | USBLPMIntEnable (uint32_t ui32Base, uint32_t ui32Ints) |
void | USBLPMIntDisable (uint32_t ui32Base, uint32_t ui32Ints) |
void USBHostLPMSend | ( | uint32_t | ui32Base, |
uint32_t | ui32Address, | ||
uint32_t | ui32Endpoint | ||
) |
Sends an LPM request to a device at a specified address and endpoint number.
ui32Base | specifies the USB module base address. |
ui32Address | is the target device address for the LPM request. |
ui32Endpoint | is the target endpoint for the LPM request. |
This function sends an LPM request to a connected device in host mode. The ui32Address parameter specifies the device address and has a range of values from 1 to 127. The ui32Endpoint parameter specifies the endpoint on the device to which to send the LPM request and must be one of the USB_EP_* values. The function returns before the LPM request is sent, requiring the caller to poll the USBLPMIntStatus() function or wait for an interrupt to signal completion of the LPM transaction. This function must only be called after the USBHostLPMConfig() has configured the LPM transaction settings.
Example: Send an LPM request to the device at address 1 on endpoint 0.
//! // //! // Send an LPM request to the device at address 1 on endpoint 0. //! // //! USBHostLPMSend(USB0_BASE, 1, USB_EP_0); //!
\note This function must only be called in host mode. \return None.
References ASSERT, HWREGB, HWREGH, USB_LPMATTR_ENDPT_M, USB_LPMATTR_ENDPT_S, USB_LPMCNTRL_TXLPM, USB_O_LPMATTR, USB_O_LPMCNTRL, USB_O_LPMFADDR, and USBEPToIndex.
void USBHostLPMConfig | ( | uint32_t | ui32Base, |
uint32_t | ui32ResumeTime, | ||
uint32_t | ui32Config | ||
) |
Sets the global configuration for all LPM requests.
ui32Base | specifies the USB module base address. |
ui32ResumeTime | specifies the resume signaling duration in 75us increments. |
ui32Config | specifies the combination of configuration options for LPM transactions. |
This function sets the global configuration options for LPM transactions and must be called at least once before ever calling USBHostLPMSend(). The ui32ResumeTime specifies the length of time that the host drives resume signaling on the bus in microseconds. The valid values for ui32ResumeTime are from 50us to 1175us in 75us increments. The remaining configuration is specified by the ui32Config parameter and includes the following options:
Example: Set the LPM configuration to allow remote wake with a resume duration of 500us.
//! // //! // Set the LPM configuration to allow remote wake with a resume //! // duration of 500us. //! // //! USBHostLPMConfig(USB0_BASE, 500, USB_HOST_LPM_RMTWAKE | USB_HOST_LPM_L1); //!
\note This function must only be called in host mode. \return None.
References ASSERT, HWREGH, USB_LPMATTR_HIRD_S, and USB_O_LPMATTR.
void USBHostLPMResume | ( | uint32_t | ui32Base | ) |
Initiates resume signaling to wake a device from LPM suspend mode.
ui32Base | specifies the USB module base address. |
In host mode, this function initiates resume signaling to wake a device that has entered an LPM-triggered low power mode. This LPM-triggered low power mode is entered when the USBHostLPMSend() is called to put a specific device into a low power state.
Example: Initiate resume signaling.
//! // //! // Initiate resume signaling. //! // //! USBHostLPMResume(USB0_BASE); //!
\note This function must only be called in host mode. \return None.
References ASSERT, HWREGB, USB_LPMCNTRL_RES, and USB_O_LPMCNTRL.
void USBDevLPMRemoteWake | ( | uint32_t | ui32Base | ) |
Initiates remote wake signaling to request the device to leave LPM suspend mode.
ui32Base | specifies the USB module base address. |
This function initiates remote wake signaling to request that the host wake a device that has entered an LPM-triggered low power mode.
Example: Initiate remote wake signaling.
//! // //! // Initiate remote wake signaling. //! // //! USBDevLPMRemoteWake(USB0_BASE); //!
\note This function must only be called in device mode. \return None.
References ASSERT, HWREGB, USB_LPMCNTRL_RES, and USB_O_LPMCNTRL.
void USBDevLPMConfig | ( | uint32_t | ui32Base, |
uint32_t | ui32Config | ||
) |
Configures the USB device mode response to LPM requests.
ui32Base | specifies the USB module base address. |
ui32Config | is the combination of configuration options for LPM transactions in device mode. |
This function sets the global configuration options for LPM transactions in device mode and must be called before ever calling USBDevLPMEnable() to set the configuration for LPM transactions. The configuration options in device mode are specified in the ui32Config parameter and include one of the following:
The ui32Config option can also optionally include the USB_DEV_LPM_NAK value to cause the USB controller to NAK all transactions other than an LPM transaction once the USB controller is in LPM suspend mode. If this value is not included in the ui32Config parameter, the USB controller does not respond in suspend mode.
The USB controller does not enter LPM suspend mode until the application calls the USBDevLPMEnable() function.
Example: Enable LPM transactions and NAK while in LPM suspend mode.
//! // //! // Enable LPM transactions and NAK while in LPM suspend mode. //! // //! USBDevLPMConfig(USB0_BASE, USB_DEV_LPM_NAK | USB_DEV_LPM_EN); //!
\note This function must only be called in device mode. \return None.
References ASSERT, HWREGB, and USB_O_LPMCNTRL.
void USBDevLPMEnable | ( | uint32_t | ui32Base | ) |
Enables the USB controller to respond to LPM suspend requests.
ui32Base | specifies the USB module base address. |
This function is used to automatically respond to an LPM sleep request from the USB host controller. If there is no data pending in any transmit FIFOs, then the USB controller acknowledges the packet and enters the LPM L1 state and generates the USB_INTLPM_ACK interrupt. If the USB controller has pending transmit data in at least one FIFO, then the USB controller responds with NYET and signals the USB_INTLPM_INCOMPLETE or USB_INTLPM_NYET depending on if data is pending in receive or transmit FIFOs. A call to USBDevLPMEnable() is required after every LPM resume event to re-enable LPM mode.
Example: Enable LPM suspend mode.
//! // //! // Enable LPM suspend mode. //! // //! USBDevLPMEnable(USB0_BASE); //!
\note This function must only be called in device mode. \return None.
References ASSERT, HWREGB, USB_LPMCNTRL_EN_LPMEXT, USB_LPMCNTRL_TXLPM, and USB_O_LPMCNTRL.
void USBDevLPMDisable | ( | uint32_t | ui32Base | ) |
Disables the USB controller from responding to LPM suspend requests.
ui32Base | specifies the USB module base address. |
This function disables the USB controller from responding to LPM transactions. When the device enters LPM L1 mode, the USB controller automatically disables responding to further LPM transactions.
Example: Disable LPM suspend mode.
//! // //! // Disable LPM suspend mode. //! // //! USBDevLPMDisable(USB0_BASE); //!
\note This function must only be called in device mode. \return None.
References ASSERT, HWREGB, USB_LPMCNTRL_TXLPM, and USB_O_LPMCNTRL.
uint32_t USBLPMLinkStateGet | ( | uint32_t | ui32Base | ) |
Returns the current link state setting.
ui32Base | specifies the USB module base address. |
This function returns the current link state setting for the USB controller. When the controller is operating as a host, this link state is sent with an LPM request. When the controller is acting as a device, this link state was received by the last LPM transaction whether it was acknowledged or stalled because the requested LPM mode is not supported.
Example: Get the link state for the last LPM transaction.
//! uint32_t ui32LinkState; //! //! // //! // Get the endpoint number that received the LPM request. //! // //! ui32LinkState = USBLPMLinkStateGet(USB0_BASE); //! //! // //! // Check if this was a supported link state. //! // //! if(ui32LinkState == USB_HOST_LPM_L1) //! { //! // //! // Handle the supported L1 link state. //! // //! } //! else //! { //! // //! // Handle the unsupported link state. //! // //! } //!
\return The current LPM link state.
References ASSERT, HWREGH, USB_LPMATTR_LS_M, and USB_O_LPMATTR.
uint32_t USBLPMEndpointGet | ( | uint32_t | ui32Base | ) |
Returns the current LPM endpoint value.
ui32Base | specifies the USB module base address. |
This function returns the current LPM endpoint value. The meaning of the value depends on the mode of operation of the USB controller. When in device mode, the value returned is the endpoint that received the last LPM transaction. When in host mode this is the endpoint that was last sent an LPM transaction, or the endpoint that is configured to be sent when the LPM transaction is triggered. The value returned is in the USB_EP_[0-7] value and a direct endpoint index.
Example: Get the endpoint for the last LPM transaction.
//! uint32_t ui32Endpoint; //! //! // //! // Get the endpoint number that received the LPM request. //! // //! ui32LinkState = USBLPMEndpointGet(USB0_BASE); //! //!
\return The last endpoint to receive an LPM request in device mode or the endpoint that the host sends an LPM request as one of the \b USB_EP_[0-7] values.
References ASSERT, HWREGH, IndexToUSBEP, USB_LPMATTR_ENDPT_M, USB_LPMATTR_ENDPT_S, and USB_O_LPMATTR.
bool USBLPMRemoteWakeEnabled | ( | uint32_t | ui32Base | ) |
Returns if remote wake is currently enabled.
ui32Base | specifies the USB module base address. |
This function returns the current state of the remote wake setting for host or device mode operation. If the controller is acting as a host this returns the current setting that is sent to devices when LPM requests are sent to a device. If the controller is in device mode, this function returns the state of the last LPM request sent from the host and indicates if the host enabled remote wakeup.
Example: Issue remote wake if remote wake is enabled.
//! //! if(USBLPMRemoteWakeEnabled(USB0_BASE)) //! { //! USBDevLPMRemoteWake(USB0_BASE); //! } //! //!
\return The \b true if remote wake is enabled or \b false if it is not.
References ASSERT, HWREGH, USB_LPMATTR_RMTWAK, and USB_O_LPMATTR.
uint32_t USBLPMIntStatus | ( | uint32_t | ui32Base | ) |
Returns the current LPM interrupt status.
ui32Base | specifies the USB module base address. |
This function returns the current LPM interrupt status for the USB controller.
The valid interrupt status bits when the USB controller is acting as a host are the following:
The valid interrupt status bits when the USB controller is acting as a device are the following:
Example: Get the current LPM interrupt status.
//! uint32_t ui32LPMIntStatus; //! //! // //! // Get the current LPM interrupt status. //! // //! ui32LPMIntStatus = USBLPMIntStatus(USB0_BASE); //! //! // //! // Check if an LPM transaction was acknowledged. //! // //! if(ui32LPMIntStatus & USB_INTLPM_ACK) //! { //! // //! // Handle entering LPM suspend mode. //! // //! ... //! } //!
\return The current LPM interrupt status.
References ASSERT, HWREGB, and USB_O_LPMRIS.
void USBLPMIntEnable | ( | uint32_t | ui32Base, |
uint32_t | ui32Ints | ||
) |
Enables LPM interrupts.
ui32Base | specifies the USB module base address. |
ui32Ints | specifies which LPM interrupts to enable. |
This function enables a set of LPM interrupts so that they can trigger a USB interrupt. The ui32Ints parameter specifies which of the USB_INTLPM_* to enable.
The valid interrupt status bits when the USB controller is acting as a host are the following:
The valid interrupt status bits when the USB controller is acting as a device are the following:
Example: Enable all LPM interrupt sources.
//! // //! // Enable all LPM interrupt sources. //! // //! USBLPMIntEnable(USB0_BASE, USB_INTLPM_ERROR | USB_INTLPM_RESUME | //! USB_INTLPM_INCOMPLETE | USB_INTLPM_ACK | //! USB_INTLPM_NYET | USB_INTLPM_STALL); //!
\return None.
References ASSERT, HWREGB, and USB_O_LPMIM.
void USBLPMIntDisable | ( | uint32_t | ui32Base, |
uint32_t | ui32Ints | ||
) |
Disables LPM interrupts.
ui32Base | specifies the USB module base address. |
ui32Ints | specifies which LPM interrupts to disable. |
This function disables the LPM interrupts specified in the ui32Ints parameter, preventing them from triggering a USB interrupt.
The valid interrupt status bits when the USB controller is acting as a host are the following:
The valid interrupt status bits when the USB controller is acting as a device are the following:
Example: Disable all LPM interrupt sources.
//! // //! // Disable all LPM interrupt sources. //! // //! USBLPMIntDisable(USB0_BASE, USB_INTLPM_ERROR | USB_INTLPM_RESUME | //! USB_INTLPM_INCOMPLETE | USB_INTLPM_ACK | //! USB_INTLPM_NYET | USB_INTLPM_STALL); //!
\return None.
References ASSERT, HWREGB, and USB_O_LPMIM.