void Task1(void *Id)
{
INT8U err;
OS_FLAGS value;
for (;;)
{
printf("post msg index=%d\n", index);
err = OSQPost(CommQ, (void *)&msg[index]);
switch (err) {
case OS_ERR_NONE:
/* Message was deposited into queue */
index++;
break;
case OS_ERR_Q_FULL:
/* Queue is full */
err = OSFlagPost(EngineFlags,
0xFF,//clear 0-7 bit
OS_FLAG_CLR,
&err);
value = OSFlagPend(EngineFlags,
1,//wait bit 0 be set
OS_FLAG_WAIT_SET_ALL + OS_FLAG_CONSUME,//clr flag after be read
0,//0 for forever
&err);
break;
}
if(index >= MSG_COUNT)
index = 0;
}
}
这种任务式挺有意思。
|