CE6.0加驱动后,启动时自动软件复位

ccxida   2010-4-14 11:47 楼主
写了两天代码,以为今天可以调试了……可刚加载到NK中就出现了下面的错误:

1、Eboot打印输出:
[UFNPDD] OTG Cable Attached
[UFNPDD] RESET Again
[USBH] HcdPdd_Init()

[USBH] ++InitializeOHCI()

[USBH] --InitializeOHCI() : Success

-OALIntrRequestSysIntr(irq = 13, sysIntr = 31)
-OALIntrRequestSysIntr(irq = 14, sysIntr = 32)
+OEMSetAlarmTime(4/14/2010 11:42:35.000)
[MAG] Process Attach——说明dll被加载进了内存

***********haiou************
MAG:just for testing MAG_Init is OK!
***********haiou************

-OALIntrRequestSysIntr(irq = 8, sysIntr = 33)
-OALIntrRequestSysIntr(irq = 9, sysIntr = 34)

***********haiou************
MAG:just for testing CreateThread is OK!
***********haiou************

DEBUG: CreateSerialObject 1
-OALIntrRequestSysIntr(irq = 62, sysIntr = 36)
[OEM] ++OEMSWReset()——问题就出在这,软件复位了

2、驱动的Init函数是:DWORD
MAG_Init(PVOID Context)
{
        BOOL bResult = TRUE;
    DWORD  dwHwIntr=0;

        RETAILMSG(MAG_MSG,(TEXT("\r\n***********haiou************\r\n")));
        RETAILMSG(MAG_MSG,(TEXT("MAG:just for testing MAG_Init is OK!\r\n")));
        RETAILMSG(MAG_MSG,(TEXT("***********haiou************\r\n\r\n")));
   
        if(0 == Init_Address())
        {
            bResult = FALSE;
        }
       
        Init_Port();
       
        hEvent_BrushTime = CreateEvent(NULL, FALSE, FALSE, NULL);
       
        //Track3 CLK eint8
        dwSysIntr_Track3 = SYSINTR_NOP;
        dwHwIntr = IRQ_EINT8;

    hEvent_Track3 = CreateEvent(NULL, FALSE, FALSE, NULL);

    if (!KernelIoControl(IOCTL_HAL_REQUEST_SYSINTR, &dwHwIntr, sizeof(DWORD), &dwSysIntr_Track3, sizeof(DWORD), NULL))
    {
        RETAILMSG(MAG_DUG,(TEXT("[MAG] Failed to request the ENT8 sysintr for track3.\n")));
        dwSysIntr_Track3 = SYSINTR_UNDEFINED;
        bResult = FALSE;
    }
        
        if (!InterruptInitialize(dwSysIntr_Track3, hEvent_Track3, NULL, 0))
    {
        RETAILMSG(MAG_DUG,(TEXT("[MAG] EINT8 Interrupt Initialization failed!!!\n")));
        bResult = FALSE;
    }
   
        hThread_Track3 = CreateThread(0, 0, (LPTHREAD_START_ROUTINE)ThreadFor_Track3, 0, 0, (LPDWORD)&dwThreadId_Track3);
    if (hThread_Track3 == NULL)
    {
        RETAILMSG(MAG_DUG,(TEXT("[MAG] MAG ISR(EINT8) Thread of Track3 creation error!!!\n")));
        bResult = FALSE;
    }

        //Track2 CLK eint9
        dwSysIntr_Track2 = SYSINTR_NOP;
        dwHwIntr = IRQ_EINT9;

    hEvent_Track2 = CreateEvent(NULL, FALSE, FALSE, NULL);

    if (!KernelIoControl(IOCTL_HAL_REQUEST_SYSINTR, &dwHwIntr, sizeof(DWORD), &dwSysIntr_Track2, sizeof(DWORD), NULL))
    {
        RETAILMSG(MAG_DUG,(TEXT("[MAG] Failed to request the ENT9 sysintr for track2.\n")));
        dwSysIntr_Track2 = SYSINTR_UNDEFINED;
        bResult = FALSE;
    }
        
        if (!InterruptInitialize(dwSysIntr_Track2, hEvent_Track2, NULL, 0))
    {
        RETAILMSG(MAG_DUG,(TEXT("[MAG] EINT9 Interrupt Initialization failed!!!\n")));
        bResult = FALSE;
    }
   
        hThread_Track2 = CreateThread(0, 0, (LPTHREAD_START_ROUTINE)ThreadFor_Track2, 0, 0, (LPDWORD)&dwThreadId_Track2);
    if (hThread_Track2 == NULL)
    {
        RETAILMSG(MAG_DUG,(TEXT("[MAG] MAG ISR(EINT9) Thread of Track2 creation error!!!\n")));
        bResult = FALSE;
    }

        RETAILMSG(MAG_MSG,(TEXT("\r\n***********haiou************\r\n")));
        RETAILMSG(MAG_MSG,(TEXT("MAG:just for testing CreateThread is OK!\r\n")));
        RETAILMSG(MAG_MSG,(TEXT("***********haiou************\r\n\r\n")));

        return bResult;
}

3、因为启动时Driver.exe只调用了Init函数,刚把上面Init函数中所有创建线程、事件的、申请中断的代码都注释掉试了下,还是没效果。

请大家帮忙一起分析下

回复评论 (1)

原来是Init_Port时触发了能引起软复位的中断。
原中断IRQ_EINT9已经被系统占用,将其换成别的中断就好。
点赞  2010-4-15 15:56
电子工程世界版权所有 京B2-20211791 京ICP备10001474号-1 京公网安备 11010802033920号
    写回复