Chapter 3
void
{
main (void)
OS_ERR
err;
BSP_IntDisAll();
OSInit(&err);
if (err != OS_ERR_NONE) {
/* Something didn’t get initialized correctly ... */
/* ... check OS.H for the meaning of the error code, see OS_ERR_xxxx */
}
OSTaskCreate((OS_TCB *)&AppTaskStartTCB,
(CPU_CHAR *)”App Task Start”,
(OS_TASK_PTR )AppTaskStart,
(void *)0,
(OS_PRIO )APP_TASK_START_PRIO,
(CPU_STK *)&AppTaskStartStk[0],
(CPU_STK_SIZE)APP_TASK_START_STK_SIZE / 10,
(CPU_STK_SIZE)APP_TASK_START_STK_SIZE,
(OS_MSG_QTY )0,
(OS_TICK )0,
(void *)0,
(OS_OPT )(OS_OPT_TASK_STK_CHK | OS_OPT_TASK_STK_CLR),
(1)
(2)
(3)
(4)
(5)
(6)
(7)
(8)
(9)
(10)
(11)
(OS_ERR *)&err); (12)
if (err != OS_ERR_NONE) {
/* The task didn’t get created. Lookup the value of the error code ... */
/* ... in OS.H for the meaning of the error */
}
OSStart(&err); (13)
if (err != OS_ERR_NONE) {
/* Your code is NEVER supposed to come back to this point. */
}
}
Listing 3-2 APP.C (2nd Part)
L3-2(1)
Start main() by calling a BSP function that disables all interrupts. On most
processors, interrupts are disabled at startup until explicitly enabled by application
code. However, it is safer to turn off all peripheral interrupts during startup.
L3-2(2)
Call OSInit() , which is responsible for initializing μC/OS-III. OSInit()
initializes internal variables and data structures, and also creates two (2) to five (5)
internal tasks. At a minimum, μC/OS-III creates the idle task ( OS_IdleTask() ),
which executes when no other task is ready to run. μC/OS-III also creates the
tick task, which is responsible for keeping track of time.
54
相关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