#include "../SOURCE/includes.h" // uC/OS interface
#include "../inc/44blib.h"
#include "../inc/def.h"
#include "../inc/44b.h"
// allocate memory for tasks' stacks
#ifdef SEMIHOSTED
#define STACKSIZE (64+SEMIHOSTED_STACK_NEEDS)
#else
#define STACKSIZE 256
#endif
OS_STK Stack1[STACKSIZE]= {0, };
OS_STK Stack2[STACKSIZE]= {0, };
void Task1(void *Id)
{
while(1) {
Uart_Printf("I am task1\n");
OSTimeDly(OS_TICKS_PER_SEC);
Uart_Printf("I am task2\n");
OSTimeDly(200);
}
}
void Task2(void *Id)
{
for(;;){
Led_Display(2);
Delay(1000);
Led_Display(4);
Delay(1000);
}
}
int Main(int argc, char **argv)
{
char Id1 = '1';
char Id2 = '2';
OSInit();
OSTaskCreate(Task1, (void *)&Id1, (OS_STK *)&Stack1[STACKSIZE - 1], 5);
OSTaskCreate(Task2, (void *)&Id2, (OS_STK *)&Stack2[STACKSIZE - 1],10);
OSStart();
return 0;
}