summaryrefslogtreecommitdiffstats
path: root/sys/dev/uart/uart_core.c
diff options
context:
space:
mode:
authormarcel <marcel@FreeBSD.org>2003-09-11 23:06:42 +0000
committermarcel <marcel@FreeBSD.org>2003-09-11 23:06:42 +0000
commit49dd02f24778121c7cc0834ee7098d793db0a196 (patch)
tree0bacf5d5df77a2825660a1165c400033575725a0 /sys/dev/uart/uart_core.c
parent27c75c8f21b68a051100fcfb4c1ead51af82f27c (diff)
downloadFreeBSD-src-49dd02f24778121c7cc0834ee7098d793db0a196.zip
FreeBSD-src-49dd02f24778121c7cc0834ee7098d793db0a196.tar.gz
Add support for using uart(4) for pulse capturing for the Pulse Per
Second (PPS) timing interface. The support is non-optional and by default uses the DCD line signal as the pulse input. A compile-time option (UART_PPS_ON_CTS) can be used to have uart(4) use the CTS line signal. Include <sys/timepps.h> in uart_bus.h to avoid having to add the inclusion of that header in all source files. Reviewed by: phk
Diffstat (limited to 'sys/dev/uart/uart_core.c')
-rw-r--r--sys/dev/uart/uart_core.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/sys/dev/uart/uart_core.c b/sys/dev/uart/uart_core.c
index 450313a..883bea2 100644
--- a/sys/dev/uart/uart_core.c
+++ b/sys/dev/uart/uart_core.c
@@ -162,6 +162,15 @@ uart_intr_sigchg(struct uart_softc *sc)
int new, old, sig;
sig = UART_GETSIG(sc);
+
+ if (sc->sc_pps.ppsparam.mode & PPS_CAPTUREBOTH) {
+ if (sig & UART_SIG_DPPS) {
+ pps_capture(&sc->sc_pps);
+ pps_event(&sc->sc_pps, (sig & UART_SIG_PPS) ?
+ PPS_CAPTUREASSERT : PPS_CAPTURECLEAR);
+ }
+ }
+
do {
old = sc->sc_ttypend;
new = old & ~UART_SIGMASK_STATE;
@@ -393,6 +402,9 @@ uart_bus_attach(device_t dev)
sc->sc_sysdev->stopbits);
}
+ sc->sc_pps.ppscap = PPS_CAPTUREBOTH;
+ pps_init(&sc->sc_pps);
+
error = (sc->sc_sysdev != NULL && sc->sc_sysdev->attach != NULL)
? (*sc->sc_sysdev->attach)(sc) : uart_tty_attach(sc);
if (error)
OpenPOWER on IntegriCloud