![Texas Instruments AM1808 Technical Reference Manual Download Page 1676](http://html.mh-extra.com/html/texas-instruments/am1808/am1808_technical-reference-manual_10945581676.webp)
Use Cases
1676
SPRUH82C – April 2013 – Revised September 2016
Copyright © 2013–2016, Texas Instruments Incorporated
Universal Serial Bus 2.0 (USB) Controller
Example 34-1. Initializing the USB2.0 Controller (continued)
// PHY_PLLON: On Simulation PHY PLL is OFF
BootCfg->CFGCHIP2 |= 0x00000040;
// 1/0 => On/ Off
/* Wait Until PHY Clock is Good */
while ((BootCfg->CFGCHIP2 & 0x00020000) == 0); // Wait Until PHY Clock is Good.
#ifndef HS_ENABLE
// Disable high-speed
CSL_FINS(usbRegs->POWER,USB_OTG_POWER_HSEN,0);
#else
// Enable high-speed
CSL_FINS(usbRegs->POWER,USB_OTG_POWER_HSEN,1);
#endif
// Enable Interrupts
// Enable interrupts in OTG block
usbRegs->CTRLR &= 0xFFFFFFF7; // Enable PDR2.0 Interrupt
usbRegs-
>INTRTXE = 0x1F;
// Enable All Core Tx Endpoints Inte EP0 Tx/Rx interrupt
usbRegs->INTRRXE = 0x1E;
// Enable All Core Rx Endpoints Interrupts
// Enable all interrupts in OTG block
usbRegs->INTMSKSETR = 0x01FF1E1F;
// Enable all USB interrupts in MUSBMHDRC
usbRegs->INTRUSBE = 0xFF;
// Enable SUSPENDM so that suspend can be seen UTMI signal
CSL_FINS(usbRegs->POWER,USB_OTG_POWER_ENSUSPM,1);
//Clear all pending interrupts
usbRegs->INTCLRR = usbRegs->INTSRCR;
#if (_USB_PERIPHERAL_)
// defined within project file if need to function as Peripheral.
// Set softconn bit
CSL_FINS(usbRegs->POWER,USB_OTG_POWER_SOFTCONN,1);
while ((usbRegs-
>DEVCTL & 0x01) == 0);
//Stay here until controller goes in Session.
#else
// Start a session
CSL_FINS(usbRegs->DEVCTL,USB_OTG_DEVCTL_SESSION,1);
#endif
}