#include "semLib.h"
SEM_ID syncSem;
/* ID of sync semaphore */
init ( int someIntNum )
{ /* connect interrupt service routine */
intConnect (INUM_TO_IVEC (someIntNum), eventInterruptSvcRout, 0);
/* create semaphore */
syncSem = semBCreate (SEM_Q_FIFO, SEM_EMPTY);
/* spawn task used for synchronization. */
taskSpawn ("sample", 100, 0, 20000, task1, 0,0,0,0,0,0,0,0,0,0);
}
task1 (void)
{ ...
semTake (syncSem, WAIT_FOREVER);
/* wait for event to occur */
printf ("task 1 got the semaphore\n");
...
/* process event */
}
eventInterruptSvcRout (void)
{ ...
semGive (syncSem);
/* let task 1 process event */
...
}
请问如何触发一个中断进入到中断函数中,还有就是同步函数执行后,是立即跳转task1函数,还是继续执行其后面的代码(假如后面还紧跟有代码)???谢谢了!!
翻阅古今
相关分类