LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   making use of digital i/o? (https://www.linuxquestions.org/questions/programming-9/making-use-of-digital-i-o-765334/)

yonnieboy 10-29-2009 10:17 AM

making use of digital i/o?
 
I have this old juki card (all-in-one motherboard for multi-slot isa backplane). This board has a plug with several digital i/o available. The bios has a couple of address settings for this starting at (if I remember right) around 220.

Does anybody know how to make use of or access this i/o?

jlinkels 10-29-2009 07:11 PM

You could either use ioctl which allows you to write to IO ports, but that is not elegant. Or use Comedi and find a driver which controls IO which is very similar to yours and adapt it to your IO. At least I assume there is no Comedi driver for it. Adapting such a driver is really easy.

jlinkels

yonnieboy 10-30-2009 01:08 AM

Thanks, didn't know this. Would you know of good resources for learning to make use of ioctl and comedi?

jlinkels 10-30-2009 05:30 AM

If I am not mistaken ioctl is described in the O'Reilly book abot writing Linux device drivers. http://lwn.net/Kernel/LDD3/

Information about Comedi on the web site http://www.comedi.org/

jlinkels

theNbomr 10-30-2009 08:39 AM

In Linux, you can access arbitrary x86 IO ports (where the term IO ports implies the IO address space using IN/OUT machine instructions) with the /dev/port pseudo device. You open() the device, select an address to access with lseek(), and then either read() or write() the selected address. When done, naturally, you close() the device. All of this requires root privileges.
I am not sure how ioctl() plays a role in your objective, as it typically is a method of communicating with a device driver, (as opposed to the actual device it is supporting). A comedi driver that supports the IO you have may provide an ioclt() interface, and if so, it should be documented with the driver. The kinds of things you might expect such a driver's ioctl() to perform might be stuff like assigning an input/output bitmask, defining bits or words as either inputs, outputs, or bi-directional; stuff that you can't control or read by simply writing/reading the device address space.
--- rod.

theNbomr 10-30-2009 08:39 AM

In Linux, you can access arbitrary x86 IO ports (where the term IO ports implies the IO address space using IN/OUT machine instructions) with the /dev/port pseudo device. You open() the device, select an address to access with lseek(), and then either read() or write() the selected address. When done, naturally, you close() the device. All of this requires root privileges.
I am not sure how ioctl() plays a role in your objective, as it typically is a method of communicating with a device driver, (as opposed to the actual device it is supporting). A comedi driver that supports the IO you have may provide an ioclt() interface, and if so, it should be documented with the driver. The kinds of things you might expect such a driver's ioctl() to perform might be stuff like assigning an input/output bitmask, defining bits or words as either inputs, outputs, or bi-directional; stuff that you can't control or read by simply writing/reading the device address space.
--- rod.

yonnieboy 10-30-2009 09:18 AM

Thanks, this looks like a very good resource, I might learn something. Thank you.


All times are GMT -5. The time now is 05:27 AM.