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...

Max Schmeling
  • 12,363
  • 14
  • 66
  • 109
  • You want to handle hardware interrupts in C#? – Remus Rusanu Jan 30 '10 at 19:07
  • The provided AIOWDM component has a WaitForIRQ method that I'm P/Invoking – Max Schmeling Jan 30 '10 at 19:09
  • 1
    Do you have the drivers installed for this hardware? The reason I ask, is that, since there is no interrupts firing, it is possible that the driver is not communicating with the hardware. What do you think? – t0mm13b Jan 30 '10 at 19:10
  • I don't know if there is any driver to actually *install*... I've got their DLLs I'm using but I don't think I've actually installed a driver. – Max Schmeling Jan 30 '10 at 19:13
  • @Max: I think you should have the driver installed. Dig around on that link you provided where the specs are for that hardware... – t0mm13b Jan 30 '10 at 19:18
  • I'm pretty sure there isn't a driver.... their documentation doesn't say anything about it – Max Schmeling Jan 30 '10 at 19:25
  • @Max: see http://accesio.com/go.cgi?p=../software/driveros.html – t0mm13b Jan 30 '10 at 19:29
  • Yeah, I've looked at that, but there still aren't any drivers to install other than the AIOWDM.dll that I'm using... at least that I can find... I'm so frustrated – Max Schmeling Jan 30 '10 at 19:34
  • "All ACCES cards can be accessed directly under Windows using ACCES32, AIOWDM, and/or AIOUSB, which provide the power and flexibility of register-level control in a Win32 environment." - from that page – Max Schmeling Jan 30 '10 at 19:35

1 Answers1

0

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.

t0mm13b
  • 34,087
  • 8
  • 78
  • 110
  • 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 Jan 30 '10 at 19:21
  • @Max: Good luck with it...did you install the driver? – t0mm13b Jan 30 '10 at 19:26
  • 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 Jan 30 '10 at 19:33
  • 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 Jan 30 '10 at 20:40