Chapter 5
F5-1(3)
μC/OS-III then initializes the top of the task’s stack with a copy of the CPU
registers in the same stacking order as if they were all saved at the beginning of
an ISR. This makes it easy to perform context switches as we will see when
discussing the context switching process. For illustration purposes, the
assumption is that the stack grows from high memory to low memory, but the
same concept applies for CPUs that use the stack in the reverse order.
F5-1(4)
The new value of the stack pointer (SP) is saved in the TCB. Note that this is
also called the top-of-stack .
F5-1(5)
The remaining fields of the TCB are initialized: task priority, task name, task
state, internal message queue, internal semaphore, and many others.
Next, a call is made to a function that is defined in the CPU port, OSTaskCreateHook()
(see OS_CPU_C.C ). OSTaskCreateHook() is passed the pointer to the new TCB and this
function allows you (or the port designer) to extend the functionality of OSTaskCreate() .
For example, one could printout the contents of the fields of the newly created TCB onto a
terminal for debugging purposes.
The task is then placed in the ready-list (see Chapter 6, “The Ready List” on page 123) and
finally, if multitasking has started, μC/OS-III will invoke the scheduler to see if the created
task is now the highest priority task and, if so, will context switch to this new task.
The body of the task can invoke other services provided by μC/OS-III. Specifically, a task
can create another task (i.e., call OSTaskCreate() ), suspend and resume other tasks (i.e.,
call OSTaskSuspend() and OSTaskResume() respectively), post signals or messages to
other tasks (i.e., call OS??Post() ), share resources with other tasks, and more. In other
words, tasks are not limited to only make “wait for an event” function calls.
Figure 5-2 shows the resources with which a task typically interacts.
80
相关PDF资料
AD-UCUSBD-SPRD PRD LIC UCUSB DEV CORE CCES SGL
AD637-EVALZ BOARD EVALUATION FOR AD637
AD736-EVALZ BOARD EVALUATION FOR AD736
AD737-EVALZ BOARD EVALUATION FOR AD737
AD8007AKS-EBZ BOARD EVAL FOR AD8007AKS
AD8018ARU-EVAL BOARD EVAL FOR AD8018
AD8034ART-EBZ BOARD EVAL FOR AD8034ART
AD8040AR-EBZ BOARD EVAL FOR AD8040AR
相关代理商/技术参数
ADUCOSC100 制造商:Analog Devices 功能描述:ADC - Rail/Tube
ADUCOSC100-REEL 功能描述:DAC MICROCONVERTER DUAL TSSOP 制造商:analog devices inc. 系列:* 零件状态:上次购买时间 标准包装:1
ADUCOSC100-REEL7 功能描述:DAC MICROCONVERTER DUAL TSSOP 制造商:analog devices inc. 系列:* 零件状态:上次购买时间 标准包装:1
ADUCOSCZ100 制造商:Analog Devices 功能描述:
ADUCOSCZ100-REEL7 制造商:Analog Devices 功能描述:ANAADUCOSCZ100-REEL7 12 BIT ADC WITH EMB
ADuC-P7026 功能描述:开发板和工具包 - ARM PROTOTYPE BRD FOR ADUC7026 ARM7 RoHS:否 制造商:Arduino 产品:Development Boards 工具用于评估:ATSAM3X8EA-AU 核心:ARM Cortex M3 接口类型:DAC, ICSP, JTAG, UART, USB 工作电源电压:3.3 V
ADUCRF101 制造商:Analog Devices 功能描述:PRECISION ANALOG MICRCONTROLLER - Tape and Reel
ADUCRF101BCPZ128 制造商:Analog Devices 功能描述:PRECISION ANALOG MICROCONTROLLER WITH RF TRANSCEIVER, ARM CO - Trays