summaryrefslogtreecommitdiffstats
path: root/sys/dev/uart/uart_core.c
diff options
context:
space:
mode:
authorian <ian@FreeBSD.org>2015-08-10 20:54:03 +0000
committerian <ian@FreeBSD.org>2015-08-10 20:54:03 +0000
commitebeb87c84e0356155d46fcf989d7618315601ba3 (patch)
treee1708534e78839f1f4287ef9e1cfe330c84e4649 /sys/dev/uart/uart_core.c
parentba06112c24598aa404ec73c277af843211d13ab2 (diff)
downloadFreeBSD-src-ebeb87c84e0356155d46fcf989d7618315601ba3.zip
FreeBSD-src-ebeb87c84e0356155d46fcf989d7618315601ba3.tar.gz
Correct the polarity of the PPS assert and clear events with respect to the
electrical signals on the serial port. Virtually all devices which output a PPS signal generate a brief higher-voltage pulse, the leading edge of which is the on-time point. Both DCD and CTS are active-low signals on the wire, meaning the assertion of their status bits in the modem status register corresponds to the lower voltage level on the wire. So when the status bit transitions to not-set, create a PPS assert event; when the status bit transitions to set, create a PPS clear event.
Diffstat (limited to 'sys/dev/uart/uart_core.c')
-rw-r--r--sys/dev/uart/uart_core.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/sys/dev/uart/uart_core.c b/sys/dev/uart/uart_core.c
index d83c31c..8a0d401 100644
--- a/sys/dev/uart/uart_core.c
+++ b/sys/dev/uart/uart_core.c
@@ -320,12 +320,18 @@ uart_intr_sigchg(void *arg)
sig = UART_GETSIG(sc);
+ /*
+ * Time pulse counting support. Note that both CTS and DCD are
+ * active-low signals. The status bit is high to indicate that
+ * the signal on the line is low, which corresponds to a PPS
+ * clear event.
+ */
if (sc->sc_pps.ppsparam.mode & PPS_CAPTUREBOTH) {
pps_sig = uart_pps_signal(sc->sc_pps_mode);
if (sig & SER_DELTA(pps_sig)) {
pps_capture(&sc->sc_pps);
pps_event(&sc->sc_pps, (sig & pps_sig) ?
- PPS_CAPTUREASSERT : PPS_CAPTURECLEAR);
+ PPS_CAPTURECLEAR : PPS_CAPTUREASSERT);
}
}
OpenPOWER on IntegriCloud