cxgetptr.c

来自「上传一个带源代码的嵌入式实时多任务操作系统CMX」· C语言 代码 · 共 36 行

C
36
字号
/*********************************************************

Copyright (c) CMX Company. 1999. All rights reserved

*********************************************************/
/* version 5.30 */

#define CMXMODULE 1

#include <cxfuncs.h>	/* get cmx include header file */
#include <cxextern.h>	/* get cmx include header file */

#if (defined(CMXTRACKER) || defined(WINTRACKER))
#include <cmxtrack.h>	/* get cmx include header file */
#endif

/***************************************************************
	This function gets the address of a task's task control block.
	also tests to see if task was created and if so not removed.
	passes back requested task's address so the function that call
	this function will be able to work with the requested task's
	task control block.
*****************************************************************/

byte K_I_Get_Ptr(byte tskid,tcbpointer *tcbptr)
{
	if (tskid > MAX_TASKS || !tskid)	/* see if task exists */
		return(K_ERROR);	/* no, return error */
	*tcbptr = &cmx_tcb[tskid];	/* pass address of task TCB back */
	if (((tcbpointer)(*tcbptr))->nxttcb)	/* see if NOT NULL */
		return(K_OK);	/* return good status */
	else
		return(K_ERROR);	/* it was so return error */
}

⌨️ 快捷键说明

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