ERROR: Power Handler function yield to low priority thread. 解决方法

来源:互联网 发布:淘宝店铺导航在线制作 编辑:程序博客网 时间:2024/05/16 12:28

最近在调试休眠唤醒,发现添加了 USBFN 驱动后,

休眠唤醒后出现

ERROR: Power Handler function yield to low priority thread. 错误。

通过网上查找一些资料,基本确定是在 POWERUP POWERDOWN 的时候调用了

系统的 API ,如 SLEEP 之类的。

查看 USBFN 的驱动,在

 

BOOL HW_USBClocks(CEDEVICE_POWER_STATE    cpsNew)
{

    DWORD loop;
    if (cpsNew == D0) //power on
    {

        USBFN_MSG( (TEXT("HW_USBClocks::D0 \r\n")));
        //if(pIOPregs->GPFDAT & (1<<2)) //check cable connection, for powerconsumption
    {
        // Set the Normal mode
//    pIOPregs->GPHCON = (pIOPregs->GPHCON & ~(0x3<<28)) | (0x1<<28);
//    pIOPregs->GPHUDP = (pIOPregs->GPHUDP & ~(0x3<<28));
//    pIOPregs->GPHDAT = (pIOPregs->GPHDAT & ~(0x1<<14)) | (0x1<<14);
    pIOPregs->MISCCR &= ~(1<<12);
    // Enable the PHY Power
    pCLKPWR->PWRCFG |= (1<<4);
    // First USB PHY has to be reset, and after 10us, func and host has to be reset.

            pCLKPWR->USB_CLKCON = (0<<31)|(1<<2)|(0<<1)|(0<<0); //pullup disable

    pCLKPWR->USB_RSTCON = (0<<2)|(0<<1)|(1<<0);
  for(loop=0;loop<180000;loop++);
  for(loop=0;loop<180000;loop++);
            //Sleep(2);
    pCLKPWR->USB_RSTCON = (1<<2)|(0<<1)|(0<<0);
            //Sleep(2);
            for(loop=0;loop<180000;loop++);
  for(loop=0;loop<180000;loop++);
    pCLKPWR->USB_RSTCON = (0<<2)|(0<<1)|(0<<0);
            pCLKPWR->USB_CLKCON = (1<<31)|(1<<2)|(0<<1)|(0<<0);//pull up enable

 

这里有两个 SLEEP 函数。

把 SLEEP 换成 软件延时,这样问题解决了。

希望对后来人有所帮助~!@

 

原创粉丝点击