. treat a stream of framing errors as a single break

. trigger ddb upon receiving a break if we are the console
This commit is contained in:
aymeric 2002-10-01 12:17:09 +00:00
parent 7ba11c51fd
commit f835a6ae04
1 changed files with 28 additions and 7 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: ser.c,v 1.65 2002/09/27 20:30:18 thorpej Exp $ */
/* $NetBSD: ser.c,v 1.66 2002/10/01 12:17:09 aymeric Exp $ */
/*
* Copyright (c) 1982, 1986, 1990 The Regents of the University of California.
@ -40,10 +40,11 @@
*/
#include "opt_amigacons.h"
#include "opt_ddb.h"
#include "opt_kgdb.h"
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ser.c,v 1.65 2002/09/27 20:30:18 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: ser.c,v 1.66 2002/10/01 12:17:09 aymeric Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -573,6 +574,7 @@ serintr(void)
void
sereint(int stat)
{
static int break_in_progress = 0;
struct tty *tp;
u_char ch;
int c;
@ -596,12 +598,29 @@ sereint(int stat)
/*
* Check for break and (if enabled) parity error.
*/
if ((stat & 0x1ff) == 0)
c |= TTY_FE;
else if ((tp->t_cflag & PARENB) &&
if ((stat & 0x1ff) == 0) {
if (break_in_progress)
return;
c = TTY_FE;
break_in_progress = 1;
#ifdef DDB
if (serconsole == 0) {
extern int db_active;
if (!db_active) {
console_debugger();
return;
}
}
#endif
} else {
break_in_progress = 0;
if ((tp->t_cflag & PARENB) &&
(((ch >> 7) + even_parity[ch & 0x7f]
+ !!(tp->t_cflag & PARODD)) & 1))
c |= TTY_PE;
}
if (stat & SERDATRF_OVRUN)
log(LOG_WARNING, "ser0: silo overflow\n");
@ -1103,12 +1122,14 @@ sercngetc(dev_t dev)
*/
while (((stat = custom.serdatr & 0xffff) & SERDATRF_RBF) == 0)
;
c = stat & 0xff;
/*
* clear interrupt
*/
custom.intreq = INTF_RBF;
splx(s);
return(c);
}