LinuxPPS version 4.0.0-rc3
Subsystems (6)
Rodolfo Giometti
maintainerPATCH 1/1 LinuxPPS version 4.0.0-rc3
Hello,
here my last version of LinuxPPS support against kernel 2.6.23 (ready for inclusion?).
All suggestions are welcomed. :)
Rodolfo
Signature · 4 lines
GNU/Linux Solutions e-mail: [email protected] Linux Device Driver [email protected] Embedded Systems [email protected] UNIX programming phone: +39 349 2432127
Documentation/pps/Makefile new file +27 -0
@@ -0,0 +1,27 @@ +TARGETS = ppstest ppsctl + +CFLAGS += -Wall -O2 -D_GNU_SOURCE +CFLAGS += -I . +CFLAGS += -ggdb + +# -- Actions section ---------------------------------------------------------- + +.PHONY : all depend dep + +all : .depend $(TARGETS) + +.depend depend dep : + $(CC) $(CFLAGS) -M $(TARGETS:=.c) > .depend + +ifeq (.depend,$(wildcard .depend)) +include .depend +endif + + +# -- Clean section ------------------------------------------------------------ + +.PHONY : clean + +clean : + rm -f *.o *~ core .depend + rm -f ${TARGETS}
Documentation/pps/pps.txt new file +211 -0
212 lines not on this page · raw message
Documentation/pps/ppsctl.c new file +61 -0
61 lines not on this page · raw message
Documentation/pps/ppstest.c new file +199 -0
199 lines not on this page · raw message
Documentation/pps/timepps.h new file +235 -0
235 lines not on this page · raw message
MAINTAINERS +7 -0
@@ -2903,6 +2903,13 @@ P: Michal Ostrowski M: [email protected] S: Maintained +PPS SUPPORT +P: Rodolfo Giometti +M: [email protected] +W: http://wiki.enneenne.com/index.php/LinuxPPS_support +L: [email protected] +S: Maintained + PREEMPTIBLE KERNEL P: Robert Love M: [email protected]
arch/i386/kernel/syscall_table.S +5 -0
@@ -323,3 +323,8 @@ ENTRY(sys_call_table) .long sys_signalfd .long sys_timerfd .long sys_eventfd + .long sys_time_pps_cmd + .long sys_time_pps_getparams /* 325 */ + .long sys_time_pps_setparams + .long sys_time_pps_getcap + .long sys_time_pps_fetch
drivers/Kconfig +2 -0
@@ -52,6 +52,8 @@ source "drivers/i2c/Kconfig" source "drivers/spi/Kconfig" +source "drivers/pps/Kconfig" + source "drivers/w1/Kconfig" source "drivers/hwmon/Kconfig"
drivers/Makefile +1 -0
@@ -60,6 +60,7 @@ obj-$(CONFIG_INPUT) += input/ obj-$(CONFIG_I2O) += message/ obj-$(CONFIG_RTC_LIB) += rtc/ obj-y += i2c/ +obj-$(CONFIG_PPS) += pps/ obj-$(CONFIG_W1) += w1/ obj-$(CONFIG_HWMON) += hwmon/ obj-$(CONFIG_PHONE) += telephony/
drivers/char/lp.c +58 -0
76 lines not on this page · raw message
drivers/pps/Kconfig new file +34 -0
@@ -0,0 +1,34 @@ +# +# Character device configuration +# + +menu "PPS support" + +config PPS + bool "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 an high 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. + + This PPS support can also be built as a module. If so, the module + will be called pps-core. + +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. + +source drivers/pps/clients/Kconfig + +endmenu
drivers/pps/Makefile new file +7 -0
@@ -0,0 +1,7 @@ +# +# Makefile for the PPS core. +# + +pps_core-objs += pps.o kapi.o sysfs.o +obj-$(CONFIG_PPS) += pps_core.o +obj-y += clients/
drivers/pps/clients/Kconfig new file +30 -0
@@ -0,0 +1,30 @@ +# +# LinuxPPS clients configuration +# + +if PPS + +comment "PPS clients support" + +config PPS_CLIENT_KTIMER + tristate "Kernel timer client (Testing client, use for debug)" + help + If you say yes here you get support for a PPS debugging client + which uses a kernel timer to generate the PPS signal. + + This driver can also be built as a module. If so, the module + will be called ktimer.o. + +config PPS_CLIENT_UART + bool "UART serial support" + help + If you say yes here you get support for a PPS source connected + with the CD (Carrier Detect) pin of your serial port. + +config PPS_CLIENT_LP + bool "Parallel printer support" + help + If you say yes here you get support for a PPS source connected + with the interrupt pin of your parallel port. + +endif
drivers/pps/clients/Makefile new file +6 -0
@@ -0,0 +1,6 @@ +# +# Makefile for miscellaneous I2C chip drivers. +# + +obj-$(CONFIG_PPS_CLIENT_KTIMER) += ktimer.o +
drivers/pps/clients/ktimer.c new file +113 -0
113 lines not on this page · raw message
drivers/pps/kapi.c new file +207 -0
207 lines not on this page · raw message
drivers/pps/pps.c new file +398 -0
398 lines not on this page · raw message
drivers/pps/sysfs.c new file +217 -0
217 lines not on this page · raw message
drivers/serial/8250.c +2 -0
@@ -2101,6 +2101,8 @@ serial8250_set_termios(struct uart_port *port, struct ktermios *termios, up->ier |=UART_IER_MSI ;if (up->capabilities &UART_CAP_UUE ) up->ier |=UART_IER_UUE |UART_IER_RTOIE ; +if (up->port.flags &UPF_HARDPPS_CD ) + up->ier |=UART_IER_MSI ;/* enable interrupts */ serial_out (up,UART_IER , up->ier);
drivers/serial/serial_core.c +68 -1
103 lines not on this page · raw message
include/asm-i386/unistd.h +6 -1
@@ -329,10 +329,15 @@#define __NR_signalfd 321#define __NR_timerfd 322#define __NR_eventfd 323 +#define __NR_time_pps_cmd 324 +#define __NR_time_pps_getparams 325 +#define __NR_time_pps_setparams 326 +#define __NR_time_pps_getcap 327 +#define __NR_time_pps_fetch 328#ifdef __KERNEL__ -#define NR_syscalls 324 +#define NR_syscalls 329#define __ARCH_WANT_IPC_PARSE_VERSION#define __ARCH_WANT_OLD_READDIR
include/linux/Kbuild +1 -0
@@ -293,6 +293,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/parport.h +12 -0
@@ -100,6 +100,7 @@ typedef enum {#include <linux/proc_fs.h> #include <linux/spinlock.h> #include <linux/wait.h> +#include <linux/pps.h> #include <asm/system.h> #include <asm/ptrace.h> #include <asm/semaphore.h>
@@ -327,6 +328,11 @@ struct parport {struct list_head full_list;struct parport *slaves[3 ]; + +#ifdef CONFIG_PPS_CLIENT_LP +struct pps_source_info_s pps_info; +int pps_source;/* PPS source ID */ +#endif };#define DEFAULT_SPIN_TIME 500/* us */
@@ -517,6 +523,12 @@ extern int parport_daisy_select (struct parport *port, int daisy, int mode);/* Lowlevel drivers _can_ call this support function to handle irqs. */ static __inline__void parport_generic_irq (int irq,struct parport *port) { +#ifdef CONFIG_PPS_CLIENT_LP +pps_event (port->pps_source,PPS_CAPTUREASSERT , port); +pps_dbg ("parport_pc: PPS assert event at %lu on source #%d" , + jiffies, port->pps_source); +#endif +parport_ieee1284_interrupt (irq, port);read_lock (&port->cad_lock);if (port->cad && port->cad->irq_func)
include/linux/pps.h new file +207 -0
207 lines not on this page · raw message
include/linux/serial_core.h +28 -5
@@ -153,6 +153,7 @@#include <linux/tty.h> #include <linux/mutex.h> #include <linux/sysrq.h> +#include <linux/pps.h> struct uart_port ;struct uart_info ;
@@ -232,6 +233,9 @@ struct uart_port {unsigned char regshift;/* reg offset shift */ unsigned char iotype;/* io access style */ unsigned char unused1; +#ifdef CONFIG_PPS_CLIENT_UART +int pps_source;/* PPS source ID */ +#endif #define UPIO_PORT (0)#define UPIO_HUB6 (1)
@@ -276,7 +280,8 @@ struct uart_port {#define UPF_IOREMAP ((__force upf_t) (1 << 31))#define UPF_CHANGE_MASK ((__force upf_t) (0x17fff)) -#define UPF_USR_MASK ((__force upf_t) (UPF_SPD_MASK|UPF_LOW_LATENCY)) +#define UPF_USR_MASK ((__force upf_t) (UPF_SPD_MASK|UPF_LOW_LATENCY\ + |UPF_HARDPPS_CD))unsigned int mctrl;/* current modem ctrl settings */ unsigned int timeout;/* character-based timeout */
@@ -308,6 +313,10 @@ struct uart_state {struct uart_info *info;struct uart_port *port; +#ifdef CONFIG_PPS_CLIENT_UART +struct pps_source_info_s pps_info; +#endif +struct mutex mutex; };
@@ -472,13 +481,27 @@ uart_handle_dcd_change(struct uart_port *port, unsigned int status) {struct uart_info *info = port->info; - port->icount.dcd++; +#ifdef CONFIG_PPS_CLIENT_UART +struct tty_driver *drv = port->info->tty->driver; -#ifdef CONFIG_HARD_PPS -if ((port->flags &UPF_HARDPPS_CD ) && status) -hardpps (); +if (port->flags &UPF_HARDPPS_CD ) { +if (status) { +pps_event (port->pps_source,PPS_CAPTUREASSERT , port); +pps_dbg ("%s%d: PPS assert event at %lu on source #%d" , + drv->driver_name, port->line, + jiffies, port->pps_source); + } +else { +pps_event (port->pps_source,PPS_CAPTURECLEAR , port); +pps_dbg ("%s%d: PPS clear event at %lu on source #%d" , + drv->driver_name, port->line, + jiffies, port->pps_source); + } + }#endif + port->icount.dcd++; +if (info->flags &UIF_CHECK_CD ) {if (status)wake_up_interruptible (&info->open_wait);
include/linux/syscalls.h +10 -0
@@ -65,6 +65,7 @@ struct getcpu_cache;#include <asm/signal.h> #include <linux/quota.h> #include <linux/key.h> +#include <linux/pps.h> asmlinkage long sys_time (time_t __user *tloc);asmlinkage long sys_stime (time_t __user *tptr);
@@ -611,6 +612,15 @@ asmlinkage long sys_timerfd(int ufd, int clockid, int flags, const struct itimerspec __user *utmr);asmlinkage long sys_eventfd (unsigned int count); +asmlinkage long sys_time_pps_cmd (int cmd,void __user *arg); +asmlinkage long sys_time_pps_getparams (int source, +struct pps_kparams __user *params); +asmlinkage long sys_time_pps_setparams (int source, +const struct pps_kparams __user *params); +asmlinkage long sys_time_pps_getcap (int source,int __user *mode); +asmlinkage long sys_time_pps_fetch (int source,struct pps_kinfo __user *info, +const struct pps_ktime __user *timeout); +int kernel_execve (const char *filename,char *const argv[],char *const envp[]);#endif
kernel/sys_ni.c +7 -0
@@ -148,3 +148,10 @@ cond_syscall(sys_timerfd);cond_syscall (compat_sys_signalfd);cond_syscall (compat_sys_timerfd);cond_syscall (sys_eventfd); + +/* PPS dependent */ +cond_syscall (sys_time_pps_find); +cond_syscall (sys_time_pps_getparams); +cond_syscall (sys_time_pps_setparams); +cond_syscall (sys_time_pps_getcap); +cond_syscall (sys_time_pps_fetch);