Subject: Re: project with parallel port
To: Francois Briere <francois@dopha.org>
From: der Mouse <mouse@Rodents.Montreal.QC.CA>
List: port-i386
Date: 07/22/2003 23:45:51
> Im trying to setup my 'little' project running on netbsd but im
> having a little problem with i386_set_ioperm().

Well, it won't help with i386_set_ioperm, but one of the patches I have
in my patch tree is something that, among other things, provides a way
to open an lpt device so that instead of being designed for sending
data to printers, it's a fairly raw parallel-port interface.  This may
be suitable directly for your use, or you may need to tweak it.

It should be up for ftp from
ftp.netbsd.org:/pub/NetBSD/misc/mouse/patch-tree/ (the lpt patch in
particular is one of the patches in src/sys/dev/ic/lpt.c, with
fragments in lptvar.h and src/sys/arch/i386/i386/conf.c - see the "doc"
file in .../patch-tree/ for more).  There _should_ be a copy available
at ftp.rodents.montreal.qc.ca:/mouse/source-tree/patches/working/ as
well, but that ftp area is very new and I'm not entirely sure it works
right yet.

> void flashsolid(int hertz)
> {
>     int delay;
>     delay = 1000 / hertz * 500;
> 	outb(base, 255);
> 	sleep(delay);
> 	outb(base, 0);
> 	sleep(delay);
> }

Um, this doesn't look right.  sleep() sleeps for a time measured in
seconds.  This code appears to be designed for a nonstandard variant of
sleep() that measures its argument in microseconds.  (Incidentally, why
not write just "delay = 500000 / hertz;" instead?)

/~\ The ASCII				der Mouse
\ / Ribbon Campaign
 X  Against HTML	       mouse@rodents.montreal.qc.ca
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B