What is the difference between context & priority of a task?


#1

Hi,

Priority is the task priority level, relative to the other tasks declared in the table. The higher is the number, the higher is the priority level. Priorities values declared in the table should be from 1 to the tasks count.
Context id is that which ADL supplies to all the tasks in the application. The value ranges from 0 to (taskCount -1). And these are assigned in that sequential order in which the tasks are declared. As the highest priority task should be declared first in the table, the context id is always 0.

Considering the below example, highest priority task should be declared first and then the other tasks can follow any order. The context ids will be assigned by ADL in the following way:

const adl_InitTasks_t adl_InitTasks [] =
{
{ MyFirstEntryPoint, 1024, “MYTASK1”, 4 }, // the highest priority task should be declared first and the rest of the priorities can be declared in any order.// Context id is 0
{ MySecondEntryPoint, 1024, “MYTASK2”, 1 }, //Context id is 1
{ MyThirdEntryPoint, 1024, “MYTASK3”, 3 }, //Context id is 2
{ MyFourthEntryPoint, 1024, “MYTASK4”, 2 }, //Context id is 3
{ 0, 0, 0, 0 }
};