1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
|
--- sys/dev/ltmdm/ltmdmsio.c-0.7.1 Thu Apr 4 23:40:35 2002
+++ sys/dev/ltmdm/ltmdmsio.c Sun Apr 28 23:43:29 2002
@@ -69,9 +69,13 @@
#include <machine/bus.h>
#include <sys/rman.h>
#if __FreeBSD_version >= 500000
+#if __FreeBSD_version < 500034 /* < 20020426 */
#include <sys/timetc.h>
#endif
+#endif
+#ifdef ENABLE_PPS
#include <sys/timepps.h>
+#endif
#include <pci/pcireg.h>
#include <pci/pcivar.h>
@@ -258,7 +262,9 @@
bool_t do_dcd_timestamp;
struct timeval timestamp;
struct timeval dcd_timestamp;
+#ifdef ENABLE_PPS
struct pps_state pps;
+#endif
u_long bytes_in; /* statistics */
u_long bytes_out;
@@ -1297,8 +1303,11 @@
DPRINTF(1,(" x_chip_version = %d\n", x_chip_version));
com->flags = flags;
+
+#ifdef ENABLE_PPS
com->pps.ppscap = PPS_CAPTUREASSERT | PPS_CAPTURECLEAR;
pps_init(&com->pps);
+#endif
/*
* initialize the device registers as follows:
@@ -1687,7 +1696,9 @@
s = splfunc();
com->do_timestamp = FALSE;
com->do_dcd_timestamp = FALSE;
+#ifdef ENABLE_PPS
com->pps.ppsparam.mode = 0;
+#endif
write_vuart_port(UART_CFCR, com->cfcr_image &= ~CFCR_SBREAK);
{
write_vuart_port(UART_IER, 0);
@@ -1896,23 +1907,34 @@
u_char recv_data;
u_char int_ctl;
u_char int_ctl_new;
+#ifdef ENABLE_PPS
+#if __FreeBSD_version < 500034
struct timecounter *tc;
u_int count;
+#endif
+#endif
int_ctl = read_vuart_port(UART_IER);
int_ctl_new = int_ctl;
while (!com->gone) {
+#ifdef ENABLE_PPS
if (com->pps.ppsparam.mode & PPS_CAPTUREBOTH) {
modem_status = read_vuart_port(UART_MSR);
if ((modem_status ^ com->last_modem_status) & MSR_DCD) {
+#if __FreeBSD_version < 500034
tc = timecounter;
count = tc->tc_get_timecount(tc);
pps_event(&com->pps, tc, count,
+#else
+ pps_capture(&com->pps);
+ pps_event(&com->pps,
+#endif
(modem_status & MSR_DCD) ?
PPS_CAPTUREASSERT : PPS_CAPTURECLEAR);
}
}
+#endif
line_status = read_vuart_port(UART_LSR);
/* input event? (check first to help avoid overruns) */
@@ -2197,7 +2219,9 @@
break;
default:
splx(s);
+#ifdef ENABLE_PPS
error = pps_ioctl(cmd, data, &com->pps);
+#endif
if (error == ENODEV)
error = ENOTTY;
return (error);
|