test.c
来自「windows vc ucos」· C语言 代码 · 共 84 行
C
84 行
/*
*********************************************************************************************************
* uC/OS-II
* The Real-Time Kernel
*
* (c) Copyright 2004, Werner.Zimmermann@fht-esslingen.de
* (Similar to Example 1 of the 80x86 Real Mode port by Jean J. Labrosse)
* All Rights Reserved
*
* Application Template
*********************************************************************************************************
*/
#include "includes.h"
/*
*********************************************************************************************************
* CONSTANTS
*********************************************************************************************************
*/
#define TASK_STK_SIZE 512 /* Size of start task's stacks */
#define TASK_START_PRIO 0 /* Priority of your startup task */
/*
*********************************************************************************************************
* VARIABLES
*********************************************************************************************************
*/
OS_STK TaskStartStk[TASK_STK_SIZE]; /* Start task's stack */
/*
*********************************************************************************************************
* FUNCTION PROTOTYPES
*********************************************************************************************************
*/
void TaskStart(void *data); /* Function prototypes of Startup task */
/*
*********************************************************************************************************
* MAIN
*********************************************************************************************************
*/
void main (void)
{
OSInit(); /* Initialize uC/OS-II */
/* ToDo: Create semaphores, mailboxes etc. here */
OSTaskCreate(TaskStart, (void *)0, &TaskStartStk[TASK_STK_SIZE - 1], TASK_START_PRIO); /* Create the startup task*/
OSStart(); /* Start multitasking */
}
/*
*********************************************************************************************************
* STARTUP TASK
*********************************************************************************************************
*/
void TaskStart (void *pdata)
{
pdata = pdata; /* Prevent compiler warning */
#if OS_TASK_STAT_EN > 0
OSStatInit(); /* Initialize uC/OS-II's statistics */
#endif
/* Create all other application tasks here */
printf("uCOS-II WIN32 Port (C) by Werner.Zimmermann@fht-esslingen - Startup task\n");
while (1) /* Startup task's infinite loop */
{
/* ToDo: Place additional code for your startup task, which you want to run once or periodically here */
printf("Now running for %u ticks - press CTRL-BREAK to stop\n", OSTime);
/* ToDo: Don't forget to call the uCOS scheduler with OSTimeDly etc., to give other tasks a chance to run */
OSTimeDly(100); /* Wait 100 ticks */
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?