diff --git a/sys/pc98/cbus/sio.c b/sys/pc98/cbus/sio.c index 33f0ff25dd6..6a21b5bf9dc 100644 --- a/sys/pc98/cbus/sio.c +++ b/sys/pc98/cbus/sio.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)com.c 7.5 (Berkeley) 5/16/91 - * $Id: sio.c,v 1.82 1999/03/04 10:37:30 kato Exp $ + * $Id: sio.c,v 1.83 1999/03/25 08:26:50 kato Exp $ */ #include "opt_comconsole.h" @@ -151,6 +151,7 @@ #ifdef DEVFS #include #endif +#include #include #include @@ -381,6 +382,7 @@ struct com_s { bool_t do_dcd_timestamp; struct timeval timestamp; struct timeval dcd_timestamp; + struct pps_state pps; u_long bytes_in; /* statistics */ u_long bytes_out; @@ -1810,6 +1812,8 @@ determined_type: ; UID_UUCP, GID_DIALER, 0660, "cuala%r", unit); #endif com->id_flags = isdp->id_flags; /* Heritate id_flags for later */ + com->pps.ppscap = PPS_CAPTUREASSERT | PPS_CAPTURECLEAR; + pps_init(&com->pps); return (1); } @@ -2118,6 +2122,7 @@ comhardclose(com) com->poll_output = FALSE; com->do_timestamp = FALSE; com->do_dcd_timestamp = FALSE; + com->pps.ppsparam.mode = 0; #ifdef PC98 if (IS_8251(com->pc98_if_type)) com_send_break_off(com); @@ -2473,6 +2478,8 @@ siointr1(com) u_char recv_data; u_char int_ctl; u_char int_ctl_new; + struct timecounter *tc; + u_int count; #ifdef PC98 u_char tmp=0; @@ -2500,6 +2507,16 @@ more_intr: if (tmp & STS8251_BD_SD) line_status |= LSR_BI; } else #endif /* PC98 */ + if (com->pps.ppsparam.mode & PPS_CAPTUREBOTH) { + modem_status = inb(com->modem_status_port); + if ((modem_status ^ com->last_modem_status) & MSR_DCD) { + tc = timecounter; + count = tc->tc_get_timecount(tc); + pps_event(&com->pps, tc, count, + (modem_status & MSR_DCD) ? + PPS_CAPTUREASSERT : PPS_CAPTURECLEAR); + } + } line_status = inb(com->line_status_port); #ifdef PC98 if (com->pc98_if_type == COM_IF_RSA98III) @@ -2981,7 +2998,10 @@ sioioctl(dev, cmd, data, flag, p) break; default: splx(s); - return (ENOTTY); + error = pps_ioctl(cmd, data, &com->pps); + if (error == ENODEV) + error = ENOTTY; + return (error); } #ifdef PC98 } diff --git a/sys/pc98/pc98/sio.c b/sys/pc98/pc98/sio.c index 33f0ff25dd6..6a21b5bf9dc 100644 --- a/sys/pc98/pc98/sio.c +++ b/sys/pc98/pc98/sio.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)com.c 7.5 (Berkeley) 5/16/91 - * $Id: sio.c,v 1.82 1999/03/04 10:37:30 kato Exp $ + * $Id: sio.c,v 1.83 1999/03/25 08:26:50 kato Exp $ */ #include "opt_comconsole.h" @@ -151,6 +151,7 @@ #ifdef DEVFS #include #endif +#include #include #include @@ -381,6 +382,7 @@ struct com_s { bool_t do_dcd_timestamp; struct timeval timestamp; struct timeval dcd_timestamp; + struct pps_state pps; u_long bytes_in; /* statistics */ u_long bytes_out; @@ -1810,6 +1812,8 @@ determined_type: ; UID_UUCP, GID_DIALER, 0660, "cuala%r", unit); #endif com->id_flags = isdp->id_flags; /* Heritate id_flags for later */ + com->pps.ppscap = PPS_CAPTUREASSERT | PPS_CAPTURECLEAR; + pps_init(&com->pps); return (1); } @@ -2118,6 +2122,7 @@ comhardclose(com) com->poll_output = FALSE; com->do_timestamp = FALSE; com->do_dcd_timestamp = FALSE; + com->pps.ppsparam.mode = 0; #ifdef PC98 if (IS_8251(com->pc98_if_type)) com_send_break_off(com); @@ -2473,6 +2478,8 @@ siointr1(com) u_char recv_data; u_char int_ctl; u_char int_ctl_new; + struct timecounter *tc; + u_int count; #ifdef PC98 u_char tmp=0; @@ -2500,6 +2507,16 @@ more_intr: if (tmp & STS8251_BD_SD) line_status |= LSR_BI; } else #endif /* PC98 */ + if (com->pps.ppsparam.mode & PPS_CAPTUREBOTH) { + modem_status = inb(com->modem_status_port); + if ((modem_status ^ com->last_modem_status) & MSR_DCD) { + tc = timecounter; + count = tc->tc_get_timecount(tc); + pps_event(&com->pps, tc, count, + (modem_status & MSR_DCD) ? + PPS_CAPTUREASSERT : PPS_CAPTURECLEAR); + } + } line_status = inb(com->line_status_port); #ifdef PC98 if (com->pc98_if_type == COM_IF_RSA98III) @@ -2981,7 +2998,10 @@ sioioctl(dev, cmd, data, flag, p) break; default: splx(s); - return (ENOTTY); + error = pps_ioctl(cmd, data, &com->pps); + if (error == ENODEV) + error = ENOTTY; + return (error); } #ifdef PC98 }