| Description | The usbh_ohci_hw_init function is used for initialization or uninitialization of hardware (clocks, pins) for the OHCI USB Host controller. The argument on specify if function should do initialize or uninitialize. The usbh_ohci_hw_init function is part of the RL-USB Host software stack. You can modify this function to suit different OHCI controller hardware. This function will need to be changed if OHCI controller is used on a chip that does not yet have a low level driver provided. |
| Example |
BOOL usbh_ohci_hw_init (BOOL on) {
U32 tout;
if (on) {
/* Initialize memory pool for data */
if (!usbh_mem_init(0, (U32 *)&usbh_ohci_mpool, sizeof(usbh_ohci_mpool)))
return (__FALSE);
LPC_SC->PCONP |= (1UL << 31);/* Enable USB interface power/clock */
LPC_USB->OTGClkCtrl |= 0x19; /* Enable Host, OTG and AHB master clk*/
for (tout = 100; ; tout--) {
if ((LPC_USB->OTGClkSt & 0x19) == 0x19) /* Wait for clocks enabled */
break;
if (!tout)
return (__FALSE);
}
LPC_USB->OTGStCtrl |= 0x03; /* Select port function */
NVIC_SetPriority (USB_IRQn, 0); /* Set USB interrupt highest priority */
} else {
LPC_USB->OTGStCtrl &= ~0x03; /* Deselect port function */
LPC_USB->OTGClkCtrl &= ~0x19; /* Disable Host,OTG and AHB master clk*/
for (tout = 100; ; tout--) {
if ((LPC_USB->OTGClkSt & 0x19) == 0)/* Wait for clocks disabled */
break;
if (!tout)
return (__FALSE);
}
LPC_SC->PCONP &= ~(1UL << 31);/* Disable USB interface power/clock */
}
return (__TRUE);
}
|