📄 main.c
字号:
#include "..\SOURCE\includes.h" // uC/OS interface
#include "..\inc\44blib.h"
#include "..\inc\def.h"
#include "..\inc\44b.h"
#include "..\inc\int.h"
// allocate memory for tasks' stacks
//#ifdef SEMIHOSTED
//#else
#define STACKSIZE 256
//#endif
OS_STK Stack1[STACKSIZE]= {0, };
OS_STK Stack2[STACKSIZE]= {0, };
OS_STK Stack3[STACKSIZE]= {0, };
OS_STK Stack4[STACKSIZE]= {0, };
// mailbox event control blocks
OS_EVENT *Mbox1;
OS_EVENT *Mbox2;
OS_EVENT *Mbox3;
char PassMsg[] = "SW44B0";
void Task1(void *Id)
{
char *Msg;
INT8U err;
//Uart_Printf("Task1() called\r\n");
for(;;){
// wait for a message from the input mailbox
Msg = (char *)OSMboxPend(Mbox1, 0, &err);
// print task's id
//Uart_Printf("%c", *(char *)Id);
//OSTimeDly(5);
// post the input message to the output mailbox
OSMboxPost(Mbox2, Msg);
}
}
void Task2(void *Id)
{
char *Msg;
INT8U err;
// Uart_Printf("Task2() called\r\n");
for(;;){
// wait for a message from the input mailbox
Msg = (char *)OSMboxPend(Mbox2, 0, &err);
// print task's id
// Uart_Printf("%c", *(char *)Id);
// post the input message to the output mailbox
OSMboxPost(Mbox3, Msg);
}
}
void Task3(void *Id)
{
char *Msg;
INT8U err;
// Uart_Printf("Task3() called\r\n");
for(;;){
// wait for a message from the input mailbox
Msg = (char *)OSMboxPend(Mbox3, 0, &err);
// print task's id
// Uart_Printf("%c", *(char *)Id);
// post the input message to the output mailbox
OSMboxPost(Mbox1, Msg);
}
}
void Task4(void *pdata)
{
pdata=pdata;
Port_Init();
tickinit();
intinit();
for(;;)
{
OSTimeDly(10);
ledflash();
}
}
int Main(int argc, char **argv)
{
//char Id1 = '1';
//char Id2 = '2';
//char Id3 = '3';
//
Port_Init();
// tickinit();
// intinit();
//Uart_Select(0);
OSInit();
//Mbox1 = OSMboxCreate(PassMsg);
//Mbox2 = OSMboxCreate((void *)0);
//Mbox3 = OSMboxCreate((void *)0);
//OSTaskCreate(Task1, (void *)&Id1, (OS_STK *)&Stack1[STACKSIZE - 1],0);
//OSTaskCreate(Task2, (void *)&Id2, (OS_STK *)&Stack2[STACKSIZE - 1],6);
//OSTaskCreate(Task3, (void *)&Id3, (OS_STK *)&Stack3[STACKSIZE - 1],7);
OSTaskCreate(Task4, (void *)0, (OS_STK *)&Stack4[STACKSIZE - 1],0);
OSStart();
return 0;
} // main
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -