Page MenuHomeFreeBSD

Add 'invert' and 'narrow-pulse' options to uart(4) PPS capture.

Authored by ian on Dec 9 2015, 7:51 PM.
Referenced Files
Unknown Object (File)
Apr 16 2017, 7:39 AM
Unknown Object (File)
Apr 15 2017, 8:09 PM
Unknown Object (File)
Feb 10 2017, 11:40 AM
Unknown Object (File)
Feb 6 2017, 3:25 AM
Unknown Object (File)
Sep 29 2016, 3:54 PM
Unknown Object (File)
Aug 31 2016, 9:13 PM
Unknown Object (File)
May 31 2016, 4:12 AM
Unknown Object (File)
May 20 2016, 3:40 PM



Restore PPS signal capture polarity to its historical norm, and add an option to invert the polarity in software. Also add an option to capture very narrow pulses by using the hardware's MSR delta-bit capability of latching line state changes.

This effectively reverts the mistake I made in r286595 which was based on empirical measurements made on hardware using TTL-level signaling, in which the logic levels are inverted from RS-232. Thus, this re-syncs the polarity with the requirements of RFC 2783, which is writen in terms of RS-232 signaling.

Narrow-pulse mode uses the ability of most ns8250 and similar chips to provide a delta indication in the modem status register. The hardware is able to notice and latch the change when the pulse width is shorter than interrupt latency, which results in the signal no longer being asserted by time the interrupt service code runs. When running in this mode we get notified only that "a pulse happened" so the driver synthesizes both an ASSERT and a CLEAR event (with the same timestamp for each). When the pulse width is about equal to the interrupt latency the driver may intermittantly see both edges of the pulse. To prevent generating spurious events, the driver implements a half-second lockout period after generating an event before it will generate another.

Test Plan

Tested (this time) on both TTL-level and RS-232-level uart connections, on x86 and arm hardware.

Diff Detail

rS FreeBSD src repository - subversion
Lint Not Applicable
Tests Not Applicable

Event Timeline

ian retitled this revision from to Add 'invert' and 'narrow-pulse' options to uart(4) PPS capture..
ian updated this object.
ian edited the test plan for this revision. (Show Details)
ian added a reviewer: gnn.
ian set the repository for this revision to rS FreeBSD src repository - subversion.
imp added a reviewer: imp.
This revision is now accepted and ready to land.Dec 9 2015, 9:00 PM
wblock added inline comments.
181 ↗(On Diff #11000)

s/The following/These/

191 ↗(On Diff #11000)

This is a little ambiguous. How about:

These extra bits can be ORed with the capture mode value to change capture options:

Not sure that's the right meaning, but it's going in the right direction.

199 ↗(On Diff #11000)

Avoid the informal "you" and "your":

201 ↗(On Diff #11000)

Needs a comma after "mode".

202 ↗(On Diff #11000)

Avoid asides:

state change.
Not all hardware has this capability.
205 ↗(On Diff #11000)

Needs a comma after "pulse". Not sure about the second use of "each". Should it be "an event of the same type"?

208 ↗(On Diff #11000)

Split the sentence:

each other.
This prevents spurious events when the hardware is intermittently
214 ↗(On Diff #11000)


219 ↗(On Diff #11000)

Try to avoid Latin abbreviations:

On an RS-232 line, ...
220 ↗(On Diff #11000)

Split the sentence instead of using a semicolon:

On a TTL connection, carrier...
223 ↗(On Diff #11000)

Avoid "you":

Generally speaking, when connecting a signal to a DB9 connector, it is
225 ↗(On Diff #11000)

Avoid "you" (note punctuation changes, too):

When connecting to header pins or an edge connector on an embedded board,
This revision was automatically updated to reflect the committed changes.