This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
where did ioperm & iopl functions go ?
- To: egcs at egcs dot cygnus dot com, Riku dot Saikkonen at hut dot fi
- Subject: where did ioperm & iopl functions go ?
- From: Ahmed El-Mahmoudy <goofy at goofy dot dhis dot org>
- Date: Sun, 19 Sep 1999 13:16:28 +0000
- Reply-To: amcons at ritsec3 dot com dot eg
as-salam alikom,
I read in a IO port mini-programming HOWTO (written by Riku
Saikkonen <Riku.Saikkonen@hut.fi>) that the hearder file 'unistd.h'
contains a declaration of two functions ioperm & iopl which gives one
the access to IO ports, well, I'm recently installed gcc 2.95.1 (along
with the libraries & header files that came with it), and I found that
the ioperm & iopl are not in the unistd.h header file nor in the
"asm/io.h" I figured that those fns may have moved there... but it was
of no use, here's the example code that was in the IO port pragramming
mini-HOWTO that I tried to test but I failed due to the non-presence of
those ioperm & iopl functions:
/*
* example.c: very simple example of port I/O
*
* This code does nothing useful, just a port write, a pause,
* and a port read. Compile with `gcc -O2 -o example example.c',
* and run as root with `./example'.
*/
#include <stdio.h>
#include <unistd.h>
#include <asm/io.h>
#define BASEPORT 0x378 /* lp1 */
int main()
{
/* Get access to the ports */
if (ioperm(BASEPORT, 3, 1)) {perror("ioperm"); exit(1);}
/* Set the data signals (D0-7) of the port to all low (0) */
outb(0, BASEPORT);
/* Sleep for a while (100 ms) */
usleep(100000);
/* Read from the status port (BASE+1) and display the result */
printf("status: %d\n", inb(BASEPORT + 1));
/* We don't need the ports anymore */
if (ioperm(BASEPORT, 3, 0)) {perror("ioperm"); exit(1);}
exit(0);
}
/* end of example.c */
Thanks in advance...
+-----------------------------------------------------+
| Ahmed El-Mahmoudy |
| |
| Web : http://www.geocities.com/CapeCanaveral/9568/ |
| Snail mail : P.O. Box 10 Saray Elkobba, |
| Cairo ,Egypt. |
| Postal Code 11712 |
+-----------------------------------------------------+