Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 46b402a0 authored by Alexander Gordeev's avatar Alexander Gordeev Committed by Linus Torvalds
Browse files

pps: add parallel port PPS signal generator



Add PPS signal generator which utilizes STROBE pin of a parallel port to
send PPS signals.  It uses parport abstraction layer and hrtimers to
precisely control the signal.

[akpm@linux-foundation.org: fix build]
Signed-off-by: default avatarAlexander Gordeev <lasaine@lvk.cs.msu.su>
Acked-by: default avatarRodolfo Giometti <giometti@linux.it>
Cc: john stultz <johnstul@us.ibm.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent a10203c6
Loading
Loading
Loading
Loading
+46 −0
Original line number Diff line number Diff line
@@ -170,3 +170,49 @@ and the run ppstest as follow:

Please, note that to compile userland programs you need the file timepps.h
(see Documentation/pps/).


Generators
----------

Sometimes one needs to be able not only to catch PPS signals but to produce
them also. For example, running a distributed simulation, which requires
computers' clock to be synchronized very tightly. One way to do this is to
invent some complicated hardware solutions but it may be neither necessary
nor affordable. The cheap way is to load a PPS generator on one of the
computers (master) and PPS clients on others (slaves), and use very simple
cables to deliver signals using parallel ports, for example.

Parallel port cable pinout:
pin	name	master      slave
1	STROBE	  *------     *
2	D0	  *     |     *
3	D1	  *     |     *
4	D2	  *     |     *
5	D3	  *     |     *
6	D4	  *     |     *
7	D5	  *     |     *
8	D6	  *     |     *
9	D7	  *     |     *
10	ACK	  *     ------*
11	BUSY	  *           *
12	PE	  *           *
13	SEL	  *           *
14	AUTOFD	  *           *
15	ERROR	  *           *
16	INIT	  *           *
17	SELIN	  *           *
18-25	GND	  *-----------*

Please note that parallel port interrupt occurs only on high->low transition,
so it is used for PPS assert edge. PPS clear edge can be determined only
using polling in the interrupt handler which actually can be done way more
precisely because interrupt handling delays can be quite big and random. So
current parport PPS generator implementation (pps_gen_parport module) is
geared towards using the clear edge for time synchronization.

Clear edge polling is done with disabled interrupts so it's better to select
delay between assert and clear edge as small as possible to reduce system
latencies. But if it is too small slave won't be able to capture clear edge
transition. The default of 30us should be good enough in most situations.
The delay can be selected using 'delay' pps_gen_parport module parameter.
+2 −0
Original line number Diff line number Diff line
@@ -41,4 +41,6 @@ config NTP_PPS

source drivers/pps/clients/Kconfig

source drivers/pps/generators/Kconfig

endmenu
+1 −1
Original line number Diff line number Diff line
@@ -5,6 +5,6 @@
pps_core-y			:= pps.o kapi.o sysfs.o
pps_core-$(CONFIG_NTP_PPS)	+= kc.o
obj-$(CONFIG_PPS)		:= pps_core.o
obj-y				+= clients/
obj-y				+= clients/ generators/

ccflags-$(CONFIG_PPS_DEBUG) := -DDEBUG
+17 −0
Original line number Diff line number Diff line
#
# PPS generators configuration
#

if PPS

comment "PPS generators support"

config PPS_GENERATOR_PARPORT
	tristate "Parallel port PPS signal generator"
	depends on PARPORT != n && GENERIC_TIME
	help
	  If you say yes here you get support for a PPS signal generator which
	  utilizes STROBE pin of a parallel port to send PPS signals. It uses
	  parport abstraction layer and hrtimers to precisely control the signal.

endif
+9 −0
Original line number Diff line number Diff line
#
# Makefile for PPS generators.
#

obj-$(CONFIG_PPS_GENERATOR_PARPORT) += pps_gen_parport.o

ifeq ($(CONFIG_PPS_DEBUG),y)
EXTRA_CFLAGS += -DDEBUG
endif
Loading