Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. =================================================================== RCS file: /ftp/cvs/cvsroot/src/sys/dev/ic/com.c,v rcsdiff: /ftp/cvs/cvsroot/src/sys/dev/ic/com.c,v: warning: Unknown phrases like `commitid ...;' are present. retrieving revision 1.155 retrieving revision 1.156 diff -u -p -r1.155 -r1.156 --- src/sys/dev/ic/com.c 1999/02/28 17:10:52 1.155 +++ src/sys/dev/ic/com.c 1999/03/29 10:01:39 1.156 @@ -1,4 +1,4 @@ -/* $NetBSD: com.c,v 1.155 1999/02/28 17:10:52 explorer Exp $ */ +/* $NetBSD: com.c,v 1.156 1999/03/29 10:01:39 ross Exp $ */ /*- * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc. @@ -223,6 +223,10 @@ void com_kgdb_putc __P((void *, int)); #define COM_ISALIVE(sc) ((sc)->enabled != 0 && \ ISSET((sc)->sc_dev.dv_flags, DVF_ACTIVE)) +#define BR BUS_SPACE_BARRIER_READ +#define BW BUS_SPACE_BARRIER_WRITE +#define COM_BARRIER(t, h, f) bus_space_barrier((t), (h), 0, COM_NPORTS, (f)) + int comspeed(speed, frequency) long speed, frequency; @@ -2170,25 +2174,32 @@ com_common_putc(iot, ioh, c) int c; { int s = splserial(); + int clearirq; u_char stat; int timo; /* wait for any pending transmission to finish */ - timo = 50000; + timo = 500; while (!ISSET(stat = bus_space_read_1(iot, ioh, com_lsr), LSR_TXRDY) && --timo) - ; + delay(100); + clearirq = ISSET(bus_space_read_1(iot, ioh, com_iir), IIR_NOPEND); + COM_BARRIER(iot, ioh, BR | BW); bus_space_write_1(iot, ioh, com_data, c); + COM_BARRIER(iot, ioh, BR | BW); /* wait for this transmission to complete */ - timo = 1500000; + timo = 15000; while (!ISSET(stat = bus_space_read_1(iot, ioh, com_lsr), LSR_TXRDY) && --timo) - ; + delay(100); - /* clear any interrupts generated by this transmission */ - stat = bus_space_read_1(iot, ioh, com_iir); - splx(s); + if(clearirq != 0) { + /* clear any interrupts generated by this transmission */ + (void)bus_space_read_1(iot, ioh, com_iir); + COM_BARRIER(iot, ioh, BR | BW); + splx(s); + } } /*