limesp
Newbie level 1
Hi All,
I am new to Real Time OS. Can anyone explain the code stated as below to me in details?
First part:
OS_STK MainTaskStk[MainTaskStkLengh];
OS_STK Task0Stk [Task0StkLengh]; // Define the Task0 stack
OS_STK Task1Stk [Task1StkLengh]; // Define the Task1 stack
OS_STK Task2Stk [Task2StkLengh]; // Define the Task2 stack
Second part:
#define rGPKCON0 (*(volatile unsigned *)(0x7F008800))
#define rGPKCON1 (*(volatile unsigned *)(0x7F008804))
#define rGPKDAT (*(volatile unsigned *)(0x7F008808))
#define rGPKPUD (*(volatile unsigned *)(0x7F00880C))
void Port_Init(void)
{
rGPKCON0 = (rGPKCON0 & ~(0xffffU<<16))|(0x1111U<<16);
rGPKPUD = (rGPKPUD & ~(0xffU << 8))|(0x00U<<8);
}
void Led_Display(int data)
{
rGPKDAT = (rGPKDAT & ~(0xf<<4)) | ((data & 0xf)<<4);
}
void Task2 (void *pdata)
{
Port_Init();
while(1)
{
OSPrintf("this is from task2\n");
Led_Display(0x9); // 1001
OSTimeDly(OS_TICKS_PER_SEC/4);
Led_Display(0x6); // 0110
OSTimeDly(OS_TICKS_PER_SEC/4);
}
}
Third part:
- How to create Task 3?
Fourth part:
- There are four leds in hardware. How led blinking based on Task0,Task1 and Task2 from this program code?
Attached is the whole program code used in ARM Developer Suite.
Appreciated and Thanks.
I am new to Real Time OS. Can anyone explain the code stated as below to me in details?
First part:
OS_STK MainTaskStk[MainTaskStkLengh];
OS_STK Task0Stk [Task0StkLengh]; // Define the Task0 stack
OS_STK Task1Stk [Task1StkLengh]; // Define the Task1 stack
OS_STK Task2Stk [Task2StkLengh]; // Define the Task2 stack
Second part:
#define rGPKCON0 (*(volatile unsigned *)(0x7F008800))
#define rGPKCON1 (*(volatile unsigned *)(0x7F008804))
#define rGPKDAT (*(volatile unsigned *)(0x7F008808))
#define rGPKPUD (*(volatile unsigned *)(0x7F00880C))
void Port_Init(void)
{
rGPKCON0 = (rGPKCON0 & ~(0xffffU<<16))|(0x1111U<<16);
rGPKPUD = (rGPKPUD & ~(0xffU << 8))|(0x00U<<8);
}
void Led_Display(int data)
{
rGPKDAT = (rGPKDAT & ~(0xf<<4)) | ((data & 0xf)<<4);
}
void Task2 (void *pdata)
{
Port_Init();
while(1)
{
OSPrintf("this is from task2\n");
Led_Display(0x9); // 1001
OSTimeDly(OS_TICKS_PER_SEC/4);
Led_Display(0x6); // 0110
OSTimeDly(OS_TICKS_PER_SEC/4);
}
}
Third part:
- How to create Task 3?
Fourth part:
- There are four leds in hardware. How led blinking based on Task0,Task1 and Task2 from this program code?
Attached is the whole program code used in ARM Developer Suite.
Appreciated and Thanks.