How do I handle an interrupt? Just need simple example..

5

5thWheel

I have an ISA card that my company has produced.
Every so often it makes IRQ10 happen.
I need to write a byte to an IO address (0x230 I think) when this
happens, and also an application I am running needs to notice.

This sounds like it should be very easy to do.
But I can find no information on how to go about it on the web.
Can anyone explain it to me, or point me at a decent tutorial?

I have the XP ddk, so if a tutorial exists in there I can use that
(I've seen various general driver tutorials, but they seem very
complicated, e.g., "here is how to write a pnp pci printer driver", and
all I want is a small simple example of how to handle a specific irq).

I found this
http://www.codeproject.com/system/interrupthook.asp
which looked good, and was proposing to use the same method the author
of that article to get a handler to be called, and then set a named
event when the handler was called. My other code would then notice this
event and take some action. But the author says this is the wrong way
to go about it.

I do not need to share the interrupt with anything, and I can live with
a fair amount of latency (of the order of half a second!). Also it is
always IRQ10, so I don't need to PnP or anything (it is an embedded
thingy, so I can get away with quite a bit of hardcoded nastiness:).
The card is an ISA card if that makes a difference.

I've 10 years experience as a professional c++ windows embeddedish
programmer & have written CE.Net USB drivers & things, so I should be
able to cope with fairly teched answers:) I just don't know lots about
xp internals and have not done much drivery stuff before.

TIA,
5thWheel
 
G

Gary G. Little

By far the simplest approach would be to acquire Walter Oneys "Proramming
the Windows Driver Model, 2d Edition" and run his wizard to produce a driver
skeleton with ISR. Comment out the setting of AddDevice in that DriverEntry
function and basically you have a legacy driver ... granted it's decorated
with a lot of crap for PnP and Power, but you can remove that as you have
time. Or ... leave it as a WDM driver for PNPISA. The advantage to keeping
it WDM is that your system Power management will work ... legacy, NT4,
drivers tend to bolox up Power and systems will no longer hibernate or enter
standby: On/Off is about all they will do. Oh ... be sure to set this
skeleton up for asynchronous operations in the wizard.

Once you have a driver in the kernel to handle that Interrupt, you then
produce an application using the IOCTL calls you defined in the driver
wizard and hang an IO request for the data from that interrupt. When the
interrupt occurs the IRP is completed, your app signaled, and you hang
another.
 
5

5thWheel

K, thanks, I've just ordered it from amazon.
But it is a sad day indeed when I have to resort to paper-based documents:)
 
G

Gary G. Little

Not so ... you can use the toaster example in the latest DDK, which you
will need anyway, to do the same thing.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top