?? task2.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: TASK2.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/task2/hdr/task2.h"
/*
* FUNCTION NAME: TASK2_Init
* PURPOSE:
* Initialize for TASK2 operations.
*
* INPUT:
* None
* OUTPUT:
* None
* RETURN:
* BOOL
* NOTES:
*
*/
BOOL TASK2_Init(void)
{
/* LOCAL VARIABLES DECLARATIONS */
T_CSEM t_csem; /* semaphore2 */
ER ercd;
/* Init semaphore */
t_csem.sematr = TA_TFIFO;
t_csem.isemcnt = 0;
t_csem.exinf = SYS_BLD_TASK2_SEM_NAME; /* store task name */
t_csem.maxsem = 1;
/* create semaphore sema id SYS_BLD_SMTPC_SEM_ID */
ercd=cre_sem( SYS_BLD_TASK2_SEM_ID , &t_csem);
if (ercd!= E_OK)
{
printf("TASK2 wait semaphore error %d\n", ercd);
return FALSE;
}
return TRUE;
}
/*
* FUNCTION NAME: TASK2_TskMain
* PURPOSE:
* this is task2 information.
*
* INPUT:
* None
* OUTPUT:
* None
* RETURN:
* None
* NOTES:
*
*/
void TASK2_TskMain(void)
{
while(TRUE)
{
wai_sem(SYS_BLD_TASK2_SEM_ID);
printf("\n I'm task B! \n");
sig_sem(SYS_BLD_TASK3_SEM_ID);
}
}
/*
* FUNCTION NAME: TASK2_CreateTask
* PURPOSE:
* Create the task of TASK2 Alerter.
*
* INPUT:
* None
* OUTPUT:
* None
* RETURN:
* BOOL -- return TRUE/FALSE
* NOTES:
*
*/
BOOL TASK2_CreateTask(void)
{
/* LOCAL VARIABLES DECLARATIONS */
T_CTSK t_ctsk; /* task2 */
ER ercd2;
I32 taskid;
/* FUNCTION BODY */
memset(&t_ctsk, 0 , sizeof(t_ctsk));
t_ctsk.task = (FP)&TASK2_TskMain;
t_ctsk.itskpri = SYS_BLD_TASK2_TASK_PRIORITY;
t_ctsk.stksz = SYS_BLD_GENERIC_STACK_SIZE;
t_ctsk.tskatr = TA_HLNG;
t_ctsk.exinf = SYS_BLD_TASK2_TASK_NAME; /* assign task name */
ercd2 = cre_tsk( SYS_BLD_TASK2_TASK_ID, &t_ctsk);
if(ercd2 != E_OK )
{
printf(" Create Task1 Error ! ercd1 = %d\n",ercd2);
return FALSE;
}
ercd2 = sta_tsk (SYS_BLD_TASK2_TASK_ID,0);
if(ercd2!= E_OK)
{
printf(" Start Task1 Error ! ercd = %d\n",ercd2);
return FALSE;
}
return TRUE;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -