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

📄 task3.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: TASK3.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/task3/hdr/task3.h" 
#include "core/task1/hdr/task1.h" 

/*
 * FUNCTION NAME: TASK3_TskMain
 * PURPOSE:
 *      this is task3 information.
 *
 * INPUT:
 *      None
 * OUTPUT:
 *       None
 * RETURN:
 *       None
 * NOTES:
 *      
 */ 
void TASK3_TskMain(void)
{	
	while(TRUE)
	{
		wai_sem(SYS_BLD_TASK1_SEM_ID);
      
      	printf("\n I'm task C! \n");
      		
        tslp_tsk(500);

		sig_sem(SYS_BLD_TASK1_SEM_ID);
	}
}

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

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

    t_ctsk.task    = (FP)&TASK3_TskMain;
    t_ctsk.itskpri = SYS_BLD_TASK3_TASK_PRIORITY;
    t_ctsk.stksz   = SYS_BLD_GENERIC_STACK_SIZE;
    t_ctsk.tskatr  = TA_HLNG;
    t_ctsk.exinf   = SYS_BLD_TASK3_TASK_NAME; /* assign task name */
   
    ercd3 = cre_tsk( SYS_BLD_TASK3_TASK_ID, &t_ctsk); 
    
    if(ercd3 != E_OK )
    {
       	printf(" Create Task3 Error ! ercd3 = %d\n",ercd3);
       	return FALSE;
    }

	ercd3 = sta_tsk (SYS_BLD_TASK3_TASK_ID,0);

	if(ercd3!= E_OK)
	{
		printf(" Start Task3 Error ! ercd = %d\n",ercd3);
		return FALSE;
	} 
	return TRUE;
}



⌨️ 快捷键说明

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