/* stop the USB host and clean up FIFO  */
void usb_host_stop(usb_core_driver *pudev)
/* stop the USB host and clean up FIFO  */
void usb_host_stop(usb_core_driver *pudev)
{
    uint32_t i;
    __IO uint32_t pp_ctl = 0U;
    pudev->regs.hr->HACHINTEN = 0x0U;
    pudev->regs.hr->HACHINT = 0xFFFFFFFFU;
    for (i = 0U; i < pudev->bp.num_pipe; i++) {
        pp_ctl = pudev->regs.pr[i]->HCHCTL;
        pp_ctl &= ~(HCHCTL_CEN | HCHCTL_EPDIR);
        pp_ctl |= HCHCTL_CDIS;
        pudev->regs.pr[i]->HCHCTL = pp_ctl;
    }
    usb_rxfifo_flush (&pudev->regs);
    usb_txfifo_flush (&pudev->regs, 0x10U);
}