Re: [PARPORT] Parallel Port FIFO mode


Tim Waugh (tim@cyberelk.demon.co.uk)
Mon, 21 Dec 1998 09:10:12 +0000 (GMT)


On Mon, 21 Dec 1998, Keiichi Sakai wrote:

> I have modified the driver to use the FIFO for 2.0.29 kernel and now
> I am using the parallel port FIFO mode lp driver in 2.0.35 kernel.
> The driver works fine for me.
> I have no time to port it to 2.1.13x kernel.

I've modified my code to take advantage of the FIFO being completely
empty, as yours does. (You can replace the asm()s with things like
outsb.)

Incidentally, has _anyone_ seen a chipset with a FIFO size other than 16?

Tim.
*/

/* Parallel Port FIFO mode (ECP chipsets) */
int parport_pc_compat_write_block_pio (struct parport *port,
                                       const void *buf, size_t length,
                                       void (*fn) (struct parport *,
                                                   void *, size_t),
                                       void *handle)
{
        /* ... */
        while (left) {
                unsigned char ecr = parport_read_econtrol (port);
                expire = jiffies + port->ieee1284.timeout;
        check:
                /* Anyone else waiting for the port? */
                if (port->waithead)
                        break;

                if (ecr & 0x02) {
                        /* FIFO is full. Wait for interrupt. */
                        /* ... */
                        goto check;
                }

                if (ecr & 0x01) {
                        /* FIFO is empty. Blast it full. */

                        /* FIXME: Should use port->fifo_size */
                        const int n = left < 16 ? left : 16;
                        outsb (fifo, bufp, n);
                        bufp += n;
                        left -= n;
                        continue;
                }

                /* Half-full (call me an optimist) */
                outb (fifo, *bufp);
                bufp++;
                left--;
        }

        /* Wait for FIFO to drain. */
        /* ... */
}

-- To unsubscribe, send mail to: linux-parport-request@torque.net --
-- with the single word "unsubscribe" in the body of the message. --



This archive was generated by hypermail 2.0b3 on Wed 30 Dec 1998 - 10:18:59 EST