Page MenuHomeFreeBSD

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

Authored by ian on Dec 9 2015, 7:51 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mar 6 2024, 9:52 PM
Unknown Object (File)
Jan 9 2024, 7:10 AM
Unknown Object (File)
Dec 20 2023, 2:41 AM
Unknown Object (File)
Nov 9 2023, 2:05 AM
Unknown Object (File)
Nov 7 2023, 7:20 PM
Unknown Object (File)
Nov 3 2023, 7:04 AM
Unknown Object (File)
Nov 3 2023, 6:57 AM
Unknown Object (File)
Nov 1 2023, 7:03 AM
Subscribers

Details

Summary

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

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
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.
share/man/man4/uart.4
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":
s/your/the/

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)

s/your/the/

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:

line.
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.