sio.c (45029) | sio.c (45226) |
---|---|
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.82 1999/03/04 10:37:30 kato Exp $ | 34 * $Id: sio.c,v 1.83 1999/03/25 08:26:50 kato Exp $ |
35 */ 36 37#include "opt_comconsole.h" 38#include "opt_compat.h" 39#include "opt_ddb.h" 40#include "opt_devfs.h" 41#include "opt_sio.h" 42#include "sio.h" --- 103 unchanged lines hidden (view full) --- 146#include <sys/fcntl.h> 147#include <sys/interrupt.h> 148#include <sys/kernel.h> 149#include <sys/syslog.h> 150#include <sys/sysctl.h> 151#ifdef DEVFS 152#include <sys/devfsext.h> 153#endif | 35 */ 36 37#include "opt_comconsole.h" 38#include "opt_compat.h" 39#include "opt_ddb.h" 40#include "opt_devfs.h" 41#include "opt_sio.h" 42#include "sio.h" --- 103 unchanged lines hidden (view full) --- 146#include <sys/fcntl.h> 147#include <sys/interrupt.h> 148#include <sys/kernel.h> 149#include <sys/syslog.h> 150#include <sys/sysctl.h> 151#ifdef DEVFS 152#include <sys/devfsext.h> 153#endif |
154#include <sys/timepps.h> |
|
154 155#include <machine/clock.h> 156#include <machine/ipl.h> 157#ifndef SMP 158#include <machine/lock.h> 159#endif 160 161#ifdef PC98 --- 214 unchanged lines hidden (view full) --- 376 /* Lock state. */ 377 struct termios lt_in; /* should be in struct tty */ 378 struct termios lt_out; 379 380 bool_t do_timestamp; 381 bool_t do_dcd_timestamp; 382 struct timeval timestamp; 383 struct timeval dcd_timestamp; | 155 156#include <machine/clock.h> 157#include <machine/ipl.h> 158#ifndef SMP 159#include <machine/lock.h> 160#endif 161 162#ifdef PC98 --- 214 unchanged lines hidden (view full) --- 377 /* Lock state. */ 378 struct termios lt_in; /* should be in struct tty */ 379 struct termios lt_out; 380 381 bool_t do_timestamp; 382 bool_t do_dcd_timestamp; 383 struct timeval timestamp; 384 struct timeval dcd_timestamp; |
385 struct pps_state pps; |
|
384 385 u_long bytes_in; /* statistics */ 386 u_long bytes_out; 387 u_int delta_error_counts[CE_NTYPES]; 388 u_long error_counts[CE_NTYPES]; 389 390 /* 391 * Data area for output buffers. Someday we should build the output --- 1413 unchanged lines hidden (view full) --- 1805 com->devfs_token_cuai = devfs_add_devswf(&sio_cdevsw, 1806 unit | CALLOUT_MASK | CONTROL_INIT_STATE, DV_CHR, 1807 UID_UUCP, GID_DIALER, 0660, "cuaia%r", unit); 1808 com->devfs_token_cual = devfs_add_devswf(&sio_cdevsw, 1809 unit | CALLOUT_MASK | CONTROL_LOCK_STATE, DV_CHR, 1810 UID_UUCP, GID_DIALER, 0660, "cuala%r", unit); 1811#endif 1812 com->id_flags = isdp->id_flags; /* Heritate id_flags for later */ | 386 387 u_long bytes_in; /* statistics */ 388 u_long bytes_out; 389 u_int delta_error_counts[CE_NTYPES]; 390 u_long error_counts[CE_NTYPES]; 391 392 /* 393 * Data area for output buffers. Someday we should build the output --- 1413 unchanged lines hidden (view full) --- 1807 com->devfs_token_cuai = devfs_add_devswf(&sio_cdevsw, 1808 unit | CALLOUT_MASK | CONTROL_INIT_STATE, DV_CHR, 1809 UID_UUCP, GID_DIALER, 0660, "cuaia%r", unit); 1810 com->devfs_token_cual = devfs_add_devswf(&sio_cdevsw, 1811 unit | CALLOUT_MASK | CONTROL_LOCK_STATE, DV_CHR, 1812 UID_UUCP, GID_DIALER, 0660, "cuala%r", unit); 1813#endif 1814 com->id_flags = isdp->id_flags; /* Heritate id_flags for later */ |
1815 com->pps.ppscap = PPS_CAPTUREASSERT | PPS_CAPTURECLEAR; 1816 pps_init(&com->pps); |
|
1813 return (1); 1814} 1815 1816static int 1817sioopen(dev, flag, mode, p) 1818 dev_t dev; 1819 int flag; 1820 int mode; --- 292 unchanged lines hidden (view full) --- 2113 2114 unit = com->unit; 2115 iobase = com->iobase; 2116 s = spltty(); 2117 com->poll = FALSE; 2118 com->poll_output = FALSE; 2119 com->do_timestamp = FALSE; 2120 com->do_dcd_timestamp = FALSE; | 1817 return (1); 1818} 1819 1820static int 1821sioopen(dev, flag, mode, p) 1822 dev_t dev; 1823 int flag; 1824 int mode; --- 292 unchanged lines hidden (view full) --- 2117 2118 unit = com->unit; 2119 iobase = com->iobase; 2120 s = spltty(); 2121 com->poll = FALSE; 2122 com->poll_output = FALSE; 2123 com->do_timestamp = FALSE; 2124 com->do_dcd_timestamp = FALSE; |
2125 com->pps.ppsparam.mode = 0; |
|
2121#ifdef PC98 2122 if (IS_8251(com->pc98_if_type)) 2123 com_send_break_off(com); 2124 else { 2125 port_shift = if_16550a_type[com->pc98_if_type & 0x0f].port_shift; 2126 outb(iobase + (com_cfcr << port_shift), 2127 com->cfcr_image &= ~CFCR_SBREAK); 2128 } --- 339 unchanged lines hidden (view full) --- 2468 struct com_s *com; 2469{ 2470 u_char line_status; 2471 u_char modem_status; 2472 u_char *ioptr; 2473 u_char recv_data; 2474 u_char int_ctl; 2475 u_char int_ctl_new; | 2126#ifdef PC98 2127 if (IS_8251(com->pc98_if_type)) 2128 com_send_break_off(com); 2129 else { 2130 port_shift = if_16550a_type[com->pc98_if_type & 0x0f].port_shift; 2131 outb(iobase + (com_cfcr << port_shift), 2132 com->cfcr_image &= ~CFCR_SBREAK); 2133 } --- 339 unchanged lines hidden (view full) --- 2473 struct com_s *com; 2474{ 2475 u_char line_status; 2476 u_char modem_status; 2477 u_char *ioptr; 2478 u_char recv_data; 2479 u_char int_ctl; 2480 u_char int_ctl_new; |
2481 struct timecounter *tc; 2482 u_int count; |
|
2476 2477#ifdef PC98 2478 u_char tmp=0; 2479 u_char rsa_buf_status = 0; 2480 int rsa_tx_fifo_size=0; 2481 recv_data=0; 2482#endif /* PC98 */ 2483 --- 11 unchanged lines hidden (view full) --- 2495 if (tmp & STS8251_RxRDY) line_status |= LSR_RXRDY; 2496 if (tmp & STS8251_TxEMP) line_status |= LSR_TSRE; 2497 if (tmp & STS8251_PE) line_status |= LSR_PE; 2498 if (tmp & STS8251_OE) line_status |= LSR_OE; 2499 if (tmp & STS8251_FE) line_status |= LSR_FE; 2500 if (tmp & STS8251_BD_SD) line_status |= LSR_BI; 2501 } else 2502#endif /* PC98 */ | 2483 2484#ifdef PC98 2485 u_char tmp=0; 2486 u_char rsa_buf_status = 0; 2487 int rsa_tx_fifo_size=0; 2488 recv_data=0; 2489#endif /* PC98 */ 2490 --- 11 unchanged lines hidden (view full) --- 2502 if (tmp & STS8251_RxRDY) line_status |= LSR_RXRDY; 2503 if (tmp & STS8251_TxEMP) line_status |= LSR_TSRE; 2504 if (tmp & STS8251_PE) line_status |= LSR_PE; 2505 if (tmp & STS8251_OE) line_status |= LSR_OE; 2506 if (tmp & STS8251_FE) line_status |= LSR_FE; 2507 if (tmp & STS8251_BD_SD) line_status |= LSR_BI; 2508 } else 2509#endif /* PC98 */ |
2510 if (com->pps.ppsparam.mode & PPS_CAPTUREBOTH) { 2511 modem_status = inb(com->modem_status_port); 2512 if ((modem_status ^ com->last_modem_status) & MSR_DCD) { 2513 tc = timecounter; 2514 count = tc->tc_get_timecount(tc); 2515 pps_event(&com->pps, tc, count, 2516 (modem_status & MSR_DCD) ? 2517 PPS_CAPTUREASSERT : PPS_CAPTURECLEAR); 2518 } 2519 } |
|
2503 line_status = inb(com->line_status_port); 2504#ifdef PC98 2505 if (com->pc98_if_type == COM_IF_RSA98III) 2506 rsa_buf_status = inb(com->rsabase + rsa_srr); 2507#endif /* PC98 */ 2508 2509 /* input event? (check first to help avoid overruns) */ 2510#ifndef PC98 --- 465 unchanged lines hidden (view full) --- 2976 *(struct timeval *)data = com->timestamp; 2977 break; 2978 case TIOCDCDTIMESTAMP: 2979 com->do_dcd_timestamp = TRUE; 2980 *(struct timeval *)data = com->dcd_timestamp; 2981 break; 2982 default: 2983 splx(s); | 2520 line_status = inb(com->line_status_port); 2521#ifdef PC98 2522 if (com->pc98_if_type == COM_IF_RSA98III) 2523 rsa_buf_status = inb(com->rsabase + rsa_srr); 2524#endif /* PC98 */ 2525 2526 /* input event? (check first to help avoid overruns) */ 2527#ifndef PC98 --- 465 unchanged lines hidden (view full) --- 2993 *(struct timeval *)data = com->timestamp; 2994 break; 2995 case TIOCDCDTIMESTAMP: 2996 com->do_dcd_timestamp = TRUE; 2997 *(struct timeval *)data = com->dcd_timestamp; 2998 break; 2999 default: 3000 splx(s); |
2984 return (ENOTTY); | 3001 error = pps_ioctl(cmd, data, &com->pps); 3002 if (error == ENODEV) 3003 error = ENOTTY; 3004 return (error); |
2985 } 2986#ifdef PC98 2987 } 2988#endif 2989 splx(s); 2990 return (0); 2991} 2992 --- 1778 unchanged lines hidden --- | 3005 } 3006#ifdef PC98 3007 } 3008#endif 3009 splx(s); 3010 return (0); 3011} 3012 --- 1778 unchanged lines hidden --- |