📄 app.c
字号:
/*
*********************************************************************************************************
* EXAMPLE CODE
*
* (c) Copyright 2003-2007; Micrium, Inc.; Weston, FL
*
* All rights reserved. Protected by international copyright laws.
* Knowledge of the source code may NOT be used to develop a similar product.
* Please help us continue to provide the Embedded community with the finest
* software available. Your honesty is greatly appreciated.
*********************************************************************************************************
*/
/*
*********************************************************************************************************
*
* EXAMPLE CODE
*
* ST Microelectronics STM32
* on the
*
* Micrium uC-Eval-STM32F107
* Evaluation Board
*
* Filename : app.c
* Version : V1.00
* Programmer(s) : EHS
*********************************************************************************************************
*/
/*
*********************************************************************************************************
* INCLUDE FILES
*********************************************************************************************************
*/
#include <includes.h>
/*
*********************************************************************************************************
* LOCAL DEFINES
*********************************************************************************************************
*/
/*
*********************************************************************************************************
* LOCAL GLOBAL VARIABLES
*********************************************************************************************************
*/
static 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 initialization.
*
* Arguments : none
*
* Returns : none
*********************************************************************************************************
*/
int main (void)
{
CPU_INT08U err;
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_EN > 0)
OSTaskNameSet(APP_TASK_START_PRIO, "Start Task", &err);
#endif
OSStart(); /* Start multitasking (i.e. give control to uC/OS-II) */
}
/*
*********************************************************************************************************
* 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 'AppTaskStart()' by 'OSTaskCreate()'.
*
* Returns : none
*
* 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.
*********************************************************************************************************
*/
static void AppTaskStart (void *p_arg)
{
CPU_INT32U hclk_freq;
CPU_INT32U cnts;
(void)p_arg;
BSP_Init(); /* Init BSP fncts. */
CPU_Init(); /* Init CPU name & int. dis. time measuring fncts. */
#if (BSP_SER_COMM_EN == DEF_ENABLED) /* Init serial port 0 to 115,2000 baud for use with ... */
BSP_Ser_Init(115200); /* ... tracing. See app_cfg.h. */
#endif
hclk_freq = BSP_CPU_ClkFreq(); /* Determine SysTick reference freq. */
cnts = hclk_freq / (CPU_INT32U)OS_TICKS_PER_SEC; /* Determine nbr SysTick increments in OS_TICKS_PER_SEC. */
OS_CPU_SysTickInit(cnts); /* Init uC/OS periodic time src (SysTick). */
Mem_Init(); /* Init mem mgmt module. */
#if (OS_TASK_STAT_EN > 0)
OSStatInit(); /* Determine CPU capacity */
#endif
AppTaskCreate(); /* Create application tasks */
BSP_LED_Off(0);
while (DEF_TRUE) { /* Task body, always written as an infinite loop. */
BSP_LED_Toggle(0);
OSTimeDlyHMSM(0, 0, 0, 500);
}
}
/*
*********************************************************************************************************
* CREATE APPLICATION TASKS
*
* Description: This function creates the application tasks.
*
* Arguments : none
*
* Returns : none
*********************************************************************************************************
*/
static void AppTaskCreate (void)
{
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -