[PARPORT] [Fwd: Something I do not understand in the parport code]


Roger Schreiter (Roger.Schreiter@Spectro21.de)
Fri, 17 Sep 1999 11:46:25 +0200


-------- Original Message --------
Subject: Something I do not understand in the parport code
Date: Thu, 16 Sep 1999 19:12:28 +0200
From: Roger Schreiter <Roger.Schreiter@Spectro21.de>
To: Tim Waugh <tim@cyberelk.demon.co.uk>

Hi Tim,

I'm currently working on introducing the "microsteps" in the
parport-ieee1284-code.

You asked about, what to do, when a previous function is not finished.

I think, those, who want to use those funcs atomically, should
themselves pay attention.

We replace things like
        port->ieee1284.phase = IEEE1284_PH_TERMINATE;

by
        if (port->ieee1284.phase != IEEE1284_PH_TERMINATE) {
                port->ieee1284.phase = IEEE1284_PH_TERMINATE;
                port->ieee1284.microstep = IDLE;
        }

Besides the possibility to set the timeout value to zero, we should
perhaps provide a flag, where the "user" of the funcs can
tell, that he wishes those atomic calls and will by himself pay
attention to proper terminate or abort a func call.

==========================================

Now I would like to understand well the func
int parport_wait_peripheral

There is one thing, I don't understand at all:

        if (!port->physport->cad->timeout)
                /* A zero timeout is "special": busy wait for the
                   entire 35ms. */
                counter = 35000;

        for (counter /= 5; counter > 0; counter--) {
                status = parport_read_status (port);
                if ((status & mask) == result)
                        return 0;
                if (signal_pending (current))
                        return -EINTR;
                if (current->need_resched)
                        break;
                udelay(5);
        }

        if (!port->physport->cad->timeout)
                /* We may be in an interrupt handler, so we can't poll
                 * slowly anyway. */
                return 1;

... really? Does "(!port->physport->cad->timeout)" and a sleeping
device not mean, that we have maybe already waited for 35000 usec?
Does the first statement not set "counter" to 35000 and the loop than
maybe last 35msec?

Tanks for explaining me what I do not understand right!

Roger.

--
Spectro21 Pat und Roger Schreiter GbR
Hauptstrasse 6
D-74391 Erligheim
Tel.: (+ 49 7143) 872056
Fax: (+ 49 7143) 872057

Email: Roger.Schreiter@Spectro21.de WWW: http://www.Spectro21.de

-- 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 Fri 17 Sep 1999 - 05:44:06 EDT