Re: [PARPORT] Two or more interrupt-driven devices?


David Campbell (campbell@torque.net)
Fri, 12 Mar 1999 14:31:34 +0800


Date sent: Thu, 11 Mar 1999 21:55:35 -0600 (CST)
From: Lijun Zhu <lzhu@Bayou.UH.EDU>
To: linux-parport@torque.net
Subject: [PARPORT] Two or more interrupt-driven devices?

> Recently I succesfully designed a program that could use parport ( connect
> a pushbutton to Pin 10) as a method to generate an interrupt to wake up some
> process. But, now I need more pushbuttons to wake up different processes,
> while there is only one pin of parport I can connect. How to deal with
> other buttons?

Userland or kernel? (Must be kernel if you can access the interrupts)

If you are in kernel mode then there is the timer queue which you can
use for a source of software interrupts. Not a nice way to do it but
providing the actual "interrupt" handler is small, eg:

soft_irq_handler()
{
  a = r_dtr(x);
  if (a != NO_BUTTONS_DOWN) {
    requeue_handler();
  } else {
    do_something();
  }
}

Then there will be no noticable penalty (in and out of the handler in
10 instructions. The sort of resolution for an x86 machine will be
0.01 second (HZ == 100), axp boxes this would be 0.001 (HZ == 1000).
You would not need the loop to be processed any faster as the process
will only be marked for wake-up at the next timer interval (eg: 1/HZ)

Theoretically you could have access to 13 lines (8 data + 5 status
pins). Contact me off list if you want some more details.

David Campbell
=======================================================
campbell@torque.net
Check http://www.torque.net/parport for all Linux parallel port solutions.
(also check http://www.torque.net/parport/archive/current/)
Current project list:
a) Catch up on the ZIP Plus backlog (drive back from waranty)
b) Maintain Linux ZIP drivers (need to update docs)
c) sleep
d) real life

-- 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 12 Mar 1999 - 01:33:58 EST