sio.c (130892) | sio.c (130938) |
---|---|
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 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 * 29 * from: @(#)com.c 7.5 (Berkeley) 5/16/91 30 * from: i386/isa sio.c,v 1.234 31 */ 32 33#include <sys/cdefs.h> | 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 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 * 29 * from: @(#)com.c 7.5 (Berkeley) 5/16/91 30 * from: i386/isa sio.c,v 1.234 31 */ 32 33#include <sys/cdefs.h> |
34__FBSDID("$FreeBSD: head/sys/dev/sio/sio.c 130892 2004-06-21 22:57:16Z phk $"); | 34__FBSDID("$FreeBSD: head/sys/dev/sio/sio.c 130938 2004-06-22 20:32:17Z phk $"); |
35 36#include "opt_comconsole.h" 37#include "opt_compat.h" 38#include "opt_ddb.h" 39#include "opt_sio.h" 40 41/* 42 * Serial driver, based on 386BSD-0.1 com driver. --- 203 unchanged lines hidden (view full) --- 246 struct termios it_in; /* should be in struct tty */ 247 struct termios it_out; 248 249 /* Lock state. */ 250 struct termios lt_in; /* should be in struct tty */ 251 struct termios lt_out; 252 253 bool_t do_timestamp; | 35 36#include "opt_comconsole.h" 37#include "opt_compat.h" 38#include "opt_ddb.h" 39#include "opt_sio.h" 40 41/* 42 * Serial driver, based on 386BSD-0.1 com driver. --- 203 unchanged lines hidden (view full) --- 246 struct termios it_in; /* should be in struct tty */ 247 struct termios it_out; 248 249 /* Lock state. */ 250 struct termios lt_in; /* should be in struct tty */ 251 struct termios lt_out; 252 253 bool_t do_timestamp; |
254 bool_t do_dcd_timestamp; | |
255 struct timeval timestamp; | 254 struct timeval timestamp; |
256 struct timeval dcd_timestamp; | |
257 struct pps_state pps; 258 int pps_bit; 259#ifdef ALT_BREAK_TO_DEBUGGER 260 int alt_brk_state; 261#endif 262 263 u_long bytes_in; /* statistics */ 264 u_long bytes_out; --- 1179 unchanged lines hidden (view full) --- 1444{ 1445 int s; 1446 struct tty *tp; 1447 1448 s = spltty(); 1449 com->poll = FALSE; 1450 com->poll_output = FALSE; 1451 com->do_timestamp = FALSE; | 255 struct pps_state pps; 256 int pps_bit; 257#ifdef ALT_BREAK_TO_DEBUGGER 258 int alt_brk_state; 259#endif 260 261 u_long bytes_in; /* statistics */ 262 u_long bytes_out; --- 1179 unchanged lines hidden (view full) --- 1442{ 1443 int s; 1444 struct tty *tp; 1445 1446 s = spltty(); 1447 com->poll = FALSE; 1448 com->poll_output = FALSE; 1449 com->do_timestamp = FALSE; |
1452 com->do_dcd_timestamp = FALSE; | |
1453 com->pps.ppsparam.mode = 0; 1454 sio_setreg(com, com_cfcr, com->cfcr_image &= ~CFCR_SBREAK); 1455 tp = com->tp; 1456 1457#if defined(DDB) && (defined(BREAK_TO_DEBUGGER) || \ 1458 defined(ALT_BREAK_TO_DEBUGGER)) 1459 /* 1460 * Leave interrupts enabled and don't clear DTR if this is the --- 448 unchanged lines hidden (view full) --- 1909 * jump from the top of the loop to here 1910 */ 1911 line_status = inb(com->line_status_port) & 0x7F; 1912 } 1913 1914 /* modem status change? (always check before doing output) */ 1915 modem_status = inb(com->modem_status_port); 1916 if (modem_status != com->last_modem_status) { | 1450 com->pps.ppsparam.mode = 0; 1451 sio_setreg(com, com_cfcr, com->cfcr_image &= ~CFCR_SBREAK); 1452 tp = com->tp; 1453 1454#if defined(DDB) && (defined(BREAK_TO_DEBUGGER) || \ 1455 defined(ALT_BREAK_TO_DEBUGGER)) 1456 /* 1457 * Leave interrupts enabled and don't clear DTR if this is the --- 448 unchanged lines hidden (view full) --- 1906 * jump from the top of the loop to here 1907 */ 1908 line_status = inb(com->line_status_port) & 0x7F; 1909 } 1910 1911 /* modem status change? (always check before doing output) */ 1912 modem_status = inb(com->modem_status_port); 1913 if (modem_status != com->last_modem_status) { |
1917 if (com->do_dcd_timestamp 1918 && !(com->last_modem_status & MSR_DCD) 1919 && modem_status & MSR_DCD) 1920 microtime(&com->dcd_timestamp); 1921 | |
1922 /* 1923 * Schedule high level to handle DCD changes. Note 1924 * that we don't use the delta bits anywhere. Some 1925 * UARTs mess them up, and it's easy to remember the 1926 * previous bits and calculate the delta. 1927 */ 1928 com->last_modem_status = modem_status; 1929 if (!(com->state & CS_CHECKMSR)) { --- 225 unchanged lines hidden (view full) --- 2155 break; 2156 case TIOCMGDTRWAIT: 2157 *(int *)data = com->dtr_wait * 100 / hz; 2158 break; 2159 case TIOCTIMESTAMP: 2160 com->do_timestamp = TRUE; 2161 *(struct timeval *)data = com->timestamp; 2162 break; | 1914 /* 1915 * Schedule high level to handle DCD changes. Note 1916 * that we don't use the delta bits anywhere. Some 1917 * UARTs mess them up, and it's easy to remember the 1918 * previous bits and calculate the delta. 1919 */ 1920 com->last_modem_status = modem_status; 1921 if (!(com->state & CS_CHECKMSR)) { --- 225 unchanged lines hidden (view full) --- 2147 break; 2148 case TIOCMGDTRWAIT: 2149 *(int *)data = com->dtr_wait * 100 / hz; 2150 break; 2151 case TIOCTIMESTAMP: 2152 com->do_timestamp = TRUE; 2153 *(struct timeval *)data = com->timestamp; 2154 break; |
2163 case TIOCDCDTIMESTAMP: 2164 com->do_dcd_timestamp = TRUE; 2165 *(struct timeval *)data = com->dcd_timestamp; 2166 break; | |
2167 default: 2168 splx(s); 2169 error = pps_ioctl(cmd, data, &com->pps); 2170 if (error == ENODEV) 2171 error = ENOTTY; 2172 return (error); 2173 } 2174 splx(s); --- 1122 unchanged lines hidden --- | 2155 default: 2156 splx(s); 2157 error = pps_ioctl(cmd, data, &com->pps); 2158 if (error == ENODEV) 2159 error = ENOTTY; 2160 return (error); 2161 } 2162 splx(s); --- 1122 unchanged lines hidden --- |