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

📄 cpu_status.h

📁 uT Kernel os source code for AT91
💻 H
字号:
/* *---------------------------------------------------------------------- *    micro T-Kernel * *    Copyright (C) 2006-2007 by Ken Sakamura. All rights reserved. *    micro T-Kernel is distributed under the micro T-License. *---------------------------------------------------------------------- * *    Version:   1.00.00 *    Released by T-Engine Forum(http://www.t-engine.org) at 2007/03/26. * *---------------------------------------------------------------------- *//* *	cpu_status.h (AT91) *	AT91M55800A-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 _cpsr_ = disint();#define END_CRITICAL_SECTION	if ( !isDI(_cpsr_)			\				  && knl_ctxtsk != knl_schedtsk			\				  && !knl_isTaskIndependent()		\				  && !knl_dispatch_disabled ) {		\					knl_dispatch();			\				}					\				enaint(_cpsr_); }/* * Start/End interrupt disable section */#define BEGIN_DISABLE_INTERRUPT	{ UINT _cpsr_ = disint();#define END_DISABLE_INTERRUPT	enaint(_cpsr_); }/* * 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	{ knl_EnterTaskIndependent(); }#define LEAVE_TASK_INDEPENDENT	{ knl_LeaveTaskIndependent(); }/* ----------------------------------------------------------------------- *//* *	Check system state *//* * When a system call is called from the task independent part, TRUE */#define in_indp()	( knl_isTaskIndependent() || knl_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()	( knl_dispatch_disabled	\			|| in_indp()		\			|| isDI(knl_getCPSR()) )/* * 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(knl_getCPSR())		\			|| 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()	( knl_ctxtsk->sysmode > knl_ctxtsk->isysmode )/* ----------------------------------------------------------------------- *//* *	Task dispatcher startup routine *//* * Request for task dispatcher startup *	Do nothing at this point because there is no delayed *	interrupt function in ARM. *	Perform dispatcher startup with END_CRITICAL_SECTION. */#define knl_dispatch_request()	/* *//* * 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 knl_force_dispatch( void ){IMPORT	void	knl_dispatch_to_schedtsk();	Asm("bx %0":: "r"(&knl_dispatch_to_schedtsk));}/* * Start task dispatcher */Inline void knl_dispatch( void ){#if USE_TRAP	Asm("swi %0":: "i"(SWI_DISPATCH): "lr");#elseIMPORT void knl_dispatch_entry( void );		/* Dispatcher call */	knl_dispatch_entry();#endif}/* ----------------------------------------------------------------------- *//* * Task context block */typedef struct {	VP	ssp;		/* System stack pointer */} CTXB;#endif /* _CPU_STATUS_ */

⌨️ 快捷键说明

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