USB Controller
by a call to
ROM_uDMAChannelAttributeEnable()
with the
DMA_ATTR_USEBURST
value.
Note:
All uDMA transfers used by the USB controller must use burst mode.
The final call sets the read access size to 8 bits wide, the source address increment to 0, the
destination address increment to 8 bits and the uDMA arbitration size to 64 bytes.
Example: Configure endpoint 1 transmit channel.
//
// Clear out any uDMA settings.
//
ROM_uDMAChannelAttributeDisable(UDMA_CHANNEL_USBEP1RX, UDMA_ATTR_ALL);
ROM_uDMAChannelAttributeEnable(UDMA_CHANNEL_USBEP1RX, UDMA_ATTR_USEBURST);
ROM_uDMAChannelControlSet(UDMA_CHANNEL_USBEP1RX,
(UDMA_SIZE_8 | UDMA_SRC_INC_NONE |
UDMA_DST_INC_8 | UDMA_ARB_64));
The next step is to actually start the uDMA transfer. Unlike the transfer side, if the application is
ready, this can be set up right away to wait for incoming data. Like the transmit case, these are
the only calls needed to start a new transfer, normally all of the previous uDMA configuration can
remain the same.
Example: Start requesting of data on endpoint 1.
//
// Configure the address and size of the data to transfer.
The transfer
// is from the USB FIFO for endpoint 0 to g_DataBufferIn.
//
ROM_uDMAChannelTransferSet(UDMA_CHANNEL_USBEP1RX, UDMA_MODE_BASIC,
(void *)ROM_USBFIFOAddr(USB0_BASE, USB_EP_1),
g_DataBufferIn, 64);
//
// Enable the uDMA channel and wait for data.
//
ROM_uDMAChannelEnable(UDMA_CHANNEL_USBEP1RX);
The uDMA interrupt occurs on the same interrupt vector as any other USB interrupt, this means
that the application needs to check to see what was the actual source of the interrupt. It is possible
that the USB interrupt does not indicate that the USB transfer was complete. The interrupt could
also have been caused by a short packet, error, or even a transmit complete. This requires that the
application check both receive cases to determine if this is related to receiving data on the endpoint.
Because the USB has no status bit indicating that the interrupt was due to a uDMA complete, the
application must remember if a uDMA transaction was in progress.
Example: Interrupt handling with uDMA.
//
// Get the current interrupt status.
//
ui32Status = ROM_USBIntStatusEndpoint(USB0_BASE);
if(ui32Status & USB_INT_DEV_OUT_EP1)
{
//
April 8, 2013
301
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...