EE445M RTOS
Taken at the University of Texas Spring 2015
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

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. This function must not be used on devices that return USB_CONTROLLER_VER_0 from the USBControllerVersion() function.

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);
//! 
\note This feature is not available on all Tiva devices.  Please
check the data sheet to determine if the USB controller has a DMA
controller or if it must use the uDMA controller for DMA transfers.

\return The current DMA address for a USB DMA channel.  

Definition at line 4821 of file usb.c.

References ASSERT, HWREG, USB0_BASE, and USB_O_DMAADDR0.

4822 {
4823  ASSERT(ui32Base == USB0_BASE);
4824  ASSERT(ui32Channel < 8);
4825 
4826  //
4827  // Return the current DMA address.
4828  //
4829  return((void *)HWREG(ui32Base + USB_O_DMAADDR0 + (0x10 * ui32Channel)));
4830 }
#define HWREG(x)
Definition: hw_types.h:48
#define ASSERT(expr)
Definition: debug.h:67
#define USB_O_DMAADDR0
Definition: hw_usb.h:326
#define USB0_BASE
Definition: hw_memmap.h:99
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);
//! 
\note This feature is not available on all Tiva devices.  Please
check the data sheet to determine if the USB controller has a DMA
controller or if it must use the uDMA controller for DMA transfers.

\return None.  

Definition at line 4775 of file usb.c.

References ASSERT, HWREG, USB0_BASE, and USB_O_DMAADDR0.

4777 {
4778  ASSERT(ui32Base == USB0_BASE);
4779  ASSERT(ui32Channel < 8);
4780 
4781  //
4782  // Set the DMA address.
4783  //
4784  HWREG(ui32Base + USB_O_DMAADDR0 + (0x10 * ui32Channel)) =
4785  (uint32_t)pvAddress;
4786 }
#define HWREG(x)
Definition: hw_types.h:48
#define ASSERT(expr)
Definition: debug.h:67
#define USB_O_DMAADDR0
Definition: hw_usb.h:326
#define USB0_BASE
Definition: hw_memmap.h:99
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));
//! 
\note This feature is not available on all Tiva devices.  Please
check the data sheet to determine if the USB controller has a DMA
controller or if it must use the uDMA controller for DMA transfers.

\return None.  

Definition at line 4629 of file usb.c.

References ASSERT, HWREG, USB0_BASE, USB_EP_7, and USB_O_DMACTL0.

4631 {
4632  ASSERT(ui32Base == USB0_BASE);
4633  ASSERT(ui32Channel < 8);
4634  ASSERT((ui32Endpoint & ~USB_EP_7) == 0);
4635 
4636  //
4637  // Reset this USB DMA channel.
4638  //
4639  HWREG(ui32Base + USB_O_DMACTL0 + (0x10 * ui32Channel)) = 0;
4640 
4641  //
4642  // Set the configuration of the requested channel.
4643  //
4644  HWREG(ui32Base + USB_O_DMACTL0 + (0x10 * ui32Channel)) =
4645  ui32Config | ui32Endpoint;
4646 }
#define USB_O_DMACTL0
Definition: hw_usb.h:325
#define HWREG(x)
Definition: hw_types.h:48
#define ASSERT(expr)
Definition: debug.h:67
#define USB0_BASE
Definition: hw_memmap.h:99
#define USB_EP_7
Definition: usb.h:354
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);
//! 
\note This feature is not available on all Tiva devices.  Please
check the data sheet to determine if the USB controller has a DMA
controller or if it must use the uDMA controller for DMA transfers.

\return The current count for a USB DMA channel.  

Definition at line 4903 of file usb.c.

References ASSERT, HWREG, USB0_BASE, and USB_O_DMACOUNT0.

4904 {
4905  ASSERT(ui32Base == USB0_BASE);
4906  ASSERT(ui32Channel < 8);
4907 
4908  //
4909  // Return the current DMA count.
4910  //
4911  return(HWREG(ui32Base + USB_O_DMACOUNT0 + (0x10 * ui32Channel)));
4912 }
#define HWREG(x)
Definition: hw_types.h:48
#define ASSERT(expr)
Definition: debug.h:67
#define USB_O_DMACOUNT0
Definition: hw_usb.h:327
#define USB0_BASE
Definition: hw_memmap.h:99
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);
//! 
\note This feature is not available on all Tiva devices.  Please
check the data sheet to determine if the USB controller has a DMA
controller or if it must use the uDMA controller for DMA transfers.

\return None.  

Definition at line 4861 of file usb.c.

References ASSERT, HWREG, USB0_BASE, and USB_O_DMACOUNT0.

4863 {
4864  ASSERT(ui32Base == USB0_BASE);
4865  ASSERT(ui32Channel < 8);
4866 
4867  //
4868  // Set the USB DMA count for the channel.
4869  //
4870  HWREG(ui32Base + USB_O_DMACOUNT0 + (0x10 * ui32Channel)) = ui32Count;
4871 }
#define HWREG(x)
Definition: hw_types.h:48
#define ASSERT(expr)
Definition: debug.h:67
#define USB_O_DMACOUNT0
Definition: hw_usb.h:327
#define USB0_BASE
Definition: hw_memmap.h:99
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);
//! 
\note This feature is not available on all Tiva devices.  Please
check the data sheet to determine if the USB controller has a DMA
controller or if it must use the uDMA controller for DMA transfers.

\return None.  

Definition at line 4552 of file usb.c.

References ASSERT, HWREG, USB0_BASE, USB_DMACTL0_ENABLE, and USB_O_DMACTL0.

4553 {
4554  ASSERT(ui32Base == USB0_BASE);
4555  ASSERT(ui32Channel < 8);
4556 
4557  //
4558  // Disable the USB DMA channel.
4559  //
4560  HWREG(ui32Base + USB_O_DMACTL0 + (0x10 * ui32Channel)) &=
4562 }
#define USB_O_DMACTL0
Definition: hw_usb.h:325
#define HWREG(x)
Definition: hw_types.h:48
#define ASSERT(expr)
Definition: debug.h:67
#define USB_DMACTL0_ENABLE
Definition: hw_usb.h:2360
#define USB0_BASE
Definition: hw_memmap.h:99
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);
//! 
\note This feature is not available on all Tiva devices.  Please
check the data sheet to determine if the USB controller has a DMA
controller or if it must use the uDMA controller for DMA transfers.

\return None.  

Definition at line 4512 of file usb.c.

References ASSERT, HWREG, USB0_BASE, USB_DMACTL0_ENABLE, and USB_O_DMACTL0.

4513 {
4514  ASSERT(ui32Base == USB0_BASE);
4515  ASSERT(ui32Channel < 8);
4516 
4517  //
4518  // Enable the USB DMA channel.
4519  //
4520  HWREG(ui32Base + USB_O_DMACTL0 + (0x10 * ui32Channel)) |=
4522 }
#define USB_O_DMACTL0
Definition: hw_usb.h:325
#define HWREG(x)
Definition: hw_types.h:48
#define ASSERT(expr)
Definition: debug.h:67
#define USB_DMACTL0_ENABLE
Definition: hw_usb.h:2360
#define USB0_BASE
Definition: hw_memmap.h:99
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);
//! 
\note This feature is not available on all Tiva devices.  Please
check the data sheet to determine if the USB controller has a DMA
controller or if it must use the uDMA controller for DMA transfers.

\return None.  

Definition at line 4437 of file usb.c.

References ASSERT, HWREG, USB0_BASE, USB_DMACTL0_IE, and USB_O_DMACTL0.

4438 {
4439  ASSERT(ui32Base == USB0_BASE);
4440  ASSERT(ui32Channel < 8);
4441 
4442  //
4443  // Enable the specified DMA channel interrupts.
4444  //
4445  HWREG(ui32Base + USB_O_DMACTL0 + (0x10 * ui32Channel)) &= ~USB_DMACTL0_IE;
4446 }
#define USB_O_DMACTL0
Definition: hw_usb.h:325
#define HWREG(x)
Definition: hw_types.h:48
#define ASSERT(expr)
Definition: debug.h:67
#define USB_DMACTL0_IE
Definition: hw_usb.h:2357
#define USB0_BASE
Definition: hw_memmap.h:99
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);
//! 
\note This feature is not available on all Tiva devices.  Please
check the data sheet to determine if the USB controller has a DMA
controller or if it must use the uDMA controller for DMA transfers.

\return None.  

Definition at line 4398 of file usb.c.

References ASSERT, HWREG, USB0_BASE, USB_DMACTL0_IE, and USB_O_DMACTL0.

4399 {
4400  ASSERT(ui32Base == USB0_BASE);
4401  ASSERT(ui32Channel < 8);
4402 
4403  //
4404  // Enable the specified DMA channel interrupts.
4405  //
4406  HWREG(ui32Base + USB_O_DMACTL0 + (0x10 * ui32Channel)) |= USB_DMACTL0_IE;
4407 }
#define USB_O_DMACTL0
Definition: hw_usb.h:325
#define HWREG(x)
Definition: hw_types.h:48
#define ASSERT(expr)
Definition: debug.h:67
#define USB_DMACTL0_IE
Definition: hw_usb.h:2357
#define USB0_BASE
Definition: hw_memmap.h:99
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.

Note
This feature is not available on all Tiva devices. Please check the data sheet to determine if the USB controller has a DMA controller or if it must use the uDMA controller for DMA transfers.

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.  

Definition at line 4477 of file usb.c.

References ASSERT, HWREG, USB0_BASE, and USB_O_DMAINTR.

4478 {
4479  ASSERT(ui32Base == USB0_BASE);
4480 
4481  return(HWREG(ui32Base + USB_O_DMAINTR));
4482 }
#define HWREG(x)
Definition: hw_types.h:48
#define ASSERT(expr)
Definition: debug.h:67
#define USB_O_DMAINTR
Definition: hw_usb.h:324
#define USB0_BASE
Definition: hw_memmap.h:99
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);
//! 
\note This feature is not available on all Tiva devices.  Please
check the data sheet to determine if the USB controller has a DMA
controller or if it must use the uDMA controller for DMA transfers.

\return Returns zero or \b USB_DMACTL0_ERR if there is a pending error
condition on a DMA channel.  

Definition at line 4679 of file usb.c.

References ASSERT, HWREG, USB0_BASE, USB_DMACTL0_ERR, and USB_O_DMACTL0.

4680 {
4681  ASSERT(ui32Base == USB0_BASE);
4682  ASSERT(ui32Channel < 8);
4683 
4684  //
4685  // Return a non-zero value if there is a pending error condition.
4686  //
4687  return(HWREG(ui32Base + USB_O_DMACTL0 + (0x10 * ui32Channel)) &
4688  USB_DMACTL0_ERR);
4689 }
#define USB_O_DMACTL0
Definition: hw_usb.h:325
#define HWREG(x)
Definition: hw_types.h:48
#define ASSERT(expr)
Definition: debug.h:67
#define USB_DMACTL0_ERR
Definition: hw_usb.h:2355
#define USB0_BASE
Definition: hw_memmap.h:99
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));
//! 
\note This feature is not available on all Tiva devices.  Please
check the data sheet to determine if the USB controller has a DMA
controller or if it must use the uDMA controller for DMA transfers.

\return None.  

Definition at line 4722 of file usb.c.

References ASSERT, HWREG, USB0_BASE, USB_DMACTL0_ERR, and USB_O_DMACTL0.

4724 {
4725  ASSERT(ui32Base == USB0_BASE);
4726  ASSERT(ui32Channel < 8);
4727 
4728  //
4729  // The only status is the error bit.
4730  //
4731  ui32Status &= USB_DMACTL0_ERR;
4732 
4733  //
4734  // Clear the specified error condition.
4735  //
4736  HWREG(ui32Base + USB_O_DMACTL0 + (0x10 * ui32Channel)) &= ~ui32Status;
4737 }
#define USB_O_DMACTL0
Definition: hw_usb.h:325
#define HWREG(x)
Definition: hw_types.h:48
#define ASSERT(expr)
Definition: debug.h:67
#define USB_DMACTL0_ERR
Definition: hw_usb.h:2355
#define USB0_BASE
Definition: hw_memmap.h:99
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.  

Definition at line 4940 of file usb.c.

References ASSERT, HWREG, USB0_BASE, USB_O_RAMINFO, and USB_RAMINFO_DMACHAN_S.

4941 {
4942  ASSERT(ui32Base == USB0_BASE);
4943 
4944  //
4945  // Return the number of DMA channels for the integrated DMA controller.
4946  //
4947  return(HWREG(ui32Base + USB_O_RAMINFO) >> USB_RAMINFO_DMACHAN_S);
4948 }
#define HWREG(x)
Definition: hw_types.h:48
#define ASSERT(expr)
Definition: debug.h:67
#define USB_RAMINFO_DMACHAN_S
Definition: hw_usb.h:746
#define USB_O_RAMINFO
Definition: hw_usb.h:78
#define USB0_BASE
Definition: hw_memmap.h:99