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

📄 os_sign.c

📁 引入事件驱动观念的抢占式多任务微型实时内核——MicroStar的设计与实现;提出基于事件的优先级这一新概念。
💻 C
字号:
/**************** os_sign.c**************/
/*            MacroStar 1.0a            */
/*          Zhengyuquan,2003.7,Beijing  */
/*           All rights reserved        */
/****************************************/
#include "mStar.h"

/*
************************************************************
*
*
*
************************************************************
*/
void STDCALL _FAR os_WaitORSignal( volatile uint_16 *pSignal,uint_16 acceptMask,uint_16 urgentMask )
{
	uint_16 temp;
	LOCK_INT( );
	while( !( temp = (*pSignal)&acceptMask ) )
	{
        os_rdyState &= ~os_curPrioMask; 
		os_rdyhState&= ~os_curPrioMask;
		UNLOCK_INT( );
		os_Schedule( );
		LOCK_INT( );
	}
	if( !(temp & urgentMask) )
	{
		os_rdyState |= os_curPrioMask;/*robust code*/
		os_rdyhState &= ~os_curPrioMask;
	}
	UNLOCK_INT( );
}

/*
************************************************************
*
*
*
************************************************************
*/
void STDCALL _FAR os_Notify( uchar taskId,BOOL isUrgent )
{
	uint_16 taskMask;

	os_WARNING( !(os_tcbState&os_maskTable[taskId]),NOTIFY_NULL);

	LOCK_INT_EX( );
	taskMask = os_maskTable[ os_tcbs[taskId].priority ];
	if( isUrgent )
		os_rdyhState |= taskMask;
	else
		os_rdyState  |= taskMask;
	UNLOCK_INT_EX( );
	os_SetSwitchFlag( );
}

/*
************************************************************
*
*
*
************************************************************
*/
void STDCALL _FAR os_WaitANDSignal(volatile uint_16 *pSignal,uint_16 acceptMask )
{
	LOCK_INT( );
    while( (*pSignal & acceptMask) != acceptMask  )
	{   
		os_rdyState &= ~os_curPrioMask;
		os_rdyhState&= ~os_curPrioMask;
		UNLOCK_INT( );
		os_Schedule( );
		LOCK_INT( );
	}
	UNLOCK_INT( );
}

⌨️ 快捷键说明

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