⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tasks.c

📁 ucos porting source for 8052
💻 C
📖 第 1 页 / 共 2 页
字号:
/******************************************************************************************************\
*                                                                                                      *
*  File     : TASK.C                                                                                   *
*                                                                                                      *
*  Date     : October, 2001                                                                            *
*  Version  : 0.00                                                                                     *
*  Change   : N/A                                                                                      *
*  Reason   : Initial Release                                                                          *
*                                                                                                      *
*  Author   : Antonio Fuentes - (antonio_fuentes@msl-vlc.com                                           *
*                                                                                                      *
*  Comments:   This file contains the code that constitutes the system application. This application   *                                                                                   
*              is made up by independent tasks that run concurrently under control of the Real-Time    *
*              kernel.                                                                                 *
\******************************************************************************************************/
#pragma language=extended

/*<---[ Include files: ]----------------------------------------------------------------------------->*/

#include "main.h"
#include "includes.h"   

/*<---[ Globals variables declared in other modules: ]----------------------------------------------->*/

extern pOS_EVENT  Comm_Sem;                            /* Handler of the serial Port semaphore        */
extern  ULONG     Task_Ctr[8];                         /* Counter to keep track of tasks execution    */

/*<---[ Global variables used by all modules: ]------------------------------------------------------>*/

#define display ((INT8U *)0x01FFA7)              /* These two addresses are hardware-specific of the  */
#define led     ((INT8U *)0x01FFA4)              /*..test board where the port is being verified      */

 typedef struct {
                 INT8U  *ptr1;
                 INT8U   array[20];
                 INT16U  test;
                 INT16U *ptr2;
                }
                 parm;
                 

/******************************************************************************************************/
/*                                                                                                    */  
/*                                      FUNCTION PROTOTYPES                                           */
/*                                                                                                    */  
/******************************************************************************************************/
void Task_0(void *); 
void Task_1(void *);
void Task_2(void *);
void Task_3(void *);
void Task_4(void *);
void Task_5(void *);
void Task_6(void *);
void Task_7(void *);
 
void Clock(void *);
void Comm_Mgr(void *);  

/******************************************************************************************************\
*                                                                                                      *
*  Function   : Task_0                                                                                 *
*                                                                                                      *
*  Description: First running task in the system.                                                      *  
*                                                                                                      *
*  Input      : void                                                                                   * 
*  Output     : void                                                                                   *                                                                                
*  Return     : void                                                                                   *
*                                                                                                      *
\******************************************************************************************************/
void Task_0(void *prm)
{
/*<---[ Variables used in this function: ]----------------------------------------------------------->*/

/*<---[ End of variable declaration ]---------------------------------------------------------------->*/

 prm = prm; /* This is to avoid compiler warnings if not using "prm". However, you con pass a pointer */         
            /* ..to this task at creation time eg.:                                                   */
            /*     OSTaskCreate(void (*Task_0)(void *), void *prm, (pOS_STK)stackptr, prio);          */
            /* Upon execution, "Task_0()" will perform as if it had been called by the 'C' compiler,  */
            /* ..with the sentence: Task_0(void *prm);                                                */
             
 for ( ; ; )
    {
    *led = 0x01;
     Task_Ctr[0]++; 
     OSTimeDly(TIME_50mS);
    }

}
/******************************************************************************************************\
*                                                                                                      *
*  Function   : Task_1                                                                                 *
*                                                                                                      *
*  Description: Second running task in the system.                                                     *  
*                                                                                                      *
*  Input      : void                                                                                   * 
*  Output     : void                                                                                   *                                                                                
*  Return     : void                                                                                   *
*                                                                                                      *
\******************************************************************************************************/
void Task_1(void *prm)
{
/*<---[ Variables used in this function: ]----------------------------------------------------------->*/
  
/*<---[ End of variable declaration ]---------------------------------------------------------------->*/

 prm = prm; 
 for ( ; ; )
    {
    *led = 0x02;
     Task_Ctr[1]++; 
     OSTimeDly(TIME_50mS);
    }

}
/******************************************************************************************************\
*                                                                                                      *
*  Function   : Task_2                                                                                 *
*                                                                                                      *
*  Description: Third running task in the system.                                                      *  
*                                                                                                      *
*  Input      : void                                                                                   * 
*  Output     : void                                                                                   *                                                                                
*  Return     : void                                                                                   *
*                                                                                                      *
\******************************************************************************************************/
void Task_2(void *prm)
{
/*<---[ Variables used in this function: ]----------------------------------------------------------->*/
  
/*<---[ End of variable declaration ]---------------------------------------------------------------->*/
 
 prm = prm;  
 for ( ; ; )
    {
    *led = 0x04;
     Task_Ctr[2]++; 
     OSTimeDly(TIME_50mS);
    }

}
/******************************************************************************************************\
*                                                                                                      *
*  Function   : Task_3                                                                                 *
*                                                                                                      *
*  Description: Fourth running task in the system.                                                     *  
*                                                                                                      *
*  Input      : void                                                                                   * 
*  Output     : void                                                                                   *                                                                                
*  Return     : void                                                                                   *
*                                                                                                      *
\******************************************************************************************************/
void Task_3(void *prm)
{
/*<---[ Variables used in this function: ]----------------------------------------------------------->*/
  
/*<---[ End of variable declaration ]---------------------------------------------------------------->*/

 prm = prm; 
 for ( ; ; )
    {
    *led = 0x08;
     Task_Ctr[3]++; 
     OSTimeDly(TIME_50mS);
    }

}
/******************************************************************************************************\
*                                                                                                      *
*  Function   : Task_4                                                                                 *
*                                                                                                      *
*  Description: Fifth running task in the system.                                                      *  
*                                                                                                      *
*  Input      : void                                                                                   * 
*  Output     : void                                                                                   *                                                                                
*  Return     : void                                                                                   *
*                                                                                                      *
\******************************************************************************************************/
void Task_4(void *prm)
{
/*<---[ Variables used in this function: ]----------------------------------------------------------->*/

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -