Functions
Usb_dma

Functions

void USBDMAChannelIntEnable (uint32_t ui32Base, uint32_t ui32Channel)
 
void USBDMAChannelIntDisable (uint32_t ui32Base, uint32_t ui32Channel)
 
uint32_t USBDMAChannelIntStatus (uint32_t ui32Base)
 
void USBDMAChannelEnable (uint32_t ui32Base, uint32_t ui32Channel)
 
void USBDMAChannelDisable (uint32_t ui32Base, uint32_t ui32Channel)
 
void USBDMAChannelConfigSet (uint32_t ui32Base, uint32_t ui32Channel, uint32_t ui32Endpoint, uint32_t ui32Config)
 
uint32_t USBDMAChannelStatus (uint32_t ui32Base, uint32_t ui32Channel)
 
void USBDMAChannelStatusClear (uint32_t ui32Base, uint32_t ui32Channel, uint32_t ui32Status)
 
void USBDMAChannelAddressSet (uint32_t ui32Base, uint32_t ui32Channel, void *pvAddress)
 
void * USBDMAChannelAddressGet (uint32_t ui32Base, uint32_t ui32Channel)
 
void USBDMAChannelCountSet (uint32_t ui32Base, uint32_t ui32Channel, uint32_t ui32Count)
 
uint32_t USBDMAChannelCountGet (uint32_t ui32Base, uint32_t ui32Channel)
 
uint32_t USBDMANumChannels (uint32_t ui32Base)
 

Detailed Description

Function Documentation

§ USBDMAChannelIntEnable()

void USBDMAChannelIntEnable ( uint32_t  ui32Base,
uint32_t  ui32Channel 
)

Enable interrupts for a specified integrated USB DMA channel.

Parameters
ui32Basespecifies the USB module base address.
ui32Channelspecifies which DMA channel interrupt to enable.

This function enables the USB DMA channel interrupt based on the ui32Channel parameter. The ui32Channel value is a zero-based index of the USB DMA channel. Once enabled, the USBDMAChannelIntStatus() function returns if a DMA channel has generated an interrupt.

Example: Enable the USB DMA channel 3 interrupt.

//! //
//! // Enable the USB DMA channel 3 interrupt
//! //
//! USBDMAChannelIntEnable(USB0_BASE, 3);
//! 
\return None.  

References ASSERT, HWREG, USB_DMACTL0_IE, and USB_O_DMACTL0.

§ USBDMAChannelIntDisable()

void USBDMAChannelIntDisable ( uint32_t  ui32Base,
uint32_t  ui32Channel 
)

Disable interrupts for a specified integrated USB DMA channel.

Parameters
ui32Basespecifies the USB module base address.
ui32Channelspecifies which USB DMA channel interrupt to disable.

This function disables the USB DMA channel interrupt based on the ui32Channel parameter. The ui32Channel value is a zero-based index of the USB DMA channel.

Example: Disable the USB DMA channel 3 interrupt.

//! //
//! // Disable the USB DMA channel 3 interrupt
//! //
//! USBDMAChannelIntDisable(USB0_BASE, 3);
//! 
\return None.  

References ASSERT, HWREG, USB_DMACTL0_IE, and USB_O_DMACTL0.

§ USBDMAChannelIntStatus()

uint32_t USBDMAChannelIntStatus ( uint32_t  ui32Base)

Return the current status of the integrated USB DMA interrupts.

Parameters
ui32Basespecifies the USB module base address.

This function returns the current bit-mapped interrupt status for all USB DMA channel interrupt sources. Calling this function automatically clears all currently pending USB DMA interrupts.

Example: Get the pending USB DMA interrupts.

//! uint32_t ui32Ints;
//!
//! //
//! // Get the pending USB DMA interrupts.
//! //
//! ui32Ints = USBDMAChannelIntStatus(USB0_BASE);
//! 
\return The bit-mapped interrupts for the DMA channels.  

References ASSERT, HWREG, and USB_O_DMAINTR.

§ USBDMAChannelEnable()

void USBDMAChannelEnable ( uint32_t  ui32Base,
uint32_t  ui32Channel 
)

Enables integrated USB DMA for a specified channel.

Parameters
ui32Basespecifies the USB module base address.
ui32Channelspecifies the USB DMA channel to enable.

This function enables the USB DMA channel passed in the ui32Channel parameter. The ui32Channel value is a zero-based index of the USB DMA channel.

Example: Enable USB DMA channel 2.

//! //
//! // Enable USB DMA channel 2.
//! //
//! USBDMAChannelEnable(2);
//! 
\return None.  

References ASSERT, HWREG, USB_DMACTL0_ENABLE, and USB_O_DMACTL0.

§ USBDMAChannelDisable()

void USBDMAChannelDisable ( uint32_t  ui32Base,
uint32_t  ui32Channel 
)

Disables integrated USB DMA for a specified channel.

Parameters
ui32Basespecifies the USB module base address.
ui32Channelspecifies the USB DMA channel to disable.

This function disables the USB DMA channel passed in the ui32Channel parameter. The ui32Channel parameter is a zero-based index of the DMA channel.

Example: Disable USB DMA channel 2.

//! //
//! // Disable USB DMA channel 2.
//! //
//! USBDMAChannelDisable(2);
//! 
\return None.  

References ASSERT, HWREG, USB_DMACTL0_ENABLE, and USB_O_DMACTL0.

§ USBDMAChannelConfigSet()

void USBDMAChannelConfigSet ( uint32_t  ui32Base,
uint32_t  ui32Channel,
uint32_t  ui32Endpoint,
uint32_t  ui32Config 
)

Assigns and configures an endpoint to a specified integrated USB DMA channel.

Parameters
ui32Basespecifies the USB module base address.
ui32Channelspecifies which DMA channel to access.
ui32Endpointis the endpoint to assign to the USB DMA channel.
ui32Configis used to specify the configuration of the USB DMA channel.

This function assigns an endpoint and configures the settings for a USB DMA channel. The ui32Endpoint parameter is one of the USB_EP_* values and the ui32Channel value is a zero-based index of the DMA channel to configure. The ui32Config parameter is a combination of the USB_DMA_CFG_* values using the following guidelines.

Use one of the following to set the DMA burst mode:

  • USB_DMA_CFG_BURST_NONE disables bursting.
  • USB_DMA_CFG_BURST_4 sets the DMA burst size to 4 words.
  • USB_DMA_CFG_BURST_8 sets the DMA burst size to 8 words.
  • USB_DMA_CFG_BURST_16 sets the DMA burst size to 16 words.

Use one of the following to set the DMA mode:

  • USB_DMA_CFG_MODE_0 is typically used when only a single packet is being sent via DMA and triggers one completion interrupt per packet.
  • USB_DMA_CFG_MODE_1 is typically used when multiple packets are being sent via DMA and triggers one completion interrupt per transfer.

Use one of the following to set the direction of the transfer:

  • USB_DMA_CFG_DIR_RX selects a DMA transfer from the endpoint to a memory location.
  • USB_DMA_CFG_DIR_TX selects a DMA transfer to the endpoint from a memory location.

The following two optional settings allow an application to immediately enable the DMA transfer and/or DMA interrupts when configuring the DMA channel:

  • USB_DMA_CFG_INT_EN enables interrupts for this channel immediately so that an added call to USBDMAChannelIntEnable() is not necessary.
  • USB_DMA_CFG_EN enables the DMA channel immediately so that an added call to USBDMAChannelEnable() is not necessary.

Example: Assign channel 0 to endpoint 1 in DMA mode 0, 4 word burst, enable interrupts and immediately enable the transfer.

//! //
//! // Assign channel 0 to endpoint 1 in DMA mode 0, 4 word bursts,
//! // enable interrupts and immediately enable the transfer.
//! //
//! USBDMAChannelConfigSet(USB0_BASE, 0, USB_EP_1,
//!                        (USB_DMA_CFG_BURST_4 | USB_DMA_CFG_MODE0 |
//!                         USB_DMA_CFG_DIR_RX | USB_DMA_CFG_INT_EN |
//!                         USB_DMA_CFG_EN));
//! 
\return None.  

References ASSERT, HWREG, USB_EP_7, and USB_O_DMACTL0.

§ USBDMAChannelStatus()

uint32_t USBDMAChannelStatus ( uint32_t  ui32Base,
uint32_t  ui32Channel 
)

Returns the current status for an integrated USB DMA channel.

Parameters
ui32Basespecifies the USB module base address.
ui32Channelspecifies which DMA channel to query.

This function returns the current status for the USB DMA channel specified by the ui32Channel parameter. The ui32Channel value is a zero-based index of the USB DMA channel to query.

Example: Get the current USB DMA status for channel 2.

//! uint32_t ui32Status;
//!
//! //
//! // Get the current USB DMA status for channel 2.
//! //
//! ui32Status = USBDMAChannelStatus(USB0_BASE, 2);
//! 
\return Returns zero or \b USB_DMACTL0_ERR if there is a pending error
condition on a DMA channel.  

References ASSERT, HWREG, USB_DMACTL0_ERR, and USB_O_DMACTL0.

§ USBDMAChannelStatusClear()

void USBDMAChannelStatusClear ( uint32_t  ui32Base,
uint32_t  ui32Channel,
uint32_t  ui32Status 
)

Clears the integrated USB DMA status for a specified channel.

Parameters
ui32Basespecifies the USB module base address.
ui32Channelspecifies which DMA channel to clear.
ui32Statusholds the status bits to clear.

This function clears the USB DMA channel status for the channel specified by the ui32Channel parameter. The ui32Channel value is a zero-based index of the USB DMA channel to query. The ui32Status parameter specifies the status bits to clear and must be the valid values that are returned from a call to the USBDMAChannelStatus() function.

Example: Clear the current USB DMA status for channel 2.

//! //
//! // Clear the any pending USB DMA status for channel 2.
//! //
//! USBDMAChannelStatusClear(USB0_BASE, 2, USBDMAChannelStatus(USB0_BASE, 2));
//! 
\return None.  

References ASSERT, HWREG, USB_DMACTL0_ERR, and USB_O_DMACTL0.

§ USBDMAChannelAddressSet()

void USBDMAChannelAddressSet ( uint32_t  ui32Base,
uint32_t  ui32Channel,
void *  pvAddress 
)

Sets the source or destination address for an integrated USB DMA transfer on a specified channel.

Parameters
ui32Basespecifies the USB module base address.
ui32Channelspecifies which DMA channel to configure.
pvAddressspecifies the source or destination address for the USB DMA transfer.

This function sets the source or destination address for the USB DMA channel number specified in the ui32Channel parameter. The ui32Channel value is a zero-based index of the USB DMA channel. The pvAddress parameter is a source address if the transfer type for the DMA channel is transmit and a destination address if the transfer type is receive.

Example: Set the transfer address for USB DMA channel 1.

//! void *pvBuffer;
//!
//! //
//! // Set the address for USB DMA channel 1.
//! //
//! USBDMAChannelAddressSet(USB0_BASE, 1, pvBuffer);
//! 
\return None.  

References ASSERT, HWREG, and USB_O_DMAADDR0.

§ USBDMAChannelAddressGet()

void* USBDMAChannelAddressGet ( uint32_t  ui32Base,
uint32_t  ui32Channel 
)

Returns the source or destination address for the specified integrated USB DMA channel.

Parameters
ui32Basespecifies the USB module base address.
ui32Channelspecifies the USB DMA channel.

This function returns the DMA address for the channel number specified in the ui32Channel parameter. The ui32Channel value is a zero-based index of the DMA channel to query.

Example: Get the transfer address for USB DMA channel 1.

//! void *pvBuffer;
//!
//! //
//! // Retrieve the current DMA address for channel 1.
//! //
//! pvBuffer = USBDMAChannelAddressGet(USB0_BASE, 1);
//! 
\return The current DMA address for a USB DMA channel.  

References ASSERT, HWREG, and USB_O_DMAADDR0.

§ USBDMAChannelCountSet()

void USBDMAChannelCountSet ( uint32_t  ui32Base,
uint32_t  ui32Channel,
uint32_t  ui32Count 
)

Sets the transfer count for an integrated USB DMA channel.

Parameters
ui32Basespecifies the USB module base address.
ui32Channelspecifies which DMA channel to access.
ui32Countspecifies the number of bytes to transfer.

This function sets the USB DMA transfer count in bytes for the channel number specified in the ui32Channel parameter. The ui32Channel value is a zero-based index of the DMA channel.

Example: Set the transfer count to 512 bytes for USB DMA channel 1.

//! //
//! // Set the transfer count to 512 bytes for USB DMA channel 1.
//! //
//! USBDMAChannelCountSet(USB0_BASE, 1, 512);
//! 
\return None.  

References ASSERT, HWREG, and USB_O_DMACOUNT0.

§ USBDMAChannelCountGet()

uint32_t USBDMAChannelCountGet ( uint32_t  ui32Base,
uint32_t  ui32Channel 
)

Returns the transfer count for an integrated USB DMA channel.

Parameters
ui32Basespecifies the USB module base address.
ui32Channelspecifies which DMA channel to access.

This function returns the USB DMA transfer count in bytes for the channel number specified in the ui32Channel parameter. The ui32Channel value is a zero-based index of the DMA channel to query.

Example: Get the transfer count for USB DMA channel 1.

//! uint32_t ui32Count;
//!
//! //
//! // Get the transfer count for USB DMA channel 1.
//! //
//! ui32Count = USBDMAChannelCountGet(USB0_BASE, 1);
//! 
\return The current count for a USB DMA channel.  

References ASSERT, HWREG, and USB_O_DMACOUNT0.

§ USBDMANumChannels()

uint32_t USBDMANumChannels ( uint32_t  ui32Base)

Returns the available number of integrated USB DMA channels.

Parameters
ui32Basespecifies the USB module base address.

This function returns the total number of DMA channels available when using the integrated USB DMA controller. This function returns 0 if the integrated controller is not present.

Example: Get the number of integrated DMA channels.

//! uint32_t ui32Count;
//!
//! //
//! // Get the number of integrated DMA channels.
//! //
//! ui32Count = USBDMANumChannels(USB0_BASE);
//! 
\return The number of integrated USB DMA channels or zero if the
integrated USB DMA controller is not present.  

References ASSERT, HWREG, USB_O_RAMINFO, and USB_RAMINFO_DMACHAN_S.

Copyright 2017, Texas Instruments Incorporated