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

📄 task1.c

📁 进程之间通讯的一个例子
💻 C
字号:
/*
  Copyright(c) Micro-Star International Co. Ltd.
  The copyright to the computer program(s) herein is the property of
  Micro-Star International Co. Ltd.
  The program(s) may be used and/or copied only with the written
  permission of MSI or in accordance with the terms and conditions
  stipulated in the agreement/contract under which the program(s) have
  been supplied.
*/
/*
 * MODULE FILE NAME: TASK1.C
 *
 * DESCRIPTION:
 *
 *
 * NOTES:
 *
 *
 * HISTORY:
 *
 * $Log$
 
/* INCLUDE FILES */

/* system-wise, independent */
#include "syslib.h"
#include "sys_hdr/sys_type.h"
#include "sys_hdr/uitron.h"
#include "sys_bld.h"

/* kernel service */

/* project dependent */

/* third party */

/* other components */

/* this component */
#include "core/task1/hdr/task1.h" 


/*
 * FUNCTION NAME: TASK1_TskMain
 * PURPOSE:
 *      this is task1 information.
 *
 * INPUT:
 *      None
 * OUTPUT:
 *       None
 * RETURN:
 *       None
 * NOTES:
 *      
 */ 

void TASK1_TskMain(void)
{
	while(TRUE)
	{
		wai_sem(SYS_BLD_TASK1_SEM_ID);
      	printf("\n I'm task A! \n");
		sig_sem(SYS_BLD_TASK2_SEM_ID);
 	}
}


/*
 * FUNCTION NAME: TASK1_CreateTask
 * PURPOSE:
 *      Create the task of TASK1 Alerter.
 *
 * INPUT:
 *      None
 * OUTPUT:
 *       None
 * RETURN:
 *      BOOL -- return TRUE/FALSE 
 * NOTES:
 *      
 */ 
BOOL TASK1_CreateTask(void)
{
	/* LOCAL VARIABLES DECLARATIONS */
	T_CTSK t_ctsk;          /* task */ 
	ER ercd1;
    
    /* FUNCTION BODY */

    memset(&t_ctsk, 0 , sizeof(t_ctsk));	

    t_ctsk.task    = (FP)&TASK1_TskMain;
    t_ctsk.itskpri = SYS_BLD_TASK1_TASK_PRIORITY;
    t_ctsk.stksz   = SYS_BLD_GENERIC_STACK_SIZE;
    t_ctsk.tskatr  = TA_HLNG;
    t_ctsk.exinf   = SYS_BLD_TASK1_TASK_NAME; /* assign task name */
   
    ercd1 = cre_tsk( SYS_BLD_TASK1_TASK_ID, &t_ctsk); 
    
    if(ercd1 != E_OK )
    {
    	printf(" Create Task1 Error ! ercd1 = %d\n",ercd1);
        return FALSE;
    }

	ercd1 = sta_tsk (SYS_BLD_TASK1_TASK_ID,0);
  	
	if(ercd1!= E_OK)
	{
		printf(" Start Task1 Error ! ercd = %d\n",ercd1);
		return FALSE;
	} 
	return TRUE;
}




⌨️ 快捷键说明

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