[BACK]Return to com.c CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / sys / dev / ic

Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.

Diff for /src/sys/dev/ic/com.c between version 1.224 and 1.224.2.2

version 1.224, 2004/01/23 05:01:19 version 1.224.2.2, 2004/07/05 21:57:45
Line 1 
Line 1 
 /*      $NetBSD$        */  /*      $NetBSD$        */
   
 /*-  /*-
  * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.   * Copyright (c) 1998, 1999, 2004 The NetBSD Foundation, Inc.
  * All rights reserved.   * All rights reserved.
  *   *
  * This code is derived from software contributed to The NetBSD Foundation   * This code is derived from software contributed to The NetBSD Foundation
Line 1341  com_to_tiocm(struct com_softc *sc)
Line 1341  com_to_tiocm(struct com_softc *sc)
         if (ISSET(combits, MSR_RI | MSR_TERI))          if (ISSET(combits, MSR_RI | MSR_TERI))
                 SET(ttybits, TIOCM_RI);                  SET(ttybits, TIOCM_RI);
   
 #ifdef COM_PXA2X0          if (ISSET(sc->sc_ier, IER_ERXRDY | IER_ETXRDY | IER_ERLS | IER_EMSC))
         if (sc->sc_type == COM_TYPE_PXA2x0) {  
                 if ((sc->sc_ier & 0x0f) != 0)  
                         SET(ttybits, TIOCM_LE);  
         } else  
 #endif  
         if ((sc->sc_ier & 0xbf) != 0)  
                 SET(ttybits, TIOCM_LE);                  SET(ttybits, TIOCM_LE);
   
         return (ttybits);          return (ttybits);
Line 1513  comparam(struct tty *tp, struct termios 
Line 1507  comparam(struct tty *tp, struct termios 
                 sc->sc_fifo = FIFO_DMA_MODE | FIFO_ENABLE | FIFO_TRIGGER_8;                  sc->sc_fifo = FIFO_DMA_MODE | FIFO_ENABLE | FIFO_TRIGGER_8;
         else if (ISSET(sc->sc_hwflags, COM_HW_FIFO))          else if (ISSET(sc->sc_hwflags, COM_HW_FIFO))
                 sc->sc_fifo = FIFO_ENABLE |                  sc->sc_fifo = FIFO_ENABLE |
                     (t->c_ospeed <= 1200 ? FIFO_TRIGGER_1 :                      (t->c_ospeed <= 1200 ? FIFO_TRIGGER_1 : FIFO_TRIGGER_8);
                      t->c_ospeed <= 38400 ? FIFO_TRIGGER_8 : FIFO_TRIGGER_4);  
         else          else
                 sc->sc_fifo = 0;                  sc->sc_fifo = 0;
   
Line 1752  comstart(struct tty *tp)
Line 1745  comstart(struct tty *tp)
                 bus_space_write_1(iot, ioh, com_ier, sc->sc_ier);                  bus_space_write_1(iot, ioh, com_ier, sc->sc_ier);
         }          }
   
   #if 0
         /* Output the first chunk of the contiguous buffer. */          /* Output the first chunk of the contiguous buffer. */
         if (!ISSET(sc->sc_hwflags, COM_HW_NO_TXPRELOAD)) {          if (!ISSET(sc->sc_hwflags, COM_HW_NO_TXPRELOAD)) {
                 u_int n;                  u_int n;
Line 1763  comstart(struct tty *tp)
Line 1757  comstart(struct tty *tp)
                 sc->sc_tbc -= n;                  sc->sc_tbc -= n;
                 sc->sc_tba += n;                  sc->sc_tba += n;
         }          }
   #endif
         COM_UNLOCK(sc);          COM_UNLOCK(sc);
 out:  out:
         splx(s);          splx(s);
Line 2092  again: do {
Line 2087  again: do {
                                 put[1] = lsr;                                  put[1] = lsr;
                                 cn_check_magic(sc->sc_tty->t_dev,                                  cn_check_magic(sc->sc_tty->t_dev,
                                                put[0], com_cnm_state);                                                 put[0], com_cnm_state);
                                 if (cn_trapped) {                                  if (cn_trapped)
                                         lsr = bus_space_read_1(iot, ioh, com_lsr);                                          goto next;
                                         if (!ISSET(lsr, LSR_RCV_MASK))  
                                                 break;  
   
                                         continue;  
                                 }  
                                 put += 2;                                  put += 2;
                                 if (put >= end)                                  if (put >= end)
                                         put = sc->sc_rbuf;                                          put = sc->sc_rbuf;
                                 cc--;                                  cc--;
                           next:
                                 lsr = bus_space_read_1(iot, ioh, com_lsr);                                  lsr = bus_space_read_1(iot, ioh, com_lsr);
                                 if (!ISSET(lsr, LSR_RCV_MASK))                                  if (!ISSET(lsr, LSR_RCV_MASK))
                                         break;                                          break;
Line 2136  again: do {
Line 2126  again: do {
                          */                           */
                         if (!cc) {                          if (!cc) {
                                 SET(sc->sc_rx_flags, RX_IBUF_OVERFLOWED);                                  SET(sc->sc_rx_flags, RX_IBUF_OVERFLOWED);
                                 CLR(sc->sc_ier, IER_ERXRDY);  
 #ifdef COM_PXA2X0  #ifdef COM_PXA2X0
                                 if (sc->sc_type == COM_TYPE_PXA2x0)                                  if (sc->sc_type == COM_TYPE_PXA2x0)
                                         CLR(sc->sc_ier, IER_ERXTOUT);                                          CLR(sc->sc_ier, IER_ERXRDY|IER_ERXTOUT);
                                   else
 #endif  #endif
                                           CLR(sc->sc_ier, IER_ERXRDY);
                                 bus_space_write_1(iot, ioh, com_ier,                                  bus_space_write_1(iot, ioh, com_ier,
                                     sc->sc_ier);                                      sc->sc_ier);
                         }                          }
                 } else {                  } else {
                         if ((iir & IIR_IMASK) == IIR_RXRDY) {                          if ((iir & (IIR_RXRDY|IIR_TXRDY)) == IIR_RXRDY) {
 #ifdef COM_PXA2X0                                  (void) bus_space_read_1(iot, ioh, com_data);
                                 if (sc->sc_type == COM_TYPE_PXA2x0)  
                                         bus_space_write_1(iot, ioh, com_ier,  
                                             IER_EUART);  
                                 else  
 #endif  
                                         bus_space_write_1(iot, ioh, com_ier, 0);  
                                 delay(10);  
                                 bus_space_write_1(iot, ioh, com_ier,sc->sc_ier);  
                                 continue;                                  continue;
                         }                          }
                 }                  }
Line 2231  again: do {
Line 2214  again: do {
   
                         sc->sc_st_check = 1;                          sc->sc_st_check = 1;
                 }                  }
         } while (ISSET((iir = bus_space_read_1(iot, ioh, com_iir)), IIR_RXRDY)          } while (!ISSET((iir =
             || ((iir & IIR_IMASK) == 0));              bus_space_read_1(iot, ioh, com_iir)), IIR_NOPEND) &&
               /*
                * Since some device (e.g., ST16C1550) doesn't clear IIR_TXRDY
                * by IIR read, so we can't do this way: `process all interrupts,
                * then do TX if possble'.
                */
               (iir & IIR_IMASK) != IIR_TXRDY);
   
         /*          /*
          * Done handling any receive interrupts. See if data can be           * Read LSR again, since there may be an interrupt between
          * transmitted as well. Schedule tx done event if no data left           * the last LSR read and IIR read above.
            */
           lsr = bus_space_read_1(iot, ioh, com_lsr);
   
           /*
            * See if data can be transmitted as well.
            * Schedule tx done event if no data left
          * and tty was marked busy.           * and tty was marked busy.
          */           */
         if (ISSET(lsr, LSR_TXRDY)) {          if (ISSET(lsr, LSR_TXRDY)) {
Line 2373  com_common_putc(dev_t dev, bus_space_tag
Line 2368  com_common_putc(dev_t dev, bus_space_tag
         bus_space_write_1(iot, ioh, com_data, c);          bus_space_write_1(iot, ioh, com_data, c);
         COM_BARRIER(iot, ioh, BR | BW);          COM_BARRIER(iot, ioh, BR | BW);
   
         /* wait for this transmission to complete */  
         timo = 1500000;  
         while (!ISSET(bus_space_read_1(iot, ioh, com_lsr), LSR_TXRDY) && --timo)  
                 continue;  
   
         splx(s);          splx(s);
 }  }
   

Legend:
Removed from v.1.224  
changed lines
  Added in v.1.224.2.2

CVSweb <webmaster@jp.NetBSD.org>