|
主要就是这部分
void TestTask4 (void * pdata) TASK_REENTRANT
{
OS_SEM_DATA sem_data;
printf("Check semaphore:\n");
err=OSSemQuery(mis5,&sem_data);
if(err==OS_NO_ERR){
printf("MIS4 has been established\n");}
OSSemPost(mis5);
}
void TestTask9(void * os_pdata) TASK_REENTRANT
{
INT8U err ;
os_pdata = os_pdata;
for(;;)
{
OSSemPend(mis5,0,&err);
if(err==OS_NO_ERR) {
printf ("OS_NO_ERR\n");
}
}
}
void main (void)
{
OSInit();
OSTaskCreate (TestTask4,(void *)0, &TestTask4Stk[63], 4);
OSTaskCreate (TestTask5,(void *)0, &TestTask5Stk[63], 5);
OSTaskCreate (TestTask6,(void *)0, &TestTask6Stk[63], 6);
OSTaskCreate (TestTask7,(void *)0, &TestTask7Stk[63], 7);
OSTaskCreate (TestTask8,(void *)0, &TestTask8Stk[63], 8);
OSTaskCreate (TestTask9,(void *)0, &TestTask9Stk[63], 9);
mis1=OSSemCreate(0);
mis2=OSSemCreate(0);
mis3=OSSemCreate(0);
mis4=OSSemCreate(0);
mis5=OSSemCreate(0);
OSStart();
}
把OS_SEM_DATA改成其他的就可以正常运行
|
|