EasyManuals Logo

Texas Instruments Tiva TM4C123GH6PM User Manual

Texas Instruments Tiva TM4C123GH6PM
352 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #299 background imageLoading...
Page #299 background image
USB Controller
Example: Endpoint configuration for a device IN endpoint:
//
// Endpoint 1 is a device mode BULK IN endpoint using uDMA.
//
ROM_USBDevEndpointConfigSet(USB0_BASE, USB_EP_1, 64,
(USB_EP_MODE_BULK | USB_EP_DEV_IN |
USB_EP_DMA_MODE_0 | USB_EP_AUTO_SET));
The application must provide the configuration of the actual uDMA controller. First, to clear out any
previous settings, the application should call ROM_uDMAChannelAttributeDisable(). Then the ap-
plication should call ROM_uDMAChannelAttributeEnable() for the uDMA channel that corresponds
to the endpoint, and specify the UDMA_ATTR_USEBURST flag.
Note:
All uDMA transfers used by the USB controller must enable burst mode.
The application needs to indicate the size of each uDMA transactions, combined with the source
and destination increments and the arbitration level for the uDMA controller.
Example: Configure endpoint 1 transmit channel.
//
// Set up the DMA for USB transmit.
//
ROM_uDMAChannelAttributeDisable(UDMA_CHANNEL_USBEP1TX, UDMA_ATTR_ALL);
//
// Enable uDMA burst mode.
//
ROM_uDMAChannelAttributeEnable(UDMA_CHANNEL_USBEP1TX, UDMA_ATTR_USEBURST);
//
// Data size is 8 bits and the source has a one byte increment.
// Destination has no increment as it is a FIFO.
//
ROM_uDMAChannelControlSet(UDMA_CHANNEL_USBEP1TX,
(UDMA_SIZE_8 | UDMA_SRC_INC_8 |
UDMA_DST_INC_NONE | UDMA_ARB_64));
The next step is to actually start the uDMA transfer once the data is ready to be sent. There are the
only two calls that the application needs to call to start a new transfer. Normally all of the previous
uDMA configuration can stay the same. The first call, ROM_uDMAChannelTransferSet(), resets the
source and destination addresses for the DMA transfer and specifies how much data will be sent.
The next call, ROM_uDMAChannelEnable() actually allows the uDMA controller to begin requesting
data.
Example: Start the transfer of data on endpoint 1.
//
// Configure the address and size of the data to transfer.
//
ROM_uDMAChannelTransferSet(UDMA_CHANNEL_USBEP1TX, UDMA_MODE_BASIC, pData,
(void
*
)ROM_USBFIFOAddr(USB0_BASE, USB_EP_1),
64);
//
// Start the transfer.
//
ROM_uDMAChannelEnable(UDMA_CHANNEL_USBEP1TX);
April 8, 2013 299

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Texas Instruments Tiva TM4C123GH6PM and is the answer not in the manual?

Texas Instruments Tiva TM4C123GH6PM Specifications

General IconGeneral
BrandTexas Instruments
ModelTiva TM4C123GH6PM
CategoryMicrocontrollers
LanguageEnglish

Related product manuals