(no subject)

Bradley D. LaRonde (brad@ltc.com)
Tue, 10 Aug 1999 11:04:12 -0400


> I wonder how to threat a pulse wave on the serial (com-) port. I wish to
interrupt my processes every time a pulse is received. The maximum frequence
of this pulse train is approximately 179 Hz. I'm aware of a function
called request_irq(), and I
> wonder if I can use this function with the com port to preempt processes
and furthermore I wonder how to use this function. Do I use the irq assigned
to the com port? I'm quite new in this matter and would be very gratefull
if someone can help me .

I will take a stab at this. I'm more familiar with MIPS, but i386 looks
similar.

If you just have something short to do every pules, then try feeding your
pulse wave to the serial port in such a way that it causes 1 interrupt per
pulse. Maybe you can use the CTS or DCD lines. Then setup the serial port
so that a change in the input line causes an interrupt. Then write a kernel
module that calls request_irq() to register a handler for the serial irq
that schedules your interupt bottom half processing and reset the interrupt
pending. In addition, you have to disable the normal serial port driver.

I'm not sure you meant this, but just in case: if you wanted to task-switch
based on the serial pulse wave, that's a different story. You could replace
the system timer in the kernel with your own "timer" based on a serial port
interrupt instead of the timer interrupt.

Look at time_init() and timer_interrupt() in arch/i386/kernel/time.c.

The system timer does an irq0 at a regular interval (HZ). You could disable
that timer, register the serial interrupt instead of the system timer
interrupt in time_init(), and adapt timer_interrupt() to the serial irq
specifics.

You will need to set the HZ define to the same as your pulse wave freq. You
also have to feed your pulse wave to the serial port in such a way that it
causes 1 interrupt per pulse. Maybe use the CTS or DCD lines. You would
also have to disable the normal serial port driver.

Hope that helps.

Regards,
Brad

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/