4
Table of Contents
Chapter 4 Critical Sections ................................................................................... 69
4-1 Disabling Interrupts .............................................................................. 70
4-1-1 Measuring Interrupt Disable Time ....................................................... 70
4-2 Locking the Scheduler ......................................................................... 71
4-2-1 Measuring Scheduler Lock Time ......................................................... 72
4-3 μC/OS-III Features with Longer Critical Sections ............................... 73
4-4 Summary .............................................................................................. 74
Chapter 5 Task Management ............................................................................... 75
5-1 Assigning Task Priorities ..................................................................... 84
5-2 Determining the Size of a Stack .......................................................... 86
5-3 Detecting Task Stack Overflows ......................................................... 87
5-4 Task Management Services ................................................................ 91
5-5 Task Management Internals ................................................................ 92
5-5-1 Task States ........................................................................................... 92
5-5-2 Task Control Blocks (TCBs) ................................................................. 97
5-6 Internal Tasks ..................................................................................... 109
5-6-1 The Idle Task (OS_IdleTask(), os_core.c) .......................................... 109
5-6-2 The Tick Task (OS_TickTask(), os_tick.c) .......................................... 111
5-6-3 The Statistic Task (OS_StatTask(), os_stat.c) ................................... 118
5-6-4 The Timer Task (OS_TmrTask(), os_tmr.c) ........................................ 121
5-6-5 The ISR Handler Task (OS_IntQTask(), os_int.c) .............................. 122
5-7 Summary ............................................................................................ 123
Chapter 6 The Ready List ................................................................................... 125
6-1 Priority Levels ..................................................................................... 126
6-2 The Ready List ................................................................................... 130
6-3 Adding Tasks to the Ready List ........................................................ 133
6-4 Summary ............................................................................................ 134
Chapter 7 Scheduling .......................................................................................... 135
7-1 Preemptive Scheduling ...................................................................... 136
7-2 Scheduling Points .............................................................................. 138
7-3 Round-Robin Scheduling .................................................................. 140
7-4 Scheduling Internals .......................................................................... 142
7-4-1 OSSched() .......................................................................................... 143
7-4-2 OSIntExit() ........................................................................................... 144