请大家指教一下,要做的是,当程序检测到USB没有插入,则从APROM中启动。下面这样写怎么跳不进去?
//======================================================
// USB Floating Detect
//======================================================
void UsbFdt(void)
{
uint8_t u8FLODET = USBD->FLDET.FLDET;
_DRVUSB_SET_EVF(EVF_FLD);
if (u8FLODET)
{
/* USB Plug In */
if (g_u8UsbState & USB_STATE_ATTACHED)
{
/* Do nothing if it is already attached */
return;
}
/* Update USB state */
g_u8UsbState = USB_STATE_ATTACHED;
/* Init the end points */
UsbCfg();
/* Enable USB and enable PHY */
_DRVUSB_ENABLE_USB();
}
else
{
/* USB Un-plug */
/* Update USB state */
g_u8UsbState = USB_STATE_DETACHED;
udcOnLine = 0;
/* Disable USB, Disable remote weak up, and disable PHY */
_DRVUSB_DISABLE_USB();
/* Boot from AP */
RoughDelay(0x200000);
RESET_TO_AP();//CPU复位,从AP启动,此函数放于主函数的最前面是有用的
}
}
|