|
急!!2450 wince5.0 怎么用IIC的中断???
[复制链接]
while(_iicDataCount!=-1)
{ Run_IicPoll();}
这段代码,若是没有产生中断的话,会一直在这死等,占用资源,造成系统慢或死机。
现在我想用中断来做IIC,
UINT32 g_charge_Irq2 = IRQ_IIC;
UINT32 g_charge_detect_SysIntr2=0;
HANDLE g_charge_detect_Event2=NULL;
然后
g_charge_detect_Event2 = CreateEvent(NULL, FALSE, FALSE, NULL);
if (!KernelIoControl(IOCTL_HAL_REQUEST_SYSINTR, &g_charge_Irq2, sizeof(UINT32), &g_charge_detect_SysIntr2, sizeof(UINT32), NULL))
{
RETAILMSG(1, (TEXT("ERROR: Plug Failed to request sysintr value for g_charge_Irq2 interrupt.\r\n")));
return(0);
}
RETAILMSG(1,(TEXT("INFO: Plug: Mapped Irq 0x%x to SysIntr 0x%x.\r\n"), g_charge_Irq2, g_charge_detect_SysIntr2));
if (!(InterruptInitialize(g_charge_detect_SysIntr2, g_charge_detect_Event2, 0, 0)))
{
RETAILMSG(1, (TEXT("ERROR: Plug: Interrupt initialize failed.\r\n")));
}
ghBattChargeThread2=CreateThread (NULL, 0, ReceiveIICInterruptEventThread, NULL, 0, NULL);
我用WaitForSingleObject(g_charge_detect_Event2, INFINITE);发现一直在这个线程里,根本就没有产生中断,是不是IIC的中断不能这样做呀? 有不有人用过IIC的中断,用WaitForSingleObject做的?
|
|