接上面的文章,补齐源码
// set the thread prioritythreadpriority= 6;
if( !CeSetThreadPriority( m_interrupTestThread, threadpriority))
{
RETAILMSG(1,(TEXT("test: Failed setting Thread Priority.\r\n")));
return FALSE;
}
//initialize interrupt event
if (!InterruptInitialize(m_interruptTestSysId,m_interruptTestEvent,NULL,0))
{
ERRORMSG( 1, (TEXT("test interrupt is not initialized\n\r")));
return(FALSE);
}
//启动线程
ResumeThread( m_interrupTestThread );
return TRUE;
}
4.中断线程处理函数
DWORD WINAPIThreadproc(LPVOID lpvParam)
{
DWORDdwStatus;
BOOLfState = TRUE;
static BOOL count = TRUE;
RETAILMSG(1,(TEXT("entry test thread \r\n")));
while (!m_ExitThread)
{
dwStatus = WaitForSingleObject(m_interruptTestEvent,INFINITE);
if (m_ExitThread)
{
break;
}
if (dwStatus == WAIT_OBJECT_0)
{
RETAILMSG(1,(TEXT("test thread happend \r\n")));
}
count = ~count;
if(count&0x1)
v_pIOPregs->GPMDAT |= 0x1; //灯灭
else
v_pIOPregs->GPMDAT &= 0xfffffffe;//灯亮
InterruptDone(m_interruptTestSysId);
Enble_Test_Interrupt();
}
return FALSE;
}
页:
[1]