Chinaunix首页 | 论坛 | 博客
  • 博客访问: 596564
  • 博文数量: 169
  • 博客积分: 2656
  • 博客等级: 少校
  • 技术积分: 1685
  • 用 户 组: 普通用户
  • 注册时间: 2009-07-30 13:03
文章分类

全部博文(169)

文章存档

2011年(1)

2010年(135)

2009年(33)

我的朋友

分类: 嵌入式

2010-05-22 18:05:21

#include"..\ucos-ii\includes.h"               /* uC/OS interface */

#include

#include"uhal.h"

#include"myuart.h"

#include"LCD320.h"

#include "tchScr.h"

 

///*********************************///

OS_STK SYS_Task_Stack[STACKSIZE]= {0, };

#define SYS_Task_Prio                      1

void SYS_Task(void *Id);

 

OS_STK Task1_Stack[STACKSIZE]={0, };

void Task1(void *Id);

#define Task1_Prio     12

 

OS_STK Task2_Stack[STACKSIZE]= {0, };

void Task2(void *Id);

#define  Task2_Prio       13

 

OS_STK Task3_Stack[STACKSIZE]= {0, };

void Task3(void *Id);

#define  Task3_Prio       14

 

int Main(int argc, char **argv)

{

 

       ARMTargetInit();        // do target (uHAL based ARM system) initialisation //

       OSInit(); 

       OSTaskCreate(SYS_Task,  (void *)0,  (OS_STK *)&SYS_Task_Stack[STACKSIZE-1],  SYS_Task_Prio);

       OSTaskCreate(Task3,  (void *)0,  (OS_STK *)&Task3_Stack[STACKSIZE-1],  Task3_Prio);

       OSTaskCreate(Task2,  (void *)0,  (OS_STK *)&Task2_Stack[STACKSIZE-1],  Task2_Prio  );

        OSTaskCreate(Task1,  (void *)0,  (OS_STK *)&Task1_Stack[STACKSIZE-1],  Task1_Prio  );

       OSStart();              // start the game //

       // never reached //

       return 0;

}//main

 

void Task1(void *Id)    

{

       for(;;){

                 int DspTxtMode=0;

              ARMTargetInit();

       LCD_Init();

       LCD_ChangeMode(DspTxtMode);

       LCD_Cls();

       LCD_printf("Hello world!\n");

       Uart_Printf("\nHello world!\n");

    while(1);

              OSTimeDly(1000);

       }

}

 

void Task2(void *Id)

{

       for (;;)

       {

              char c1[1];

       char err;

       ARMTargetInit();  

       while(1)

       {

         Uart_SendByte(0,0xa);

              Uart_SendByte(0,0xd);

               err=Uart_Getch(c1,0,0);

               Uart_SendByte(0,c1[0]);      

       }

       return 0;

              OSTimeDly(2000);

       }

}

 

void Task3(void *Id)

{

       for (;;)

       {

              ARMTargetInit();

                TchScr_Test();

              OSTimeDly(3000);

       }

}

void SYS_Task(void *Id)

{

       uHALr_InstallSystemTimer();

       Uart_Printf("\nstart system task.\n");

       for (;;)

       {

              OSTimeDly(10000);

       }

}

阅读(812) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~