setspc.c

来自「日本很有名的一个嵌入式RTOS」· C语言 代码 · 共 66 行

C
66
字号
/* *---------------------------------------------------------------------- *    T-Kernel * *    Copyright (C) 2004-2006 by Ken Sakamura. All rights reserved. *    T-Kernel is distributed under the T-License. *---------------------------------------------------------------------- * *    Version:   1.02.01 *    Released by T-Engine Forum(http://www.t-engine.org) at 2006/1/10. * *---------------------------------------------------------------------- *//* *	@(#)setspc.c (libtk/MB87Q1100) * *	Address space control  */#include <basic.h>#include <tk/tkernel.h>#include <tk/sysdef.h>#include "getsvcenv.h"/* * Set task address space  */EXPORT ER SetTaskSpace( ID taskid ){	UW	taskmode;	ER	ercd;	if ( taskid == TSK_SELF ) {		/* Set current CPL in RPL */		taskmode = getsvcenv();		SCInfo.taskmode ^= (taskmode ^ (taskmode << 16)) & TMF_PPL(3);	} else {		T_EIT		r_eit;		T_CREGS		r_cregs;		T_TSKSPC	tskspc;		/* Get logical space/taskmode for taskid tasks */		ercd = tk_get_reg(taskid, NULL, &r_eit, &r_cregs);		if ( ercd < E_OK ) {			goto err_ret;		}		/* Change to logical space for nominated tasks */		tskspc.uatb = r_cregs.uatb;		tskspc.lsid = r_cregs.lsid;		ercd = tk_set_tsp(TSK_SELF, &tskspc);		if ( ercd < E_OK ) {			goto err_ret;		}		/* Change to PPL for nominted tasks */		taskmode = getsvcenv();		SCInfo.taskmode ^= (taskmode ^ r_eit.taskmode) & TMF_PPL(3);	}	return E_OK;err_ret:	return ercd;}

⌨️ 快捷键说明

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