Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 09 Jul 2003 20:00:52 +0200
From:      FreeBSD-Lis <FreeBSD@Zaleo.nl>
To:        freebsd-hardware@freebsd.org
Cc:        Zeo@Zaleo.nl
Subject:   machine/pio.h: No such file or directory
Message-ID:  <5.1.1.6.2.20030709195346.00b257f8@pop3.zaleo.homeunix.net>

next in thread | raw e-mail | index | archive | help
Dear people,

after installing FreeBSD 5.0 I wand to start programming, to start with 
some simple examples I have my first problem.
I'm missing a include file that just isn't on my system.

/usr/include/machine/pio.h

Can you guys give me a hint how to install the PIO library ?

Error message :
# cc sh2lpt.c

sh2lpt.c:1: syntax error before '.' token
sh2lpt.c:5:25: machine/pio.h: No such file or directory
sh2lpt.c: In function `ioport':
sh2lpt.c:13: storage size of `ioperm' isn't known

Source (a basic example) :
# cat sh2lpt.c

#include <unistd.h>
#include <sys/types.h>
#include <sys/syscall.h>
#include <machine/sysarch.h>
#include <machine/pio.h>

/* ioport(port)         permit access to an I/O port.
  * port                 I/O address to enable
  */
void
ioport(int port) {
         u_long iomap[32];
         struct i386_set_ioperm_args ioperm;

         ioperm.iomap = iomap;
         syscall(SYS_sysarch, I386_GET_IOPERM, (char *) &ioperm);
         iomap[port >> 5] &= ~(1 << (port & 0x1f));
         syscall(SYS_sysarch, I386_SET_IOPERM, (char *) &ioperm);
}

int
main() {
         int i;
         ioport(0x378);                  /* Enable access to the port */
         for(i = 0; i < 256; i++) {
                 outb(0x378, i);         /* Set the output register   */
                 sleep(1);               /* Sleep a tick              */
         }
         return 0;
}

Kind regards,

--
Zeo Smeijsters
http://www.zaleo.homeunix.net/
http://www.zaleo.nl.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?5.1.1.6.2.20030709195346.00b257f8>