📄 oldmemtest.c
字号:
OSQPost(MsgQueue, addr3);//(rom INT8U *)three);
// OSTimeDly(10);
OSTimeDlyHMSM(0, 0, 1, 0); /* Delay for 1 second */
}
}
/*$PAGE*/
/*
*********************************************************************************************************
* TASK #2
*
* Description: This task waits for messages sent by task #1.
*********************************************************************************************************
*/
void Task2 (void *data)
{
rom INT8U *msg;
INT8U err;
INT8U viewchar;
unsigned char viewvar=0;
data = data;
for (;;) {
msg = (rom INT8U *)OSQPend(MsgQueue, 0, &err); /* Wait forever for message */
viewchar=msg[0];
viewvar++;
// OSTimeDly(5);
OSMemPut(MemPtr,msg);
OSTimeDlyHMSM(0, 0, 0, 500); /* Delay for 500 mS */
}
}
/*$PAGE*/
/*
*********************************************************************************************************
* TASK #3
*
* Description: This task waits for up to 500 mS for a message sent by task #1.
*********************************************************************************************************
*/
void Task3 (void *data)
{
rom INT8U *msg;
INT8U err;
INT8U viewchar;
INT8U aaa=0;
data = data;
for (;;) {
msg = (rom INT8U *)OSQPend(MsgQueue,0, &err); /* Wait up to 250 mS for a msg */
// msg = (rom INT8U *)OSQPend(MsgQueue, OS_TICKS_PER_SEC / 4, &err); /* Wait up to 250 mS for a msg */
viewchar=msg[0];
aaa++;
OSMemPut(MemPtr,msg);
if (err == OS_TIMEOUT) {
err=err;
}
}
}
/*
*********************************************************************************************************
* TASK #4
*
* Description: This task posts a message to a mailbox and then immediately reads the message.
*********************************************************************************************************
*/
OS_EVENT *mbox;
void Task4 (void *data)
{
// OS_EVENT *mbox;
INT8U err;
data = data;
// mbox = OSMboxCreate((rom INT8U *)0);
for (;;) {
// OSMboxPost(mbox, (rom INT8U *)1); /* Send message to mailbox */
// OSMboxPend(mbox, 0, &err); /* Get message from mailbox */
// OSTimeDly(1);
OSTimeDlyHMSM(0, 0, 1, 0); /* Delay 10 mS */
}
}
/*$PAGE*/
/*
*********************************************************************************************************
* TASK #5
*
* Description: This task simply delays itself. We basically want to determine how long OSTimeDly() takes
* to execute.
*********************************************************************************************************
*/
void Task5 (void *data)
{
INT8U err;
// rom char *addr1[36];
// INT16U i;
data = data;
for (;;) {
// OSMboxPend(mbox, 0, &err); /* Get message from mailbox */
/* for(i=0;i<36;i++){
addr1[i]=OSMemGet(MemPtr,&err);
if(addr1[i]==(rom void *)0){
i=i;
err=err;
break;
}
}
for(i=0;i<36;i++){
if(addr1[i]!=(rom void *)0){
OSMemPut(MemPtr,addr1[i]);
}
else
break;
}
*/
// OSTimeDly(5);
}
}
/*
*********************************************************************************************************
* DISPLAY TASK RELATED STATISTICS
*********************************************************************************************************
*/
/*$PAGE*/
/*
*********************************************************************************************************
* CLOCK TASK
*********************************************************************************************************
*/
void TaskClk (void *data)
{
// char s[120];
data = data;
for (;;) {
// OSTimeDly(1000);
OSTimeDlyHMSM(0, 0, 0, 100); /* Execute every 100 mS */
}
}
/*$PAGE*/
/*
*********************************************************************************************************
* TASK CREATION HOOK
*
* Description: This function is called when a task is created.
*
* Arguments : ptcb is a pointer to the task being created.
*
* Note(s) : 1) Interrupts are disabled during this call.
*********************************************************************************************************
*/
//void OSTaskCreateHook (OS_TCB *ptcb)
//{
// ptcb = ptcb; /* Prevent compiler warning */
//}
/*
*********************************************************************************************************
* TASK DELETION HOOK
*
* Description: This function is called when a task is deleted.
*
* Arguments : ptcb is a pointer to the task being created.
*
* Note(s) : 1) Interrupts are disabled during this call.
*********************************************************************************************************
*/
//void OSTaskDelHook (OS_TCB *ptcb)
//{
// ptcb = ptcb; /* Prevent compiler warning */
//}
/*$PAGE*/
/*
*********************************************************************************************************
* TASK SWITCH HOOK
*
* Description: This function is called when a task switch is performed. This allows you to perform other
* operations during a context switch.
*
* Arguments : none
*
* Note(s) : 1) Interrupts are disabled during this call.
* 2) It is assumed that the global pointer 'OSTCBHighRdy' points to the TCB of the task that
* will be 'switched in' (i.e. the highest priority task) and, 'OSTCBCur' points to the task
* being switched out (i.e. the preempted task).
*********************************************************************************************************
*/
/*
*********************************************************************************************************
* STATISTIC TASK HOOK
*
* Description: This function is called every second by uC/OS-II's statistics task. This allows your
* application to add functionality to the statistics task.
*
* Arguments : none
*********************************************************************************************************
*/
/*$PAGE*/
/*
*********************************************************************************************************
* TICK HOOK
*
* Description: This function is called every tick.
*
* Arguments : none
*
* Note(s) : 1) Interrupts may or may not be are ENABLED during this call.
*********************************************************************************************************
*/
//void OSTimeTickHook (void)
//{
//}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -