|
Posted by Andrew Ho on February 19, 2005, 9:00 pm
Please log in for more thread options
Hello,
On Linux or BSD systems, you can do direct port I/O from C/C++ using
the inb() and outb() functions. In addition, on Linux and glibc based
systems you may have to use ioperm() to get access to a port, and the
BSDs have equivalents (I've been using /dev/io on FreeBSD and sysarch()
and iopl on OpenBSD).
Typically, you want to do this to do some sort of ad hoc hardware
interfacing: for example, using your joystick port or parallel port for
random hackery.
I've written some XS glue--it's pretty simple--to provide Perl access
to these functions; it's four simple exported functions:
port_open($portnum);
write_byte($portnum, $value);
$value = read_byte($portnum);
port_close($portnum);
I have a few questions. First, is there already a module that does this
for me? I note at least one port-specific module, Device::ParallelPort,
but no general interface to inb() and outb() and equivalents (it could
almost be, though, the API is pretty much the same, so perhaps it just
bears renaming!).
If there is not such a module, I'd like to contribute one. I'm thinking
the Sys:: namespace is the right place for it, so I'd suggest something
like Sys::PortIO. I'm quite open to alternate suggestions.
I'm already registered with PAUSE, so if I don't hear back from anybody
in a week or so, I'll probably just go ahead with packaging up and
submitting the code I've got working. Thanks!
Humbly,
Andrew
-----------------------------------------------------------------------
'Twas brillig, and the slithy toves Andrew Ho
Did gyre and gimble in the wabe. andrew@zeuscat.com
All mimsy were the borogoves,
And the mome raths outgrabe. http://www.zeuscat.com/andrew/ -----------------------------------------------------------------------
|
| Similar Threads | Posted | | Perl modul for controlling the par port | September 24, 2004, 2:30 pm |
| Perl interface to Google GDS SDK | May 9, 2005, 2:22 am |
| No queue support with the Sleepycat::Db Perl interface? | March 28, 2006, 7:03 pm |
| Announcing VCI: The Version Control Interface for Perl | August 31, 2007, 9:37 am |
| How can I call MFC functions from Perl | July 19, 2005, 9:46 pm |
| Module for Orchestrating Perl Functions? | May 9, 2008, 9:30 pm |
| Calling External DLL functions in Perl using Inline | July 11, 2005, 6:47 am |
| Net::SFTP port problem | July 26, 2004, 2:18 pm |
| Announcing WWW::Metaweb - Perl interface to the Metaweb API (Freebase) | September 14, 2007, 3:06 am |
| Modules for hash functions? (ie, common algorithms for computing hash keys, not manipulating perl hashes) | August 26, 2006, 7:08 pm |
|