home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Phoenix Heaven Sunny 2
/
APPARE2.BIN
/
oh_towns
/
his
/
source
/
hisl11.c
< prev
next >
Wrap
C/C++ Source or Header
|
1995-06-20
|
2KB
|
78 lines
/***********************************************************************
* *
* ハードウェア割り込み支援ライブラリ *
* *
* 1995.6.12 by ちょもらんま *
* *
***********************************************************************/
#include <hisinner.h>
/************************ 割り込みハンドラの解除 ***********************/
int HIS_detachHandler( int intnum )
{
intInfo *nowInfo,*preInfo;
/*--------------- 割り込み番号は正常か? --------------*/
if( HIS_checkIntNumber( intnum ) == HIS_IllegalIntNumber )
{
return HIS_IllegalIntNumber;
}
/*--------- 割り込みハンドラは登録されているか? ------*/
if( ( preInfo = topIntInfo[ intnum ] )== NULL )
{
return HIS_NoHandler;
}
/*----------------- 割り込みの一時禁止 ----------------*/
HIS_disableAllInt();
/*----------------- 登録前の状態に戻す ----------------*/
HIS_disableInterrupt( intnum );
nowInfo = preInfo->nextInfo;
if( nowInfo == NULL )
{
/*------------ 先客がいない場合 -----------*/
nowInfo = preInfo;
/* リアル側ハンドラ復帰 */
_setrvect( intnum + HardVector , nowInfo->RealHandler );
/* ネイティブ側ハンドラ復帰 */
_setpvect( intnum + HardVector , nowInfo->NativeHandler );
topIntInfo[ intnum ] = NULL;
}
else
{
/*------------ 先客がいる場合 -----------*/
while( nowInfo->nextInfo != NULL )
{
preInfo = nowInfo;
nowInfo = nowInfo->nextInfo;
}
userHandler[ intnum ].handlerAdr
= (_Far void(*)())nowInfo->NativeHandler;
userHandler[ intnum ].dataSegment = nowInfo->dataSegment;
preInfo->nextInfo = NULL;
}
/* IMR復帰 */
if( nowInfo->IMR == HIS_intUnmasked )
{
HIS_enableInterrupt( intnum );
}
else
{
HIS_disableInterrupt( intnum );
}
/*-------------- ハンドラ等の退避先を開放 -------------*/
free( nowInfo );
/*------------------- 割り込みの許可 ------------------*/
HIS_enableAllInt();
return HIS_NoError;
}