Subject: Handling BREAK on serail console in com dirver?
To: None <tech-kern@netbsd.org>
From: Valeriy E. Ushakov <uwe@ptc.spbu.ru>
List: tech-kern
Date: 10/07/2001 23:49:01
I have a bad cold that makes my mind rather hazy, so can someone
familiar with ns16x50 please correct me if I'm wrong.

In com_enable_debugport and com_shutdown we set Interrupt Enable
Register to IER_ERXRDY with a comment that for serial console we want
an interrupt on BREAK.  However my reading of the ns16550 docs is that
to get an interrupt on BREAK we need to set it to IER_ERLS.

8.4 LINE STATUS REGISTER

Bit 4: This bit is the Break Interrupt (BI) indicator.

Note: Bits 1 through 4 are the error conditions that produce a
Receiver Line Status interrupt whenever any of the corresponding
conditions are detected and the interrupt is enabled.

8.7 INTERRUPT ENABLE REGISTER

Bit 2: This bit enables the Receiver Line Status Interrupt when set to
logic 1.



I guess that this doesn't have that big an impact because later in
comopen IER_ERLS is enabled.

Ok, so is it my delirium, or the code should read:

Index: com.c
===================================================================
RCS file: /cvsroot/syssrc/sys/dev/ic/com.c,v
retrieving revision 1.189
diff --unified -r1.189 com.c
--- com.c	2001/09/17 02:47:13	1.189
+++ com.c	2001/10/07 19:27:41
@@ -399,7 +399,7 @@
 	/* Turn on line break interrupt, set carrier. */
 	s = splserial();
 	COM_LOCK(sc);
-	sc->sc_ier = IER_ERXRDY;
+	sc->sc_ier = IER_ERLS;
 	bus_space_write_1(sc->sc_iot, sc->sc_ioh, com_ier, sc->sc_ier);
 	SET(sc->sc_mcr, MCR_DTR | MCR_RTS);
 	bus_space_write_1(sc->sc_iot, sc->sc_ioh, com_mcr, sc->sc_mcr);
@@ -750,7 +750,7 @@
 
 	/* Turn off interrupts. */
 	if (ISSET(sc->sc_hwflags, COM_HW_CONSOLE))
-		sc->sc_ier = IER_ERXRDY; /* interrupt on break */
+		sc->sc_ier = IER_ERLS; /* interrupt on break */
 	else
 		sc->sc_ier = 0;
 	bus_space_write_1(sc->sc_iot, sc->sc_ioh, com_ier, sc->sc_ier);

SY, Uwe
-- 
uwe@ptc.spbu.ru                         |       Zu Grunde kommen
http://www.ptc.spbu.ru/~uwe/            |       Ist zu Grunde gehen