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

📄 cpu_status.h

📁 日本著名的的嵌入式实时操作系统T-Kernel的源码及用户手册。
💻 H
字号:
/* *---------------------------------------------------------------------- *    T-Kernel * *    Copyright (C) 2004 by Ken Sakamura. All rights reserved. *    T-Kernel is distributed under the T-License. *---------------------------------------------------------------------- * *    Version:   1.01.00 *    Released by T-Engine Forum(http://www.t-engine.org) at 2004/6/28. * *---------------------------------------------------------------------- *//* *	cpu_status.h (VR4131) *	CPU-Dependent Definition */#ifndef _CPU_STATUS_#define _CPU_STATUS_#include <tk/syslib.h>#include <tk/sysdef.h>#include "cpu_insn.h"/* * Start/End critical section */#define	BEGIN_CRITICAL_SECTION	{ UINT _psr_ = disint();#define END_CRITICAL_SECTION	enaint(_psr_); }/* * Start/End interrupt disable section */#define	BEGIN_DISABLE_INTERRUPT	{ UINT _psr_ = disint();#define	END_DISABLE_INTERRUPT	enaint(_psr_); }/* * Interrupt enable/disable */#define	ENABLE_INTERRUPT	{ enaint(0); }#define	DISABLE_INTERRUPT	{ disint(); }/* * Enable interrupt nesting *	Enable the interrupt that has a higher priority than 'level.' */#define	ENABLE_INTERRUPT_UPTO(level)	{ enaint(0); }/* * Move to/Restore task independent part */#define	ENTER_TASK_INDEPENDENT	{ EnterTaskIndependent(); }#define	LEAVE_TASK_INDEPENDENT	{ LeaveTaskIndependent(); }/* ----------------------------------------------------------------------- *//* *	Check system state *//* * When a system call is called from task independent part, TRUE */#define	in_indp()	( isTaskIndependent() || ctxtsk == NULL )/* * When a system call is called during dispatch disable, TRUE * Also include the task independent part as during dispatch disable. */#define	in_ddsp()	( isDispatchDisabled()	\			|| in_indp()		\			|| isDI(~getPSR()) )/* * When a system call is called during CPU lock (interrupt disable), TRUE * Also include the task independent part as during CPU lock. */#define	in_loc()	( isDI(~getPSR())	\			|| in_indp() )/* * When a system call is called during executing the quasi task part, TRUE * Valid only when in_indp() == FALSE because it is not discriminated * from the task independent part. */#define	in_qtsk()	( ctxtsk->sysmode > ctxtsk->isysmode )/* ----------------------------------------------------------------------- *//* *	Task dispatcher startup routine *//* * Request for task dispatcher startup *	Use IP1 software interrupt as the delayed interrupt.  */Inline void dispatch_request( void ){	UW	occ;	Asm("mfc0 %0, $13": "=r"(occ));	occ |= OC_IP(1);	Asm("mtc0 %0, $13":: "r"(occ));}/* * Throw away the current task context. * and forcibly dispatch to the task that should be performed next. *	Use at system startup and 'tk_ext_tsk, tk_exd_tsk.' */Inline void force_dispatch( void ){IMPORT	void	dispatch_to_schedtsk();	Asm("jr %0":: "r"(&dispatch_to_schedtsk));}/* * Start task dispatcher *	Do not use 'dispatch()' because of using the delayed interrupt. */#define	dispatch()/* ----------------------------------------------------------------------- *//* *	Task exception *//* * Task exception handler startup reservation */IMPORT void request_tex( TCB *tcb );/* ----------------------------------------------------------------------- *//* * Task context block */typedef struct {	DW	ssp;		/* System stack pointer */	VP	uatb;		/* Task space page table */	INT	lsid;		/* Task space ID */} CTXB;/* * CPU information */IMPORT ATR	available_cop;	/* Enabled coprocessor (TA_COPn) *//* * User defined handler call */IMPORT INT CallUserHandler( INT p1, INT p2, INT p3, FP hdr, VP gp );#endif /* _CPU_STATUS_ */

⌨️ 快捷键说明

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