diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2004-11-13 14:47:36 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2004-11-13 14:47:36 +0000 |
commit | 3b2cccc0083c068b99279edb607a7cef3b7df1c1 (patch) | |
tree | a2a363b9e536d9c26d00380470fc47977c393e69 | |
parent | c79e3c182e8e1e6f66e5b7b149b0ff93bda82a63 (diff) |
Let the chip settle for a bit more time between trying to output two
characters; this will prevent us from falling into timeout behaviour when
it is in fact not necessary.
-rw-r--r-- | sys/arch/mvme88k/dev/dart.c | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/sys/arch/mvme88k/dev/dart.c b/sys/arch/mvme88k/dev/dart.c index aa9e8950997..a28a56fd86d 100644 --- a/sys/arch/mvme88k/dev/dart.c +++ b/sys/arch/mvme88k/dev/dart.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dart.c,v 1.41 2004/08/24 18:44:49 miod Exp $ */ +/* $OpenBSD: dart.c,v 1.42 2004/11/13 14:47:35 miod Exp $ */ /* * Mach Operating System @@ -322,7 +322,7 @@ dartstart(tp) int s; union dart_pt_io *ptaddr; union dartreg *addr; - int port; + int port, tries; int c; dev = tp->t_dev; @@ -347,9 +347,9 @@ dartstart(tp) tp->t_state &= ~TS_ASLEEP; wakeup((caddr_t)&tp->t_outq); } + selwakeup(&tp->t_wsel); if (tp->t_outq.c_cc == 0) goto bail; - selwakeup(&tp->t_wsel); } dprintf(("dartstart: dev(%d, %d)\n", major(dev), minor(dev))); @@ -358,11 +358,19 @@ dartstart(tp) dprintf(("dartstart: ptaddr = 0x%08x from uart at 0x%08x\n", ptaddr, addr)); - if (tp->t_outq.c_cc != 0) { - tp->t_state |= TS_BUSY; + tp->t_state |= TS_BUSY; + while (tp->t_outq.c_cc != 0) { /* load transmitter until it is full */ - while (ptaddr->read.rd_sr & TXRDY) { + for (tries = 10000; tries != 0; tries --) + if (ptaddr->read.rd_sr & TXRDY) + break; + + if (tries == 0) { + timeout_add(&tp->t_rstrt_to, 1); + tp->t_state |= TS_TIMEOUT; + break; + } else { c = getc(&tp->t_outq); if (port != CONS_PORT) @@ -373,22 +381,14 @@ dartstart(tp) if (port != CONS_PORT) dprintf(("dartstart: enabling Tx int\n")); if (port == A_PORT) - dart_sv_reg.sv_imr = dart_sv_reg.sv_imr | ITXRDYA; + dart_sv_reg.sv_imr |= ITXRDYA; else - dart_sv_reg.sv_imr = dart_sv_reg.sv_imr | ITXRDYB; + dart_sv_reg.sv_imr |= ITXRDYB; addr->write.wr_imr = dart_sv_reg.sv_imr; - - if (tp->t_outq.c_cc == 0) - break; - } - - tp->t_state &= ~TS_BUSY; - - if (tp->t_outq.c_cc != 0) { - timeout_add(&tp->t_rstrt_to, 1); - tp->t_state |= TS_TIMEOUT; } } + tp->t_state &= ~TS_BUSY; + bail: splx(s); } |