📄 app.c
字号:
/*
*********************************************************************************************************
* uC/OS-II
* The Real-Time Kernel
*
* (c) Copyright 1998-2005, Micrium, Weston, FL
* All Rights Reserved
*
*
* ARM Sample code
*
* File : APP.C
* By : Jean J. Labrosse
*********************************************************************************************************
*/
#include <includes.h>
/*
*********************************************************************************************************
* VARIABLES
*********************************************************************************************************
*/
OS_STK AppTaskStartStk[APP_TASK_START_STK_SIZE];
/*
*********************************************************************************************************
* FUNCTION PROTOTYPES
*********************************************************************************************************
*/
static void AppTaskCreate(void);
static void AppTaskStart(void *p_arg);
/*
*********************************************************************************************************
* main()
*
* Description : This is the standard entry point for C code. It is assumed that your code will call
* main() once you have performed all necessary 68HC12 and C initialization.
* Arguments : none
*********************************************************************************************************
*/
int main (void)
{
CPU_INT08U err;
#if 1
BSP_IntDisAll(); /* Disable all interrupts until we are ready to accept them */
OSInit(); /* Initialize "uC/OS-II, The Real-Time Kernel" */
OSTaskCreateExt(AppTaskStart, /* Create the start task */
(void *)0,
(OS_STK *)&AppTaskStartStk[APP_TASK_START_STK_SIZE - 1],
APP_TASK_START_PRIO,
APP_TASK_START_PRIO,
(OS_STK *)&AppTaskStartStk[0],
APP_TASK_START_STK_SIZE,
(void *)0,
OS_TASK_OPT_STK_CHK | OS_TASK_OPT_STK_CLR);
#if OS_TASK_NAME_SIZE > 13
OSTaskNameSet(APP_TASK_START_PRIO, (INT8U*)"Startup", &err);
#endif
OSStart(); /* Start multitasking (i.e. give control to uC/OS-II) */
#endif
}
/*
*********************************************************************************************************
* STARTUP TASK
*
* Description : This is an example of a startup task. As mentioned in the book's text, you MUST
* initialize the ticker only once multitasking has started.
* Arguments : p_arg is the argument passed to 'AppStartTask()' by 'OSTaskCreate()'.
* Notes : 1) The first line of code is used to prevent a compiler warning because 'p_arg' is not
* used. The compiler should not generate any code for this statement.
* 2) Interrupts are enabled once the task start because the I-bit of the CCR register was
* set to 0 by 'OSTaskCreate()'.
*********************************************************************************************************
*/
static void AppTaskStart (void *p_arg)
{
INT8U err;
(void)p_arg;
BSP_Init(); /* Initialize BSP functions */
#if OS_TASK_STAT_EN > 0
OSStatInit(); /* Determine CPU capacity */
#endif
event_cmd = OSSemCreate(0);
AppTaskCreate(); /* Create application tasks */
while (DEF_TRUE)
{ /* Task body, always written as an infinite loop. */
//OSSemPend(event,0,&err);
//
//LED_Off(0);
//OSTimeDlyHMSM(0, 0, 1, 0);
//LED_On(0);
OSTimeDlyHMSM(0, 0, 1, 0);
}
}
/*$PAGE*/
/*
*********************************************************************************************************
* CREATE APPLICATION TASKS
*********************************************************************************************************
*/
static void AppTaskCreate (void)
{
INT8U err;
err = RTCTaskStart();
err = CMDTaskStart();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -