FreeRTOS复习
1. FreeRTOS⼀共9K的代码,分成3部分:
a. 50%: task.c
b. 40%: queue.c
c. 6%: hardware-dependent
Par 1:其中最主要的这9⾏代码,其他8900多⾏都是为他服务,保证real time OS始终执⾏当前最⾼优先度的task:
#define taskSELECT_HIGHEST_PRIORITY_TASK()
{
关于动物的成语/* Find the highest priority queue that contains ready tasks. */
while( listLIST_IS_EMPTY( &( pxReadyTasksLists[ uxTopReadyPriority ] ) ) )海贼王日语
{
伊人青青操
configASSERT( uxTopReadyPriority );
--uxTopReadyPriority;
}
from的用法/* listGET_OWNER_OF_NEXT_ENTRY indexes through the list, so the tasks of
风大的成语
the same priority get an equal share of the processor time. */
listGET_OWNER_OF_NEXT_ENTRY( pxCurrentTCB, &( pxReadyTasksLists[ uxTopReadyPriority ] ) );
} /* taskSELECT_HIGHEST_PRIORITY_TASK */
项目建议书范本Part 2: 在FreeRTOS ⾥⾯,⽤TCB来代表每个ur defined task。
/*
* Task control block. A task control block (TCB) is allocated for each task,
* and stores task state information, including a pointer to the task's context参考文献字体
* (the task's run time environment, including register values)
*/
typedef struct tskTaskControlBlock
驴肉火烧热量
{
volatile portSTACK_TYPE *pxTopOfStack; /*。。。。。。。。。。*/
} tskTCB;
参考资料:
2. Dev Board ARM M3 LPC17xx