?? ex1.c
字號:
/**************************************************************************
* *
* PROJECT : ARM port for UCOS-II *
* *
* MODULE : EX1.c *
* *
* AUTHOR : Michael Anburaj *
* URL : http://geocities.com/michaelanburaj/ *
* EMAIL: michaelanburaj@hotmail.com *
* *
* PROCESSOR : Any processor *
* *
* IDE : Any IDE *
* *
* DESCRIPTION : *
* This is a sample code to test UCOS-II. *
* *
**************************************************************************/
#include "includes.h"
#include "consol.h"
#include "test.h"
/* ********************************************************************* */
/* Global definitions */
/* ********************************************************************* */
/* File local definitions */
#define TASK_STK_SIZE 256 /* Size of each task's stacks (# of WORDs) */
#define NO_TASKS 10 /* Number of identical tasks */
OS_STK TaskStartStk[TASK_STK_SIZE];
/* ********************************************************************* */
/* Local functions */
char ShowMenu()
{
char ret;
CONSOL_Printf("\n\n\n---測試任務菜單---\n");
CONSOL_Printf("[1] 多任務\n");
CONSOL_Printf("[2] 郵箱的使用\n");
CONSOL_Printf("請選擇:");
ret = CONSOL_GetCh();
CONSOL_Printf("\n\n");
return ret;
}
void Run()
{
while(1)
{
switch(ShowMenu())
{
case '1':
RunTestMultitask();
break;
case '2':
RunTestMbox();
break;
default:
CONSOL_Printf("選擇無效。\n");
break;
}
}
}
void TaskStart (void *data)
{
data = data; /* Prevent compiler warning */
CONSOL_Printf("uC/OS-II, The Real-Time Kernel ARM Ported version\n");
OSStatInit(); /* Initialize uC/OS-II's statistics */
Run();
while(1)
{
OSTimeDly(1000); /* Wait one second */
}
}
/* ********************************************************************* */
/* Global functions */
void APP_vMain (void)
{
OSInit(); /* Initialize uC/OS-II */
OSTaskCreate(TaskStart, (void *)0, (void *)&TaskStartStk[TASK_STK_SIZE - 1], 0);
FRMWRK_vStartTicker(OS_TICKS_PER_SEC); /* os_cfg.h */
OSStart(); /* Start multitasking */
}
/* ********************************************************************* */
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -