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,
, resets the
source and destination addresses for the DMA transfer and specifies how much data will be sent.
The next call,
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
Summary of Contents for Tiva TM4C123GH6PM
Page 26: ...Boot Loader 26 April 8 2013...
Page 68: ...Controller Area Network CAN 68 April 8 2013...
Page 122: ...Hibernation Module 122 April 8 2013...
Page 136: ...Inter Integrated Circuit I2C 136 April 8 2013...
Page 152: ...Memory Protection Unit MPU 152 April 8 2013...
Page 174: ...Pulse Width Modulator PWM Returns None 174 April 8 2013...
Page 196: ...Synchronous Serial Interface SSI 196 April 8 2013...
Page 222: ...System Control 222 April 8 2013...
Page 270: ...UART 270 April 8 2013...
Page 296: ...uDMA Controller 296 April 8 2013...
Page 351: ...April 8 2013 351...