?? app.c
字號:
/*
*********************************************************************************************************
* uC/OS-II
* The Real-Time Kernel
*
* (c) Copyright 2008, Micrium, Inc., Weston, FL
* All Rights Reserved
*
*
* Sample code
*
* File : APP.C
* By : Hong Soong
*********************************************************************************************************
*/
#include "includes.h"
/*
*********************************************************************************************************
* DEFINES
*********************************************************************************************************
*/
#define LCD_LINE_BUF 18 /* The last character should always be a null character */
#define LCD_NUM_LINES 9
#define PB_LEFT DEF_BIT_01
#define PB_RIGHT DEF_BIT_02
#define PB_SELECT DEF_BIT_03
#define PB_UP DEF_BIT_04
#define PB_DOWN DEF_BIT_05
#define PB_S1 DEF_BIT_06
#define PB_S2 DEF_BIT_07
/*
*********************************************************************************************************
* VARIABLES
*********************************************************************************************************
*/
static OS_STK AppTaskStartStk[APP_START_TASK_STK_SIZE];
static OS_STK AppTask1Stk[APP_TASK1_STK_SIZE];
static OS_STK AppTask2Stk[APP_TASK2_STK_SIZE];
static OS_STK AppTask3Stk[APP_TASK3_STK_SIZE];
static OS_STK AppTask4Stk[APP_TASK4_STK_SIZE];
#if (uC_TCPIP_MODULE > 0)
NET_IP_ADDR AppNetIP;
NET_IP_ADDR AppNetMsk;
NET_IP_ADDR AppNetGateway;
#endif
static CPU_CHAR AppLCDTxt0[LCD_LINE_BUF];
static CPU_CHAR AppLCDTxt1[LCD_LINE_BUF];
static CPU_CHAR AppLCDTxt2[LCD_LINE_BUF];
static CPU_CHAR AppLCDTxt3[LCD_LINE_BUF];
static CPU_CHAR AppLCDTxt4[LCD_LINE_BUF];
static CPU_CHAR AppLCDTxt5[LCD_LINE_BUF];
static CPU_CHAR AppLCDTxt6[LCD_LINE_BUF];
static CPU_CHAR AppLCDTxt7[LCD_LINE_BUF];
static CPU_CHAR AppLCDTxt8[LCD_LINE_BUF];
static CPU_CHAR AppLCDTxt[(LCD_LINE_BUF * LCD_NUM_LINES)] = " 0 Micrium 000 uCOS-II 00 0 --------- CPU Usage Time Ticks Context Switches ";
/*
*********************************************************************************************************
* FUNCTION PROTOTYPES
*********************************************************************************************************
*/
static void AppDispInit (void);
static void AppDispUpdate (void);
/*$PAGE*/
/*
*********************************************************************************************************
* 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 CPU and C initialization.
*
* Arguments : none
*********************************************************************************************************
*/
void main (void)
{
CPU_INT08U err;
/* Disable all interrupts until we are ready to accept them */
OSInit(); /* Initialize "uC/OS-II, The Real-Time Kernel" */
OSTaskCreate(AppTaskStart, /* Create the start task */
(void *)0,
(OS_STK *)&AppTaskStartStk[APP_START_TASK_STK_SIZE - 1],
APP_START_TASK3_PRIO,
);
OSStart(); /* Start multitasking (i.e. give control to uC/OS-II) */
}
/*$PAGE*/
/*
*********************************************************************************************************
* 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()'.
*
* Note(s) : 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)
{
(void)p_arg;
BSP_Init(); /* Initialize BSP functions */
#if (OS_TASK_STAT_EN > 0)
OSStatInit(); /* Determine CPU capacity */
#endif
AppDispInit(); /* Initialize the Display layout */
AppTaskCreate(); /* Create application tasks */
while (1) { /* Task body, always written as an infinite loop. */
AppDispUpdate();
OSTimeDlyHMSM(0, 0, 0, 100);
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -