*BSD News Article 17954


Return to BSD News archive

Newsgroups: comp.os.386bsd.bugs
Path: sserve!newshost.anu.edu.au!munnari.oz.au!uunet!psgrain!ee.und.ac.za!csir.co.za!hippo.ru.ac.za!kudu!g89r4222
From: g89r4222@kudu.ru.ac.za (Geoff Rehmet)
Subject: Re: LPA driver broken with PK0.2.4 - fix
Message-ID: <g89r4222.741864699@kudu>
Sender: news@hippo.ru.ac.za (Usenet News Admin)
Organization: Rhodes University, Grahamstown, South Africa
References: <g89r4222.741863216@kudu>
Date: Mon, 5 Jul 1993 09:31:39 GMT
Lines: 80


Oopsy, some slightly incorrect facts in my first post, here goes
another try:

Hi,

I didn't really follow all of the discussion earlier about the
lpa driver, and whether or not it was broken by patchkit 0.2.4,
but here goes with my experiences.

To start with, the configuration I am working with is a 486DX33,
with the ISA bus pushed to 11MHz, 2 parallel ports (one on a
multi-io card) and 2 printers - HPLJ3p, Epson LX800.

After installing patchkit 0.2.4, only one of the printers printed
properly, and by switching ports around, and connecting the
printers to different ports things worked again.  Things also
always worked when the system's turbo was off.  I decided
therefor that the Epson seemed to be a bit sensitive to timing.

This morning I had a look at the lpa code, and found that the
following was happening:
 - first the driver puts the data onto the parallel port
 - it then waits for the printer to become ready
 - then it strobes the printer
 - adapt spin length

This does not actually wait for the printer to be finished with
one data byte before sending the next, as there is not wait for
the printer to become ready after the strobe.  (If you look at
timing diagrams for the parallel port you will see that there is
a problem.)

The modification I have made, which works for me so far, is to
output bytes as follows:
 - First wait for the printer to become ready
 - output the data
 - strobe (hoping like hell that at least 1 microsecond has
        elapsed since outputting the data)
 - adapt spin length


The diffs for this (to /sys/i386/isa/lpa.c are:

-------------------------------------------------------------------
*** /sys/i386/isa/lpa.c.orig	Mon Jul  5 09:55:01 1993
--- /sys/i386/isa/lpa.c	Mon Jul  5 11:01:04 1993
***************
*** 337,343 ****
  		ch = *(sc->sc_cp);
  		sc->sc_cp += 1;
  		sc->sc_count -= 1;
- 		outb(sc->sc_data, ch);
  
  		/* Busy wait for printer ready .. */
  		spin = tic = 0;
--- 337,342 ----
***************
*** 355,360 ****
--- 354,361 ----
  			}
  		}
  
+                 /* output data */
+ 		outb(sc->sc_data, ch);
  		/* strobe */
  		outb(sc->sc_ctrl, LPC_NINIT|LPC_SEL|LPC_STB);
  		outb(sc->sc_ctrl, LPC_NINIT|LPC_SEL);
---------------------------------------------------------------


Geoff.



--
============================csgr@alpha.ru.ac.za===============================
 Geoff Rehmet, Parallel Processing Group, |#define DISCLAIMER These are my
 Computer Science Department,             |         ramblings, not the
 Rhodes University, RSA.                  |         University's