[comp.os.coherent] Catching COM port interrupts

marke@richs118.cpg.trs.reuter.com (Mark Ellis) (05/01/91)

Also, I don't really understand the different device drivers for the com
ports.  
According to the manual, each port has corresponding drivers for polled mode or
interrupt driven mode.  Well, where to the interrupts go when they occur?

Is there any way to catch com port interrupts for reading the com port
when data is present rather than polling the port?  I was hoping to find
a signal called "SIGCOM" (BSD like), which would do the trick, or
"select" (also BSD).  Perhaps there is some other way I am unfamiliar with?

Thanks for any suggestions!

Mark 

gsm@mailgsm.mendelson.com (Geoffrey S. Mendelson) (05/01/91)

marke@richs118.cpg.trs.reuter.com (Mark Ellis) asks:
>
>Also, I don't really understand the different device drivers for the com
>ports.  
>According to the manual, each port has corresponding drivers for polled mode or
>interrupt driven mode.  Well, where to the interrupts go when they occur?

It depends. in polled mode the interupts are turned off. They go no where
because they never happen. This is the way dos users com ports btw.

>Is there any way to catch com port interrupts for reading the com port
>when data is present rather than polling the port?  I was hoping to find
>a signal called "SIGCOM" (BSD like), which would do the trick, or
>"select" (also BSD).  Perhaps there is some other way I am unfamiliar with?
>

It's all described very nicely in the device driver manual. 

Unless you are going to write your own drivers, you never need to get the
interupts.  If you are going to write your own driver, consider (very seriously)
canibalizing the ones in the driver kit.

If you are just using the ports and the coherent drivers, here are the relevant 
facts:


com1 uses irq 4 
com2 uses irq 3 
com3 uses irq 4 
com4 uses irq 3

If you are using only two lines try to use 1/2, 3/4, 1/4, 2/3 and the interupt
drivers.

If you are using four lines use two interupt and two polled.
Put high speed devices on the interrupt driven lines, and low speed ones
on the polled lines.

If you have low volume dial out only lines, use them polled if don't
have interupts for them.

Some internal modems and serial cards will use irq 2 or 5. If you have
one and those interupts are free, you can patch the drivers to use them.


Buy the driver manual and read it. It will probably be the best computer 
education you can get for $40.
------
Copyright (C) 1991, Geoffrey S. Mendelson.              All Rights Reserved.
Except for usenet followups, may not be reproduced without permsission. 
----------------------------------------------------------------------------
|                   |  Computer Software Consulting    |                   |
----------------------------------------------------------------------------
Geoffrey S. Mendelson           I've written and debugged almost eight thousand 
geoffrey@mendelson.com          LINES of C code under Coherent in the last two
mwcbbs!mailgsm!geoffrey         months.  :-)                     
(215) 242-8712                  And my wife still speaks to me!

joachim@jrix.radig.de (Joachim Riedel) (05/03/91)

marke@richs118.cpg.trs.reuter.com (Mark Ellis) writes:

>Also, I don't really understand the different device drivers for the com
>ports.  
>According to the manual, each port has corresponding drivers for polled mode or
>interrupt driven mode.  Well, where to the interrupts go when they occur?

It's difficult to describe if you are a foreign non english speaking guy but
I will try it:

Interrupt mode:

The UART (8250 / 16450) is initialized for interrupt mode. That means:
if a character is received, a hardware signal is is given to to the
interrupt controller chip (IRQ 3 (COM2) or IRQ 4 (COM1)) and this chip
tells the CPU that it is now time to start an Interrupt service routine
This routine will be called and gets the character from the UART. ALso
the other way round is possible, that means after sending a character an
interrupt is issued if the UART is ready for the next one to send. 

Polled mode:

The UART has several register with several status bits. One bit says if
the UART has a character received. In polled mode you continually control
this bit "character arrived ?" and then you will get the character from
the receive register. For 9600 Baud you have to poll the UART 960 times
a second. If only 10 characters at 9600 Baud arrive you polled 950 times
just for fun. So polled mode is a waste of cpu time.
Interrupt mode is the better solution. 

> Is there any way to catch com port interrupts for reading the com port
> when data is present rather than polling the port?  I was hoping to find

No Ideas, don't think that there are now such signals you asked for. Maybe
when you modify the source for the driver. 

Joachim

+---------------------------------------+-------+-------------------+-------+
|    Joachim Riedel                     | @   @ |    Don't worry,   | @   @ |
|    Geschwister-Scholl-Strasse 48      |  \_/  |    keep smiling   |  \_/  |
|    D-6050 Offenbach am Main           +-------+-------------------+-------+
|    Tel. +49 69 85 62 25               |       joachim@jrix.radig.de       |  
+---------------------------------------+-----------------------------------+