5 supported use case examples, Examples – Texas Instruments TMS320DM357 User Manual
Page 16
1.5
Supported Use Case Examples
Introduction
www.ti.com
The USB supports the following user cases:
Detailed information about the architecture and operation of the USB controller follows in
Programming examples are also provided for each of the operational modes of the controller.
User Case 1: An example of how to initialize the USB controller
Example 1. Initializing the USB Controller
// Routine to initialize USB controller
void usb_init()
{
// local loop variable
int I;
// VBUS must be controlled externally. The following routine
// should perform whatever actions are required (if any) to
// turn off VBUS in the system.
vbus_off();
// Reset the USB controller
usbRegs->CTRLR = 0x00000001;
// Power on PHY and oscillator by clearing bits 2, 1, and 0 of USBPHY_CTL
sysRegs->USB_PHY_CTRL = 0x000000D0;
//Clear all pending interrupts
usbRegs->INTCLRR = usbRegs->INTSRCR;
// Initialize CPPI DMA
usbRegs->RCPPICR = 0;
//Disable the RX DMA
usbRegs->TCPPICR = 0;
//Disable the TX DMA
// Initialize CPPI DMA state
for(I = 0; i<4; I++) {
usbRegs->CHANNEL[i].TCPPIDMASTATEW0 = 0;
usbRegs->CHANNEL[i].TCPPIDMASTATEW1 = 0;
usbRegs->CHANNEL[i].TCPPIDMASTATEW2 = 0;
usbRegs->CHANNEL[i].TCPPIDMASTATEW3 = 0;
usbRegs->CHANNEL[i].TCPPIDMASTATEW4 = 0;
usbRegs->CHANNEL[i].TCPPIDMASTATEW5 = 0;
usbRegs->CHANNEL[i].RCPPIDMASTATEW0 = 0;
usbRegs->CHANNEL[i].RCPPIDMASTATEW1 = 0;
usbRegs->CHANNEL[i].RCPPIDMASTATEW2 = 0;
usbRegs->CHANNEL[i].RCPPIDMASTATEW3 = 0;
usbRegs->CHANNEL[i].RCPPIDMASTATEW4 = 0;
usbRegs->CHANNEL[i].RCPPIDMASTATEW5 = 0;
usbRegs->CHANNEL[i].RCPPIDMASTATEW6 = 0;
}
}
Universal Serial Bus (USB) Controller
16
SPRUGH3 – November 2008