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;
}
/* 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来代表每个user defined task。

这篇博客主要复习了FreeRTOS操作系统,其9000行代码中,task.c占50%,queue.c占40%,硬件相关代码占6%。重点讨论了如何确保实时操作系统始终执行最高优先级的任务,并介绍了FreeRTOS中使用TCB(任务控制块)来表示用户定义的任务。参考了AOSA Book和LPC17xx开发板的相关资料。
最低0.47元/天 解锁文章
8871

被折叠的 条评论
为什么被折叠?



