Skip to contentSkip to conversation

LinuxPPS core (Version 3): the PPS Linux implementation.

PATCH In review Rodolfo Giometti 5 participants 6 messages May 22, 2009 – May 27, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

This patch adds the PPS core support into Linux.

Currently I just propose the "core" so after inclusion we can add all other related stuff as suggested by several people in this list. :)

PPS means "pulse per second" and its API is specified by RFC 2783 (Pulse-Per-Second API for UNIX-like Operating Systems, Version 1.0).

The code has been tested with the NTPD program
(http://www.eecis.udel.edu/~mills/ntp/html/index.html) and several GPS antennae.

Changelog
=========

Version 2 -> 3
--------------

* include file splitted up.

Version 1 -> 2
--------------

* fix race during PPS source registration.

* PPS_CHECK removed.

* not needed check in pps_exit() removed.

* Printing stuff on exit removed.

Version [full patchset] -> 1
----------------------------

* stupid filenames removed.

* kernel-doc documentation of exported symbols.

* old BKL-locked ioctl removed.

* !uarg checks in the ioctls removed.

* pps.h revisited but not splitted, since several stuff are shared between kernel and user land (I hope this will not stop inclusion...)

Rodolfo

--

 Documentation/ABI/testing/sysfs-pps  |   73 +++++++
 Documentation/ioctl/ioctl-number.txt |    2 
 Documentation/pps/pps.txt            |  172 ++++++++++++++++++
 MAINTAINERS                          |    7 
 drivers/Kconfig                      |    2 
 drivers/Makefile                     |    1 
 drivers/pps/Kconfig                  |   33 +++
 drivers/pps/Makefile                 |    8 
 drivers/pps/kapi.c                   |  329 +++++++++++++++++++++++++++++++++++
 drivers/pps/pps.c                    |  312 +++++++++++++++++++++++++++++++++
 drivers/pps/sysfs.c                  |   98 ++++++++++
 include/linux/Kbuild                 |    1 
 include/linux/pps.h                  |  122 ++++++++++++
 include/linux/pps_kernel.h           |   89 +++++++++
 14 files changed, 1249 insertions(+)
#1 lore raw

PATCH 1/1 LinuxPPS core support.

This patch adds the kernel side of the PPS support currently named "LinuxPPS".

PPS means "pulse per second" and a PPS source is just a device which provides a high precision signal each second so that an application can use it to adjust system clock time.

Common use is the combination of the NTPD as userland program with a GPS receiver as PPS source to obtain a wallclock-time with sub-millisecond synchronisation to UTC.

To obtain this goal the userland programs shoud use the PPS API specification (RFC 2783 - Pulse-Per-Second API for UNIX-like Operating Systems, Version 1.0) which in part is implemented by this patch. It provides a set of chars devices, one per PPS source, which can be used to get the time signal. The RFC's functions can be implemented by accessing to these char devices.

---
 Documentation/ABI/testing/sysfs-pps  |   73 ++++++++
 Documentation/ioctl/ioctl-number.txt |    2 +
 Documentation/pps/pps.txt            |  172 ++++++++++++++++++
 MAINTAINERS                          |    7 +
 drivers/Kconfig                      |    2 +
 drivers/Makefile                     |    1 +
 drivers/pps/Kconfig                  |   33 ++++
 drivers/pps/Makefile                 |    8 +
 drivers/pps/kapi.c                   |  329 ++++++++++++++++++++++++++++++++++
 drivers/pps/pps.c                    |  312 ++++++++++++++++++++++++++++++++
 drivers/pps/sysfs.c                  |   98 ++++++++++
 include/linux/Kbuild                 |    1 +
 include/linux/pps.h                  |  122 +++++++++++++
 include/linux/pps_kernel.h           |   89 +++++++++
 14 files changed, 1249 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/ABI/testing/sysfs-pps
 create mode 100644 Documentation/pps/pps.txt
 create mode 100644 drivers/pps/Kconfig
 create mode 100644 drivers/pps/Makefile
 create mode 100644 drivers/pps/kapi.c
 create mode 100644 drivers/pps/pps.c
 create mode 100644 drivers/pps/sysfs.c
 create mode 100644 include/linux/pps.h
 create mode 100644 include/linux/pps_kernel.h
Documentation/ABI/testing/sysfs-pps new file +73 -0
new file mode 100644
index 0000000..25028c7
@@ -0,0 +1,73 @@
+What:		/sys/class/pps/
+Date:		February 2008
+Contact:	Rodolfo Giometti <[email protected]>
+Description:
+		The /sys/class/pps/ directory will contain files and
+		directories that will provide a unified interface to
+		the PPS sources.
+
+What:		/sys/class/pps/ppsX/
+Date:		February 2008
+Contact:	Rodolfo Giometti <[email protected]>
+Description:
+		The /sys/class/pps/ppsX/ directory is related to X-th
+		PPS source into the system. Each directory will
+		contain files to manage and control its PPS source.
+
+What:		/sys/class/pps/ppsX/assert
+Date:		February 2008
+Contact:	Rodolfo Giometti <[email protected]>
+Description:
+		The /sys/class/pps/ppsX/assert file reports the assert events
+		and the assert sequence number of the X-th source in the form:
+
+			<secs>.<nsec>#<sequence>
+
+		If the source has no assert events the content of this file
+		is empty.
+
+What:		/sys/class/pps/ppsX/clear
+Date:		February 2008
+Contact:	Rodolfo Giometti <[email protected]>
+Description:
+		The /sys/class/pps/ppsX/clear file reports the clear events
+		and the clear sequence number of the X-th source in the form:
+
+			<secs>.<nsec>#<sequence>
+
+		If the source has no clear events the content of this file
+		is empty.
+
+What:		/sys/class/pps/ppsX/mode
+Date:		February 2008
+Contact:	Rodolfo Giometti <[email protected]>
+Description:
+		The /sys/class/pps/ppsX/mode file reports the functioning
+		mode of the X-th source in hexadecimal encoding.
+
+		Please, refer to linux/include/linux/pps.h for further
+		info.
+
+What:		/sys/class/pps/ppsX/echo
+Date:		February 2008
+Contact:	Rodolfo Giometti <[email protected]>
+Description:
+		The /sys/class/pps/ppsX/echo file reports if the X-th does
+		or does not support an "echo" function.
+
+What:		/sys/class/pps/ppsX/name
+Date:		February 2008
+Contact:	Rodolfo Giometti <[email protected]>
+Description:
+		The /sys/class/pps/ppsX/name file reports the name of the
+		X-th source.
+
+What:		/sys/class/pps/ppsX/path
+Date:		February 2008
+Contact:	Rodolfo Giometti <[email protected]>
+Description:
+		The /sys/class/pps/ppsX/path file reports the path name of
+		the device connected with the X-th source.
+
+		If the source is not connected with any device the content
+		of this file is empty.
Documentation/ioctl/ioctl-number.txt +2 -0
index 1f779a2..7bb0d93 100644
@@ -149,6 +149,8 @@ Code	Seq#	Include File		Comments
 'p'	40-7F	linux/nvram.h
 'p'	80-9F				user-space parport
 					<mailto:[email protected]>
+'p'	a1-a4	linux/pps.h		LinuxPPS
+					<mailto:[email protected]>
 'q'	00-1F	linux/serio.h
 'q'	80-FF				Internet PhoneJACK, Internet LineJACK
 					<http://www.quicknet.net>
Documentation/pps/pps.txt new file +172 -0

172 lines not on this page · raw message

MAINTAINERS +7 -0
index 2b349ba..c9557c2 100644
@@ -4460,6 +4460,13 @@ S:	Maintained
 F:	drivers/net/pppol2tp.c
 F:	include/linux/if_pppol2tp.h
 
+PPS SUPPORT
+P:	Rodolfo Giometti
+M:	[email protected]
+W:	http://wiki.enneenne.com/index.php/LinuxPPS_support
+L:	[email protected] (subscribers-only)
+S:	Maintained
+
 PREEMPTIBLE KERNEL
 P:	Robert Love
 M:	[email protected]
drivers/Kconfig +2 -0
index 00cf955..e328e5b 100644
@@ -52,6 +52,8 @@ source "drivers/i2c/Kconfig"
 
 source "drivers/spi/Kconfig"
 
+source "drivers/pps/Kconfig"
+
 source "drivers/gpio/Kconfig"
 
 source "drivers/w1/Kconfig"
drivers/Makefile +1 -0
index 1266ead..61536b9 100644
@@ -72,6 +72,7 @@ obj-$(CONFIG_INPUT)		+= input/
 obj-$(CONFIG_I2O)		+= message/
 obj-$(CONFIG_RTC_LIB)		+= rtc/
 obj-y				+= i2c/ media/
+obj-$(CONFIG_PPS)		+= pps/
 obj-$(CONFIG_W1)		+= w1/
 obj-$(CONFIG_POWER_SUPPLY)	+= power/
 obj-$(CONFIG_HWMON)		+= hwmon/
drivers/pps/Kconfig new file +33 -0
new file mode 100644
index 0000000..cc2eb8e
@@ -0,0 +1,33 @@
+#
+# PPS support configuration
+#
+
+menu "PPS support"
+
+config PPS
+	tristate "PPS support"
+	depends on EXPERIMENTAL
+	---help---
+	  PPS (Pulse Per Second) is a special pulse provided by some GPS
+	  antennae. Userland can use it to get a high-precision time
+	  reference.
+
+	  Some antennae's PPS signals are connected with the CD (Carrier
+	  Detect) pin of the serial line they use to communicate with the
+	  host. In this case use the SERIAL_LINE client support.
+
+	  Some antennae's PPS signals are connected with some special host
+	  inputs so you have to enable the corresponding client support.
+
+	  To compile this driver as a module, choose M here: the module
+	  will be called pps_core.ko.
+
+config PPS_DEBUG
+	bool "PPS debugging messages"
+	depends on PPS
+	help
+	  Say Y here if you want the PPS support to produce a bunch of debug
+	  messages to the system log.  Select this if you are having a
+	  problem with PPS support and want to see more of what is going on.
+
+endmenu
drivers/pps/Makefile new file +8 -0
new file mode 100644
index 0000000..19ea582
@@ -0,0 +1,8 @@
+#
+# Makefile for the PPS core.
+#
+
+pps_core-y			:= pps.o kapi.o sysfs.o
+obj-$(CONFIG_PPS)		:= pps_core.o
+
+ccflags-$(CONFIG_PPS_DEBUG) := -DDEBUG
drivers/pps/kapi.c new file +329 -0

329 lines not on this page · raw message

drivers/pps/pps.c new file +312 -0

312 lines not on this page · raw message

drivers/pps/sysfs.c new file +98 -0

98 lines not on this page · raw message

include/linux/Kbuild +1 -0
index 3f0eaa3..3547c61 100644
@@ -307,6 +307,7 @@ unifdef-y += pmu.h
 unifdef-y += poll.h
 unifdef-y += ppp_defs.h
 unifdef-y += ppp-comp.h
+unifdef-y += pps.h
 unifdef-y += ptrace.h
 unifdef-y += qnx4_fs.h
 unifdef-y += quota.h
include/linux/pps.h new file +122 -0

122 lines not on this page · raw message

include/linux/pps_kernel.h new file +89 -0

89 lines not on this page · raw message

Signature · 1 line
1.5.6.3
#2 lore raw

Re: [PATCH 1/1] LinuxPPS core support.

Quoted 20 lines · On Fri, 22 May 2009 08:12:33 +0200 Rodolfo Giometti <[email protected]> wrote:

This patch adds the kernel side of the PPS support currently named "LinuxPPS".

PPS means "pulse per second" and a PPS source is just a device which provides a high precision signal each second so that an application can use it to adjust system clock time.

Common use is the combination of the NTPD as userland program with a GPS receiver as PPS source to obtain a wallclock-time with sub-millisecond synchronisation to UTC.

To obtain this goal the userland programs shoud use the PPS API specification (RFC 2783 - Pulse-Per-Second API for UNIX-like Operating Systems, Version 1.0) which in part is implemented by this patch. It provides a set of chars devices, one per PPS source, which can be used to get the time signal. The RFC's functions can be implemented by accessing to these char devices.

...

Quoted 14 lines
 Documentation/ABI/testing/sysfs-pps  |   73 ++++++++
 Documentation/ioctl/ioctl-number.txt |    2 +
 Documentation/pps/pps.txt            |  172 ++++++++++++++++++
 MAINTAINERS                          |    7 +
 drivers/Kconfig                      |    2 +
 drivers/Makefile                     |    1 +
 drivers/pps/Kconfig                  |   33 ++++
 drivers/pps/Makefile                 |    8 +
 drivers/pps/kapi.c                   |  329 ++++++++++++++++++++++++++++++++++
 drivers/pps/pps.c                    |  312 ++++++++++++++++++++++++++++++++
 drivers/pps/sysfs.c                  |   98 ++++++++++
 include/linux/Kbuild                 |    1 +
 include/linux/pps.h                  |  122 +++++++++++++
 include/linux/pps_kernel.h           |   89 +++++++++

Well it seems that Christoph's header file suggestion was addressed.

It's been a long time and there have been many reviews and comments. Have you been keeping track of them all?

If so, can you please let us know which review comments remain unaddressed, or were deliberately not addressed because you disagreed with them?

Thanks.

#3 lore raw

Re: [PATCH 1/1] LinuxPPS core support.

I'm happy with this now certainly

#4 lore raw

Re: [PATCH 1/1] LinuxPPS core support.

Quoted 1 line

I'm happy with this now certainly

Great to hear! So it will now be merged? For 2.6.31?

Thanks,

Folkert van Heusden

Signature · 4 lines
Ever wonder what is out there? Any alien races? Then please support
the seti@home project: setiathome.ssl.berkeley.edu
----------------------------------------------------------------------
Phone: +31-6-41278122, PGP-key: 1F28D8AE, www.vanheusden.com
maintainer
#5 lore raw

Re: [PATCH 1/1] LinuxPPS core support.

In reply to Andrew Morton
Quoted 1 line · Andrew Morton

Well it seems that Christoph's header file suggestion was addressed.

Yes, I fixed it.

Quoted 6 lines

It's been a long time and there have been many reviews and comments. Have you been keeping track of them all?

If so, can you please let us know which review comments remain unaddressed, or were deliberately not addressed because you disagreed with them?

I fixed everything but didn't include George Spelvin <[email protected]>'s pathes (see them here
http://ml.enneenne.com/pipermail/linuxpps/2009-February/002788.html)
because after a (very) long discussion (please, refer also to some private messages to you from myself and George) we agree to wait for a new patchset from him but, after several weeks, I still receive nothing so I decided to addres the header file issue and repropose my implementation which is currenlty used into several systems.

Ciao,

Rodolfo

Signature · 4 lines
GNU/Linux Solutions                  e-mail: [email protected]
Linux Device Driver                          [email protected]
Embedded Systems                     phone:  +39 349 2432127
UNIX programming                     skype:  rodolfo.giometti