[Xenomai-git] Philippe Gerum : cobalt/posix/io: drop superfluous check

2014-10-30 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: 4d3d4b7f8246d6c1074956e9c37b51aebb0bdebc
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=4d3d4b7f8246d6c1074956e9c37b51aebb0bdebc

Author: Philippe Gerum r...@xenomai.org
Date:   Thu Oct 30 10:02:17 2014 +0100

cobalt/posix/io: drop superfluous check

---

 kernel/cobalt/posix/io.c |6 --
 1 file changed, 6 deletions(-)

diff --git a/kernel/cobalt/posix/io.c b/kernel/cobalt/posix/io.c
index 3a5e856..75c71fb 100644
--- a/kernel/cobalt/posix/io.c
+++ b/kernel/cobalt/posix/io.c
@@ -84,9 +84,6 @@ COBALT_SYSCALL(recvmsg, probing,
struct msghdr m;
ssize_t ret;
 
-   if (flags  MSG_CMSG_COMPAT)
-   return -EINVAL;
-
ret = __xn_safe_copy_from_user(m, umsg, sizeof(m));
if (ret)
return ret;
@@ -104,9 +101,6 @@ COBALT_SYSCALL(sendmsg, probing,
struct msghdr m;
int ret;
 
-   if (flags  MSG_CMSG_COMPAT)
-   return -EINVAL;
-
ret = __xn_safe_copy_from_user(m, umsg, sizeof(m));
 
return ret ?: rtdm_fd_sendmsg(fd, m, flags);


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://www.xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : cobalt/sched/procfs: prevent frequent overflow of timeout display

2014-10-30 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: 0a465a2a83d5ec19e524807f906e85296cfb7855
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=0a465a2a83d5ec19e524807f906e85296cfb7855

Author: Philippe Gerum r...@xenomai.org
Date:   Thu Oct 30 11:29:42 2014 +0100

cobalt/sched/procfs: prevent frequent overflow of timeout display

---

 kernel/cobalt/sched.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/cobalt/sched.c b/kernel/cobalt/sched.c
index 7cc5770..2c4c237 100644
--- a/kernel/cobalt/sched.c
+++ b/kernel/cobalt/sched.c
@@ -999,7 +999,7 @@ static int vfile_schedlist_show(struct 
xnvfile_snapshot_iterator *it,
 
if (p == NULL)
xnvfile_printf(it,
-  %-3s  %-6s %-5s  %-8s  %-5s %-8s  %-10s %s\n,
+  %-3s  %-6s %-5s  %-8s  %-5s %-12s  %-10s %s\n,
   CPU, PID, CLASS, TYPE, PRI, TIMEOUT,
   STAT, NAME);
else {
@@ -1008,7 +1008,7 @@ static int vfile_schedlist_show(struct 
xnvfile_snapshot_iterator *it,
xnthread_format_status(p-state, sbuf, sizeof(sbuf));
 
xnvfile_printf(it,
-  %3u  %-6d %-5s  %-8s  %-5s %-8s  %-10s 
%s%s%s\n,
+  %3u  %-6d %-5s  %-8s  %-5s %-12s  %-10s 
%s%s%s\n,
   p-cpu,
   p-pid,
   p-sched_class,


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://www.xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : cobalt/pipe: introduce uapi/ section

2014-10-30 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: 62e36a36382ffc29a22bdb53b4258eda947fbaff
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=62e36a36382ffc29a22bdb53b4258eda947fbaff

Author: Philippe Gerum r...@xenomai.org
Date:   Thu Oct 30 12:09:00 2014 +0100

cobalt/pipe: introduce uapi/ section

---

 include/cobalt/kernel/pipe.h   |   16 +-
 include/cobalt/uapi/kernel/Makefile.am |1 +
 include/cobalt/uapi/kernel/Makefile.in |1 +
 include/cobalt/uapi/kernel/pipe.h  |   37 
 include/rtdm/uapi/ipc.h|1 +
 5 files changed, 41 insertions(+), 15 deletions(-)

diff --git a/include/cobalt/kernel/pipe.h b/include/cobalt/kernel/pipe.h
index b781f71..01b4642 100644
--- a/include/cobalt/kernel/pipe.h
+++ b/include/cobalt/kernel/pipe.h
@@ -23,25 +23,11 @@
 #include linux/poll.h
 #include cobalt/kernel/synch.h
 #include cobalt/kernel/thread.h
+#include cobalt/uapi/kernel/pipe.h
 
 #define XNPIPE_NDEVS  CONFIG_XENO_OPT_PIPE_NRDEV
 #define XNPIPE_DEV_MAJOR  150
 
-#defineXNPIPE_IOCTL_BASE   'p'
-#define XNPIPEIOC_GET_NRDEV_IOW(XNPIPE_IOCTL_BASE, 0, int)
-#define XNPIPEIOC_IFLUSH   _IO(XNPIPE_IOCTL_BASE,1)
-#define XNPIPEIOC_OFLUSH   _IO(XNPIPE_IOCTL_BASE,2)
-#define XNPIPEIOC_FLUSHXNPIPEIOC_OFLUSH
-#define XNPIPEIOC_SETSIG   _IO(XNPIPE_IOCTL_BASE,3)
-
-#define XNPIPE_NORMAL  0x0
-#define XNPIPE_URGENT  0x1
-
-#define XNPIPE_IFLUSH  0x1
-#define XNPIPE_OFLUSH  0x2
-
-#define XNPIPE_MINOR_AUTO  -1
-
 #define XNPIPE_KERN_CONN 0x1
 #define XNPIPE_KERN_LCLOSE   0x2
 #define XNPIPE_USER_CONN 0x4
diff --git a/include/cobalt/uapi/kernel/Makefile.am 
b/include/cobalt/uapi/kernel/Makefile.am
index e98a735..12e1b37 100644
--- a/include/cobalt/uapi/kernel/Makefile.am
+++ b/include/cobalt/uapi/kernel/Makefile.am
@@ -3,6 +3,7 @@ includesubdir = $(includedir)/cobalt/uapi/kernel
 includesub_HEADERS =   \
heap.h  \
limits.h\
+   pipe.h  \
synch.h \
thread.h\
trace.h \
diff --git a/include/cobalt/uapi/kernel/Makefile.in 
b/include/cobalt/uapi/kernel/Makefile.in
index 0edff6d..11f9251 100644
--- a/include/cobalt/uapi/kernel/Makefile.in
+++ b/include/cobalt/uapi/kernel/Makefile.in
@@ -336,6 +336,7 @@ includesubdir = $(includedir)/cobalt/uapi/kernel
 includesub_HEADERS = \
heap.h  \
limits.h\
+   pipe.h  \
synch.h \
thread.h\
trace.h \
diff --git a/include/cobalt/uapi/kernel/pipe.h 
b/include/cobalt/uapi/kernel/pipe.h
new file mode 100644
index 000..688ee0c
--- /dev/null
+++ b/include/cobalt/uapi/kernel/pipe.h
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2014 Philippe Gerum r...@xenomai.org.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.
+ */
+#ifndef _COBALT_UAPI_KERNEL_PIPE_H
+#define _COBALT_UAPI_KERNEL_PIPE_H
+
+#defineXNPIPE_IOCTL_BASE   'p'
+
+#define XNPIPEIOC_GET_NRDEV_IOW(XNPIPE_IOCTL_BASE, 0, int)
+#define XNPIPEIOC_IFLUSH   _IO(XNPIPE_IOCTL_BASE, 1)
+#define XNPIPEIOC_OFLUSH   _IO(XNPIPE_IOCTL_BASE, 2)
+#define XNPIPEIOC_FLUSHXNPIPEIOC_OFLUSH
+#define XNPIPEIOC_SETSIG   _IO(XNPIPE_IOCTL_BASE, 3)
+
+#define XNPIPE_NORMAL  0x0
+#define XNPIPE_URGENT  0x1
+
+#define XNPIPE_IFLUSH  0x1
+#define XNPIPE_OFLUSH  0x2
+
+#define XNPIPE_MINOR_AUTO  (-1)
+
+#endif /* !_COBALT_UAPI_KERNEL_PIPE_H */
diff --git a/include/rtdm/uapi/ipc.h b/include/rtdm/uapi/ipc.h
index bdef4de..a558150 100644
--- a/include/rtdm/uapi/ipc.h
+++ b/include/rtdm/uapi/ipc.h
@@ -393,6 +393,7 @@ int getpeername__AF_RTIPC(int sockfd, struct sockaddr_ipc 
*addr, socklen_t *addr
 /** @} */
 
 #include cobalt/uapi/kernel/types.h
+#include cobalt/uapi/kernel/pipe.h
 #include rtdm/rtdm.h
 
 /* Address family */


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://www.xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : pipe-test

2014-10-30 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: 6ff16413e32afd5b0eafda40cff07f09f7af37a7
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=6ff16413e32afd5b0eafda40cff07f09f7af37a7

Author: Philippe Gerum r...@xenomai.org
Date:   Thu Oct 30 14:34:15 2014 +0100

pipe-test

---

 lib/alchemy/testsuite/pipe-1.c |  101 
 1 file changed, 101 insertions(+)

diff --git a/lib/alchemy/testsuite/pipe-1.c b/lib/alchemy/testsuite/pipe-1.c
new file mode 100644
index 000..3b9b183
--- /dev/null
+++ b/lib/alchemy/testsuite/pipe-1.c
@@ -0,0 +1,101 @@
+#include stdio.h
+#include stdlib.h
+#include fcntl.h
+#include copperplate/traceobj.h
+#include alchemy/task.h
+#include alchemy/pipe.h
+
+static struct traceobj trobj;
+
+static RT_TASK t_real;
+
+static RT_PIPE pipe;
+
+static pthread_t t_reg;
+
+static int minor;
+
+struct pipe_message {
+   int value;
+};
+
+static void realtime_task(void *arg)
+{
+   struct pipe_message m;
+   int ret, seq;
+
+   traceobj_enter(trobj);
+
+   ret = rt_pipe_bind(pipe, pipe, TM_INFINITE);
+   traceobj_assert(trobj, ret == 0);
+
+   while (seq  16) {
+   ret = rt_pipe_read(pipe, m, sizeof(m), TM_INFINITE);
+   traceobj_assert(trobj, ret == sizeof(m));
+   traceobj_assert(trobj, m.value == seq);
+   ret = rt_pipe_write(pipe, m, sizeof(m), P_NORMAL);
+   traceobj_assert(trobj, ret == sizeof(m));
+   seq = m.value++;
+   }
+
+   pthread_cancel(t_reg);
+
+   traceobj_exit(trobj);
+}
+
+static void *regular_thread(void *arg)
+{
+   struct pipe_message m;
+   int fd, seq = 0;
+   ssize_t ret;
+   char *rtp;
+
+   asprintf(rtp, /dev/rtp%d, minor);
+
+   fd = open(rtp, O_RDWR);
+   free(rtp);
+   traceobj_assert(trobj, fd = 0);
+
+   for (;;) {
+   printf(sending message #%d\n, seq);
+   m.value = seq++;
+   ret = write(fd, m, sizeof(m));
+   traceobj_assert(trobj, ret == sizeof(m));
+   ret = read(fd, m, sizeof(m));
+   traceobj_assert(trobj, ret == sizeof(m));
+   printf(read %d vs %d\n, m.value, seq);
+   traceobj_assert(trobj, m.value == seq);
+   }
+
+   return NULL;
+}
+
+int main(int argc, char *const argv[])
+{
+   int ret;
+
+   traceobj_init(trobj, argv[0], 0);
+
+   ret = rt_pipe_create(pipe, pipe, P_MINOR_AUTO, 0);
+   traceobj_assert(trobj, ret = 0);
+
+   ret = rt_pipe_delete(pipe);
+   traceobj_assert(trobj, ret == 0);
+
+   ret = rt_task_create(t_real, realtime, 0,  10, 0);
+   traceobj_assert(trobj, ret == 0);
+
+   ret = rt_task_start(t_real, realtime_task, NULL);
+   traceobj_assert(trobj, ret == 0);
+
+   ret = rt_pipe_create(pipe, pipe, P_MINOR_AUTO, 16384);
+   traceobj_assert(trobj, ret = 0);
+   minor = ret;
+
+   ret = pthread_create(t_reg, NULL, regular_thread, NULL);
+   traceobj_assert(trobj, ret == 0);
+
+   traceobj_join(trobj);
+
+   exit(0);
+}


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://www.xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : drivers/ipc/xddp: fix memory leak on connection release

2014-10-30 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: 65ec540905a6bc56a02c3d5ae87ce0b72b1516a3
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=65ec540905a6bc56a02c3d5ae87ce0b72b1516a3

Author: Philippe Gerum r...@xenomai.org
Date:   Thu Oct 30 14:44:07 2014 +0100

drivers/ipc/xddp: fix memory leak on connection release

---

 kernel/drivers/ipc/xddp.c |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/kernel/drivers/ipc/xddp.c b/kernel/drivers/ipc/xddp.c
index 8f1333d..efb4a41 100644
--- a/kernel/drivers/ipc/xddp.c
+++ b/kernel/drivers/ipc/xddp.c
@@ -207,7 +207,8 @@ static void __xddp_release_handler(void *skarg) /* nklock 
free */
poolsz = xnheap_get_size(sk-privpool);
xnheap_destroy(sk-privpool);
free_pages_exact(poolmem, poolsz);
-   }
+   } else if (sk-buffer)
+   xnfree(sk-buffer);
 
kfree(sk);
 }


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://www.xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : pipe-test

2014-10-30 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: 54aaa5d673757d93ae7f8ed53d7006f279f52916
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=54aaa5d673757d93ae7f8ed53d7006f279f52916

Author: Philippe Gerum r...@xenomai.org
Date:   Thu Oct 30 14:34:27 2014 +0100

pipe-test

---

 lib/alchemy/testsuite/Makefile |   43 
 1 file changed, 22 insertions(+), 21 deletions(-)

diff --git a/lib/alchemy/testsuite/Makefile b/lib/alchemy/testsuite/Makefile
index 1014741..98de605 100644
--- a/lib/alchemy/testsuite/Makefile
+++ b/lib/alchemy/testsuite/Makefile
@@ -11,27 +11,28 @@ ifeq ($(prefix),)
 $(error Please add xenomai-install-path/bin to your PATH variable or specify 
DESTDIR)
 endif
 
-TESTS :=   \
-   task-1  \
-   task-2  \
-   task-3  \
-   task-4  \
-   task-5  \
-   task-6  \
-   task-7  \
-   task-8  \
-   task-9  \
-   task-10 \
-   mq-1\
-   mq-2\
-   mq-3\
-   alarm-1 \
-   sem-1   \
-   sem-2   \
-   mutex-1 \
-   event-1 \
-   heap-1  \
-   buffer-1
+TESTS :=   \
+   task-1  \
+   task-2  \
+   task-3  \
+   task-4  \
+   task-5  \
+   task-6  \
+   task-7  \
+   task-8  \
+   task-9  \
+   task-10 \
+   mq-1\
+   mq-2\
+   mq-3\
+   alarm-1 \
+   sem-1   \
+   sem-2   \
+   mutex-1 \
+   event-1 \
+   heap-1  \
+   buffer-1\
+   pipe-1
 
 CFLAGS := $(shell DESTDIR=$(DESTDIR) $(XENO_CONFIG) --skin=alchemy --cflags) -g
 LDFLAGS := $(shell DESTDIR=$(DESTDIR) $(XENO_CONFIG) --skin=alchemy --ldflags)


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://www.xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : drivers/ipc/xddp: fix memory leak on connection release

2014-10-30 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: caf0a0b4a3f279e3e4bd42e6b62bc09fab4fba94
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=caf0a0b4a3f279e3e4bd42e6b62bc09fab4fba94

Author: Philippe Gerum r...@xenomai.org
Date:   Thu Oct 30 14:44:07 2014 +0100

drivers/ipc/xddp: fix memory leak on connection release

---

 kernel/drivers/ipc/xddp.c |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/kernel/drivers/ipc/xddp.c b/kernel/drivers/ipc/xddp.c
index 8f1333d..efb4a41 100644
--- a/kernel/drivers/ipc/xddp.c
+++ b/kernel/drivers/ipc/xddp.c
@@ -207,7 +207,8 @@ static void __xddp_release_handler(void *skarg) /* nklock 
free */
poolsz = xnheap_get_size(sk-privpool);
xnheap_destroy(sk-privpool);
free_pages_exact(poolmem, poolsz);
-   }
+   } else if (sk-buffer)
+   xnfree(sk-buffer);
 
kfree(sk);
 }


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://www.xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : lib/cobalt: fix ioctl() prototype

2014-10-30 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: d5af062a1755f83e09cf380e8f4cac7cef5cdde0
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=d5af062a1755f83e09cf380e8f4cac7cef5cdde0

Author: Philippe Gerum r...@xenomai.org
Date:   Thu Oct 30 15:32:16 2014 +0100

lib/cobalt: fix ioctl() prototype

---

 include/cobalt/sys/ioctl.h |2 +-
 lib/cobalt/rtdm.c  |4 ++--
 lib/cobalt/wrappers.c  |2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/include/cobalt/sys/ioctl.h b/include/cobalt/sys/ioctl.h
index 00c9735..553aa56 100644
--- a/include/cobalt/sys/ioctl.h
+++ b/include/cobalt/sys/ioctl.h
@@ -27,7 +27,7 @@
 extern C {
 #endif
 
-COBALT_DECL(int, ioctl(int fildes, unsigned long int request, ...));
+COBALT_DECL(int, ioctl(int fildes, unsigned int request, ...));
 
 #ifdef __cplusplus
 }
diff --git a/lib/cobalt/rtdm.c b/lib/cobalt/rtdm.c
index 26c271a..4e1e24e 100644
--- a/lib/cobalt/rtdm.c
+++ b/lib/cobalt/rtdm.c
@@ -98,7 +98,7 @@ COBALT_IMPL(int, close, (int fd))
return __STD(close(fd));
 }
 
-static int do_ioctl(int fd, unsigned long request, void *arg)
+static int do_ioctl(int fd, unsigned int request, void *arg)
 {
int ret, oldtype;
 
@@ -129,7 +129,7 @@ COBALT_IMPL(int, fcntl, (int fd, int cmd, ...))
return __STD(fcntl(fd, cmd, arg));
 }
 
-COBALT_IMPL(int, ioctl, (int fd, unsigned long int request, ...))
+COBALT_IMPL(int, ioctl, (int fd, unsigned int request, ...))
 {
va_list ap;
void *arg;
diff --git a/lib/cobalt/wrappers.c b/lib/cobalt/wrappers.c
index 30522a4..106b466 100644
--- a/lib/cobalt/wrappers.c
+++ b/lib/cobalt/wrappers.c
@@ -183,7 +183,7 @@ int __real_fcntl(int fd, int cmd, ...)
 }
 
 __weak
-int __real_ioctl(int fd, unsigned long int request, ...)
+int __real_ioctl(int fd, unsigned int request, ...)
 {
va_list ap;
void *arg;


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://www.xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : cobalt/kernel, lib/cobalt: drop sc_cobalt_info syscall

2014-10-30 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: 6cd480017f082ff0eb5acbc621849646d865c222
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=6cd480017f082ff0eb5acbc621849646d865c222

Author: Philippe Gerum r...@xenomai.org
Date:   Thu Oct 30 15:24:38 2014 +0100

cobalt/kernel, lib/cobalt: drop sc_cobalt_info syscall

This syscall had no point, given that the reported information is
purely static. sc_cobalt_bind is the right place to pass this
information back to userland which needs it only once, in order to
bootstrap lib/cobalt.

---

 include/cobalt/uapi/asm-generic/features.h |   22 --
 include/cobalt/uapi/asm-generic/syscall.h  |9 ++---
 include/cobalt/uapi/syscall.h  |2 +-
 kernel/cobalt/posix/syscall.c  |   16 +++-
 lib/cobalt/init.c  |   14 ++
 lib/cobalt/umm.c   |   24 
 lib/cobalt/umm.h   |4 +++-
 7 files changed, 31 insertions(+), 60 deletions(-)

diff --git a/include/cobalt/uapi/asm-generic/features.h 
b/include/cobalt/uapi/asm-generic/features.h
index 797e4ce..f62b4b1 100644
--- a/include/cobalt/uapi/asm-generic/features.h
+++ b/include/cobalt/uapi/asm-generic/features.h
@@ -23,16 +23,26 @@
 #define XNFEAT_STRING_LEN 64
 
 struct cobalt_featinfo {
-   __u32 feat_abirev;  /* ABI revision level. */
-   __u32 feat_all; /* Available feature set. */
-   __u32 feat_man; /* Mandatory features (when requested). */
-   __u32 feat_req; /* Requested feature set. */
-   __u32 feat_mis; /* Missing features. */
+   /** Real-time clock frequency */
+   __u64 clock_freq;
+   /** Offset of nkvdso in the sem heap. */
+   __u32 vdso_offset;
+   /** ABI revision level. */
+   __u32 feat_abirev;
+   /** Available feature set. */
+   __u32 feat_all;
+   /** Mandatory features (when requested). */
+   __u32 feat_man;
+   /** Requested feature set. */
+   __u32 feat_req;
+   /** Missing features. */
+   __u32 feat_mis;
char feat_all_s[XNFEAT_STRING_LEN];
char feat_man_s[XNFEAT_STRING_LEN];
char feat_req_s[XNFEAT_STRING_LEN];
char feat_mis_s[XNFEAT_STRING_LEN];
-   struct cobalt_featinfo_archdep feat_arch; /* Arch-dep extension. */
+   /* Architecture-specific features. */
+   struct cobalt_featinfo_archdep feat_arch;
 };
 
 #define __xn_feat_smp 0x8000
diff --git a/include/cobalt/uapi/asm-generic/syscall.h 
b/include/cobalt/uapi/asm-generic/syscall.h
index 0cdb032..b38b241 100644
--- a/include/cobalt/uapi/asm-generic/syscall.h
+++ b/include/cobalt/uapi/asm-generic/syscall.h
@@ -26,9 +26,9 @@
 
 struct cobalt_bindreq {
/** Features userland requires. */
-   int feat_req;
+   __u32 feat_req;
/** ABI revision userland uses. */
-   int abi_rev;
+   __u32 abi_rev;
/** Features the Cobalt core provides. */
struct cobalt_featinfo feat_ret;
 };
@@ -36,9 +36,4 @@ struct cobalt_bindreq {
 #define COBALT_SECONDARY  0
 #define COBALT_PRIMARY1
 
-struct cobalt_sysinfo {
-   __u64 clockfreq;/* Real-time clock frequency */
-   __u32 vdso; /* Offset of nkvdso in the sem heap */
-};
-
 #endif /* !_COBALT_UAPI_ASM_GENERIC_SYSCALL_H */
diff --git a/include/cobalt/uapi/syscall.h b/include/cobalt/uapi/syscall.h
index 0f74f37..e907c4b 100644
--- a/include/cobalt/uapi/syscall.h
+++ b/include/cobalt/uapi/syscall.h
@@ -110,7 +110,7 @@
 #define sc_cobalt_select   87
 #define sc_cobalt_migrate  88
 #define sc_cobalt_archcall 89
-#define sc_cobalt_info 90
+/* 90 unimp */
 #define sc_cobalt_trace91
 #define sc_cobalt_sysctl   92
 #define sc_cobalt_get_current  93
diff --git a/kernel/cobalt/posix/syscall.c b/kernel/cobalt/posix/syscall.c
index 60a385b..03ec81d 100644
--- a/kernel/cobalt/posix/syscall.c
+++ b/kernel/cobalt/posix/syscall.c
@@ -130,17 +130,6 @@ static COBALT_SYSCALL(migrate, current, int, (int domain))
return 0;
 }
 
-static COBALT_SYSCALL(info, lostage,
- int, (struct cobalt_sysinfo __user *u_info))
-{
-   struct cobalt_sysinfo info;
-
-   info.clockfreq = xnarch_machdata.clock_freq;
-   info.vdso = cobalt_umm_offset(cobalt_ppd_get(1)-umm, nkvdso);
-
-   return __xn_safe_copy_to_user(u_info, info, sizeof(info));
-}
-
 static COBALT_SYSCALL(trace, current,
  int, (int op, unsigned long a1,
unsigned long a2, unsigned long a3))
@@ -341,6 +330,9 @@ static COBALT_SYSCALL(bind, lostage,
f-feat_abirev = XENOMAI_ABI_REV;
collect_arch_features(f);
 
+   f-clock_freq = xnarch_machdata.clock_freq;
+   f-vdso_offset = cobalt_umm_offset(cobalt_ppd_get(1)-umm, nkvdso);
+
if 

[Xenomai-git] Jan Kiszka : cobalt/x86: Fix section mismatch warning for mach_x86_c1e_disable

2014-10-30 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: 03a3c26475e9d2045ea2432254d610298cba9a6f
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=03a3c26475e9d2045ea2432254d610298cba9a6f

Author: Jan Kiszka jan.kis...@siemens.com
Date:   Wed Jul  9 17:50:30 2014 +0200

cobalt/x86: Fix section mismatch warning for mach_x86_c1e_disable

mach_x86_c1e_disable is called from non-__init function mach_x86_init,
thus can't be tagged as __init. mach_x86_init can't be converted as it
is referenced by the persistent xnarch_machdesc structure.

Signed-off-by: Jan Kiszka jan.kis...@siemens.com

---

 kernel/cobalt/arch/x86/c1e.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/cobalt/arch/x86/c1e.c b/kernel/cobalt/arch/x86/c1e.c
index 9aa4c66..9bd4e92 100644
--- a/kernel/cobalt/arch/x86/c1e.c
+++ b/kernel/cobalt/arch/x86/c1e.c
@@ -56,7 +56,7 @@ static void c1e_promotion_disable(void *dummy)
wrmsrl(MSR_IA32_POWER_CTL, msr_bits);
 }
 
-void __init mach_x86_c1e_disable(void)
+void mach_x86_c1e_disable(void)
 {
const struct x86_cpu_id *id;
 


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://www.xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : cobalt: bump ABI revision level

2014-10-30 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: 08103dd9d9f72d7f8a798c27eb98327ff5f4f994
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=08103dd9d9f72d7f8a798c27eb98327ff5f4f994

Author: Philippe Gerum r...@xenomai.org
Date:   Thu Oct 30 16:38:42 2014 +0100

cobalt: bump ABI revision level

---

 kernel/cobalt/arch/arm/include/asm/xenomai/uapi/features.h  |2 +-
 kernel/cobalt/arch/blackfin/include/asm/xenomai/uapi/features.h |2 +-
 kernel/cobalt/arch/nios2/include/asm/xenomai/uapi/features.h|2 +-
 kernel/cobalt/arch/powerpc/include/asm/xenomai/uapi/features.h  |2 +-
 kernel/cobalt/arch/sh/include/asm/xenomai/uapi/features.h   |2 +-
 kernel/cobalt/arch/x86/include/asm/xenomai/uapi/features.h  |2 +-
 6 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/kernel/cobalt/arch/arm/include/asm/xenomai/uapi/features.h 
b/kernel/cobalt/arch/arm/include/asm/xenomai/uapi/features.h
index 1a3baca..3e98f75 100644
--- a/kernel/cobalt/arch/arm/include/asm/xenomai/uapi/features.h
+++ b/kernel/cobalt/arch/arm/include/asm/xenomai/uapi/features.h
@@ -22,7 +22,7 @@
 #define _COBALT_ARM_ASM_UAPI_FEATURES_H
 
 /* The ABI revision level we use on this arch. */
-#define XENOMAI_ABI_REV   10UL
+#define XENOMAI_ABI_REV   11UL
 
 #define XENOMAI_FEAT_DEP (__xn_feat_generic_mask)
 
diff --git a/kernel/cobalt/arch/blackfin/include/asm/xenomai/uapi/features.h 
b/kernel/cobalt/arch/blackfin/include/asm/xenomai/uapi/features.h
index aaabe1b..9160d5c 100644
--- a/kernel/cobalt/arch/blackfin/include/asm/xenomai/uapi/features.h
+++ b/kernel/cobalt/arch/blackfin/include/asm/xenomai/uapi/features.h
@@ -19,7 +19,7 @@
 #define _COBALT_BLACKFIN_ASM_UAPI_FEATURES_H
 
 /* The ABI revision level we use on this arch. */
-#define XENOMAI_ABI_REV   10UL
+#define XENOMAI_ABI_REV   11UL
 
 #define XENOMAI_FEAT_DEP  __xn_feat_generic_mask
 
diff --git a/kernel/cobalt/arch/nios2/include/asm/xenomai/uapi/features.h 
b/kernel/cobalt/arch/nios2/include/asm/xenomai/uapi/features.h
index cfeb0c2..da15782 100644
--- a/kernel/cobalt/arch/nios2/include/asm/xenomai/uapi/features.h
+++ b/kernel/cobalt/arch/nios2/include/asm/xenomai/uapi/features.h
@@ -21,7 +21,7 @@
 #include linux/types.h
 
 /* The ABI revision level we use on this arch. */
-#define XENOMAI_ABI_REV   9UL
+#define XENOMAI_ABI_REV   10UL
 
 #define XENOMAI_FEAT_DEP  __xn_feat_generic_mask
 
diff --git a/kernel/cobalt/arch/powerpc/include/asm/xenomai/uapi/features.h 
b/kernel/cobalt/arch/powerpc/include/asm/xenomai/uapi/features.h
index 8a2aee7..1944dde 100644
--- a/kernel/cobalt/arch/powerpc/include/asm/xenomai/uapi/features.h
+++ b/kernel/cobalt/arch/powerpc/include/asm/xenomai/uapi/features.h
@@ -19,7 +19,7 @@
 #define _COBALT_POWERPC_ASM_UAPI_FEATURES_H
 
 /* The ABI revision level we use on this arch. */
-#define XENOMAI_ABI_REV   10UL
+#define XENOMAI_ABI_REV   11UL
 
 #define XENOMAI_FEAT_DEP  __xn_feat_generic_mask
 
diff --git a/kernel/cobalt/arch/sh/include/asm/xenomai/uapi/features.h 
b/kernel/cobalt/arch/sh/include/asm/xenomai/uapi/features.h
index 5d1500f..54ae32b 100644
--- a/kernel/cobalt/arch/sh/include/asm/xenomai/uapi/features.h
+++ b/kernel/cobalt/arch/sh/include/asm/xenomai/uapi/features.h
@@ -21,7 +21,7 @@
 #include linux/types.h
 
 /* The ABI revision level we use on this arch. */
-#define XENOMAI_ABI_REV   7UL
+#define XENOMAI_ABI_REV   8UL
 
 #define XENOMAI_FEAT_DEP  __xn_feat_generic_mask
 
diff --git a/kernel/cobalt/arch/x86/include/asm/xenomai/uapi/features.h 
b/kernel/cobalt/arch/x86/include/asm/xenomai/uapi/features.h
index dba7921..32e1b93 100644
--- a/kernel/cobalt/arch/x86/include/asm/xenomai/uapi/features.h
+++ b/kernel/cobalt/arch/x86/include/asm/xenomai/uapi/features.h
@@ -19,7 +19,7 @@
 #define _COBALT_X86_ASM_UAPI_FEATURES_H
 
 /* The ABI revision level we use on this arch. */
-#define XENOMAI_ABI_REV   10UL
+#define XENOMAI_ABI_REV   11UL
 
 #define XENOMAI_FEAT_DEP  __xn_feat_generic_mask
 


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://www.xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : cobalt/syscall: compact syscall table

2014-10-30 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: 45689e3b46298ba1cd746851ff953b35dbba84ae
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=45689e3b46298ba1cd746851ff953b35dbba84ae

Author: Philippe Gerum r...@xenomai.org
Date:   Thu Oct 30 16:35:40 2014 +0100

cobalt/syscall: compact syscall table

---

 include/cobalt/uapi/syscall.h |  176 -
 1 file changed, 86 insertions(+), 90 deletions(-)

diff --git a/include/cobalt/uapi/syscall.h b/include/cobalt/uapi/syscall.h
index e907c4b..18bb358 100644
--- a/include/cobalt/uapi/syscall.h
+++ b/include/cobalt/uapi/syscall.h
@@ -30,96 +30,92 @@
 #define sc_cobalt_thread_setschedparam_ex  7
 #define sc_cobalt_thread_getschedparam_ex  8
 #define sc_cobalt_thread_getstat   9
-/* 10 unimp */
-#define sc_cobalt_sem_init 11
-#define sc_cobalt_sem_destroy  12
-#define sc_cobalt_sem_post 13
-#define sc_cobalt_sem_wait 14
-#define sc_cobalt_sem_trywait  15
-#define sc_cobalt_sem_getvalue 16
-#define sc_cobalt_sem_open 17
-#define sc_cobalt_sem_close18
-#define sc_cobalt_sem_unlink   19
-#define sc_cobalt_sem_timedwait20
-#define sc_cobalt_sem_inquire  21
-/* 22 unimp */
-#define sc_cobalt_sem_broadcast_np 23
-#define sc_cobalt_clock_getres 24
-#define sc_cobalt_clock_gettime25
-#define sc_cobalt_clock_settime26
-#define sc_cobalt_clock_nanosleep  27
-#define sc_cobalt_mutex_init   28
-#define sc_cobalt_mutex_check_init 29
-#define sc_cobalt_mutex_destroy30
-#define sc_cobalt_mutex_lock   31
-#define sc_cobalt_mutex_timedlock  32
-#define sc_cobalt_mutex_trylock33
-#define sc_cobalt_mutex_unlock 34
-#define sc_cobalt_cond_init35
-#define sc_cobalt_cond_destroy 36
-#define sc_cobalt_cond_wait_prologue   37
-#define sc_cobalt_cond_wait_epilogue   38
-#define sc_cobalt_mq_open  39
-#define sc_cobalt_mq_close 40
-#define sc_cobalt_mq_unlink41
-#define sc_cobalt_mq_getattr   42
-/* 43 unimp */
-#define sc_cobalt_mq_timedsend 44
-#define sc_cobalt_mq_timedreceive  45
-#define sc_cobalt_mq_notify46
-#define sc_cobalt_sched_minprio47
-#define sc_cobalt_sched_maxprio48
-#define sc_cobalt_sched_weightprio 49
-#define sc_cobalt_sched_yield  50
-#define sc_cobalt_sched_setconfig_np   51
-#define sc_cobalt_sched_getconfig_np   52
-#define sc_cobalt_timer_create 53
-#define sc_cobalt_timer_delete 54
-#define sc_cobalt_timer_settime55
-#define sc_cobalt_timer_gettime56
-#define sc_cobalt_timer_getoverrun 57
-#define sc_cobalt_timerfd_create   58
-#define sc_cobalt_timerfd_settime  59
-#define sc_cobalt_timerfd_gettime  60
-#define sc_cobalt_sigwait  61
-#define sc_cobalt_sigwaitinfo  62
-#define sc_cobalt_sigtimedwait 63
-#define sc_cobalt_sigpending   64
-#define sc_cobalt_kill 65
-#define sc_cobalt_sigqueue 66
-#define sc_cobalt_monitor_init 67
-#define sc_cobalt_monitor_destroy  68
-#define sc_cobalt_monitor_enter69
-#define sc_cobalt_monitor_wait 70
-#define sc_cobalt_monitor_sync 71
-#define sc_cobalt_monitor_exit 72
-#define sc_cobalt_event_init   73
-#define sc_cobalt_event_wait   74
-#define sc_cobalt_event_sync   75
-#define sc_cobalt_event_destroy76
-#define sc_cobalt_event_inquire77
-#define sc_cobalt_open 78
-#define sc_cobalt_socket   79
-#define sc_cobalt_close80
-#define sc_cobalt_ioctl81
-#define sc_cobalt_read 82
-#define sc_cobalt_write83
-#define sc_cobalt_recvmsg  84
-#define sc_cobalt_sendmsg  85
-#define sc_cobalt_mmap 86
-#define sc_cobalt_select   87
-#define sc_cobalt_migrate  88
-#define sc_cobalt_archcall 89
-/* 90 unimp */
-#define sc_cobalt_trace91
-#define sc_cobalt_sysctl   

[Xenomai-git] Philippe Gerum : cobalt: bump ABI revision level

2014-10-30 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: 08103dd9d9f72d7f8a798c27eb98327ff5f4f994
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=08103dd9d9f72d7f8a798c27eb98327ff5f4f994

Author: Philippe Gerum r...@xenomai.org
Date:   Thu Oct 30 16:38:42 2014 +0100

cobalt: bump ABI revision level

---

 kernel/cobalt/arch/arm/include/asm/xenomai/uapi/features.h  |2 +-
 kernel/cobalt/arch/blackfin/include/asm/xenomai/uapi/features.h |2 +-
 kernel/cobalt/arch/nios2/include/asm/xenomai/uapi/features.h|2 +-
 kernel/cobalt/arch/powerpc/include/asm/xenomai/uapi/features.h  |2 +-
 kernel/cobalt/arch/sh/include/asm/xenomai/uapi/features.h   |2 +-
 kernel/cobalt/arch/x86/include/asm/xenomai/uapi/features.h  |2 +-
 6 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/kernel/cobalt/arch/arm/include/asm/xenomai/uapi/features.h 
b/kernel/cobalt/arch/arm/include/asm/xenomai/uapi/features.h
index 1a3baca..3e98f75 100644
--- a/kernel/cobalt/arch/arm/include/asm/xenomai/uapi/features.h
+++ b/kernel/cobalt/arch/arm/include/asm/xenomai/uapi/features.h
@@ -22,7 +22,7 @@
 #define _COBALT_ARM_ASM_UAPI_FEATURES_H
 
 /* The ABI revision level we use on this arch. */
-#define XENOMAI_ABI_REV   10UL
+#define XENOMAI_ABI_REV   11UL
 
 #define XENOMAI_FEAT_DEP (__xn_feat_generic_mask)
 
diff --git a/kernel/cobalt/arch/blackfin/include/asm/xenomai/uapi/features.h 
b/kernel/cobalt/arch/blackfin/include/asm/xenomai/uapi/features.h
index aaabe1b..9160d5c 100644
--- a/kernel/cobalt/arch/blackfin/include/asm/xenomai/uapi/features.h
+++ b/kernel/cobalt/arch/blackfin/include/asm/xenomai/uapi/features.h
@@ -19,7 +19,7 @@
 #define _COBALT_BLACKFIN_ASM_UAPI_FEATURES_H
 
 /* The ABI revision level we use on this arch. */
-#define XENOMAI_ABI_REV   10UL
+#define XENOMAI_ABI_REV   11UL
 
 #define XENOMAI_FEAT_DEP  __xn_feat_generic_mask
 
diff --git a/kernel/cobalt/arch/nios2/include/asm/xenomai/uapi/features.h 
b/kernel/cobalt/arch/nios2/include/asm/xenomai/uapi/features.h
index cfeb0c2..da15782 100644
--- a/kernel/cobalt/arch/nios2/include/asm/xenomai/uapi/features.h
+++ b/kernel/cobalt/arch/nios2/include/asm/xenomai/uapi/features.h
@@ -21,7 +21,7 @@
 #include linux/types.h
 
 /* The ABI revision level we use on this arch. */
-#define XENOMAI_ABI_REV   9UL
+#define XENOMAI_ABI_REV   10UL
 
 #define XENOMAI_FEAT_DEP  __xn_feat_generic_mask
 
diff --git a/kernel/cobalt/arch/powerpc/include/asm/xenomai/uapi/features.h 
b/kernel/cobalt/arch/powerpc/include/asm/xenomai/uapi/features.h
index 8a2aee7..1944dde 100644
--- a/kernel/cobalt/arch/powerpc/include/asm/xenomai/uapi/features.h
+++ b/kernel/cobalt/arch/powerpc/include/asm/xenomai/uapi/features.h
@@ -19,7 +19,7 @@
 #define _COBALT_POWERPC_ASM_UAPI_FEATURES_H
 
 /* The ABI revision level we use on this arch. */
-#define XENOMAI_ABI_REV   10UL
+#define XENOMAI_ABI_REV   11UL
 
 #define XENOMAI_FEAT_DEP  __xn_feat_generic_mask
 
diff --git a/kernel/cobalt/arch/sh/include/asm/xenomai/uapi/features.h 
b/kernel/cobalt/arch/sh/include/asm/xenomai/uapi/features.h
index 5d1500f..54ae32b 100644
--- a/kernel/cobalt/arch/sh/include/asm/xenomai/uapi/features.h
+++ b/kernel/cobalt/arch/sh/include/asm/xenomai/uapi/features.h
@@ -21,7 +21,7 @@
 #include linux/types.h
 
 /* The ABI revision level we use on this arch. */
-#define XENOMAI_ABI_REV   7UL
+#define XENOMAI_ABI_REV   8UL
 
 #define XENOMAI_FEAT_DEP  __xn_feat_generic_mask
 
diff --git a/kernel/cobalt/arch/x86/include/asm/xenomai/uapi/features.h 
b/kernel/cobalt/arch/x86/include/asm/xenomai/uapi/features.h
index dba7921..32e1b93 100644
--- a/kernel/cobalt/arch/x86/include/asm/xenomai/uapi/features.h
+++ b/kernel/cobalt/arch/x86/include/asm/xenomai/uapi/features.h
@@ -19,7 +19,7 @@
 #define _COBALT_X86_ASM_UAPI_FEATURES_H
 
 /* The ABI revision level we use on this arch. */
-#define XENOMAI_ABI_REV   10UL
+#define XENOMAI_ABI_REV   11UL
 
 #define XENOMAI_FEAT_DEP  __xn_feat_generic_mask
 


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://www.xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : smokey/sched-quota: throttle test threads to stop calibration

2014-10-30 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: 610e0a4429065b3816b90f9f64ccee1fb5365742
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=610e0a4429065b3816b90f9f64ccee1fb5365742

Author: Philippe Gerum r...@xenomai.org
Date:   Thu Oct 30 11:10:03 2014 +0100

smokey/sched-quota: throttle test threads to stop calibration

It is not totally clear why we need that, but as a matter of fact the
test control thread appears to be stuck in glibc's pthread_cancel() on
SMP/x86 during the first couple of runs while calibrating, despite it
has higher priority than the threads to cancel.

There is some suspicion on the adverse effect of running the
glibc-internal pthread_cancel_init() code at the first invocation of
pthread_cancel(), but no formal proof. It behaves like the test
control thread waits for some event completion in pthread_cancel() -
even before sys_tkill is issued - which never happens, as the test
threads spinning on the same CPU tend to lock it out.

Bottom-line is that something looks fishy here, and this change is
more a workaround than a fix.

---

 testsuite/smokey/sched-quota/sched-quota.c |   11 ++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/testsuite/smokey/sched-quota/sched-quota.c 
b/testsuite/smokey/sched-quota/sched-quota.c
index da1c471..9c08924 100644
--- a/testsuite/smokey/sched-quota/sched-quota.c
+++ b/testsuite/smokey/sched-quota/sched-quota.c
@@ -16,6 +16,7 @@
 #include error.h
 #include boilerplate/time.h
 #include boilerplate/ancillaries.h
+#include boilerplate/atomic.h
 #include smokey/smokey.h
 
 smokey_test_plugin(sched_quota,
@@ -57,6 +58,8 @@ static int started;
 
 static sem_t ready;
 
+static atomic_t throttle;
+
 static unsigned long __attribute__(( noinline ))
 __do_work(unsigned long count)
 {
@@ -93,7 +96,9 @@ static void *thread_body(void *arg)
 
for (;;) {
do_work(loops, count_r);
-   if (nrthreads  1)
+   if (atomic_read(throttle))
+   sleep(1);
+   else if (nrthreads  1)
sched_yield();
}
 
@@ -255,12 +260,16 @@ static unsigned long long calibrate(void)
pthread_kill(threads[n], SIGDEMT);
}
 
+   atomic_set(throttle, 1);
+   smp_wmb();
+
for (n = 0; n  nrthreads; n++) {
pthread_cancel(threads[n]);
pthread_join(threads[n], NULL);
}
 
started = 0;
+   atomic_set(throttle, 0);
 
return lps;
 }


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://www.xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : cobalt/pipe: introduce uapi/ section

2014-10-30 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: 62e36a36382ffc29a22bdb53b4258eda947fbaff
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=62e36a36382ffc29a22bdb53b4258eda947fbaff

Author: Philippe Gerum r...@xenomai.org
Date:   Thu Oct 30 12:09:00 2014 +0100

cobalt/pipe: introduce uapi/ section

---

 include/cobalt/kernel/pipe.h   |   16 +-
 include/cobalt/uapi/kernel/Makefile.am |1 +
 include/cobalt/uapi/kernel/Makefile.in |1 +
 include/cobalt/uapi/kernel/pipe.h  |   37 
 include/rtdm/uapi/ipc.h|1 +
 5 files changed, 41 insertions(+), 15 deletions(-)

diff --git a/include/cobalt/kernel/pipe.h b/include/cobalt/kernel/pipe.h
index b781f71..01b4642 100644
--- a/include/cobalt/kernel/pipe.h
+++ b/include/cobalt/kernel/pipe.h
@@ -23,25 +23,11 @@
 #include linux/poll.h
 #include cobalt/kernel/synch.h
 #include cobalt/kernel/thread.h
+#include cobalt/uapi/kernel/pipe.h
 
 #define XNPIPE_NDEVS  CONFIG_XENO_OPT_PIPE_NRDEV
 #define XNPIPE_DEV_MAJOR  150
 
-#defineXNPIPE_IOCTL_BASE   'p'
-#define XNPIPEIOC_GET_NRDEV_IOW(XNPIPE_IOCTL_BASE, 0, int)
-#define XNPIPEIOC_IFLUSH   _IO(XNPIPE_IOCTL_BASE,1)
-#define XNPIPEIOC_OFLUSH   _IO(XNPIPE_IOCTL_BASE,2)
-#define XNPIPEIOC_FLUSHXNPIPEIOC_OFLUSH
-#define XNPIPEIOC_SETSIG   _IO(XNPIPE_IOCTL_BASE,3)
-
-#define XNPIPE_NORMAL  0x0
-#define XNPIPE_URGENT  0x1
-
-#define XNPIPE_IFLUSH  0x1
-#define XNPIPE_OFLUSH  0x2
-
-#define XNPIPE_MINOR_AUTO  -1
-
 #define XNPIPE_KERN_CONN 0x1
 #define XNPIPE_KERN_LCLOSE   0x2
 #define XNPIPE_USER_CONN 0x4
diff --git a/include/cobalt/uapi/kernel/Makefile.am 
b/include/cobalt/uapi/kernel/Makefile.am
index e98a735..12e1b37 100644
--- a/include/cobalt/uapi/kernel/Makefile.am
+++ b/include/cobalt/uapi/kernel/Makefile.am
@@ -3,6 +3,7 @@ includesubdir = $(includedir)/cobalt/uapi/kernel
 includesub_HEADERS =   \
heap.h  \
limits.h\
+   pipe.h  \
synch.h \
thread.h\
trace.h \
diff --git a/include/cobalt/uapi/kernel/Makefile.in 
b/include/cobalt/uapi/kernel/Makefile.in
index 0edff6d..11f9251 100644
--- a/include/cobalt/uapi/kernel/Makefile.in
+++ b/include/cobalt/uapi/kernel/Makefile.in
@@ -336,6 +336,7 @@ includesubdir = $(includedir)/cobalt/uapi/kernel
 includesub_HEADERS = \
heap.h  \
limits.h\
+   pipe.h  \
synch.h \
thread.h\
trace.h \
diff --git a/include/cobalt/uapi/kernel/pipe.h 
b/include/cobalt/uapi/kernel/pipe.h
new file mode 100644
index 000..688ee0c
--- /dev/null
+++ b/include/cobalt/uapi/kernel/pipe.h
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2014 Philippe Gerum r...@xenomai.org.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.
+ */
+#ifndef _COBALT_UAPI_KERNEL_PIPE_H
+#define _COBALT_UAPI_KERNEL_PIPE_H
+
+#defineXNPIPE_IOCTL_BASE   'p'
+
+#define XNPIPEIOC_GET_NRDEV_IOW(XNPIPE_IOCTL_BASE, 0, int)
+#define XNPIPEIOC_IFLUSH   _IO(XNPIPE_IOCTL_BASE, 1)
+#define XNPIPEIOC_OFLUSH   _IO(XNPIPE_IOCTL_BASE, 2)
+#define XNPIPEIOC_FLUSHXNPIPEIOC_OFLUSH
+#define XNPIPEIOC_SETSIG   _IO(XNPIPE_IOCTL_BASE, 3)
+
+#define XNPIPE_NORMAL  0x0
+#define XNPIPE_URGENT  0x1
+
+#define XNPIPE_IFLUSH  0x1
+#define XNPIPE_OFLUSH  0x2
+
+#define XNPIPE_MINOR_AUTO  (-1)
+
+#endif /* !_COBALT_UAPI_KERNEL_PIPE_H */
diff --git a/include/rtdm/uapi/ipc.h b/include/rtdm/uapi/ipc.h
index bdef4de..a558150 100644
--- a/include/rtdm/uapi/ipc.h
+++ b/include/rtdm/uapi/ipc.h
@@ -393,6 +393,7 @@ int getpeername__AF_RTIPC(int sockfd, struct sockaddr_ipc 
*addr, socklen_t *addr
 /** @} */
 
 #include cobalt/uapi/kernel/types.h
+#include cobalt/uapi/kernel/pipe.h
 #include rtdm/rtdm.h
 
 /* Address family */


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://www.xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Gilles Chanteperdrix : cobalt/spinlocks: rebase on linux spinlocks

2014-10-30 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: 2380aa45a1060217795a6dc4b3e8ad60abbf10ba
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=2380aa45a1060217795a6dc4b3e8ad60abbf10ba

Author: Gilles Chanteperdrix gilles.chanteperd...@xenomai.org
Date:   Sun Oct 19 21:43:37 2014 +0200

cobalt/spinlocks: rebase on linux spinlocks

---

 include/cobalt/kernel/lock.h |   35 ++-
 kernel/cobalt/debug.c|2 +-
 kernel/cobalt/lock.c |   15 ---
 3 files changed, 19 insertions(+), 33 deletions(-)

diff --git a/include/cobalt/kernel/lock.h b/include/cobalt/kernel/lock.h
index b0c34bf..e590b85 100644
--- a/include/cobalt/kernel/lock.h
+++ b/include/cobalt/kernel/lock.h
@@ -66,7 +66,8 @@ typedef unsigned long spl_t;
 #if XENO_DEBUG(LOCKING)
 
 struct xnlock {
-   atomic_t owner;
+   unsigned owner;
+   arch_spinlock_t alock;
const char *file;
const char *function;
unsigned int line;
@@ -84,7 +85,8 @@ struct xnlockinfo {
 };
 
 #define XNARCH_LOCK_UNLOCKED (struct xnlock) { \
-   { ~0 }, \
+   ~0, \
+   __ARCH_SPIN_LOCK_UNLOCKED,  \
NULL,   \
NULL,   \
0,  \
@@ -117,10 +119,15 @@ DECLARE_PER_CPU(struct xnlockinfo, xnlock_stats);
 #else /* !XENO_DEBUG(LOCKING) */
 
 struct xnlock {
-   atomic_t owner;
+   unsigned owner;
+   arch_spinlock_t alock;
 };
 
-#define XNARCH_LOCK_UNLOCKED   (struct xnlock) { { ~0 } }
+#define XNARCH_LOCK_UNLOCKED   \
+   (struct xnlock) {   \
+   ~0, \
+   __ARCH_SPIN_LOCK_UNLOCKED,  \
+   }
 
 #define XNLOCK_DBG_CONTEXT
 #define XNLOCK_DBG_CONTEXT_ARGS
@@ -175,20 +182,18 @@ static inline void xnlock_init (struct xnlock *lock)
 #define DEFINE_XNLOCK(lock)struct xnlock lock = 
XNARCH_LOCK_UNLOCKED
 #define DEFINE_PRIVATE_XNLOCK(lock)static DEFINE_XNLOCK(lock)
 
-void __xnlock_spin(int cpu, struct xnlock *lock /*, */ 
XNLOCK_DBG_CONTEXT_ARGS);
-
 static inline int xnlock_get(struct xnlock *lock /*, */ 
XNLOCK_DBG_CONTEXT_ARGS)
 {
int cpu = ipipe_processor_id();
unsigned long long start;
 
-   if (atomic_read(lock-owner) == cpu)
+   if (lock-owner == cpu)
return 2;
 
xnlock_dbg_prepare_acquire(start);
 
-   if (unlikely(atomic_cmpxchg(lock-owner, ~0, cpu) != ~0))
-   __xnlock_spin(cpu, lock /*, */ XNLOCK_DBG_PASS_CONTEXT);
+   arch_spin_lock(lock-alock);
+   lock-owner = cpu;
 
xnlock_dbg_acquired(lock, cpu, start /*, */ XNLOCK_DBG_PASS_CONTEXT);
 
@@ -200,12 +205,8 @@ static inline void xnlock_put(struct xnlock *lock /*, 
*/ XNLOCK_DBG_CONTEXT_
if (xnlock_dbg_release(lock /*, */ XNLOCK_DBG_PASS_CONTEXT))
return;
 
-   /*
-* Make sure all data written inside the lock is visible to
-* other CPUs before we release the lock.
-*/
-   mb();
-   atomic_set(lock-owner, ~0);
+   lock-owner = ~0U;
+   arch_spin_unlock(lock-alock);
 }
 
 #ifndef CONFIG_XENO_ARCH_OUTOFLINE_XNLOCK
@@ -250,7 +251,7 @@ static inline void __xnlock_put_irqrestore(struct xnlock 
*lock, spl_t flags
 static inline int xnlock_is_owner(struct xnlock *lock)
 {
if (__locking_active__)
-   return atomic_read(lock-owner) == ipipe_processor_id();
+   return lock-owner == ipipe_processor_id();
 
return 1;
 }
@@ -266,7 +267,7 @@ static inline int __xnlock_get(struct xnlock *lock /*, */ 
XNLOCK_DBG_CONTEXT_ARG
 static inline void __xnlock_put(struct xnlock *lock /*, */ 
XNLOCK_DBG_CONTEXT_ARGS)
 {
if (__locking_active__)
-   ___xnlock_put(lock /*, */ XNLOCK_DBG_PASS_CONTEXT); 
+   ___xnlock_put(lock /*, */ XNLOCK_DBG_PASS_CONTEXT);
 }
 
 #undef __locking_active__
diff --git a/kernel/cobalt/debug.c b/kernel/cobalt/debug.c
index ad72a3e..ef46e0b 100644
--- a/kernel/cobalt/debug.c
+++ b/kernel/cobalt/debug.c
@@ -598,7 +598,7 @@ int xnlock_dbg_release(struct xnlock *lock,
lock-function = invalid;
}
 
-   if (unlikely(atomic_read(lock-owner) != cpu)) {
+   if (unlikely(lock-owner != cpu)) {
ipipe_prepare_panic();
printk(XENO_ERR lock %p already unlocked on CPU #%d\n
  last owner = %s:%u (%s(), CPU 
#%d)\n,
diff --git a/kernel/cobalt/lock.c b/kernel/cobalt/lock.c
index 5c339b5..a1b2e37 100644
--- a/kernel/cobalt/lock.c
+++ b/kernel/cobalt/lock.c
@@ -42,21 +42,6 @@ DEFINE_XNLOCK(nklock);
 #if defined(CONFIG_SMP) || XENO_DEBUG(LOCKING)
 EXPORT_SYMBOL_GPL(nklock);
 
-void __xnlock_spin(int cpu, struct xnlock *lock /*, */ XNLOCK_DBG_CONTEXT_ARGS)
-{
-   unsigned int 

[Xenomai-git] Jorge Ramirez-Ortiz : utils/analogy: calibration - use iniparser

2014-10-30 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: 68033dcc5bf6c732eba6a43390aca34c9f490e98
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=68033dcc5bf6c732eba6a43390aca34c9f490e98

Author: Jorge Ramirez-Ortiz j...@xenomai.org
Date:   Fri Sep 12 11:55:40 2014 -0400

utils/analogy: calibration - use iniparser

---

 utils/analogy/Makefile.am |4 ++-
 utils/analogy/analogy_calibrate.c |   57 -
 utils/analogy/analogy_calibrate.h |   11 ++-
 utils/analogy/calibration_ni_m.c  |   40 ++
 4 files changed, 103 insertions(+), 9 deletions(-)

diff --git a/utils/analogy/Makefile.am b/utils/analogy/Makefile.am
index fe2f317..40c09f3 100644
--- a/utils/analogy/Makefile.am
+++ b/utils/analogy/Makefile.am
@@ -12,7 +12,9 @@ bin_PROGRAMS = \
 CPPFLAGS = \
@XENO_USER_CFLAGS@  \
-ggdb   \
-   -I$(top_srcdir)/include
+   -I$(top_srcdir)/include \
+   -I$(top_srcdir)/lib/boilerplate 
+
 
 LDFLAGS =
 
diff --git a/utils/analogy/analogy_calibrate.c 
b/utils/analogy/analogy_calibrate.c
index 586a38a..b2ac286 100644
--- a/utils/analogy/analogy_calibrate.c
+++ b/utils/analogy/analogy_calibrate.c
@@ -31,7 +31,7 @@
 #include analogy_calibrate.h
 #include calibration_ni_m.h
 
-
+struct apply_calibration_params params = {.name = NULL,} ;
 struct timespec calibration_start_time;
 static const char *revision = 0.0.1;
 a4l_desc_t descriptor;
@@ -57,28 +57,65 @@ static const struct option options[] = {
.flag = NULL,
},
{
+#define apply_opt  3
+   .name = apply,
+   .has_arg = 1,
+   .flag = NULL,
+   },
+   {
.name = NULL,
}
 };
 
-static void print_usage(void)
+static void
+print_usage(void)
 {
fprintf(stderr, Usage: analogy_calibrate \n
---help: this menu \n
---device /dev/analogyX: analogy device to calibrate 
\n
---output filename : calibration results \n
+--help: this menu \n
+--device /dev/analogyX: analogy 
device to calibrate \n
+--output filename : calibration 
results \n
+--apply filename:subd,channel,range,aref  : apply the 
calibration file \n
+ex: /home/foo/calib.rc:0,1,255,255 - use 255 for dont 
care \n
  );
 }
 
+static int
+apply_calibration_set_globals(char *info)
+{
+   char *p;
+
+   params.name = strtok(info, :);
+   p = strtok(NULL, ,);
+   if (!p)
+   error(EXIT, 0, missing --apply parameter \n);
+   params.subd = strtol(p, NULL, 0);
+
+   p = strtok(NULL, ,);
+   if (!p)
+   error(EXIT, 0, missing --apply parameter \n);
+   params.channel = strtol(p, NULL, 0);
+
+   p = strtok(NULL, ,);
+   if (!p)
+   error(EXIT, 0, missing --apply parameter \n);
+   params.range = strtol(p, NULL, 0);
+
+   p = strtok(NULL, );
+   if (!p)
+   error(EXIT, 0, missing --apply parameter \n);
+   params.aref = strtol(p, NULL, 0);
+
+   return 0;
+}
+
 static void __attribute__ ((constructor)) __analogy_calibrate_init(void)
 {
clock_gettime(CLOCK_MONOTONIC, calibration_start_time);
 }
-
 int main(int argc, char *argv[])
 {
struct sched_param param = {.sched_priority = 99};
-   char *device = NULL, *file = NULL;
+   char *device = NULL, *file = NULL, *apply_info = NULL;
int v, i, fd, err = 0;
struct rlimit rl;
 
@@ -103,12 +140,18 @@ int main(int argc, char *argv[])
error(EXIT, errno, calibration file);
__debug(calibration output: %s \n, file);
break;
+   case apply_opt:
+   apply_info = optarg;
+   break;
default:
print_usage();
exit(EXIT_FAILURE);
}
}
 
+   if (apply_info)
+   apply_calibration_set_globals(apply_info);
+
err = getrlimit(RLIMIT_STACK, rl);
if (!err) {
if (rl.rlim_cur  rl.rlim_max) {
diff --git a/utils/analogy/analogy_calibrate.h 
b/utils/analogy/analogy_calibrate.h
index 1fb548e..c2b539a 100644
--- a/utils/analogy/analogy_calibrate.h
+++ b/utils/analogy/analogy_calibrate.h
@@ -38,8 +38,17 @@ extern struct timespec calibration_start_time;
 extern a4l_desc_t descriptor;
 extern FILE *cal;
 
-#define ARRAY_LEN(a)  (sizeof(a) / sizeof((a)[0]))
+struct apply_calibration_params {
+   int channel;
+   char *name;
+   int range;
+   int subd;
+   int aref;
+};
 
+extern 

[Xenomai-git] Jorge Ramirez-Ortiz : lib/analogy: fix a4l_sync_read wait call

2014-10-30 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: 465302d146d293149f7646b409e6bee28e1af464
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=465302d146d293149f7646b409e6bee28e1af464

Author: Jorge Ramirez-Ortiz j...@xenomai.org
Date:   Thu Aug 21 15:22:05 2014 -0400

lib/analogy: fix a4l_sync_read wait call

---

 lib/analogy/sync.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/analogy/sync.c b/lib/analogy/sync.c
index 6dd49f9..fee5fc9 100644
--- a/lib/analogy/sync.c
+++ b/lib/analogy/sync.c
@@ -211,13 +211,13 @@ int a4l_sync_read(a4l_desc_t * dsc,
.type = A4L_INSN_READ,
.idx_subd = idx_subd,
.chan_desc = chan_desc,
-   .data_size = 0,
+   .data_size = nbyte,
.data = buf},
{
.type = A4L_INSN_WAIT,
.idx_subd = idx_subd,
.chan_desc = chan_desc,
-   .data_size = 1,
+   .data_size = sizeof(unsigned int),
.data = NULL}
};
 


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://www.xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Jorge Ramirez-Ortiz : drivers/analogy: let A4L_CMD_SIMUL calls return driver specific values

2014-10-30 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: ca84782351a929ed78baee05fffd3accfce31db0
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=ca84782351a929ed78baee05fffd3accfce31db0

Author: Jorge Ramirez-Ortiz j...@xenomai.org
Date:   Tue Aug 19 14:02:23 2014 -0400

drivers/analogy: let A4L_CMD_SIMUL calls return driver specific values

---

 kernel/drivers/analogy/command.c |   17 +
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/kernel/drivers/analogy/command.c b/kernel/drivers/analogy/command.c
index 1c544bf..213591d 100644
--- a/kernel/drivers/analogy/command.c
+++ b/kernel/drivers/analogy/command.c
@@ -26,7 +26,6 @@
 #include rtdm/analogy/device.h
 
 /* --- Command descriptor management functions --- */
-
 int a4l_fill_cmddesc(struct a4l_device_context * cxt, struct a4l_cmd_desc * 
desc, void *arg)
 {
int ret = 0;
@@ -284,11 +283,11 @@ int a4l_check_specific_cmdcnt(struct a4l_device_context * 
cxt, struct a4l_cmd_de
 
 /* --- IOCTL / FOPS function --- */
 
-int a4l_ioctl_cmd(struct a4l_device_context * cxt, void *arg)
+int a4l_ioctl_cmd(struct a4l_device_context * ctx, void *arg)
 {
int ret = 0, simul_flag = 0;
struct a4l_cmd_desc *cmd_desc = NULL;
-   struct a4l_device *dev = a4l_get_dev(cxt);
+   struct a4l_device *dev = a4l_get_dev(ctx);
struct a4l_subdevice *subd;
 
/* The command launching cannot be done in real-time because
@@ -310,12 +309,12 @@ int a4l_ioctl_cmd(struct a4l_device_context * cxt, void 
*arg)
memset(cmd_desc, 0, sizeof(struct a4l_cmd_desc));
 
/* Gets the command */
-   ret = a4l_fill_cmddesc(cxt, cmd_desc, arg);
+   ret = a4l_fill_cmddesc(ctx, cmd_desc, arg);
if (ret != 0)
goto out_ioctl_cmd;
 
/* Checks the command */
-   ret = a4l_check_cmddesc(cxt, cmd_desc);
+   ret = a4l_check_cmddesc(ctx, cmd_desc);
if (ret != 0)
goto out_ioctl_cmd;
 
@@ -323,7 +322,7 @@ int a4l_ioctl_cmd(struct a4l_device_context * cxt, void 
*arg)
if (ret != 0)
goto out_ioctl_cmd;
 
-   ret = a4l_check_specific_cmdcnt(cxt, cmd_desc);
+   ret = a4l_check_specific_cmdcnt(ctx, cmd_desc);
if (ret != 0)
goto out_ioctl_cmd;
 
@@ -347,7 +346,7 @@ int a4l_ioctl_cmd(struct a4l_device_context * cxt, void 
*arg)
}
 
/* Gets the transfer system ready */
-   ret = a4l_setup_buffer(cxt, cmd_desc);
+   ret = a4l_setup_buffer(ctx, cmd_desc);
if (ret  0)
goto out_ioctl_cmd;
 
@@ -355,12 +354,14 @@ int a4l_ioctl_cmd(struct a4l_device_context * cxt, void 
*arg)
ret = subd-do_cmd(subd, cmd_desc);
 
if (ret != 0) {
-   a4l_cancel_buffer(cxt);
+   a4l_cancel_buffer(ctx);
goto out_ioctl_cmd;
}
 
 out_ioctl_cmd:
if (ret != 0 || simul_flag == 1) {
+   rtdm_safe_copy_to_user(rtdm_private_to_fd(ctx), arg, cmd_desc,
+   sizeof(struct a4l_cmd_desc));
a4l_free_cmddesc(cmd_desc);
rtdm_free(cmd_desc);
}


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://www.xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Jorge Ramirez-Ortiz : lib/boilerplate: add iniparser to boilerplate

2014-10-30 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: 67803dce543ee6f680f42e8dcd2c77b2fc383ad6
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=67803dce543ee6f680f42e8dcd2c77b2fc383ad6

Author: Jorge Ramirez-Ortiz j...@xenomai.org
Date:   Fri Sep 12 10:01:45 2014 -0400

lib/boilerplate: add iniparser to boilerplate

---

 lib/boilerplate/Makefile.am|   21 +-
 lib/boilerplate/iniparser/LICENSE  |   21 +
 lib/boilerplate/iniparser/README   |1 +
 lib/boilerplate/iniparser/dictionary.c |  405 +++
 lib/boilerplate/iniparser/dictionary.h |  174 +
 lib/boilerplate/iniparser/iniparser.c  |  667 
 lib/boilerplate/iniparser/iniparser.h  |  281 ++
 7 files changed, 1567 insertions(+), 3 deletions(-)

diff --git a/lib/boilerplate/Makefile.am b/lib/boilerplate/Makefile.am
index 0a14d18..e2275c1 100644
--- a/lib/boilerplate/Makefile.am
+++ b/lib/boilerplate/Makefile.am
@@ -31,10 +31,25 @@ libboilerplate_la_CPPFLAGS =
\
-I$(top_srcdir) \
-I$(top_srcdir)/include
 
+libboilerplate_la_LIBADD = libiniparser.la
+noinst_LTLIBRARIES += libiniparser.la
+
+libiniparser_la_SOURCES=   \
+   iniparser/dictionary.c  \
+   iniparser/dictionary.h  \
+   iniparser/iniparser.h   \
+   iniparser/iniparser.c
+
+libiniparser_la_CPPFLAGS   =   \
+   -Iiniparser @XENO_USER_CFLAGS@  \
+   -I$(top_srcdir)/include
+
+EXTRA_DIST = iniparser/README iniparser/LICENSE
+
 # We always build the tlsf/malloc support. In the pshared case, it
 # will provide for private memory allocation.
 if XENO_TLSF
-libboilerplate_la_LIBADD = libtlsf.la
+libboilerplate_la_LIBADD +=libtlsf.la
 noinst_LTLIBRARIES += libtlsf.la
 endif
 
@@ -48,11 +63,11 @@ libtlsf_la_CPPFLAGS =   
\
-I$(top_srcdir)/include \
-DTLSF_USE_LOCKS=1 -DUSE_MMAP=1 -DTLSF_STATISTIC=1
 
-EXTRA_DIST = tlsf/README
+EXTRA_DIST += tlsf/README
 
 SPARSE = sparse
 
 sparse:
-   @for i in $(libboilerplate_la_SOURCES) $(libtlsf_la_SOURCES); do \
+   @for i in $(libboilerplate_la_SOURCES) $(libtlsf_la_SOURCES) 
$(libiniparser_la_SOURCES; do \
$(SPARSE) $(CHECKFLAGS) $(srcdir)/$$i; \
done
diff --git a/lib/boilerplate/iniparser/LICENSE 
b/lib/boilerplate/iniparser/LICENSE
new file mode 100644
index 000..dbfa45d
--- /dev/null
+++ b/lib/boilerplate/iniparser/LICENSE
@@ -0,0 +1,21 @@
+Copyright (c) 2000-2007 by Nicolas Devillard.
+MIT License
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the Software),
+to deal in the Software without restriction, including without limitation
+the rights to use, copy, modify, merge, publish, distribute, sublicense,
+and/or sell copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
+
diff --git a/lib/boilerplate/iniparser/README b/lib/boilerplate/iniparser/README
new file mode 100644
index 000..dfa43c8
--- /dev/null
+++ b/lib/boilerplate/iniparser/README
@@ -0,0 +1 @@
+See http://ndevilla.free.fr/iniparser/
diff --git a/lib/boilerplate/iniparser/dictionary.c 
b/lib/boilerplate/iniparser/dictionary.c
new file mode 100644
index 000..5299b77
--- /dev/null
+++ b/lib/boilerplate/iniparser/dictionary.c
@@ -0,0 +1,405 @@
+/*-*/
+/**
+   @file   dictionary.c
+   @author N. Devillard
+   @date   Sep 2007
+   @version$Revision: 1.27 $
+   @brief  Implements a dictionary for string variables.
+
+   This module implements a simple dictionary object, i.e. a list
+   of string/string associations. This object is useful to store e.g.
+   informations retrieved from a configuration file (ini files).
+*/
+/*--*/
+
+/*
+   $Id: dictionary.c,v 1.27 2007-11-23 21:39:18 ndevilla Exp $
+   $Revision: 1.27 $
+*/
+/*---
+   Includes
+ 

[Xenomai-git] Philippe Gerum : cobalt/posix/sem: prepare for 32bit syscall emulation

2014-10-30 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: b39cb363985d5130a432fca5111bd38046985e59
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=b39cb363985d5130a432fca5111bd38046985e59

Author: Philippe Gerum r...@xenomai.org
Date:   Thu Oct 16 14:40:04 2014 +0200

cobalt/posix/sem: prepare for 32bit syscall emulation

---

 kernel/cobalt/posix/sem.c |  114 -
 kernel/cobalt/posix/sem.h |5 ++
 2 files changed, 67 insertions(+), 52 deletions(-)

diff --git a/kernel/cobalt/posix/sem.c b/kernel/cobalt/posix/sem.c
index 331fae9..433f5ca 100644
--- a/kernel/cobalt/posix/sem.c
+++ b/kernel/cobalt/posix/sem.c
@@ -243,25 +243,61 @@ static int sem_trywait(xnhandle_t handle)
return err;
 }
 
-static inline int
-sem_wait_inner(xnhandle_t handle, int timed,
-  const struct timespec __user *u_ts)
+static int sem_wait(xnhandle_t handle)
 {
-   struct timespec ts = { .tv_sec = 0, .tv_nsec = 0 };
-   int pull_ts = 1, ret, info;
struct cobalt_sem *sem;
-   xntmode_t tmode;
+   int ret, info;
spl_t s;
 
xnlock_get_irqsave(nklock, s);
-redo:
-   sem = xnregistry_lookup(handle, NULL);
 
+   sem = xnregistry_lookup(handle, NULL);
ret = sem_trywait_inner(sem);
if (ret != -EAGAIN)
goto out;
 
-   if (timed) {
+   ret = 0;
+   info = xnsynch_sleep_on(sem-synchbase, XN_INFINITE, XN_RELATIVE);
+   if (info  XNRMID)
+   ret = -EINVAL;
+   else if (info  XNBREAK)
+   ret = -EINTR;
+out:
+   xnlock_put_irqrestore(nklock, s);
+
+   return ret;
+}
+
+static inline int sem_fetch_timeout(struct timespec *ts,
+   const void __user *u_ts)
+{
+   return u_ts == NULL ? -EFAULT :
+   __xn_safe_copy_from_user(ts, u_ts, sizeof(*ts));
+}
+
+int __cobalt_sem_timedwait(struct cobalt_sem_shadow __user *u_sem,
+  const void __user *u_ts,
+  int (*fetch_timeout)(struct timespec *ts,
+   const void __user *u_ts))
+{
+   struct timespec ts = { .tv_sec = 0, .tv_nsec = 0 };
+   int pull_ts = 1, ret, info;
+   struct cobalt_sem *sem;
+   xnhandle_t handle;
+   xntmode_t tmode;
+   spl_t s;
+
+   handle = cobalt_get_handle_from_user(u_sem-handle);
+   trace_cobalt_psem_timedwait(handle);
+
+   xnlock_get_irqsave(nklock, s);
+
+   for (;;) {
+   sem = xnregistry_lookup(handle, NULL);
+   ret = sem_trywait_inner(sem);
+   if (ret != -EAGAIN)
+   break;
+
/*
 * POSIX states that the validity of the timeout spec
 * _need_ not be checked if the semaphore can be
@@ -271,55 +307,34 @@ redo:
 */
if (pull_ts) {
atomic_inc(sem-datp-value);
-   if (u_ts == NULL)
-   goto efault;
xnlock_put_irqrestore(nklock, s);
-   ret =__xn_safe_copy_from_user(ts, u_ts, sizeof(ts));
+   ret = sem_fetch_timeout(ts, u_ts);
xnlock_get_irqsave(nklock, s);
if (ret)
-   goto efault;
-   if (ts.tv_nsec = ONE_BILLION)
-   goto einval;
+   break;
+   if (ts.tv_nsec = ONE_BILLION) {
+   ret = -EINVAL;
+   break;
+   }
pull_ts = 0;
-   goto redo;
+   continue;
}
 
+   ret = 0;
tmode = sem-flags  SEM_RAWCLOCK ? XN_ABSOLUTE : XN_REALTIME;
info = xnsynch_sleep_on(sem-synchbase, ts2ns(ts) + 1, tmode);
-   } else
-   info = xnsynch_sleep_on(sem-synchbase,
-   XN_INFINITE, XN_RELATIVE);
-   if (info  XNRMID)
-   goto einval;
-   if (info  (XNBREAK|XNTIMEO)) {
-   ret = (info  XNBREAK) ? -EINTR : -ETIMEDOUT;
-   goto fail;
+   if (info  XNRMID)
+   ret = -EINVAL;
+   else if (info  (XNBREAK|XNTIMEO)) {
+   ret = (info  XNBREAK) ? -EINTR : -ETIMEDOUT;
+   atomic_inc(sem-datp-value);
+   }
+   break;
}
-   ret = 0;
-out:
+
xnlock_put_irqrestore(nklock, s);
 
return ret;
-fail:
-   atomic_inc(sem-datp-value);
-   goto out;
-efault:
-   ret = -EFAULT;
-   goto out;
-einval:
-   ret = -EINVAL;
-   goto out;
-}
-
-static int sem_wait(xnhandle_t handle)
-{
-   return sem_wait_inner(handle, 0, NULL);
-}
-
-static int sem_timedwait(xnhandle_t handle,
- 

[Xenomai-git] Philippe Gerum : cobalt/posix/mutex: prepare for 32bit syscall emulation

2014-10-30 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: c53a9dd3ebc7b25d157e25b0e7381d6ee2ce3592
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=c53a9dd3ebc7b25d157e25b0e7381d6ee2ce3592

Author: Philippe Gerum r...@xenomai.org
Date:   Thu Oct 16 14:40:25 2014 +0200

cobalt/posix/mutex: prepare for 32bit syscall emulation

---

 kernel/cobalt/posix/mutex.c |  128 +--
 kernel/cobalt/posix/mutex.h |   14 +++--
 2 files changed, 72 insertions(+), 70 deletions(-)

diff --git a/kernel/cobalt/posix/mutex.c b/kernel/cobalt/posix/mutex.c
index 30ad1e5..e78ebde 100644
--- a/kernel/cobalt/posix/mutex.c
+++ b/kernel/cobalt/posix/mutex.c
@@ -94,40 +94,15 @@ cobalt_mutex_destroy_inner(xnhandle_t handle, struct 
cobalt_kqueues *q)
xnfree(mutex);
 }
 
-static inline int cobalt_mutex_acquire(struct xnthread *cur,
-  struct cobalt_mutex *mutex,
-  int timed,
-  const struct timespec __user *u_ts)
-{
-   if (!cobalt_obj_active(mutex, COBALT_MUTEX_MAGIC, struct cobalt_mutex))
-   return -EINVAL;
-
-#if XENO_DEBUG(USER)
-   if (mutex-owningq != cobalt_kqueues(mutex-attr.pshared))
-   return -EPERM;
-#endif
-
-   if (xnsynch_owner_check(mutex-synchbase, cur) == 0)
-   return -EBUSY;
-
-   return cobalt_mutex_acquire_unchecked(cur, mutex, timed, u_ts);
-}
-
 /* must be called with nklock locked, interrupts off. */
-int cobalt_mutex_acquire_unchecked(struct xnthread *cur,
-  struct cobalt_mutex *mutex,
-  int timed,
-  const struct timespec __user *u_ts)
+int __cobalt_mutex_acquire_unchecked(struct xnthread *cur,
+struct cobalt_mutex *mutex,
+const struct timespec *ts)
 {
-   struct timespec ts;
-
-   if (timed) {/* Always called with IRQs on in this case. */
-   if (u_ts == NULL ||
-   __xn_safe_copy_from_user(ts, u_ts, sizeof(ts)))
-   return -EFAULT;
-   if (ts.tv_nsec = ONE_BILLION)
+   if (ts) {
+   if (ts-tv_nsec = ONE_BILLION)
return -EINVAL;
-   xnsynch_acquire(mutex-synchbase, ts2ns(ts) + 1, XN_REALTIME);
+   xnsynch_acquire(mutex-synchbase, ts2ns(ts) + 1, XN_REALTIME);
} else
xnsynch_acquire(mutex-synchbase, XN_INFINITE, XN_RELATIVE);
 
@@ -174,21 +149,57 @@ int cobalt_mutex_release(struct xnthread *cur,
return need_resched;
 }
 
-static inline
-int cobalt_mutex_timedlock_break(struct cobalt_mutex *mutex,
-int timed, const struct timespec __user *u_ts)
+int __cobalt_mutex_timedlock_break(struct cobalt_mutex_shadow __user *u_mx,
+  const void __user *u_ts,
+  int (*fetch_timeout)(struct timespec *ts,
+   const void __user 
*u_ts))
 {
struct xnthread *curr = xnthread_current();
+   struct timespec ts, *tsp = NULL;
+   struct cobalt_mutex *mutex;
+   xnhandle_t handle;
+   spl_t s;
int ret;
 
/* We need a valid thread handle for the fast lock. */
if (curr-handle == XN_NO_HANDLE)
return -EPERM;
 
-   ret = cobalt_mutex_acquire(curr, mutex, timed, u_ts);
-   if (ret != -EBUSY)
+   handle = cobalt_get_handle_from_user(u_mx-handle);
+redo:
+   xnlock_get_irqsave(nklock, s);
+
+   mutex = xnregistry_lookup(handle, NULL);
+
+   if (!cobalt_obj_active(mutex, COBALT_MUTEX_MAGIC, struct cobalt_mutex)) 
{
+   ret = -EINVAL;
+   goto out;
+   }
+#if XENO_DEBUG(USER)
+   if (mutex-owningq != cobalt_kqueues(mutex-attr.pshared)) {
+   ret = -EPERM;
+   goto out;
+   }
+#endif
+   if (xnsynch_owner_check(mutex-synchbase, curr)) {
+   if (fetch_timeout) {
+   xnlock_put_irqrestore(nklock, s);
+   ret = fetch_timeout(ts, u_ts);
+   if (ret)
+   return ret;
+
+   fetch_timeout = NULL;
+   tsp = ts;
+   goto redo; /* Revalidate handle. */
+   }
+   ret = __cobalt_mutex_acquire_unchecked(curr, mutex, tsp);
+   xnlock_put_irqrestore(nklock, s);
return ret;
+   }
 
+   /* We already own the mutex, something looks wrong. */
+
+   ret = -EBUSY;
switch(mutex-attr.type) {
case PTHREAD_MUTEX_NORMAL:
/* Attempting to relock a normal mutex, deadlock. */
@@ -197,19 +208,21 @@ int cobalt_mutex_timedlock_break(struct cobalt_mutex 
*mutex,
   thread %s 

[Xenomai-git] Philippe Gerum : cobalt/posix/timer: prepare for 32bit syscall emulation

2014-10-30 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: b55d99143bc668e0ad757d6ea020ced13300b7ef
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=b55d99143bc668e0ad757d6ea020ced13300b7ef

Author: Philippe Gerum r...@xenomai.org
Date:   Thu Oct 16 14:40:33 2014 +0200

cobalt/posix/timer: prepare for 32bit syscall emulation

---

 kernel/cobalt/posix/timer.c |   66 ---
 kernel/cobalt/posix/timer.h |   20 +
 2 files changed, 52 insertions(+), 34 deletions(-)

diff --git a/kernel/cobalt/posix/timer.c b/kernel/cobalt/posix/timer.c
index 819db8e..1f59975 100644
--- a/kernel/cobalt/posix/timer.c
+++ b/kernel/cobalt/posix/timer.c
@@ -259,8 +259,8 @@ out:
return ret;
 }
 
-void cobalt_xntimer_gettime(struct xntimer *__restrict__ timer,
-   struct itimerspec *__restrict__ value)
+void __cobalt_timer_getval(struct xntimer *__restrict__ timer,
+  struct itimerspec *__restrict__ value)
 {
if (!xntimer_running_p(timer)) {
value-it_value.tv_sec = 0;
@@ -290,11 +290,11 @@ timer_gettimeout(struct cobalt_timer *__restrict__ timer,
 
if (!cobalt_call_extension(timer_gettime, timer-extref,
   ret, value) || ret == 0)
-   cobalt_xntimer_gettime(timer-timerbase, value);
+   __cobalt_timer_getval(timer-timerbase, value);
 }
 
-int cobalt_xntimer_settime(struct xntimer *__restrict__ timer, int clock_flag,
-   const struct itimerspec *__restrict__ value)
+int __cobalt_timer_setval(struct xntimer *__restrict__ timer, int clock_flag,
+ const struct itimerspec *__restrict__ value)
 {
xnticks_t start, period;
 
@@ -349,8 +349,8 @@ static inline int timer_set(struct cobalt_timer *timer, int 
flags,
 */
xntimer_set_sched(timer-timerbase, thread-threadbase.sched);
 
-   return cobalt_xntimer_settime(timer-timerbase,
-   clock_flag(flags, timer-clockid), value);
+   return __cobalt_timer_setval(timer-timerbase,
+clock_flag(flags, timer-clockid), value);
 }
 
 static inline void
@@ -371,10 +371,9 @@ timer_deliver_late(struct cobalt_process *cc, timer_t 
timerid)
xnlock_put_irqrestore(nklock, s);
 }
 
-static inline int
-timer_settime(timer_t timerid, int flags,
- const struct itimerspec *__restrict__ value,
- struct itimerspec *__restrict__ ovalue)
+int __cobalt_timer_settime(timer_t timerid, int flags,
+  const struct itimerspec *__restrict__ value,
+  struct itimerspec *__restrict__ ovalue)
 {
struct cobalt_timer *timer;
struct cobalt_process *cc;
@@ -413,7 +412,7 @@ out:
return ret;
 }
 
-static inline int timer_gettime(timer_t timerid, struct itimerspec *value)
+int __cobalt_timer_gettime(timer_t timerid, struct itimerspec *value)
 {
struct cobalt_timer *timer;
struct cobalt_process *cc;
@@ -445,22 +444,14 @@ int cobalt_timer_delete(timer_t timerid)
return timer_delete(timerid);
 }
 
-COBALT_SYSCALL(timer_create, current,
-  int, (clockid_t clock,
-const struct sigevent __user *u_sev,
-timer_t __user *u_tm))
+int __cobalt_timer_create(clockid_t clock,
+ const struct sigevent *sev,
+ timer_t __user *u_tm)
 {
-   struct sigevent sev, *evp = NULL;
timer_t timerid = 0;
int ret;
 
-   if (u_sev) {
-   evp = sev;
-   if (__xn_safe_copy_from_user(sev, u_sev, sizeof(sev)))
-   return -EFAULT;
-   }
-
-   ret = timer_create(clock, evp, timerid);
+   ret = timer_create(clock, sev, timerid);
if (ret)
return ret;
 
@@ -472,25 +463,42 @@ COBALT_SYSCALL(timer_create, current,
return 0;
 }
 
+COBALT_SYSCALL(timer_create, current,
+  int, (clockid_t clock,
+const struct sigevent __user *u_sev,
+timer_t __user *u_tm))
+{
+   struct sigevent sev, *evp = NULL;
+
+   if (u_sev) {
+   evp = sev;
+   if (__xn_safe_copy_from_user(sev, u_sev, sizeof(sev)))
+   return -EFAULT;
+   }
+
+   return __cobalt_timer_create(clock, evp, u_tm);
+}
+
 COBALT_SYSCALL(timer_settime, primary,
   int, (timer_t tm, int flags,
 const struct itimerspec __user *u_newval,
 struct itimerspec __user *u_oldval))
 {
-   struct itimerspec newv, oldv, *oldvp;
+   struct itimerspec newv, oldv, *oldvp = oldv;
int ret;
 
-   oldvp = u_oldval == 0 ? NULL : oldv;
+   if (u_oldval == NULL)
+   oldvp = NULL;
 
if (__xn_safe_copy_from_user(newv, u_newval, sizeof(newv)))
return -EFAULT;
 
-   ret = 

[Xenomai-git] Philippe Gerum : cobalt/posix/signal: fixup sigpending() prototype

2014-10-30 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: 091ddb5bfda22cf9cc9e363a9d03beb9d3090200
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=091ddb5bfda22cf9cc9e363a9d03beb9d3090200

Author: Philippe Gerum r...@xenomai.org
Date:   Tue Oct 28 10:37:06 2014 +0100

cobalt/posix/signal: fixup sigpending() prototype

---

 kernel/cobalt/posix/signal.c|4 ++--
 kernel/cobalt/posix/signal.h|2 +-
 kernel/cobalt/posix/syscall32.c |6 +++---
 kernel/cobalt/posix/syscall32.h |2 +-
 4 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/kernel/cobalt/posix/signal.c b/kernel/cobalt/posix/signal.c
index 94d87d6..83f03fd 100644
--- a/kernel/cobalt/posix/signal.c
+++ b/kernel/cobalt/posix/signal.c
@@ -451,10 +451,10 @@ COBALT_SYSCALL(sigwaitinfo, nonrestartable,
return __cobalt_sigwaitinfo(set, u_si, signal_put_siginfo);
 }
 
-COBALT_SYSCALL(sigpending, primary, int, (sigset_t __user *u_set))
+COBALT_SYSCALL(sigpending, primary, int, (old_sigset_t __user *u_set))
 {
struct cobalt_thread *curr = cobalt_current_thread();
-   
+
return __xn_safe_copy_to_user(u_set, curr-sigpending, sizeof(*u_set));
 }
 
diff --git a/kernel/cobalt/posix/signal.h b/kernel/cobalt/posix/signal.h
index 9f4c972..75c5a2a 100644
--- a/kernel/cobalt/posix/signal.h
+++ b/kernel/cobalt/posix/signal.h
@@ -106,7 +106,7 @@ COBALT_SYSCALL_DECL(sigwaitinfo,
  struct siginfo __user *u_si));
 
 COBALT_SYSCALL_DECL(sigpending,
-   int, (sigset_t __user *u_set));
+   int, (old_sigset_t __user *u_set));
 
 COBALT_SYSCALL_DECL(kill, int, (pid_t pid, int sig));
 
diff --git a/kernel/cobalt/posix/syscall32.c b/kernel/cobalt/posix/syscall32.c
index a9b0ade..3074a3a 100644
--- a/kernel/cobalt/posix/syscall32.c
+++ b/kernel/cobalt/posix/syscall32.c
@@ -577,11 +577,11 @@ COBALT_SYSCALL32emu(sigwaitinfo, nonrestartable,
return __cobalt_sigwaitinfo(set, u_si, sys32_put_siginfo);
 }
 
-COBALT_SYSCALL32emu(sigpending, primary, int, (compat_sigset_t __user *u_set))
+COBALT_SYSCALL32emu(sigpending, primary, int, (compat_old_sigset_t __user 
*u_set))
 {
struct cobalt_thread *curr = cobalt_current_thread();
-   
-   return sys32_put_sigset(u_set, curr-sigpending);
+
+   return sys32_put_sigset((compat_sigset_t *)u_set, curr-sigpending);
 }
 
 COBALT_SYSCALL32emu(sigqueue, conforming,
diff --git a/kernel/cobalt/posix/syscall32.h b/kernel/cobalt/posix/syscall32.h
index f1ebaec..c759820 100644
--- a/kernel/cobalt/posix/syscall32.h
+++ b/kernel/cobalt/posix/syscall32.h
@@ -142,7 +142,7 @@ COBALT_SYSCALL32emu_DECL(sigwaitinfo,
   struct compat_siginfo __user *u_si));
 
 COBALT_SYSCALL32emu_DECL(sigpending,
-int, (compat_sigset_t __user *u_set));
+int, (compat_old_sigset_t __user *u_set));
 
 COBALT_SYSCALL32emu_DECL(sigqueue,
 int, (pid_t pid, int sig,


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://www.xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Gilles Chanteperdrix : lib/cobalt: wrap time and gettimeofday calls

2014-10-30 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: 496b0b95d4eb780ce8c3ba769151697204606b60
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=496b0b95d4eb780ce8c3ba769151697204606b60

Author: Gilles Chanteperdrix gilles.chanteperd...@xenomai.org
Date:   Sat Sep 20 23:06:02 2014 +0200

lib/cobalt: wrap time and gettimeofday calls

---

 include/cobalt/time.h   |2 ++
 lib/cobalt/assert_context.c |7 ---
 lib/cobalt/clock.c  |   23 +++
 lib/cobalt/cobalt.wrappers  |1 +
 4 files changed, 26 insertions(+), 7 deletions(-)

diff --git a/include/cobalt/time.h b/include/cobalt/time.h
index c5d7412..fed8957 100644
--- a/include/cobalt/time.h
+++ b/include/cobalt/time.h
@@ -44,6 +44,8 @@ COBALT_DECL(int, clock_nanosleep(clockid_t clock_id,
 const struct timespec *rqtp,
 struct timespec *rmtp));
 
+COBALT_DECL(time_t, time(time_t *t));
+
 COBALT_DECL(int, nanosleep(const struct timespec *rqtp,
   struct timespec *rmtp));
 
diff --git a/lib/cobalt/assert_context.c b/lib/cobalt/assert_context.c
index 6b49f3d..48690dc 100644
--- a/lib/cobalt/assert_context.c
+++ b/lib/cobalt/assert_context.c
@@ -75,10 +75,3 @@ COBALT_IMPL(void, free, (void *ptr))
assert_nrt();
__STD(free(ptr));
 }
-
-/* vsyscall-based services */
-COBALT_IMPL(int, gettimeofday, (struct timeval *tv, struct timezone *tz))
-{
-   assert_nrt();
-   return __STD(gettimeofday(tv, tz));
-}
diff --git a/lib/cobalt/clock.c b/lib/cobalt/clock.c
index b31517f..d17ea56 100644
--- a/lib/cobalt/clock.c
+++ b/lib/cobalt/clock.c
@@ -25,6 +25,7 @@
 #include pthread.h
 #include unistd.h
 #include time.h
+#include sys/time.h
 #include cobalt/uapi/time.h
 #include cobalt/ticks.h
 #include asm/xenomai/syscall.h
@@ -356,4 +357,26 @@ COBALT_IMPL(unsigned int, sleep, (unsigned int seconds))
return 0;
 }
 
+COBALT_IMPL(int, gettimeofday, (struct timeval *tv, struct timezone *tz))
+{
+   struct timespec ts;
+   int ret = __WRAP(clock_gettime(CLOCK_REALTIME, ts));
+   if (ret == 0) {
+   tv-tv_sec = ts.tv_sec;
+   tv-tv_usec = ts.tv_nsec / 1000;
+   }
+   return ret;
+}
+
+COBALT_IMPL(time_t, time, (time_t *t))
+{
+   struct timespec ts;
+   int ret = __WRAP(clock_gettime(CLOCK_REALTIME, ts));
+   if (ret)
+   return (time_t)-1;
+
+   if (t)
+   *t = ts.tv_sec;
+   return ts.tv_sec;
+}
 /** @} */
diff --git a/lib/cobalt/cobalt.wrappers b/lib/cobalt/cobalt.wrappers
index 10cb36a..329ff3b 100644
--- a/lib/cobalt/cobalt.wrappers
+++ b/lib/cobalt/cobalt.wrappers
@@ -104,3 +104,4 @@
 --wrap kill
 --wrap sleep
 --wrap mmap
+--wrap time


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://www.xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : cobalt/posix/timerfd: prepare for 32bit syscall emulation

2014-10-30 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: ba218111ebea0ce19a47bb7f4802d79a20972e73
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=ba218111ebea0ce19a47bb7f4802d79a20972e73

Author: Philippe Gerum r...@xenomai.org
Date:   Thu Oct 16 14:41:12 2014 +0200

cobalt/posix/timerfd: prepare for 32bit syscall emulation

---

 kernel/cobalt/posix/timerfd.c |  102 +++--
 kernel/cobalt/posix/timerfd.h |7 +++
 2 files changed, 65 insertions(+), 44 deletions(-)

diff --git a/kernel/cobalt/posix/timerfd.c b/kernel/cobalt/posix/timerfd.c
index f994a22..7324ce9 100644
--- a/kernel/cobalt/posix/timerfd.c
+++ b/kernel/cobalt/posix/timerfd.c
@@ -43,9 +43,9 @@ struct cobalt_tfd {
 
 static ssize_t timerfd_read(struct rtdm_fd *fd, void __user *buf, size_t size)
 {
-   unsigned long long __user *u_ticks;
-   unsigned long long ticks = 0;
struct cobalt_tfd *tfd;
+   __u64 __user *u_ticks;
+   __u64 ticks = 0;
bool aligned;
spl_t s;
int err;
@@ -54,6 +54,9 @@ static ssize_t timerfd_read(struct rtdm_fd *fd, void __user 
*buf, size_t size)
return -EINVAL;
 
u_ticks = buf;
+   if (!access_wok(u_ticks, sizeof(*u_ticks)))
+   return -EFAULT;
+
aligned = (((unsigned long)buf)  (sizeof(ticks) - 1)) == 0;
 
tfd = container_of(fd, struct cobalt_tfd, fd);
@@ -230,15 +233,12 @@ static inline void tfd_put(struct cobalt_tfd *tfd)
rtdm_fd_put(tfd-fd);
 }
 
-COBALT_SYSCALL(timerfd_settime, primary,
-  int, (int fd, int flags,
-const struct itimerspec __user *new_value,
-struct itimerspec __user *old_value))
+int __cobalt_timerfd_settime(int fd, int flags,
+const struct itimerspec *value,
+struct itimerspec *ovalue)
 {
-   struct itimerspec ovalue, value;
struct cobalt_tfd *tfd;
-   int cflag;
-   int err;
+   int cflag, ret;
spl_t s;
 
if (flags  ~COBALT_TFD_SETTIME_FLAGS)
@@ -248,57 +248,63 @@ COBALT_SYSCALL(timerfd_settime, primary,
if (IS_ERR(tfd))
return PTR_ERR(tfd);
 
-   if (!new_value ||
-   __xn_copy_from_user(value, new_value, sizeof(value))) {
-   err = -EFAULT;
-   goto out;
-   }
-
cflag = (flags  TFD_TIMER_ABSTIME) ? TIMER_ABSTIME : 0;
 
xnlock_get_irqsave(nklock, s);
 
+   tfd-target = NULL;
if (flags  TFD_WAKEUP) {
tfd-target = xnthread_current();
if (tfd-target == NULL) {
-   err = -EPERM;
-   goto out_unlock;
+   ret = -EPERM;
+   goto out;
}
-   } else
-   tfd-target = NULL;
+   }
 
-   if (old_value)
-   cobalt_xntimer_gettime(tfd-timer, ovalue);
+   if (ovalue)
+   __cobalt_timer_getval(tfd-timer, ovalue);
 
xntimer_set_sched(tfd-timer, xnsched_current());
 
-   err = cobalt_xntimer_settime(tfd-timer,
-   clock_flag(cflag, tfd-clockid), value);
-  out_unlock:
+   ret = __cobalt_timer_setval(tfd-timer,
+   clock_flag(cflag, tfd-clockid), value);
+out:
xnlock_put_irqrestore(nklock, s);
 
-   if (err == 0  old_value 
-   __xn_copy_to_user(old_value, ovalue, sizeof(ovalue))) {
-   xnlock_get_irqsave(nklock, s);
-   xntimer_stop(tfd-timer);
-   tfd-target = NULL;
-   xnlock_put_irqrestore(nklock, s);
+   tfd_put(tfd);
 
-   err = -EFAULT;
-   }
+   return ret;
+}
 
-  out:
-   tfd_put(tfd);
+COBALT_SYSCALL(timerfd_settime, primary,
+  int, (int fd, int flags,
+const struct itimerspec __user *new_value,
+struct itimerspec __user *old_value))
+{
+   struct itimerspec ovalue, value;
+   int ret;
 
-   return err;
+   ret = __xn_safe_copy_from_user(value, new_value, sizeof(value));
+   if (ret)
+   return ret;
+
+   ret = __cobalt_timerfd_settime(fd, flags, value, ovalue);
+   if (ret)
+   return ret;
+
+   if (old_value) {
+   ret = __xn_safe_copy_to_user(old_value, ovalue, 
sizeof(ovalue));
+   value.it_value.tv_sec = 0;
+   value.it_value.tv_nsec = 0;
+   __cobalt_timerfd_settime(fd, flags, value, NULL);
+   }
+
+   return ret;
 }
 
-COBALT_SYSCALL(timerfd_gettime, current,
-  int, (int fd, struct itimerspec __user *curr_value))
+int __cobalt_timerfd_gettime(int fd, struct itimerspec *value)
 {
-   struct itimerspec value;
struct cobalt_tfd *tfd;
-   int err = 0;
spl_t s;
 
tfd = tfd_get(fd);
@@ -306,13 +312,21 @@ COBALT_SYSCALL(timerfd_gettime, current,
return 

[Xenomai-git] Philippe Gerum : cobalt/posix/compat: fix sys32_put_sigset() helper

2014-10-30 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: 37374676e81988e6dffb52cfb96ebcbe24560006
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=37374676e81988e6dffb52cfb96ebcbe24560006

Author: Philippe Gerum r...@xenomai.org
Date:   Tue Oct 28 11:50:03 2014 +0100

cobalt/posix/compat: fix sys32_put_sigset() helper

---

 kernel/cobalt/posix/compat.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/cobalt/posix/compat.c b/kernel/cobalt/posix/compat.c
index de2143a..e0f9609 100644
--- a/kernel/cobalt/posix/compat.c
+++ b/kernel/cobalt/posix/compat.c
@@ -273,7 +273,7 @@ int sys32_put_sigset(compat_sigset_t *u_cset, const 
sigset_t *set)
 
sigset_to_compat(cset, set);
 
-   return __xn_safe_copy_from_user(u_cset, cset, sizeof(cset));
+   return __xn_safe_copy_to_user(u_cset, cset, sizeof(cset));
 }
 EXPORT_SYMBOL_GPL(sys32_put_sigset);
 


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://www.xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : cobalt/posix/thread: prepare for 32bit syscall emulation

2014-10-30 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: 6baf0c769a41a5ff65686c51f2341ab09db24e9e
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=6baf0c769a41a5ff65686c51f2341ab09db24e9e

Author: Philippe Gerum r...@xenomai.org
Date:   Thu Oct 16 14:38:18 2014 +0200

cobalt/posix/thread: prepare for 32bit syscall emulation

---

 kernel/cobalt/posix/thread.c |   74 --
 kernel/cobalt/posix/thread.h |   10 ++
 lib/cobalt/thread.c  |   51 +++--
 3 files changed, 92 insertions(+), 43 deletions(-)

diff --git a/kernel/cobalt/posix/thread.c b/kernel/cobalt/posix/thread.c
index 8271afd..a74d024 100644
--- a/kernel/cobalt/posix/thread.c
+++ b/kernel/cobalt/posix/thread.c
@@ -439,29 +439,19 @@ static inline int pthread_setmode_np(int clrmask, int 
setmask, int *mode_r)
return 0;
 }
 
-/*
- * NOTE: there is no cobalt_thread_setschedparam syscall defined by
- * the Cobalt ABI. Useland changes scheduling parameters only via the
- * extended cobalt_thread_setschedparam_ex syscall.
- */
-COBALT_SYSCALL(thread_setschedparam_ex, conforming,
-  int, (unsigned long pth,
-int policy,
-const struct sched_param_ex __user *u_param,
-__u32 __user *u_winoff,
-int __user *u_promoted))
+int __cobalt_thread_setschedparam_ex(unsigned long pth,
+int policy,
+const struct sched_param_ex *param_ex,
+__u32 __user *u_winoff,
+int __user *u_promoted)
 {
-   struct sched_param_ex param_ex;
struct cobalt_local_hkey hkey;
struct cobalt_thread *thread;
int ret, promoted = 0;
 
-   if (__xn_safe_copy_from_user(param_ex, u_param, sizeof(param_ex)))
-   return -EFAULT;
-
hkey.u_pth = pth;
hkey.mm = current-mm;
-   trace_cobalt_pthread_setschedparam(pth, policy, param_ex);
+   trace_cobalt_pthread_setschedparam(pth, policy, param_ex);
 
thread = thread_lookup(hkey);
if (thread == NULL  u_winoff) {
@@ -473,7 +463,7 @@ COBALT_SYSCALL(thread_setschedparam_ex, conforming,
}
 
if (thread)
-   ret = pthread_setschedparam_ex(thread, policy, param_ex);
+   ret = pthread_setschedparam_ex(thread, policy, param_ex);
else
ret = -EPERM;
 
@@ -485,16 +475,30 @@ COBALT_SYSCALL(thread_setschedparam_ex, conforming,
 }
 
 /*
- * NOTE: there is no cobalt_thread_getschedparam syscall defined by
- * the Cobalt ABI. Useland retrieves scheduling parameters only via
- * the extended cobalt_thread_getschedparam_ex syscall.
+ * NOTE: there is no cobalt_thread_setschedparam syscall defined by
+ * the Cobalt ABI. Useland changes scheduling parameters only via the
+ * extended cobalt_thread_setschedparam_ex syscall.
  */
-COBALT_SYSCALL(thread_getschedparam_ex, current,
+COBALT_SYSCALL(thread_setschedparam_ex, conforming,
   int, (unsigned long pth,
-int __user *u_policy,
-struct sched_param_ex __user *u_param))
+int policy,
+const struct sched_param_ex __user *u_param,
+__u32 __user *u_winoff,
+int __user *u_promoted))
 {
struct sched_param_ex param_ex;
+
+   if (__xn_safe_copy_from_user(param_ex, u_param, sizeof(param_ex)))
+   return -EFAULT;
+
+   return __cobalt_thread_setschedparam_ex(pth, policy, param_ex,
+   u_winoff, u_promoted);
+}
+
+int __cobalt_thread_getschedparam_ex(unsigned long pth,
+int __user *u_policy,
+struct sched_param_ex *param_ex)
+{
struct cobalt_local_hkey hkey;
struct cobalt_thread *thread;
int policy, ret;
@@ -505,15 +509,35 @@ COBALT_SYSCALL(thread_getschedparam_ex, current,
if (thread == NULL)
return -ESRCH;
 
-   ret = pthread_getschedparam_ex(thread, policy, param_ex);
+   ret = pthread_getschedparam_ex(thread, policy, param_ex);
if (ret)
return ret;
 
-   trace_cobalt_pthread_getschedparam(pth, policy, param_ex);
+   trace_cobalt_pthread_getschedparam(pth, policy, param_ex);
 
if (__xn_safe_copy_to_user(u_policy, policy, sizeof(int)))
return -EFAULT;
 
+   return policy;
+}
+
+/*
+ * NOTE: there is no cobalt_thread_getschedparam syscall defined by
+ * the Cobalt ABI. Useland retrieves scheduling parameters only via
+ * the extended cobalt_thread_getschedparam_ex syscall.
+ */
+COBALT_SYSCALL(thread_getschedparam_ex, current,
+  int, (unsigned long pth,
+int __user *u_policy,
+struct sched_param_ex __user *u_param))
+{
+   struct sched_param_ex 

[Xenomai-git] Jorge Ramirez-Ortiz : utils/analogy: calibration - cleanup

2014-10-30 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: a4ec3dfe961e91e26abf61b78036481eda213e60
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=a4ec3dfe961e91e26abf61b78036481eda213e60

Author: Jorge Ramirez-Ortiz j...@xenomai.org
Date:   Sat Oct 25 12:37:33 2014 -0400

utils/analogy: calibration - cleanup

---

 lib/analogy/calibration.c |   35 ---
 utils/analogy/Makefile.am |   12 +---
 utils/analogy/analogy_calibrate.c |3 ---
 utils/analogy/analogy_calibrate.h |3 ---
 utils/analogy/calibration_ni_m.c  |6 --
 5 files changed, 9 insertions(+), 50 deletions(-)

diff --git a/lib/analogy/calibration.c b/lib/analogy/calibration.c
index 9fd944c..331dcac 100644
--- a/lib/analogy/calibration.c
+++ b/lib/analogy/calibration.c
@@ -19,12 +19,13 @@
  * License along with this library; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.
  */
-
+#include sys/types.h
+#include sys/stat.h
+#include fcntl.h
 #include math.h
 #include rtdm/analogy.h
 #include stdio.h
 #include errno.h
-#include wordexp.h
 #include iniparser/iniparser.h
 #include boilerplate/list.h
 #include calibration.h
@@ -196,36 +197,16 @@ write_calibration_file(FILE *dst, struct list *l,
 int a4l_read_calibration_file(char *name, struct a4l_calibration_data *data)
 {
const char *subdevice[2] = { AI_SUBD_STR, AO_SUBD_STR };
-   struct a4l_calibration_subdev_data *p = NULL;
int i, j, k, index = -1, nb_elements = -1;
+   struct a4l_calibration_subdev_data *p = NULL;
struct _dictionary_ *d;
-   const char *filename;
-   wordexp_t exp;
-   int ret = 0;
-
-   ret = wordexp(name, exp, WRDE_NOCMD|WRDE_UNDEF);
-   if (ret) {
-   /* can't apply calibration */
-   ret = ret == WRDE_NOSPACE ? -ENOMEM : -EINVAL;
-   return ret;
-   }
 
-   if (exp.we_wordc != 1) {
-   /* weird expansion of %s as rc file \n, params.name */
+   if (access(name, R_OK))
return -1;
-   }
 
-   filename = exp.we_wordv[0];
-   if (access(filename, R_OK)) {
-   /* cant access %s for reading \n, params.name */
+   d = iniparser_load(name);
+   if (d == NULL)
return -1;
-   }
-
-   d = iniparser_load(filename);
-   if (d == NULL) {
-   /* loading error for %s (%d)\n, params.name, errno */
-   return -1;
-   }
 
read_str(data-driver_name, d, PLATFORM_STR, DRIVER_STR);
read_str(data-board_name, d, PLATFORM_STR, BOARD_STR);
@@ -271,7 +252,7 @@ int a4l_read_calibration_file(char *name, struct 
a4l_calibration_data *data)
p++;
}
}
-   wordfree(exp);
+
 
return 0;
 }
diff --git a/utils/analogy/Makefile.am b/utils/analogy/Makefile.am
index eed1265..57ff7a8 100644
--- a/utils/analogy/Makefile.am
+++ b/utils/analogy/Makefile.am
@@ -31,17 +31,7 @@ analogy_config_LDADD = \
-lrt -lpthread
 
 analogy_calibrate_SOURCES = analogy_calibrate.c calibration_ni_m.c
-analogy_calibrate.c: git-stamp.h calibration_ni_m.h
-git-stamp.h: git-stamp
-   @set -x; if test -r $(top_srcdir)/.git; then
\
- stamp=`git --git-dir=$(top_srcdir)/.git rev-list --abbrev-commit -1 
HEAD`;\
- if test \! -s $@ || grep -wvq $$stamp $@; then
\
-   date=`git --git-dir=$(top_srcdir)/.git log -1 $$stamp 
--pretty=format:%ci`; \
-   echo #define GIT_STAMP \#$$stamp ($$date)\  $@;
\
- fi;   
\
-   elif test \! -r $@ -o -s $@; then   
\
-   rm -f $@  touch $@;   
\
-   fi; true
+analogy_calibrate.c: calibration_ni_m.h
 analogy_calibrate_LDADD = \
../../lib/analogy/libanalogy.la \
../../lib/cobalt/libcobalt.la   \
diff --git a/utils/analogy/analogy_calibrate.c 
b/utils/analogy/analogy_calibrate.c
index 1b87e39..ca33ab7 100644
--- a/utils/analogy/analogy_calibrate.c
+++ b/utils/analogy/analogy_calibrate.c
@@ -32,7 +32,6 @@
 #include calibration_ni_m.h
 
 struct timespec calibration_start_time;
-static const char *revision = 1.0.0;
 a4l_desc_t descriptor;
 
 static const struct option options[] = {
@@ -86,8 +85,6 @@ int main(int argc, char *argv[])
int v, i, fd, err = 0;
FILE *p = NULL;
 
-   __debug(version: git commit %s, revision %s \n, GIT_STAMP, revision);
-
for (;;) {
i = -1;
v = getopt_long_only(argc, argv, , options, i);
diff --git a/utils/analogy/analogy_calibrate.h 
b/utils/analogy/analogy_calibrate.h
index 09812ae..b2a1c6e 100644
--- 

[Xenomai-git] Philippe Gerum : alchemy/pipe: fix assorted issues in rt_pipe_create() wrapper to XDDP

2014-10-30 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: eb69a837eaab4cd6639772503c789de0a52906c0
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=eb69a837eaab4cd6639772503c789de0a52906c0

Author: Philippe Gerum r...@xenomai.org
Date:   Thu Oct 30 12:13:05 2014 +0100

alchemy/pipe: fix assorted issues in rt_pipe_create() wrapper to XDDP

In addition, the assigned minor is now returned (for use with
P_MINOR_AUTO).

---

 include/alchemy/pipe.h |5 +++--
 lib/alchemy/init.c |   17 +
 lib/alchemy/pipe.c |   26 +-
 lib/alchemy/pipe.h |3 +++
 4 files changed, 44 insertions(+), 7 deletions(-)

diff --git a/include/alchemy/pipe.h b/include/alchemy/pipe.h
index 4be8f85..4f91281 100644
--- a/include/alchemy/pipe.h
+++ b/include/alchemy/pipe.h
@@ -19,6 +19,7 @@
 #define _XENOMAI_ALCHEMY_PIPE_H
 
 #include stdint.h
+#include cobalt/uapi/kernel/pipe.h
 #include alchemy/timer.h
 
 /**
@@ -30,8 +31,8 @@
 #define P_MINOR_AUTO   XNPIPE_MINOR_AUTO
 
 /** Operation flags. */
-#define P_URGENT  0x1
-#define P_NORMAL  0x0
+#define P_URGENT   XNPIPE_URGENT
+#define P_NORMAL   XNPIPE_NORMAL
 
 struct RT_PIPE {
uintptr_t handle;
diff --git a/lib/alchemy/init.c b/lib/alchemy/init.c
index bf37840..daaa757 100644
--- a/lib/alchemy/init.c
+++ b/lib/alchemy/init.c
@@ -33,6 +33,7 @@
 #include buffer.h
 #include heap.h
 #include alarm.h
+#include pipe.h
 
 /**
  * @defgroup alchemy Alchemy API
@@ -80,6 +81,20 @@ static void alchemy_help(void)
 fprintf(stderr, --alchemy-clock-resolution=ns  tick value (default 
1ns, tickless)\n);
 }
 
+#ifdef CONFIG_XENO_COBALT
+
+static inline void init_corespec(void)
+{
+   syncluster_init(alchemy_pipe_table, alchemy.pipe);
+   registry_add_dir(/alchemy/pipes);
+}
+
+#else
+
+static inline void init_corespec(void) { }
+
+#endif
+
 static int alchemy_init(void)
 {
int ret;
@@ -112,6 +127,8 @@ static int alchemy_init(void)
registry_add_dir(/alchemy/heaps);
registry_add_dir(/alchemy/alarms);
 
+   init_corespec();
+
return 0;
 }
 
diff --git a/lib/alchemy/pipe.c b/lib/alchemy/pipe.c
index 439a00f..be974c0 100644
--- a/lib/alchemy/pipe.c
+++ b/lib/alchemy/pipe.c
@@ -110,7 +110,8 @@ DEFINE_LOOKUP_PRIVATE(pipe, RT_PIPE);
  * pipe. Passing 0 means that all message allocations for this pipe are
  * performed on the Cobalt core heap.
  *
- * @return Zero is returned upon success. Otherwise:
+ * @return The @a minor number assigned to the connection is returned
+ * upon success. Otherwise:
  *
  * - -ENOMEM is returned if the system fails to get memory from the
  * main heap in order to create the pipe.
@@ -136,6 +137,7 @@ int rt_pipe_create(RT_PIPE *pipe,
struct alchemy_pipe *pcb;
struct service svc;
size_t streambufsz;
+   socklen_t addrlen;
int ret, sock;
 
if (threadobj_irq_p())
@@ -166,15 +168,15 @@ int rt_pipe_create(RT_PIPE *pipe,
}
 
if (poolsize  0) {
-   ret = __RT(setsockopt(pcb-sock, SOL_XDDP, XDDP_POOLSZ,
+   ret = __RT(setsockopt(sock, SOL_XDDP, XDDP_POOLSZ,
  poolsize, sizeof(poolsize)));
if (ret)
goto fail_sockopt;
}
 
streambufsz = ALCHEMY_PIPE_STREAMSZ;
-   ret = __RT(setsockopt(pcb-sock, SOL_XDDP, XDDP_BUFSZ,
- streambufsz, streambufsz));
+   ret = __RT(setsockopt(sock, SOL_XDDP, XDDP_BUFSZ,
+ streambufsz, sizeof(streambufsz)));
if (ret)
goto fail_sockopt;
 
@@ -185,8 +187,22 @@ int rt_pipe_create(RT_PIPE *pipe,
if (ret)
goto fail_sockopt;
 
+   if (minor == P_MINOR_AUTO) {
+   /* Fetch the assigned minor device. */
+   addrlen = sizeof(saddr);
+   ret = __RT(getsockname(sock, (struct sockaddr *)saddr, 
addrlen));
+   if (ret)
+   goto fail_sockopt;
+   if (addrlen != sizeof(saddr)) {
+   ret = -EINVAL;
+   goto fail_register;
+   }
+   minor = saddr.sipc_port;
+   }
+
generate_name(pcb-name, name, pipe_namegen);
pcb-sock = sock;
+   pcb-minor = minor;
pcb-magic = pipe_magic;
 
if (syncluster_addobj(alchemy_pipe_table, pcb-name, pcb-cobj)) {
@@ -198,7 +214,7 @@ int rt_pipe_create(RT_PIPE *pipe,
 
CANCEL_RESTORE(svc);
 
-   return 0;
+   return minor;
 fail_sockopt:
ret = -errno;
if (ret == -EADDRINUSE)
diff --git a/lib/alchemy/pipe.h b/lib/alchemy/pipe.h
index 5d90d75..48843af 100644
--- a/lib/alchemy/pipe.h
+++ b/lib/alchemy/pipe.h
@@ -29,9 +29,12 @@ struct alchemy_pipe {
unsigned int magic; /* Must be first. */
char name[XNOBJECT_NAME_LEN];
int sock;
+   int minor;
struct clusterobj cobj;
 };
 
 #define pipe_magic 0x8b8bebeb
 

[Xenomai-git] Philippe Gerum : cobalt/posix: 32bit syscall wrappers

2014-10-30 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: e34b18e0f5de26254b774977acae119cbd7f1f1d
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=e34b18e0f5de26254b774977acae119cbd7f1f1d

Author: Philippe Gerum r...@xenomai.org
Date:   Thu Oct 16 14:43:59 2014 +0200

cobalt/posix: 32bit syscall wrappers

---

 kernel/cobalt/posix/Makefile|2 +-
 kernel/cobalt/posix/syscall32.c | 1149 ++-
 kernel/cobalt/posix/syscall32.h |  267 +
 3 files changed, 1403 insertions(+), 15 deletions(-)

diff --git a/kernel/cobalt/posix/Makefile b/kernel/cobalt/posix/Makefile
index e965846..22d5f2b 100644
--- a/kernel/cobalt/posix/Makefile
+++ b/kernel/cobalt/posix/Makefile
@@ -20,6 +20,6 @@ xenomai-y :=  \
timer.o \
timerfd.o
 
-xenomai-$(CONFIG_XENO_OPT_SYS3264) += syscall32.o
+xenomai-$(CONFIG_XENO_ARCH_SYS3264) += syscall32.o
 
 ccflags-y := -Iarch/$(SRCARCH)/xenomai/include -Iinclude/xenomai -Ikernel
diff --git a/kernel/cobalt/posix/syscall32.c b/kernel/cobalt/posix/syscall32.c
index 3b0b71c..603c379 100644
--- a/kernel/cobalt/posix/syscall32.c
+++ b/kernel/cobalt/posix/syscall32.c
@@ -17,19 +17,1140 @@
  */
 #include linux/types.h
 #include linux/err.h
-#include linux/compat.h
 #include cobalt/uapi/syscall.h
+#include xenomai/rtdm/internal.h
 #include internal.h
-#include thread.h
-#include sched.h
-#include mutex.h
-#include cond.h
-#include mqueue.h
-#include sem.h
-#include signal.h
-#include timer.h
-#include monitor.h
-#include clock.h
-#include event.h
-#include timerfd.h
-#include io.h
+#include syscall32.h
+#include ../debug.h
+
+static int sys32_get_timespec(struct timespec *ts,
+ const struct compat_timespec __user *cts)
+{
+   return (cts == NULL ||
+   !access_rok(cts, sizeof(*cts)) ||
+   __xn_get_user(ts-tv_sec, cts-tv_sec) ||
+   __xn_get_user(ts-tv_nsec, cts-tv_nsec)) ? -EFAULT : 0;
+}
+
+static int sys32_put_timespec(struct compat_timespec __user *cts,
+ const struct timespec *ts)
+{
+   return (cts == NULL ||
+   !access_wok(cts, sizeof(*cts)) ||
+   __xn_put_user(ts-tv_sec, cts-tv_sec) ||
+   __xn_put_user(ts-tv_nsec, cts-tv_nsec)) ? -EFAULT : 0;
+}
+
+static int sys32_get_itimerspec(struct itimerspec *its,
+   const struct compat_itimerspec __user *cits)
+{
+   int ret = sys32_get_timespec(its-it_value, cits-it_value);
+
+   return ret ?: sys32_get_timespec(its-it_interval, cits-it_interval);
+}
+
+static int sys32_put_itimerspec(struct compat_itimerspec __user *cits,
+   const struct itimerspec *its)
+{
+   int ret = sys32_put_timespec(cits-it_value, its-it_value);
+
+   return ret ?: sys32_put_timespec(cits-it_interval, its-it_interval);
+}
+
+static int sys32_get_timeval(struct timeval *tv,
+const struct compat_timeval __user *ctv)
+{
+   return (ctv == NULL ||
+   !access_rok(ctv, sizeof(*ctv)) ||
+   __xn_get_user(tv-tv_sec, ctv-tv_sec) ||
+   __xn_get_user(tv-tv_usec, ctv-tv_usec)) ? -EFAULT : 0;
+}
+
+static int sys32_put_timeval(struct compat_timeval __user *ctv,
+const struct timeval *tv)
+{
+   return (ctv == NULL ||
+   !access_wok(ctv, sizeof(*ctv)) ||
+   __xn_put_user(tv-tv_sec, ctv-tv_sec) ||
+   __xn_put_user(tv-tv_usec, ctv-tv_usec)) ? -EFAULT : 0;
+}
+
+static ssize_t sys32_get_fdset(fd_set *fds, const compat_fd_set __user *cfds,
+  size_t cfdsize)
+{
+   int rdpos, wrpos, rdlim = cfdsize / sizeof(compat_ulong_t);
+
+   if (cfds == NULL || !access_rok(cfds, cfdsize))
+   return -EFAULT;
+
+   for (rdpos = 0, wrpos = 0; rdpos  rdlim; rdpos++, wrpos++)
+   if (__xn_get_user(fds-fds_bits[wrpos], cfds-fds_bits + rdpos))
+   return -EFAULT;
+
+   return (ssize_t)rdlim * sizeof(long);
+}
+
+static ssize_t sys32_put_fdset(compat_fd_set __user *cfds, const fd_set *fds,
+  size_t fdsize)
+{
+   int rdpos, wrpos, wrlim = fdsize / sizeof(long);
+
+   if (cfds == NULL || !access_wok(cfds, wrlim * sizeof(compat_ulong_t)))
+   return -EFAULT;
+
+   for (rdpos = 0, wrpos = 0; wrpos  wrlim; rdpos++, wrpos++)
+   if (__xn_put_user(fds-fds_bits[rdpos], cfds-fds_bits + wrpos))
+   return -EFAULT;
+
+   return (ssize_t)wrlim * sizeof(compat_ulong_t);
+}
+
+static int sys32_get_param_ex(int policy,
+ struct sched_param_ex *p,
+ const struct compat_sched_param_ex __user *u_cp)
+{
+   struct compat_sched_param_ex cpex;
+
+   if (u_cp == NULL || __xn_safe_copy_from_user(cpex, u_cp, sizeof(cpex)))
+   return -EFAULT;
+
+   p-sched_priority = 

[Xenomai-git] Philippe Gerum : cobalt/posix/event: prepare for 32bit syscall emulation

2014-10-30 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: 5e4730ebd2327a54c5d78a439faff0e32017e73f
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=5e4730ebd2327a54c5d78a439faff0e32017e73f

Author: Philippe Gerum r...@xenomai.org
Date:   Thu Oct 16 14:38:03 2014 +0200

cobalt/posix/event: prepare for 32bit syscall emulation

---

 kernel/cobalt/posix/event.c |   37 ++---
 kernel/cobalt/posix/event.h |7 ++-
 2 files changed, 32 insertions(+), 12 deletions(-)

diff --git a/kernel/cobalt/posix/event.c b/kernel/cobalt/posix/event.c
index d7d564d..0d0594e 100644
--- a/kernel/cobalt/posix/event.c
+++ b/kernel/cobalt/posix/event.c
@@ -105,11 +105,10 @@ COBALT_SYSCALL(event_init, current,
return __xn_safe_copy_to_user(u_event, shadow, sizeof(*u_event));
 }
 
-COBALT_SYSCALL(event_wait, primary,
-  int, (struct cobalt_event_shadow __user *u_event,
-unsigned int bits,
-unsigned int __user *u_bits_r,
-int mode, struct timespec __user *u_ts))
+int __cobalt_event_wait(struct cobalt_event_shadow __user *u_event,
+   unsigned int bits,
+   unsigned int __user *u_bits_r,
+   int mode, const struct timespec *ts)
 {
unsigned int rbits = 0, testval;
xnticks_t timeout = XN_INFINITE;
@@ -117,23 +116,20 @@ COBALT_SYSCALL(event_wait, primary,
xntmode_t tmode = XN_RELATIVE;
struct event_wait_context ewc;
struct cobalt_event *event;
-   struct timespec ts;
xnhandle_t handle;
int ret = 0, info;
spl_t s;
 
handle = cobalt_get_handle_from_user(u_event-handle);
 
-   if (u_ts) {
-   if (__xn_safe_copy_from_user(ts, u_ts, sizeof(ts)))
-   return -EFAULT;
-   timeout = ts2ns(ts);
+   if (ts) {
+   timeout = ts2ns(ts);
if (timeout) {
timeout++;
tmode = XN_ABSOLUTE;
} else
timeout = XN_NONBLOCK;
-   trace_cobalt_event_timedwait(u_event, bits, mode, ts);
+   trace_cobalt_event_timedwait(u_event, bits, mode, ts);
} else
trace_cobalt_event_wait(u_event, bits, mode);
 
@@ -194,6 +190,25 @@ out:
return ret;
 }
 
+COBALT_SYSCALL(event_wait, primary,
+  int, (struct cobalt_event_shadow __user *u_event,
+unsigned int bits,
+unsigned int __user *u_bits_r,
+int mode, const struct timespec __user *u_ts))
+{
+   struct timespec ts, *tsp = NULL;
+   int ret;
+
+   if (u_ts) {
+   tsp = ts;
+   ret = __xn_safe_copy_from_user(ts, u_ts, sizeof(ts));
+   if (ret)
+   return ret;
+   }
+
+   return __cobalt_event_wait(u_event, bits, u_bits_r, mode, tsp);
+}
+
 COBALT_SYSCALL(event_sync, current,
   int, (struct cobalt_event_shadow __user *u_event))
 {
diff --git a/kernel/cobalt/posix/event.h b/kernel/cobalt/posix/event.h
index 9341800..6dd9f79 100644
--- a/kernel/cobalt/posix/event.h
+++ b/kernel/cobalt/posix/event.h
@@ -36,6 +36,11 @@ struct cobalt_event {
xnhandle_t handle;
 };
 
+int __cobalt_event_wait(struct cobalt_event_shadow __user *u_event,
+   unsigned int bits,
+   unsigned int __user *u_bits_r,
+   int mode, const struct timespec *ts);
+
 COBALT_SYSCALL_DECL(event_init,
int, (struct cobalt_event_shadow __user *u_evtsh,
  unsigned int value,
@@ -46,7 +51,7 @@ COBALT_SYSCALL_DECL(event_wait,
  unsigned int bits,
  unsigned int __user *u_bits_r,
  int mode,
- struct timespec __user *u_ts));
+ const struct timespec __user *u_ts));
 
 COBALT_SYSCALL_DECL(event_sync,
int, (struct cobalt_event_shadow __user *u_evtsh));


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://www.xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : cobalt/posix/sched: prepare for 32bit syscall emulation

2014-10-30 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: 87bb4ce0a3dbe4234a184ccee03576423ede17af
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=87bb4ce0a3dbe4234a184ccee03576423ede17af

Author: Philippe Gerum r...@xenomai.org
Date:   Thu Oct 16 14:39:53 2014 +0200

cobalt/posix/sched: prepare for 32bit syscall emulation

---

 include/cobalt/uapi/sched.h|   38 +--
 kernel/cobalt/posix/sched.c|  345 ++--
 kernel/cobalt/posix/sched.h|   25 +-
 kernel/cobalt/trace/cobalt-posix.h |   31 +--
 testsuite/smokey/sched-quota/sched-quota.c |8 +-
 5 files changed, 276 insertions(+), 171 deletions(-)

diff --git a/include/cobalt/uapi/sched.h b/include/cobalt/uapi/sched.h
index 8ead498..fc04f49 100644
--- a/include/cobalt/uapi/sched.h
+++ b/include/cobalt/uapi/sched.h
@@ -29,8 +29,6 @@
 #define sched_ss_max_repl  sched_u.ss.__sched_max_repl
 #endif /* !SCHED_SPORADIC */
 
-#define sched_rr_quantum   sched_u.rr.__sched_rr_quantum
-
 struct __sched_ss_param {
int __sched_low_priority;
struct timespec __sched_repl_period;
@@ -38,6 +36,8 @@ struct __sched_ss_param {
int __sched_max_repl;
 };
 
+#define sched_rr_quantum   sched_u.rr.__sched_rr_quantum
+
 struct __sched_rr_param {
struct timespec __sched_rr_quantum;
 };
@@ -84,24 +84,28 @@ enum {
 
 struct __sched_config_quota {
int op;
-   int *sum_r;
-   struct {
-   int pshared;
-   int *tgid_r;
-   } add;
-   struct {
-   int tgid;
-   } remove;
-   struct {
+   union {
+   struct {
+   int pshared;
+   } add;
+   struct {
+   int tgid;
+   } remove;
+   struct {
+   int tgid;
+   int quota;
+   int quota_peak;
+   } set;
+   struct {
+   int tgid;
+   } get;
+   };
+   struct __sched_quota_info {
int tgid;
int quota;
int quota_peak;
-   } set;
-   struct {
-   int tgid;
-   int *quota_r;
-   int *quota_peak_r;
-   } get;
+   int quota_sum;
+   } info;
 };
 
 #define sched_quota_confsz()  sizeof(struct __sched_config_quota)
diff --git a/kernel/cobalt/posix/sched.c b/kernel/cobalt/posix/sched.c
index bfdd2e0..f2fe09a 100644
--- a/kernel/cobalt/posix/sched.c
+++ b/kernel/cobalt/posix/sched.c
@@ -239,6 +239,9 @@ int set_tp_config(int cpu, union sched_config *config, 
size_t len)
spl_t s;
int n;
 
+   if (len  sizeof(config-tp))
+   return -EINVAL;
+
if (config-tp.nr_windows == 0) {
gps = NULL;
goto set_schedule;
@@ -294,15 +297,20 @@ fail:
 }
 
 static inline
-ssize_t get_tp_config(int cpu, union sched_config __user *u_config,
- size_t len)
+ssize_t get_tp_config(int cpu, void __user *u_config, size_t len,
+ union sched_config *(*fetch_config)
+ (int policy, const void __user *u_config,
+  size_t *len),
+ ssize_t (*put_config)(int policy, void __user *u_config,
+   const union sched_config *config,
+   size_t len))
 {
struct xnsched_tp_window *pw, *w;
struct xnsched_tp_schedule *gps;
struct sched_tp_window *pp, *p;
union sched_config *config;
struct xnsched *sched;
-   ssize_t ret = 0, elen;
+   ssize_t ret, elen;
spl_t s;
int n;
 
@@ -329,6 +337,7 @@ ssize_t get_tp_config(int cpu, union sched_config __user 
*u_config,
goto out;
}
 
+   ret = elen;
config-tp.nr_windows = gps-pwin_nr;
for (n = 0, pp = p = config-tp.windows, pw = w = gps-pwins;
 n  gps-pwin_nr; pp = p, p++, pw = w, w++, n++) {
@@ -337,11 +346,12 @@ ssize_t get_tp_config(int cpu, union sched_config __user 
*u_config,
p-ptid = w-w_part;
}
ns2ts(pp-duration, gps-tf_duration - pw-w_offset);
-   ret = __xn_safe_copy_to_user(u_config, config, elen);
+   ret = put_config(SCHED_TP, u_config, config, elen);
+   xnfree(config);
 out:
xnsched_tp_put_schedule(gps);
 
-   return ret ?: elen;
+   return ret;
 }
 
 #else /* !CONFIG_XENO_OPT_SCHED_TP */
@@ -353,8 +363,13 @@ set_tp_config(int cpu, union sched_config *config, size_t 
len)
 }
 
 static inline ssize_t
-get_tp_config(int cpu, union sched_config __user *u_config,
- size_t len)
+get_tp_config(int cpu, union sched_config __user *u_config, size_t len,
+ union sched_config *(*fetch_config)
+ (int policy, const void __user *u_config,
+  size_t *len),
+ ssize_t 

[Xenomai-git] Philippe Gerum : cobalt: fixup generic 32bit syscall support

2014-10-30 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: 367867fafbd9174fec9cfcae06979911e3a78c50
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=367867fafbd9174fec9cfcae06979911e3a78c50

Author: Philippe Gerum r...@xenomai.org
Date:   Thu Oct 16 14:20:49 2014 +0200

cobalt: fixup generic 32bit syscall support

---

 include/cobalt/kernel/rtdm/fd.h|   25 +-
 include/cobalt/uapi/syscall.h  |2 +-
 kernel/cobalt/Kconfig  |3 -
 kernel/cobalt/debug.c  |   26 +-
 kernel/cobalt/debug.h  |4 +-
 .../cobalt/include/asm-generic/xenomai/syscall.h   |5 ++
 .../cobalt/include/asm-generic/xenomai/syscall32.h |6 +-
 kernel/cobalt/posix/syscall.c  |   88 +++-
 kernel/cobalt/rtdm/fd.c|   45 +-
 9 files changed, 146 insertions(+), 58 deletions(-)

diff --git a/include/cobalt/kernel/rtdm/fd.h b/include/cobalt/kernel/rtdm/fd.h
index cf47fcb..51609b3 100644
--- a/include/cobalt/kernel/rtdm/fd.h
+++ b/include/cobalt/kernel/rtdm/fd.h
@@ -24,6 +24,7 @@
 #include linux/socket.h
 #include linux/file.h
 #include cobalt/kernel/tree.h
+#include asm-generic/xenomai/syscall.h
 
 struct vm_area_struct;
 struct rtdm_fd;
@@ -299,30 +300,48 @@ struct rtdm_fd {
unsigned int refs;
int minor;
int oflags;
+#ifdef CONFIG_COMPAT
+   int compat;
+#endif
struct list_head cleanup;
 };
 
 #define RTDM_FD_MAGIC 0x5256
 
+#define RTDM_FD_COMPAT __COBALT_COMPAT_BIT
+#define RTDM_FD_COMPATX__COBALT_COMPATX_BIT
+
 int __rtdm_anon_getfd(const char *name, int flags);
 
 void __rtdm_anon_putfd(int ufd);
 
-static inline struct cobalt_ppd *rtdm_fd_owner(struct rtdm_fd *fd)
+static inline struct cobalt_ppd *rtdm_fd_owner(const struct rtdm_fd *fd)
 {
return fd-owner;
 }
 
-static inline int rtdm_fd_minor(struct rtdm_fd *fd)
+static inline int rtdm_fd_minor(const struct rtdm_fd *fd)
 {
return fd-minor;
 }
 
-static inline int rtdm_fd_flags(struct rtdm_fd *fd)
+static inline int rtdm_fd_flags(const struct rtdm_fd *fd)
 {
return fd-oflags;
 }
 
+#ifdef CONFIG_COMPAT
+static inline int rtdm_fd_compat(const struct rtdm_fd *fd)
+{
+   return fd-compat;
+}
+#else
+static inline int rtdm_fd_compat(const struct rtdm_fd *fd)
+{
+   return 0;
+}
+#endif
+
 int rtdm_fd_enter(struct rtdm_fd *rtdm_fd, int ufd,
  unsigned int magic, struct rtdm_fd_ops *ops);
 
diff --git a/include/cobalt/uapi/syscall.h b/include/cobalt/uapi/syscall.h
index 59d90e5..aa364a1 100644
--- a/include/cobalt/uapi/syscall.h
+++ b/include/cobalt/uapi/syscall.h
@@ -120,6 +120,6 @@
 #define sc_cobalt_extend   97
 #define sc_cobalt_sysconf  98
 
-#define __NR_COBALT_SYSCALLS   100
+#define __NR_COBALT_SYSCALLS   128 /* Power of 2 */
 
 #endif /* !_COBALT_UAPI_SYSCALL_H */
diff --git a/kernel/cobalt/Kconfig b/kernel/cobalt/Kconfig
index c4185b2..2e49d37 100644
--- a/kernel/cobalt/Kconfig
+++ b/kernel/cobalt/Kconfig
@@ -257,9 +257,6 @@ config XENO_OPT_VFILE
depends on PROC_FS
default y
 
-config XENO_OPT_SYS3264
-   bool
-
 endmenu
 
 menu Sizes and static limits
diff --git a/kernel/cobalt/debug.c b/kernel/cobalt/debug.c
index a809dc9..ad72a3e 100644
--- a/kernel/cobalt/debug.c
+++ b/kernel/cobalt/debug.c
@@ -111,7 +111,6 @@ out:
  */
 #define RELAX_SPOTNR   128
 #define RELAX_HSLOTS   (1  8)
-#define RELAX_CALLDEPTHSIGSHADOW_BACKTRACE_DEPTH
 
 struct relax_record {
/* Number of hits for this location */
@@ -124,7 +123,7 @@ struct relax_record {
struct backtrace {
unsigned long pc;
const char *mapname;
-   } backtrace[RELAX_CALLDEPTH];
+   } backtrace[SIGSHADOW_BACKTRACE_DEPTH];
/* Program hash value of the caller. */
u32 proghash;
/* Pid of the caller. */
@@ -201,10 +200,9 @@ void xndebug_notify_relax(struct xnthread *thread, int 
reason)
  sigshadow_int(SIGSHADOW_ACTION_BACKTRACE, reason));
 }
 
-void xndebug_trace_relax(int nr, unsigned long __user *u_backtrace,
+void xndebug_trace_relax(int nr, unsigned long *backtrace,
 int reason)
 {
-   unsigned long backtrace[RELAX_CALLDEPTH];
struct relax_record *p, **h;
struct vm_area_struct *vma;
struct xnthread *thread;
@@ -220,25 +218,7 @@ void xndebug_trace_relax(int nr, unsigned long __user 
*u_backtrace,
thread = xnthread_current();
if (thread == NULL)
return; /* Can't be, right? What a mess. */
-   /*
-* In case backtrace() in userland is broken or fails. We may
-* want to know about this in kernel space however, for future
-* use.
-*/
-   if (nr = 0)
-   

[Xenomai-git] Philippe Gerum : cobalt/posix/compat: fix sys32 helpers

2014-10-30 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: d2e53792f75e9f5670bf557eb7fde408296c0bf6
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=d2e53792f75e9f5670bf557eb7fde408296c0bf6

Author: Philippe Gerum r...@xenomai.org
Date:   Wed Oct 29 08:26:53 2014 +0100

cobalt/posix/compat: fix sys32 helpers

---

 kernel/cobalt/posix/sem.c   |2 +-
 kernel/cobalt/posix/syscall32.c |9 +
 2 files changed, 2 insertions(+), 9 deletions(-)

diff --git a/kernel/cobalt/posix/sem.c b/kernel/cobalt/posix/sem.c
index fb9f391..eca42e3 100644
--- a/kernel/cobalt/posix/sem.c
+++ b/kernel/cobalt/posix/sem.c
@@ -306,7 +306,7 @@ int __cobalt_sem_timedwait(struct cobalt_sem_shadow __user 
*u_sem,
if (pull_ts) {
atomic_inc(sem-state-value);
xnlock_put_irqrestore(nklock, s);
-   ret = sem_fetch_timeout(ts, u_ts);
+   ret = fetch_timeout(ts, u_ts);
xnlock_get_irqsave(nklock, s);
if (ret)
break;
diff --git a/kernel/cobalt/posix/syscall32.c b/kernel/cobalt/posix/syscall32.c
index 87ea0b7..6620fdf 100644
--- a/kernel/cobalt/posix/syscall32.c
+++ b/kernel/cobalt/posix/syscall32.c
@@ -115,13 +115,6 @@ COBALT_SYSCALL32emu(sem_timedwait, primary,
int, (struct cobalt_sem_shadow __user *u_sem,
  struct compat_timespec __user *u_ts))
 {
-   struct timespec ts;
-   int ret;
-
-   ret = sys32_get_timespec(ts, u_ts);
-   if (ret)
-   return ret;
-
return __cobalt_sem_timedwait(u_sem, u_ts, sys32_fetch_timeout);
 }
 
@@ -136,7 +129,7 @@ COBALT_SYSCALL32emu(clock_getres, current,
if (ret)
return ret;
 
-   return sys32_put_timespec(u_ts, ts);
+   return u_ts ? sys32_put_timespec(u_ts, ts) : 0;
 }
 
 COBALT_SYSCALL32emu(clock_gettime, current,


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://www.xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : cobalt/posix/cond: prepare for 32bit syscall emulation

2014-10-30 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: 884baa00e008674aef44c0d00a9aac6dcb073c95
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=884baa00e008674aef44c0d00a9aac6dcb073c95

Author: Philippe Gerum r...@xenomai.org
Date:   Thu Oct 16 14:40:11 2014 +0200

cobalt/posix/cond: prepare for 32bit syscall emulation

---

 kernel/cobalt/posix/cond.c |   48 
 kernel/cobalt/posix/cond.h |6 ++
 2 files changed, 37 insertions(+), 17 deletions(-)

diff --git a/kernel/cobalt/posix/cond.c b/kernel/cobalt/posix/cond.c
index 3c47608..f2fd7bd 100644
--- a/kernel/cobalt/posix/cond.c
+++ b/kernel/cobalt/posix/cond.c
@@ -169,7 +169,6 @@ static inline int pthread_cond_destroy(struct 
cobalt_cond_shadow *cnd)
 static inline int cobalt_cond_timedwait_prologue(struct xnthread *cur,
 struct cobalt_cond *cond,
 struct cobalt_mutex *mutex,
-int timed,
 xnticks_t abs_to)
 {
spl_t s;
@@ -212,7 +211,7 @@ static inline int cobalt_cond_timedwait_prologue(struct 
xnthread *cur,
}
 
/* Wait for another thread to signal the condition. */
-   if (timed)
+   if (abs_to != XN_INFINITE)
xnsynch_sleep_on(cond-synchbase, abs_to,
 clock_flag(TIMER_ABSTIME, cond-attr.clock));
else
@@ -252,7 +251,7 @@ static inline int cobalt_cond_timedwait_epilogue(struct 
xnthread *cur,
 
xnlock_get_irqsave(nklock, s);
 
-   err = cobalt_mutex_acquire_unchecked(cur, mutex, 0, NULL);
+   err = __cobalt_mutex_acquire_unchecked(cur, mutex, NULL);
if (err == -EINTR)
goto unlock_and_return;
 
@@ -316,13 +315,19 @@ struct us_cond_data {
int err;
 };
 
-/* pthread_cond_wait_prologue(cond, mutex, count_ptr, timed, timeout) */
-COBALT_SYSCALL(cond_wait_prologue, nonrestartable,
-  int, (struct cobalt_cond_shadow __user *u_cnd,
-struct cobalt_mutex_shadow __user *u_mx,
-int *u_err,
-unsigned int timed,
-struct timespec __user *u_ts))
+static inline int cond_fetch_timeout(struct timespec *ts,
+const void __user *u_ts)
+{
+   return u_ts == NULL ? -EFAULT :
+   __xn_safe_copy_from_user(ts, u_ts, sizeof(*ts));
+}
+
+int __cobalt_cond_wait_prologue(struct cobalt_cond_shadow __user *u_cnd,
+   struct cobalt_mutex_shadow __user *u_mx,
+   int *u_err,
+   void __user *u_ts,
+   int (*fetch_timeout)(struct timespec *ts,
+const void __user *u_ts))
 {
struct xnthread *cur = xnthread_current();
struct cobalt_cond *cond;
@@ -344,19 +349,16 @@ COBALT_SYSCALL(cond_wait_prologue, nonrestartable,
cond-state-mutex_datp = datp;
}
 
-   if (timed) {
-   err = __xn_safe_copy_from_user(ts, u_ts, sizeof(ts))?-EFAULT:0;
+   if (fetch_timeout) {
+   err = fetch_timeout(ts, u_ts);
if (err == 0) {
trace_cobalt_cond_timedwait(u_cnd, u_mx, ts);
-   err = cobalt_cond_timedwait_prologue(cur,
-cond, mx, timed,
+   err = cobalt_cond_timedwait_prologue(cur, cond, mx,
 ts2ns(ts) + 1);
}
} else {
trace_cobalt_cond_wait(u_cnd, u_mx);
-   err = cobalt_cond_timedwait_prologue(cur, cond,
-mx, timed,
-XN_INFINITE);
+   err = cobalt_cond_timedwait_prologue(cur, cond, mx, 
XN_INFINITE);
}
 
switch(err) {
@@ -386,6 +388,18 @@ COBALT_SYSCALL(cond_wait_prologue, nonrestartable,
return err == 0 ? perr : err;
 }
 
+/* pthread_cond_wait_prologue(cond, mutex, count_ptr, timed, timeout) */
+COBALT_SYSCALL(cond_wait_prologue, nonrestartable,
+  int, (struct cobalt_cond_shadow __user *u_cnd,
+struct cobalt_mutex_shadow __user *u_mx,
+int *u_err,
+unsigned int timed,
+struct timespec __user *u_ts))
+{
+   return __cobalt_cond_wait_prologue(u_cnd, u_mx, u_err, u_ts,
+  timed ? cond_fetch_timeout : NULL);
+}
+
 COBALT_SYSCALL(cond_wait_epilogue, primary,
   int, (struct cobalt_cond_shadow __user *u_cnd,
 struct cobalt_mutex_shadow __user *u_mx))
diff --git a/kernel/cobalt/posix/cond.h b/kernel/cobalt/posix/cond.h
index 

[Xenomai-git] Philippe Gerum : cobalt/posix/mq: prepare for 32bit syscall emulation

2014-10-30 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: 4f92282712b36c53ab6591011cb0448f40badfe2
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=4f92282712b36c53ab6591011cb0448f40badfe2

Author: Philippe Gerum r...@xenomai.org
Date:   Thu Oct 16 14:40:56 2014 +0200

cobalt/posix/mq: prepare for 32bit syscall emulation

---

 kernel/cobalt/posix/mqueue.c |  299 --
 kernel/cobalt/posix/mqueue.h |   22 
 lib/cobalt/mq.c  |6 +
 3 files changed, 196 insertions(+), 131 deletions(-)

diff --git a/kernel/cobalt/posix/mqueue.c b/kernel/cobalt/posix/mqueue.c
index b1ce1d2..f5a69f9 100644
--- a/kernel/cobalt/posix/mqueue.c
+++ b/kernel/cobalt/posix/mqueue.c
@@ -464,16 +464,22 @@ mq_tryrcv(struct cobalt_mqd *mqd, size_t len)
 
 static struct cobalt_msg *
 mq_timedsend_inner(struct cobalt_mqd *mqd,
-  size_t len, const struct timespec *abs_timeoutp)
+  size_t len, const void __user *u_ts,
+  int (*fetch_timeout)(struct timespec *ts,
+   const void __user *u_ts))
 {
struct cobalt_mqwait_context mwc;
struct cobalt_msg *msg;
struct cobalt_mq *mq;
+   struct timespec ts;
xntmode_t tmode;
xnticks_t to;
spl_t s;
int ret;
 
+   to = XN_INFINITE;
+   tmode = XN_RELATIVE;
+redo:
xnlock_get_irqsave(nklock, s);
msg = mq_trysend(mqd, len);
if (msg != ERR_PTR(-EAGAIN))
@@ -482,15 +488,17 @@ mq_timedsend_inner(struct cobalt_mqd *mqd,
if (mqd-flags  O_NONBLOCK)
goto out;
 
-   to = XN_INFINITE;
-   tmode = XN_RELATIVE;
-   if (abs_timeoutp) {
-   if ((unsigned long)abs_timeoutp-tv_nsec = ONE_BILLION) {
-   msg = ERR_PTR(-EINVAL);
-   goto out;
-   }
-   to = ts2ns(abs_timeoutp) + 1;
+   if (fetch_timeout) {
+   xnlock_put_irqrestore(nklock, s);
+   ret = fetch_timeout(ts, u_ts);
+   if (ret)
+   return ERR_PTR(ret);
+   if ((unsigned long)ts.tv_nsec = ONE_BILLION)
+   return ERR_PTR(-EINVAL);
+   to = ts2ns(ts) + 1;
tmode = XN_REALTIME;
+   fetch_timeout = NULL;
+   goto redo;
}
 
mq = mqd-mq;
@@ -584,16 +592,23 @@ mq_finish_send(struct cobalt_mqd *mqd, struct cobalt_msg 
*msg)
 
 static struct cobalt_msg *
 mq_timedrcv_inner(struct cobalt_mqd *mqd,
- size_t len, const struct timespec *abs_timeoutp)
+ size_t len,
+ const void __user *u_ts,
+ int (*fetch_timeout)(struct timespec *ts,
+  const void __user *u_ts))
 {
struct cobalt_mqwait_context mwc;
struct cobalt_msg *msg;
struct cobalt_mq *mq;
+   struct timespec ts;
xntmode_t tmode;
xnticks_t to;
spl_t s;
int ret;
 
+   to = XN_INFINITE;
+   tmode = XN_RELATIVE;
+redo:
xnlock_get_irqsave(nklock, s);
msg = mq_tryrcv(mqd, len);
if (msg != ERR_PTR(-EAGAIN))
@@ -602,15 +617,17 @@ mq_timedrcv_inner(struct cobalt_mqd *mqd,
if (mqd-flags  O_NONBLOCK)
goto out;
 
-   to = XN_INFINITE;
-   tmode = XN_RELATIVE;
-   if (abs_timeoutp) {
-   if (abs_timeoutp-tv_nsec = ONE_BILLION) {
-   msg = ERR_PTR(-EINVAL);
-   goto out;
-   }
-   to = ts2ns(abs_timeoutp) + 1;
+   if (fetch_timeout) {
+   xnlock_put_irqrestore(nklock, s);
+   ret = fetch_timeout(ts, u_ts);
+   if (ret)
+   return ERR_PTR(ret);
+   if (ts.tv_nsec = ONE_BILLION)
+   return ERR_PTR(-EINVAL);
+   to = ts2ns(ts) + 1;
tmode = XN_REALTIME;
+   fetch_timeout = NULL;
+   goto redo;
}
 
mq = mqd-mq;
@@ -752,39 +769,37 @@ static inline void cobalt_mqd_put(struct cobalt_mqd *mqd)
rtdm_fd_put(mqd-fd);
 }
 
-COBALT_SYSCALL(mq_notify, primary,
-  int, (mqd_t fd, const struct sigevent *__user evp))
+int __cobalt_mq_notify(mqd_t fd, const struct sigevent *evp)
 {
struct cobalt_mqd *mqd;
-   struct sigevent sev;
-   int err;
+   int ret;
 
mqd = cobalt_mqd_get(fd);
-   if (IS_ERR(mqd)) {
-   err = PTR_ERR(mqd);
-   goto out;
-   }
-
-   if (evp  __xn_safe_copy_from_user(sev, evp, sizeof(sev))) {
-   err = -EFAULT;
-   goto out;
+   if (IS_ERR(mqd))
+   ret = PTR_ERR(mqd);
+   else {
+   trace_cobalt_mq_notify(fd, evp);
+   ret = mq_notify(mqd, fd, evp);
+   cobalt_mqd_put(mqd);
}
 
-   trace_cobalt_mq_notify(fd, evp ? 

[Xenomai-git] Philippe Gerum : cobalt/posix/sched: switch set/ getconfig calls to conforming mode

2014-10-30 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: bab8db9977b72dbbe6fa35787d9a173e156b6815
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=bab8db9977b72dbbe6fa35787d9a173e156b6815

Author: Philippe Gerum r...@xenomai.org
Date:   Wed Oct 29 12:38:13 2014 +0100

cobalt/posix/sched: switch set/getconfig calls to conforming mode

---

 kernel/cobalt/posix/sched.c |4 ++--
 kernel/cobalt/posix/syscall.c   |4 ++--
 kernel/cobalt/posix/syscall32.c |4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/kernel/cobalt/posix/sched.c b/kernel/cobalt/posix/sched.c
index 2dcdfcd..20221a4 100644
--- a/kernel/cobalt/posix/sched.c
+++ b/kernel/cobalt/posix/sched.c
@@ -631,7 +631,7 @@ int __cobalt_sched_setconfig_np(int cpu, int policy,
return ret;
 }
 
-COBALT_SYSCALL(sched_setconfig_np, current,
+COBALT_SYSCALL(sched_setconfig_np, conforming,
   int, (int cpu, int policy,
 union sched_config __user *u_config,
 size_t len))
@@ -672,7 +672,7 @@ ssize_t __cobalt_sched_getconfig_np(int cpu, int policy,
return ret;
 }
 
-COBALT_SYSCALL(sched_getconfig_np, current,
+COBALT_SYSCALL(sched_getconfig_np, conforming,
   ssize_t, (int cpu, int policy,
 union sched_config __user *u_config,
 size_t len))
diff --git a/kernel/cobalt/posix/syscall.c b/kernel/cobalt/posix/syscall.c
index 537defe..e327f7e 100644
--- a/kernel/cobalt/posix/syscall.c
+++ b/kernel/cobalt/posix/syscall.c
@@ -693,8 +693,8 @@ static const int cobalt_sysmodes[] = {
__COBALT_MODE(event_wait, primary),
__COBALT_MODE(event_sync, current),
__COBALT_MODE(event_inquire, current),
-   __COBALT_MODE(sched_setconfig_np, current),
-   __COBALT_MODE(sched_getconfig_np, current),
+   __COBALT_MODE(sched_setconfig_np, conforming),
+   __COBALT_MODE(sched_getconfig_np, conforming),
__COBALT_MODE(open, lostage),
__COBALT_MODE(socket, lostage),
__COBALT_MODE(close, lostage),
diff --git a/kernel/cobalt/posix/syscall32.c b/kernel/cobalt/posix/syscall32.c
index 6620fdf..9bc852e 100644
--- a/kernel/cobalt/posix/syscall32.c
+++ b/kernel/cobalt/posix/syscall32.c
@@ -421,7 +421,7 @@ static ssize_t sys32_put_config(int policy,
return ret ?: u_len;
 }
 
-COBALT_SYSCALL32emu(sched_setconfig_np, current,
+COBALT_SYSCALL32emu(sched_setconfig_np, conforming,
int, (int cpu, int policy,
  union compat_sched_config __user *u_config,
  size_t len))
@@ -430,7 +430,7 @@ COBALT_SYSCALL32emu(sched_setconfig_np, current,
   sys32_fetch_config, 
sys32_ack_config);
 }
 
-COBALT_SYSCALL32emu(sched_getconfig_np, current,
+COBALT_SYSCALL32emu(sched_getconfig_np, conformin,
ssize_t, (int cpu, int policy,
  union compat_sched_config __user *u_config,
  size_t len))


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://www.xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : alchemy/pipe: add missing wrapping to Cobalt

2014-10-30 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: c683a8bb9d469c67eafdf76f8403abfc918d3531
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=c683a8bb9d469c67eafdf76f8403abfc918d3531

Author: Philippe Gerum r...@xenomai.org
Date:   Tue Oct 28 11:06:26 2014 +0100

alchemy/pipe: add missing wrapping to Cobalt

---

 lib/alchemy/pipe.c |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/alchemy/pipe.c b/lib/alchemy/pipe.c
index 93da9be..439a00f 100644
--- a/lib/alchemy/pipe.c
+++ b/lib/alchemy/pipe.c
@@ -166,8 +166,8 @@ int rt_pipe_create(RT_PIPE *pipe,
}
 
if (poolsize  0) {
-   ret = setsockopt(pcb-sock, SOL_XDDP, XDDP_POOLSZ,
-poolsize, sizeof(poolsize));
+   ret = __RT(setsockopt(pcb-sock, SOL_XDDP, XDDP_POOLSZ,
+ poolsize, sizeof(poolsize)));
if (ret)
goto fail_sockopt;
}
@@ -181,7 +181,7 @@ int rt_pipe_create(RT_PIPE *pipe,
memset(saddr, 0, sizeof(saddr));
saddr.sipc_family = AF_RTIPC;
saddr.sipc_port = minor;
-   ret = bind(sock, (struct sockaddr *)saddr, sizeof(saddr));
+   ret = __RT(bind(sock, (struct sockaddr *)saddr, sizeof(saddr)));
if (ret)
goto fail_sockopt;
 


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://www.xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : cobalt/posix/clock: prepare for 32bit syscall emulation

2014-10-30 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: 8325e4c3076fcbd0bacd7b68419cd064a775ac58
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=8325e4c3076fcbd0bacd7b68419cd064a775ac58

Author: Philippe Gerum r...@xenomai.org
Date:   Thu Oct 16 14:37:53 2014 +0200

cobalt/posix/clock: prepare for 32bit syscall emulation

---

 kernel/cobalt/posix/clock.c |  133 +--
 kernel/cobalt/posix/clock.h |   13 +
 2 files changed, 102 insertions(+), 44 deletions(-)

diff --git a/kernel/cobalt/posix/clock.c b/kernel/cobalt/posix/clock.c
index 28dd18f..dbd7132 100644
--- a/kernel/cobalt/posix/clock.c
+++ b/kernel/cobalt/posix/clock.c
@@ -106,10 +106,8 @@ static int do_clock_host_realtime(struct timespec *tp)
__val;  \
 })
 
-COBALT_SYSCALL(clock_getres, current,
-  int, (clockid_t clock_id, struct timespec __user *u_ts))
+int __cobalt_clock_getres(clockid_t clock_id, struct timespec *ts)
 {
-   struct timespec ts;
xnticks_t ns;
int ret;
 
@@ -117,15 +115,30 @@ COBALT_SYSCALL(clock_getres, current,
case CLOCK_REALTIME:
case CLOCK_MONOTONIC:
case CLOCK_MONOTONIC_RAW:
-   ns2ts(ts, 1);
+   ns2ts(ts, 1);
break;
default:
ret = do_ext_clock(clock_id, get_resolution, ns);
if (ret)
return ret;
-   ns2ts(ts, ns);
+   ns2ts(ts, ns);
}
 
+   trace_cobalt_clock_getres(clock_id, ts);
+
+   return 0;
+}
+
+COBALT_SYSCALL(clock_getres, current,
+  int, (clockid_t clock_id, struct timespec __user *u_ts))
+{
+   struct timespec ts;
+   int ret;
+
+   ret = __cobalt_clock_getres(clock_id, ts);
+   if (ret)
+   return ret;
+
if (u_ts  __xn_safe_copy_to_user(u_ts, ts, sizeof(ts)))
return -EFAULT;
 
@@ -134,32 +147,45 @@ COBALT_SYSCALL(clock_getres, current,
return 0;
 }
 
-COBALT_SYSCALL(clock_gettime, current,
-  int, (clockid_t clock_id, struct timespec __user *u_ts))
+int __cobalt_clock_gettime(clockid_t clock_id, struct timespec *ts)
 {
-   struct timespec ts;
xnticks_t ns;
int ret;
 
switch (clock_id) {
case CLOCK_REALTIME:
-   ns2ts(ts, xnclock_read_realtime(nkclock));
+   ns2ts(ts, xnclock_read_realtime(nkclock));
break;
case CLOCK_MONOTONIC:
case CLOCK_MONOTONIC_RAW:
-   ns2ts(ts, xnclock_read_monotonic(nkclock));
+   ns2ts(ts, xnclock_read_monotonic(nkclock));
break;
case CLOCK_HOST_REALTIME:
-   if (do_clock_host_realtime(ts) != 0)
+   if (do_clock_host_realtime(ts) != 0)
return -EINVAL;
break;
default:
ret = do_ext_clock(clock_id, read_monotonic, ns);
if (ret)
return ret;
-   ns2ts(ts, ns);
+   ns2ts(ts, ns);
}
 
+   trace_cobalt_clock_gettime(clock_id, ts);
+
+   return 0;
+}
+
+COBALT_SYSCALL(clock_gettime, current,
+  int, (clockid_t clock_id, struct timespec __user *u_ts))
+{
+   struct timespec ts;
+   int ret;
+
+   ret = __cobalt_clock_gettime(clock_id, ts);
+   if (ret)
+   return ret;
+
if (__xn_safe_copy_to_user(u_ts, ts, sizeof(*u_ts)))
return -EFAULT;
 
@@ -168,67 +194,65 @@ COBALT_SYSCALL(clock_gettime, current,
return 0;
 }
 
-COBALT_SYSCALL(clock_settime, current,
-  int, (clockid_t clock_id,
-const struct timespec __user *u_ts))
+int __cobalt_clock_settime(clockid_t clock_id, const struct timespec *ts)
 {
-   struct timespec ts;
int _ret, ret = 0;
xnticks_t now;
spl_t s;
 
-   if (__xn_safe_copy_from_user(ts, u_ts, sizeof(ts)))
-   return -EFAULT;
-
-   if ((unsigned long)ts.tv_nsec = ONE_BILLION)
+   if ((unsigned long)ts-tv_nsec = ONE_BILLION)
return -EINVAL;
 
switch (clock_id) {
case CLOCK_REALTIME:
xnlock_get_irqsave(nklock, s);
now = xnclock_read_realtime(nkclock);
-   xnclock_adjust(nkclock, (xnsticks_t) (ts2ns(ts) - now));
+   xnclock_adjust(nkclock, (xnsticks_t) (ts2ns(ts) - now));
xnlock_put_irqrestore(nklock, s);
break;
default:
-   _ret = do_ext_clock(clock_id, set_time, ret, ts);
+   _ret = do_ext_clock(clock_id, set_time, ret, ts);
if (_ret || ret)
return _ret ?: ret;
}
 
-   trace_cobalt_clock_settime(clock_id, ts);
+   trace_cobalt_clock_settime(clock_id, ts);
 
return 0;
 }
 
-COBALT_SYSCALL(clock_nanosleep, nonrestartable,
-  int, 

[Xenomai-git] Philippe Gerum : cobalt: factor out compat helpers for common types

2014-10-30 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: 4572997e878f24625c8ddbfa5256b8f423679bf8
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=4572997e878f24625c8ddbfa5256b8f423679bf8

Author: Philippe Gerum r...@xenomai.org
Date:   Tue Oct 28 19:14:09 2014 +0100

cobalt: factor out compat helpers for common types

---

 .../posix = include/cobalt/kernel}/compat.h   |   34 ++---
 include/cobalt/kernel/rtdm/cobalt.h|1 -
 include/cobalt/kernel/rtdm/compat.h|3 +-
 kernel/cobalt/posix/compat.c   |   44 +++-
 kernel/cobalt/posix/syscall32.c|   13 +
 kernel/cobalt/posix/syscall32.h|8 ++-
 kernel/drivers/ipc/rtipc.c |   53 +---
 7 files changed, 93 insertions(+), 63 deletions(-)

diff --git a/kernel/cobalt/posix/compat.h b/include/cobalt/kernel/compat.h
similarity index 86%
rename from kernel/cobalt/posix/compat.h
rename to include/cobalt/kernel/compat.h
index 466ea43..6a2e838 100644
--- a/kernel/cobalt/posix/compat.h
+++ b/include/cobalt/kernel/compat.h
@@ -15,26 +15,16 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  */
-#ifndef _COBALT_POSIX_COMPAT_H
-#define _COBALT_POSIX_COMPAT_H
+#ifndef _COBALT_KERNEL_COMPAT_H
+#define _COBALT_KERNEL_COMPAT_H
 
 #ifdef CONFIG_COMPAT
 
-#include rtdm/compat.h
-/* CAUTION: rtdm/cobalt.h reads this header. */
-#include xenomai/posix/thread.h
-#include xenomai/posix/mutex.h
-#include xenomai/posix/cond.h
-#include xenomai/posix/sem.h
-#include xenomai/posix/sched.h
-#include xenomai/posix/mqueue.h
-#include xenomai/posix/clock.h
-#include xenomai/posix/timer.h
-#include xenomai/posix/timerfd.h
-#include xenomai/posix/signal.h
-#include xenomai/posix/monitor.h
-#include xenomai/posix/event.h
-#include xenomai/posix/io.h
+#include linux/compat.h
+#include net/compat.h
+#include cobalt/uapi/sched.h
+
+struct mq_attr;
 
 struct __compat_sched_ss_param {
int __sched_low_priority;
@@ -150,6 +140,14 @@ int sys32_get_msghdr(struct msghdr *msg,
 int sys32_put_msghdr(struct compat_msghdr __user *u_cmsg,
 const struct msghdr *msg);
 
+int sys32_get_iovec(struct iovec *iov,
+   const struct compat_iovec __user *ciov,
+   int ciovlen);
+
+int sys32_put_iovec(struct compat_iovec __user *u_ciov,
+   const struct iovec *iov,
+   int iovlen);
+
 #endif /* CONFIG_COMPAT */
 
-#endif /* !_COBALT_POSIX_COMPAT_H */
+#endif /* !_COBALT_KERNEL_COMPAT_H */
diff --git a/include/cobalt/kernel/rtdm/cobalt.h 
b/include/cobalt/kernel/rtdm/cobalt.h
index fc75430..2c38053 100644
--- a/include/cobalt/kernel/rtdm/cobalt.h
+++ b/include/cobalt/kernel/rtdm/cobalt.h
@@ -29,6 +29,5 @@
 #include xenomai/posix/clock.h
 #include xenomai/posix/event.h
 #include xenomai/posix/monitor.h
-#include xenomai/posix/compat.h
 
 #endif /* !_COBALT_RTDM_COBALT_H */
diff --git a/include/cobalt/kernel/rtdm/compat.h 
b/include/cobalt/kernel/rtdm/compat.h
index 44b6884..974f9bd 100644
--- a/include/cobalt/kernel/rtdm/compat.h
+++ b/include/cobalt/kernel/rtdm/compat.h
@@ -20,8 +20,7 @@
 
 #ifdef CONFIG_COMPAT
 
-#include linux/compat.h
-#include net/compat.h
+#include cobalt/kernel/compat.h
 #include rtdm/rtdm.h
 
 struct compat_rtdm_getsockopt_args {
diff --git a/kernel/cobalt/posix/compat.c b/kernel/cobalt/posix/compat.c
index 948616c..5808371 100644
--- a/kernel/cobalt/posix/compat.c
+++ b/kernel/cobalt/posix/compat.c
@@ -17,7 +17,9 @@
  */
 #include linux/err.h
 #include linux/module.h
-#include compat.h
+#include cobalt/kernel/compat.h
+#include asm/xenomai/syscall.h
+#include xenomai/posix/mqueue.h
 
 int sys32_get_timespec(struct timespec *ts,
   const struct compat_timespec __user *cts)
@@ -379,3 +381,43 @@ int sys32_put_msghdr(struct compat_msghdr __user *u_cmsg,
return 0;
 }
 EXPORT_SYMBOL_GPL(sys32_put_msghdr);
+
+int sys32_get_iovec(struct iovec *iov,
+   const struct compat_iovec __user *u_ciov,
+   int ciovlen)
+{
+   const struct compat_iovec __user *p;
+   struct compat_iovec ciov;
+   int ret, n;
+   
+   for (n = 0, p = u_ciov; n  ciovlen; n++, p++) {
+   ret = __xn_safe_copy_from_user(ciov, p, sizeof(ciov));
+   if (ret)
+   return ret;
+   iov[n].iov_base = compat_ptr(ciov.iov_base);
+   iov[n].iov_len = ciov.iov_len;
+   }
+
+   return 0;
+}
+EXPORT_SYMBOL_GPL(sys32_get_iovec);
+
+int sys32_put_iovec(struct compat_iovec __user *u_ciov,
+   const struct iovec *iov,
+   int iovlen)
+{
+   struct compat_iovec __user *p;
+   struct compat_iovec ciov;
+   int ret, n;
+   
+   for (n = 0, p = u_ciov; n  iovlen; n++, p++) {
+   ciov.iov_base = 

[Xenomai-git] Philippe Gerum : bootstrap

2014-10-30 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: 0e1dc8cdfeb877812f8570974990bde37261367b
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=0e1dc8cdfeb877812f8570974990bde37261367b

Author: Philippe Gerum r...@xenomai.org
Date:   Mon Oct 27 14:11:04 2014 +0100

bootstrap

---

 include/cobalt/kernel/rtdm/Makefile.in |1 +
 lib/analogy/Makefile.in|   30 --
 lib/boilerplate/Makefile.in|   53 ++--
 utils/analogy/Makefile.in  |   46 ---
 4 files changed, 107 insertions(+), 23 deletions(-)

diff --git a/include/cobalt/kernel/rtdm/Makefile.in 
b/include/cobalt/kernel/rtdm/Makefile.in
index 1cc5915..81d84d1 100644
--- a/include/cobalt/kernel/rtdm/Makefile.in
+++ b/include/cobalt/kernel/rtdm/Makefile.in
@@ -350,6 +350,7 @@ noinst_HEADERS = \
autotune.h  \
can.h   \
cobalt.h\
+   compat.h\
driver.h\
fd.h\
ipc.h   \
diff --git a/lib/analogy/Makefile.in b/lib/analogy/Makefile.in
index 832f43d..f42dbde 100644
--- a/lib/analogy/Makefile.in
+++ b/lib/analogy/Makefile.in
@@ -125,9 +125,10 @@ am__uninstall_files_from_dir = { \
   }
 am__installdirs = $(DESTDIR)$(libdir)
 LTLIBRARIES = $(lib_LTLIBRARIES)
-libanalogy_la_LIBADD =
+libanalogy_la_DEPENDENCIES = ../boilerplate/libboilerplate.la
 am_libanalogy_la_OBJECTS = libanalogy_la-async.lo \
libanalogy_la-descriptor.lo libanalogy_la-info.lo \
+   libanalogy_la-math.lo libanalogy_la-calibration.lo \
libanalogy_la-range.lo libanalogy_la-sync.lo \
libanalogy_la-sys.lo
 libanalogy_la_OBJECTS = $(am_libanalogy_la_OBJECTS)
@@ -374,14 +375,21 @@ libanalogy_la_SOURCES = \
descriptor.c\
info.c  \
internal.h  \
+   math.c  \
+   calibration.c   \
range.c \
root_leaf.h \
sync.c  \
sys.c
 
 libanalogy_la_CPPFLAGS = \
-   @XENO_USER_CFLAGS@  \
-   -I$(top_srcdir)/include
+   @XENO_USER_CFLAGS@  \
+   -I$(top_srcdir)/include \
+   -I$(top_srcdir)/lib/boilerplate 
+
+libanalogy_la_LIBADD = \
+   ../boilerplate/libboilerplate.la\
+   -lm
 
 all: all-am
 
@@ -463,8 +471,10 @@ distclean-compile:
-rm -f *.tab.c
 
 @AMDEP_TRUE@@am__include@ 
@am__quote@./$(DEPDIR)/libanalogy_la-async.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ 
@am__quote@./$(DEPDIR)/libanalogy_la-calibration.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ 
@am__quote@./$(DEPDIR)/libanalogy_la-descriptor.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ 
@am__quote@./$(DEPDIR)/libanalogy_la-info.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ 
@am__quote@./$(DEPDIR)/libanalogy_la-math.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ 
@am__quote@./$(DEPDIR)/libanalogy_la-range.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ 
@am__quote@./$(DEPDIR)/libanalogy_la-sync.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ 
@am__quote@./$(DEPDIR)/libanalogy_la-sys.Plo@am__quote@
@@ -511,6 +521,20 @@ libanalogy_la-info.lo: info.c
 @AMDEP_TRUE@@am__fastdepCC_FALSE@  DEPDIR=$(DEPDIR) $(CCDEPMODE) 
$(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC 
$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) 
$(DEFAULT_INCLUDES) $(INCLUDES) $(libanalogy_la_CPPFLAGS) $(CPPFLAGS) 
$(AM_CFLAGS) $(CFLAGS) -c -o libanalogy_la-info.lo `test -f 'info.c' || echo 
'$(srcdir)/'`info.c
 
+libanalogy_la-math.lo: math.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC 
$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) 
$(DEFAULT_INCLUDES) $(INCLUDES) $(libanalogy_la_CPPFLAGS) $(CPPFLAGS) 
$(AM_CFLAGS) $(CFLAGS) -MT libanalogy_la-math.lo -MD -MP -MF 
$(DEPDIR)/libanalogy_la-math.Tpo -c -o libanalogy_la-math.lo `test -f 'math.c' 
|| echo '$(srcdir)/'`math.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/libanalogy_la-math.Tpo 
$(DEPDIR)/libanalogy_la-math.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@  $(AM_V_CC)source='math.c' 
object='libanalogy_la-math.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@  DEPDIR=$(DEPDIR) $(CCDEPMODE) 
$(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC 
$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) 
$(DEFAULT_INCLUDES) $(INCLUDES) $(libanalogy_la_CPPFLAGS) $(CPPFLAGS) 
$(AM_CFLAGS) $(CFLAGS) -c -o libanalogy_la-math.lo `test -f 'math.c' || echo 
'$(srcdir)/'`math.c
+
+libanalogy_la-calibration.lo: calibration.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC 
$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) 
$(DEFAULT_INCLUDES) $(INCLUDES) $(libanalogy_la_CPPFLAGS) $(CPPFLAGS) 
$(AM_CFLAGS) $(CFLAGS) -MT libanalogy_la-calibration.lo -MD -MP -MF 
$(DEPDIR)/libanalogy_la-calibration.Tpo -c -o libanalogy_la-calibration.lo 
`test -f 

[Xenomai-git] Gilles Chanteperdrix : cobalt/mqueue: use rtdm fd flags

2014-10-30 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: 10078a95d180c0bfbc2b1068ba1b46d842e87fe9
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=10078a95d180c0bfbc2b1068ba1b46d842e87fe9

Author: Gilles Chanteperdrix gilles.chanteperd...@xenomai.org
Date:   Sat Oct 25 21:52:07 2014 +0200

cobalt/mqueue: use rtdm fd flags

---

 include/cobalt/uapi/syscall.h  |2 +-
 .../arch/x86/include/asm/xenomai/syscall32-table.h |1 -
 kernel/cobalt/posix/mqueue.c   |   79 +++-
 kernel/cobalt/posix/mqueue.h   |7 --
 kernel/cobalt/posix/syscall.c  |5 +-
 kernel/cobalt/posix/syscall32.c|   21 --
 kernel/cobalt/posix/syscall32.h|4 -
 lib/cobalt/mq.c|   19 -
 8 files changed, 29 insertions(+), 109 deletions(-)

diff --git a/include/cobalt/uapi/syscall.h b/include/cobalt/uapi/syscall.h
index 025d2ff..0f74f37 100644
--- a/include/cobalt/uapi/syscall.h
+++ b/include/cobalt/uapi/syscall.h
@@ -63,7 +63,7 @@
 #define sc_cobalt_mq_close 40
 #define sc_cobalt_mq_unlink41
 #define sc_cobalt_mq_getattr   42
-#define sc_cobalt_mq_setattr   43
+/* 43 unimp */
 #define sc_cobalt_mq_timedsend 44
 #define sc_cobalt_mq_timedreceive  45
 #define sc_cobalt_mq_notify46
diff --git a/kernel/cobalt/arch/x86/include/asm/xenomai/syscall32-table.h 
b/kernel/cobalt/arch/x86/include/asm/xenomai/syscall32-table.h
index 1c84ef3..9f2f000 100644
--- a/kernel/cobalt/arch/x86/include/asm/xenomai/syscall32-table.h
+++ b/kernel/cobalt/arch/x86/include/asm/xenomai/syscall32-table.h
@@ -37,7 +37,6 @@ __COBALT_CALL32emu_THUNK(mutex_timedlock)
 __COBALT_CALL32emu_THUNK(cond_wait_prologue)
 __COBALT_CALL32emu_THUNK(mq_open)
 __COBALT_CALL32emu_THUNK(mq_getattr)
-__COBALT_CALL32emu_THUNK(mq_setattr)
 __COBALT_CALL32emu_THUNK(mq_timedsend)
 __COBALT_CALL32emu_THUNK(mq_timedreceive)
 __COBALT_CALL32emu_THUNK(mq_notify)
diff --git a/kernel/cobalt/posix/mqueue.c b/kernel/cobalt/posix/mqueue.c
index 33d8310..b922d5c 100644
--- a/kernel/cobalt/posix/mqueue.c
+++ b/kernel/cobalt/posix/mqueue.c
@@ -31,7 +31,7 @@
 
 #define COBALT_MSGMAX  65536
 #define COBALT_MSGSIZEMAX  (16*1024*1024)
-#define COBALT_MSGPRIOMAX  32768
+#define COBALT_MSGPRIOMAX  32768
 
 struct cobalt_mq {
unsigned magic;
@@ -62,7 +62,6 @@ struct cobalt_mq {
 };
 
 struct cobalt_mqd {
-   long flags;
struct cobalt_mq *mq;
struct rtdm_fd fd;
 };
@@ -228,7 +227,7 @@ mqd_select(struct rtdm_fd *fd, struct xnselector *selector,
switch(type) {
case XNSELECT_READ:
err = -EBADF;
-   if ((mqd-flags  COBALT_PERMS_MASK) == O_WRONLY)
+   if ((rtdm_fd_flags(fd)  COBALT_PERMS_MASK) == O_WRONLY)
goto unlock_and_error;
 
err = xnselect_bind(mq-read_select, binding,
@@ -240,7 +239,7 @@ mqd_select(struct rtdm_fd *fd, struct xnselector *selector,
 
case XNSELECT_WRITE:
err = -EBADF;
-   if ((mqd-flags  COBALT_PERMS_MASK) == O_RDONLY)
+   if ((rtdm_fd_flags(fd)  COBALT_PERMS_MASK) == O_RDONLY)
goto unlock_and_error;
 
err = xnselect_bind(mq-write_select, binding,
@@ -275,7 +274,7 @@ static inline int mqd_create(struct cobalt_mq *mq, unsigned 
long flags, int ufd)
if (mqd == NULL)
return -ENOSPC;
 
-   mqd-flags = flags;
+   mqd-fd.oflags = flags;
mqd-mq = mq;
 
return rtdm_fd_enter(mqd-fd, ufd, COBALT_MQD_MAGIC, mqd_ops);
@@ -416,7 +415,7 @@ mq_trysend(struct cobalt_mqd *mqd, size_t len)
unsigned flags;
 
mq = mqd-mq;
-   flags = mqd-flags  COBALT_PERMS_MASK;
+   flags = rtdm_fd_flags(mqd-fd)  COBALT_PERMS_MASK;
 
if (flags != O_WRONLY  flags != O_RDWR)
return ERR_PTR(-EBADF);
@@ -442,7 +441,7 @@ mq_tryrcv(struct cobalt_mqd *mqd, size_t len)
struct cobalt_mq *mq;
 
mq = mqd-mq;
-   flags = mqd-flags  COBALT_PERMS_MASK;
+   flags = rtdm_fd_flags(mqd-fd)  COBALT_PERMS_MASK;
 
if (flags != O_RDONLY  flags != O_RDWR)
return ERR_PTR(-EBADF);
@@ -485,7 +484,7 @@ redo:
if (msg != ERR_PTR(-EAGAIN))
goto out;
 
-   if (mqd-flags  O_NONBLOCK)
+   if (rtdm_fd_flags(mqd-fd)  O_NONBLOCK)
goto out;
 
if (fetch_timeout) {
@@ -614,7 +613,7 @@ redo:
if (msg != ERR_PTR(-EAGAIN))
goto out;
 
-   if (mqd-flags  O_NONBLOCK)
+   if (rtdm_fd_flags(mqd-fd)  O_NONBLOCK)
goto out;
 
if (fetch_timeout) {
@@ -668,36 +667,13 @@ static inline int mq_getattr(struct cobalt_mqd *mqd, 
struct mq_attr *attr)
mq = mqd-mq;
*attr = mq-attr;

[Xenomai-git] Philippe Gerum : cobalt/sched: clarify schedlist header

2014-10-30 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: 994d9828a036a04b9c54362620b01ee0b97f8641
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=994d9828a036a04b9c54362620b01ee0b97f8641

Author: Philippe Gerum r...@xenomai.org
Date:   Sun Oct 26 18:00:14 2014 +0100

cobalt/sched: clarify schedlist header

---

 kernel/cobalt/sched.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/cobalt/sched.c b/kernel/cobalt/sched.c
index 6fdae55..7cc5770 100644
--- a/kernel/cobalt/sched.c
+++ b/kernel/cobalt/sched.c
@@ -1000,7 +1000,7 @@ static int vfile_schedlist_show(struct 
xnvfile_snapshot_iterator *it,
if (p == NULL)
xnvfile_printf(it,
   %-3s  %-6s %-5s  %-8s  %-5s %-8s  %-10s %s\n,
-  CPU, PID, CLASS, PERS, PRI, TIMEOUT,
+  CPU, PID, CLASS, TYPE, PRI, TIMEOUT,
   STAT, NAME);
else {
ksformat(pbuf, sizeof(pbuf), %3d, p-cprio);


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://www.xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : cobalt/posix/thread: propagate error upon failed setschedparam

2014-10-30 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: cdde256f6857d991e49b100e5fc8a9760eba9c84
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=cdde256f6857d991e49b100e5fc8a9760eba9c84

Author: Philippe Gerum r...@xenomai.org
Date:   Sun Oct 26 17:57:46 2014 +0100

cobalt/posix/thread: propagate error upon failed setschedparam

---

 kernel/cobalt/posix/thread.c |5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/kernel/cobalt/posix/thread.c b/kernel/cobalt/posix/thread.c
index defea50..27c824b 100644
--- a/kernel/cobalt/posix/thread.c
+++ b/kernel/cobalt/posix/thread.c
@@ -246,7 +246,7 @@ pthread_setschedparam_ex(struct cobalt_thread *thread,
struct xnsched_class *sched_class;
union xnsched_policy_param param;
xnticks_t tslice;
-   int ret = 0;
+   int ret;
spl_t s;
 
xnlock_get_irqsave(nklock, s);
@@ -269,7 +269,8 @@ pthread_setschedparam_ex(struct cobalt_thread *thread,
if (cobalt_call_extension(thread_setsched, thread-extref, ret,
  sched_class, param)  ret)
goto out;
-   xnthread_set_schedparam(thread-threadbase, sched_class, param);
+   ret = xnthread_set_schedparam(thread-threadbase,
+ sched_class, param);
xnsched_run();
 out:
xnlock_put_irqrestore(nklock, s);


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://www.xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : cobalt/testsuite: fixup for 32bit emulation

2014-10-30 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: 3759aa162c5359fc2c9e0d07590b157186ebe90f
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=3759aa162c5359fc2c9e0d07590b157186ebe90f

Author: Philippe Gerum r...@xenomai.org
Date:   Wed Oct 22 10:53:36 2014 +0200

cobalt/testsuite: fixup for 32bit emulation

---

 demo/alchemy/altency.c  |   44 ++--
 include/rtdm/uapi/autotune.h|2 +
 include/rtdm/uapi/testing.h |   78 ++-
 kernel/drivers/testing/switchtest.c |2 +-
 kernel/drivers/testing/timerbench.c |   28 ++---
 testsuite/latency/latency.c |   53 
 testsuite/switchtest/switchtest.c   |6 +--
 7 files changed, 90 insertions(+), 123 deletions(-)

diff --git a/demo/alchemy/altency.c b/demo/alchemy/altency.c
index ef1a694..2e4d093 100644
--- a/demo/alchemy/altency.c
+++ b/demo/alchemy/altency.c
@@ -25,9 +25,9 @@ RT_SEM display_sem;
 #define TEN_MILLIONS1000
 
 unsigned max_relaxed;
-long minjitter, maxjitter, avgjitter;
-long gminjitter = TEN_MILLIONS, gmaxjitter = -TEN_MILLIONS, goverrun = 0;
-long long gavgjitter = 0;
+int32_t minjitter, maxjitter, avgjitter;
+int32_t gminjitter = TEN_MILLIONS, gmaxjitter = -TEN_MILLIONS, goverrun = 0;
+int64_t gavgjitter = 0;
 
 long long period_ns = 0;
 int test_duration = 0; /* sec of testing, via -T sec, 0 is inf */
@@ -57,7 +57,7 @@ int test_loops = 0;   /* outer loop count */
 #define WARMUP_TIME 1
 #define HISTOGRAM_CELLS 300
 int histogram_size = HISTOGRAM_CELLS;
-long *histogram_avg = NULL, *histogram_max = NULL, *histogram_min = NULL;
+int32_t *histogram_avg = NULL, *histogram_max = NULL, *histogram_min = NULL;
 
 char *do_gnuplot = NULL;
 int do_histogram = 0, do_stats = 0, finished = 0;
@@ -65,10 +65,10 @@ int bucketsize = 1000;  /* default = 1000ns, -B 
size to override */
 
 #define need_histo() (do_histogram || do_stats || do_gnuplot)
 
-static inline void add_histogram(long *histogram, long addval)
+static inline void add_histogram(int32_t *histogram, int32_t addval)
 {
/* bucketsize steps */
-   long inabs = (addval = 0 ? addval : -addval) / bucketsize;
+   int inabs = (addval = 0 ? addval : -addval) / bucketsize;
histogram[inabs  histogram_size ? inabs : histogram_size - 1]++;
 }
 
@@ -77,7 +77,7 @@ static void latency(void *cookie)
RTIME expected_ns, start_ns, fault_threshold;
unsigned int old_relaxed = 0, new_relaxed;
int ret, count, nsamples, warmup = 1;
-   long minj, maxj, dt, overrun, sumj;
+   int32_t minj, maxj, dt, overrun, sumj;
unsigned long ov;
 
fault_threshold = CONFIG_XENO_DEFAULT_PERIOD;
@@ -100,7 +100,7 @@ static void latency(void *cookie)
 
for (count = sumj = 0; count  nsamples; count++) {
ret = rt_task_wait_period(ov);
-   dt = (long)(rt_timer_read() - expected_ns);
+   dt = (int32_t)(rt_timer_read() - expected_ns);
new_relaxed = sampling_relaxed;
if (dt  maxj) {
if (new_relaxed != old_relaxed
@@ -213,7 +213,7 @@ static void display(void *cookie)
test_duration);
 
for (;;) {
-   long minj, gminj, maxj, gmaxj, avgj;
+   int32_t minj, gminj, maxj, gmaxj, avgj;
 
if (test_mode == USER_TASK) {
ret = rt_sem_p(display_sem, TM_INFINITE);
@@ -268,7 +268,7 @@ static void display(void *cookie)
   lat max, -overrun, ---msw,
   ---lat best, --lat worst);
}
-   
printf(RTD|%11.3f|%11.3f|%11.3f|%8ld|%6u|%11.3f|%11.3f\n,
+   
printf(RTD|%11.3f|%11.3f|%11.3f|%8d|%6u|%11.3f|%11.3f\n,
   (double)minj / 1000,
   (double)avgj / 1000,
   (double)maxj / 1000,
@@ -279,7 +279,7 @@ static void display(void *cookie)
}
 }
 
-static double dump_histogram(long *histogram, char *kind)
+static double dump_histogram(int32_t *histogram, char *kind)
 {
int n, total_hits = 0;
double avg = 0; /* used to sum hits 1st */
@@ -288,13 +288,13 @@ static double dump_histogram(long *histogram, char *kind)
printf(---|--param|range-|--samples\n);
 
for (n = 0; n  histogram_size; n++) {
-   long hits = histogram[n];
+   int32_t hits = histogram[n];
 
if (hits) {
total_hits += hits;
avg += n * hits;
if (do_histogram)
-   printf(HSD|%s| %3d -%3d | %8ld\n,
+   printf(HSD|%s| %3d -%3d | %8d\n,
   kind, n, n + 1, 

[Xenomai-git] Philippe Gerum : cobalt/posix: expose compat helpers to RTDM drivers

2014-10-30 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: 7fb98485d05bb5dc0210b9fdb723baafa2bac0eb
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=7fb98485d05bb5dc0210b9fdb723baafa2bac0eb

Author: Philippe Gerum r...@xenomai.org
Date:   Mon Oct 27 17:27:35 2014 +0100

cobalt/posix: expose compat helpers to RTDM drivers

---

 include/cobalt/kernel/rtdm/cobalt.h |1 +
 include/cobalt/kernel/rtdm/compat.h |3 +
 kernel/cobalt/posix/Makefile|2 +-
 kernel/cobalt/posix/compat.c|  381 +++
 kernel/cobalt/posix/compat.h|  155 ++
 kernel/cobalt/posix/syscall32.c |  342 ---
 kernel/cobalt/posix/syscall32.h |   74 +--
 kernel/cobalt/posix/thread.h|4 +-
 8 files changed, 545 insertions(+), 417 deletions(-)

diff --git a/include/cobalt/kernel/rtdm/cobalt.h 
b/include/cobalt/kernel/rtdm/cobalt.h
index 2c38053..fc75430 100644
--- a/include/cobalt/kernel/rtdm/cobalt.h
+++ b/include/cobalt/kernel/rtdm/cobalt.h
@@ -29,5 +29,6 @@
 #include xenomai/posix/clock.h
 #include xenomai/posix/event.h
 #include xenomai/posix/monitor.h
+#include xenomai/posix/compat.h
 
 #endif /* !_COBALT_RTDM_COBALT_H */
diff --git a/include/cobalt/kernel/rtdm/compat.h 
b/include/cobalt/kernel/rtdm/compat.h
index fdf493f..44b6884 100644
--- a/include/cobalt/kernel/rtdm/compat.h
+++ b/include/cobalt/kernel/rtdm/compat.h
@@ -22,6 +22,7 @@
 
 #include linux/compat.h
 #include net/compat.h
+#include rtdm/rtdm.h
 
 struct compat_rtdm_getsockopt_args {
int level;
@@ -70,4 +71,6 @@ struct compat_rtdm_setsockaddr_args {
 
 #endif /* !CONFIG_COMPAT */
 
+#define COMPAT_CASE(__op)  case __op __COMPAT_CASE(__op  ## _COMPAT)
+
 #endif /* !_COBALT_RTDM_COMPAT_H */
diff --git a/kernel/cobalt/posix/Makefile b/kernel/cobalt/posix/Makefile
index 22d5f2b..2ac92ff 100644
--- a/kernel/cobalt/posix/Makefile
+++ b/kernel/cobalt/posix/Makefile
@@ -20,6 +20,6 @@ xenomai-y :=  \
timer.o \
timerfd.o
 
-xenomai-$(CONFIG_XENO_ARCH_SYS3264) += syscall32.o
+xenomai-$(CONFIG_XENO_ARCH_SYS3264) += compat.o syscall32.o
 
 ccflags-y := -Iarch/$(SRCARCH)/xenomai/include -Iinclude/xenomai -Ikernel
diff --git a/kernel/cobalt/posix/compat.c b/kernel/cobalt/posix/compat.c
new file mode 100644
index 000..de2143a
--- /dev/null
+++ b/kernel/cobalt/posix/compat.c
@@ -0,0 +1,381 @@
+/*
+ * Copyright (C) 2014 Philippe Gerum r...@xenomai.org
+ *
+ * Xenomai is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Xenomai is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+#include linux/err.h
+#include linux/module.h
+#include compat.h
+
+int sys32_get_timespec(struct timespec *ts,
+  const struct compat_timespec __user *cts)
+{
+   return (cts == NULL ||
+   !access_rok(cts, sizeof(*cts)) ||
+   __xn_get_user(ts-tv_sec, cts-tv_sec) ||
+   __xn_get_user(ts-tv_nsec, cts-tv_nsec)) ? -EFAULT : 0;
+}
+EXPORT_SYMBOL_GPL(sys32_get_timespec);
+
+int sys32_put_timespec(struct compat_timespec __user *cts,
+  const struct timespec *ts)
+{
+   return (cts == NULL ||
+   !access_wok(cts, sizeof(*cts)) ||
+   __xn_put_user(ts-tv_sec, cts-tv_sec) ||
+   __xn_put_user(ts-tv_nsec, cts-tv_nsec)) ? -EFAULT : 0;
+}
+EXPORT_SYMBOL_GPL(sys32_put_timespec);
+
+int sys32_get_itimerspec(struct itimerspec *its,
+const struct compat_itimerspec __user *cits)
+{
+   int ret = sys32_get_timespec(its-it_value, cits-it_value);
+
+   return ret ?: sys32_get_timespec(its-it_interval, cits-it_interval);
+}
+EXPORT_SYMBOL_GPL(sys32_get_itimerspec);
+
+int sys32_put_itimerspec(struct compat_itimerspec __user *cits,
+const struct itimerspec *its)
+{
+   int ret = sys32_put_timespec(cits-it_value, its-it_value);
+
+   return ret ?: sys32_put_timespec(cits-it_interval, its-it_interval);
+}
+EXPORT_SYMBOL_GPL(sys32_put_itimerspec);
+
+int sys32_get_timeval(struct timeval *tv,
+ const struct compat_timeval __user *ctv)
+{
+   return (ctv == NULL ||
+   !access_rok(ctv, sizeof(*ctv)) ||
+   __xn_get_user(tv-tv_sec, ctv-tv_sec) ||
+   __xn_get_user(tv-tv_usec, ctv-tv_usec)) ? -EFAULT : 0;
+}
+EXPORT_SYMBOL_GPL(sys32_get_timeval);
+
+int 

[Xenomai-git] Jorge Ramirez-Ortiz : utils/analogy: calibration - use the analogy' s math utils

2014-10-30 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: a66aefdeb317df5772f84eeba1468343a9e450c1
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=a66aefdeb317df5772f84eeba1468343a9e450c1

Author: Jorge Ramirez-Ortiz j...@xenomai.org
Date:   Tue Oct 14 21:03:05 2014 -0400

utils/analogy: calibration - use the analogy's math utils

---

 include/rtdm/analogy.h|   12 ++
 include/rtdm/uapi/analogy.h   |2 +-
 lib/analogy/Makefile.am   |5 +-
 lib/analogy/calibration.c |   22 ++
 lib/analogy/calibration.h |   21 ++
 lib/analogy/math.c|  418 +
 utils/analogy/Makefile.am |2 +-
 utils/analogy/analogy_calibrate.c |6 +-
 utils/analogy/calibration_ni_m.c  |  106 +++---
 utils/analogy/calibration_ni_m.h  |6 +-
 10 files changed, 515 insertions(+), 85 deletions(-)

diff --git a/include/rtdm/analogy.h b/include/rtdm/analogy.h
index fd26f58..c03d2b1 100644
--- a/include/rtdm/analogy.h
+++ b/include/rtdm/analogy.h
@@ -236,6 +236,18 @@ void a4l_write_calibration_file(FILE *dst, struct list *l,
 
 int a4l_read_calibration_file(char *name, struct a4l_calibration_data *data);
 
+int a4l_math_polyfit(unsigned order, double *r,double orig,
+const unsigned dim, double *x, double *y);
+
+void a4l_math_mean(double *pmean, double *val, unsigned nr);
+
+void a4l_math_stddev(double *pstddev,
+double mean, double *val, unsigned nr);
+
+void a4l_math_stddev_of_mean(double *pstddevm,
+double mean, double *val, unsigned nr);
+
+
 
 
 #endif /* !DOXYGEN_CPP */
diff --git a/include/rtdm/uapi/analogy.h b/include/rtdm/uapi/analogy.h
index 669ded7..a0a1e59 100644
--- a/include/rtdm/uapi/analogy.h
+++ b/include/rtdm/uapi/analogy.h
@@ -708,9 +708,9 @@ typedef struct a4l_instruction_list a4l_insnlst_t;
 
 struct a4l_calibration_subdev {
a4l_sbinfo_t *info;
+   char *name;
int slen;
int idx;
-   char *name;
 };
 
 struct a4l_calibration_subdev_data {
diff --git a/lib/analogy/Makefile.am b/lib/analogy/Makefile.am
index 500453d..b79d4cb 100644
--- a/lib/analogy/Makefile.am
+++ b/lib/analogy/Makefile.am
@@ -7,6 +7,7 @@ libanalogy_la_SOURCES = \
descriptor.c\
info.c  \
internal.h  \
+   math.c  \
calibration.c   \
range.c \
root_leaf.h \
@@ -19,4 +20,6 @@ libanalogy_la_CPPFLAGS =  \
-I$(top_srcdir)/lib/boilerplate 
 
 libanalogy_la_LIBADD = \
-   ../boilerplate/libboilerplate.la
+   ../boilerplate/libboilerplate.la\
+   -lm
+
diff --git a/lib/analogy/calibration.c b/lib/analogy/calibration.c
index 74b2789..85860d1 100644
--- a/lib/analogy/calibration.c
+++ b/lib/analogy/calibration.c
@@ -1,3 +1,25 @@
+/**
+ * @file
+ * Analogy for Linux, device, subdevice, etc. related features
+ *
+ * @note Copyright (C) 1997-2000 David A. Schleef d...@schleef.org
+ * @note Copyright (C) 2014 Jorge A. Ramirez-Ortiz j...@xenomai.org
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.
+ */
+
 #include rtdm/analogy.h
 #include stdio.h
 #include errno.h
diff --git a/lib/analogy/calibration.h b/lib/analogy/calibration.h
index 04a7e72..4080c60 100644
--- a/lib/analogy/calibration.h
+++ b/lib/analogy/calibration.h
@@ -1,3 +1,24 @@
+/**
+ * @file
+ * Analogy for Linux, internal calibration declarations
+ *
+ * @note Copyright (C) 2014 Jorge A Ramirez-Ortiz j...@xenomai.org
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.
+ */
+
 #ifndef __ANALOGY_CALIBRATION_H__

[Xenomai-git] Philippe Gerum : cobalt/sched: assoc policy identifier to sched class

2014-10-30 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: f15920c67d075cee304e673ad2b76610dda3b97d
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=f15920c67d075cee304e673ad2b76610dda3b97d

Author: Philippe Gerum r...@xenomai.org
Date:   Wed Oct 29 10:03:46 2014 +0100

cobalt/sched: assoc policy identifier to sched class

---

 include/cobalt/kernel/sched.h  |1 +
 kernel/cobalt/posix/thread.c   |   10 --
 kernel/cobalt/posix/thread.h   |3 ---
 kernel/cobalt/sched-idle.c |1 +
 kernel/cobalt/sched-quota.c|2 ++
 kernel/cobalt/sched-rt.c   |1 +
 kernel/cobalt/sched-sporadic.c |2 ++
 kernel/cobalt/sched-tp.c   |2 ++
 kernel/cobalt/sched-weak.c |2 ++
 9 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/include/cobalt/kernel/sched.h b/include/cobalt/kernel/sched.h
index 424538b..1ee2aa7 100644
--- a/include/cobalt/kernel/sched.h
+++ b/include/cobalt/kernel/sched.h
@@ -158,6 +158,7 @@ struct xnsched_class {
int nthreads;
struct xnsched_class *next;
int weight;
+   int policy;
const char *name;
 };
 
diff --git a/kernel/cobalt/posix/thread.c b/kernel/cobalt/posix/thread.c
index 27c824b..0786ad3 100644
--- a/kernel/cobalt/posix/thread.c
+++ b/kernel/cobalt/posix/thread.c
@@ -264,7 +264,6 @@ pthread_setschedparam_ex(struct cobalt_thread *thread,
ret = -EINVAL;
goto out;
}
-   thread-sched_u_policy = policy;
xnthread_set_slice(thread-threadbase, tslice);
if (cobalt_call_extension(thread_setsched, thread-extref, ret,
  sched_class, param)  ret)
@@ -284,7 +283,6 @@ pthread_getschedparam_ex(struct cobalt_thread *thread,
 {
struct xnsched_class *base_class;
struct xnthread *base_thread;
-   int prio;
spl_t s;
 
xnlock_get_irqsave(nklock, s);
@@ -297,9 +295,10 @@ pthread_getschedparam_ex(struct cobalt_thread *thread,
 
base_thread = thread-threadbase;
base_class = base_thread-base_class;
-   *policy_r = thread-sched_u_policy;
-   prio = xnthread_base_priority(base_thread);
-   param_ex-sched_priority = prio;
+   param_ex-sched_priority = xnthread_base_priority(base_thread);
+   *policy_r = base_class-policy;
+   if (param_ex-sched_priority == 0) /* SCHED_FIFO/SCHED_WEAK */
+   *policy_r = SCHED_NORMAL;
 
if (base_class == xnsched_class_rt) {
if (xnthread_test_state(base_thread, XNRRB))
@@ -379,7 +378,6 @@ static inline int pthread_create(struct cobalt_thread 
**thread_p,
return ret;
}
 
-   thread-sched_u_policy = policy;
thread-magic = COBALT_THREAD_MAGIC;
xnsynch_init(thread-monitor_synch, XNSYNCH_FIFO, NULL);
 
diff --git a/kernel/cobalt/posix/thread.h b/kernel/cobalt/posix/thread.h
index d1bc034..34dc6cc 100644
--- a/kernel/cobalt/posix/thread.h
+++ b/kernel/cobalt/posix/thread.h
@@ -102,9 +102,6 @@ struct cobalt_thread {
struct xnsynch sigwait;
struct list_head signext;
 
-   /** Cached value for current policy (user side). */
-   int sched_u_policy;
-
/** Monitor wait object and link holder. */
struct xnsynch monitor_synch;
struct list_head monitor_link;
diff --git a/kernel/cobalt/sched-idle.c b/kernel/cobalt/sched-idle.c
index 5127798..8f59c0d 100644
--- a/kernel/cobalt/sched-idle.c
+++ b/kernel/cobalt/sched-idle.c
@@ -56,5 +56,6 @@ struct xnsched_class xnsched_class_idle = {
.sched_getparam =   xnsched_idle_getparam,
.sched_trackprio=   xnsched_idle_trackprio,
.weight =   XNSCHED_CLASS_WEIGHT(0),
+   .policy =   SCHED_IDLE,
.name   =   idle
 };
diff --git a/kernel/cobalt/sched-quota.c b/kernel/cobalt/sched-quota.c
index 8a72819..71e2c36 100644
--- a/kernel/cobalt/sched-quota.c
+++ b/kernel/cobalt/sched-quota.c
@@ -19,6 +19,7 @@
 #include linux/bitmap.h
 #include cobalt/kernel/sched.h
 #include cobalt/kernel/arith.h
+#include cobalt/uapi/sched.h
 
 /*
  * With this policy, each per-CPU scheduler slot maintains a list of
@@ -765,6 +766,7 @@ struct xnsched_class xnsched_class_quota = {
.sched_cleanup_vfile=   xnsched_quota_cleanup_vfile,
 #endif
.weight =   XNSCHED_CLASS_WEIGHT(3),
+   .policy =   SCHED_QUOTA,
.name   =   quota
 };
 EXPORT_SYMBOL_GPL(xnsched_class_quota);
diff --git a/kernel/cobalt/sched-rt.c b/kernel/cobalt/sched-rt.c
index 44f90dd..3bd9308 100644
--- a/kernel/cobalt/sched-rt.c
+++ b/kernel/cobalt/sched-rt.c
@@ -246,6 +246,7 @@ struct xnsched_class xnsched_class_rt = {
.sched_cleanup_vfile=   xnsched_rt_cleanup_vfile,
 #endif
.weight =   XNSCHED_CLASS_WEIGHT(4),
+   .policy =   SCHED_FIFO,
.name   =   

[Xenomai-git] Gilles Chanteperdrix : cobalt/rtdm: add fcntl syscall

2014-10-30 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: 450290bb5c82f0007027776be9e9bd09136f41be
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=450290bb5c82f0007027776be9e9bd09136f41be

Author: Gilles Chanteperdrix gilles.chanteperd...@xenomai.org
Date:   Sat Oct 25 21:11:16 2014 +0200

cobalt/rtdm: add fcntl syscall

---

 include/cobalt/fcntl.h|2 +
 include/cobalt/kernel/rtdm/fd.h   |2 +
 include/cobalt/kernel/rtdm/rtdm.h |3 +
 include/cobalt/uapi/syscall.h |  133 +++--
 kernel/cobalt/posix/io.c  |6 ++
 kernel/cobalt/posix/io.h  |2 +
 kernel/cobalt/posix/syscall.c |   10 +--
 kernel/cobalt/rtdm/fd.c   |   42 +++-
 lib/cobalt/cobalt.wrappers|1 +
 lib/cobalt/rtdm.c |   18 +
 lib/cobalt/wrappers.c |   13 
 11 files changed, 159 insertions(+), 73 deletions(-)

diff --git a/include/cobalt/fcntl.h b/include/cobalt/fcntl.h
index ed96dd7..2a83a7a 100644
--- a/include/cobalt/fcntl.h
+++ b/include/cobalt/fcntl.h
@@ -29,6 +29,8 @@ extern C {
 
 COBALT_DECL(int, open(const char *path, int oflag, ...));
 
+COBALT_DECL(int, fcntl(int fd, int cmd, ...));
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/include/cobalt/kernel/rtdm/fd.h b/include/cobalt/kernel/rtdm/fd.h
index ccf0332..5685b3a 100644
--- a/include/cobalt/kernel/rtdm/fd.h
+++ b/include/cobalt/kernel/rtdm/fd.h
@@ -353,6 +353,8 @@ void rtdm_fd_put(struct rtdm_fd *fd);
 
 void rtdm_fd_unlock(struct rtdm_fd *fd);
 
+int rtdm_fd_fcntl(int ufd, int cmd, ...);
+
 int rtdm_fd_ioctl(int ufd, unsigned int request, ...);
 
 ssize_t rtdm_fd_read(int ufd, void __user *buf, size_t size);
diff --git a/include/cobalt/kernel/rtdm/rtdm.h 
b/include/cobalt/kernel/rtdm/rtdm.h
index db1e270..2b1c8fd 100644
--- a/include/cobalt/kernel/rtdm/rtdm.h
+++ b/include/cobalt/kernel/rtdm/rtdm.h
@@ -50,6 +50,9 @@ int __rtdm_dev_socket(int protocol_family,
 #define rt_dev_close(fd)   \
rtdm_fd_close(fd, RTDM_FD_MAGIC)
 
+#define rt_dev_fcntl(fd, cmd, ...) \
+   rtdm_fd_fcntl(fd,cmd, __VA_ARGS__)
+
 #define rt_dev_ioctl(fd, request, ...) \
rtdm_fd_ioctl(fd, request, __VA_ARGS__)
 
diff --git a/include/cobalt/uapi/syscall.h b/include/cobalt/uapi/syscall.h
index aa364a1..025d2ff 100644
--- a/include/cobalt/uapi/syscall.h
+++ b/include/cobalt/uapi/syscall.h
@@ -21,63 +21,63 @@
 #include cobalt/uapi/asm-generic/syscall.h
 
 #define sc_cobalt_bind 0
-#define sc_cobalt_thread_create1
-#define sc_cobalt_thread_getpid2
-#define sc_cobalt_thread_setmode   3
-#define sc_cobalt_thread_setname   4
-#define sc_cobalt_thread_join  5
-#define sc_cobalt_thread_kill  6
+#define sc_cobalt_thread_create1
+#define sc_cobalt_thread_getpid2
+#define sc_cobalt_thread_setmode   3
+#define sc_cobalt_thread_setname   4
+#define sc_cobalt_thread_join  5
+#define sc_cobalt_thread_kill  6
 #define sc_cobalt_thread_setschedparam_ex  7
 #define sc_cobalt_thread_getschedparam_ex  8
-#define sc_cobalt_thread_getstat   9
+#define sc_cobalt_thread_getstat   9
 /* 10 unimp */
-#define sc_cobalt_sem_init 11
-#define sc_cobalt_sem_destroy  12
-#define sc_cobalt_sem_post 13
-#define sc_cobalt_sem_wait 14
-#define sc_cobalt_sem_trywait  15
-#define sc_cobalt_sem_getvalue 16
-#define sc_cobalt_sem_open 17
-#define sc_cobalt_sem_close18
-#define sc_cobalt_sem_unlink   19
-#define sc_cobalt_sem_timedwait20
-#define sc_cobalt_sem_inquire  21
+#define sc_cobalt_sem_init 11
+#define sc_cobalt_sem_destroy  12
+#define sc_cobalt_sem_post 13
+#define sc_cobalt_sem_wait 14
+#define sc_cobalt_sem_trywait  15
+#define sc_cobalt_sem_getvalue 16
+#define sc_cobalt_sem_open 17
+#define sc_cobalt_sem_close18
+#define sc_cobalt_sem_unlink   19
+#define sc_cobalt_sem_timedwait20
+#define sc_cobalt_sem_inquire  21
 /* 22 unimp */
-#define sc_cobalt_sem_broadcast_np 23
-#define sc_cobalt_clock_getres 24
-#define sc_cobalt_clock_gettime25
-#define sc_cobalt_clock_settime26
-#define sc_cobalt_clock_nanosleep  27
-#define sc_cobalt_mutex_init   28
-#define sc_cobalt_mutex_check_init 29
-#define sc_cobalt_mutex_destroy30
-#define sc_cobalt_mutex_lock

[Xenomai-git] Philippe Gerum : cobalt/syscall: compact syscall table

2014-10-30 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: 45689e3b46298ba1cd746851ff953b35dbba84ae
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=45689e3b46298ba1cd746851ff953b35dbba84ae

Author: Philippe Gerum r...@xenomai.org
Date:   Thu Oct 30 16:35:40 2014 +0100

cobalt/syscall: compact syscall table

---

 include/cobalt/uapi/syscall.h |  176 -
 1 file changed, 86 insertions(+), 90 deletions(-)

diff --git a/include/cobalt/uapi/syscall.h b/include/cobalt/uapi/syscall.h
index e907c4b..18bb358 100644
--- a/include/cobalt/uapi/syscall.h
+++ b/include/cobalt/uapi/syscall.h
@@ -30,96 +30,92 @@
 #define sc_cobalt_thread_setschedparam_ex  7
 #define sc_cobalt_thread_getschedparam_ex  8
 #define sc_cobalt_thread_getstat   9
-/* 10 unimp */
-#define sc_cobalt_sem_init 11
-#define sc_cobalt_sem_destroy  12
-#define sc_cobalt_sem_post 13
-#define sc_cobalt_sem_wait 14
-#define sc_cobalt_sem_trywait  15
-#define sc_cobalt_sem_getvalue 16
-#define sc_cobalt_sem_open 17
-#define sc_cobalt_sem_close18
-#define sc_cobalt_sem_unlink   19
-#define sc_cobalt_sem_timedwait20
-#define sc_cobalt_sem_inquire  21
-/* 22 unimp */
-#define sc_cobalt_sem_broadcast_np 23
-#define sc_cobalt_clock_getres 24
-#define sc_cobalt_clock_gettime25
-#define sc_cobalt_clock_settime26
-#define sc_cobalt_clock_nanosleep  27
-#define sc_cobalt_mutex_init   28
-#define sc_cobalt_mutex_check_init 29
-#define sc_cobalt_mutex_destroy30
-#define sc_cobalt_mutex_lock   31
-#define sc_cobalt_mutex_timedlock  32
-#define sc_cobalt_mutex_trylock33
-#define sc_cobalt_mutex_unlock 34
-#define sc_cobalt_cond_init35
-#define sc_cobalt_cond_destroy 36
-#define sc_cobalt_cond_wait_prologue   37
-#define sc_cobalt_cond_wait_epilogue   38
-#define sc_cobalt_mq_open  39
-#define sc_cobalt_mq_close 40
-#define sc_cobalt_mq_unlink41
-#define sc_cobalt_mq_getattr   42
-/* 43 unimp */
-#define sc_cobalt_mq_timedsend 44
-#define sc_cobalt_mq_timedreceive  45
-#define sc_cobalt_mq_notify46
-#define sc_cobalt_sched_minprio47
-#define sc_cobalt_sched_maxprio48
-#define sc_cobalt_sched_weightprio 49
-#define sc_cobalt_sched_yield  50
-#define sc_cobalt_sched_setconfig_np   51
-#define sc_cobalt_sched_getconfig_np   52
-#define sc_cobalt_timer_create 53
-#define sc_cobalt_timer_delete 54
-#define sc_cobalt_timer_settime55
-#define sc_cobalt_timer_gettime56
-#define sc_cobalt_timer_getoverrun 57
-#define sc_cobalt_timerfd_create   58
-#define sc_cobalt_timerfd_settime  59
-#define sc_cobalt_timerfd_gettime  60
-#define sc_cobalt_sigwait  61
-#define sc_cobalt_sigwaitinfo  62
-#define sc_cobalt_sigtimedwait 63
-#define sc_cobalt_sigpending   64
-#define sc_cobalt_kill 65
-#define sc_cobalt_sigqueue 66
-#define sc_cobalt_monitor_init 67
-#define sc_cobalt_monitor_destroy  68
-#define sc_cobalt_monitor_enter69
-#define sc_cobalt_monitor_wait 70
-#define sc_cobalt_monitor_sync 71
-#define sc_cobalt_monitor_exit 72
-#define sc_cobalt_event_init   73
-#define sc_cobalt_event_wait   74
-#define sc_cobalt_event_sync   75
-#define sc_cobalt_event_destroy76
-#define sc_cobalt_event_inquire77
-#define sc_cobalt_open 78
-#define sc_cobalt_socket   79
-#define sc_cobalt_close80
-#define sc_cobalt_ioctl81
-#define sc_cobalt_read 82
-#define sc_cobalt_write83
-#define sc_cobalt_recvmsg  84
-#define sc_cobalt_sendmsg  85
-#define sc_cobalt_mmap 86
-#define sc_cobalt_select   87
-#define sc_cobalt_migrate  88
-#define sc_cobalt_archcall 89
-/* 90 unimp */
-#define sc_cobalt_trace91
-#define sc_cobalt_sysctl 

[Xenomai-git] Philippe Gerum : cobalt/sched/tp: fix double unlink on thread fallback to FIFO

2014-10-30 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: 4cfacb30c140b9534d2e40ace5c4e4d4baa10874
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=4cfacb30c140b9534d2e40ace5c4e4d4baa10874

Author: Philippe Gerum r...@xenomai.org
Date:   Sun Oct 26 16:14:19 2014 +0100

cobalt/sched/tp: fix double unlink on thread fallback to FIFO

---

 kernel/cobalt/sched-tp.c |1 -
 1 file changed, 1 deletion(-)

diff --git a/kernel/cobalt/sched-tp.c b/kernel/cobalt/sched-tp.c
index 484e339..d3e7f5f 100644
--- a/kernel/cobalt/sched-tp.c
+++ b/kernel/cobalt/sched-tp.c
@@ -253,7 +253,6 @@ xnsched_tp_set_schedule(struct xnsched *sched,
goto done;
 
list_for_each_entry_safe(thread, tmp, tp-threads, tp_link) {
-   list_del(thread-tp_link);
param.rt.prio = thread-cprio;
xnsched_set_policy(thread, xnsched_class_rt, param);
}


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://www.xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : drivers/ipc/xddp: fix memory leak on connection release

2014-10-30 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: caf0a0b4a3f279e3e4bd42e6b62bc09fab4fba94
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=caf0a0b4a3f279e3e4bd42e6b62bc09fab4fba94

Author: Philippe Gerum r...@xenomai.org
Date:   Thu Oct 30 14:44:07 2014 +0100

drivers/ipc/xddp: fix memory leak on connection release

---

 kernel/drivers/ipc/xddp.c |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/kernel/drivers/ipc/xddp.c b/kernel/drivers/ipc/xddp.c
index 8f1333d..efb4a41 100644
--- a/kernel/drivers/ipc/xddp.c
+++ b/kernel/drivers/ipc/xddp.c
@@ -207,7 +207,8 @@ static void __xddp_release_handler(void *skarg) /* nklock 
free */
poolsz = xnheap_get_size(sk-privpool);
xnheap_destroy(sk-privpool);
free_pages_exact(poolmem, poolsz);
-   }
+   } else if (sk-buffer)
+   xnfree(sk-buffer);
 
kfree(sk);
 }


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://www.xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Jorge Ramirez-Ortiz : lib/analogy: use stddev to calculate stddev_of_mean

2014-10-30 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: 50aa0a9aae828ecedaf1d5ff6f875755fe32a9b5
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=50aa0a9aae828ecedaf1d5ff6f875755fe32a9b5

Author: Jorge Ramirez-Ortiz j...@xenomai.org
Date:   Sun Oct 26 10:47:45 2014 -0400

lib/analogy: use stddev to calculate stddev_of_mean

---

 lib/analogy/math.c |   12 ++--
 1 file changed, 2 insertions(+), 10 deletions(-)

diff --git a/lib/analogy/math.c b/lib/analogy/math.c
index c0e2f60..1679ecd 100644
--- a/lib/analogy/math.c
+++ b/lib/analogy/math.c
@@ -449,16 +449,8 @@ void a4l_math_stddev(double *pstddev, double mean, double 
*val, unsigned nr)
  */
 void a4l_math_stddev_of_mean(double *pstddevm, double mean, double *val, 
unsigned nr)
 {
-   double sum, sum_sq;
-   int i;
-
-   for (sum = 0, sum_sq = 0, i = 0; i  nr; i++) {
-   double x = val[i] - mean;
-   sum_sq += x * x;
-   sum += x;
-   }
-
-   *pstddevm = sqrt(((sum_sq - (sum * sum) / nr) / (nr - 1)) / nr);
+   a4l_math_stddev(pstddevm, mean, val, nr);
+   *pstddevm = *pstddevm / sqrt(nr); 
 }
 
 


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://www.xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : cobalt/posix/compat: fix sys32_get_sigevent() helper

2014-10-30 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: 0313853e0802acc09121d291f7694818e8af3ade
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=0313853e0802acc09121d291f7694818e8af3ade

Author: Philippe Gerum r...@xenomai.org
Date:   Tue Oct 28 16:09:01 2014 +0100

cobalt/posix/compat: fix sys32_get_sigevent() helper

---

 kernel/cobalt/posix/compat.c |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/kernel/cobalt/posix/compat.c b/kernel/cobalt/posix/compat.c
index e0f9609..948616c 100644
--- a/kernel/cobalt/posix/compat.c
+++ b/kernel/cobalt/posix/compat.c
@@ -229,7 +229,7 @@ int sys32_get_sigevent(struct sigevent *ev,
return ret;
 
memset(ev, 0, sizeof(*ev));
-   ev-sigev_value.sival_int = cev.sigev_value.sival_int;
+   ev-sigev_value.sival_ptr = compat_ptr(cev.sigev_value.sival_ptr);
ev-sigev_signo = cev.sigev_signo;
ev-sigev_notify = cev.sigev_notify;
/*
@@ -238,8 +238,8 @@ int sys32_get_sigevent(struct sigevent *ev,
 */
p = ev-_sigev_un._pad;
cp = cev._sigev_un._pad;
-   while ((void *)cp  (void *)cev._sigev_un._pad
-  + sizeof(cev._sigev_un._pad))
+   while (p  ev-_sigev_un._pad[ARRAY_SIZE(ev-_sigev_un._pad)] 
+  cp  cev._sigev_un._pad[ARRAY_SIZE(cev._sigev_un._pad)])
*p++ = *cp++;
 
return 0;


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://www.xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Jorge Ramirez-Ortiz : drivers/analogy: remove unnecessary lock

2014-10-30 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: b82b83556b147741c31187595412ba203de1fcf3
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=b82b83556b147741c31187595412ba203de1fcf3

Author: Jorge Ramirez-Ortiz j...@xenomai.org
Date:   Thu Aug 14 13:41:50 2014 -0400

drivers/analogy: remove unnecessary lock

---

 kernel/drivers/analogy/transfer.c |   13 ++---
 1 file changed, 2 insertions(+), 11 deletions(-)

diff --git a/kernel/drivers/analogy/transfer.c 
b/kernel/drivers/analogy/transfer.c
index 2594f00..bf19c8c 100644
--- a/kernel/drivers/analogy/transfer.c
+++ b/kernel/drivers/analogy/transfer.c
@@ -154,26 +154,17 @@ int a4l_request_irq(struct a4l_device * dev,
unsigned long flags, void *cookie)
 {
int ret;
-   unsigned long __flags;
 
if (dev-transfer.irq_desc.irq != A4L_IRQ_UNUSED)
return -EBUSY;
 
-   /* A spinlock is used so as to prevent race conditions
-  on the field irq of the IRQ descriptor
-  (even if such a case is bound not to happen) */
-   rtdm_lock_get_irqsave(dev-lock, __flags);
-
-   ret = __a4l_request_irq(dev-transfer.irq_desc,
-   irq, handler, flags, cookie);
-
+   ret = __a4l_request_irq(dev-transfer.irq_desc, irq, handler, flags,
+   cookie);
if (ret != 0) {
__a4l_err(a4l_request_irq: IRQ registration failed\n);
dev-transfer.irq_desc.irq = A4L_IRQ_UNUSED;
}
 
-   rtdm_lock_put_irqrestore(dev-lock, __flags);
-
return ret;
 }
 


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://www.xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : cobalt/x86: enable support for x32 ABI model

2014-10-30 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: 8876746e82af2d46af91eb93504f498b4d1f4b39
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=8876746e82af2d46af91eb93504f498b4d1f4b39

Author: Philippe Gerum r...@xenomai.org
Date:   Wed Oct 29 15:41:33 2014 +0100

cobalt/x86: enable support for x32 ABI model

---

 .../arch/x86/include/asm/xenomai/syscall32-table.h |   16 +
 .../arch/x86/include/asm/xenomai/syscall32.h   |7 +++-
 kernel/cobalt/posix/syscall32.c|   34 
 kernel/cobalt/posix/syscall32.h|6 
 4 files changed, 62 insertions(+), 1 deletion(-)

diff --git a/kernel/cobalt/arch/x86/include/asm/xenomai/syscall32-table.h 
b/kernel/cobalt/arch/x86/include/asm/xenomai/syscall32-table.h
index 9f2f000..1dce4e7 100644
--- a/kernel/cobalt/arch/x86/include/asm/xenomai/syscall32-table.h
+++ b/kernel/cobalt/arch/x86/include/asm/xenomai/syscall32-table.h
@@ -28,6 +28,7 @@ __COBALT_CALL32emu_THUNK(thread_create)
 __COBALT_CALL32emu_THUNK(thread_setschedparam_ex)
 __COBALT_CALL32emu_THUNK(thread_getschedparam_ex)
 __COBALT_CALL32emu_THUNK(sem_open)
+__COBALT_CALL32x_THUNK(sem_open)
 __COBALT_CALL32emu_THUNK(sem_timedwait)
 __COBALT_CALL32emu_THUNK(clock_getres)
 __COBALT_CALL32emu_THUNK(clock_gettime)
@@ -36,29 +37,44 @@ __COBALT_CALL32emu_THUNK(clock_nanosleep)
 __COBALT_CALL32emu_THUNK(mutex_timedlock)
 __COBALT_CALL32emu_THUNK(cond_wait_prologue)
 __COBALT_CALL32emu_THUNK(mq_open)
+__COBALT_CALL32x_THUNK(mq_open)
 __COBALT_CALL32emu_THUNK(mq_getattr)
+__COBALT_CALL32x_THUNK(mq_getattr)
 __COBALT_CALL32emu_THUNK(mq_timedsend)
 __COBALT_CALL32emu_THUNK(mq_timedreceive)
+__COBALT_CALL32x_pure_THUNK(mq_timedreceive)
 __COBALT_CALL32emu_THUNK(mq_notify)
+__COBALT_CALL32x_THUNK(mq_notify)
 __COBALT_CALL32emu_THUNK(sched_weightprio)
 __COBALT_CALL32emu_THUNK(sched_setconfig_np)
 __COBALT_CALL32emu_THUNK(sched_getconfig_np)
 __COBALT_CALL32emu_THUNK(timer_create)
+__COBALT_CALL32x_THUNK(timer_create)
 __COBALT_CALL32emu_THUNK(timer_settime)
 __COBALT_CALL32emu_THUNK(timer_gettime)
 __COBALT_CALL32emu_THUNK(timerfd_settime)
 __COBALT_CALL32emu_THUNK(timerfd_gettime)
 __COBALT_CALL32emu_THUNK(sigwait)
+__COBALT_CALL32x_THUNK(sigwait)
 __COBALT_CALL32emu_THUNK(sigtimedwait)
+__COBALT_CALL32x_THUNK(sigtimedwait)
 __COBALT_CALL32emu_THUNK(sigwaitinfo)
+__COBALT_CALL32x_THUNK(sigwaitinfo)
 __COBALT_CALL32emu_THUNK(sigpending)
+__COBALT_CALL32x_THUNK(sigpending)
 __COBALT_CALL32emu_THUNK(sigqueue)
+__COBALT_CALL32x_THUNK(sigqueue)
 __COBALT_CALL32emu_THUNK(monitor_wait)
 __COBALT_CALL32emu_THUNK(event_wait)
 __COBALT_CALL32emu_THUNK(select)
+__COBALT_CALL32x_THUNK(select)
 __COBALT_CALL32emu_THUNK(recvmsg)
+__COBALT_CALL32x_THUNK(recvmsg)
 __COBALT_CALL32emu_THUNK(sendmsg)
+__COBALT_CALL32x_THUNK(sendmsg)
 __COBALT_CALL32emu_THUNK(mmap)
+__COBALT_CALL32x_THUNK(mmap)
 __COBALT_CALL32emu_THUNK(backtrace)
+__COBALT_CALL32x_THUNK(backtrace)
 
 #endif /* !_COBALT_X86_ASM_SYSCALL32_TABLE_H */
diff --git a/kernel/cobalt/arch/x86/include/asm/xenomai/syscall32.h 
b/kernel/cobalt/arch/x86/include/asm/xenomai/syscall32.h
index e4890a6..5604580 100644
--- a/kernel/cobalt/arch/x86/include/asm/xenomai/syscall32.h
+++ b/kernel/cobalt/arch/x86/include/asm/xenomai/syscall32.h
@@ -55,9 +55,12 @@
, [sc_cobalt_ ## __name + __COBALT_X32_BASE] = __handler
 
 /* x32 thunk installation */
-#define __COBALT_CALL32x_THUNK(__name) \
+#define __COBALT_CALL32x_pure_THUNK(__name)\
__COBALT_CALL32x_ENTRY(__name, __syshand32x__(__name))
 
+#define __COBALT_CALL32x_THUNK(__name) \
+   __COBALT_CALL32x_ENTRY(__name, __syshand32emu__(__name))
+
 /* x32 thunk implementation. */
 #define COBALT_SYSCALL32x(__name, __mode, __type, __args)  \
__typeof__(__type) cobalt32x_ ## __name __args
@@ -80,6 +83,8 @@
 
 #define __COBALT_CALL32x_ENTRY(__name, __handler)
 
+#define __COBALT_CALL32x_pure_THUNK(__name)
+
 #define __COBALT_CALL32x_THUNK(__name)
 
 #define COBALT_SYSCALL32x_DECL(__name, __type, __args)
diff --git a/kernel/cobalt/posix/syscall32.c b/kernel/cobalt/posix/syscall32.c
index 61c619f..17066bc 100644
--- a/kernel/cobalt/posix/syscall32.c
+++ b/kernel/cobalt/posix/syscall32.c
@@ -261,6 +261,14 @@ COBALT_SYSCALL32emu(mq_timedreceive, primary,
return ret ?: __xn_safe_copy_to_user(u_len, clen, sizeof(*u_len));
 }
 
+static inline int mq_fetch_timeout(struct timespec *ts,
+  const void __user *u_ts)
+{
+   return u_ts == NULL ? -EFAULT :
+   __xn_safe_copy_from_user(ts, u_ts, sizeof(*ts));
+
+}
+
 COBALT_SYSCALL32emu(mq_notify, primary,
int, (mqd_t fd, const struct compat_sigevent *__user u_cev))
 {
@@ -799,3 +807,29 @@ COBALT_SYSCALL32emu(backtrace, current,
 
return 0;
 }
+
+#ifdef COBALT_SYSCALL32x
+
+COBALT_SYSCALL32x(mq_timedreceive, primary,
+ int, (mqd_t uqd, void __user *u_buf,
+   compat_ssize_t __user *u_len,
+ 

[Xenomai-git] Philippe Gerum : cobalt/sched/tp: detect assignment to unconfigured CPU

2014-10-30 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: 5278d83ea3a108bbf3bc579e7b7f9e2048bf33f0
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=5278d83ea3a108bbf3bc579e7b7f9e2048bf33f0

Author: Philippe Gerum r...@xenomai.org
Date:   Sun Oct 26 17:58:43 2014 +0100

cobalt/sched/tp: detect assignment to unconfigured CPU

---

 kernel/cobalt/sched-tp.c |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/kernel/cobalt/sched-tp.c b/kernel/cobalt/sched-tp.c
index d3e7f5f..7ce04c1 100644
--- a/kernel/cobalt/sched-tp.c
+++ b/kernel/cobalt/sched-tp.c
@@ -158,8 +158,10 @@ static int xnsched_tp_declare(struct xnthread *thread,
  const union xnsched_policy_param *p)
 {
struct xnsched *sched = thread-sched;
+   struct xnsched_tp *tp = sched-tp;
 
-   if (p-tp.prio  XNSCHED_TP_MIN_PRIO ||
+   if (tp-gps == NULL ||
+   p-tp.prio  XNSCHED_TP_MIN_PRIO ||
p-tp.prio  XNSCHED_TP_MAX_PRIO)
return -EINVAL;
 


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://www.xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : cobalt/autotune: fixup for 32bit emulation

2014-10-30 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: 7ae93fc219c2a68317b5e21f7323820ddb20fa34
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=7ae93fc219c2a68317b5e21f7323820ddb20fa34

Author: Philippe Gerum r...@xenomai.org
Date:   Wed Oct 22 10:10:04 2014 +0200

cobalt/autotune: fixup for 32bit emulation

---

 include/rtdm/uapi/autotune.h   |8 
 kernel/drivers/autotune/autotune.c |4 ++--
 utils/autotune/autotune.c  |8 
 3 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/include/rtdm/uapi/autotune.h b/include/rtdm/uapi/autotune.h
index 4a75d72..225f2f8 100644
--- a/include/rtdm/uapi/autotune.h
+++ b/include/rtdm/uapi/autotune.h
@@ -24,15 +24,15 @@
 #define RTDM_SUBCLASS_AUTOTUNE 0
 
 struct autotune_setup {
-   int period;
-   int quiet;
+   __u32 period;
+   __u32 quiet;
 };
 
 #define AUTOTUNE_RTIOC_IRQ _IOW(RTDM_CLASS_AUTOTUNE, 0, struct 
autotune_setup)
 #define AUTOTUNE_RTIOC_KERN_IOW(RTDM_CLASS_AUTOTUNE, 1, struct 
autotune_setup)
 #define AUTOTUNE_RTIOC_USER_IOW(RTDM_CLASS_AUTOTUNE, 2, struct 
autotune_setup)
-#define AUTOTUNE_RTIOC_PULSE   _IOW(RTDM_CLASS_AUTOTUNE, 3, 
nanosecs_abs_t)
-#define AUTOTUNE_RTIOC_RUN _IOR(RTDM_CLASS_AUTOTUNE, 4, unsigned 
long)
+#define AUTOTUNE_RTIOC_PULSE   _IOW(RTDM_CLASS_AUTOTUNE, 3, __u64)
+#define AUTOTUNE_RTIOC_RUN _IOR(RTDM_CLASS_AUTOTUNE, 4, __u32)
 #define AUTOTUNE_RTIOC_RESET   _IO(RTDM_CLASS_AUTOTUNE, 5)
 
 #endif /* !_RTDM_UAPI_AUTOTUNE_H */
diff --git a/kernel/drivers/autotune/autotune.c 
b/kernel/drivers/autotune/autotune.c
index 34ba9d5..79608b3 100644
--- a/kernel/drivers/autotune/autotune.c
+++ b/kernel/drivers/autotune/autotune.c
@@ -675,8 +675,8 @@ static int autotune_ioctl_rt(struct rtdm_fd *fd, unsigned 
int request, void *arg
 {
struct autotune_context *context;
struct gravity_tuner *tuner;
-   nanosecs_abs_t timestamp;
-   unsigned int gravity;
+   __u64 timestamp;
+   __u32 gravity;
int ret;
 
context = rtdm_fd_to_private(fd);
diff --git a/utils/autotune/autotune.c b/utils/autotune/autotune.c
index 5a18310..fe2f621 100644
--- a/utils/autotune/autotune.c
+++ b/utils/autotune/autotune.c
@@ -87,8 +87,8 @@ static const struct option base_options[] = {
 
 static void *sampler_thread(void *arg)
 {
-   nanosecs_abs_t timestamp = 0;
int fd = (long)arg, ret, n = 0;
+   __u64 timestamp = 0;
struct timespec now;
 
for (;;) {
@@ -101,7 +101,7 @@ static void *sampler_thread(void *arg)
} else {
n++;
clock_gettime(CLOCK_MONOTONIC, now);
-   timestamp = (nanosecs_abs_t)now.tv_sec * 10 + 
now.tv_nsec;
+   timestamp = (__u64)now.tv_sec * 10 + 
now.tv_nsec;
}
}
 
@@ -206,8 +206,8 @@ static void usage(void)
 static void run_tuner(int fd, int op, int period, const char *type)
 {
struct autotune_setup setup;
-   unsigned long gravity;
pthread_t sampler;
+   __u32 gravity;
int ret;
 
setup.period = period;
@@ -232,7 +232,7 @@ static void run_tuner(int fd, int op, int period, const 
char *type)
pthread_cancel(sampler);
 
if (!quiet)
-   printf(%lu ns\n, gravity);
+   printf(%u ns\n, gravity);
 }
 
 int main(int argc, char *const argv[])


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://www.xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : cobalt/posix/compat: fix mq_timedreceive() for 32/ 64bit neutrality

2014-10-30 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: d8c9e4ec89151d625acaef8abd926a22d48f6a2a
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=d8c9e4ec89151d625acaef8abd926a22d48f6a2a

Author: Philippe Gerum r...@xenomai.org
Date:   Tue Oct 28 17:02:25 2014 +0100

cobalt/posix/compat: fix mq_timedreceive() for 32/64bit neutrality

---

 kernel/cobalt/posix/mqueue.c|   30 +++---
 kernel/cobalt/posix/mqueue.h|2 +-
 kernel/cobalt/posix/syscall32.c |8 +---
 3 files changed, 21 insertions(+), 19 deletions(-)

diff --git a/kernel/cobalt/posix/mqueue.c b/kernel/cobalt/posix/mqueue.c
index f5a69f9..33d8310 100644
--- a/kernel/cobalt/posix/mqueue.c
+++ b/kernel/cobalt/posix/mqueue.c
@@ -998,7 +998,7 @@ COBALT_SYSCALL(mq_timedsend, primary,
 }
 
 int __cobalt_mq_timedreceive(mqd_t uqd, void __user *u_buf,
-ssize_t __user *u_len,
+ssize_t *lenp,
 unsigned int __user *u_prio,
 const void __user *u_ts,
 int (*fetch_timeout)(struct timespec *ts,
@@ -1007,24 +1007,18 @@ int __cobalt_mq_timedreceive(mqd_t uqd, void __user 
*u_buf,
struct cobalt_mqd *mqd;
struct cobalt_msg *msg;
unsigned int prio;
-   ssize_t len;
int ret;
 
mqd = cobalt_mqd_get(uqd);
if (IS_ERR(mqd))
return PTR_ERR(mqd);
 
-   if (__xn_get_user(len, u_len)) {
+   if (*lenp  0  !access_wok(u_buf, *lenp)) {
ret = -EFAULT;
goto fail;
}
 
-   if (len  0  !access_wok(u_buf, len)) {
-   ret = -EFAULT;
-   goto fail;
-   }
-
-   msg = mq_timedrcv_inner(mqd, len, u_ts, fetch_timeout);
+   msg = mq_timedrcv_inner(mqd, *lenp, u_ts, fetch_timeout);
if (IS_ERR(msg)) {
ret = PTR_ERR(msg);
goto fail;
@@ -1036,7 +1030,7 @@ int __cobalt_mq_timedreceive(mqd_t uqd, void __user 
*u_buf,
goto fail;
}
 
-   len = msg-len;
+   *lenp = msg-len;
prio = msg-prio;
ret = mq_finish_rcv(mqd, msg);
if (ret)
@@ -1044,9 +1038,6 @@ int __cobalt_mq_timedreceive(mqd_t uqd, void __user 
*u_buf,
 
cobalt_mqd_put(mqd);
 
-   if (__xn_put_user(len, u_len))
-   return -EFAULT;
-
if (u_prio  __xn_put_user(prio, u_prio))
return -EFAULT;
 
@@ -1063,8 +1054,17 @@ COBALT_SYSCALL(mq_timedreceive, primary,
 unsigned int __user *u_prio,
 const struct timespec __user *u_ts))
 {
-   return __cobalt_mq_timedreceive(uqd, u_buf, u_len, u_prio,
-   u_ts, u_ts ? mq_fetch_timeout : NULL);
+   ssize_t len;
+   int ret;
+
+   ret = __xn_safe_copy_from_user(len, u_len, sizeof(len));
+   if (ret)
+   return ret;
+
+   ret = __cobalt_mq_timedreceive(uqd, u_buf, len, u_prio,
+  u_ts, u_ts ? mq_fetch_timeout : NULL);
+
+   return ret ?: __xn_safe_copy_to_user(u_len, len, sizeof(*u_len));
 }
 
 int cobalt_mq_pkg_init(void)
diff --git a/kernel/cobalt/posix/mqueue.h b/kernel/cobalt/posix/mqueue.h
index 8bdccd4..8fc42d0 100644
--- a/kernel/cobalt/posix/mqueue.h
+++ b/kernel/cobalt/posix/mqueue.h
@@ -44,7 +44,7 @@ int __cobalt_mq_timedsend(mqd_t uqd, const void __user 
*u_buf, size_t len,
   const void __user *u_ts));
 
 int __cobalt_mq_timedreceive(mqd_t uqd, void __user *u_buf,
-ssize_t __user *u_len,
+ssize_t *lenp,
 unsigned int __user *u_prio,
 const void __user *u_ts,
 int (*fetch_timeout)(struct timespec *ts,
diff --git a/kernel/cobalt/posix/syscall32.c b/kernel/cobalt/posix/syscall32.c
index 3074a3a..e813d21 100644
--- a/kernel/cobalt/posix/syscall32.c
+++ b/kernel/cobalt/posix/syscall32.c
@@ -264,14 +264,16 @@ COBALT_SYSCALL32emu(mq_timedreceive, primary,
ssize_t len;
int ret;
 
-   ret = __cobalt_mq_timedreceive(uqd, u_buf, len, u_prio,
-  u_ts, u_ts ? sys32_fetch_timeout : NULL);
+   ret = __xn_safe_copy_from_user(clen, u_len, sizeof(*u_len));
if (ret)
return ret;
 
+   len = clen;
+   ret = __cobalt_mq_timedreceive(uqd, u_buf, len, u_prio,
+  u_ts, u_ts ? sys32_fetch_timeout : NULL);
clen = len;
 
-   return __xn_safe_copy_to_user(u_len, clen, sizeof(*u_len));
+   return ret ?: __xn_safe_copy_to_user(u_len, clen, sizeof(*u_len));
 }
 
 COBALT_SYSCALL32emu(mq_notify, primary,


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://www.xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : scripts/xeno-config: fix variable quoting

2014-10-30 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: aa78eab89436fc1003465f8aa29894514f11b7eb
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=aa78eab89436fc1003465f8aa29894514f11b7eb

Author: Philippe Gerum r...@xenomai.org
Date:   Fri Oct 17 11:35:22 2014 +0200

scripts/xeno-config: fix variable quoting

---

 scripts/xeno-config-cobalt.in  |2 +-
 scripts/xeno-config-mercury.in |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/scripts/xeno-config-cobalt.in b/scripts/xeno-config-cobalt.in
index 42ee2af..c6c6da5 100644
--- a/scripts/xeno-config-cobalt.in
+++ b/scripts/xeno-config-cobalt.in
@@ -70,7 +70,7 @@ dump_info ()
 version=${XENO_VERSION}
 if test -x $XENO_PREFIX/sbin/version; then
_version=`$XENO_PREFIX/sbin/version 2/dev/null`
-   test x$_version = x || version=$_version
+   test x$_version = x || version=$_version
 fi
 echo Xenomai version: ${version}
 if test -r /proc/ipipe/version; then
diff --git a/scripts/xeno-config-mercury.in b/scripts/xeno-config-mercury.in
index 2ac6fd8..9311f4c 100644
--- a/scripts/xeno-config-mercury.in
+++ b/scripts/xeno-config-mercury.in
@@ -63,7 +63,7 @@ dump_info ()
 version=${XENO_VERSION}
 if test -x $XENO_PREFIX/sbin/version; then
_version=`$XENO_PREFIX/sbin/version 2/dev/null`
-   test x$_version = x || version=$_version
+   test x$_version = x || version=$_version
 fi
 echo Xenomai version: ${version}
 uname -a 2/dev/null || echo Cannot determine system information (uname?)


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://www.xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : cobalt/heap: add xnstrdup()

2014-10-30 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: e7585233e24a089b204230d6f3cc9d4b3a4f3ea1
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=e7585233e24a089b204230d6f3cc9d4b3a4f3ea1

Author: Philippe Gerum r...@xenomai.org
Date:   Mon Oct 27 11:14:11 2014 +0100

cobalt/heap: add xnstrdup()

---

 include/cobalt/kernel/heap.h |   12 
 1 file changed, 12 insertions(+)

diff --git a/include/cobalt/kernel/heap.h b/include/cobalt/kernel/heap.h
index d29778f..916ac8f 100644
--- a/include/cobalt/kernel/heap.h
+++ b/include/cobalt/kernel/heap.h
@@ -19,6 +19,7 @@
 #ifndef _COBALT_KERNEL_HEAP_H
 #define _COBALT_KERNEL_HEAP_H
 
+#include linux/string.h
 #include cobalt/kernel/lock.h
 #include cobalt/kernel/list.h
 #include cobalt/uapi/kernel/types.h
@@ -142,6 +143,17 @@ void xnheap_free(struct xnheap *heap, void *block);
 
 int xnheap_check_block(struct xnheap *heap, void *block);
 
+static inline char *xnstrdup(const char *s)
+{
+   char *p;
+
+   p = xnmalloc(strlen(s) + 1);
+   if (p == NULL)
+   return NULL;
+
+   return strcpy(p, s);
+}
+
 /** @} */
 
 #endif /* !_COBALT_KERNEL_HEAP_H */


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://www.xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : drivers/timerbench: fix 32/64bit neutrality issue

2014-10-30 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: 2baf06308f0756da2c73e476b31171bb23737796
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=2baf06308f0756da2c73e476b31171bb23737796

Author: Philippe Gerum r...@xenomai.org
Date:   Thu Oct 30 10:02:35 2014 +0100

drivers/timerbench: fix 32/64bit neutrality issue

---

 include/cobalt/kernel/rtdm/testing.h |   16 
 kernel/drivers/testing/timerbench.c  |  141 ++
 2 files changed, 108 insertions(+), 49 deletions(-)

diff --git a/include/cobalt/kernel/rtdm/testing.h 
b/include/cobalt/kernel/rtdm/testing.h
index 6a66990..2cf96a2 100644
--- a/include/cobalt/kernel/rtdm/testing.h
+++ b/include/cobalt/kernel/rtdm/testing.h
@@ -22,4 +22,20 @@
 #include rtdm/rtdm.h
 #include rtdm/uapi/testing.h
 
+#ifdef CONFIG_COMPAT
+
+#include rtdm/compat.h
+
+struct compat_rttst_overall_bench_res {
+   struct rttst_bench_res result;
+   compat_uptr_t histogram_avg;
+   compat_uptr_t histogram_min;
+   compat_uptr_t histogram_max;
+};
+
+#define RTTST_RTIOC_TMBENCH_STOP_COMPAT \
+   _IOWR(RTIOC_TYPE_TESTING, 0x11, struct compat_rttst_overall_bench_res)
+
+#endif /* CONFIG_COMPAT */
+
 #endif /* !_COBALT_RTDM_TESTING_H */
diff --git a/kernel/drivers/testing/timerbench.c 
b/kernel/drivers/testing/timerbench.c
index 9dc0e3e..bc4f35d 100644
--- a/kernel/drivers/testing/timerbench.c
+++ b/kernel/drivers/testing/timerbench.c
@@ -315,11 +315,86 @@ static int rt_tmbench_start(struct rtdm_fd *fd,
return err;
 }
 
-static int rt_tmbench_stop(struct rt_tmbench_context *ctx,
-  struct rttst_overall_bench_res __user *user_res)
+static int kernel_copy_results(struct rt_tmbench_context *ctx,
+  struct rttst_overall_bench_res *res)
+{
+   int size;
+
+   memcpy(res-result, ctx-result.overall, sizeof(res-result));
+
+   if (ctx-histogram_size  0) {
+   size = ctx-histogram_size * sizeof(int32_t);
+   memcpy(res-histogram_min, ctx-histogram_min, size);
+   memcpy(res-histogram_max, ctx-histogram_max, size);
+   memcpy(res-histogram_avg, ctx-histogram_avg, size);
+   kfree(ctx-histogram_min);
+   }
+
+   return 0;
+}
+
+static int user_copy_results(struct rt_tmbench_context *ctx,
+struct rttst_overall_bench_res __user *u_res)
 {
struct rtdm_fd *fd = rtdm_private_to_fd(ctx);
-   int err = 0;
+   struct rttst_overall_bench_res res_buf;
+   int ret, size;
+
+   ret = rtdm_safe_copy_to_user(fd, u_res-result,
+ctx-result.overall,
+sizeof(u_res-result));
+   if (ret || ctx-histogram_size == 0)
+   return ret;
+
+   size = ctx-histogram_size * sizeof(int32_t);
+
+   if (rtdm_safe_copy_from_user(fd, res_buf, u_res, sizeof(res_buf))  0 
||
+   rtdm_safe_copy_to_user(fd, res_buf.histogram_min,
+  ctx-histogram_min, size)  0 ||
+   rtdm_safe_copy_to_user(fd, res_buf.histogram_max,
+  ctx-histogram_max, size)  0 ||
+   rtdm_safe_copy_to_user(fd, res_buf.histogram_avg,
+  ctx-histogram_avg, size)  0)
+   return -EFAULT;
+
+   return 0;
+}
+
+#ifdef CONFIG_COMPAT
+
+static int compat_user_copy_results(struct rt_tmbench_context *ctx,
+   struct compat_rttst_overall_bench_res 
__user *u_res)
+{
+   struct compat_rttst_overall_bench_res res_buf;
+   struct rtdm_fd *fd = rtdm_private_to_fd(ctx);
+   int ret, size;
+
+   ret = rtdm_safe_copy_to_user(fd, u_res-result,
+ctx-result.overall,
+sizeof(u_res-result));
+   if (ret || ctx-histogram_size == 0)
+   return ret;
+
+   size = ctx-histogram_size * sizeof(int32_t);
+
+   if (rtdm_safe_copy_from_user(fd, res_buf, u_res, sizeof(res_buf))  0 
||
+   rtdm_safe_copy_to_user(fd, compat_ptr(res_buf.histogram_min),
+  ctx-histogram_min, size)  0 ||
+   rtdm_safe_copy_to_user(fd, compat_ptr(res_buf.histogram_max),
+  ctx-histogram_max, size)  0 ||
+   rtdm_safe_copy_to_user(fd, compat_ptr(res_buf.histogram_avg),
+  ctx-histogram_avg, size)  0)
+   return -EFAULT;
+
+   return 0;
+}
+
+#endif /* CONFIG_COMPAT */
+
+static int rt_tmbench_stop(struct rt_tmbench_context *ctx, void *u_res)
+{
+   struct rtdm_fd *fd = rtdm_private_to_fd(ctx);
+   int ret;
 
down(ctx-nrt_mutex);
 
@@ -342,54 +417,22 @@ static int rt_tmbench_stop(struct rt_tmbench_context *ctx,
   ((ctx-result.overall.test_loops)  1 ?
ctx-result.overall.test_loops : 2) - 1);
 
-   if (rtdm_fd_is_user(fd))
- 

[Xenomai-git] Philippe Gerum : cobalt/arm: disable 32bit syscall emulation

2014-10-30 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: 50a49b55e854be62411871e5950401f0f7261a8b
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=50a49b55e854be62411871e5950401f0f7261a8b

Author: Philippe Gerum r...@xenomai.org
Date:   Thu Oct 16 14:22:01 2014 +0200

cobalt/arm: disable 32bit syscall emulation

---

 kernel/cobalt/arch/arm/Kconfig   |3 +++
 kernel/cobalt/arch/arm/syscall.c |5 +
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/kernel/cobalt/arch/arm/Kconfig b/kernel/cobalt/arch/arm/Kconfig
index 03826de..dc6485d 100644
--- a/kernel/cobalt/arch/arm/Kconfig
+++ b/kernel/cobalt/arch/arm/Kconfig
@@ -32,6 +32,9 @@ config XENO_ARCH_WANT_TIP
 config XENO_ARCH_FPU
def_bool VFP
 
+config XENO_ARCH_SYS3264
+def_bool n
+
 config XENO_ARCH_OUTOFLINE_XNLOCK
bool
default y
diff --git a/kernel/cobalt/arch/arm/syscall.c b/kernel/cobalt/arch/arm/syscall.c
index 8e9c801..735208b 100644
--- a/kernel/cobalt/arch/arm/syscall.c
+++ b/kernel/cobalt/arch/arm/syscall.c
@@ -49,8 +49,5 @@ int xnarch_local_syscall(unsigned long a1, unsigned long a2,
break;
}
 
-   if (__xn_copy_to_user((void *)a2, info, sizeof(info)))
-   return -EFAULT;
-
-   return 0;
+   return __xn_safe_copy_to_user((void *)a2, info, sizeof(info));
 }


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://www.xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : smokey/sched-quota: force affinity on the test CPU

2014-10-30 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: a0d78580975974b94795e3a29b0a1704d7b7f785
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=a0d78580975974b94795e3a29b0a1704d7b7f785

Author: Philippe Gerum r...@xenomai.org
Date:   Mon Oct 27 08:58:15 2014 +0100

smokey/sched-quota: force affinity on the test CPU

---

 testsuite/smokey/sched-quota/sched-quota.c |7 +++
 1 file changed, 7 insertions(+)

diff --git a/testsuite/smokey/sched-quota/sched-quota.c 
b/testsuite/smokey/sched-quota/sched-quota.c
index e8f4347..da1c471 100644
--- a/testsuite/smokey/sched-quota/sched-quota.c
+++ b/testsuite/smokey/sched-quota/sched-quota.c
@@ -270,8 +270,15 @@ static int run_sched_quota(struct smokey_test *t, int 
argc, char *const argv[])
pthread_t me = pthread_self();
struct sched_param param;
int ret, quota = 0;
+   cpu_set_t affinity;
double effective;
 
+   CPU_ZERO(affinity);
+   CPU_SET(0, affinity);
+   ret = sched_setaffinity(0, sizeof(affinity), affinity);
+   if (ret)
+   error(1, errno, sched_setaffinity);
+
smokey_parse_args(t, argc, argv);
pthread_mutex_init(lock, NULL);
pthread_cond_init(barrier, NULL);


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://www.xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : cobalt/sched/procfs: prevent frequent overflow of timeout display

2014-10-30 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: 0a465a2a83d5ec19e524807f906e85296cfb7855
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=0a465a2a83d5ec19e524807f906e85296cfb7855

Author: Philippe Gerum r...@xenomai.org
Date:   Thu Oct 30 11:29:42 2014 +0100

cobalt/sched/procfs: prevent frequent overflow of timeout display

---

 kernel/cobalt/sched.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/cobalt/sched.c b/kernel/cobalt/sched.c
index 7cc5770..2c4c237 100644
--- a/kernel/cobalt/sched.c
+++ b/kernel/cobalt/sched.c
@@ -999,7 +999,7 @@ static int vfile_schedlist_show(struct 
xnvfile_snapshot_iterator *it,
 
if (p == NULL)
xnvfile_printf(it,
-  %-3s  %-6s %-5s  %-8s  %-5s %-8s  %-10s %s\n,
+  %-3s  %-6s %-5s  %-8s  %-5s %-12s  %-10s %s\n,
   CPU, PID, CLASS, TYPE, PRI, TIMEOUT,
   STAT, NAME);
else {
@@ -1008,7 +1008,7 @@ static int vfile_schedlist_show(struct 
xnvfile_snapshot_iterator *it,
xnthread_format_status(p-state, sbuf, sizeof(sbuf));
 
xnvfile_printf(it,
-  %3u  %-6d %-5s  %-8s  %-5s %-8s  %-10s 
%s%s%s\n,
+  %3u  %-6d %-5s  %-8s  %-5s %-12s  %-10s 
%s%s%s\n,
   p-cpu,
   p-pid,
   p-sched_class,


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://www.xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Gilles Chanteperdrix : cobalt/x86: fix AVX/SSE2 test code

2014-10-30 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: 13a1bf515b25ce6e3a5499c800d50032c4679b96
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=13a1bf515b25ce6e3a5499c800d50032c4679b96

Author: Gilles Chanteperdrix gilles.chanteperd...@xenomai.org
Date:   Sun Oct 12 11:51:57 2014 +0200

cobalt/x86: fix AVX/SSE2 test code

---

 kernel/cobalt/arch/x86/include/asm/xenomai/uapi/fptest.h |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/cobalt/arch/x86/include/asm/xenomai/uapi/fptest.h 
b/kernel/cobalt/arch/x86/include/asm/xenomai/uapi/fptest.h
index d6a9a68..d406cc3 100644
--- a/kernel/cobalt/arch/x86/include/asm/xenomai/uapi/fptest.h
+++ b/kernel/cobalt/arch/x86/include/asm/xenomai/uapi/fptest.h
@@ -39,7 +39,7 @@ static inline void fp_regs_set(int features, unsigned int val)
vmovupd %0,%%ymm5;
vmovupd %0,%%ymm6;
vmovupd %0,%%ymm7;
-   : : m (vec[0]));
+   : : m(vec[0]), m(vec[1]), m(vec[2]), m(vec[3]));
} else if (features  __COBALT_HAVE_SSE2) {
__asm__ __volatile__(
movupd %0,%%xmm0;
@@ -50,7 +50,7 @@ static inline void fp_regs_set(int features, unsigned int val)
movupd %0,%%xmm5;
movupd %0,%%xmm6;
movupd %0,%%xmm7;
-   : : m (vec[0]));
+   : : m(vec[0]), m(vec[1]), m(vec[2]), m(vec[3]));
}
 }
 


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://www.xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : smokey/sched-tp: force affinity on the test CPU

2014-10-30 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: b32d11169db844a7770a599b73d66145af069e2f
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=b32d11169db844a7770a599b73d66145af069e2f

Author: Philippe Gerum r...@xenomai.org
Date:   Mon Oct 27 08:57:27 2014 +0100

smokey/sched-tp: force affinity on the test CPU

---

 testsuite/smokey/sched-tp/sched-tp.c |7 +++
 1 file changed, 7 insertions(+)

diff --git a/testsuite/smokey/sched-tp/sched-tp.c 
b/testsuite/smokey/sched-tp/sched-tp.c
index ee6a07f..b946c85 100644
--- a/testsuite/smokey/sched-tp/sched-tp.c
+++ b/testsuite/smokey/sched-tp/sched-tp.c
@@ -37,8 +37,15 @@ static void *thread_body(void *arg)
pthread_t me = pthread_self();
struct sched_param_ex param;
struct timespec ts;
+   cpu_set_t affinity;
int ret, part;
 
+   CPU_ZERO(affinity);
+   CPU_SET(0, affinity);
+   ret = sched_setaffinity(0, sizeof(affinity), affinity);
+   if (ret)
+   error(1, errno, sched_setaffinity);
+
part = (int)(long)arg;
param.sched_priority = 50 - part;
param.sched_tp_partition = part;


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://www.xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : cobalt/posix/nsem: allow path lengths up to PATH_MAX

2014-10-30 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: 68cdffd721f751f2cf08123791d75d27cd7bc880
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=68cdffd721f751f2cf08123791d75d27cd7bc880

Author: Philippe Gerum r...@xenomai.org
Date:   Mon Oct 27 10:09:35 2014 +0100

cobalt/posix/nsem: allow path lengths up to PATH_MAX

As a consequence of this change, open/close/unlink ops move to low
stage handling.

---

 kernel/cobalt/posix/nsem.c  |   40 ++-
 kernel/cobalt/posix/sem.c   |   14 ++
 kernel/cobalt/posix/sem.h   |1 -
 kernel/cobalt/posix/syscall.c   |6 +++---
 kernel/cobalt/posix/syscall32.c |2 +-
 5 files changed, 33 insertions(+), 30 deletions(-)

diff --git a/kernel/cobalt/posix/nsem.c b/kernel/cobalt/posix/nsem.c
index af0cd49..e0472f7 100644
--- a/kernel/cobalt/posix/nsem.c
+++ b/kernel/cobalt/posix/nsem.c
@@ -33,6 +33,7 @@ struct named_sem {
struct cobalt_sem_shadow __user *usem;
unsigned int refs;
struct xnid id;
+   struct filename *filename;
 };
 
 static struct named_sem *sem_search(struct cobalt_process *cc, xnhandle_t 
handle)
@@ -48,11 +49,12 @@ static struct named_sem *sem_search(struct cobalt_process 
*cc, xnhandle_t handle
 
 static struct cobalt_sem_shadow __user *
 sem_open(struct cobalt_process *cc, struct cobalt_sem_shadow __user *ushadow,
-const char *name, int oflags, mode_t mode, unsigned int value)
+struct filename *filename, int oflags, mode_t mode, unsigned int value)
 {
+   const char *name = filename-name;
struct cobalt_sem_shadow shadow;
-   struct cobalt_sem *sem;
struct named_sem *u, *v;
+   struct cobalt_sem *sem;
xnhandle_t handle;
spl_t s;
int rc;
@@ -126,6 +128,7 @@ sem_open(struct cobalt_process *cc, struct 
cobalt_sem_shadow __user *ushadow,
u-sem = sem;
u-usem = ushadow;
u-refs = 1;
+   u-filename = filename;
 
xnlock_get_irqsave(named_sem_lock, s);
v = sem_search(cc, handle);
@@ -136,6 +139,7 @@ sem_open(struct cobalt_process *cc, struct 
cobalt_sem_shadow __user *ushadow,
--sem-refs;
xnlock_put_irqrestore(nklock, s);
 
+   putname(filename);
xnfree(u);
u = v;
} else {
@@ -171,6 +175,7 @@ static int sem_close(struct cobalt_process *cc, xnhandle_t 
handle)
 
__cobalt_sem_destroy(handle);
 
+   putname(u-filename);
xnfree(u);
return 1;
 
@@ -201,16 +206,17 @@ __cobalt_sem_open(struct cobalt_sem_shadow __user *usm,
if (IS_ERR(filename))
return ERR_CAST(filename);
 
-   usm = sem_open(cc, usm, filename-name, oflags, mode, value);
-   if (IS_ERR(usm))
+   usm = sem_open(cc, usm, filename, oflags, mode, value);
+   if (IS_ERR(usm)) {
trace_cobalt_psem_open_failed(filename-name, oflags, mode,
  value, PTR_ERR(usm));
-   putname(filename);
+   putname(filename);
+   }
 
return usm;
 }
 
-COBALT_SYSCALL(sem_open, current,
+COBALT_SYSCALL(sem_open, lostage,
   int, (struct cobalt_sem_shadow __user *__user *u_addrp,
 const char __user *u_name,
 int oflags, mode_t mode, unsigned int value))
@@ -227,7 +233,7 @@ COBALT_SYSCALL(sem_open, current,
return __xn_put_user(usm, u_addrp) ? -EFAULT : 0;
 }
 
-COBALT_SYSCALL(sem_close, current,
+COBALT_SYSCALL(sem_close, lostage,
   int, (struct cobalt_sem_shadow __user *usm))
 {
struct cobalt_process *cc;
@@ -260,21 +266,21 @@ static inline int sem_unlink(const char *name)
return 0;
 }
 
-COBALT_SYSCALL(sem_unlink, current,
+COBALT_SYSCALL(sem_unlink, lostage,
   int, (const char __user *u_name))
 {
-   char name[COBALT_MAXNAME + 1];
-   long len;
+   struct filename *filename;
+   int ret;
 
-   len = __xn_safe_strncpy_from_user(name, u_name, sizeof(name));
-   if (len  0)
-   return len;
-   if (len = sizeof(name))
-   return -ENAMETOOLONG;
+   filename = getname(u_name);
+   if (IS_ERR(filename))
+   return PTR_ERR(filename);
 
-   trace_cobalt_psem_unlink(name);
+   trace_cobalt_psem_unlink(filename-name);
+   ret = sem_unlink(filename-name);
+   putname(filename);
 
-   return sem_unlink(name);
+   return ret;
 }
 
 static void cleanup_named_sems(void *cookie, struct xnid *i)
diff --git a/kernel/cobalt/posix/sem.c b/kernel/cobalt/posix/sem.c
index 3555ab8..fb9f391 100644
--- a/kernel/cobalt/posix/sem.c
+++ b/kernel/cobalt/posix/sem.c
@@ -89,8 +89,6 @@ __cobalt_sem_init(const char *name, struct cobalt_sem_shadow 
*sm,
goto out;
}
 
-   ksformat(sem-name, sizeof(sem-name), %s, name);
-
sys_ppd = cobalt_ppd_get(!!(flags  SEM_PSHARED));
state = 

[Xenomai-git] Jorge Ramirez-Ortiz : drivers/analogy: disable chanlist check on calibration instructions

2014-10-30 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: c39b74040ab085a03ec9078baffecab7bed758d1
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=c39b74040ab085a03ec9078baffecab7bed758d1

Author: Jorge Ramirez-Ortiz j...@xenomai.org
Date:   Wed Aug 20 15:58:07 2014 -0400

drivers/analogy: disable chanlist check on calibration instructions

---

 kernel/drivers/analogy/instruction.c |   10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/kernel/drivers/analogy/instruction.c 
b/kernel/drivers/analogy/instruction.c
index 95c4419..7e7704f 100644
--- a/kernel/drivers/analogy/instruction.c
+++ b/kernel/drivers/analogy/instruction.c
@@ -228,10 +228,12 @@ int a4l_do_insn(struct a4l_device_context * cxt, struct 
a4l_kernel_instruction *
}
 
/* Checks the channel descriptor */
-   ret = a4l_check_chanlist(dev-transfer.subds[dsc-idx_subd],
-1, dsc-chan_desc);
-   if (ret  0)
-   return ret;
+   if ((subd-flags  A4L_SUBD_TYPES) != A4L_SUBD_CALIB) {
+   ret = a4l_check_chanlist(dev-transfer.subds[dsc-idx_subd],
+1, dsc-chan_desc);
+   if (ret  0)
+   return ret;
+   }
 
/* Choose the proper handler, we can check the pointer because
   the subdevice was memset to 0 at allocation time */


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://www.xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Jorge Ramirez-Ortiz : lib/analogy: calibration - a4l_rawtodcal a4l_dcaltoraw

2014-10-30 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: 029424c470f6697dca77b9e693a8669d66474d54
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=029424c470f6697dca77b9e693a8669d66474d54

Author: Jorge Ramirez-Ortiz j...@xenomai.org
Date:   Fri Oct 24 08:59:31 2014 -0400

lib/analogy: calibration - a4l_rawtodcal  a4l_dcaltoraw

---

 include/rtdm/analogy.h  |9 ++
 include/rtdm/uapi/analogy.h |6 ++
 lib/analogy/calibration.c   |  237 ++-
 lib/analogy/math.c  |8 +-
 utils/analogy/Makefile.am   |2 +-
 5 files changed, 252 insertions(+), 10 deletions(-)

diff --git a/include/rtdm/analogy.h b/include/rtdm/analogy.h
index a87ce54..066d05a 100644
--- a/include/rtdm/analogy.h
+++ b/include/rtdm/analogy.h
@@ -232,6 +232,15 @@ int a4l_dtoraw(a4l_chinfo_t *chan,
 
 int a4l_read_calibration_file(char *name, struct a4l_calibration_data *data);
 
+int a4l_get_softcal_converter(struct a4l_polynomial *converter,
+ int subd, int chan, int range,
+ struct a4l_calibration_data *data );
+
+int a4l_rawtodcal(a4l_chinfo_t *chan, double *dst, void *src,
+ int cnt, struct a4l_polynomial *converter);
+int a4l_dcaltoraw(a4l_chinfo_t * chan, void *dst, double *src, int cnt,
+ struct a4l_polynomial *converter);
+
 int a4l_math_polyfit(unsigned order, double *r,double orig,
 const unsigned dim, double *x, double *y);
 
diff --git a/include/rtdm/uapi/analogy.h b/include/rtdm/uapi/analogy.h
index a0a1e59..2d53168 100644
--- a/include/rtdm/uapi/analogy.h
+++ b/include/rtdm/uapi/analogy.h
@@ -732,6 +732,12 @@ struct a4l_calibration_data {
struct a4l_calibration_subdev_data *ao;
 };
 
+struct a4l_polynomial {
+   int expansion;
+   int order;
+   int nb_coeff;
+   double *coeff;
+};
 
 
 #endif /* _RTDM_UAPI_ANALOGY_H */
diff --git a/lib/analogy/calibration.c b/lib/analogy/calibration.c
index dcec16d..9fd944c 100644
--- a/lib/analogy/calibration.c
+++ b/lib/analogy/calibration.c
@@ -20,6 +20,7 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.
  */
 
+#include math.h
 #include rtdm/analogy.h
 #include stdio.h
 #include errno.h
@@ -28,8 +29,39 @@
 #include boilerplate/list.h
 #include calibration.h
 
+
 #define ARRAY_LEN(a)  (sizeof(a) / sizeof((a)[0]))
 
+static lsampl_t data32_get(void *src)
+{
+   return (lsampl_t) * ((lsampl_t *) (src));
+}
+
+static lsampl_t data16_get(void *src)
+{
+   return (lsampl_t) * ((sampl_t *) (src));
+}
+
+static lsampl_t data8_get(void *src)
+{
+   return (lsampl_t) * ((unsigned char *)(src));
+}
+
+static void data32_set(void *dst, lsampl_t val)
+{
+   *((lsampl_t *) (dst)) = val;
+}
+
+static void data16_set(void *dst, lsampl_t val)
+{
+   *((sampl_t *) (dst)) = (sampl_t) (0x  val);
+}
+
+static void data8_set(void *dst, lsampl_t val)
+{
+   *((unsigned char *)(dst)) = (unsigned char)(0xff  val);
+}
+
 static inline int read_dbl(double *d, struct _dictionary_ *f,const char *subd,
   int subd_idx, char *type, int type_idx)
 {
@@ -73,7 +105,7 @@ static inline int read_int(int *val, struct _dictionary_ *f, 
const char *subd,
 }
 
 static inline int read_str(char **val, struct _dictionary_ *f, const char 
*subd,
-  const char *type)
+  const char *type)
 {
char *str;
int ret;
@@ -105,7 +137,7 @@ static inline void write_calibration(FILE *file, char *fmt, 
...)
 
 void
 write_calibration_file(FILE *dst, struct list *l,
-  struct a4l_calibration_subdev *subd, a4l_desc_t *desc)
+  struct a4l_calibration_subdev *subd, a4l_desc_t *desc)
 {
struct subdevice_calibration_node *e, *t;
int i, j = 0;
@@ -205,7 +237,7 @@ int a4l_read_calibration_file(char *name, struct 
a4l_calibration_data *data)
if (strncmp(subdevice[k], AI_SUBD_STR,
strlen(AI_SUBD_STR)) == 0) {
data-ai = malloc(nb_elements *
-  sizeof(struct a4l_calibration_subdev_data));
+ sizeof(struct 
a4l_calibration_subdev_data));
data-nb_ai = nb_elements;
p  = data-ai;
}
@@ -213,7 +245,7 @@ int a4l_read_calibration_file(char *name, struct 
a4l_calibration_data *data)
if (strncmp(subdevice[k], AO_SUBD_STR,
strlen(AO_SUBD_STR)) == 0) {
data-ao = malloc(nb_elements *
-  sizeof(struct a4l_calibration_subdev_data));
+ sizeof(struct 
a4l_calibration_subdev_data));
data-nb_ao = nb_elements;
p = data-ao;
}
@@ -232,7 +264,7 @@ int a4l_read_calibration_file(char *name, struct 

[Xenomai-git] Philippe Gerum : cobalt/nios2: disable 32bit syscall emulation

2014-10-30 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: a12f2af328a6d6c540f5b72c84f22b705d1f445c
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=a12f2af328a6d6c540f5b72c84f22b705d1f445c

Author: Philippe Gerum r...@xenomai.org
Date:   Thu Oct 16 14:22:33 2014 +0200

cobalt/nios2: disable 32bit syscall emulation

---

 kernel/cobalt/arch/nios2/Kconfig |3 +++
 1 file changed, 3 insertions(+)

diff --git a/kernel/cobalt/arch/nios2/Kconfig b/kernel/cobalt/arch/nios2/Kconfig
index 9f19382..1ca0278 100644
--- a/kernel/cobalt/arch/nios2/Kconfig
+++ b/kernel/cobalt/arch/nios2/Kconfig
@@ -1,5 +1,8 @@
 config XENO_ARCH_FPU
def_bool n
 
+config XENO_ARCH_SYS3264
+def_bool n
+
 source kernel/xenomai/Kconfig
 source drivers/xenomai/Kconfig


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://www.xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Jorge Ramirez-Ortiz : utils/analogy: calibration - generating the calibration file is not a user API

2014-10-30 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: e3c818fee687fcf07c448c462cbba5ce29100e0b
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=e3c818fee687fcf07c448c462cbba5ce29100e0b

Author: Jorge Ramirez-Ortiz j...@xenomai.org
Date:   Tue Oct 14 21:53:25 2014 -0400

utils/analogy: calibration - generating the calibration file is not a user API

---

 include/rtdm/analogy.h|4 --
 lib/analogy/calibration.c |  103 +
 lib/analogy/calibration.h |3 ++
 lib/analogy/math.c|   51 +-
 utils/analogy/analogy_calibrate.c |6 +++
 utils/analogy/calibration_ni_m.c  |   15 +++---
 6 files changed, 125 insertions(+), 57 deletions(-)

diff --git a/include/rtdm/analogy.h b/include/rtdm/analogy.h
index c03d2b1..a87ce54 100644
--- a/include/rtdm/analogy.h
+++ b/include/rtdm/analogy.h
@@ -230,10 +230,6 @@ int a4l_ftoraw(a4l_chinfo_t *chan,
 int a4l_dtoraw(a4l_chinfo_t *chan,
   a4l_rnginfo_t *rng, void *dst, double *src, int cnt);
 
-void a4l_write_calibration_file(FILE *dst, struct list *l,
-   struct a4l_calibration_subdev *subd,
-   a4l_desc_t *desc);
-
 int a4l_read_calibration_file(char *name, struct a4l_calibration_data *data);
 
 int a4l_math_polyfit(unsigned order, double *r,double orig,
diff --git a/lib/analogy/calibration.c b/lib/analogy/calibration.c
index 85860d1..dcec16d 100644
--- a/lib/analogy/calibration.c
+++ b/lib/analogy/calibration.c
@@ -103,6 +103,64 @@ static inline void write_calibration(FILE *file, char 
*fmt, ...)
va_end(ap);
 }
 
+void
+write_calibration_file(FILE *dst, struct list *l,
+  struct a4l_calibration_subdev *subd, a4l_desc_t *desc)
+{
+   struct subdevice_calibration_node *e, *t;
+   int i, j = 0;
+
+   if (list_empty(l))
+   return;
+
+   /* TODO: modify the meaning of board/driver in the proc */
+   if (desc) {
+   write_calibration(dst, [%s] \n,PLATFORM_STR);
+   write_calibration(dst, DRIVER_STR = %s;\n, desc-board_name);
+   write_calibration(dst, BOARD_STR = %s;\n, desc-driver_name);
+   }
+
+   write_calibration(dst, \n[%s] \n, subd-name);
+   write_calibration(dst, INDEX_STR = %d;\n, subd-idx);
+   list_for_each_entry_safe(e, t, l, node) {
+   j++;
+   }
+   write_calibration(dst, ELEMENTS_STR = %d;\n, j);
+
+   j = 0;
+   list_for_each_entry_safe(e, t, l, node) {
+   write_calibration(dst, [%s_%d] \n, subd-name, j);
+   write_calibration(dst, CHANNEL_STR = %d;\n, e-channel);
+   write_calibration(dst, RANGE_STR = %d;\n, e-range);
+   write_calibration(dst, EXPANSION_STR = %g;\n,
+ e-polynomial-expansion_origin);
+   write_calibration(dst, NBCOEFF_STR= %d;\n,
+ e-polynomial-nb_coefficients);
+
+   for (i = 0; i  e-polynomial-nb_coefficients; i++)
+   write_calibration(dst, COEFF_STR_%d = %g;\n,
+ i,
+ e-polynomial-coefficients[i]);
+   j++;
+   }
+
+   return;
+}
+
+/*!
+ * @ingroup analogy_lib_level2
+ * @defgroup analogy_lib_calibration Software calibration API
+ * @{
+ */
+
+/**
+ * @brief Read the analogy generated calibration file
+ *
+ * @param[in] name Name of the calibration file
+ * @param[out] data Pointer to the calibration file contents
+ *
+ */
+
 int a4l_read_calibration_file(char *name, struct a4l_calibration_data *data)
 {
const char *subdevice[2] = { AI_SUBD_STR, AO_SUBD_STR };
@@ -186,48 +244,5 @@ int a4l_read_calibration_file(char *name, struct 
a4l_calibration_data *data)
return 0;
 }
 
-void a4l_write_calibration_file(FILE *dst, struct list *l,
-   struct a4l_calibration_subdev *subd,
-   a4l_desc_t *desc)
-{
-   struct subdevice_calibration_node *e, *t;
-   int i, j = 0;
-
-   if (list_empty(l))
-   return;
-
-   /* TODO: modify the meaning of board/driver in the proc */
-   if (desc) {
-   write_calibration(dst, [%s] \n,PLATFORM_STR);
-   write_calibration(dst, DRIVER_STR = %s;\n, desc-board_name);
-   write_calibration(dst, BOARD_STR = %s;\n, desc-driver_name);
-   }
-
-   write_calibration(dst, \n[%s] \n, subd-name);
-   write_calibration(dst, INDEX_STR = %d;\n, subd-idx);
-   list_for_each_entry_safe(e, t, l, node) {
-   j++;
-   }
-   write_calibration(dst, ELEMENTS_STR = %d;\n, j);
-
-   j = 0;
-   list_for_each_entry_safe(e, t, l, node) {
-   write_calibration(dst, [%s_%d] \n, subd-name, j);
-   write_calibration(dst, CHANNEL_STR = %d;\n, e-channel);
-   write_calibration(dst, 

[Xenomai-git] Philippe Gerum : cobalt/powerpc: disable 32bit syscall emulation

2014-10-30 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: d6df3c655e6345e3c4d26efa53ed0b4857acfa09
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=d6df3c655e6345e3c4d26efa53ed0b4857acfa09

Author: Philippe Gerum r...@xenomai.org
Date:   Thu Oct 16 14:22:18 2014 +0200

cobalt/powerpc: disable 32bit syscall emulation

---

 kernel/cobalt/arch/powerpc/Kconfig |3 +++
 1 file changed, 3 insertions(+)

diff --git a/kernel/cobalt/arch/powerpc/Kconfig 
b/kernel/cobalt/arch/powerpc/Kconfig
index bc519a5..ef49798 100644
--- a/kernel/cobalt/arch/powerpc/Kconfig
+++ b/kernel/cobalt/arch/powerpc/Kconfig
@@ -20,6 +20,9 @@ config XENO_ARCH_WANT_TIP
 config XENO_ARCH_FPU
def_bool PPC_FPU
 
+config XENO_ARCH_SYS3264
+def_bool n
+
 menu Machine/platform-specific options
 
 config XENO_ARCH_UNLOCKED_SWITCH


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://www.xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : lib/cobalt: fix ioctl() prototype

2014-10-30 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: d5af062a1755f83e09cf380e8f4cac7cef5cdde0
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=d5af062a1755f83e09cf380e8f4cac7cef5cdde0

Author: Philippe Gerum r...@xenomai.org
Date:   Thu Oct 30 15:32:16 2014 +0100

lib/cobalt: fix ioctl() prototype

---

 include/cobalt/sys/ioctl.h |2 +-
 lib/cobalt/rtdm.c  |4 ++--
 lib/cobalt/wrappers.c  |2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/include/cobalt/sys/ioctl.h b/include/cobalt/sys/ioctl.h
index 00c9735..553aa56 100644
--- a/include/cobalt/sys/ioctl.h
+++ b/include/cobalt/sys/ioctl.h
@@ -27,7 +27,7 @@
 extern C {
 #endif
 
-COBALT_DECL(int, ioctl(int fildes, unsigned long int request, ...));
+COBALT_DECL(int, ioctl(int fildes, unsigned int request, ...));
 
 #ifdef __cplusplus
 }
diff --git a/lib/cobalt/rtdm.c b/lib/cobalt/rtdm.c
index 26c271a..4e1e24e 100644
--- a/lib/cobalt/rtdm.c
+++ b/lib/cobalt/rtdm.c
@@ -98,7 +98,7 @@ COBALT_IMPL(int, close, (int fd))
return __STD(close(fd));
 }
 
-static int do_ioctl(int fd, unsigned long request, void *arg)
+static int do_ioctl(int fd, unsigned int request, void *arg)
 {
int ret, oldtype;
 
@@ -129,7 +129,7 @@ COBALT_IMPL(int, fcntl, (int fd, int cmd, ...))
return __STD(fcntl(fd, cmd, arg));
 }
 
-COBALT_IMPL(int, ioctl, (int fd, unsigned long int request, ...))
+COBALT_IMPL(int, ioctl, (int fd, unsigned int request, ...))
 {
va_list ap;
void *arg;
diff --git a/lib/cobalt/wrappers.c b/lib/cobalt/wrappers.c
index 30522a4..106b466 100644
--- a/lib/cobalt/wrappers.c
+++ b/lib/cobalt/wrappers.c
@@ -183,7 +183,7 @@ int __real_fcntl(int fd, int cmd, ...)
 }
 
 __weak
-int __real_ioctl(int fd, unsigned long int request, ...)
+int __real_ioctl(int fd, unsigned int request, ...)
 {
va_list ap;
void *arg;


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://www.xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Jorge Ramirez-Ortiz : utils/analogy: calibration - implement calibrated insn_read

2014-10-30 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: 54b8e8c46a1feb0b07cacbc255f63955868cd006
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=54b8e8c46a1feb0b07cacbc255f63955868cd006

Author: Jorge Ramirez-Ortiz j...@xenomai.org
Date:   Fri Oct 24 09:01:09 2014 -0400

utils/analogy: calibration - implement calibrated insn_read

---

 utils/analogy/insn_read.c |   85 +++--
 1 file changed, 82 insertions(+), 3 deletions(-)

diff --git a/utils/analogy/insn_read.c b/utils/analogy/insn_read.c
index 842bddb..3592aac 100644
--- a/utils/analogy/insn_read.c
+++ b/utils/analogy/insn_read.c
@@ -39,6 +39,7 @@ static int idx_subd = -1;
 static int idx_chan;
 static int idx_rng = -1;
 static unsigned int scan_size = SCAN_CNT;
+static char *calibration_file = NULL;
 
 struct option insn_read_opts[] = {
{verbose, no_argument, NULL, 'v'},
@@ -47,6 +48,7 @@ struct option insn_read_opts[] = {
{scan-count, required_argument, NULL, 'S'},
{channel, required_argument, NULL, 'c'},
{range, required_argument, NULL, 'R'},
+   {cal, required_argument, NULL, 'y'},
{raw, no_argument, NULL, 'w'},
{help, no_argument, NULL, 'h'},
{0},
@@ -63,6 +65,7 @@ static void do_print_usage(void)
fprintf(stdout, \t\t -c, --channel: channel to use\n);
fprintf(stdout, \t\t -R, --range: range to use\n);
fprintf(stdout, \t\t -w, --raw: dump data in raw format\n);
+   fprintf(stdout, \t\t -y, --cal: /path/to/calibration.bin \n);
fprintf(stdout, \t\t -h, --help: print this help\n);
 }
 
@@ -118,9 +121,8 @@ static int dump_text(a4l_desc_t *dsc, unsigned char *buf, 
int size)
if (err  0)
goto out;
 
-   for (i = 0; i  tmp_cnt; i++) {
+   for (i = 0; i  tmp_cnt; i++)
fprintf(stdout, fmt, values[i]);
-   }
 
tmp_size += tmp_cnt * width;
}
@@ -162,6 +164,7 @@ static int dump_converted(a4l_desc_t *dsc, unsigned char 
*buf, int size)
goto out;
}
 
+   fprintf(stdout, Non Calibrated values: \n);
while (size - tmp_size  0) {
double values[64];
int i, tmp_cnt = ((size - tmp_size) / width  64) ?
@@ -182,6 +185,78 @@ out:
return err;
 }
 
+static int dump_calibrated(a4l_desc_t *dsc, unsigned char *buf, int size)
+{
+   struct a4l_calibration_data cal_info;
+   struct a4l_polynomial converter;
+   int err = 0, width, tmp_size = 0;
+   a4l_chinfo_t *chan;
+   a4l_rnginfo_t *rng;
+
+
+   /* Retrieve the channel info */
+   err = a4l_get_chinfo(dsc, idx_subd, idx_chan, chan);
+   if (err  0) {
+   fprintf(stderr,
+   insn_read: info for channel %d 
+   on subdevice %d not available (err=%d)\n,
+   idx_chan, idx_subd, err);
+   goto out;
+   }
+
+   /* Retrieve the range info */
+   err = a4l_get_rnginfo(dsc, idx_subd, idx_chan, idx_rng, rng);
+   if (err  0) {
+   fprintf(stderr,
+   insn_read: failed to recover range descriptor\n);
+   goto out;
+   }
+
+   width = a4l_sizeof_chan(chan);
+   if (width  0) {
+   fprintf(stderr,
+   insn_read: incoherent info for channel %d\n,
+   idx_chan);
+   err = width;
+   goto out;
+   }
+
+   err = a4l_read_calibration_file(calibration_file, cal_info);
+   if (err  0) {
+   fprintf(stderr,
+   insn_read: failed to read /tmp/calibration.txt \n);
+   goto out;
+   }
+
+   err = a4l_get_softcal_converter(converter, idx_subd, idx_chan, idx_rng,
+   cal_info);
+   if (err  0) {
+   fprintf(stderr,
+   insn_read: failed to get the softcal converter  \n);
+   goto out;
+   }
+
+   fprintf(stdout, Calibrated values: \n);
+   while (size - tmp_size  0) {
+   double values[64];
+   int i, tmp_cnt = ((size - tmp_size) / width  64) ?
+   64 : ((size - tmp_size) / width);
+
+   err = a4l_rawtodcal(chan, values, buf + tmp_size, tmp_cnt,
+   converter);
+   if (err  0)
+   goto out;
+
+   for (i = 0; i  tmp_cnt; i++)
+   fprintf(stdout, %F\n, values[i]);
+
+   tmp_size += tmp_cnt * width;
+   }
+
+out:
+   return err;
+}
+
 int main(int argc, char *argv[])
 {
int err = 0;
@@ -196,7 +271,7 @@ int main(int argc, char *argv[])
/* Compute arguments */
while ((err = getopt_long(argc,
  argv,
- vrd:s:S:c:R:wh, insn_read_opts,
+ 

[Xenomai-git] Philippe Gerum : testsuite/smokey: xddp: fix race on connection setup

2014-10-30 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: ef7bee345533718c31ecfd63f3ffdf1fc26d3d3e
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=ef7bee345533718c31ecfd63f3ffdf1fc26d3d3e

Author: Philippe Gerum r...@xenomai.org
Date:   Fri Oct 17 17:43:52 2014 +0200

testsuite/smokey: xddp: fix race on connection setup

---

 testsuite/smokey/xddp/xddp.c |   22 ++
 1 file changed, 22 insertions(+)

diff --git a/testsuite/smokey/xddp/xddp.c b/testsuite/smokey/xddp/xddp.c
index e447fab..6dca6e6 100644
--- a/testsuite/smokey/xddp/xddp.c
+++ b/testsuite/smokey/xddp/xddp.c
@@ -10,6 +10,7 @@
 #include unistd.h
 #include signal.h
 #include string.h
+#include semaphore.h
 #include pthread.h
 #include fcntl.h
 #include errno.h
@@ -23,6 +24,8 @@ smokey_test_plugin(xddp,
 
 static pthread_t rt1, rt2, nrt;
 
+static sem_t semsync;
+
 #define XDDP_PORT_LABEL  xddp-smokey
 
 static void fail(const char *reason)
@@ -59,6 +62,7 @@ static void *realtime_thread1(void *arg)
 
FD_ZERO(set);
FD_SET(s, set);
+   sem_post(semsync); /* unleash client RT thread */
 
for (;;) {
control++;
@@ -89,6 +93,19 @@ static void *realtime_thread1(void *arg)
return NULL;
 }
 
+static void sem_sync(sem_t *sem)
+{
+   int ret;
+
+   for (;;) {
+   ret = sem_wait(sem);
+   if (ret == 0)
+   return;
+   if (errno != EINTR)
+   fail(sem_wait);
+   }
+}
+
 static void *realtime_thread2(void *arg)
 {
struct rtipc_port_label plabel;
@@ -119,6 +136,9 @@ static void *realtime_thread2(void *arg)
if (ret)
fail(setsockopt);
 
+   sem_sync(semsync);
+   sem_post(semsync); /* unleash regular thread */
+
memset(saddr, 0, sizeof(saddr));
saddr.sipc_family = AF_RTIPC;
saddr.sipc_port = -1;   /* Tell XDDP to search by label. */
@@ -200,6 +220,8 @@ static int run_xddp(struct smokey_test *t, int argc, char 
*const argv[])
struct sched_param param = { .sched_priority = 42 };
pthread_attr_t rtattr, regattr;
 
+   sem_init(semsync, 0, 0);
+
pthread_attr_init(rtattr);
pthread_attr_setdetachstate(rtattr, PTHREAD_CREATE_JOINABLE);
pthread_attr_setinheritsched(rtattr, PTHREAD_EXPLICIT_SCHED);


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://www.xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : cobalt/posix/signal: prepare for 32bit syscall emulation

2014-10-30 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: e03c30d69e24a24978935a69fcafc2276ac4d82f
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=e03c30d69e24a24978935a69fcafc2276ac4d82f

Author: Philippe Gerum r...@xenomai.org
Date:   Thu Oct 16 14:40:45 2014 +0200

cobalt/posix/signal: prepare for 32bit syscall emulation

---

 kernel/cobalt/posix/extension.h |2 +-
 kernel/cobalt/posix/signal.c|  154 ---
 kernel/cobalt/posix/signal.h|   17 +
 3 files changed, 115 insertions(+), 58 deletions(-)

diff --git a/kernel/cobalt/posix/extension.h b/kernel/cobalt/posix/extension.h
index 47c44f8..b831a3a 100644
--- a/kernel/cobalt/posix/extension.h
+++ b/kernel/cobalt/posix/extension.h
@@ -51,7 +51,7 @@ struct cobalt_extension {
int (*signal_queue)(struct cobalt_extref *refthread,
struct cobalt_sigpending *sigp);
int (*signal_copyinfo)(struct cobalt_extref *refthread,
-  struct siginfo __user *u_si,
+  void __user *u_si,
   const struct siginfo *si,
   int overrun);
int (*sched_yield)(struct cobalt_extref *curref);
diff --git a/kernel/cobalt/posix/signal.c b/kernel/cobalt/posix/signal.c
index 1259cc4..94d87d6 100644
--- a/kernel/cobalt/posix/signal.c
+++ b/kernel/cobalt/posix/signal.c
@@ -201,12 +201,15 @@ void cobalt_signal_flush(struct cobalt_thread *thread)
 }
 
 static int signal_wait(sigset_t *set, xnticks_t timeout,
-  struct siginfo __user *u_si)
+  void __user *u_si,
+  int (*put_siginfo)(void __user *u_si,
+ const struct siginfo *si,
+ int overrun))
 {
struct cobalt_sigpending *sigp = NULL;
struct cobalt_sigwait_context swc;
-   int ret, sig, n, code, overrun;
struct cobalt_thread *curr;
+   int ret, sig, n, overrun;
unsigned long *p, *t, m;
struct siginfo si, *sip;
struct list_head *sigq;
@@ -303,37 +306,13 @@ done:
if (u_si == NULL)
goto out;   /* Return signo only. */
 
-   /* Translate kernel codes for userland. */
-   code = sip-si_code;
-   if (code  __SI_MASK)
-   code |= __SI_MASK;
-
-   ret = __xn_put_user(sip-si_signo, u_si-si_signo);
-   ret |= __xn_put_user(sip-si_errno, u_si-si_errno);
-   ret |= __xn_put_user(code, u_si-si_code);
-
-   /*
-* Copy the generic/standard siginfo bits to userland.
-*/
-   switch (sip-si_code) {
-   case SI_TIMER:
-   ret |= __xn_put_user(sip-si_tid, u_si-si_tid);
-   ret |= __xn_put_user(sip-si_ptr, u_si-si_ptr);
-   ret |= __xn_put_user(overrun, u_si-si_overrun);
-   break;
-   case SI_QUEUE:
-   case SI_MESGQ:
-   ret |= __xn_put_user(sip-si_ptr, u_si-si_ptr);
-   /* falldown wanted. */
-   case SI_USER:
-   ret |= __xn_put_user(sip-si_pid, u_si-si_pid);
-   ret |= __xn_put_user(sip-si_uid, u_si-si_uid);
-   }
+   ret = put_siginfo(u_si, sip, overrun);
+   if (ret)
+   goto out;
 
/* Allow an extended target to receive more data. */
-   if (ret == 0)
-   cobalt_call_extension(signal_copyinfo, curr-extref,
- ret, u_si, sip, overrun);
+   cobalt_call_extension(signal_copyinfo, curr-extref,
+ ret, u_si, sip, overrun);
 out:
/*
 * If we pulled the signal information from a sigpending
@@ -355,6 +334,47 @@ fail:
return ret;
 }
 
+static int signal_put_siginfo(void __user *u_si, const struct siginfo *si,
+ int overrun)
+{
+   struct siginfo __user *u_p = u_si;
+   int code, ret;
+
+   /* Translate kernel codes for userland. */
+   code = si-si_code;
+   if (code  __SI_MASK)
+   code |= __SI_MASK;
+
+   ret = __xn_put_user(si-si_signo, u_p-si_signo);
+   ret |= __xn_put_user(si-si_errno, u_p-si_errno);
+   ret |= __xn_put_user(code, u_p-si_code);
+
+   /*
+* Copy the generic/standard siginfo bits to userland.
+*/
+   switch (si-si_code) {
+   case SI_TIMER:
+   ret |= __xn_put_user(si-si_tid, u_p-si_tid);
+   ret |= __xn_put_user(si-si_ptr, u_p-si_ptr);
+   ret |= __xn_put_user(overrun, u_p-si_overrun);
+   break;
+   case SI_QUEUE:
+   case SI_MESGQ:
+   ret |= __xn_put_user(si-si_ptr, u_p-si_ptr);
+   /* falldown wanted. */
+   case SI_USER:
+   ret |= __xn_put_user(si-si_pid, u_p-si_pid);
+   ret |= __xn_put_user(si-si_uid, u_p-si_uid);
+   }
+
+   return 

[Xenomai-git] Jorge Ramirez-Ortiz : drivers/analogy: NI_M - retrieve the sampling period via A4L_CMD_SIMUL

2014-10-30 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: 9d5eda59702de396d6bb20158357e4ed2162fefe
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=9d5eda59702de396d6bb20158357e4ed2162fefe

Author: Jorge Ramirez-Ortiz j...@xenomai.org
Date:   Tue Aug 19 14:13:08 2014 -0400

drivers/analogy: NI_M - retrieve the sampling period via A4L_CMD_SIMUL

---

 kernel/drivers/analogy/national_instruments/mio_common.c |   10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/kernel/drivers/analogy/national_instruments/mio_common.c 
b/kernel/drivers/analogy/national_instruments/mio_common.c
index f0f2abf..e5ccf7a 100644
--- a/kernel/drivers/analogy/national_instruments/mio_common.c
+++ b/kernel/drivers/analogy/national_instruments/mio_common.c
@@ -2067,12 +2067,14 @@ static int ni_ai_cmdtest(struct a4l_subdevice *subd, 
struct a4l_cmd_desc * cmd)
   
cmd-nb_chan)) {
cmd-scan_begin_arg =
ni_min_ai_scan_period_ns(dev, cmd-nb_chan);
-   return -EINVAL;
-   }
-   if (cmd-scan_begin_arg  devpriv-clock_ns * 0xff) {
+
+   if (cmd-scan_begin_arg  devpriv-clock_ns * 0xff)
cmd-scan_begin_arg = devpriv-clock_ns * 0xff;
-   return -EINVAL;
+
+   /* required for calibration */
+   return 0;
}
+
} else if (cmd-scan_begin_src == TRIG_EXT) {
/* external trigger */
unsigned int tmp = CR_CHAN(cmd-scan_begin_arg);


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://www.xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : cobalt/sh: disable 32bit syscall emulation

2014-10-30 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: 37574aa22533942cfd7cd19d26754a99371192b7
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=37574aa22533942cfd7cd19d26754a99371192b7

Author: Philippe Gerum r...@xenomai.org
Date:   Thu Oct 16 14:22:25 2014 +0200

cobalt/sh: disable 32bit syscall emulation

---

 kernel/cobalt/arch/sh/Kconfig |3 +++
 1 file changed, 3 insertions(+)

diff --git a/kernel/cobalt/arch/sh/Kconfig b/kernel/cobalt/arch/sh/Kconfig
index 3f92993..af23fa0 100644
--- a/kernel/cobalt/arch/sh/Kconfig
+++ b/kernel/cobalt/arch/sh/Kconfig
@@ -4,6 +4,9 @@ config IPIPE_WANT_ACTIVE_MM
 config XENO_ARCH_FPU
def_bool SH_FPU
 
+config XENO_ARCH_SYS3264
+def_bool n
+
 menu Machine/platform-specific options
 
 config IPIPE_WANT_PREEMPTIBLE_SWITCH


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://www.xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : cobalt/posix/monitor: prepare for 32bit syscall emulation

2014-10-30 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: 8f0675c0023785303f1145dba481c0d5d4280fbe
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=8f0675c0023785303f1145dba481c0d5d4280fbe

Author: Philippe Gerum r...@xenomai.org
Date:   Thu Oct 16 14:42:05 2014 +0200

cobalt/posix/monitor: prepare for 32bit syscall emulation

---

 kernel/cobalt/posix/monitor.c |   35 ---
 kernel/cobalt/posix/monitor.h |4 
 2 files changed, 28 insertions(+), 11 deletions(-)

diff --git a/kernel/cobalt/posix/monitor.c b/kernel/cobalt/posix/monitor.c
index 9572c3b..fa05477 100644
--- a/kernel/cobalt/posix/monitor.c
+++ b/kernel/cobalt/posix/monitor.c
@@ -224,10 +224,9 @@ drain:
datp-flags = ~COBALT_MONITOR_PENDED;
 }
 
-COBALT_SYSCALL(monitor_wait, nonrestartable,
-  int, (struct cobalt_monitor_shadow __user *u_mon,
-int event, const struct timespec __user *u_ts,
-int __user *u_ret))
+int __cobalt_monitor_wait(struct cobalt_monitor_shadow __user *u_mon,
+ int event, const struct timespec *ts,
+ int __user *u_ret)
 {
struct cobalt_thread *curr = cobalt_current_thread();
struct cobalt_monitor_data *datp;
@@ -235,18 +234,14 @@ COBALT_SYSCALL(monitor_wait, nonrestartable,
int ret = 0, opret = 0, info;
struct cobalt_monitor *mon;
struct xnsynch *synch;
-   struct timespec ts;
xnhandle_t handle;
xntmode_t tmode;
spl_t s;
 
handle = cobalt_get_handle_from_user(u_mon-handle);
 
-   if (u_ts) {
-   if (__xn_safe_copy_from_user(ts, u_ts, sizeof(ts)))
-   return -EFAULT;
-   timeout = ts2ns(ts) + 1;
-   }
+   if (ts)
+   timeout = ts2ns(ts) + 1;
 
xnlock_get_irqsave(nklock, s);
 
@@ -277,7 +272,7 @@ COBALT_SYSCALL(monitor_wait, nonrestartable,
}
datp-flags |= COBALT_MONITOR_PENDED;
 
-   tmode = u_ts ? mon-tmode : XN_RELATIVE;
+   tmode = ts ? mon-tmode : XN_RELATIVE;
info = xnsynch_sleep_on(synch, timeout, tmode);
if (info) {
if ((event  COBALT_MONITOR_WAITDRAIN) == 0 
@@ -304,6 +299,24 @@ out:
return ret;
 }
 
+COBALT_SYSCALL(monitor_wait, nonrestartable,
+  int, (struct cobalt_monitor_shadow __user *u_mon,
+int event, const struct timespec __user *u_ts,
+int __user *u_ret))
+{
+   struct timespec ts, *tsp = NULL;
+   int ret;
+
+   if (u_ts) {
+   tsp = ts;
+   ret = __xn_safe_copy_from_user(ts, u_ts, sizeof(ts));
+   if (ret)
+   return ret;
+   }
+
+   return __cobalt_monitor_wait(u_mon, event, tsp, u_ret);
+}
+
 COBALT_SYSCALL(monitor_sync, nonrestartable,
   int, (struct cobalt_monitor_shadow __user *u_mon))
 {
diff --git a/kernel/cobalt/posix/monitor.h b/kernel/cobalt/posix/monitor.h
index 1519abf..ff84acf 100644
--- a/kernel/cobalt/posix/monitor.h
+++ b/kernel/cobalt/posix/monitor.h
@@ -38,6 +38,10 @@ struct cobalt_monitor {
xnhandle_t handle;
 };
 
+int __cobalt_monitor_wait(struct cobalt_monitor_shadow __user *u_mon,
+ int event, const struct timespec *ts,
+ int __user *u_ret);
+
 COBALT_SYSCALL_DECL(monitor_init,
int, (struct cobalt_monitor_shadow __user *u_monsh,
  clockid_t clk_id,


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://www.xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : cobalt: fix 32/64bit code neutrality issues

2014-10-30 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: daa824592f21fc102fd7edb5aa036412d49f6b2e
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=daa824592f21fc102fd7edb5aa036412d49f6b2e

Author: Philippe Gerum r...@xenomai.org
Date:   Sun Oct 19 19:15:38 2014 +0200

cobalt: fix 32/64bit code neutrality issues

---

 include/boilerplate/compiler.h |4 +
 include/cobalt/kernel/ppd.h|2 +-
 include/cobalt/kernel/rtdm/Makefile.am |1 +
 include/cobalt/kernel/rtdm/compat.h|   73 ++
 include/cobalt/kernel/rtdm/fd.h|4 +-
 include/cobalt/uapi/cond.h |   10 +-
 include/cobalt/uapi/event.h|9 +-
 include/cobalt/uapi/kernel/vdso.h  |   11 +-
 include/cobalt/uapi/monitor.h  |9 +-
 include/cobalt/uapi/mutex.h|7 +-
 include/cobalt/uapi/sem.h  |4 +-
 kernel/cobalt/arch/arm/mayday.c|   26 +-
 kernel/cobalt/arch/blackfin/mayday.c   |   26 +-
 kernel/cobalt/arch/nios2/mayday.c  |   26 +-
 kernel/cobalt/arch/powerpc/mayday.c|   26 +-
 kernel/cobalt/arch/sh/mayday.c |   26 +-
 kernel/cobalt/arch/x86/mayday.c|   51 +-
 kernel/cobalt/include/asm-generic/xenomai/mayday.h |6 +-
 kernel/cobalt/posix/clock.c|4 +-
 kernel/cobalt/posix/cond.c |   12 +-
 kernel/cobalt/posix/event.c|   52 +-
 kernel/cobalt/posix/event.h|2 +-
 kernel/cobalt/posix/io.h   |2 +-
 kernel/cobalt/posix/monitor.c  |   56 +-
 kernel/cobalt/posix/monitor.h  |2 +-
 kernel/cobalt/posix/mutex.c|   32 +-
 kernel/cobalt/posix/nsem.c |   54 +-
 kernel/cobalt/posix/process.c  |   70 +-
 kernel/cobalt/posix/sched.c|   29 +-
 kernel/cobalt/posix/sched.h|2 +-
 kernel/cobalt/posix/sem.c  |   42 +-
 kernel/cobalt/posix/sem.h  |   11 +-
 kernel/cobalt/posix/syscall.c  |  776 ++--
 kernel/cobalt/posix/thread.c   |   38 +-
 kernel/cobalt/posix/thread.h   |   24 +-
 lib/cobalt/clock.c |4 +-
 lib/cobalt/cond.c  |   32 +-
 lib/cobalt/current.h   |4 +-
 lib/cobalt/internal.c  |  104 ++-
 lib/cobalt/internal.h  |   10 +-
 lib/cobalt/mutex.c |   75 +-
 lib/cobalt/semaphore.c |   45 +-
 testsuite/clocktest/clocktest.c|   14 +-
 43 files changed, 1008 insertions(+), 809 deletions(-)

diff --git a/include/boilerplate/compiler.h b/include/boilerplate/compiler.h
index b52a585..e27d165 100644
--- a/include/boilerplate/compiler.h
+++ b/include/boilerplate/compiler.h
@@ -50,4 +50,8 @@
 #define __maybe_unused __attribute__((__unused__))
 #endif
 
+#ifndef __aligned
+#define __aligned(__n) __attribute__((aligned (__n)))
+#endif
+
 #endif /* _BOILERPLATE_COMPILER_H */
diff --git a/include/cobalt/kernel/ppd.h b/include/cobalt/kernel/ppd.h
index 4d42427..d5cfc69 100644
--- a/include/cobalt/kernel/ppd.h
+++ b/include/cobalt/kernel/ppd.h
@@ -32,7 +32,7 @@ struct cobalt_umm {
 
 struct cobalt_ppd {
struct cobalt_umm umm;
-   unsigned long mayday_addr;
+   unsigned long mayday_tramp;
atomic_t refcnt;
char *exe_path;
struct rb_root fds;
diff --git a/include/cobalt/kernel/rtdm/Makefile.am 
b/include/cobalt/kernel/rtdm/Makefile.am
index 6279168..2c04cac 100644
--- a/include/cobalt/kernel/rtdm/Makefile.am
+++ b/include/cobalt/kernel/rtdm/Makefile.am
@@ -3,6 +3,7 @@ noinst_HEADERS =\
autotune.h  \
can.h   \
cobalt.h\
+   compat.h\
driver.h\
fd.h\
ipc.h   \
diff --git a/include/cobalt/kernel/rtdm/compat.h 
b/include/cobalt/kernel/rtdm/compat.h
new file mode 100644
index 000..fdf493f
--- /dev/null
+++ b/include/cobalt/kernel/rtdm/compat.h
@@ -0,0 +1,73 @@
+/*
+ * Copyright (C) 2014 Philippe Gerum r...@xenomai.org
+ *
+ * Xenomai is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Xenomai is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See 

[Xenomai-git] Jorge Ramirez-Ortiz : utils/analogy: calibration - use analogy lib to read /write the calibration file

2014-10-30 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: fb962115628721bc52ae05923b67185c4005ee37
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=fb962115628721bc52ae05923b67185c4005ee37

Author: Jorge Ramirez-Ortiz j...@xenomai.org
Date:   Sat Oct 11 14:25:26 2014 -0400

utils/analogy: calibration - use analogy lib to read/write the calibration file

---

 include/rtdm/analogy.h|   11 +
 include/rtdm/uapi/analogy.h   |   28 +++
 lib/analogy/Makefile.am   |   11 +-
 lib/analogy/calibration.c |  211 +++
 lib/analogy/calibration.h |   44 
 utils/analogy/Makefile.am |5 +-
 utils/analogy/analogy_calibrate.c |   73 +--
 utils/analogy/analogy_calibrate.h |  131 +---
 utils/analogy/calibration_ni_m.c  |  422 -
 utils/analogy/calibration_ni_m.h  |   36 +---
 10 files changed, 456 insertions(+), 516 deletions(-)

diff --git a/include/rtdm/analogy.h b/include/rtdm/analogy.h
index 57f2ec0..fd26f58 100644
--- a/include/rtdm/analogy.h
+++ b/include/rtdm/analogy.h
@@ -21,9 +21,12 @@
 #ifndef _RTDM_ANALOGY_H
 #define _RTDM_ANALOGY_H
 
+#include stdio.h
 #include sys/types.h
 #include rtdm/uapi/analogy.h
 
+#include boilerplate/list.h
+
 /*!
   @addtogroup analogy_lib_descriptor
   @{
@@ -227,6 +230,14 @@ int a4l_ftoraw(a4l_chinfo_t *chan,
 int a4l_dtoraw(a4l_chinfo_t *chan,
   a4l_rnginfo_t *rng, void *dst, double *src, int cnt);
 
+void a4l_write_calibration_file(FILE *dst, struct list *l,
+   struct a4l_calibration_subdev *subd,
+   a4l_desc_t *desc);
+
+int a4l_read_calibration_file(char *name, struct a4l_calibration_data *data);
+
+
+
 #endif /* !DOXYGEN_CPP */
 
 #ifdef __cplusplus
diff --git a/include/rtdm/uapi/analogy.h b/include/rtdm/uapi/analogy.h
index 9806c82..669ded7 100644
--- a/include/rtdm/uapi/analogy.h
+++ b/include/rtdm/uapi/analogy.h
@@ -706,4 +706,32 @@ typedef struct a4l_instruction_list a4l_insnlst_t;
 
 /*! @} analogy_lib_sync1 */
 
+struct a4l_calibration_subdev {
+   a4l_sbinfo_t *info;
+   int slen;
+   int idx;
+   char *name;
+};
+
+struct a4l_calibration_subdev_data {
+   int index;
+   int channel;
+   int range;
+   int expansion;
+   int nb_coeff;
+   double *coeff;
+
+};
+
+struct a4l_calibration_data {
+   char *driver_name;
+   char *board_name;
+   int nb_ai;
+   struct a4l_calibration_subdev_data *ai;
+   int nb_ao;
+   struct a4l_calibration_subdev_data *ao;
+};
+
+
+
 #endif /* _RTDM_UAPI_ANALOGY_H */
diff --git a/lib/analogy/Makefile.am b/lib/analogy/Makefile.am
index 4d242ff..500453d 100644
--- a/lib/analogy/Makefile.am
+++ b/lib/analogy/Makefile.am
@@ -7,11 +7,16 @@ libanalogy_la_SOURCES =   \
descriptor.c\
info.c  \
internal.h  \
+   calibration.c   \
range.c \
root_leaf.h \
sync.c  \
sys.c
 
-libanalogy_la_CPPFLAGS =   \
-   @XENO_USER_CFLAGS@  \
-   -I$(top_srcdir)/include
+libanalogy_la_CPPFLAGS =   \
+   @XENO_USER_CFLAGS@  \
+   -I$(top_srcdir)/include \
+   -I$(top_srcdir)/lib/boilerplate 
+
+libanalogy_la_LIBADD = \
+   ../boilerplate/libboilerplate.la
diff --git a/lib/analogy/calibration.c b/lib/analogy/calibration.c
new file mode 100644
index 000..74b2789
--- /dev/null
+++ b/lib/analogy/calibration.c
@@ -0,0 +1,211 @@
+#include rtdm/analogy.h
+#include stdio.h
+#include errno.h
+#include wordexp.h
+#include iniparser/iniparser.h
+#include boilerplate/list.h
+#include calibration.h
+
+#define ARRAY_LEN(a)  (sizeof(a) / sizeof((a)[0]))
+
+static inline int read_dbl(double *d, struct _dictionary_ *f,const char *subd,
+  int subd_idx, char *type, int type_idx)
+{
+   char *str;
+   int ret;
+
+   /* if only contains doubles as coefficients */
+   if (strncmp(type, COEFF_STR, strlen(COEFF_STR) != 0))
+   return -ENOENT;
+
+   ret = asprintf(str, COEFF_FMT, subd, subd_idx, type, type_idx);
+   if (ret  0)
+   return ret;
+
+   *d = iniparser_getdouble(f, str, -255.0);
+   if (*d == -255.0)
+   ret = -ENOENT;
+   free(str);
+
+   return ret;
+}
+
+static inline int read_int(int *val, struct _dictionary_ *f, const char *subd,
+  int subd_idx, char *type)
+{
+   char *str;
+   int ret;
+
+   ret = (subd_idx = 0) ?
+ asprintf(str, ELEMENT_FIELD_FMT, subd, subd_idx, type):
+ asprintf(str, ELEMENT_FMT, subd, type);
+   if (ret  0)
+   return ret;
+
+   *val = iniparser_getint(f, str, 0x);
+   if (*val == 0x)
+   ret = -ENOENT;
+   free(str);
+
+   return ret;
+}
+
+static inline int read_str(char **val, struct _dictionary_ *f, const char 
*subd,
+   

[Xenomai-git] Jorge Ramirez-Ortiz : drivers/analogy: fix warning

2014-10-30 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: c386253f4c5869abf88d5d7b1271da501f8d0f6b
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=c386253f4c5869abf88d5d7b1271da501f8d0f6b

Author: Jorge Ramirez-Ortiz j...@xenomai.org
Date:   Tue Aug 26 13:51:08 2014 -0400

drivers/analogy: fix warning

---

 kernel/drivers/analogy/instruction.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/drivers/analogy/instruction.c 
b/kernel/drivers/analogy/instruction.c
index 7e7704f..1cbdb14 100644
--- a/kernel/drivers/analogy/instruction.c
+++ b/kernel/drivers/analogy/instruction.c
@@ -205,7 +205,7 @@ int a4l_do_special_insn(struct a4l_device_context * cxt, 
struct a4l_kernel_instr
 
 int a4l_do_insn(struct a4l_device_context * cxt, struct a4l_kernel_instruction 
* dsc)
 {
-   int ret;
+   int ret = 0;
struct a4l_subdevice *subd;
struct a4l_device *dev = a4l_get_dev(cxt);
int (*hdlr) (struct a4l_subdevice *, struct a4l_kernel_instruction *) = 
NULL;


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://www.xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : cobalt/posix/io: prepare for 32bit syscall emulation

2014-10-30 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: d7af7913e6e7288aa74b719c5c3b3b7f1b95c6a4
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=d7af7913e6e7288aa74b719c5c3b3b7f1b95c6a4

Author: Philippe Gerum r...@xenomai.org
Date:   Thu Oct 16 14:41:04 2014 +0200

cobalt/posix/io: prepare for 32bit syscall emulation

---

 kernel/cobalt/posix/io.c |   46 --
 kernel/cobalt/posix/io.h |6 ++
 2 files changed, 30 insertions(+), 22 deletions(-)

diff --git a/kernel/cobalt/posix/io.c b/kernel/cobalt/posix/io.c
index 15ff720..0d7ca33 100644
--- a/kernel/cobalt/posix/io.c
+++ b/kernel/cobalt/posix/io.c
@@ -76,30 +76,34 @@ COBALT_SYSCALL(recvmsg, probing,
   ssize_t, (int fd, struct msghdr __user *umsg, int flags))
 {
struct msghdr m;
-   int ret;
+   ssize_t ret;
+
+   if (flags  MSG_CMSG_COMPAT)
+   return -EINVAL;
 
-   if (__xn_copy_from_user(m, umsg, sizeof(m)))
-   return -EFAULT;
+   ret = __xn_safe_copy_from_user(m, umsg, sizeof(m));
+   if (ret)
+   return ret;
 
ret = rtdm_fd_recvmsg(fd, m, flags);
if (ret  0)
return ret;
 
-   if (__xn_copy_to_user(umsg, m, sizeof(*umsg)))
-   return -EFAULT;
-
-   return ret;
+   return __xn_safe_copy_to_user(umsg, m, sizeof(*umsg)) ?: ret;
 }
 
 COBALT_SYSCALL(sendmsg, probing,
   ssize_t, (int fd, struct msghdr __user *umsg, int flags))
 {
struct msghdr m;
+   int ret;
 
-   if (__xn_copy_from_user(m, umsg, sizeof(m)))
-   return -EFAULT;
+   if (flags  MSG_CMSG_COMPAT)
+   return -EINVAL;
 
-   return rtdm_fd_sendmsg(fd, m, flags);
+   ret = __xn_safe_copy_from_user(m, umsg, sizeof(m));
+
+   return ret ?: rtdm_fd_sendmsg(fd, m, flags);
 }
 
 COBALT_SYSCALL(mmap, lostage,
@@ -110,20 +114,18 @@ COBALT_SYSCALL(mmap, lostage,
void *u_addr = NULL;
int ret;
 
-   if (__xn_copy_from_user(rma, u_rma, sizeof(rma)))
-   return -EFAULT;
+   ret = __xn_safe_copy_from_user(rma, u_rma, sizeof(rma));
+   if (ret)
+   return ret;
 
ret = rtdm_fd_mmap(fd, rma, u_addr);
if (ret)
return ret;
 
-   if (__xn_copy_to_user(u_addrp, u_addr, sizeof(u_addr)))
-   return -EFAULT;
-
-   return 0;
+   return __xn_safe_copy_to_user(u_addrp, u_addr, sizeof(u_addr));
 }
 
-static int first_fd_valid_p(fd_set *fds[XNSELECT_MAX_TYPES], int nfds)
+int __cobalt_first_fd_valid_p(fd_set *fds[XNSELECT_MAX_TYPES], int nfds)
 {
int i, fd;
 
@@ -148,8 +150,8 @@ static int select_bind_one(struct xnselector *selector, 
unsigned type, int fd)
return -EBADF;
 }
 
-static int select_bind_all(struct xnselector *selector,
-  fd_set *fds[XNSELECT_MAX_TYPES], int nfds)
+int __cobalt_select_bind_all(struct xnselector *selector,
+fd_set *fds[XNSELECT_MAX_TYPES], int nfds)
 {
unsigned fd, type;
int err;
@@ -228,7 +230,7 @@ COBALT_SYSCALL(select, nonrestartable,
   to avoid the xnselector allocation in this case, so, we do a
   simple test: test if the first file descriptor we find in the
   fd_set is an RTDM descriptor or a message queue descriptor. 
*/
-   if (!first_fd_valid_p(in_fds, nfds))
+   if (!__cobalt_first_fd_valid_p(in_fds, nfds))
return -EBADF;
 
selector = xnmalloc(sizeof(*curr-selector));
@@ -239,7 +241,7 @@ COBALT_SYSCALL(select, nonrestartable,
 
/* Bind directly the file descriptors, we do not need to go
   through xnselect returning -ECHRNG */
-   if ((err = select_bind_all(selector, in_fds, nfds)))
+   if ((err = __cobalt_select_bind_all(selector, in_fds, nfds)))
return err;
}
 
@@ -247,7 +249,7 @@ COBALT_SYSCALL(select, nonrestartable,
err = xnselect(selector, out_fds, in_fds, nfds, timeout, mode);
 
if (err == -ECHRNG) {
-   int err = select_bind_all(selector, out_fds, nfds);
+   int err = __cobalt_select_bind_all(selector, out_fds, 
nfds);
if (err)
return err;
}
diff --git a/kernel/cobalt/posix/io.h b/kernel/cobalt/posix/io.h
index 9ddbfee..d1fc5fd 100644
--- a/kernel/cobalt/posix/io.h
+++ b/kernel/cobalt/posix/io.h
@@ -21,6 +21,12 @@
 
 #include rtdm/rtdm.h
 #include xenomai/posix/syscall.h
+#include cobalt/kernel/select.h
+
+int __cobalt_first_fd_valid_p(fd_set *fds[XNSELECT_MAX_TYPES], int nfds);
+
+int __cobalt_select_bind_all(struct xnselector *selector,
+fd_set *fds[XNSELECT_MAX_TYPES], int nfds);
 
 COBALT_SYSCALL_DECL(open, int,
(const char __user *u_path, int 

[Xenomai-git] Jorge Ramirez-Ortiz : drivers/analogy: NI M - 622x ranges changed to bipolar

2014-10-30 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: 6f3465ff217435c22aebaf3cf9cba4dc78f9c9fe
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=6f3465ff217435c22aebaf3cf9cba4dc78f9c9fe

Author: Jorge Ramirez-Ortiz j...@xenomai.org
Date:   Thu Sep  4 10:35:26 2014 -0400

drivers/analogy: NI M - 622x ranges changed to bipolar

---

 kernel/drivers/analogy/national_instruments/pcimio.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/drivers/analogy/national_instruments/pcimio.c 
b/kernel/drivers/analogy/national_instruments/pcimio.c
index e7a2ab3..8a3 100644
--- a/kernel/drivers/analogy/national_instruments/pcimio.c
+++ b/kernel/drivers/analogy/national_instruments/pcimio.c
@@ -801,7 +801,7 @@ static ni_board ni_boards[]={
n_aochan:   2,
aobits: 16,
ao_fifo_depth:  8191,
-   .ao_range_table = range_ni_M_622x_ao,
+   .ao_range_table = a4l_range_bipolar10,
reg_type:   ni_reg_622x,
ao_unipolar:0,
ao_speed:   1200,
@@ -819,7 +819,7 @@ static ni_board ni_boards[]={
n_aochan:   2,
aobits: 16,
ao_fifo_depth:  8191,
-   .ao_range_table = range_ni_M_622x_ao,
+   .ao_range_table = a4l_range_bipolar10,
reg_type:   ni_reg_622x,
ao_unipolar:0,
ao_speed:   1200,


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://www.xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Jorge Ramirez-Ortiz : drivers/analogy: NI M - cmd test update (from comedi )

2014-10-30 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: 7988c4132872f09611db5a219c425769b687
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=7988c4132872f09611db5a219c425769b687

Author: Jorge Ramirez-Ortiz j...@xenomai.org
Date:   Tue Aug 26 13:45:23 2014 -0400

drivers/analogy: NI M - cmd test update (from comedi)

In order to mimic the comedi behaviour, the simulation comand shall update
command fields specifics to the driver.

To that end, the a4l_cmd_t structure defines a driver specific bitfield to
indidate which states are allowed by the driver to not be reported as errors.

---

 include/rtdm/uapi/analogy.h|   33 +--
 .../analogy/national_instruments/mio_common.c  |  256 +---
 2 files changed, 190 insertions(+), 99 deletions(-)

diff --git a/include/rtdm/uapi/analogy.h b/include/rtdm/uapi/analogy.h
index 98c6154..458d5f7 100644
--- a/include/rtdm/uapi/analogy.h
+++ b/include/rtdm/uapi/analogy.h
@@ -236,7 +236,7 @@ typedef struct a4l_dev_info a4l_dvinfo_t;
 /**
  * Reference definition macro
  */
-#define AREF(a) (((a)  0xf)  24)
+#define AREF(a) (((a)  0x03)  24)
 /**
  * Flags definition macro
  */
@@ -244,7 +244,7 @@ typedef struct a4l_dev_info a4l_dvinfo_t;
 /**
  * Channel + range + reference definition macro
  */
-#define PACK(a, b, c) (CHAN(a) | RNG(b) | AREF(c))
+#define PACK(a, b, c) (a | RNG(b) | AREF(c))
 /**
  * Channel + range + reference + flags definition macro
  */
@@ -276,8 +276,8 @@ typedef struct a4l_dev_info a4l_dvinfo_t;
 #define CR_DITHER CR_ALT_FILTER
 #define CR_DEGLITCH CR_ALT_FILTER
 #define CR_ALT_SOURCE (127)
-#define CR_EDGE(128)
-#define CR_INVERT (129)
+#define CR_EDGE(130)
+#define CR_INVERT (131)
 
 #endif /* !DOXYGEN_CPP */
 
@@ -288,43 +288,46 @@ typedef struct a4l_dev_info a4l_dvinfo_t;
 
 struct a4l_cmd_desc {
unsigned char idx_subd;
-   /** Subdevice to which the command will be 
applied. */
+  /** Subdevice to which the command will be 
applied. */
 
unsigned long flags;
-/** Command flags */
+  /** Command flags */
 
/* Command trigger characteristics */
unsigned int start_src;
-   /** Start trigger type */
+  /** Start trigger type */
unsigned int start_arg;
-   /** Start trigger argument */
+  /** Start trigger argument */
unsigned int scan_begin_src;
-/** Scan begin trigger type */
+  /** Scan begin trigger type */
unsigned int scan_begin_arg;
-/** Scan begin trigger argument */
+  /** Scan begin trigger argument */
unsigned int convert_src;
- /** Convert trigger type */
+  /** Convert trigger type */
unsigned int convert_arg;
- /** Convert trigger argument */
+  /** Convert trigger argument */
unsigned int scan_end_src;
   /** Scan end trigger type */
unsigned int scan_end_arg;
   /** Scan end trigger argument */
unsigned int stop_src;
-  /** Stop trigger type */
+  /** Stop trigger type */
unsigned int stop_arg;
   /** Stop trigger argument */
 
unsigned char nb_chan;
   /** Count of channels related with the command */
unsigned int *chan_descs;
- /** Tab containing channels descriptors */
+   /** Tab containing channels descriptors */
 
/* Driver specific fields */
+   unsigned int valid_simul_stages;
+  /**  cmd simulation valid stages (driver dependent) 
*/
+
unsigned int data_len;
   /** Driver specific buffer size */
sampl_t *data;
-  /** Driver specific buffer pointer */
+  /** Driver specific buffer pointer */
 };
 typedef struct a4l_cmd_desc a4l_cmd_t;
 
diff --git a/kernel/drivers/analogy/national_instruments/mio_common.c 
b/kernel/drivers/analogy/national_instruments/mio_common.c
index e5ccf7a..6c5bba0 100644
--- a/kernel/drivers/analogy/national_instruments/mio_common.c
+++ b/kernel/drivers/analogy/national_instruments/mio_common.c
@@ -2029,52 +2029,145 @@ int ni_ai_inttrig(struct a4l_subdevice *subd, lsampl_t 
trignum)
return 1;
 }
 
-static int ni_ai_cmdtest(struct a4l_subdevice *subd, struct a4l_cmd_desc * cmd)
+#define cfc_check_trigger_arg_is(a,b) __cfc_check_trigger_arg_is(a,b, dev, 
__LINE__)
+static inline int __cfc_check_trigger_arg_is(unsigned int *arg,
+  

[Xenomai-git] Philippe Gerum : cobalt/blackfin: disable 32bit syscall emulation

2014-10-30 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: 4ed2ff124b301752d5eada7e6ba2d157f23ba017
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=4ed2ff124b301752d5eada7e6ba2d157f23ba017

Author: Philippe Gerum r...@xenomai.org
Date:   Thu Oct 16 14:22:40 2014 +0200

cobalt/blackfin: disable 32bit syscall emulation

---

 kernel/cobalt/arch/blackfin/Kconfig |3 +++
 1 file changed, 3 insertions(+)

diff --git a/kernel/cobalt/arch/blackfin/Kconfig 
b/kernel/cobalt/arch/blackfin/Kconfig
index 9f19382..1ca0278 100644
--- a/kernel/cobalt/arch/blackfin/Kconfig
+++ b/kernel/cobalt/arch/blackfin/Kconfig
@@ -1,5 +1,8 @@
 config XENO_ARCH_FPU
def_bool n
 
+config XENO_ARCH_SYS3264
+def_bool n
+
 source kernel/xenomai/Kconfig
 source drivers/xenomai/Kconfig


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://www.xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : drivers/rtipc: fixup for 32bit emulation

2014-10-30 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: 92b6dab81dcf6d5be10642010830c359410055a7
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=92b6dab81dcf6d5be10642010830c359410055a7

Author: Philippe Gerum r...@xenomai.org
Date:   Wed Oct 22 15:20:21 2014 +0200

drivers/rtipc: fixup for 32bit emulation

---

 kernel/drivers/ipc/bufp.c |  115 ++---
 kernel/drivers/ipc/iddp.c |  123 +++---
 kernel/drivers/ipc/internal.h |   41 -
 kernel/drivers/ipc/rtipc.c|  365 -
 kernel/drivers/ipc/xddp.c |  113 ++---
 5 files changed, 520 insertions(+), 237 deletions(-)

diff --git a/kernel/drivers/ipc/bufp.c b/kernel/drivers/ipc/bufp.c
index 1e5ecf3..5ae166a 100644
--- a/kernel/drivers/ipc/bufp.c
+++ b/kernel/drivers/ipc/bufp.c
@@ -375,17 +375,16 @@ static ssize_t bufp_recvmsg(struct rtdm_fd *fd,
return -EINVAL;
 
/* Copy I/O vector in */
-   if (rtipc_get_arg(fd, iov, msg-msg_iov,
- sizeof(iov[0]) * msg-msg_iovlen))
-   return -EFAULT;
+   ret = rtipc_get_iovec(fd, iov, msg);
+   if (ret)
+   return ret;
 
ret = __bufp_recvmsg(fd, iov, msg-msg_iovlen, flags, saddr);
if (ret = 0)
return ret;
 
/* Copy the updated I/O vector back */
-   if (rtipc_put_arg(fd, msg-msg_iov, iov,
- sizeof(iov[0]) * msg-msg_iovlen))
+   if (rtipc_put_iovec(fd, iov, msg))
return -EFAULT;
 
/* Copy the source address if required. */
@@ -620,8 +619,7 @@ static ssize_t bufp_sendmsg(struct rtdm_fd *fd,
return -EINVAL;
 
/* Fetch the destination address to send to. */
-   if (rtipc_get_arg(fd, daddr,
- msg-msg_name, sizeof(daddr)))
+   if (rtipc_get_arg(fd, daddr, msg-msg_name, sizeof(daddr)))
return -EFAULT;
 
if (daddr.sipc_port  0 ||
@@ -639,20 +637,16 @@ static ssize_t bufp_sendmsg(struct rtdm_fd *fd,
return -EINVAL;
 
/* Copy I/O vector in */
-   if (rtipc_get_arg(fd, iov, msg-msg_iov,
- sizeof(iov[0]) * msg-msg_iovlen))
-   return -EFAULT;
+   ret = rtipc_get_iovec(fd, iov, msg);
+   if (ret)
+   return ret;
 
ret = __bufp_sendmsg(fd, iov, msg-msg_iovlen, flags, daddr);
if (ret = 0)
return ret;
 
/* Copy updated I/O vector back */
-   if (rtipc_put_arg(fd, msg-msg_iov, iov,
- sizeof(iov[0]) * msg-msg_iovlen))
-   return -EFAULT;
-
-   return ret;
+   return rtipc_put_iovec(fd, iov, msg) ?: ret;
 }
 
 static ssize_t bufp_write(struct rtdm_fd *fd,
@@ -829,30 +823,27 @@ static int __bufp_setsockopt(struct bufp_socket *sk,
struct rtipc_port_label plabel;
struct timeval tv;
rtdm_lockctx_t s;
-   int ret = 0;
size_t len;
+   int ret;
 
-   if (rtipc_get_arg(fd, sopt, arg, sizeof(sopt)))
-   return -EFAULT;
+   ret = rtipc_get_sockoptin(fd, sopt, arg);
+   if (ret)
+   return ret;
 
if (sopt.level == SOL_SOCKET) {
switch (sopt.optname) {
 
case SO_RCVTIMEO:
-   if (sopt.optlen != sizeof(tv))
-   return -EINVAL;
-   if (rtipc_get_arg(fd, tv,
- sopt.optval, sizeof(tv)))
-   return -EFAULT;
+   ret = rtipc_get_timeval(fd, tv, sopt.optval, 
sopt.optlen);
+   if (ret)
+   return ret;
sk-rx_timeout = rtipc_timeval_to_ns(tv);
break;
 
case SO_SNDTIMEO:
-   if (sopt.optlen != sizeof(tv))
-   return -EINVAL;
-   if (rtipc_get_arg(fd, tv,
- sopt.optval, sizeof(tv)))
-   return -EFAULT;
+   ret = rtipc_get_timeval(fd, tv, sopt.optval, 
sopt.optlen);
+   if (ret)
+   return ret;
sk-tx_timeout = rtipc_timeval_to_ns(tv);
break;
 
@@ -869,11 +860,9 @@ static int __bufp_setsockopt(struct bufp_socket *sk,
switch (sopt.optname) {
 
case BUFP_BUFSZ:
-   if (sopt.optlen != sizeof(len))
-   return -EINVAL;
-   if (rtipc_get_arg(fd, len,
- sopt.optval, sizeof(len)))
-   return -EFAULT;
+   ret = rtipc_get_length(fd, len, sopt.optval, sopt.optlen);
+   if (ret)
+   return ret;
if (len == 0)

[Xenomai-git] Jorge Ramirez-Ortiz : rtdm/uapi: define PACK_FLAGS using previous definition of PACK

2014-10-30 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: 8ec0c54431ac402be811a5501c2a01658e4fdad2
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=8ec0c54431ac402be811a5501c2a01658e4fdad2

Author: Jorge Ramirez-Ortiz j...@xenomai.org
Date:   Thu Sep 11 18:03:07 2014 -0400

rtdm/uapi: define PACK_FLAGS using previous definition of PACK

---

 include/rtdm/uapi/analogy.h |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/rtdm/uapi/analogy.h b/include/rtdm/uapi/analogy.h
index 458d5f7..9806c82 100644
--- a/include/rtdm/uapi/analogy.h
+++ b/include/rtdm/uapi/analogy.h
@@ -248,7 +248,7 @@ typedef struct a4l_dev_info a4l_dvinfo_t;
 /**
  * Channel + range + reference + flags definition macro
  */
-#define PACK_FLAGS(a, b, c, d) (CHAN(a) | RNG(b) | AREF(c) | FLAGS(d))
+#define PACK_FLAGS(a, b, c, d) (PACK(a, b, c) | FLAGS(d))
 
 /**
  * Analog reference is analog ground


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://www.xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Jorge Ramirez-Ortiz : utils/analogy: NI-M software calibration [Part I]

2014-10-30 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: 047c0fe54a2a751bd5bf3e3c7f857684845656b8
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=047c0fe54a2a751bd5bf3e3c7f857684845656b8

Author: Jorge Ramirez-Ortiz j...@xenomai.org
Date:   Wed Aug 13 12:24:16 2014 -0400

utils/analogy: NI-M software calibration [Part I]

Generates a calibration file as per the comedi implementation.

---

 utils/analogy/Makefile.am |   24 +-
 utils/analogy/analogy_calibrate.c |  157 +
 utils/analogy/analogy_calibrate.h |  182 +
 utils/analogy/calibration_ni_m.c  | 1406 +
 utils/analogy/calibration_ni_m.h  |  280 
 5 files changed, 2048 insertions(+), 1 deletion(-)

diff --git a/utils/analogy/Makefile.am b/utils/analogy/Makefile.am
index c731b7a..fe2f317 100644
--- a/utils/analogy/Makefile.am
+++ b/utils/analogy/Makefile.am
@@ -1,4 +1,4 @@
-sbin_PROGRAMS = analogy_config
+sbin_PROGRAMS = analogy_config analogy_calibrate
 
 bin_PROGRAMS = \
cmd_read \
@@ -29,6 +29,24 @@ analogy_config_LDADD = \
@XENO_USER_LDADD@   \
-lpthread -lrt
 
+analogy_calibrate_SOURCES = analogy_calibrate.c calibration_ni_m.c
+analogy_calibrate.c: git-stamp.h calibration_ni_m.h
+git-stamp.h: git-stamp
+   @set -x; if test -r $(top_srcdir)/.git; then
\
+ stamp=`git --git-dir=$(top_srcdir)/.git rev-list --abbrev-commit -1 
HEAD`;\
+ if test \! -s $@ || grep -wvq $$stamp $@; then
\
+   date=`git --git-dir=$(top_srcdir)/.git log -1 $$stamp 
--pretty=format:%ci`; \
+   echo #define GIT_STAMP \#$$stamp ($$date)\  $@;
\
+ fi;   
\
+   elif test \! -r $@ -o -s $@; then   
\
+   rm -f $@  touch $@;   
\
+   fi; true
+analogy_calibrate_LDADD = \
+   ../../lib/analogy/libanalogy.la \
+   ../../lib/cobalt/libcobalt.la   \
+   @XENO_USER_LDADD@   \
+   -lpthread -lrt -lgsl -lgslcblas -lm
+
 cmd_read_SOURCES = cmd_read.c
 cmd_read_LDADD = \
../../lib/analogy/libanalogy.la \
@@ -77,3 +95,7 @@ insn_bits_LDADD = \
 
 wf_generate_SOURCES = wf_generate.c
 wf_generate_LDADD = ./libwaveform.la -lm
+
+
+.PHONY: git-stamp
+
diff --git a/utils/analogy/analogy_calibrate.c 
b/utils/analogy/analogy_calibrate.c
new file mode 100644
index 000..586a38a
--- /dev/null
+++ b/utils/analogy/analogy_calibrate.c
@@ -0,0 +1,157 @@
+/**
+ * @file
+ * Analogy for Linux, calibration program
+ *
+ * @note Copyright (C) 2014 Jorge A. Ramirez-Ortiz j...@xenomai.org
+ *
+ * from original code from the Comedi project
+ *
+ * Xenomai is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Xenomai is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Xenomai; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include sys/time.h
+#include sys/resource.h
+#include getopt.h
+#include pthread.h
+#include sys/mman.h
+#include xeno_config.h
+#include rtdm/analogy.h
+#include analogy_calibrate.h
+#include calibration_ni_m.h
+
+
+struct timespec calibration_start_time;
+static const char *revision = 0.0.1;
+a4l_desc_t descriptor;
+FILE *cal = NULL;
+
+static const struct option options[] = {
+   {
+#define help_opt   0
+   .name = help,
+   .has_arg = 0,
+   .flag = NULL,
+   },
+   {
+#define device_opt 1
+   .name = device,
+   .has_arg = 1,
+   .flag = NULL,
+   },
+   {
+#define output_opt 2
+   .name = output,
+   .has_arg = 1,
+   .flag = NULL,
+   },
+   {
+   .name = NULL,
+   }
+};
+
+static void print_usage(void)
+{
+   fprintf(stderr, Usage: analogy_calibrate \n
+--help: this menu \n
+--device /dev/analogyX: analogy device to calibrate 
\n
+--output filename : calibration results \n
+ );
+}
+
+static void __attribute__ ((constructor)) __analogy_calibrate_init(void)
+{
+   clock_gettime(CLOCK_MONOTONIC, calibration_start_time);
+}
+
+int main(int argc, char *argv[])
+{
+   struct 

[Xenomai-git] Jorge Ramirez-Ortiz : drivers/analogy: modify the cmd test behaviour

2014-10-30 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: 1c00aab42aec168634b0380cfc1735296e164db0
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=1c00aab42aec168634b0380cfc1735296e164db0

Author: Jorge Ramirez-Ortiz j...@xenomai.org
Date:   Tue Aug 26 13:50:41 2014 -0400

drivers/analogy: modify the cmd test behaviour

---

 kernel/drivers/analogy/command.c |   66 +-
 1 file changed, 44 insertions(+), 22 deletions(-)

diff --git a/kernel/drivers/analogy/command.c b/kernel/drivers/analogy/command.c
index 213591d..7420bc5 100644
--- a/kernel/drivers/analogy/command.c
+++ b/kernel/drivers/analogy/command.c
@@ -26,16 +26,18 @@
 #include rtdm/analogy/device.h
 
 /* --- Command descriptor management functions --- */
-int a4l_fill_cmddesc(struct a4l_device_context * cxt, struct a4l_cmd_desc * 
desc, void *arg)
+int a4l_fill_cmddesc(struct a4l_device_context *cxt, struct a4l_cmd_desc *desc,
+unsigned int **chan_descs, void *arg)
 {
-   int ret = 0;
unsigned int *tmpchans = NULL;
+   int ret = 0;
 
ret = rtdm_safe_copy_from_user(rtdm_private_to_fd(cxt),
   desc, arg, sizeof(struct a4l_cmd_desc));
if (ret != 0)
goto out_cmddesc;
 
+
if (desc-nb_chan == 0) {
ret = -EINVAL;
goto out_cmddesc;
@@ -50,13 +52,16 @@ int a4l_fill_cmddesc(struct a4l_device_context * cxt, 
struct a4l_cmd_desc * desc
ret = rtdm_safe_copy_from_user(rtdm_private_to_fd(cxt),
   tmpchans,
   desc-chan_descs,
-  desc-nb_chan * sizeof(unsigned long));
-   if (ret != 0)
+  desc-nb_chan * sizeof(unsigned int));
+   if (ret != 0) {
+   __a4l_err(%s invalid arguments \n, __FUNCTION__);
goto out_cmddesc;
+   }
 
+   *chan_descs = desc-chan_descs;
desc-chan_descs = tmpchans;
 
-   __a4l_dbg(1, core_dbg, desc dump\n);
+   __a4l_dbg(1, core_dbg, desc dump: \n);
__a4l_dbg(1, core_dbg, \t-idx_subd=%u\n, desc-idx_subd);
__a4l_dbg(1, core_dbg, \t-flags=%lu\n, desc-flags);
__a4l_dbg(1, core_dbg, \t-nb_chan=%u\n, desc-nb_chan);
@@ -64,9 +69,10 @@ int a4l_fill_cmddesc(struct a4l_device_context * cxt, struct 
a4l_cmd_desc * desc
__a4l_dbg(1, core_dbg, \t-data_len=%u\n, desc-data_len);
__a4l_dbg(1, core_dbg, \t-pdata=0x%p\n, desc-data);
 
-  out_cmddesc:
+   out_cmddesc:
 
if (ret != 0) {
+   __a4l_err(a4l_fill_cmddesc: %d \n, ret);
if (tmpchans != NULL)
rtdm_free(tmpchans);
desc-chan_descs = NULL;
@@ -113,7 +119,7 @@ int a4l_check_cmddesc(struct a4l_device_context * cxt, 
struct a4l_cmd_desc * des
}
 
return a4l_check_chanlist(dev-transfer.subds[desc-idx_subd],
-desc-nb_chan, desc-chan_descs);
+ desc-nb_chan, desc-chan_descs);
 }
 
 /* --- Command checking functions --- */
@@ -124,7 +130,7 @@ int a4l_check_generic_cmdcnt(struct a4l_cmd_desc * desc)
 
/* Makes sure trigger sources are trivially valid */
tmp1 =
-   desc-start_src  ~(TRIG_NOW | TRIG_INT | TRIG_EXT | TRIG_FOLLOW);
+   desc-start_src  ~(TRIG_NOW | TRIG_INT | TRIG_EXT | TRIG_FOLLOW);
tmp2 = desc-start_src  (TRIG_NOW | TRIG_INT | TRIG_EXT | TRIG_FOLLOW);
if (tmp1 != 0 || tmp2 == 0) {
__a4l_err(a4l_check_cmddesc: start_src, weird trigger\n);
@@ -288,6 +294,7 @@ int a4l_ioctl_cmd(struct a4l_device_context * ctx, void 
*arg)
int ret = 0, simul_flag = 0;
struct a4l_cmd_desc *cmd_desc = NULL;
struct a4l_device *dev = a4l_get_dev(ctx);
+   unsigned int *chan_descs, *tmp;
struct a4l_subdevice *subd;
 
/* The command launching cannot be done in real-time because
@@ -309,7 +316,7 @@ int a4l_ioctl_cmd(struct a4l_device_context * ctx, void 
*arg)
memset(cmd_desc, 0, sizeof(struct a4l_cmd_desc));
 
/* Gets the command */
-   ret = a4l_fill_cmddesc(ctx, cmd_desc, arg);
+   ret = a4l_fill_cmddesc(ctx, cmd_desc, chan_descs, arg);
if (ret != 0)
goto out_ioctl_cmd;
 
@@ -327,24 +334,28 @@ int a4l_ioctl_cmd(struct a4l_device_context * ctx, void 
*arg)
goto out_ioctl_cmd;
 
__a4l_dbg(1, core_dbg,1st cmd checks passed\n);
-
subd = dev-transfer.subds[cmd_desc-idx_subd];
 
/* Tests the command with the cmdtest function */
-   if (subd-do_cmdtest != NULL)
-   ret = subd-do_cmdtest(subd, cmd_desc);
-   if (ret != 0) {
-   __a4l_err(a4l_ioctl_cmd: driver's cmd_test failed\n);
-   goto out_ioctl_cmd;
-   }
-
-   __a4l_dbg(1, core_dbg, driver's cmd checks passed\n);
-
if (cmd_desc-flags  

[Xenomai-git] Gilles Chanteperdrix : drivers/timerbench: add missing include

2014-10-30 Thread git repository hosting
Module: xenomai-gch
Branch: for-forge
Commit: e93e31fe3b591f8185d63d068ab851bfb9e06dfe
URL:
http://git.xenomai.org/?p=xenomai-gch.git;a=commit;h=e93e31fe3b591f8185d63d068ab851bfb9e06dfe

Author: Gilles Chanteperdrix gilles.chanteperd...@xenomai.org
Date:   Thu Oct 30 22:05:39 2014 +0100

drivers/timerbench: add missing include

---

 kernel/drivers/testing/timerbench.c |1 +
 1 file changed, 1 insertion(+)

diff --git a/kernel/drivers/testing/timerbench.c 
b/kernel/drivers/testing/timerbench.c
index bc4f35d..2253bf5 100644
--- a/kernel/drivers/testing/timerbench.c
+++ b/kernel/drivers/testing/timerbench.c
@@ -23,6 +23,7 @@
 #include cobalt/kernel/arith.h
 #include rtdm/testing.h
 #include rtdm/driver.h
+#include rtdm/compat.h
 
 MODULE_DESCRIPTION(Timer latency test helper);
 MODULE_AUTHOR(Jan Kiszka jan.kis...@web.de);


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://www.xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Gilles Chanteperdrix : cobalt/timerfd: use O_NONBLOCK from fd flags, instead of local flags

2014-10-30 Thread git repository hosting
Module: xenomai-gch
Branch: for-forge
Commit: 608e53b2113527a7763786f963060cd5a46081a1
URL:
http://git.xenomai.org/?p=xenomai-gch.git;a=commit;h=608e53b2113527a7763786f963060cd5a46081a1

Author: Gilles Chanteperdrix gilles.chanteperd...@xenomai.org
Date:   Thu Oct 30 22:00:34 2014 +0100

cobalt/timerfd: use O_NONBLOCK from fd flags, instead of local flags

this makes changing the O_NONBLOCK flag possible with fcntl

---

 kernel/cobalt/posix/timerfd.c |5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/kernel/cobalt/posix/timerfd.c b/kernel/cobalt/posix/timerfd.c
index 7324ce9..93cbf01 100644
--- a/kernel/cobalt/posix/timerfd.c
+++ b/kernel/cobalt/posix/timerfd.c
@@ -66,7 +66,7 @@ static ssize_t timerfd_read(struct rtdm_fd *fd, void __user 
*buf, size_t size)
err = 0;
goto out;
}
-   if (tfd-flags  TFD_NONBLOCK) {
+   if (rtdm_fd_flags(fd)  O_NONBLOCK) {
err = -EAGAIN;
goto out;
}
@@ -188,7 +188,8 @@ COBALT_SYSCALL(timerfd_create, lostage,
goto fail_getfd;
}
 
-   tfd-flags = flags;
+   tfd-flags = flags  ~TFD_NONBLOCK;
+   tfd-fd.oflags = (flags  TFD_NONBLOCK) ? O_NONBLOCK : 0;
tfd-clockid = clockid;
curr = xnthread_current();
xntimer_init(tfd-timer, nkclock, timerfd_handler,


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://www.xenomai.org/mailman/listinfo/xenomai-git