Re: [PARPORT] A simple question

From: Alan Cox (alan@lxorguk.ukuu.org.uk)
Date: Mon Dec 03 2001 - 13:22:25 EST

  • Next message: nick nuyts: "[PARPORT] freecom power cd"

    > like to ask one question: is there any kernel-space function that is =
    > similar to usleep()? Or is there any trick I can use to make my driver =
    > wait for a certain amount of time before getting another sample of the =
    > data? It is something like a for-loop with a clock inside (after a =
    > certain amount of time go back to the beginning of the loop).

    For a very short busy waiting timeout

            udelay(microseconds)

    for longer timeouts (100Hz granularity)

            set_current_state(TASK_UNINTERRUPTIBLE);
            schedule_timeout(n); // in HZ (eg HZ/10 is 0.1 seconds)

    for longer timeouts where signals interrupt

            set_current_state(TASK_INTERRUPTIBLE);
            schedule_timeout(n);
            if(signal_pending(current))
            {
                    /* clean up */
                    return -EINTR;
            }

    Alan

    -- 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 2b29 : Mon Dec 03 2001 - 13:18:24 EST