Chapter 3
L3-2(6)
The fourth argument of OSTaskCreate() is the actual argument that the task
receives when it first begins. In other words, the “ p_arg” of MyTask() . In the
example a NULL pointer is passed, and thus “ p_arg ” for AppTaskStart() will
be a NULL pointer.
The argument passed to the task can actually be any pointer. For example, the
user may pass a pointer to a data structure containing parameters for the task.
L3-2(7)
L3-2(8)
L3-2(9)
L3-2(10)
L3-2(11)
The next argument to OSTaskCreate() is the priority of the task. The
priority establishes the relative importance of this task with respect to the
other tasks in the application. A low-priority number indicates a high
priority (or more important task). Set the priority of the task to any value
between 1 and OS_CFG_PRIO_MAX-2 , inclusively. Avoid using priority #0, and
priority OS_CFG_PRIO_MAX-1 , because these are reserved for μC/OS-III.
OS_CFG_PRIO_MAX is a compile time configuration constant, which is declared
in OS_CFG.H .
The sixth argument to OSTaskCreate() is the base address of the stack
assigned to this task. The base address is always the lowest memory location of
the stack.
The next argument specifies the location of a “watermark” in the task’s stack
that can be used to determine the allowable stack growth of the task. See
Chapter 5, “Task Management” on page 75 for more details on using this
feature. In the code above, the value represents the amount of stack space (in
CPU_STK elements) before the stack is empty. In other words, in the example,
the limit is reached when there is 10% of the stack left.
The eighth argument to OSTaskCreate() specifies the size of the task’s stack in
number of CPU_STK elements (not bytes). For example, if allocating 1 Kbyte of
stack space for a task and the CPU_STK is a 32-bit word, then pass 256.
The next three arguments are skipped as they are not relevant for the current
discussion. The next argument to OSTaskCreate() specifies options. In this
example, we specify that the stack will be checked at run time (assuming the
statistic task was enabled in OS_CFG.H ), and that the contents of the stack will
be cleared when the task is created.
56
相关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