Date: Wed, 19 Feb 1997 22:43:26 +0100 From: j@uriah.heep.sax.de (J Wunsch) To: dario@escher.usr.dsi.unimi.it (Dario Maggiorini) Cc: freebsd-hackers@freebsd.org Subject: Re: parallel read Message-ID: <Mutt.19970219224326.j@uriah.heep.sax.de> In-Reply-To: <199702191142.DAA18699@freefall.freebsd.org>; from Dario Maggiorini on Feb 19, 1997 12:37:49 %2B0100 References: <199702191142.DAA18699@freefall.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
As Dario Maggiorini wrote: > has anyone of you already > > 1 - modified the parallel driver Dunno. > 2 - a pointer to some kind of documentation Add the desired input function as an ioctl into lptioctl. You're going to read 4 or 5 bits a time only, so you can conveniently pass them back to the caller within a single `int' value. I wouldn't bother setting up a lptread() function for this. > 3 - write asm code to access directly the memory location > ( i believe it's possible but can't write it by myself, i'm in a hurry > and has no time to learn asm details ) No need for hairy asm details. They are well-hidden from you, you're only operating with C or pseudo-C code at the driver level. All you need is a single inb() call. Have a look into /sys/i386/isa/lpt.c, and you should figure this out within an hour, provided you've got reasonable understanding of C coding. The ioctl command names for lpt(4) are defined in /sys/i386/include/lpt.h, so they are usable as #include <machine/lpt.h> from a userland program. Simply add there a: #define LPT_READSTAT _IOR('p', 2, int) /* get status bits */ Remember that your calling program must pass the _address_ of an int: #include <sys/ioctl.h> #include <machine/lpt.h> ... int status, fd; if ((fd = open(PATH_LP, O_RDONLY)) == -1) { err(...); } ... if (ioctl(fd, LPT_READSTAT, &status) == -1) { err(1, "Can't read status"); } -- cheers, J"org joerg_wunsch@uriah.heep.sax.de -- http://www.sax.de/~joerg/ -- NIC: JW11-RIPE Never trust an operating system you don't have sources for. ;-)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Mutt.19970219224326.j>