Subject: bpp trouble
To: None <port-sparc@netbsd.org>
From: der Mouse <mouse@Rodents.Montreal.QC.CA>
List: port-sparc
Date: 04/20/2003 03:30:21
I have some external parallel-port hardware that works on i386, using
the five normal input pins to get inputs into the machine.  (I'm not
doing anything the least bit tricky here; all the pins I'm using, I'm
using in their bog-standard peecee directions.)  I hacked on lpt.c so
that reads from lpt would write successive integers to the data
register then read the five input bits and do something useful with
them.

This works fine.  But now I want to do this on a sparc, using a bpp
instead of the i386's lpt.

So I made similar hacks to the bpp driver, and it partially works.  It
works fine for the input bits accessed via the TCR (ACK and BUSY), but
the bits found in the IR (ERR, PE, and SLCT) are always showing up as
zero.

Here's the core of the code:

    for (i=0;i<n;i++)
     { bus_space_write_1(lsi->sc_bustag,lsi->sc_regs,L64854_REG_DR,i);
       tcr = bus_space_read_1(lsi->sc_bustag,lsi->sc_regs,L64854_REG_TCR);
       ir = bus_space_read_1(lsi->sc_bustag,lsi->sc_regs,L64854_REG_IR);
       buf[i] = ((tcr & 0x06) << 5) | ((ir & 0x07) << 3);
     }

Now, the high two bits (the ones coming from the TCR) are working fine,
and reflect what they should for the byte written to the data lines
with the bus_space_write_1, so the basic paradigm of writing select
lines to the data register and reading the input bits seems sound.  But
it's not picking up the IR bits the way it should.  I even added
debugging code to see if I were perhaps using the wrong bits, but the
value read from the IR is 0x00 every time.

Now, I suppose it could be that this particular machine has a lightly
toasted parallel port.  But it also seems reasonably likely that I'm
misusing the 64854 somehow.  I tried to do a little searching, but the
closest thing to relevant I see is a 2001 note asking for docs on the
64854, and if there were any responses to it I managed to miss them.

Thoughts, anyone?  RTFMs will be gratefully accepted provided they're
accompanied by a pointer to T correct FM. :-)

/~\ 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