本文引用地址:http://cafeforensic.com/article/201611/322856.htmpdata=pdata;
while(TRUE){
AppTaskACtr++;
#ifOS_FLAG_EN>0
OSFlagPend(FlagGrp1,0xFF00,OS_FLAG_WAIT_SET_ALL+OS_FLAG_CONSUME,100,&err);
#endif
OSTimeDly(100);
}
}
staticvoidAppTaskB(void*pdata)
{
INT8Uerr;
pdata=pdata;
while(TRUE){
AppTaskBCtr++;
#ifOS_FLAG_EN>0
OSFlagPend(FlagGrp1,0x0FF0,OS_FLAG_WAIT_SET_ALL+OS_FLAG_CONSUME,100,&err);
#endif
OSTimeDly(100);
}
}
staticvoidAppTaskC(void*pdata)
{
INT8Uerr;
pdata=pdata;
while(TRUE){
AppTaskCCtr++;
#ifOS_MUTEX_EN>0
OSMutexPend(EventMutex1,0,&err);
OSTimeDly(100);
OSMutexPost(EventMutex1);
#endif
OSTimeDly(1);
}
}
staticvoidAppTaskD(void*pdata)
{
INT8Uerr;
pdata=pdata;
while(TRUE){
AppTaskDCtr++;
#ifOS_MUTEX_EN>0
OSMutexPend(EventMutex1,0,&err);
OSTimeDly(100);
OSMutexPost(EventMutex1);
#endif
OSTimeDly(1);
}
}
staticvoidAppTaskE(void*pdata)
{
INT8Uerr;
pdata=pdata;
while(TRUE){
AppTaskECtr++;
#ifOS_MBOX_EN>0
OSMboxPost(EventMbox1,(void*)"Msg#1");
OSTimeDly(100);
OSMboxPost(EventMbox1,(void*)"Msg#2");
OSTimeDly(100);
OSMboxPost(EventMbox1,(void*)"Msg#3");
OSTimeDly(100);
#endif
OSTimeDly(1);
}
}
staticvoidAppTaskF(void*pdata)
{
INT8Uerr;
char*pmsg;
chars[30];
pdata=pdata;
while(TRUE){
AppTaskFCtr++;
#ifOS_MBOX_EN>0
pmsg=(char*)OSMboxPend(EventMbox1,0,&err);
strcpy(s,pmsg);
#endif
OSTimeDly(1);
}
}
staticvoidAppTickInit(void)
{
TSCR1=0x80;
#ifOS_TICK_OC==0
TIOS|=0x01;
TC0=TCNT+OS_TICK_OC_CNTS;
TCTL2|=0x01;
TIE|=0x01;
#endif
#ifOS_TICK_OC==1
TIOS|=0x02;
TC1=TCNT+OS_TICK_OC_CNTS;
TCTL2|=0x04;
TIE|=0x02;
#endif
#ifOS_TICK_OC==2
TIOS|=0x04;
TC2=TCNT+OS_TICK_OC_CNTS;
TCTL2|=0x10;
TIE|=0x04;
#endif
#ifOS_TICK_OC==3
TIOS|=0x08;
TC3=TCNT+OS_TICK_OC_CNTS;
TCTL2|=0x40;
TIE|=0x08;
#endif
#ifOS_TICK_OC==4
TIOS|=0x10;
TC4=TCNT+OS_TICK_OC_CNTS;
TCTL1|=0x01;
TIE|=0x10;
#endif
#ifOS_TICK_OC==5
TIOS|=0x20;
TC5=TCNT+OS_TICK_OC_CNTS;
TCTL1|=0x04;
TIE|=0x20;
#endif
#ifOS_TICK_OC==6
TIOS|=0x40;
TC6=TCNT+OS_TICK_OC_CNTS;
TCTL1|=0x10;
TIE|=0x40;
#endif
#ifOS_TICK_OC==7
TIOS|=0x80;
TC7=TCNT+OS_TICK_OC_CNTS;
TCTL1|=0x40;
TIE|=0x80;
#endif
}
評論