USBLibAPIGuide  1.00.00.01
Functions
Usblib_otg

Functions

void USBOTGModeTerm (uint32_t ui32Index)
 
void USBOTGModeInit (uint32_t ui32Index, uint32_t ui32PollingRate, void *pvPool, uint32_t ui32PoolSize)
 
void USBOTGPollRate (uint32_t ui32Index, uint32_t ui32PollRate)
 
void USB0_IRQOTGModeHandler (void)
 
void OTGDeviceDisconnect (uint32_t ui32Index)
 
void USBOTGMain (uint32_t ui32MsTicks)
 
bool USBOTGFeatureSet (uint32_t ui32Index, uint32_t ui32Feature, void *pvFeature)
 

Detailed Description

Function Documentation

§ USBOTGModeTerm()

void USBOTGModeTerm ( uint32_t  ui32Index)

Returns the USB controller to and inactive state when in OTG mode operation.

Parameters
ui32Indexspecifies the USB controller to end OTG mode operations.

Applications using OTG mode may call this function to disable interrupts in preparation for shutdown or a change of operating mode.

Returns
None.

References g_psDCDInst.

§ USBOTGModeInit()

void USBOTGModeInit ( uint32_t  ui32Index,
uint32_t  ui32PollingRate,
void *  pvPool,
uint32_t  ui32PoolSize 
)

Initializes the USB controller for OTG mode operation.

Parameters
ui32Indexspecifies the USB controller that is to be initialized for OTG mode operation.
ui32PollingRateis the rate in milliseconds to poll the controller for changes in mode.
pvPoolis a pointer to the data to use as a memory pool for this controller.
ui32PoolSizeis the size in bytes of the buffer passed in as pvPool.

This function initializes the USB controller hardware into a state suitable for OTG mode operation. Applications must use this function to ensure that the controller is in a neutral state and able to receive appropriate interrupts before host or device mode is chosen by OTG negotiation. The ui32PollingRate parameter is used to set the rate at which the USB library will poll the controller to determine the mode. This has the most effect on how quickly the USB library will detect changes when going to host mode. The parameters pvPool and ui32PoolSize are passed on to the USB host library functions to provide memory for the USB library when it is acting as a host. Any device and host initialization should have been called before calling this function to prevent the USB library from attempting to run in device or host mode before the USB library is fully configured.

Returns
None.

References eUSBModeOTG, and g_iUSBMode.

§ USBOTGPollRate()

void USBOTGPollRate ( uint32_t  ui32Index,
uint32_t  ui32PollRate 
)

This call sets the USB OTG controllers poll rate when checking for the mode of the controller.

Parameters
ui32Indexspecifies which USB controller to set the polling rate.
ui32PollRateis the rate in milliseconds to poll for changes in the controller mode.

This function is called to set the USB OTG libraries polling rate when checking the status of the cable. The ui32PollRate value used sets the rate in milliseconds that the USB OTG library will poll the cable to see if the controller should enter host mode. This value has no effect on device detection rate as the controller will detect being connected to a host controller automatically. The ui32PollRate can be set to 0 to disable polling. The USB OTG library can still function with the polling rate set to zero, however it will fail to detect host mode properly when no device is present at the end of the USB OTG B side of the cable.

Note
This function should only be called on devices that support OTG functionality.
Returns
None.

References g_ui32PollRate.

§ USB0_IRQOTGModeHandler()

void USB0_IRQOTGModeHandler ( void  )

Handles OTG mode changes and also steers other USB interrupts from the controller to the correct handler in the USB stack.

This interrupt handler is used in applications which require to operate in both host and device mode using OTG. When in host or device mode, it steers the USB hardware interrupt to the correct handler in the USB stack depending upon the current operating mode. It also handles other OTG related interrupt events.

For successful OTG mode operation, an application must register USB0_IRQOTGModeHandler() in the CPU vector table as the interrupt handler for the USB0 interrupt.

Note
This interrupt handler should only be used on controllers that support OTG functionality.
Returns
None.

References eUSBOTGModeBWaitCon, g_eOTGModeState, InternalUSBHCDSendEvent(), tEventInfo::ui32Event, tEventInfo::ui32Instance, USB_EVENT_POWER_ENABLE, USBHCD_EVFLAG_PWREN, and USBHCDPowerAutomatic().

§ OTGDeviceDisconnect()

void OTGDeviceDisconnect ( uint32_t  ui32Index)

§ USBOTGMain()

void USBOTGMain ( uint32_t  ui32MsTicks)

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

Parameters
ui32MsTicksis the number of milliseconds that have passed since the last time this function was called.

This function is the main routine for the USB controller when using the library in OTG mode. This routine must be called periodically by the main application outside of a callback context. The ui32MsTicks value is used for basic timing needed by the USB library when operating in OTG mode. This allows for a simple cooperative system to access the the OTG controller driver interface without the need for an RTOS. All time critical operations are handled in interrupt context but all longer operations are run from the this function to allow them to block and wait for completion without holding off other interrupts.

Returns
None.

References eUSBOTGModeIdle, eUSBOTGModeWait, eUSBOTGModeWaitID, g_eOTGModeState, g_ui32PollRate, and g_ui32WaitTicks.

§ USBOTGFeatureSet()

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

This function sets one of the USBLIB_FEATURE_ requests.

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

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

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

References USBDCDFeatureSet(), and USBHCDFeatureSet().

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