xiaolehou
驱动牛犊
驱动牛犊
  • 注册日期2003-03-26
  • 最后登录2003-08-06
  • 粉丝0
  • 关注0
  • 积分0分
  • 威望0点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
阅读:874回复:0

isa板卡上的中断检测不到,怎么回事,请大家帮忙

楼主#
更多 发布于:2003-07-11 14:26
实在是不行了,试了n种办法,请大家帮忙了
98下的vtools做的,程序可以加载上去,但是
没有中断响应啊,我觉得我都没有错误了
应该顺利才是啊,帮我看看吧!我已经郁闷了好几天了
我搭的电路是7号中断,ISA板,难道ISA在响应的时候还需要什么指令吗?希望得到大家的指点


// CLOCK.h - include file for VxD CLOCK

#include <vtoolscp.h>

#define DEVICE_CLASS ClockDevice
#define CLOCK_DeviceID UNDEFINED_DEVICE_ID
#define CLOCK_Init_Order UNDEFINED_INIT_ORDER
#define CLOCK_Major 1
#define CLOCK_Minor 0

#define MY_IRQ 7

class MyHwInt : public VHardwareInt
{
public:
MyHwInt(VOID(*pCallback());
//MyHwInt() : VHardwareInt(MY_IRQ,0,0,0){}
virtual VOID OnHardwareInt(VMHANDLE);
~MyHwInt();

protected:
VOID(*m_callback)();
};

class ClockDevice : public VDevice
{
public:
virtual BOOL OnSysDynamicDeviceInit();
virtual BOOL OnSysDynamicDeviceExit();
// virtual DWORD OnW32DeviceIoControl(PIOCTLPARAMS pDIOCParams);
};


class BellEvent:public VGobalEvent
{
public:
BellEvent(VOID);
VOID handler(VMHANDLE hVM,CLIENT_STRUCT* pRegs,PVOID refData);
}








// CLOCK.cpp - main module for VxD CLOCK

#define DEVICE_MAIN
#include \"clock.h\"
Declare_Virtual_Device(CLOCK)
#undef DEVICE_MAIN

#include \"apcx.h\"
#include <vsd.h>


VOID TickHandler(VOID);
//MyHwInt* pMyIRQ=0;
MyHwInt* pMyIRQ;
//PVOID     CallBackApc = 0;
//THREADHANDLE TheThread = 0;
//int x=0;
int y=0;
unsigned char b;
unsigned char a;
extern MyHwInt* pMyHwInt;
extern VOID TickHandler(VOID);

VOID TickHandle(VOID)//中断回调历程
{
/* 这段不要也是无所谓的,是不是?????
        //读8259ISR的中断标志寄存位,如果是1,则响铃声;
b=00001011;
_outp(0x20,b);
a=_inp(0x20);
_asm{
mov al,a
and al,10000000
out 0x20,al
}

       y=_inp(0x20);
      if(y==1)
       {
       */
(new BellEvent())->call();
}

}

BellEvent::BellEvent(VOID):VGlobalEvent(0){}
VOID BellEvent::handler(VMHANDLE hVM,CLIENT_STRUCT *pRegs,PVOID refData)
{VSD_Bell();
}


MyHwInt::MyHwInt( VOID (*pCallback)())
: VHardwareInt(My_IRQ, 0, 0, 0)
{
// Store the client callback address
m_callback = pCallback;


MyHwInt::~MyHwInt()
{
// Cancel hooking of IRQ
forceDefaultOwner(My_IRQ, 0);
}


VOID MyHwInt::OnHardwareInt(VMHANDLE hVM)   //中断实时处理
{

if(m_callback)
m_callback();

sendPhysicalEOI();   //通知vpicd中断处理结束

}




BOOL ClockDevice::OnSysDynamicDeviceInit()
{
pMyIRQ = new MyHwInt(TickHandler);
if (!pMyIRQ || !pMyIRQ->hook()) return FALSE;

pMyIRQ->physicalUnmask();

VEvent::initEvents();


return TRUE;
}

BOOL ClockDevice::OnSysDynamicDeviceExit()
{

if (pMyIRQ) delete pMyIRQ;
return TRUE;
}
游客

返回顶部