Skip to contentSkip to conversation

LinuxPPS & syscalls support

RFC New Rodolfo Giometti 1 participant 1 message Jun 15, 2007

Subsystems (2)
lore
Share & tools
lore

Rodolfo Giometti

author maintainer
#0 lore raw

RFC 1/1 LinuxPPS & syscalls support

Hello,

here my first proposal for LinuxPPS implemented with new specific syscalls.

I'd like some comments before sending a "definitive" patch. :)

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
arch/i386/kernel/syscall_table.S +5 -0
index 0772678..63c5fc1 100644
@@ -320,3 +320,8 @@ ENTRY(sys_call_table)
 	.long sys_getcpu
 	.long sys_epoll_pwait
 	.long sys_utimensat		/* 320 */
+	.long sys_time_pps_find
+	.long sys_time_pps_getparams
+	.long sys_time_pps_setparams
+	.long sys_time_pps_getcap
+	.long sys_time_pps_fetch	/* 325 */
drivers/pps/Kconfig +1 -1
index 54297e8..0f5c784 100644
@@ -5,7 +5,7 @@
 menu "PPS support"
 
 config PPS
-	tristate "PPS support"
+	bool "PPS support"
 	depends on EXPERIMENTAL
 	---help---
 	  PPS (Pulse Per Second) is a special pulse provided by some GPS
drivers/pps/clients/Kconfig +0 -8
index a87cd37..867df3a 100644
@@ -15,22 +15,14 @@ config PPS_CLIENT_KTIMER
 	  This driver can also be built as a module.  If so, the module
 	  will be called ktimer.o.
 
-comment "UART serial support (forced off)"
-	depends on ! (SERIAL_CORE != n && !(PPS = m && SERIAL_CORE = y))
-
 config PPS_CLIENT_UART
 	bool "UART serial support"
-	depends on SERIAL_CORE != n && !(PPS = m && SERIAL_CORE = y)
 	help
 	  If you say yes here you get support for a PPS source connected
 	  with the CD (Carrier Detect) pin of your serial port.
 
-comment "Parallel printer support (forced off)"
-	depends on !( PRINTER != n && !(PPS = m && PRINTER = y))
-
 config PPS_CLIENT_LP
 	bool "Parallel printer support"
-	depends on PRINTER != n && !(PPS = m && PRINTER = y)
 	help
 	  If you say yes here you get support for a PPS source connected
 	  with the interrupt pin of your parallel port.
drivers/pps/kapi.c +2 -1
index 098f329..dd24c31 100644
@@ -23,6 +23,7 @@
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/init.h>
+#include <linux/sched.h>
 #include <linux/time.h>
 #include <linux/pps.h>
 
@@ -146,7 +147,7 @@ void pps_unregister_source(struct pps_source_info_s *info)
 	pps_sysfs_remove_source_entry(info);
 
 	if (mutex_lock_interruptible(&pps_mutex))
-		return -EINTR;
+		return;
 	__pps_unregister_source(info);
 	mutex_unlock(&pps_mutex);
 }
drivers/pps/pps.c +250 -221

547 lines not on this page · raw message

include/asm-i386/unistd.h +6 -1
index bd21e79..d84b679 100644
@@ -326,10 +326,15 @@
 #define __NR_getcpu		318
 #define __NR_epoll_pwait	319
 #define __NR_utimensat		320
+#define __NR_time_pps_find	321
+#define __NR_time_pps_getparams	322
+#define __NR_time_pps_setparams	323
+#define __NR_time_pps_getcap	324
+#define __NR_time_pps_fetch	325
 
 #ifdef __KERNEL__
 
-#define NR_syscalls 321
+#define NR_syscalls 326
 
 #define __ARCH_WANT_IPC_PARSE_VERSION
 #define __ARCH_WANT_OLD_READDIR
include/linux/pps.h +11 -28
index 7b66881..c3b5209 100644
@@ -33,10 +33,8 @@
 
 #ifndef __KERNEL__
 #include <asm/types.h>
-#include <sys/socket.h>
 #include <sys/time.h>
 #endif
-#include <linux/netlink.h>
 
 #define PPS_API_VERS_2          2       /* LinuxPPS proposal, dated 2006-05 */
 #define PPS_API_VERS            PPS_API_VERS_2
@@ -107,35 +105,12 @@ struct pps_params {
  * Here begins the implementation-specific part!
  */
 
-struct pps_netlink_msg {
-	int cmd;			/* the command to execute */
-	int source;
-	char name[PPS_MAX_NAME_LEN];	/* symbolic name */
-	char path[PPS_MAX_NAME_LEN];	/* path of the connected device */
-	int consumer;			/* selected kernel consumer */
-	struct pps_params params;
-	int mode;			/* edge */
-	int tsformat;			/* format of time stamps */
-	struct pps_info info;
-	struct timespec timeout;
-	int ret;
-};
-#define PPSAPI_MAX_PAYLOAD	sizeof(struct pps_netlink_msg)
-
-#define PPS_CREATE		1
-#define PPS_DESTROY		2
-#define PPS_SETPARMS		3
-#define PPS_GETPARMS		4
-#define PPS_GETCAP		5
-#define PPS_FETCH		6
-#define PPS_KC_BIND		7
-#define PPS_FIND_SRC		8
-#define PPS_FIND_PATH		9
+#define PPS_FIND_SRC		1
+#define PPS_FIND_PATH		2
 
 #ifdef __KERNEL__
 
-#include <linux/socket.h>
-#include <net/sock.h>
+#include <linux/device.h>
 
 /*
  * Misc macros
@@ -225,4 +200,12 @@ extern void pps_sysfs_unregister(void);
 
 #endif /* __KERNEL__ */
 
+struct pps_findsource_s {
+	int *source;
+	char *name;
+	int namelen;
+	char *path;
+	int pathlen;
+}
+
 #endif /* _PPS_H_ */
include/linux/syscalls.h +13 -0
index 3139f44..e894540 100644
@@ -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);
@@ -605,6 +606,18 @@ asmlinkage long sys_set_robust_list(struct robust_list_head __user *head,
 				    size_t len);
 asmlinkage long sys_getcpu(unsigned __user *cpu, unsigned __user *node, struct getcpu_cache __user *cache);
 
+asmlinkage long sys_time_pps_find(int cmd, int __user *source,
+					char __user *name, int namelen,
+					char __user *path, int pathlen);
+asmlinkage long sys_time_pps_getparams(int source,
+					struct pps_params __user *params);
+asmlinkage long sys_time_pps_setparams(int source,
+					const struct pps_params __user *params);
+asmlinkage long sys_time_pps_getcap(int source, int __user *mode);
+asmlinkage long sys_time_pps_fetch(int source, const int tsformat,
+					struct pps_info __user *info,
+					const struct timespec __user *timeout);
+
 int kernel_execve(const char *filename, char *const argv[], char *const envp[]);
 
 #endif
kernel/sys_ni.c +7 -0
index d7306d0..2bbd244 100644
@@ -141,3 +141,10 @@ cond_syscall(compat_sys_migrate_pages);
 cond_syscall(sys_bdflush);
 cond_syscall(sys_ioprio_set);
 cond_syscall(sys_ioprio_get);
+
+/* 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);