summaryrefslogtreecommitdiffstats
path: root/sys/i386/isa
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>1999-03-30 09:02:38 +0000
committerphk <phk@FreeBSD.org>1999-03-30 09:02:38 +0000
commit3dde8c0637ca3bf48861cc22bf66a53da5760723 (patch)
treeed3ca8fbdc81404616d252c80da9f7d5013b878d /sys/i386/isa
parentff83a425c71b2f39ef6277eaaa8dc2f198201357 (diff)
downloadFreeBSD-src-3dde8c0637ca3bf48861cc22bf66a53da5760723.zip
FreeBSD-src-3dde8c0637ca3bf48861cc22bf66a53da5760723.tar.gz
Add PPS-API support for DCD on serial ports.
Submitted by: jhay Slightly changed by: phk
Diffstat (limited to 'sys/i386/isa')
-rw-r--r--sys/i386/isa/sio.c24
1 files changed, 21 insertions, 3 deletions
diff --git a/sys/i386/isa/sio.c b/sys/i386/isa/sio.c
index 4493080..b12ef71 100644
--- a/sys/i386/isa/sio.c
+++ b/sys/i386/isa/sio.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* from: @(#)com.c 7.5 (Berkeley) 5/16/91
- * $Id: sio.c,v 1.230 1999/03/24 17:59:25 steve Exp $
+ * $Id: sio.c,v 1.231 1999/03/25 00:32:54 steve Exp $
*/
#include "opt_comconsole.h"
@@ -67,6 +67,7 @@
#ifdef DEVFS
#include <sys/devfsext.h>
#endif
+#include <sys/timepps.h>
#include <machine/clock.h>
#include <machine/ipl.h>
@@ -266,6 +267,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;
@@ -1077,6 +1079,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);
}
@@ -1320,6 +1324,7 @@ comhardclose(com)
com->poll_output = FALSE;
com->do_timestamp = FALSE;
com->do_dcd_timestamp = FALSE;
+ com->pps.ppsparam.mode = 0;
outb(iobase + com_cfcr, com->cfcr_image &= ~CFCR_SBREAK);
{
outb(iobase + com_ier, 0);
@@ -1581,11 +1586,22 @@ siointr1(com)
u_char recv_data;
u_char int_ctl;
u_char int_ctl_new;
+ struct timecounter *tc;
+ u_int count;
int_ctl = inb(com->intr_ctl_port);
int_ctl_new = int_ctl;
while (!com->gone) {
+ modem_status = inb(com->modem_status_port);
+ if ((com->pps.ppsparam.mode & PPS_CAPTUREBOTH) &&
+ ((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);
/* input event? (check first to help avoid overruns) */
@@ -1662,7 +1678,6 @@ cont:
}
/* modem status change? (always check before doing output) */
- modem_status = inb(com->modem_status_port);
if (modem_status != com->last_modem_status) {
if (com->do_dcd_timestamp
&& !(com->last_modem_status & MSR_DCD)
@@ -1899,7 +1914,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);
}
splx(s);
return (0);
OpenPOWER on IntegriCloud