sio.c (16359) | sio.c (17256) |
---|---|
1/*- 2 * Copyright (c) 1991 The Regents of the University of California. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 17 unchanged lines hidden (view full) --- 26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 * 33 * from: @(#)com.c 7.5 (Berkeley) 5/16/91 | 1/*- 2 * Copyright (c) 1991 The Regents of the University of California. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 17 unchanged lines hidden (view full) --- 26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 * 33 * from: @(#)com.c 7.5 (Berkeley) 5/16/91 |
34 * $Id: sio.c,v 1.142 1996/05/02 09:34:40 phk Exp $ | 34 * $Id: sio.c,v 1.1.1.1 1996/06/14 10:04:45 asami Exp $ |
35 */ 36 37#include "opt_comconsole.h" 38#include "opt_ddb.h" 39#include "opt_sio.h" 40#include "sio.h" 41 42/* --- 90 unchanged lines hidden (view full) --- 133#include <sys/devconf.h> 134#ifdef DEVFS 135#include <sys/devfsext.h> 136#endif 137 138#include <machine/clock.h> 139 140#ifdef PC98 | 35 */ 36 37#include "opt_comconsole.h" 38#include "opt_ddb.h" 39#include "opt_sio.h" 40#include "sio.h" 41 42/* --- 90 unchanged lines hidden (view full) --- 133#include <sys/devconf.h> 134#ifdef DEVFS 135#include <sys/devfsext.h> 136#endif 137 138#include <machine/clock.h> 139 140#ifdef PC98 |
141#include <pc98/pc98/icu.h> /* XXX just to get at `imen' */ | |
142#include <pc98/pc98/pc98.h> | 141#include <pc98/pc98/pc98.h> |
142#include <pc98/pc98/icu.h> |
|
143#include <pc98/pc98/pc98_device.h> 144#include <pc98/pc98/sioreg.h> 145#include <pc98/pc98/ic/i8251.h> 146#include <pc98/pc98/ic/ns16550.h> 147#else | 143#include <pc98/pc98/pc98_device.h> 144#include <pc98/pc98/sioreg.h> 145#include <pc98/pc98/ic/i8251.h> 146#include <pc98/pc98/ic/ns16550.h> 147#else |
148#include <i386/isa/icu.h> /* XXX just to get at `imen' */ | |
149#include <i386/isa/isa.h> 150#include <i386/isa/isa_device.h> 151#include <i386/isa/sioreg.h> 152 153#ifdef COM_ESP 154#include <i386/isa/ic/esp.h> 155#endif 156#include <i386/isa/ic/ns16550.h> --- 168 unchanged lines hidden (view full) --- 325 struct termios it_in; /* should be in struct tty */ 326 struct termios it_out; 327 328 /* Lock state. */ 329 struct termios lt_in; /* should be in struct tty */ 330 struct termios lt_out; 331 332 bool_t do_timestamp; | 148#include <i386/isa/isa.h> 149#include <i386/isa/isa_device.h> 150#include <i386/isa/sioreg.h> 151 152#ifdef COM_ESP 153#include <i386/isa/ic/esp.h> 154#endif 155#include <i386/isa/ic/ns16550.h> --- 168 unchanged lines hidden (view full) --- 324 struct termios it_in; /* should be in struct tty */ 325 struct termios it_out; 326 327 /* Lock state. */ 328 struct termios lt_in; /* should be in struct tty */ 329 struct termios lt_out; 330 331 bool_t do_timestamp; |
332 bool_t do_dcd_timestamp; |
|
333 struct timeval timestamp; | 333 struct timeval timestamp; |
334 struct timeval dcd_timestamp; |
|
334 335 u_long bytes_in; /* statistics */ 336 u_long bytes_out; 337 u_int delta_error_counts[CE_NTYPES]; 338 u_long error_counts[CE_NTYPES]; 339 340 /* 341 * Ping-pong input buffers. The extra factor of 2 in the sizes is --- 19 unchanged lines hidden (view full) --- 361#endif 362}; 363 364/* 365 * XXX public functions in drivers should be declared in headers produced 366 * by `config', not here. 367 */ 368 | 335 336 u_long bytes_in; /* statistics */ 337 u_long bytes_out; 338 u_int delta_error_counts[CE_NTYPES]; 339 u_long error_counts[CE_NTYPES]; 340 341 /* 342 * Ping-pong input buffers. The extra factor of 2 in the sizes is --- 19 unchanged lines hidden (view full) --- 362#endif 363}; 364 365/* 366 * XXX public functions in drivers should be declared in headers produced 367 * by `config', not here. 368 */ 369 |
369/* Interrupt handling entry points. */ 370inthand2_t siointrts; | 370/* Interrupt handling entry point. */ |
371void siopoll __P((void)); 372 373/* Device switch entry points. */ 374#define sioreset noreset 375#define siommap nommap 376#define siostrategy nostrategy 377 378#ifdef PC98 --- 33 unchanged lines hidden (view full) --- 412#endif /* DSI_SOFT_MODEM */ 413 414static char driver_name[] = "sio"; 415 416/* table and macro for fast conversion from a unit number to its com struct */ 417static struct com_s *p_com_addr[NSIO]; 418#define com_addr(unit) (p_com_addr[unit]) 419 | 371void siopoll __P((void)); 372 373/* Device switch entry points. */ 374#define sioreset noreset 375#define siommap nommap 376#define siostrategy nostrategy 377 378#ifdef PC98 --- 33 unchanged lines hidden (view full) --- 412#endif /* DSI_SOFT_MODEM */ 413 414static char driver_name[] = "sio"; 415 416/* table and macro for fast conversion from a unit number to its com struct */ 417static struct com_s *p_com_addr[NSIO]; 418#define com_addr(unit) (p_com_addr[unit]) 419 |
420static struct timeval intr_timestamp; 421 | |
422#ifdef PC98 423struct pc98_driver siodriver = { 424#else 425struct isa_driver siodriver = { 426#endif 427 sioprobe, sioattach, driver_name 428}; 429 --- 523 unchanged lines hidden (view full) --- 953 * Interrupts from this line should already be masked in the ICU, 954 * but mask them in the processor as well in case there are some 955 * (misconfigured) shared interrupts. 956 */ 957 disable_intr(); 958/* EXTRA DELAY? */ 959 960 /* | 420#ifdef PC98 421struct pc98_driver siodriver = { 422#else 423struct isa_driver siodriver = { 424#endif 425 sioprobe, sioattach, driver_name 426}; 427 --- 523 unchanged lines hidden (view full) --- 951 * Interrupts from this line should already be masked in the ICU, 952 * but mask them in the processor as well in case there are some 953 * (misconfigured) shared interrupts. 954 */ 955 disable_intr(); 956/* EXTRA DELAY? */ 957 958 /* |
961 * XXX DELAY() reenables CPU interrupts. This is a problem for 962 * shared interrupts after the first device using one has been 963 * successfully probed - config_isadev() has enabled the interrupt 964 * in the ICU. 965 */ 966#ifdef PC98 967 outb(IO_ICU1 + 2, 0xff); 968#else 969 outb(IO_ICU1 + 1, 0xff); 970#endif 971 972 /* | |
973 * Initialize the speed and the word size and wait long enough to 974 * drain the maximum of 16 bytes of junk in device output queues. 975 * The speed is undefined after a master reset and must be set 976 * before relying on anything related to output. There may be 977 * junk after a (very fast) soft reboot and (apparently) after 978 * master reset. 979 * XXX what about the UART bug avoided by waiting in comparam()? 980 * We don't want to to wait long enough to drain at 2 bps. --- 56 unchanged lines hidden (view full) --- 1037 * avoiding false positive tests from bus echoes). 1038 * o an output interrupt is generated and its vector is correct. 1039 * o the interrupt goes away when the IIR in the UART is read. 1040 */ 1041/* EXTRA DELAY? */ 1042 failures[0] = inb(iobase + com_cfcr) - CFCR_8BITS; 1043 failures[1] = inb(iobase + com_ier) - IER_ETXRDY; 1044 failures[2] = inb(iobase + com_mcr) - mcr_image; | 959 * Initialize the speed and the word size and wait long enough to 960 * drain the maximum of 16 bytes of junk in device output queues. 961 * The speed is undefined after a master reset and must be set 962 * before relying on anything related to output. There may be 963 * junk after a (very fast) soft reboot and (apparently) after 964 * master reset. 965 * XXX what about the UART bug avoided by waiting in comparam()? 966 * We don't want to to wait long enough to drain at 2 bps. --- 56 unchanged lines hidden (view full) --- 1023 * avoiding false positive tests from bus echoes). 1024 * o an output interrupt is generated and its vector is correct. 1025 * o the interrupt goes away when the IIR in the UART is read. 1026 */ 1027/* EXTRA DELAY? */ 1028 failures[0] = inb(iobase + com_cfcr) - CFCR_8BITS; 1029 failures[1] = inb(iobase + com_ier) - IER_ETXRDY; 1030 failures[2] = inb(iobase + com_mcr) - mcr_image; |
1045 DELAY(1000); /* XXX */ | 1031 DELAY(10000); /* Some internal modems need this time */ |
1046 if (idev->id_irq != 0) 1047#ifdef PC98 1048 failures[3] = pc98_irq_pending(idev) ? 0 : 1; 1049#else 1050 failures[3] = isa_irq_pending(idev) ? 0 : 1; 1051#endif 1052 failures[4] = (inb(iobase + com_iir) & IIR_IMASK) - IIR_TXRDY; 1053 DELAY(1000); /* XXX */ --- 23 unchanged lines hidden (view full) --- 1077 if (idev->id_irq != 0) 1078 failures[8] = pc98_irq_pending(idev) ? 1 : 0; 1079#else 1080 if (idev->id_irq != 0) 1081 failures[8] = isa_irq_pending(idev) ? 1 : 0; 1082#endif 1083 failures[9] = (inb(iobase + com_iir) & IIR_IMASK) - IIR_NOPEND; 1084 | 1032 if (idev->id_irq != 0) 1033#ifdef PC98 1034 failures[3] = pc98_irq_pending(idev) ? 0 : 1; 1035#else 1036 failures[3] = isa_irq_pending(idev) ? 0 : 1; 1037#endif 1038 failures[4] = (inb(iobase + com_iir) & IIR_IMASK) - IIR_TXRDY; 1039 DELAY(1000); /* XXX */ --- 23 unchanged lines hidden (view full) --- 1063 if (idev->id_irq != 0) 1064 failures[8] = pc98_irq_pending(idev) ? 1 : 0; 1065#else 1066 if (idev->id_irq != 0) 1067 failures[8] = isa_irq_pending(idev) ? 1 : 0; 1068#endif 1069 failures[9] = (inb(iobase + com_iir) & IIR_IMASK) - IIR_NOPEND; 1070 |
1085#ifdef PC98 1086 outb(IO_ICU1 + 2, imen); /* XXX */ 1087#else 1088 outb(IO_ICU1 + 1, imen); /* XXX */ 1089#endif | |
1090 enable_intr(); 1091 1092 result = IO_COMSIZE; 1093 for (fn = 0; fn < sizeof failures; ++fn) 1094 if (failures[fn]) { 1095 outb(iobase + com_mcr, 0); 1096 result = 0; 1097 if (COM_VERBOSE(dev)) --- 765 unchanged lines hidden (view full) --- 1863 1864 com = (struct com_s *)chan; 1865 com->state &= ~CS_DTR_OFF; 1866 if (com->unit != comconsole) 1867 kdc_sio[com->unit].kdc_state = DC_IDLE; 1868 wakeup(&com->dtr_wait); 1869} 1870 | 1071 enable_intr(); 1072 1073 result = IO_COMSIZE; 1074 for (fn = 0; fn < sizeof failures; ++fn) 1075 if (failures[fn]) { 1076 outb(iobase + com_mcr, 0); 1077 result = 0; 1078 if (COM_VERBOSE(dev)) --- 765 unchanged lines hidden (view full) --- 1844 1845 com = (struct com_s *)chan; 1846 com->state &= ~CS_DTR_OFF; 1847 if (com->unit != comconsole) 1848 kdc_sio[com->unit].kdc_state = DC_IDLE; 1849 wakeup(&com->dtr_wait); 1850} 1851 |
1871/* Interrupt routine for timekeeping purposes */ | |
1872void | 1852void |
1873siointrts(unit) 1874 int unit; 1875{ 1876 /* 1877 * XXX microtime() reenables CPU interrupts. We can't afford to 1878 * be interrupted and don't want to slow down microtime(), so lock 1879 * out interrupts in another way. 1880 */ 1881#ifdef PC98 1882 outb(IO_ICU1 + 2, 0xff); 1883#else /* IBM-PC */ 1884 outb(IO_ICU1 + 1, 0xff); 1885#endif /* PC98 */ 1886 microtime(&intr_timestamp); 1887 disable_intr(); 1888#ifdef PC98 1889 outb(IO_ICU1 + 2, imen); 1890#else /* IBM_PC */ 1891 outb(IO_ICU1 + 1, imen); 1892#endif /* PC98 */ 1893 1894 siointr(unit); 1895} 1896 1897void | |
1898siointr(unit) 1899 int unit; 1900{ 1901#ifndef COM_MULTIPORT 1902 siointr1(com_addr(unit)); 1903#else /* COM_MULTIPORT */ 1904 struct com_s *com; 1905 bool_t possibly_more_intrs; --- 36 unchanged lines hidden (view full) --- 1942 u_char modem_status; 1943 u_char *ioptr; 1944 u_char recv_data; 1945#ifdef PC98 1946 u_char tmp=0; 1947recv_data=0; 1948#endif /* PC98 */ 1949 | 1853siointr(unit) 1854 int unit; 1855{ 1856#ifndef COM_MULTIPORT 1857 siointr1(com_addr(unit)); 1858#else /* COM_MULTIPORT */ 1859 struct com_s *com; 1860 bool_t possibly_more_intrs; --- 36 unchanged lines hidden (view full) --- 1897 u_char modem_status; 1898 u_char *ioptr; 1899 u_char recv_data; 1900#ifdef PC98 1901 u_char tmp=0; 1902recv_data=0; 1903#endif /* PC98 */ 1904 |
1950 if (com->do_timestamp) 1951 /* XXX a little bloat here... */ 1952 com->timestamp = intr_timestamp; | |
1953 while (TRUE) { 1954#ifdef PC98 1955status_read:; 1956 if (IS_8251(com->pc98_if_type)) { 1957 tmp = inb(com->sts_port); 1958more_intr: 1959 line_status = 0; 1960 if (tmp & STS8251_TxRDY) line_status |= LSR_TXRDY; --- 58 unchanged lines hidden (view full) --- 2019 2020 ++com->bytes_in; 2021 if (com->hotchar != 0 && recv_data == com->hotchar) 2022 setsofttty(); 2023 ioptr = com->iptr; 2024 if (ioptr >= com->ibufend) 2025 CE_RECORD(com, CE_INTERRUPT_BUF_OVERFLOW); 2026 else { | 1905 while (TRUE) { 1906#ifdef PC98 1907status_read:; 1908 if (IS_8251(com->pc98_if_type)) { 1909 tmp = inb(com->sts_port); 1910more_intr: 1911 line_status = 0; 1912 if (tmp & STS8251_TxRDY) line_status |= LSR_TXRDY; --- 58 unchanged lines hidden (view full) --- 1971 1972 ++com->bytes_in; 1973 if (com->hotchar != 0 && recv_data == com->hotchar) 1974 setsofttty(); 1975 ioptr = com->iptr; 1976 if (ioptr >= com->ibufend) 1977 CE_RECORD(com, CE_INTERRUPT_BUF_OVERFLOW); 1978 else { |
1979 if (com->do_timestamp) 1980 microtime(&com->timestamp); |
|
2027 ++com_events; 2028 schedsofttty(); 2029#if 0 /* for testing input latency vs efficiency */ 2030if (com->iptr - com->ibuf == 8) 2031 setsofttty(); 2032#endif 2033 ioptr[0] = recv_data; 2034 ioptr[CE_INPUT_OFFSET] = line_status; --- 24 unchanged lines hidden (view full) --- 2059 } 2060 2061 /* modem status change? (always check before doing output) */ 2062#ifdef PC98 2063 if(!IS_8251(com->pc98_if_type)){ 2064#endif 2065 modem_status = inb(com->modem_status_port); 2066 if (modem_status != com->last_modem_status) { | 1981 ++com_events; 1982 schedsofttty(); 1983#if 0 /* for testing input latency vs efficiency */ 1984if (com->iptr - com->ibuf == 8) 1985 setsofttty(); 1986#endif 1987 ioptr[0] = recv_data; 1988 ioptr[CE_INPUT_OFFSET] = line_status; --- 24 unchanged lines hidden (view full) --- 2013 } 2014 2015 /* modem status change? (always check before doing output) */ 2016#ifdef PC98 2017 if(!IS_8251(com->pc98_if_type)){ 2018#endif 2019 modem_status = inb(com->modem_status_port); 2020 if (modem_status != com->last_modem_status) { |
2021 if (com->do_dcd_timestamp 2022 && !(com->last_modem_status & MSR_DCD) 2023 && modem_status & MSR_DCD) 2024 microtime(&com->dcd_timestamp); 2025 |
|
2067 /* 2068 * Schedule high level to handle DCD changes. Note 2069 * that we don't use the delta bits anywhere. Some 2070 * UARTs mess them up, and it's easy to remember the 2071 * previous bits and calculate the delta. 2072 */ 2073 com->last_modem_status = modem_status; 2074 if (!(com->state & CS_CHECKMSR)) { --- 35 unchanged lines hidden (view full) --- 2110#ifdef PC98 2111 if(IS_8251(com->pc98_if_type)) 2112 if ( !(pc98_check_i8251_interrupt(com) & IEN_TxFLAG) ) 2113 com_int_Tx_enable(com); 2114#endif 2115 com->obufq.l_head = ioptr; 2116 if (ioptr >= com->obufq.l_tail) { 2117 struct lbq *qp; | 2026 /* 2027 * Schedule high level to handle DCD changes. Note 2028 * that we don't use the delta bits anywhere. Some 2029 * UARTs mess them up, and it's easy to remember the 2030 * previous bits and calculate the delta. 2031 */ 2032 com->last_modem_status = modem_status; 2033 if (!(com->state & CS_CHECKMSR)) { --- 35 unchanged lines hidden (view full) --- 2069#ifdef PC98 2070 if(IS_8251(com->pc98_if_type)) 2071 if ( !(pc98_check_i8251_interrupt(com) & IEN_TxFLAG) ) 2072 com_int_Tx_enable(com); 2073#endif 2074 com->obufq.l_head = ioptr; 2075 if (ioptr >= com->obufq.l_tail) { 2076 struct lbq *qp; |
2118#ifdef PC98 2119 if(IS_8251(com->pc98_if_type)) 2120 if ( pc98_check_i8251_interrupt(com) & IEN_TxFLAG ) 2121 com_int_Tx_disable(com); 2122#endif | 2077 |
2123 qp = com->obufq.l_next; 2124 qp->l_queued = FALSE; 2125 qp = qp->l_next; 2126 if (qp != NULL) { 2127 com->obufq.l_head = qp->l_head; 2128 com->obufq.l_tail = qp->l_tail; 2129 com->obufq.l_next = qp; 2130 } else { 2131 /* output just completed */ 2132 com->state &= ~CS_BUSY; | 2078 qp = com->obufq.l_next; 2079 qp->l_queued = FALSE; 2080 qp = qp->l_next; 2081 if (qp != NULL) { 2082 com->obufq.l_head = qp->l_head; 2083 com->obufq.l_tail = qp->l_tail; 2084 com->obufq.l_next = qp; 2085 } else { 2086 /* output just completed */ 2087 com->state &= ~CS_BUSY; |
2088#if defined(PC98) 2089 if(IS_8251(com->pc98_if_type)) 2090 if ( pc98_check_i8251_interrupt(com) & IEN_TxFLAG ) 2091 com_int_Tx_disable(com); 2092#endif |
|
2133 } 2134 if (!(com->state & CS_ODONE)) { 2135 com_events += LOTS_OF_EVENTS; 2136 com->state |= CS_ODONE; 2137 setsofttty(); /* handle at high level ASAP */ 2138 } 2139 } 2140 } --- 185 unchanged lines hidden (view full) --- 2326 break; 2327 case TIOCMGDTRWAIT: 2328 *(int *)data = com->dtr_wait * 100 / hz; 2329 break; 2330 case TIOCTIMESTAMP: 2331 com->do_timestamp = TRUE; 2332 *(struct timeval *)data = com->timestamp; 2333 break; | 2093 } 2094 if (!(com->state & CS_ODONE)) { 2095 com_events += LOTS_OF_EVENTS; 2096 com->state |= CS_ODONE; 2097 setsofttty(); /* handle at high level ASAP */ 2098 } 2099 } 2100 } --- 185 unchanged lines hidden (view full) --- 2286 break; 2287 case TIOCMGDTRWAIT: 2288 *(int *)data = com->dtr_wait * 100 / hz; 2289 break; 2290 case TIOCTIMESTAMP: 2291 com->do_timestamp = TRUE; 2292 *(struct timeval *)data = com->timestamp; 2293 break; |
2294 case TIOCDCDTIMESTAMP: 2295 com->do_dcd_timestamp = TRUE; 2296 *(struct timeval *)data = com->dcd_timestamp; 2297 break; |
|
2334 default: 2335 splx(s); 2336 return (ENOTTY); 2337 } 2338 } else { 2339#endif 2340 switch (cmd) { 2341 case TIOCSBRK: --- 852 unchanged lines hidden (view full) --- 3194static void siocnclose __P((struct siocnstate *sp)); 3195static void siocnopen __P((struct siocnstate *sp)); 3196static void siocntxwait __P((void)); 3197 3198static void 3199siocntxwait() 3200{ 3201 int timo; | 2298 default: 2299 splx(s); 2300 return (ENOTTY); 2301 } 2302 } else { 2303#endif 2304 switch (cmd) { 2305 case TIOCSBRK: --- 852 unchanged lines hidden (view full) --- 3158static void siocnclose __P((struct siocnstate *sp)); 3159static void siocnopen __P((struct siocnstate *sp)); 3160static void siocntxwait __P((void)); 3161 3162static void 3163siocntxwait() 3164{ 3165 int timo; |
3202#ifdef PC98 3203 int tmp; 3204#endif | |
3205 3206 /* 3207 * Wait for any pending transmission to finish. Required to avoid 3208 * the UART lockup bug when the speed is changed, and for normal 3209 * transmits. 3210 */ 3211 timo = 100000; 3212 while ((inb(siocniobase + com_lsr) & (LSR_TSRE | LSR_TXRDY)) --- 333 unchanged lines hidden (view full) --- 3546 3547/* convert to TIOCM_?? ( ioctl.h ) */ 3548static int 3549pc98_get_modem_status(struct com_s *com) 3550{ 3551 int stat, stat2; 3552 register int msr; 3553 | 3166 3167 /* 3168 * Wait for any pending transmission to finish. Required to avoid 3169 * the UART lockup bug when the speed is changed, and for normal 3170 * transmits. 3171 */ 3172 timo = 100000; 3173 while ((inb(siocniobase + com_lsr) & (LSR_TSRE | LSR_TXRDY)) --- 333 unchanged lines hidden (view full) --- 3507 3508/* convert to TIOCM_?? ( ioctl.h ) */ 3509static int 3510pc98_get_modem_status(struct com_s *com) 3511{ 3512 int stat, stat2; 3513 register int msr; 3514 |
3554 int ret; 3555 | |
3556 stat = inb(com->sts_port); 3557 stat2 = inb(com->in_modem_port); 3558 msr = com->pc98_prev_modem_status 3559 & ~(TIOCM_CAR|TIOCM_RI|TIOCM_DSR|TIOCM_CTS); 3560 if ( !(stat2 & CICSCD_CD) ) msr |= TIOCM_CAR; 3561 if ( !(stat2 & CICSCD_CI) ) msr |= TIOCM_RI; 3562 if ( stat & STS8251_DSR ) msr |= TIOCM_DSR; 3563 if ( !(stat2 & CICSCD_CS) ) msr |= TIOCM_CTS; --- 194 unchanged lines hidden (view full) --- 3758 sysclock = 5; 3759 } 3760} 3761 3762static void 3763com_cflag_and_speed_set( struct com_s *com, int cflag, int speed) 3764{ 3765 int cfcr=0, count; | 3515 stat = inb(com->sts_port); 3516 stat2 = inb(com->in_modem_port); 3517 msr = com->pc98_prev_modem_status 3518 & ~(TIOCM_CAR|TIOCM_RI|TIOCM_DSR|TIOCM_CTS); 3519 if ( !(stat2 & CICSCD_CD) ) msr |= TIOCM_CAR; 3520 if ( !(stat2 & CICSCD_CI) ) msr |= TIOCM_RI; 3521 if ( stat & STS8251_DSR ) msr |= TIOCM_DSR; 3522 if ( !(stat2 & CICSCD_CS) ) msr |= TIOCM_CTS; --- 194 unchanged lines hidden (view full) --- 3717 sysclock = 5; 3718 } 3719} 3720 3721static void 3722com_cflag_and_speed_set( struct com_s *com, int cflag, int speed) 3723{ 3724 int cfcr=0, count; |
3766 int s, previnterrupt; | 3725 int previnterrupt; |
3767 3768 count = pc98_ttspeedtab( com, speed ); 3769 if ( count < 0 ) return; 3770 3771 previnterrupt = pc98_check_i8251_interrupt(com); 3772 pc98_disable_i8251_interrupt( com, IEN_Tx|IEN_TxEMP|IEN_Rx ); 3773 3774 switch ( cflag&CSIZE ) { --- 249 unchanged lines hidden --- | 3726 3727 count = pc98_ttspeedtab( com, speed ); 3728 if ( count < 0 ) return; 3729 3730 previnterrupt = pc98_check_i8251_interrupt(com); 3731 pc98_disable_i8251_interrupt( com, IEN_Tx|IEN_TxEMP|IEN_Rx ); 3732 3733 switch ( cflag&CSIZE ) { --- 249 unchanged lines hidden --- |