阅读:1963回复:0
急啊!9052用InterruptEnable()函数使能中断就死机!愿送全部分数!
我最近在用Windriver开发一个PCI传输卡的驱动,I/O都没有问题了,可就是在调中断时过不去,只要用InterruptEnable()函数使能中断就死机!请各位大侠指点了!我的程序如下:
//之前部分省略 cardReg.Card.dwItems = 2; cardReg.Card.Item[0].item = ITEM_INTERRUPT; cardReg.Card.Item[0].fNotSharable = false; cardReg.Card.Item[0].I.Int.dwInterrupt = 11; //下面的属性如果设为电平触发(=1)就死机,如果改为边沿触发(=0)就不会死机,但进不了中断处理程序 cardReg.Card.Item[0].I.Int.dwOptions = INTERRUPT_LEVEL_SENSITIVE;//或者 = 1; cardReg.Card.Item[1].item = ITEM_IO; cardReg.Card.Item[1].fNotSharable = TRUE; cardReg.Card.Item[1].I.IO.dwAddr = MY_IO_BASE; cardReg.Card.Item[1].I.IO.dwBytes = MY_IO_SIZE; cardReg.fCheckLockOnly = FALSE; dwStatus = WD_CardRegister(hWD, &cardReg); if (dwStatus) { printf("Failed locking device. Status 0x%lx - %s", dwStatus, Stat2Str(dwStatus)); } else { HANDLE thread_handle; WD_INTERRUPT *pIntrp; pIntrp = (WD_INTERRUPT *)malloc(sizeof(WD_INTERRUPT)); BZERO(*pIntrp); pIntrp->hInterrupt = cardReg.Card.Item[0].I.Int.hInterrupt; printf ("starting interrupt thread\n"); // this calls WD_IntEnable() and creates an interrupt handler thread dwStatus = InterruptEnable(&thread_handle, hWD, pIntrp, interrupt_handler, pIntrp); //下面程序省略 INTCSR(4CH)的初始配置为:0x1000,程序中先改为0x1043。 请各位大侠指点啊,送全部分数! |
|