Use Cases
1677
SPRUH82C – April 2013 – Revised September 2016
Copyright © 2013–2016, Texas Instruments Incorporated
Universal Serial Bus 2.0 (USB) Controller
Example 34-2. Initializing the CPPI 4.1 DMA Controller
void cppiDmaInit() {
switch (DMAmode) {
case RNDIS:
usbRegs->CTRLR |=0x00000010; // Enable RNDIS from Global Level
usbRegs->RNDISR=0x11111111;
break;
case GENERIC_RNDIS:
usbRegs->CTRLR &= ~0x00000010; // Disable RNDIS from Global Level
usbRegs->RNDISR=0x33333333;
usbRegs->GENRNDISSZ[chan_num].SIZE=descPacketLength;
break;
case LINUX_CDC:
usbRegs->CTRLR &= ~0x00000010; // Disable RNDIS from Global Level
usbRegs->RNDISR=0x22222222;
break;
case TRANSPARENT:
usbRegs->CTRLR &= ~0x00000010; // Disable RNDIS from Global Level
usbRegs->RNDISR=0x00000000;
break;
default:
usbRegs->CTRLR |=0x00000010; // Enable RNDIS from Global Level
break;
}
#ifndef _USB_PERIPHERAL_
// If Controller is assuming Host Role
#ifdef TRANSPARENT
usbRegs->AUTOREQ=00;
// No Auto Req
#else
usbRegs->AUTOREQ=01;
// Auto Req on all but EOP
#endif
#endif
A Single Queue Manager (00b) exist and 16 Regions; no particular assignment exists.
Program Link Ram0 and Link Ram1, Base & Size.
No Link Ram1 Size Register exists. Most likely is using the same Size Register used
//
Link Ram1 Base
usbRegs->QMGR.LRAM0BASE = (Uint32)queueMgrLinkRam0;
usbRegs->QMGR.LRAM0SIZE = LINKRAM0SIZE/4;
usbRegs->QMGR.LRAM1BASE = (Uint32)queueMgrLinkRam1;
// Allocate Resource to Region 0 (can use any of the 16 available) (memory location for Host
Packet Descriptors)
// DESC_SIZE value should be [1-8]. Values of 9 - 15 are reserved.
// Since a minimum of 32 Bytes is required, only program values above 32.
// Host Packet Descriptor sizes: Min/Max = 32/(104 + Opt S/W Data)
// REG_SIZE is the total # of Descriptors the Region can accommodate. At the minimum should be
capable of handling 32 Descriptors.
// This example is allocating specific regions for each port
usbRegs->QMEMREGION[chan_num].QMEMRBASE=((Uint32)region0DescriptorSpace);
usbRegs->QMEMREGION[chan_num].QMEMRCTRL=(REG0START_INDEX<<16) | (DESC_SIZE<<8) | REG_SIZE;
Configure the Scheduler
// Configure the Tx/Rx Word[x=0,1] and Scheduler Configuration Register
// Priorities are handled by programming more of the channel number wanting to see serviced
// 64 Words exist for a total of 256 entries.
// Credit can be given to both Tx and Rx Channel within the same Register.
// Here Rx Credit is given first for the single Rx Channel defined by chan_num.