From owner-svn-src-head@freebsd.org Mon Aug 10 20:54:04 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 39E6799D96C; Mon, 10 Aug 2015 20:54:04 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2BB5F232; Mon, 10 Aug 2015 20:54:04 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t7AKs49R033911; Mon, 10 Aug 2015 20:54:04 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t7AKs4gh033910; Mon, 10 Aug 2015 20:54:04 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201508102054.t7AKs4gh033910@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Mon, 10 Aug 2015 20:54:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r286595 - head/sys/dev/uart X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Aug 2015 20:54:04 -0000 Author: ian Date: Mon Aug 10 20:54:03 2015 New Revision: 286595 URL: https://svnweb.freebsd.org/changeset/base/286595 Log: 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. Modified: head/sys/dev/uart/uart_core.c Modified: head/sys/dev/uart/uart_core.c ============================================================================== --- head/sys/dev/uart/uart_core.c Mon Aug 10 20:50:31 2015 (r286594) +++ head/sys/dev/uart/uart_core.c Mon Aug 10 20:54:03 2015 (r286595) @@ -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); } }