views:

192

answers:

1

I have the following card and cannot get interupts working. I may not be understanding how they're supposed to work correctly... I don't do this type of programming very often.

From the looks of it though, it should be able to generate an interrupt when something comes in on one of the IO ports, right? We've got it hooked up to a bunch of switches for machine operation.

http://accesio.com/go.cgi?p=../pci/pci_dio_24d.html

I'll post some of the code I'm working with as soon as I can. I'm trying to write something to the base address (which I have) + 0xE but that doesn't help... the AIOWDM WaitForIRQ method just returns with a 0 every time I call it... nothing happens.

Any help would be appreciated... I know this is kind of a generic question.

UPDATE: Even the sample application they provide doesn't detect any interrupts, and I know I have the jumpers installed correctly, so I'm guessing it doesn't just fire interrupts for everything... I'm guessing I have to wire each switch up to a certain IO pin too and that one pin is responsible for the interrupts...

A: 

In short, C# is not an appropriate language for this kind of task, as this is low-level unmanaged code. You could theoretically do it, but it would be more painful as you have to make frequent trips to the unmanaged world to deal with interrupts. I would advise to look at this from the likes of C/C++ native code which would perform better and handle this kind of low-level stuff.

Another reason why, since C# has their own garbage collection, the last thing you would want is for the interrupt handling mechanism to be disposed of in the garbage collection a la good bye to the precious data structure used for interrupt handling, this will add considerable overhead to the code in this regard.

Personally, I have never heard of C# dealing with this kind of thing, but some of the more astute readers will say, "hang on, what about the new fangled OS called Singularity, which is written in C#?", at the end of the day, using the .NET runtime to manage this hardware task is a no-no.

Edit: After I realized, from looking at the reference manual, on one of the C code samples it is using outp, then I latched on the idea that you need to do direct port input output, I thought this might help, it is a dll that will enable you to do exactly that, input output, you would need to find the appropriate p/invoke signature to do this. There is another DLL that can do the same thing here. Also, check this WinRing0 code.

Again, you need to dig around and find the appropriate method signature suitable for pinvoking...

Best of luck with this..feel free to post any more and I'll try help out... :)

Hope this helps, Best regards, Tom.

tommieb75
Not an option. I have to do this in C# and I'm sure it's definitely possible to do it in a clean way
Max Schmeling
@Max: Good luck with it...did you install the driver?
tommieb75
From the documentation, the AOIWDM.dll component I'm using is the driver... I'm able to query card info with this dll, but is there something I need to do with it to make it able to work with interrupts?
Max Schmeling
I would call the company support line. It could be a bad card, buggy driver, etc.... I would think they would have demo code for every feature, since it's so simple.
kenny