[Xenomai-git] Philippe Gerum : powerpc: upgrade I-pipe support to 2.6.34-powerpc-2.10-02

2010-06-18 Thread GIT version control
Module: xenomai-rpm
Branch: for-upstream
Commit: 0357b3435fcc70dd0b416ecfe4cab463620dc3a7
URL:
http://git.xenomai.org/?p=xenomai-rpm.git;a=commit;h=0357b3435fcc70dd0b416ecfe4cab463620dc3a7

Author: Philippe Gerum 
Date:   Fri Jun 18 16:45:32 2010 +0200

powerpc: upgrade I-pipe support to 2.6.34-powerpc-2.10-02

---

 ... => adeos-ipipe-2.6.33.5-powerpc-2.10-03.patch} |   17 +
 1 files changed, 13 insertions(+), 4 deletions(-)

diff --git 
a/ksrc/arch/powerpc/patches/adeos-ipipe-2.6.33.5-powerpc-2.10-02.patch 
b/ksrc/arch/powerpc/patches/adeos-ipipe-2.6.33.5-powerpc-2.10-03.patch
similarity index 99%
rename from ksrc/arch/powerpc/patches/adeos-ipipe-2.6.33.5-powerpc-2.10-02.patch
rename to ksrc/arch/powerpc/patches/adeos-ipipe-2.6.33.5-powerpc-2.10-03.patch
index 9ae5e24..499ccf6 100644
--- a/ksrc/arch/powerpc/patches/adeos-ipipe-2.6.33.5-powerpc-2.10-02.patch
+++ b/ksrc/arch/powerpc/patches/adeos-ipipe-2.6.33.5-powerpc-2.10-03.patch
@@ -262,7 +262,7 @@ index bd100fc..8fa1901 100644
   * or should we not care like we do now ? --BenH.
 diff --git a/arch/powerpc/include/asm/ipipe.h 
b/arch/powerpc/include/asm/ipipe.h
 new file mode 100644
-index 000..8ec5cd7
+index 000..4e90de7
 --- /dev/null
 +++ b/arch/powerpc/include/asm/ipipe.h
 @@ -0,0 +1,276 @@
@@ -313,10 +313,10 @@ index 000..8ec5cd7
 +#include 
 +#endif
 +
-+#define IPIPE_ARCH_STRING "2.10-02"
++#define IPIPE_ARCH_STRING "2.10-03"
 +#define IPIPE_MAJOR_NUMBER2
 +#define IPIPE_MINOR_NUMBER10
-+#define IPIPE_PATCH_NUMBER2
++#define IPIPE_PATCH_NUMBER3
 +
 +#ifdef CONFIG_IPIPE_WANT_PREEMPTIBLE_SWITCH
 +
@@ -7250,7 +7250,7 @@ index 328bca6..4ed869d 100644
  
  #ifdef CONFIG_DEBUG_SPINLOCK_SLEEP
 diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h
-index 9ccf0e2..f500f1e 100644
+index 9ccf0e2..ec98e63 100644
 --- a/include/linux/lockdep.h
 +++ b/include/linux/lockdep.h
 @@ -395,7 +395,7 @@ do {   
\
@@ -7262,6 +7262,15 @@ index 9ccf0e2..f500f1e 100644
  
  /*
   * On lockdep we dont want the hand-coded irq-enable of
+@@ -403,7 +403,7 @@ do {   
\
+  * that interrupts are not re-enabled during lock-acquire:
+  */
+ #define LOCK_CONTENDED_FLAGS(_lock, try, lock, lockfl, flags) \
+-  LOCK_CONTENDED((_lock), (try), (lock))
++  LOCK_CONTENDED((_lock), (try), lock)
+ 
+ #else /* CONFIG_LOCKDEP */
+ 
 diff --git a/include/linux/preempt.h b/include/linux/preempt.h
 index 2e681d9..130b7d5 100644
 --- a/include/linux/preempt.h


___
Xenomai-git mailing list
Xenomai-git@gna.org
https://mail.gna.org/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : uitron: fix wait flag helper

2010-06-18 Thread GIT version control
Module: xenomai-2.5
Branch: master
Commit: bd1b54eac42c066985518788ec31427579b7cc15
URL:
http://git.xenomai.org/?p=xenomai-2.5.git;a=commit;h=bd1b54eac42c066985518788ec31427579b7cc15

Author: Philippe Gerum 
Date:   Mon May 31 18:54:44 2010 +0200

uitron: fix wait flag helper

All wait flag services from the uITRON emulator were missing the wait
mask and mode information in the sleeper TCB, so there is no way they
could ever work.

---

 ksrc/skins/uitron/flag.c |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/ksrc/skins/uitron/flag.c b/ksrc/skins/uitron/flag.c
index 8238ca7..c7f3c0d 100644
--- a/ksrc/skins/uitron/flag.c
+++ b/ksrc/skins/uitron/flag.c
@@ -316,6 +316,8 @@ static ER wai_flg_helper(UINT *p_flgptn,
task = ui_current_task();
 
xnthread_clear_info(&task->threadbase, uITRON_TASK_RLWAIT);
+   task->wargs.flag.wfmode = wfmode;
+   task->wargs.flag.waiptn = waiptn;
 
xnsynch_sleep_on(&flag->synchbase, timeout, XN_RELATIVE);
 


___
Xenomai-git mailing list
Xenomai-git@gna.org
https://mail.gna.org/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : nucleus: silence deprecated warnings on __builtin_expect for old compilers

2010-06-18 Thread GIT version control
Module: xenomai-2.5
Branch: master
Commit: 32d61eb649bf6eac822a8b80ba81922f887d63c6
URL:
http://git.xenomai.org/?p=xenomai-2.5.git;a=commit;h=32d61eb649bf6eac822a8b80ba81922f887d63c6

Author: Philippe Gerum 
Date:   Sat Jun  5 11:36:37 2010 +0200

nucleus: silence deprecated warnings on __builtin_expect for old compilers

---

 include/asm-powerpc/bits/pod.h |2 +-
 ksrc/nucleus/registry.c|2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/asm-powerpc/bits/pod.h b/include/asm-powerpc/bits/pod.h
index 6fe5e7b..7093b40 100644
--- a/include/asm-powerpc/bits/pod.h
+++ b/include/asm-powerpc/bits/pod.h
@@ -138,7 +138,7 @@ static inline void xnarch_switch_to(xnarchtcb_t *out_tcb,
}
 }
 #else /* PPC32 */
-   if (likely(next_mm)) {
+   if (likely(next_mm != NULL)) {
next->thread.pgdir = next_mm->pgd;
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29)
get_mmu_context(next_mm);
diff --git a/ksrc/nucleus/registry.c b/ksrc/nucleus/registry.c
index 53781f2..7dc7cf0 100644
--- a/ksrc/nucleus/registry.c
+++ b/ksrc/nucleus/registry.c
@@ -1037,7 +1037,7 @@ void *xnregistry_get(xnhandle_t handle)
xnlock_get_irqsave(&nklock, s);
 
object = xnregistry_validate(handle);
-   if (likely(object)) {
+   if (likely(object != NULL)) {
++object->safelock;
objaddr = object->objaddr;
} else


___
Xenomai-git mailing list
Xenomai-git@gna.org
https://mail.gna.org/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : rtai: mark as deprecated

2010-06-18 Thread GIT version control
Module: xenomai-2.5
Branch: master
Commit: 2b66eb3839defc67f60ca75f73b4437c6023411f
URL:
http://git.xenomai.org/?p=xenomai-2.5.git;a=commit;h=2b66eb3839defc67f60ca75f73b4437c6023411f

Author: Philippe Gerum 
Date:   Mon Jun  7 19:48:04 2010 +0200

rtai: mark as deprecated

Keeping this emulator does not make much sense anymore. Most people
who ported to Xenomai already moved to either the native or POSIX
APIs.

Additionally, this kernel-only emulator has no future in the next
Xenomai architecture, and it is very unlikely that anyone would bother
writing an LXRT emulator for Xenomai.

The RTAI emulator is scheduled for removal in Xenomai 2.6.x.

---

 ksrc/skins/rtai/Kconfig |7 ++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/ksrc/skins/rtai/Kconfig b/ksrc/skins/rtai/Kconfig
index 5c6a701..ac411eb 100644
--- a/ksrc/skins/rtai/Kconfig
+++ b/ksrc/skins/rtai/Kconfig
@@ -1,10 +1,15 @@
 menuconfig XENO_SKIN_RTAI
depends on XENO_OPT_NUCLEUS
-   tristate "RTAI emulator"
+   tristate "RTAI emulator (DEPRECATED)"
help
 
An emulator of the RTAI system.
 
+   WARNING: This emulator is DEPRECATED. It is planned for
+   removal in v2.6.x. Legacy applications depending on it should
+   be converted to the native Xenomai API, which provides
+   equivalent features, and more.
+
 if XENO_SKIN_RTAI
 
 config XENO_OPT_RTAI_PERIOD


___
Xenomai-git mailing list
Xenomai-git@gna.org
https://mail.gna.org/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : hal/generic: always track switch to foreign stack

2010-06-18 Thread GIT version control
Module: xenomai-2.5
Branch: master
Commit: 20dcd170c81a074eb0a12664f21d6213951fb9f2
URL:
http://git.xenomai.org/?p=xenomai-2.5.git;a=commit;h=20dcd170c81a074eb0a12664f21d6213951fb9f2

Author: Philippe Gerum 
Date:   Fri Jun  4 16:32:43 2010 +0200

hal/generic: always track switch to foreign stack

We do want to let the I-pipe know when we switch to a non-linux stack,
always.  So remove the condition on CONFIG_KGDB for tracking such
change.

---

 include/asm-generic/hal.h |6 --
 1 files changed, 0 insertions(+), 6 deletions(-)

diff --git a/include/asm-generic/hal.h b/include/asm-generic/hal.h
index 84c1a4d..f03219d 100644
--- a/include/asm-generic/hal.h
+++ b/include/asm-generic/hal.h
@@ -318,14 +318,8 @@ static inline void clear_task_nowakeup(struct task_struct 
*p)
 #define rthal_disable_ondemand_mappings(tsk)   (0)
 #endif /* !(VM_PINNED || MMF_VM_PINNED) */
 
-#ifdef CONFIG_KGDB
 #define rthal_set_foreign_stack(ipd)   ipipe_set_foreign_stack(ipd)
 #define rthal_clear_foreign_stack(ipd) ipipe_clear_foreign_stack(ipd)
-#else /* !CONFIG_KGDB */
-/* No need to track foreign stacks unless KGDB is active. */
-#define rthal_set_foreign_stack(ipd)   do { } while(0)
-#define rthal_clear_foreign_stack(ipd) do { } while(0)
-#endif /* CONFIG_KGDB */
 
 #define rthal_catch_cleanup(hdlr) \
 ipipe_catch_event(ipipe_root_domain,IPIPE_EVENT_CLEANUP,hdlr)


___
Xenomai-git mailing list
Xenomai-git@gna.org
https://mail.gna.org/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : compat: provide linux/err.h wrapper to linux/fs.h

2010-06-18 Thread GIT version control
Module: xenomai-2.5
Branch: master
Commit: cf8237e8d3203329abfc7bf6c1b810a3fbd88c19
URL:
http://git.xenomai.org/?p=xenomai-2.5.git;a=commit;h=cf8237e8d3203329abfc7bf6c1b810a3fbd88c19

Author: Philippe Gerum 
Date:   Sat Jun  5 11:34:02 2010 +0200

compat: provide linux/err.h wrapper to linux/fs.h

---

 include/compat/linux/err.h |   26 ++
 1 files changed, 26 insertions(+), 0 deletions(-)

diff --git a/include/compat/linux/err.h b/include/compat/linux/err.h
new file mode 100644
index 000..ae980db
--- /dev/null
+++ b/include/compat/linux/err.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (C) 2010 Philippe Gerum .
+ *
+ * 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.
+ *
+ */
+
+#ifndef _XENO_COMPAT_LINUX_ERR_H
+#define _XENO_COMPAT_LINUX_ERR_H
+
+#include 
+
+#endif /* _XENO_COMPAT_LINUX_ERR_H */


___
Xenomai-git mailing list
Xenomai-git@gna.org
https://mail.gna.org/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : build: check for CONFIG_MMU in user-space

2010-06-18 Thread GIT version control
Module: xenomai-2.5
Branch: master
Commit: 79008a73d85a16e25ad6c06cbc21b0333c5bc2bc
URL:
http://git.xenomai.org/?p=xenomai-2.5.git;a=commit;h=79008a73d85a16e25ad6c06cbc21b0333c5bc2bc

Author: Philippe Gerum 
Date:   Tue Jun 15 12:37:21 2010 +0200

build: check for CONFIG_MMU in user-space

---

 Makefile.in|  196 +-
 aclocal.m4 | 6980 +---
 config/Makefile.in |   46 +-
 configure  |  679 +-
 configure.in   |   17 +-
 doc/Makefile.in|  136 +-
 doc/docbook/Makefile.in|  136 +-
 doc/docbook/custom-stylesheets/Makefile.in |  136 +-
 doc/docbook/custom-stylesheets/xsl/Makefile.in |  136 +-
 .../custom-stylesheets/xsl/common/Makefile.in  |   46 +-
 doc/docbook/custom-stylesheets/xsl/fo/Makefile.in  |   46 +-
 .../custom-stylesheets/xsl/html/Makefile.in|   46 +-
 doc/docbook/xenomai/Makefile.in|   46 +-
 doc/doxygen/Makefile.in|   46 +-
 doc/man/Makefile.in|  218 +-
 doc/txt/Makefile.in|   85 +-
 include/Makefile.in|  197 +-
 include/analogy/Makefile.in|  110 +-
 include/asm-arm/Makefile.in|  175 +-
 include/asm-arm/bits/Makefile.in   |  110 +-
 include/asm-blackfin/Makefile.in   |  175 +-
 include/asm-blackfin/bits/Makefile.in  |  110 +-
 include/asm-generic/Makefile.in|  175 +-
 include/asm-generic/bits/Makefile.in   |  110 +-
 include/asm-nios2/Makefile.in  |  175 +-
 include/asm-nios2/bits/Makefile.in |  110 +-
 include/asm-powerpc/Makefile.in|  175 +-
 include/asm-powerpc/bits/Makefile.in   |  110 +-
 include/asm-sim/Makefile.in|  175 +-
 include/asm-sim/bits/Makefile.in   |  110 +-
 include/asm-x86/Makefile.in|  175 +-
 include/asm-x86/bits/Makefile.in   |  110 +-
 include/native/Makefile.in |  110 +-
 include/nucleus/Makefile.in|  110 +-
 include/posix/Makefile.in  |  175 +-
 include/posix/sys/Makefile.in  |  110 +-
 include/psos+/Makefile.in  |  110 +-
 include/rtai/Makefile.in   |  110 +-
 include/rtdm/Makefile.in   |  110 +-
 include/uitron/Makefile.in |  110 +-
 include/vrtx/Makefile.in   |  110 +-
 include/vxworks/Makefile.in|  110 +-
 scripts/Makefile.in|  107 +-
 src/Makefile.in|  136 +-
 src/drvlib/Makefile.in |  136 +-
 src/drvlib/analogy/Makefile.in |  154 +-
 src/include/Makefile.in|   50 +-
 src/include/xeno_config.h.in   |6 +
 src/rtdk/Makefile.in   |  142 +-
 src/skins/Makefile.in  |  136 +-
 src/skins/common/Makefile.in   |  148 +-
 src/skins/native/Makefile.in   |  208 +-
 src/skins/posix/Makefile.in|  196 +-
 src/skins/psos+/Makefile.in|  160 +-
 src/skins/rtai/Makefile.in |  130 +-
 src/skins/rtdm/Makefile.in |  130 +-
 src/skins/uitron/Makefile.in   |  148 +-
 src/skins/vrtx/Makefile.in |  184 +-
 src/skins/vxworks/Makefile.in  |  190 +-
 src/testsuite/Makefile.in  |  136 +-
 src/testsuite/clocktest/Makefile.in|  138 +-
 src/testsuite/cyclic/Makefile.in   |  138 +-
 src/testsuite/irqbench/Makefile.in |  142 +-
 src/testsuite/klatency/Makefile.in |  138 +-
 src/testsuite/latency/Makefile.in  |  138 +-
 src/testsuite/sigtest/Makefile.in  |  138 +-
 src/testsuite/switchtest/Makefile.in   |  138 +-
 src/testsuite/unit/Makefile.in |  170 +-
 src/utils/Makefile.in  |  136 +-
 src/utils/analogy/Makefile.in  |  190 +-
 src/utils/can/Makefile.in  |  190 +-
 src/utils/ps/Makefile.in   |  134 +-
 72 files changed, 6855 insertions(+), 9894 deletions(-)

Diff:   
http://git.xenomai.org/?p=xenomai-2.5.git;a=commitdiff;h=79008a73d85a16e25ad6c06cbc21b0333c5bc2bc

___
Xeno

[Xenomai-git] Philippe Gerum : skins: sanitize heap binding

2010-06-18 Thread GIT version control
Module: xenomai-2.5
Branch: master
Commit: bcd7078ddc7ac3ece81bf45279912691932b7205
URL:
http://git.xenomai.org/?p=xenomai-2.5.git;a=commit;h=bcd7078ddc7ac3ece81bf45279912691932b7205

Author: Philippe Gerum 
Date:   Sun Jun 13 17:27:06 2010 +0200

skins: sanitize heap binding

---

 include/nucleus/heap.h  |5 +++
 ksrc/nucleus/shadow.c   |   16 +++--
 src/skins/common/sem_heap.c |   76 +++
 src/skins/native/heap.c |   38 -
 src/skins/native/queue.c|   38 -
 src/skins/psos+/rn.c|   36 +++-
 src/skins/rtai/shm.c|   61 +++---
 src/skins/vrtx/heap.c   |   36 +++-
 src/skins/vrtx/pt.c |   36 +++-
 9 files changed, 90 insertions(+), 252 deletions(-)

diff --git a/include/nucleus/heap.h b/include/nucleus/heap.h
index fecdb79..f4ebe11 100644
--- a/include/nucleus/heap.h
+++ b/include/nucleus/heap.h
@@ -279,4 +279,9 @@ int xnheap_check_block(xnheap_t *heap,
 
 #define XNHEAP_DEV_NAME  "/dev/rtheap"
 
+struct xnheap_desc {
+   unsigned long handle;
+   unsigned int size;
+};
+
 #endif /* !_XENO_NUCLEUS_HEAP_H */
diff --git a/ksrc/nucleus/shadow.c b/ksrc/nucleus/shadow.c
index 1a32527..cc313cf 100644
--- a/ksrc/nucleus/shadow.c
+++ b/ksrc/nucleus/shadow.c
@@ -702,8 +702,7 @@ void __init xnheap_init_vdso(void)
 {
nkvdso = (struct xnvdso *)
xnheap_alloc(&__xnsys_global_ppd.sem_heap, sizeof(*nkvdso));
-
-   if (!nkvdso)
+   if (nkvdso == NULL)
xnpod_fatal("Xenomai: cannot allocate memory for xnvdso!\n");
 
nkvdso->features = XNVDSO_FEATURES;
@@ -1891,20 +1890,15 @@ static int xnshadow_sys_trace(struct pt_regs *regs)
return err;
 }
 
-struct heap_info {
-   xnheap_t *addr;
-   unsigned size;
-};
-
 static int xnshadow_sys_sem_heap(struct pt_regs *regs)
 {
-   struct heap_info hinfo, __user *us_hinfo;
+   struct xnheap_desc hinfo, __user *us_hinfo;
unsigned global;
 
global = __xn_reg_arg2(regs);
-   us_hinfo = (struct heap_info __user *) __xn_reg_arg1(regs);
-   hinfo.addr = &xnsys_ppd_get(global)->sem_heap;
-   hinfo.size = xnheap_extentsize(hinfo.addr);
+   us_hinfo = (struct xnheap_desc __user *) __xn_reg_arg1(regs);
+   hinfo.handle = (unsigned long)&xnsys_ppd_get(global)->sem_heap;
+   hinfo.size = xnheap_extentsize(&xnsys_ppd_get(global)->sem_heap);
 
return __xn_safe_copy_to_user(us_hinfo, &hinfo, sizeof(*us_hinfo));
 }
diff --git a/src/skins/common/sem_heap.c b/src/skins/common/sem_heap.c
index bf7031d..acb655b 100644
--- a/src/skins/common/sem_heap.c
+++ b/src/skins/common/sem_heap.c
@@ -11,62 +11,68 @@
 #include 
 
 #include 
+#include 
 #include 
 #include 
-
 #include "sem_heap.h"
 
 unsigned long xeno_sem_heap[2] = { 0, 0 };
+
 struct xnvdso *nkvdso;
 
-static void *map_sem_heap(unsigned shared)
+void *xeno_map_heap(unsigned long handle, unsigned int size)
 {
-   struct heap_info {
-   void *addr;
-   unsigned size;
-   } hinfo;
-   int fd, err;
+   int fd, ret;
+   void *addr;
 
-   fd = open("/dev/rtheap", O_RDWR, 0);
+   fd = open(XNHEAP_DEV_NAME, O_RDWR, 0);
if (fd < 0) {
-   fprintf(stderr, "Xenomai: open: %m\n");
+   perror("Xenomai: open");
return MAP_FAILED;
}
 
-   err = XENOMAI_SYSCALL2(__xn_sys_sem_heap, &hinfo, shared);
-   if (err < 0) {
-   fprintf(stderr, "Xenomai: sys_sem_heap: %m\n");
+   ret = ioctl(fd, 0, handle);
+   if (ret) {
+   perror("Xenomai: ioctl");
return MAP_FAILED;
}
 
-   err = ioctl(fd, 0, hinfo.addr);
-   if (err < 0) {
-   fprintf(stderr, "Xenomai: ioctl: %m\n");
-   return MAP_FAILED;
-   }
+   addr = mmap(NULL, size, PROT_READ|PROT_WRITE,
+   MAP_SHARED, fd, 0L);
 
-   hinfo.addr = mmap(NULL, hinfo.size,
- PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
close(fd);
 
-   return hinfo.addr;
+   return addr;
 }
 
-static void unmap_sem_heap(unsigned long heap_addr, unsigned shared)
+static void *map_sem_heap(unsigned int shared)
 {
-   struct heap_info {
-   void *addr;
-   unsigned size;
-   } hinfo;
-   int err;
+   struct xnheap_desc hinfo;
+   int ret;
 
-   err = XENOMAI_SYSCALL2(__xn_sys_sem_heap, &hinfo, shared);
-   if (err < 0) {
-   fprintf(stderr, "Xenomai: sys_sem_heap: %m\n");
+   ret = XENOMAI_SYSCALL2(__xn_sys_sem_heap, &hinfo, shared);
+   if (ret < 0) {
+   errno = -ret;
+   perror("Xenomai: sys_sem_heap");
+   return MAP_FAILED;
+   }
+
+   return xeno_map_heap(hinfo.handle, hinfo.size);
+}
+
+static void unmap_sem_heap(unsigned long heap_

[Xenomai-git] Philippe Gerum : wrappers: no need to reserve pages passed to vm_insert_page

2010-06-18 Thread GIT version control
Module: xenomai-2.5
Branch: master
Commit: b0ac5029b3c0180dced24cdee24e67a3ab719dd2
URL:
http://git.xenomai.org/?p=xenomai-2.5.git;a=commit;h=b0ac5029b3c0180dced24cdee24e67a3ab719dd2

Author: Philippe Gerum 
Date:   Wed Jun  9 09:35:58 2010 +0200

wrappers: no need to reserve pages passed to vm_insert_page

---

 include/asm-generic/wrappers.h |7 +++
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/include/asm-generic/wrappers.h b/include/asm-generic/wrappers.h
index ecc1867..a7349db 100644
--- a/include/asm-generic/wrappers.h
+++ b/include/asm-generic/wrappers.h
@@ -343,10 +343,9 @@ unsigned long find_next_bit(const unsigned long *addr,
 /* VM */
 
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,15) && defined(CONFIG_MMU)
-#define wrap_remap_vm_page(vma,from,to) ({ \
-vma->vm_flags |= VM_RESERVED; \
-vm_insert_page(vma,from,vmalloc_to_page((void *)to)); \
-})
+#define wrap_remap_vm_page(vma,from,to) \
+vm_insert_page(vma,from,vmalloc_to_page((void *)to))
+
 #define wrap_remap_io_page_range(vma,from,to,size,prot)  ({\
 (vma)->vm_page_prot = pgprot_noncached((vma)->vm_page_prot);   \
 /* Sets VM_RESERVED | VM_IO | VM_PFNMAP on the vma. */ \


___
Xenomai-git mailing list
Xenomai-git@gna.org
https://mail.gna.org/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : x86: upgrade I-pipe support to 2.6.32.15-x86-2.7-00, 2.6. 34-x86-2.7-00

2010-06-18 Thread GIT version control
Module: xenomai-2.5
Branch: master
Commit: b466bd76a1c385b3e3009d74970c7036e8bd39a5
URL:
http://git.xenomai.org/?p=xenomai-2.5.git;a=commit;h=b466bd76a1c385b3e3009d74970c7036e8bd39a5

Author: Philippe Gerum 
Date:   Wed Jun  9 11:32:52 2010 +0200

x86: upgrade I-pipe support to 2.6.32.15-x86-2.7-00, 2.6.34-x86-2.7-00

---

 .../patches/adeos-ipipe-2.6.32.13-x86-2.6-04.patch |11424 ---
 .../patches/adeos-ipipe-2.6.34-x86-2.6-04.patch|11613 
 2 files changed, 0 insertions(+), 23037 deletions(-)

Diff:   
http://git.xenomai.org/?p=xenomai-2.5.git;a=commitdiff;h=b466bd76a1c385b3e3009d74970c7036e8bd39a5

___
Xenomai-git mailing list
Xenomai-git@gna.org
https://mail.gna.org/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : nucleus: fix heap mapping for nommu

2010-06-18 Thread GIT version control
Module: xenomai-2.5
Branch: master
Commit: 177f7213619a2bfd72363d73678f549adc45129c
URL:
http://git.xenomai.org/?p=xenomai-2.5.git;a=commit;h=177f7213619a2bfd72363d73678f549adc45129c

Author: Philippe Gerum 
Date:   Sun Jun 13 21:49:01 2010 +0200

nucleus: fix heap mapping for nommu

Despite the kernel sees a single backing device with direct mapping
capabilities on nommu targets (/dev/rtheap), we do map different heaps
through it, so we want a brand new mapping region for each of
them. Therefore, we must make sure to request mappings on
non-overlapping areas.

To this end, we request mappings from offsets representing the start
RAM address of the heap memory instead of mapping from offset 0 like
previously.  Otherwise, the kernel could match the same region for
different heaps, for all mmap() requests directed to /dev/rtheap which
appear to be a subset of a previous one, i.e. [offset=0, length <=
largest mapped size to date]. Which does happen most of the time.

Basically, this also means that shared heap mapping on nommu systems
has always been badly broken on all Xenomai releases prior to this
commit. Yeepeee.

For this reason, we do break the nommu ABI to introduce this fix
(i.e. blackfin and nios2), simply because the previous implementation
did not work at all.

---

 include/asm-blackfin/features.h |2 +-
 include/asm-nios2/features.h|2 +-
 include/native/heap.h   |   14 +++--
 include/native/queue.h  |   14 +++--
 include/nucleus/heap.h  |   19 +++--
 include/vrtx/vrtx.h |8 ++---
 ksrc/nucleus/heap.c |   53 +--
 ksrc/nucleus/shadow.c   |   13 ++---
 ksrc/skins/native/syscall.c |7 +++--
 ksrc/skins/posix/syscall.c  |   10 +--
 ksrc/skins/psos+/syscall.c  |2 +
 ksrc/skins/vrtx/syscall.c   |4 +-
 src/skins/common/sem_heap.c |   41 +
 src/skins/native/heap.c |9 +-
 src/skins/native/queue.c|   10 ++-
 src/skins/psos+/rn.c|9 +-
 src/skins/rtai/shm.c|8 -
 src/skins/vrtx/heap.c   |8 -
 src/skins/vrtx/pt.c |8 -
 19 files changed, 152 insertions(+), 89 deletions(-)

diff --git a/include/asm-blackfin/features.h b/include/asm-blackfin/features.h
index 9dbee9c..c365c38 100644
--- a/include/asm-blackfin/features.h
+++ b/include/asm-blackfin/features.h
@@ -22,7 +22,7 @@
 #include 
 
 /* The ABI revision level we use on this arch. */
-#define XENOMAI_ABI_REV   3UL
+#define XENOMAI_ABI_REV   4UL
 
 #define XENOMAI_FEAT_DEP  __xn_feat_generic_mask
 
diff --git a/include/asm-nios2/features.h b/include/asm-nios2/features.h
index eb4589a..534c052 100644
--- a/include/asm-nios2/features.h
+++ b/include/asm-nios2/features.h
@@ -36,7 +36,7 @@ static inline void collect_arch_features(struct xnfeatinfo 
*finfo)
 #endif
 
 /* The ABI revision level we use on this arch. */
-#define XENOMAI_ABI_REV   1UL
+#define XENOMAI_ABI_REV   2UL
 
 #define XENOMAI_FEAT_DEP  __xn_feat_generic_mask
 
diff --git a/include/native/heap.h b/include/native/heap.h
index 0c2a7a2..443fd82 100644
--- a/include/native/heap.h
+++ b/include/native/heap.h
@@ -58,15 +58,11 @@ typedef struct rt_heap_info {
 } RT_HEAP_INFO;
 
 typedef struct rt_heap_placeholder {
-
-xnhandle_t opaque;
-
-void *opaque2;
-
-caddr_t mapbase;
-
-size_t mapsize;
-
+   xnhandle_t opaque;
+   void *opaque2;
+   caddr_t mapbase;
+   size_t mapsize;
+   xnheap_area_decl();
 } RT_HEAP_PLACEHOLDER;
 
 #if defined(__KERNEL__) || defined(__XENO_SIM__)
diff --git a/include/native/queue.h b/include/native/queue.h
index 2951c42..b266c1d 100644
--- a/include/native/queue.h
+++ b/include/native/queue.h
@@ -58,15 +58,11 @@ typedef struct rt_queue_info {
 } RT_QUEUE_INFO;
 
 typedef struct rt_queue_placeholder {
-
-xnhandle_t opaque;
-
-void *opaque2;
-
-caddr_t mapbase;
-
-size_t mapsize;
-
+   xnhandle_t opaque;
+   void *opaque2;
+   caddr_t mapbase;
+   size_t mapsize;
+   xnheap_area_decl();
 } RT_QUEUE_PLACEHOLDER;
 
 #if defined(__KERNEL__) || defined(__XENO_SIM__)
diff --git a/include/nucleus/heap.h b/include/nucleus/heap.h
index f4ebe11..e837bf2 100644
--- a/include/nucleus/heap.h
+++ b/include/nucleus/heap.h
@@ -208,14 +208,17 @@ void xnheap_destroy_mapped(xnheap_t *heap,
   void (*release)(struct xnheap *heap),
   void __user *mapaddr);
 
+#define xnheap_base_memory(heap) \
+   ((caddr_t)(heap)->archdep.heapbase)
+
 #define xnheap_mapped_offset(heap,ptr) \
-(((caddr_t)(ptr)) - ((caddr_t)(heap)->archdep.heapbase))
+   (((caddr_t)(ptr)) - xnheap_base_memory(heap))
 
 #define xnheap_mapped_address(heap,off) \
-(((caddr_t)(heap)->archdep.heapbase) + (off))
+   (xnheap_base_memory(heap) + (off))
 
 #define xnheap_mapped_p(heap) \
-((heap)->archdep.heapbase != NUL

[Xenomai-git] Philippe Gerum : powerpc: upgrade I-pipe support to 2.6.33.5-powerpc-2. 10-01, 2.6.34-powerpc-2.10-00

2010-06-18 Thread GIT version control
Module: xenomai-2.5
Branch: master
Commit: 59d66084bbc465ccb344ec4f07db0c94b212c37d
URL:
http://git.xenomai.org/?p=xenomai-2.5.git;a=commit;h=59d66084bbc465ccb344ec4f07db0c94b212c37d

Author: Philippe Gerum 
Date:   Wed Jun  9 11:31:28 2010 +0200

powerpc: upgrade I-pipe support to 2.6.33.5-powerpc-2.10-01, 
2.6.34-powerpc-2.10-00

---

 ksrc/arch/powerpc/patches/README   |8 +
 .../adeos-ipipe-2.6.30.3-powerpc-DENX-2.7-06.patch |11728 
 ... => adeos-ipipe-2.6.33.5-powerpc-2.10-01.patch} |  460 +-
 ...ch => adeos-ipipe-2.6.34-powerpc-2.10-00.patch} |  428 +-
 4 files changed, 548 insertions(+), 12076 deletions(-)

Diff:   
http://git.xenomai.org/?p=xenomai-2.5.git;a=commitdiff;h=59d66084bbc465ccb344ec4f07db0c94b212c37d

___
Xenomai-git mailing list
Xenomai-git@gna.org
https://mail.gna.org/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : nucleus: introduce generic bits for MAYDAY support

2010-06-18 Thread GIT version control
Module: xenomai-2.5
Branch: master
Commit: c4564431d6304249f49a7cd3005b96bdd6c59b23
URL:
http://git.xenomai.org/?p=xenomai-2.5.git;a=commit;h=c4564431d6304249f49a7cd3005b96bdd6c59b23

Author: Philippe Gerum 
Date:   Sat Jun  5 11:39:24 2010 +0200

nucleus: introduce generic bits for MAYDAY support

This patch enables the nucleus to force a user-space thread running
syscall-less code in primary mode, to call the nucleus back on its way
out from an interrupt via a dedicated syscall (__xn_sys_mayday).

This feature is currently useful for recovering gracefully from a
runaway thread situation detected by the nucleus watchdog. Instead of
killing the runaway thread bluntly, this feature allows to force a
relax on it, despite the syscall-less nature of the code it was
running in primary mode.

The trick is to force the thread to run a piece of user-space code
that issues the mayday syscall, by fixing up its program counter on
its way back to userland. This code is laid on the special "mayday
page", mapped to the process address space at binding time. The
implementation relies on the new IPIPE_EVENT_RETURN notification
available from the latest I-pipe patches, to run the fixup code.

In the future, Xenomai real-time signals will be rebased on this
feature to make them able to preempt syscall-less code as well.  In
the same move, the mayday page allocation and setup should move to
user-space. We do this from kernel space for now only to preserve the
2.5.x ABI.

---

 include/asm-generic/hal.h |   28 ++-
 include/asm-generic/syscall.h |1 +
 include/nucleus/ppd.h |4 +
 include/nucleus/shadow.h  |   10 ++
 ksrc/nucleus/sched.c  |1 +
 ksrc/nucleus/shadow.c |  186 ++---
 6 files changed, 216 insertions(+), 14 deletions(-)

diff --git a/include/asm-generic/hal.h b/include/asm-generic/hal.h
index f03219d..f90cafa 100644
--- a/include/asm-generic/hal.h
+++ b/include/asm-generic/hal.h
@@ -259,7 +259,7 @@ static int hdlr (unsigned event, struct ipipe_domain *ipd, 
void *data) \
 static int hdlr (unsigned event, struct ipipe_domain *ipd, void *data) \
 {  \
struct task_struct *p = (struct task_struct *)data; \
-   do_##hdlr(p,p->rt_priority);\
+   do_##hdlr(p, p->rt_priority);   \
return RTHAL_EVENT_PROPAGATE;   \
 }
 
@@ -287,6 +287,14 @@ static int hdlr (unsigned event, struct ipipe_domain *ipd, 
void *data) \
return RTHAL_EVENT_PROPAGATE;  \
 }
 
+#define RTHAL_DECLARE_MAYDAY_EVENT(hdlr) \
+static int hdlr(unsigned event, struct ipipe_domain *ipd, void *data) \
+{\
+   struct pt_regs *regs = data;  \
+   do_##hdlr(regs);  \
+   return RTHAL_EVENT_PROPAGATE; \
+}
+
 #ifndef TASK_ATOMICSWITCH
 #ifdef CONFIG_PREEMPT
 /* We want this feature for preemptible kernels, or the behaviour when
@@ -321,6 +329,15 @@ static inline void clear_task_nowakeup(struct task_struct 
*p)
 #define rthal_set_foreign_stack(ipd)   ipipe_set_foreign_stack(ipd)
 #define rthal_clear_foreign_stack(ipd) ipipe_clear_foreign_stack(ipd)
 
+#ifdef __IPIPE_FEATURE_ENABLE_NOTIFIER
+#define rthal_enable_notifier(p)   ipipe_enable_notifier(p)
+#else
+static inline void rthal_enable_notifier(struct task_struct *p)
+{
+   p->flags |= PF_EVNOTIFY;
+}
+#endif
+
 #define rthal_catch_cleanup(hdlr) \
 ipipe_catch_event(ipipe_root_domain,IPIPE_EVENT_CLEANUP,hdlr)
 #define rthal_catch_taskexit(hdlr) \
@@ -338,6 +355,15 @@ static inline void clear_task_nowakeup(struct task_struct 
*p)
 #define rthal_catch_exception(ex,hdlr) \
 ipipe_catch_event(&rthal_domain,ex|IPIPE_EVENT_SELF,hdlr)
 
+#ifdef IPIPE_EVENT_RETURN
+#define RTHAL_HAVE_RETURN_EVENT
+#define rthal_catch_return(hdlr) \
+ipipe_catch_event(&rthal_domain,IPIPE_EVENT_RETURN,hdlr)
+#define rthal_return_intercept(p)  ipipe_return_notify(p)
+#else
+#define rthal_catch_return(hdlr)   do { } while(0)
+#endif
+
 #define rthal_register_domain(_dom,_name,_id,_prio,_entry) \
 ({ \
struct ipipe_domain_attr attr;  \
diff --git a/include/asm-generic/syscall.h b/include/asm-generic/syscall.h
index 3f10065..7e3d01a 100644
--- a/include/asm-generic/syscall.h
+++ b/include/asm-generic/syscall.h
@@ -47,6 +47,7 @@
 #define __xn_sys_current_info  9   /* r = xnshadow_current_info(&info) */
 #define __xn_sys_get_next_sigs 10  /* only unqueue pending signals. */
 #define __xn_sys_drop_u_mode   11  /* stop updating thread->u_mode */
+#define __xn

[Xenomai-git] Philippe Gerum : arm: upgrade I-pipe support to 2.6.33-arm-1.17-00

2010-06-18 Thread GIT version control
Module: xenomai-2.5
Branch: master
Commit: cf8000c2116ac5a081b96bb69c5c00ab4557fd5d
URL:
http://git.xenomai.org/?p=xenomai-2.5.git;a=commit;h=cf8000c2116ac5a081b96bb69c5c00ab4557fd5d

Author: Philippe Gerum 
Date:   Sat Jun 12 09:38:33 2010 +0200

arm: upgrade I-pipe support to 2.6.33-arm-1.17-00

---

 patch => adeos-ipipe-2.6.33-arm-1.17-00.patch} |  263 +---
 1 files changed, 168 insertions(+), 95 deletions(-)

diff --git a/ksrc/arch/arm/patches/adeos-ipipe-2.6.33-arm-1.16-01.patch 
b/ksrc/arch/arm/patches/adeos-ipipe-2.6.33-arm-1.17-00.patch
similarity index 98%
rename from ksrc/arch/arm/patches/adeos-ipipe-2.6.33-arm-1.16-01.patch
rename to ksrc/arch/arm/patches/adeos-ipipe-2.6.33-arm-1.17-00.patch
index cbb3fb6..d2ab300 100644
--- a/ksrc/arch/arm/patches/adeos-ipipe-2.6.33-arm-1.16-01.patch
+++ b/ksrc/arch/arm/patches/adeos-ipipe-2.6.33-arm-1.17-00.patch
@@ -630,7 +630,7 @@ index 000..cfdf14a
 +#endif /* __ASM_ARM_FCSE_H */
 diff --git a/arch/arm/include/asm/ipipe.h b/arch/arm/include/asm/ipipe.h
 new file mode 100644
-index 000..8ae0cb3
+index 000..ada91f3
 --- /dev/null
 +++ b/arch/arm/include/asm/ipipe.h
 @@ -0,0 +1,274 @@
@@ -665,10 +665,10 @@ index 000..8ae0cb3
 +#include 
 +#include /* For __IPIPE_FEATURE_PIC_MUTE */
 +
-+#define IPIPE_ARCH_STRING "1.16-01"
++#define IPIPE_ARCH_STRING "1.17-00"
 +#define IPIPE_MAJOR_NUMBER1
-+#define IPIPE_MINOR_NUMBER16
-+#define IPIPE_PATCH_NUMBER1
++#define IPIPE_MINOR_NUMBER17
++#define IPIPE_PATCH_NUMBER0
 +
 +#ifdef CONFIG_SMP
 +#error "I-pipe/arm: SMP not yet implemented"
@@ -880,7 +880,7 @@ index 000..8ae0cb3
 +} while(0)
 +
 +#define __ipipe_syscall_watched_p(p, sc)  \
-+  (((p)->flags & PF_EVNOTIFY) || (unsigned long)sc >= __ARM_NR_BASE + 64)
++  (ipipe_notifier_enabled_p(p) || (unsigned long)sc >= __ARM_NR_BASE + 64)
 +
 +#define __ipipe_root_tick_p(regs) (!raw_irqs_disabled_flags(regs->ARM_cpsr))
 +
@@ -910,10 +910,10 @@ index 000..8ae0cb3
 +#endif/* !__ARM_IPIPE_H */
 diff --git a/arch/arm/include/asm/ipipe_base.h 
b/arch/arm/include/asm/ipipe_base.h
 new file mode 100644
-index 000..20e97a4
+index 000..f78523d
 --- /dev/null
 +++ b/arch/arm/include/asm/ipipe_base.h
-@@ -0,0 +1,108 @@
+@@ -0,0 +1,109 @@
 +/* -*- linux-c -*-
 + * arch/arm/include/asm/ipipe_base.h
 + *
@@ -966,7 +966,8 @@ index 000..20e97a4
 +#define IPIPE_EVENT_INIT  (IPIPE_FIRST_EVENT + 4)
 +#define IPIPE_EVENT_EXIT  (IPIPE_FIRST_EVENT + 5)
 +#define IPIPE_EVENT_CLEANUP   (IPIPE_FIRST_EVENT + 6)
-+#define IPIPE_LAST_EVENT  IPIPE_EVENT_CLEANUP
++#define IPIPE_EVENT_RETURN(IPIPE_FIRST_EVENT + 7)
++#define IPIPE_LAST_EVENT  IPIPE_EVENT_RETURN
 +#define IPIPE_NR_EVENTS   (IPIPE_LAST_EVENT + 1)
 +
 +#ifndef __ASSEMBLY__
@@ -2706,10 +2707,10 @@ index 000..1b9550c
 +#endif /* CONFIG_ARM_FCSE_MESSAGES */
 diff --git a/arch/arm/kernel/ipipe.c b/arch/arm/kernel/ipipe.c
 new file mode 100644
-index 000..41b1013
+index 000..0ee9ee1
 --- /dev/null
 +++ b/arch/arm/kernel/ipipe.c
-@@ -0,0 +1,549 @@
+@@ -0,0 +1,571 @@
 +/* -*- linux-c -*-
 + * linux/arch/arm/kernel/ipipe.c
 + *
@@ -3062,11 +3063,17 @@ index 000..41b1013
 +asmlinkage int __ipipe_syscall_root(unsigned long scno, struct pt_regs *regs)
 +{
 +  struct ipipe_percpu_domain_data *p;
-+  unsigned long flags, origr7;
++  unsigned long orig_r7;
++int ret = 0;
 +
-+  /* We use r7 to pass the syscall number to the other domains */
-+  origr7 = regs->ARM_r7;
++  WARN_ON_ONCE(irqs_disabled_hw());
++
++  /*
++   * We use r7 to pass the syscall number to the other domains.
++   */
++  orig_r7 = regs->ARM_r7;
 +  regs->ARM_r7 = __NR_SYSCALL_BASE + scno;
++
 +  /*
 +   * This routine either returns:
 +   * 0 -- if the syscall is to be passed to Linux;
@@ -3076,32 +3083,36 @@ index 000..41b1013
 +   * tail work has to be performed (for handling signals etc).
 +   */
 +
-+  WARN_ON_ONCE(irqs_disabled_hw());
-+
 +  if (!__ipipe_syscall_watched_p(current, regs->ARM_r7) ||
 +  !__ipipe_event_monitored_p(IPIPE_EVENT_SYSCALL))
-+  goto done;
++  goto out;
 +
-+  if (__ipipe_dispatch_event(IPIPE_EVENT_SYSCALL,regs) > 0){
-+  if (ipipe_root_domain_p && !in_atomic()) {
-+  /*
-+   * Sync pending VIRQs before _TIF_NEED_RESCHED
-+   * is tested.
-+   */
-+  local_irq_save_hw(flags);
-+  p = ipipe_root_cpudom_ptr();
-+  if (__ipipe_ipending_p(p))
-+  __ipipe_sync_pipeline(IPIPE_IRQ_DOVIRT);
-+  local_irq_restore_hw(flags);
-+  regs->ARM_r7 = origr7;
-+  return -1;
-+  }
-+  regs->ARM_r7 = orig

[Xenomai-git] Philippe Gerum : powerpc: enable MAYDAY support

2010-06-18 Thread GIT version control
Module: xenomai-2.5
Branch: master
Commit: 805bd0e1b3bedc2846f542c6018e32fab45fe23d
URL:
http://git.xenomai.org/?p=xenomai-2.5.git;a=commit;h=805bd0e1b3bedc2846f542c6018e32fab45fe23d

Author: Philippe Gerum 
Date:   Sat Jun  5 11:57:40 2010 +0200

powerpc: enable MAYDAY support

---

 include/asm-powerpc/bits/shadow.h |   61 +
 include/asm-powerpc/system.h  |8 -
 2 files changed, 68 insertions(+), 1 deletions(-)

diff --git a/include/asm-powerpc/bits/shadow.h 
b/include/asm-powerpc/bits/shadow.h
index 47b65a2..7f3554e 100644
--- a/include/asm-powerpc/bits/shadow.h
+++ b/include/asm-powerpc/bits/shadow.h
@@ -27,6 +27,12 @@
 #error "Pure kernel header included from user-space!"
 #endif
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
+#include 
+#else
+#include 
+#endif
+
 static inline void xnarch_init_shadow_tcb(xnarchtcb_t * tcb,
  struct xnthread *thread,
  const char *name)
@@ -59,4 +65,59 @@ static inline int xnarch_local_syscall(struct pt_regs *regs)
 
 #define xnarch_schedule_tail(prev) do { } while(0)
 
+#ifdef XNARCH_HAVE_MAYDAY
+
+static inline void xnarch_setup_mayday_page(void *page)
+{
+   /*
+* We want this code to appear at the top of the MAYDAY page:
+*
+* 3c 00 0b 00  lis r0,mux_c...@h
+* 60 00 02 2b  ori r0,r0,mux_c...@l
+* 39 00 00 00  li  r8,0
+* 44 00 00 02  sc
+* 00 b0 0b 00  .long   0x00b00b00 
+*
+* We don't mess with CCR here, so no need to save/restore it
+* in handle/fixup code.
+*/
+   u32 mux, insn[5];
+
+   mux = __xn_mux_code(0, __xn_sys_mayday);
+   insn[0] = 0x3c00 | (mux >> 16);
+   insn[1] = 0x6000 | (mux & 0x);
+   insn[2] = 0x3900;
+   insn[3] = 0x4402;
+   insn[4] = 0x00b00b00;
+   memcpy(page, insn, sizeof(insn));
+
+   flush_dcache_range((unsigned long)page,
+  (unsigned long)page + sizeof(insn));
+}
+
+static inline void xnarch_call_mayday(void)
+{
+   rthal_return_intercept(current);
+}
+
+static inline void xnarch_handle_mayday(struct xnarchtcb *tcb,
+   struct pt_regs *regs,
+   unsigned long tramp)
+{
+   tcb->mayday.nip = regs->nip;
+   tcb->mayday.r0 = regs->gpr[0];
+   tcb->mayday.r8 = regs->gpr[8];
+   regs->nip = tramp;
+}
+
+static inline void xnarch_fixup_mayday(struct xnarchtcb *tcb,
+  struct pt_regs *regs)
+{
+   regs->nip = tcb->mayday.nip;
+   regs->gpr[0] = tcb->mayday.r0;
+   regs->gpr[8] = tcb->mayday.r8;
+}
+
+#endif /* XNARCH_HAVE_MAYDAY */
+
 #endif /* !_XENO_ASM_POWERPC_BITS_SHADOW_H */
diff --git a/include/asm-powerpc/system.h b/include/asm-powerpc/system.h
index 0e1072a..4044f43 100644
--- a/include/asm-powerpc/system.h
+++ b/include/asm-powerpc/system.h
@@ -51,7 +51,13 @@ typedef struct xnarchtcb {   /* Per-thread arch-dependent 
block */
struct thread_struct *tsp;  /* Pointer to the active thread struct 
(&ts or &user->thread). */
struct mm_struct *mm;
struct mm_struct *active_mm;
-
+#ifdef XNARCH_HAVE_MAYDAY
+   struct {
+   unsigned long nip;
+   unsigned long r0;
+   unsigned long r8;
+   } mayday;
+#endif
/* Kernel mode side */
struct thread_struct ts;/* Holds kernel-based thread context. */
 #ifdef CONFIG_XENO_HW_UNLOCKED_SWITCH


___
Xenomai-git mailing list
Xenomai-git@gna.org
https://mail.gna.org/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : x86: enable MAYDAY support

2010-06-18 Thread GIT version control
Module: xenomai-2.5
Branch: master
Commit: 8eb115a9f7217c0c95712ce469a4e1a5e55e15d9
URL:
http://git.xenomai.org/?p=xenomai-2.5.git;a=commit;h=8eb115a9f7217c0c95712ce469a4e1a5e55e15d9

Author: Philippe Gerum 
Date:   Sun Jun  6 16:25:36 2010 +0200

x86: enable MAYDAY support

---

 include/asm-x86/bits/shadow_32.h |  111 ++
 include/asm-x86/bits/shadow_64.h |   71 
 include/asm-x86/system_32.h  |7 +++
 include/asm-x86/system_64.h  |7 +++
 4 files changed, 196 insertions(+), 0 deletions(-)

diff --git a/include/asm-x86/bits/shadow_32.h b/include/asm-x86/bits/shadow_32.h
index 9fc37a2..40ccc62 100644
--- a/include/asm-x86/bits/shadow_32.h
+++ b/include/asm-x86/bits/shadow_32.h
@@ -49,4 +49,115 @@ static void xnarch_schedule_tail(struct task_struct *prev)
wrap_switch_iobitmap(prev, rthal_processor_id());
 }
 
+#ifdef XNARCH_HAVE_MAYDAY
+
+static inline void xnarch_setup_mayday_page(void *page)
+{
+   /*
+* We want this code to appear at the top of the MAYDAY page:
+*
+*  b8 2b 02 00 0c  mov$,%eax
+*  bd 00 00 00 00  mov$0x0,%ebp
+* if HAVE_SEP
+*  65 ff 15 10 00 00 00call   *%gs:0x10
+* else
+*  cd 80   int$0x80
+* endif
+*  0f 0b   ud2a
+*
+* We intentionally don't mess with EFLAGS here, so that we
+* don't have to save/restore it in handle/fixup code.
+*
+* Also note that if SEP is present, we always assume NPTL on
+* the user side.
+*/
+   static const struct {
+   struct __attribute__ ((__packed__)) {
+   u8 op;
+   u32 imm;
+   } mov_eax;
+   struct __attribute__ ((__packed__)) {
+   u8 op;
+   u32 imm;
+   } mov_ebp;
+   struct __attribute__ ((__packed__)) {
+   u8 op[3];
+   u32 moffs;
+   } syscall;
+   u16 bug;
+   } code_sep = {
+   .mov_eax = {
+   .op = 0xb8,
+   .imm = __xn_mux_code(0, __xn_sys_mayday)
+   },
+   .mov_ebp = {
+   .op = 0xbd,
+   .imm = 0
+   },
+   .syscall = {
+   .op = {
+   0x65, 0xff, 0x15
+   },
+   .moffs = 0x10
+   },
+   .bug = 0x0b0f,
+   };
+
+   static const struct {
+   struct __attribute__ ((__packed__)) {
+   u8 op;
+   u32 imm;
+   } mov_eax;
+   struct __attribute__ ((__packed__)) {
+   u8 op;
+   u32 imm;
+   } mov_ebp;
+   u16 syscall;
+   u16 bug;
+   } code_nosep = {
+   .mov_eax = {
+   .op = 0xb8,
+   .imm = __xn_mux_code(0, __xn_sys_mayday)
+   },
+   .mov_ebp = {
+   .op = 0xbd,
+   .imm = 0
+   },
+   .syscall = 0x80cd,
+   .bug = 0x0b0f,
+   };
+
+   if (cpu_has_sep)
+   memcpy(page, &code_sep, sizeof(code_sep));
+   else
+   memcpy(page, &code_nosep, sizeof(code_nosep));
+
+   /* no cache flush required. */
+}
+
+static inline void xnarch_call_mayday(void)
+{
+   rthal_return_intercept(current);
+}
+
+static inline void xnarch_handle_mayday(struct xnarchtcb *tcb,
+   struct pt_regs *regs,
+   unsigned long tramp)
+{
+   tcb->mayday.eip = regs->x86reg_ip;
+   tcb->mayday.eax = regs->x86reg_ax;
+   tcb->mayday.ebp = regs->x86reg_bp;
+   regs->x86reg_ip = tramp;
+}
+
+static inline void xnarch_fixup_mayday(struct xnarchtcb *tcb,
+  struct pt_regs *regs)
+{
+   regs->x86reg_ip = tcb->mayday.eip;
+   regs->x86reg_ax = tcb->mayday.eax;
+   regs->x86reg_bp = tcb->mayday.ebp;
+}
+
+#endif /* XNARCH_HAVE_MAYDAY */
+
 #endif /* !_XENO_ASM_X86_BITS_SHADOW_32_H */
diff --git a/include/asm-x86/bits/shadow_64.h b/include/asm-x86/bits/shadow_64.h
index ddaa86a..41a266f 100644
--- a/include/asm-x86/bits/shadow_64.h
+++ b/include/asm-x86/bits/shadow_64.h
@@ -52,4 +52,75 @@ static void xnarch_schedule_tail(struct task_struct *prev)
 {
 }
 
+#ifdef XNARCH_HAVE_MAYDAY
+
+static inline void xnarch_setup_mayday_page(void *page)
+{
+   /*
+* We want this code to appear at the top of the MAYDAY page:
+*
+*  b8 2b 02 00 0c  mov$,%eax
+*  49 c7 c1 00 00 00 00mov$0x0,%r9

[Xenomai-git] Philippe Gerum : x86: upgrade I-pipe support to 2.6.32.15-x86-2.7-00, 2.6. 34-x86-2.7-00

2010-06-18 Thread GIT version control
Module: xenomai-2.5
Branch: master
Commit: 02592473ab3bf55d2779b6c2f05d045d56e71118
URL:
http://git.xenomai.org/?p=xenomai-2.5.git;a=commit;h=02592473ab3bf55d2779b6c2f05d045d56e71118

Author: Philippe Gerum 
Date:   Wed Jun  9 14:47:01 2010 +0200

x86: upgrade I-pipe support to 2.6.32.15-x86-2.7-00, 2.6.34-x86-2.7-00

---

 .../patches/adeos-ipipe-2.6.32.15-x86-2.7-00.patch |11475 +++
 .../patches/adeos-ipipe-2.6.34-x86-2.7-00.patch|11570 
 2 files changed, 23045 insertions(+), 0 deletions(-)

Diff:   
http://git.xenomai.org/?p=xenomai-2.5.git;a=commitdiff;h=02592473ab3bf55d2779b6c2f05d045d56e71118

___
Xenomai-git mailing list
Xenomai-git@gna.org
https://mail.gna.org/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : nios2: enable MAYDAY support

2010-06-18 Thread GIT version control
Module: xenomai-2.5
Branch: master
Commit: ba722b2c61e8cfb029cc2188e1e395a996846844
URL:
http://git.xenomai.org/?p=xenomai-2.5.git;a=commit;h=ba722b2c61e8cfb029cc2188e1e395a996846844

Author: Philippe Gerum 
Date:   Mon Jun 14 18:24:14 2010 +0200

nios2: enable MAYDAY support

---

 include/asm-nios2/bits/shadow.h |   65 +++
 include/asm-nios2/system.h  |8 +
 2 files changed, 73 insertions(+), 0 deletions(-)

diff --git a/include/asm-nios2/bits/shadow.h b/include/asm-nios2/bits/shadow.h
index 1d1969a..8917045 100644
--- a/include/asm-nios2/bits/shadow.h
+++ b/include/asm-nios2/bits/shadow.h
@@ -24,6 +24,8 @@
 #error "Pure kernel header included from user-space!"
 #endif
 
+#include 
+
 static inline void xnarch_init_shadow_tcb(xnarchtcb_t * tcb,
  struct xnthread *thread,
  const char *name)
@@ -63,4 +65,67 @@ static inline int xnarch_local_syscall(struct pt_regs *regs)
 
 #define xnarch_schedule_tail(prev) do { } while(0)
 
+#ifdef XNARCH_HAVE_MAYDAY
+
+static inline void xnarch_setup_mayday_page(void *page)
+{
+   /*
+* We want this code to appear at the top of the MAYDAY page:
+*
+*  00c00334movhi   r3,#__xn_sys_mayday
+*  18c08ac4addir3,r3,#__xn_sys_mux
+*  0084movir2,0
+*  0244movir9,0
+*  003b683atrap
+*  003fff06br  .
+*/
+   static const struct {
+   u32 movhi_r3h;
+   u32 addi_r3l;
+   u32 movi_r2;
+   u32 movi_r9;
+   u32 syscall;
+   u32 bug;
+   } code = {
+   .movhi_r3h = 0x00c00334,
+   .addi_r3l = 0x18c08ac4,
+   .movi_r2 = 0x0084,
+   .movi_r9 = 0x0244,
+   .syscall = 0x003b683a,
+   .bug = 0x003fff06
+   };
+
+   memcpy(page, &code, sizeof(code));
+
+   flush_dcache_range((unsigned long)page,
+  (unsigned long)page + sizeof(code));
+}
+
+static inline void xnarch_call_mayday(void)
+{
+   rthal_return_intercept(current);
+}
+
+static inline void xnarch_handle_mayday(struct xnarchtcb *tcb,
+   struct pt_regs *regs,
+   unsigned long tramp)
+{
+   tcb->mayday.ea = regs->ea;
+   tcb->mayday.r2 = regs->r2;
+   tcb->mayday.r3 = regs->r3;
+   tcb->mayday.r9 = regs->r9;
+   regs->ea = tramp;
+}
+
+static inline void xnarch_fixup_mayday(struct xnarchtcb *tcb,
+  struct pt_regs *regs)
+{
+   regs->ea = tcb->mayday.ea;
+   regs->r2 = tcb->mayday.r2;
+   regs->r3 = tcb->mayday.r3;
+   regs->r9 = tcb->mayday.r9;
+}
+
+#endif /* XNARCH_HAVE_MAYDAY */
+
 #endif /* !_XENO_ASM_NIOS2_BITS_SHADOW_H */
diff --git a/include/asm-nios2/system.h b/include/asm-nios2/system.h
index 65426d1..a31aadf 100644
--- a/include/asm-nios2/system.h
+++ b/include/asm-nios2/system.h
@@ -48,6 +48,14 @@ typedef struct xnarchtcb {   /* Per-thread arch-dependent 
block */
struct thread_struct ts;/* Holds kernel-based thread context. */
struct task_struct *user_task;  /* Shadowed user-space task */
struct thread_struct *tsp;  /* Active thread struct */
+#ifdef XNARCH_HAVE_MAYDAY
+   struct {
+   unsigned long ea;
+   unsigned long r2;
+   unsigned long r3;
+   unsigned long r9;
+   } mayday;
+#endif
 
/* Init block */
struct xnthread *self;


___
Xenomai-git mailing list
Xenomai-git@gna.org
https://mail.gna.org/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : blackfin: enable MAYDAY support

2010-06-18 Thread GIT version control
Module: xenomai-2.5
Branch: master
Commit: e495d2a7d26ac68c70b9d8a8e83863151cfa3c25
URL:
http://git.xenomai.org/?p=xenomai-2.5.git;a=commit;h=e495d2a7d26ac68c70b9d8a8e83863151cfa3c25

Author: Philippe Gerum 
Date:   Sun Jun 13 17:26:05 2010 +0200

blackfin: enable MAYDAY support

---

 include/asm-blackfin/bits/shadow.h |   78 
 include/asm-blackfin/system.h  |7 +++
 2 files changed, 85 insertions(+), 0 deletions(-)

diff --git a/include/asm-blackfin/bits/shadow.h 
b/include/asm-blackfin/bits/shadow.h
index f44d25d..1a77fe4 100644
--- a/include/asm-blackfin/bits/shadow.h
+++ b/include/asm-blackfin/bits/shadow.h
@@ -24,6 +24,8 @@
 #error "Pure kernel header included from user-space!"
 #endif
 
+#include 
+
 static inline void xnarch_init_shadow_tcb(xnarchtcb_t * tcb,
  struct xnthread *thread,
  const char *name)
@@ -66,4 +68,80 @@ static inline int xnarch_local_syscall(struct pt_regs *regs)
 
 #define xnarch_schedule_tail(prev) do { } while(0)
 
+#ifdef XNARCH_HAVE_MAYDAY
+
+static inline void xnarch_setup_mayday_page(void *page)
+{
+   /*
+* We want this code to appear at the top of the MAYDAY page:
+*
+* 45 e1 0c 00R5.H = 0xc
+* 05 e1 2b 02R5.L = 0x22b
+* 05 32  P0 = R5
+* 05 60  R5 = 0x0 (X)
+* a0 00  EXCPT 0x0
+* cd ef  
+*
+* We don't mess with ASTAT here, so no need to save/restore
+* it in handle/fixup code.
+*/
+   static const struct {
+   struct __attribute__ ((__packed__)) {
+   u16 op;
+   u16 imm;
+   } load_r5h;
+   struct __attribute__ ((__packed__)) {
+   u16 op;
+   u16 imm;
+   } load_r5l;
+   u16 mov_p0;
+   u16 clear_r5;
+   u16 syscall;
+   u16 bug;
+   } code = {
+   .load_r5h = {
+   .op = 0xe145,
+   .imm = __xn_mux_code(0, __xn_sys_mayday) >> 16
+   },
+   .load_r5l = {
+   .op = 0xe105,
+   .imm = __xn_mux_code(0, __xn_sys_mayday) & 0x
+   },
+   .mov_p0 = 0x3205,
+   .clear_r5 = 0x6005,
+   .syscall = 0x00a0,
+   .bug = BFIN_BUG_OPCODE,
+   };
+
+   memcpy(page, &code, sizeof(code));
+
+   flush_dcache_range((unsigned long)page,
+  (unsigned long)page + sizeof(code));
+}
+
+static inline void xnarch_call_mayday(void)
+{
+   rthal_return_intercept(current);
+}
+
+static inline void xnarch_handle_mayday(struct xnarchtcb *tcb,
+   struct pt_regs *regs,
+   unsigned long tramp)
+{
+   tcb->mayday.pc = regs->pc;
+   tcb->mayday.p0 = regs->p0;
+   tcb->mayday.r5 = regs->r5;
+   regs->pc = tramp;   /* i.e. RETI */
+}
+
+static inline void xnarch_fixup_mayday(struct xnarchtcb *tcb,
+  struct pt_regs *regs)
+{
+   regs->pc = tcb->mayday.pc;
+   regs->p0 = tcb->mayday.p0;
+   regs->r5 = tcb->mayday.r5;
+}
+
+#endif /* XNARCH_HAVE_MAYDAY */
+
 #endif /* !_XENO_ASM_BLACKFIN_BITS_SHADOW_H */
diff --git a/include/asm-blackfin/system.h b/include/asm-blackfin/system.h
index f7a46b2..b4be882 100644
--- a/include/asm-blackfin/system.h
+++ b/include/asm-blackfin/system.h
@@ -53,6 +53,13 @@ typedef struct xnarchtcb {   /* Per-thread arch-dependent 
block */
 struct task_struct *active_task;/* Active user-space task */
 #endif
 struct thread_struct *tsp; /* Pointer to the active thread struct (&ts or 
&user->thread). */
+#ifdef XNARCH_HAVE_MAYDAY
+   struct {
+   unsigned long pc;
+   unsigned long p0;
+   unsigned long r5;
+   } mayday;
+#endif
 
 /* Init block */
 struct xnthread *self;


___
Xenomai-git mailing list
Xenomai-git@gna.org
https://mail.gna.org/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : x86: upgrade I-pipe support to 2.6.32.15-x86-2.7-02, 2.6. 34-x86-2.7-01

2010-06-18 Thread GIT version control
Module: xenomai-2.5
Branch: master
Commit: 192e2bbc3680cc633e7c3aac4056ad27046f512d
URL:
http://git.xenomai.org/?p=xenomai-2.5.git;a=commit;h=192e2bbc3680cc633e7c3aac4056ad27046f512d

Author: Philippe Gerum 
Date:   Mon Jun 14 11:48:11 2010 +0200

x86: upgrade I-pipe support to 2.6.32.15-x86-2.7-02, 2.6.34-x86-2.7-01

---

 .../patches/adeos-ipipe-2.6.30.8-x86-2.4-09.patch  |11438 
 ...atch => adeos-ipipe-2.6.32.15-x86-2.7-01.patch} |   11 +-
 ...0.patch => adeos-ipipe-2.6.34-x86-2.7-02.patch} |   34 +-
 3 files changed, 31 insertions(+), 11452 deletions(-)

Diff:   
http://git.xenomai.org/?p=xenomai-2.5.git;a=commitdiff;h=192e2bbc3680cc633e7c3aac4056ad27046f512d

___
Xenomai-git mailing list
Xenomai-git@gna.org
https://mail.gna.org/listinfo/xenomai-git


[Xenomai-git] Gilles Chanteperdrix : rtcan: add missing PCI IDs for old kernels

2010-06-18 Thread GIT version control
Module: xenomai-2.5
Branch: master
Commit: 1bcf8f4da4f72ccf4057cbb776da37631d60f834
URL:
http://git.xenomai.org/?p=xenomai-2.5.git;a=commit;h=1bcf8f4da4f72ccf4057cbb776da37631d60f834

Author: Gilles Chanteperdrix 
Date:   Sat Jun 12 14:46:27 2010 +0200

rtcan: add missing PCI IDs for old kernels

---

 include/asm-generic/pci_ids.h |3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/include/asm-generic/pci_ids.h b/include/asm-generic/pci_ids.h
index b10cdf3..7bb9c29 100644
--- a/include/asm-generic/pci_ids.h
+++ b/include/asm-generic/pci_ids.h
@@ -21,5 +21,8 @@
 #ifndef PCI_DEVICE_ID_PLX_9030
 #define PCI_DEVICE_ID_PLX_9030 0x9030
 #endif
+#ifndef PCI_DEVICE_ID_PLX_9056
+#define PCI_DEVICE_ID_PLX_9056 0x9056
+#endif
 
 #endif /* _XENO_ASM_GENERIC_PCI_IDS_H */


___
Xenomai-git mailing list
Xenomai-git@gna.org
https://mail.gna.org/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : arm: upgrade I-pipe support to 2.6.33-arm-1.17-01

2010-06-18 Thread GIT version control
Module: xenomai-2.5
Branch: master
Commit: 66bcd5d93d7b936653b333c13f8df3cdac02a4b9
URL:
http://git.xenomai.org/?p=xenomai-2.5.git;a=commit;h=66bcd5d93d7b936653b333c13f8df3cdac02a4b9

Author: Philippe Gerum 
Date:   Mon Jun 14 11:45:16 2010 +0200

arm: upgrade I-pipe support to 2.6.33-arm-1.17-01

---

 patch => adeos-ipipe-2.6.33-arm-1.17-01.patch} |   11 ++-
 1 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/ksrc/arch/arm/patches/adeos-ipipe-2.6.33-arm-1.17-00.patch 
b/ksrc/arch/arm/patches/adeos-ipipe-2.6.33-arm-1.17-01.patch
similarity index 99%
rename from ksrc/arch/arm/patches/adeos-ipipe-2.6.33-arm-1.17-00.patch
rename to ksrc/arch/arm/patches/adeos-ipipe-2.6.33-arm-1.17-01.patch
index d2ab300..22f5d3f 100644
--- a/ksrc/arch/arm/patches/adeos-ipipe-2.6.33-arm-1.17-00.patch
+++ b/ksrc/arch/arm/patches/adeos-ipipe-2.6.33-arm-1.17-01.patch
@@ -630,7 +630,7 @@ index 000..cfdf14a
 +#endif /* __ASM_ARM_FCSE_H */
 diff --git a/arch/arm/include/asm/ipipe.h b/arch/arm/include/asm/ipipe.h
 new file mode 100644
-index 000..ada91f3
+index 000..f8880e0
 --- /dev/null
 +++ b/arch/arm/include/asm/ipipe.h
 @@ -0,0 +1,274 @@
@@ -665,10 +665,10 @@ index 000..ada91f3
 +#include 
 +#include /* For __IPIPE_FEATURE_PIC_MUTE */
 +
-+#define IPIPE_ARCH_STRING "1.17-00"
++#define IPIPE_ARCH_STRING "1.17-01"
 +#define IPIPE_MAJOR_NUMBER1
 +#define IPIPE_MINOR_NUMBER17
-+#define IPIPE_PATCH_NUMBER0
++#define IPIPE_PATCH_NUMBER1
 +
 +#ifdef CONFIG_SMP
 +#error "I-pipe/arm: SMP not yet implemented"
@@ -10835,10 +10835,10 @@ index 000..6257dfa
 +obj-$(CONFIG_IPIPE_TRACE) += tracer.o
 diff --git a/kernel/ipipe/core.c b/kernel/ipipe/core.c
 new file mode 100644
-index 000..fdb84db
+index 000..75f5d42
 --- /dev/null
 +++ b/kernel/ipipe/core.c
-@@ -0,0 +1,1970 @@
+@@ -0,0 +1,1971 @@
 +/* -*- linux-c -*-
 + * linux/kernel/ipipe/core.c
 + *
@@ -12797,6 +12797,7 @@ index 000..fdb84db
 +EXPORT_SYMBOL(ipipe_send_ipi);
 +EXPORT_SYMBOL(__ipipe_pend_irq);
 +EXPORT_SYMBOL(__ipipe_set_irq_pending);
++EXPORT_SYMBOL(__ipipe_event_monitors);
 +#if defined(CONFIG_IPIPE_DEBUG_INTERNAL) && defined(CONFIG_SMP)
 +EXPORT_SYMBOL(__ipipe_check_percpu_access);
 +#endif


___
Xenomai-git mailing list
Xenomai-git@gna.org
https://mail.gna.org/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : powerpc: upgrade I-pipe support to 2.6.33.5-powerpc-2. 10-03, 2.6.34-powerpc-2.10-02

2010-06-18 Thread GIT version control
Module: xenomai-2.5
Branch: master
Commit: f6b1bc862eef5b6013b2aa755ea0ffaff7d0df35
URL:
http://git.xenomai.org/?p=xenomai-2.5.git;a=commit;h=f6b1bc862eef5b6013b2aa755ea0ffaff7d0df35

Author: Philippe Gerum 
Date:   Mon Jun 14 11:47:15 2010 +0200

powerpc: upgrade I-pipe support to 2.6.33.5-powerpc-2.10-03, 
2.6.34-powerpc-2.10-02

---

 ... => adeos-ipipe-2.6.33.5-powerpc-2.10-03.patch} |   22 +---
 ...ch => adeos-ipipe-2.6.34-powerpc-2.10-02.patch} |   34 ++-
 2 files changed, 41 insertions(+), 15 deletions(-)

diff --git 
a/ksrc/arch/powerpc/patches/adeos-ipipe-2.6.33.5-powerpc-2.10-01.patch 
b/ksrc/arch/powerpc/patches/adeos-ipipe-2.6.33.5-powerpc-2.10-03.patch
similarity index 99%
rename from ksrc/arch/powerpc/patches/adeos-ipipe-2.6.33.5-powerpc-2.10-01.patch
rename to ksrc/arch/powerpc/patches/adeos-ipipe-2.6.33.5-powerpc-2.10-03.patch
index 8cf975e..499ccf6 100644
--- a/ksrc/arch/powerpc/patches/adeos-ipipe-2.6.33.5-powerpc-2.10-01.patch
+++ b/ksrc/arch/powerpc/patches/adeos-ipipe-2.6.33.5-powerpc-2.10-03.patch
@@ -262,7 +262,7 @@ index bd100fc..8fa1901 100644
   * or should we not care like we do now ? --BenH.
 diff --git a/arch/powerpc/include/asm/ipipe.h 
b/arch/powerpc/include/asm/ipipe.h
 new file mode 100644
-index 000..b8befae
+index 000..4e90de7
 --- /dev/null
 +++ b/arch/powerpc/include/asm/ipipe.h
 @@ -0,0 +1,276 @@
@@ -313,10 +313,10 @@ index 000..b8befae
 +#include 
 +#endif
 +
-+#define IPIPE_ARCH_STRING "2.10-01"
++#define IPIPE_ARCH_STRING "2.10-03"
 +#define IPIPE_MAJOR_NUMBER2
 +#define IPIPE_MINOR_NUMBER10
-+#define IPIPE_PATCH_NUMBER1
++#define IPIPE_PATCH_NUMBER3
 +
 +#ifdef CONFIG_IPIPE_WANT_PREEMPTIBLE_SWITCH
 +
@@ -7250,7 +7250,7 @@ index 328bca6..4ed869d 100644
  
  #ifdef CONFIG_DEBUG_SPINLOCK_SLEEP
 diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h
-index 9ccf0e2..f500f1e 100644
+index 9ccf0e2..ec98e63 100644
 --- a/include/linux/lockdep.h
 +++ b/include/linux/lockdep.h
 @@ -395,7 +395,7 @@ do {   
\
@@ -7262,6 +7262,15 @@ index 9ccf0e2..f500f1e 100644
  
  /*
   * On lockdep we dont want the hand-coded irq-enable of
+@@ -403,7 +403,7 @@ do {   
\
+  * that interrupts are not re-enabled during lock-acquire:
+  */
+ #define LOCK_CONTENDED_FLAGS(_lock, try, lock, lockfl, flags) \
+-  LOCK_CONTENDED((_lock), (try), (lock))
++  LOCK_CONTENDED((_lock), (try), lock)
+ 
+ #else /* CONFIG_LOCKDEP */
+ 
 diff --git a/include/linux/preempt.h b/include/linux/preempt.h
 index 2e681d9..130b7d5 100644
 --- a/include/linux/preempt.h
@@ -7871,10 +7880,10 @@ index 000..6257dfa
 +obj-$(CONFIG_IPIPE_TRACE) += tracer.o
 diff --git a/kernel/ipipe/core.c b/kernel/ipipe/core.c
 new file mode 100644
-index 000..fdb84db
+index 000..75f5d42
 --- /dev/null
 +++ b/kernel/ipipe/core.c
-@@ -0,0 +1,1970 @@
+@@ -0,0 +1,1971 @@
 +/* -*- linux-c -*-
 + * linux/kernel/ipipe/core.c
 + *
@@ -9833,6 +9842,7 @@ index 000..fdb84db
 +EXPORT_SYMBOL(ipipe_send_ipi);
 +EXPORT_SYMBOL(__ipipe_pend_irq);
 +EXPORT_SYMBOL(__ipipe_set_irq_pending);
++EXPORT_SYMBOL(__ipipe_event_monitors);
 +#if defined(CONFIG_IPIPE_DEBUG_INTERNAL) && defined(CONFIG_SMP)
 +EXPORT_SYMBOL(__ipipe_check_percpu_access);
 +#endif
diff --git a/ksrc/arch/powerpc/patches/adeos-ipipe-2.6.34-powerpc-2.10-00.patch 
b/ksrc/arch/powerpc/patches/adeos-ipipe-2.6.34-powerpc-2.10-02.patch
similarity index 99%
rename from ksrc/arch/powerpc/patches/adeos-ipipe-2.6.34-powerpc-2.10-00.patch
rename to ksrc/arch/powerpc/patches/adeos-ipipe-2.6.34-powerpc-2.10-02.patch
index aa050eb..8f27969 100644
--- a/ksrc/arch/powerpc/patches/adeos-ipipe-2.6.34-powerpc-2.10-00.patch
+++ b/ksrc/arch/powerpc/patches/adeos-ipipe-2.6.34-powerpc-2.10-02.patch
@@ -262,7 +262,7 @@ index bd100fc..8fa1901 100644
   * or should we not care like we do now ? --BenH.
 diff --git a/arch/powerpc/include/asm/ipipe.h 
b/arch/powerpc/include/asm/ipipe.h
 new file mode 100644
-index 000..f345359
+index 000..8aa91f0
 --- /dev/null
 +++ b/arch/powerpc/include/asm/ipipe.h
 @@ -0,0 +1,277 @@
@@ -313,10 +313,10 @@ index 000..f345359
 +#include 
 +#endif
 +
-+#define IPIPE_ARCH_STRING "2.10-00"
++#define IPIPE_ARCH_STRING "2.10-02"
 +#define IPIPE_MAJOR_NUMBER2
 +#define IPIPE_MINOR_NUMBER10
-+#define IPIPE_PATCH_NUMBER0
++#define IPIPE_PATCH_NUMBER2
 +
 +#ifdef CONFIG_IPIPE_WANT_PREEMPTIBLE_SWITCH
 +
@@ -6074,10 +6074,10 @@ index 000..fa1a951
 +#endif/* !__LINUX_IPIPE_BASE_H */
 diff --git a/include/linux/ipipe_lock.h b/include/linux/ipipe_lock.h
 new file mode 100644
-index 000..73ed46a
+index 000..032080f
 --- /dev/null
 +++ b/include/linux/ipipe_lock.h
-@@ -0,0 +1,215 @@
+@@ -0,0 +1,230 @@
 +/*   -*- linux-c -*-
 + *   include/linux/ipipe_lock.h
 + *
@@ -6143,6 +6143,19 @@ index 000..73ed46a
 +  __ret__; 

[Xenomai-git] Pavel Cheblakov : rtcan: add rtcan_plx_pci driver

2010-06-18 Thread GIT version control
Module: xenomai-2.5
Branch: master
Commit: 078977ad8680cfcae857a4753b9036e78d187d4b
URL:
http://git.xenomai.org/?p=xenomai-2.5.git;a=commit;h=078977ad8680cfcae857a4753b9036e78d187d4b

Author: Pavel Cheblakov 
Date:   Tue Jun  1 21:41:02 2010 +0700

rtcan: add rtcan_plx_pci driver

This is a general driver for cards based on PLX90xx PCI-bridges.
It supports following cards:
 - Adlink PCI-7841/cPCI-7841 card (http://www.adlinktech.com/)
 - Adlink PCI-7841/cPCI-7841 SE card
 - esd CAN-PCI/CPCI/PCI104/200 (http://www.esd.eu/)
 - esd CAN-PCI/PMC/266
 - esd CAN-PCIe/2000
 - Marathon CAN-bus-PCI card (http://www.marathon.ru/)
 - TEWS TECHNOLOGIES TPMC810 card (http://www.tews.com/)

This driver has been ported from socketcan of mainline Linux kernel 2.6.34.
Support of esd cards has been added by Matthias Fuchs in linux-next

'rtcan_esd_pci' driver marked as deprecated.

Signed-off-by: Pavel Cheblakov 

---

 ksrc/drivers/can/sja1000/Kconfig |   20 +-
 ksrc/drivers/can/sja1000/Makefile|7 +
 ksrc/drivers/can/sja1000/rtcan_plx_pci.c |  608 ++
 3 files changed, 633 insertions(+), 2 deletions(-)

diff --git a/ksrc/drivers/can/sja1000/Kconfig b/ksrc/drivers/can/sja1000/Kconfig
index 56f4691..fdb12dc 100644
--- a/ksrc/drivers/can/sja1000/Kconfig
+++ b/ksrc/drivers/can/sja1000/Kconfig
@@ -41,6 +41,21 @@ config XENO_DRIVERS_CAN_SJA1000_IXXAT_PCI
the second channel working, Xenomai's shared interrupt support
must be enabled.
 
+config XENO_DRIVERS_CAN_SJA1000_PLX_PCI
+   depends on XENO_DRIVERS_CAN_SJA1000 && PCI
+   tristate "PLX90xx PCI-bridge based Cards"
+   help
+
+   This driver is for CAN interface cards based on
+   the PLX90xx PCI bridge.
+   Driver supports now:
+- Adlink PCI-7841/cPCI-7841 card (http://www.adlinktech.com/)
+- Adlink PCI-7841/cPCI-7841 SE card
+- esd CAN-PCI/CPCI/PCI104/200 (http://www.esd.eu/)
+- esd CAN-PCI/PMC/266
+- esd CAN-PCIe/2000
+- Marathon CAN-bus-PCI card (http://www.marathon.ru/)
+- TEWS TECHNOLOGIES TPMC810 card (http://www.tews.com/)
 
 config XENO_DRIVERS_CAN_SJA1000_EMS_PCI
depends on XENO_DRIVERS_CAN_SJA1000 && PCI
@@ -51,10 +66,9 @@ config XENO_DRIVERS_CAN_SJA1000_EMS_PCI
Wünsche (http://www.ems-wuensche.de). To get the second channel
working, Xenomai's shared interrupt support must be enabled.
 
-
 config XENO_DRIVERS_CAN_SJA1000_ESD_PCI
depends on XENO_DRIVERS_CAN_SJA1000 && PCI
-   tristate "ESD PCI Cards"
+   tristate "ESD PCI Cards (DEPRECATED)"
help
 
This driver supports the esd PCI CAN cards CAN-PCI/200,
@@ -62,6 +76,8 @@ config XENO_DRIVERS_CAN_SJA1000_ESD_PCI
CAN-PCIe2000 (PCI Express) and CAN-PCI104/200 (PCI104)
from the esd electronic system design gmbh (http://www.esd.eu).
 
+   This driver is deprecated. It's functionality is now provided by
+   "PLX90xx PCI-bridge based Cards" driver.
 
 config XENO_DRIVERS_CAN_SJA1000_PEAK_DNG
depends on XENO_DRIVERS_CAN_SJA1000 && !PARPORT
diff --git a/ksrc/drivers/can/sja1000/Makefile 
b/ksrc/drivers/can/sja1000/Makefile
index 09a03ab..389ca04 100644
--- a/ksrc/drivers/can/sja1000/Makefile
+++ b/ksrc/drivers/can/sja1000/Makefile
@@ -7,6 +7,7 @@ EXTRA_CFLAGS += -D__IN_XENOMAI__ -Iinclude/xenomai 
-Idrivers/xenomai/can -Idrive
 obj-$(CONFIG_XENO_DRIVERS_CAN_SJA1000) += xeno_can_sja1000.o
 obj-$(CONFIG_XENO_DRIVERS_CAN_SJA1000_PEAK_PCI) += xeno_can_peak_pci.o
 obj-$(CONFIG_XENO_DRIVERS_CAN_SJA1000_PEAK_DNG) += xeno_can_peak_dng.o
+obj-$(CONFIG_XENO_DRIVERS_CAN_SJA1000_PLX_PCI) += xeno_can_plx_pci.o
 obj-$(CONFIG_XENO_DRIVERS_CAN_SJA1000_IXXAT_PCI) += xeno_can_ixxat_pci.o
 obj-$(CONFIG_XENO_DRIVERS_CAN_SJA1000_EMS_PCI) += xeno_can_ems_pci.o
 obj-$(CONFIG_XENO_DRIVERS_CAN_SJA1000_ESD_PCI) += xeno_can_esd_pci.o
@@ -16,6 +17,7 @@ obj-$(CONFIG_XENO_DRIVERS_CAN_SJA1000_MEM) += xeno_can_mem.o
 xeno_can_sja1000-y := rtcan_sja1000.o rtcan_sja1000_proc.o
 xeno_can_peak_pci-y := rtcan_peak_pci.o
 xeno_can_peak_dng-y := rtcan_peak_dng.o
+xeno_can_plx_pci-y := rtcan_plx_pci.o
 xeno_can_ixxat_pci-y := rtcan_ixxat_pci.o
 xeno_can_ems_pci-y := rtcan_ems_pci.o
 xeno_can_esd_pci-y := rtcan_esd_pci.o
@@ -31,6 +33,7 @@ O_TARGET := built-in.o
 obj-$(CONFIG_XENO_DRIVERS_CAN_SJA1000) += xeno_can_sja1000.o 
 obj-$(CONFIG_XENO_DRIVERS_CAN_SJA1000_PEAK_PCI) += xeno_can_peak_pci.o 
 obj-$(CONFIG_XENO_DRIVERS_CAN_SJA1000_PEAK_DNG) += xeno_can_peak_dng.o 
+obj-$(CONFIG_XENO_DRIVERS_CAN_SJA1000_PLX_PCI) += xeno_can_plx_pci.o
 obj-$(CONFIG_XENO_DRIVERS_CAN_SJA1000_IXXAT_PCI) += xeno_can_ixxat_pci.o
 obj-$(CONFIG_XENO_DRIVERS_CAN_SJA1000_EMS_PCI) += xeno_can_ems_pci.o
 obj-$(CONFIG_XENO_DRIVERS_CAN_SJA1000_ESD_PCI) += xeno_can_esd_pci.o
@@ -42,6 +45,7 @@ list-multi := xeno_can_sja1000.o
 xeno_can_sja1000-objs := rtcan_sja1000.o rtcan_sja1000_proc.o
 xeno_can_peak_pci-objs := rtcan_peak_pci.o
 xeno_can_peak_dng-objs := rtcan_peak_d

[Xenomai-git] Philippe Gerum : nucleus: fix uninit variable

2010-06-18 Thread GIT version control
Module: xenomai-2.5
Branch: master
Commit: e796a2f3b5c52698dff6048bbb2d2085ddad140a
URL:
http://git.xenomai.org/?p=xenomai-2.5.git;a=commit;h=e796a2f3b5c52698dff6048bbb2d2085ddad140a

Author: Philippe Gerum 
Date:   Tue Jun 15 23:49:51 2010 +0200

nucleus: fix uninit variable

---

 ksrc/nucleus/select.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/ksrc/nucleus/select.c b/ksrc/nucleus/select.c
index 29be0bc..656671d 100644
--- a/ksrc/nucleus/select.c
+++ b/ksrc/nucleus/select.c
@@ -179,7 +179,7 @@ EXPORT_SYMBOL_GPL(__xnselect_signal);
 void xnselect_destroy(struct xnselect *select_block)
 {
xnholder_t *holder;
-   int resched;
+   int resched = 0;
spl_t s;
 
xnlock_get_irqsave(&nklock, s);


___
Xenomai-git mailing list
Xenomai-git@gna.org
https://mail.gna.org/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : rtdm: fix memory mapping services for nommu platforms

2010-06-18 Thread GIT version control
Module: xenomai-2.5
Branch: master
Commit: 8c05ad4fbbbd72ab0d02fff21319f0ccd0a93492
URL:
http://git.xenomai.org/?p=xenomai-2.5.git;a=commit;h=8c05ad4fbbbd72ab0d02fff21319f0ccd0a93492

Author: Philippe Gerum 
Date:   Wed Jun 16 10:25:24 2010 +0200

rtdm: fix memory mapping services for nommu platforms

This patch is a follow-up to ada72009a, fixing the
rtdm_mmap/iomap_to_user() services, in the nommu case.

The rationale for it is that backing devices on nommu must have direct
mapping capabilities to support shared mapping requests (MAP_SHARED),
which are not available from /dev/zero.

We fix this by using /dev/rtheap instead of /dev/zero for issuing
non-anonymous mapping requests from rtdm_do_mmap(), since default caps
for character-based devices include BDI_CAP_MAP_DIRECT. In the same
move, we provide the missing .get_unmapped_area helper.

---

 include/compat/linux/err.h |2 +
 ksrc/skins/rtdm/drvlib.c   |   62 +--
 2 files changed, 49 insertions(+), 15 deletions(-)

diff --git a/include/compat/linux/err.h b/include/compat/linux/err.h
index ae980db..81a6134 100644
--- a/include/compat/linux/err.h
+++ b/include/compat/linux/err.h
@@ -23,4 +23,6 @@
 
 #include 
 
+#define IS_ERR_VALUE(value) IS_ERR((void *)value)
+
 #endif /* _XENO_COMPAT_LINUX_ERR_H */
diff --git a/ksrc/skins/rtdm/drvlib.c b/ksrc/skins/rtdm/drvlib.c
index 68a661c..3495e63 100644
--- a/ksrc/skins/rtdm/drvlib.c
+++ b/ksrc/skins/rtdm/drvlib.c
@@ -37,6 +37,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -1808,9 +1809,8 @@ static int rtdm_mmap_buffer(struct file *filp, struct 
vm_area_struct *vma)
 
vaddr = (unsigned long)mmap_data->src_vaddr;
paddr = mmap_data->src_paddr;
-   if (!paddr)
-   /* kmalloc memory */
-   paddr = virt_to_phys((void *)vaddr);
+   if (paddr == 0) /* kmalloc memory? */
+   paddr = __pa(vaddr);
 
maddr = vma->vm_start;
size = vma->vm_end - vma->vm_start;
@@ -1834,6 +1834,8 @@ static int rtdm_mmap_buffer(struct file *filp, struct 
vm_area_struct *vma)
xnarch_fault_range(vma);
ret = 0;
} else
+#else
+   vma->vm_pgoff = paddr >> PAGE_SHIFT;
 #endif /* CONFIG_MMU */
if (mmap_data->src_paddr)
ret = xnarch_remap_io_page_range(filp, vma, maddr, paddr,
@@ -1848,22 +1850,43 @@ static int rtdm_mmap_buffer(struct file *filp, struct 
vm_area_struct *vma)
return ret;
 }
 
+#ifndef CONFIG_MMU
+static unsigned long rtdm_unmapped_area(struct file *file,
+   unsigned long addr,
+   unsigned long len,
+   unsigned long pgoff,
+   unsigned long flags)
+{
+   struct rtdm_mmap_data *mmap_data = file->private_data;
+   unsigned long pa;
+
+   pa = mmap_data->src_paddr;
+   if (pa == 0)
+   pa = __pa(mmap_data->src_vaddr);
+
+   return pa;
+}
+#else
+#define rtdm_unmapped_area  NULL
+#endif
+
 static struct file_operations rtdm_mmap_fops = {
.mmap = rtdm_mmap_buffer,
+   .get_unmapped_area = rtdm_unmapped_area
 };
 
 static int rtdm_do_mmap(rtdm_user_info_t *user_info,
struct rtdm_mmap_data *mmap_data,
size_t len, int prot, void **pptr)
 {
-   struct file *filp;
const struct file_operations *old_fops;
+   unsigned long u_addr;
void *old_priv_data;
-   void *user_ptr;
+   struct file *filp;
 
XENO_ASSERT(RTDM, xnpod_root_p(), return -EPERM;);
 
-   filp = filp_open("/dev/zero", O_RDWR, 0);
+   filp = filp_open(XNHEAP_DEV_NAME, O_RDWR, 0);
if (IS_ERR(filp))
return PTR_ERR(filp);
 
@@ -1874,8 +1897,8 @@ static int rtdm_do_mmap(rtdm_user_info_t *user_info,
filp->private_data = mmap_data;
 
down_write(&user_info->mm->mmap_sem);
-   user_ptr = (void *)do_mmap(filp, (unsigned long)*pptr, len, prot,
-  MAP_SHARED, 0);
+   u_addr = do_mmap(filp, (unsigned long)*pptr, len, prot,
+MAP_SHARED, 0);
up_write(&user_info->mm->mmap_sem);
 
filp->f_op = (typeof(filp->f_op))old_fops;
@@ -1883,10 +1906,11 @@ static int rtdm_do_mmap(rtdm_user_info_t *user_info,
 
filp_close(filp, user_info->files);
 
-   if (IS_ERR(user_ptr))
-   return PTR_ERR(user_ptr);
+   if (IS_ERR_VALUE(u_addr))
+   return (int)u_addr;
+
+   *pptr = (void *)u_addr;
 
-   *pptr = user_ptr;
return 0;
 }
 
@@ -1950,8 +1974,12 @@ int rtdm_mmap_to_user(rtdm_user_info_t *user_info,
  struct vm_operations_struct *vm_ops,
  void *vm_private_data)
 {
-   struct rtdm_mmap_data mmap_data =
-   { src_addr, 0, vm_ops, vm_private_data };
+   struct rtdm_mmap_data mmap_data = {
+

[Xenomai-git] Philippe Gerum : rtai: disable for MMU-less and 64bit builds

2010-06-18 Thread GIT version control
Module: xenomai-2.5
Branch: master
Commit: e105a8cdd0930a61e0ca9709acf4d190302cf5a0
URL:
http://git.xenomai.org/?p=xenomai-2.5.git;a=commit;h=e105a8cdd0930a61e0ca9709acf4d190302cf5a0

Author: Philippe Gerum 
Date:   Wed Jun 16 08:33:33 2010 +0200

rtai: disable for MMU-less and 64bit builds

This emulator is massively broken on those platforms, and fixing it
would require an ABI change, which would make no sense given that it
is on its way out.

---

 ksrc/skins/rtai/Kconfig |8 ++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/ksrc/skins/rtai/Kconfig b/ksrc/skins/rtai/Kconfig
index ac411eb..2555354 100644
--- a/ksrc/skins/rtai/Kconfig
+++ b/ksrc/skins/rtai/Kconfig
@@ -1,10 +1,14 @@
 menuconfig XENO_SKIN_RTAI
-   depends on XENO_OPT_NUCLEUS
-   tristate "RTAI emulator (DEPRECATED)"
+   depends on XENO_OPT_NUCLEUS && MMU && WORD_SIZE != 64
+   tristate "RTAI emulator (BROKEN, DEPRECATED)"
help
 
An emulator of the RTAI system.
 
+   This emulator is actually broken beyond all recognition:
+   - on MMU-less targets
+   - on 64bit targets
+
WARNING: This emulator is DEPRECATED. It is planned for
removal in v2.6.x. Legacy applications depending on it should
be converted to the native Xenomai API, which provides


___
Xenomai-git mailing list
Xenomai-git@gna.org
https://mail.gna.org/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : common: warn early about missing /dev/rtheap

2010-06-18 Thread GIT version control
Module: xenomai-2.5
Branch: master
Commit: 4623992fe8b384949193fa7e70c6588063c04c34
URL:
http://git.xenomai.org/?p=xenomai-2.5.git;a=commit;h=4623992fe8b384949193fa7e70c6588063c04c34

Author: Philippe Gerum 
Date:   Mon Jun 14 17:35:13 2010 +0200

common: warn early about missing /dev/rtheap

---

 include/nucleus/heap.h  |3 +--
 src/skins/common/bind.c |9 +
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/include/nucleus/heap.h b/include/nucleus/heap.h
index e837bf2..9758f5f 100644
--- a/include/nucleus/heap.h
+++ b/include/nucleus/heap.h
@@ -190,8 +190,6 @@ extern "C" {
 
 #ifdef __KERNEL__
 
-#define XNHEAP_DEV_MINOR 254
-
 int xnheap_mount(void);
 
 void xnheap_umount(void);
@@ -281,6 +279,7 @@ int xnheap_check_block(xnheap_t *heap,
 #endif /* __KERNEL__ || __XENO_SIM__ */
 
 #define XNHEAP_DEV_NAME  "/dev/rtheap"
+#define XNHEAP_DEV_MINOR 254
 
 #ifdef CONFIG_MMU
 /* XXX: 2.5.x ABI preserved for MMU-enabled only. */
diff --git a/src/skins/common/bind.c b/src/skins/common/bind.c
index d511072..fb15bf5 100644
--- a/src/skins/common/bind.c
+++ b/src/skins/common/bind.c
@@ -1,9 +1,11 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
+#include 
 #include 
 #include 
 #include 
@@ -86,6 +88,13 @@ xeno_bind_skin_opt(unsigned skin_magic, const char *skin,
xnfeatinfo_t finfo;
int muxid;
 
+   /* Some sanity checks first. */
+   if (access(XNHEAP_DEV_NAME, 0)) {
+   fprintf(stderr, "Xenomai: %s is missing\n(chardev, major=10 
minor=%d)\n",
+   XNHEAP_DEV_NAME, XNHEAP_DEV_MINOR);
+   exit(EXIT_FAILURE);
+   }
+   
old_sigill_handler = signal(SIGILL, xeno_sigill_handler);
if (old_sigill_handler == SIG_ERR) {
perror("signal(SIGILL)");


___
Xenomai-git mailing list
Xenomai-git@gna.org
https://mail.gna.org/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : blackfin: upgrade I-pipe support to 2.6.34-blackfin-1. 14-02

2010-06-18 Thread GIT version control
Module: xenomai-2.5
Branch: master
Commit: 7750eae23a1ad8d9192698efcdd92d1d6b2cd03d
URL:
http://git.xenomai.org/?p=xenomai-2.5.git;a=commit;h=7750eae23a1ad8d9192698efcdd92d1d6b2cd03d

Author: Philippe Gerum 
Date:   Mon Jun 14 11:46:02 2010 +0200

blackfin: upgrade I-pipe support to 2.6.34-blackfin-1.14-02

---

 ...h => adeos-ipipe-2.6.34-blackfin-1.14-02.patch} |   46 ++-
 1 files changed, 34 insertions(+), 12 deletions(-)

diff --git 
a/ksrc/arch/blackfin/patches/adeos-ipipe-2.6.34-blackfin-1.14-00.patch 
b/ksrc/arch/blackfin/patches/adeos-ipipe-2.6.34-blackfin-1.14-02.patch
similarity index 99%
rename from ksrc/arch/blackfin/patches/adeos-ipipe-2.6.34-blackfin-1.14-00.patch
rename to ksrc/arch/blackfin/patches/adeos-ipipe-2.6.34-blackfin-1.14-02.patch
index e57f536..1668422 100644
--- a/ksrc/arch/blackfin/patches/adeos-ipipe-2.6.34-blackfin-1.14-00.patch
+++ b/ksrc/arch/blackfin/patches/adeos-ipipe-2.6.34-blackfin-1.14-02.patch
@@ -1,21 +1,36 @@
+diff --git a/arch/blackfin/Kconfig b/arch/blackfin/Kconfig
+index c078849..799b1c0 100644
+--- a/arch/blackfin/Kconfig
 b/arch/blackfin/Kconfig
+@@ -84,6 +84,8 @@ source "kernel/Kconfig.freezer"
+ 
+ menu "Blackfin Processor Options"
+ 
++source "kernel/ipipe/Kconfig"
++
+ comment "Processor and Board Settings"
+ 
+ choice
 diff --git a/arch/blackfin/include/asm/ipipe.h 
b/arch/blackfin/include/asm/ipipe.h
-index d3b4044..32b7bad 100644
+index d3b4044..4530dfa 100644
 --- a/arch/blackfin/include/asm/ipipe.h
 +++ b/arch/blackfin/include/asm/ipipe.h
-@@ -34,10 +34,11 @@
+@@ -34,11 +34,12 @@
  #include 
  #include 
  #include 
 +#include 
  
 -#define IPIPE_ARCH_STRING "1.12-00"
-+#define IPIPE_ARCH_STRING "1.14-00"
++#define IPIPE_ARCH_STRING "1.14-02"
  #define IPIPE_MAJOR_NUMBER1
 -#define IPIPE_MINOR_NUMBER12
+-#define IPIPE_PATCH_NUMBER0
 +#define IPIPE_MINOR_NUMBER14
- #define IPIPE_PATCH_NUMBER0
++#define IPIPE_PATCH_NUMBER2
  
  #ifdef CONFIG_SMP
+ #error "I-pipe/blackfin: SMP not implemented"
 @@ -129,11 +130,11 @@ void __ipipe_enable_pipeline(void);
  #define __ipipe_hook_critical_ipi(ipd) do { } while (0)
  
@@ -241,7 +256,7 @@ index 1a496cd..d953572 100644
  
  void __ipipe_disable_root_irqs_hw(void)
 diff --git a/arch/blackfin/mach-common/ints-priority.c 
b/arch/blackfin/mach-common/ints-priority.c
-index 7ad8878..33f1253 100644
+index 7ad8878..8400131 100644
 --- a/arch/blackfin/mach-common/ints-priority.c
 +++ b/arch/blackfin/mach-common/ints-priority.c
 @@ -15,6 +15,7 @@
@@ -279,17 +294,23 @@ index 7ad8878..33f1253 100644
  
if (likely(vec == EVT_IVTMR_P))
irq = IRQ_CORETMR;
-@@ -1436,6 +1436,18 @@ asmlinkage int __ipipe_grab_irq(int vec, struct pt_regs 
*regs)
+@@ -1436,6 +1436,24 @@ asmlinkage int __ipipe_grab_irq(int vec, struct pt_regs 
*regs)
__ipipe_handle_irq(irq, regs);
ipipe_trace_irq_exit(irq);
  
 +  if (user_mode(regs) &&
++  !ipipe_test_foreign_stack() &&
 +  (current->ipipe_flags & PF_EVTRET) != 0) {
 +  /*
-+   * Testing for user_regs() eliminates foreign stack
-+   * contexts, including from careless domains which did
-+   * not set the foreign stack bit (foreign stacks are
-+   * always kernel-based).
++   * Testing for user_regs() does NOT fully eliminate
++   * foreign stack contexts, because of the forged
++   * interrupt returns we do through
++   * __ipipe_call_irqtail. In that case, we might have
++   * preempted a foreign stack context in a high
++   * priority domain, with a single interrupt level now
++   * pending after the irqtail unwinding is done. In
++   * which case user_mode() is now true, and the event
++   * gets dispatched spuriously.
 +   */
 +  current->ipipe_flags &= ~PF_EVTRET;
 +  __ipipe_dispatch_event(IPIPE_EVENT_RETURN, regs);
@@ -2679,10 +2700,10 @@ index 000..6257dfa
 +obj-$(CONFIG_IPIPE_TRACE) += tracer.o
 diff --git a/kernel/ipipe/core.c b/kernel/ipipe/core.c
 new file mode 100644
-index 000..b7d863d
+index 000..e2503bd
 --- /dev/null
 +++ b/kernel/ipipe/core.c
-@@ -0,0 +1,1976 @@
+@@ -0,0 +1,1977 @@
 +/* -*- linux-c -*-
 + * linux/kernel/ipipe/core.c
 + *
@@ -4647,6 +4668,7 @@ index 000..b7d863d
 +EXPORT_SYMBOL(ipipe_send_ipi);
 +EXPORT_SYMBOL(__ipipe_pend_irq);
 +EXPORT_SYMBOL(__ipipe_set_irq_pending);
++EXPORT_SYMBOL(__ipipe_event_monitors);
 +#if defined(CONFIG_IPIPE_DEBUG_INTERNAL) && defined(CONFIG_SMP)
 +EXPORT_SYMBOL(__ipipe_check_percpu_access);
 +#endif


___
Xenomai-git mailing list
Xenomai-git@gna.org
https://mail.gna.org/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : nios2: upgrade I-pipe support to 2.6.30-nios2-1.2-00

2010-06-18 Thread GIT version control
Module: xenomai-2.5
Branch: master
Commit: d6a7b9b49ee12b5804f233d0b5721f16fbf969a5
URL:
http://git.xenomai.org/?p=xenomai-2.5.git;a=commit;h=d6a7b9b49ee12b5804f233d0b5721f16fbf969a5

Author: Philippe Gerum 
Date:   Wed Jun 16 07:58:47 2010 +0200

nios2: upgrade I-pipe support to 2.6.30-nios2-1.2-00

---

 ...patch => adeos-ipipe-2.6.30-nios2-1.2-00.patch} |  683 
 1 files changed, 410 insertions(+), 273 deletions(-)

diff --git a/ksrc/arch/nios2/patches/adeos-ipipe-2.6.30-nios2-1.1-00.patch 
b/ksrc/arch/nios2/patches/adeos-ipipe-2.6.30-nios2-1.2-00.patch
similarity index 94%
rename from ksrc/arch/nios2/patches/adeos-ipipe-2.6.30-nios2-1.1-00.patch
rename to ksrc/arch/nios2/patches/adeos-ipipe-2.6.30-nios2-1.2-00.patch
index 1c01a97..a89727a 100644
--- a/ksrc/arch/nios2/patches/adeos-ipipe-2.6.30-nios2-1.1-00.patch
+++ b/ksrc/arch/nios2/patches/adeos-ipipe-2.6.30-nios2-1.2-00.patch
@@ -1,6 +1,6 @@
-diff --git d01303a1/arch/nios2/Kconfig b/arch/nios2/Kconfig
+diff --git a/arch/nios2/Kconfig b/arch/nios2/Kconfig
 index 66b9348..82f997d 100644
 d01303a1/arch/nios2/Kconfig
+--- a/arch/nios2/Kconfig
 +++ b/arch/nios2/Kconfig
 @@ -309,6 +309,13 @@ config PASS_CMDLINE
  will override "Default kernel command string".
@@ -16,9 +16,9 @@ index 66b9348..82f997d 100644
  source "mm/Kconfig"
  
  config BOOT_LINK_OFFSET
-diff --git d01303a1/arch/nios2/boot/compressed/Makefile 
b/arch/nios2/boot/compressed/Makefile
+diff --git a/arch/nios2/boot/compressed/Makefile 
b/arch/nios2/boot/compressed/Makefile
 index c5413ef..b5048f5 100644
 d01303a1/arch/nios2/boot/compressed/Makefile
+--- a/arch/nios2/boot/compressed/Makefile
 +++ b/arch/nios2/boot/compressed/Makefile
 @@ -7,6 +7,13 @@
  targets   := vmlinux head.o misc.o \
@@ -34,9 +34,9 @@ index c5413ef..b5048f5 100644
  
  OBJECTS = $(obj)/head.o $(obj)/misc.o
  
-diff --git d01303a1/arch/nios2/kernel/Makefile b/arch/nios2/kernel/Makefile
+diff --git a/arch/nios2/kernel/Makefile b/arch/nios2/kernel/Makefile
 index 2f2425f..e12b3c7 100644
 d01303a1/arch/nios2/kernel/Makefile
+--- a/arch/nios2/kernel/Makefile
 +++ b/arch/nios2/kernel/Makefile
 @@ -14,6 +14,8 @@ obj-y   := entry.o traps.o irq.o syscalltable.o \
usb.o config.o dma-mapping.o \
@@ -47,9 +47,9 @@ index 2f2425f..e12b3c7 100644
  obj-$(CONFIG_MODULES) += module.o
  obj-$(CONFIG_PIO_DEVICES) += pio.o
  obj-$(CONFIG_AVALON_DMA) += dma.o
-diff --git d01303a1/arch/nios2/kernel/entry.S b/arch/nios2/kernel/entry.S
+diff --git a/arch/nios2/kernel/entry.S b/arch/nios2/kernel/entry.S
 index 8e275fb..7a15e36 100644
 d01303a1/arch/nios2/kernel/entry.S
+--- a/arch/nios2/kernel/entry.S
 +++ b/arch/nios2/kernel/entry.S
 @@ -52,6 +52,23 @@ ENTRY(system_call)
stw r2,PT_R2(sp)/* default return value in r2 */
@@ -151,12 +151,12 @@ index 8e275fb..7a15e36 100644
*/
  
  ENTRY(instruction_trap)
-diff --git d01303a1/arch/nios2/kernel/ipipe.c b/arch/nios2/kernel/ipipe.c
+diff --git a/arch/nios2/kernel/ipipe.c b/arch/nios2/kernel/ipipe.c
 new file mode 100644
-index 000..e88d788
+index 000..e86e08f
 --- /dev/null
 +++ b/arch/nios2/kernel/ipipe.c
-@@ -0,0 +1,446 @@
+@@ -0,0 +1,467 @@
 +/* -*- linux-c -*-
 + * linux/arch/nios2/kernel/ipipe.c
 + *
@@ -460,6 +460,18 @@ index 000..e88d788
 +  __ipipe_handle_irq(irq, regs);
 +  ipipe_trace_irq_exit(irq);
 +
++  if (user_mode(regs) &&
++  (current->ipipe_flags & PF_EVTRET) != 0) {
++  /*
++   * Testing for user_regs() eliminates foreign stack
++   * contexts, including from careless domains which did
++   * not set the foreign stack bit (foreign stacks are
++   * always kernel-based).
++   */
++  current->ipipe_flags &= ~PF_EVTRET;
++  __ipipe_dispatch_event(IPIPE_EVENT_RETURN, regs);
++  }
++
 +  if (__ipipe_root_domain_p) {
 +  if (!test_bit(IPIPE_STALL_FLAG, &ipipe_root_cpudom_var(status)))
 +  return 1;
@@ -578,6 +590,15 @@ index 000..e88d788
 +
 +  local_irq_save_hw(flags);
 +
++  /*
++   * This is the end of the syscall path, so we may
++   * safely assume a valid Linux task stack here.
++   */
++  if (current->ipipe_flags & PF_EVTRET) {
++  current->ipipe_flags &= ~PF_EVTRET;
++  __ipipe_dispatch_event(IPIPE_EVENT_RETURN, regs);
++  }
++
 +if (!__ipipe_root_domain_p) {
 +  local_irq_restore_hw(flags);
 +  return 1;
@@ -603,9 +624,9 @@ index 000..e88d788
 +void notrace mcount(void);
 +EXPORT_SYMBOL(mcount);
 +#endif /* CONFIG_IPIPE_TRACE_MCOUNT */
-diff --git d01303a1/arch/nios2/kernel/irq.c b/arch/nios2/kernel/irq.c
+diff --git a/arch/nios2/kernel/irq.c b/arch/nios2/kernel/irq.c
 index bcd915c..6b68f82 100644
 d01303a1/arch/nios2/kernel/irq.c
+--- a/arch/nios2/kernel/irq.c
 +++ b/arch/nios2/kernel/irq.c
 @@ -39,18 +39,26 @@ void

[Xenomai-git] Philippe Gerum : arm: enable MAYDAY support

2010-06-18 Thread GIT version control
Module: xenomai-2.5
Branch: master
Commit: 09a48b1beb6019be322f246bdf2372fd4d0d66ea
URL:
http://git.xenomai.org/?p=xenomai-2.5.git;a=commit;h=09a48b1beb6019be322f246bdf2372fd4d0d66ea

Author: Philippe Gerum 
Date:   Sat Jun 12 08:28:29 2010 +0200

arm: enable MAYDAY support

---

 include/asm-arm/bits/shadow.h |  111 +
 include/asm-arm/system.h  |   10 
 2 files changed, 121 insertions(+), 0 deletions(-)

diff --git a/include/asm-arm/bits/shadow.h b/include/asm-arm/bits/shadow.h
index a396510..6021dad 100644
--- a/include/asm-arm/bits/shadow.h
+++ b/include/asm-arm/bits/shadow.h
@@ -27,6 +27,8 @@
 #error "Pure kernel header included from user-space!"
 #endif
 
+#include 
+
 static inline void xnarch_init_shadow_tcb(xnarchtcb_t * tcb,
  struct xnthread *thread,
  const char *name)
@@ -182,4 +184,113 @@ static inline int xnarch_local_syscall(struct pt_regs 
*regs)
 
 #define xnarch_schedule_tail(prev) do { } while(0)
 
+#ifdef XNARCH_HAVE_MAYDAY
+
+static inline void xnarch_setup_mayday_page(void *page)
+{
+   /*
+* We want this code to appear at the top of the MAYDAY page:
+*
+* ifdef ARM_EABI
+*
+* e3a00f8a mov r0, #552; 0x228
+* e28003c3 add r0, r0, #201326595  ; 0xc03
+* e3a0780f mov r7, #983040 ; 0xf
+* e2877042 add r7, r7, #66 ; 0x42
+* e3a06000 mov r6, #0
+* ef00 svc 0x
+* e3a0 mov r0, #0
+* e580 str r0, [r0]; 
+*
+* elif ARM_OABI
+*
+* e3a00f8a mov r0, #552; 0x228
+* e28003c3 add r0, r0, #201326595  ; 0xc03
+* e3a06000 mov r6, #0
+* ef9f0042 swi 0x009f0042
+* e3a0 mov r0, #0
+* e580 str r0, [r0]; 
+*
+* endif
+*
+* 32bit instruction words will be laid out by the compiler as
+* the target endianness requires.
+*
+* We don't mess with CPSR here, so no need to save/restore it
+* in handle/fixup code.
+*/
+#ifdef CONFIG_XENO_ARM_EABI
+   static const struct {
+   u32 mov_muxl;
+   u32 add_muxh;
+   u32 mov_sysh;
+   u32 add_sysl;
+   u32 mov_sigp;
+   u32 swi_0;
+   u32 mov_r0;
+   u32 str_r0;
+   } code = {
+   .mov_muxl = 0xe3a00f8a,
+   .add_muxh = 0xe28003c3,
+   .mov_sysh = 0xe3a0780f,
+   .add_sysl = 0xe2877042,
+   .mov_sigp = 0xe3a06000,
+   .swi_0 = 0xef00,
+   .mov_r0 = 0xe3a0,
+   .str_r0 = 0xe580
+   };
+#else /* OABI */
+   static const struct {
+   u32 mov_muxl;
+   u32 add_muxh;
+   u32 mov_sigp;
+   u32 swi_syscall;
+   u32 mov_r0;
+   u32 str_r0;
+   } code = {
+   .mov_muxl = 0xe3a00f8a,
+   .add_muxh = 0xe28003c3,
+   .mov_sigp = 0xe3a06000,
+   .swi_syscall = 0x009f0042,
+   .mov_r0 = 0xe3a0,
+   .str_r0 = 0xe580
+   };
+#endif /* OABI */
+
+   memcpy(page, &code, sizeof(code));
+
+   flush_dcache_page(vmalloc_to_page(page));
+}
+
+static inline void xnarch_call_mayday(void)
+{
+   rthal_return_intercept(current);
+}
+
+static inline void xnarch_handle_mayday(struct xnarchtcb *tcb,
+   struct pt_regs *regs,
+   unsigned long tramp)
+{
+   tcb->mayday.pc = regs->ARM_pc;
+   tcb->mayday.r0 = regs->ARM_r0;
+   tcb->mayday.r6 = regs->ARM_r6;
+#ifdef CONFIG_XENO_ARM_EABI
+   tcb->mayday.r7 = regs->ARM_r7;
+#endif
+   regs->ARM_pc = tramp;
+}
+
+static inline void xnarch_fixup_mayday(struct xnarchtcb *tcb,
+  struct pt_regs *regs)
+{
+   regs->ARM_pc = tcb->mayday.pc;
+   regs->ARM_r0 = tcb->mayday.r0;
+   regs->ARM_r6 = tcb->mayday.r6;
+#ifdef CONFIG_XENO_ARM_EABI
+   regs->ARM_r7 = tcb->mayday.r7;
+#endif
+}
+
+#endif /* XNARCH_HAVE_MAYDAY */
+
 #endif /* !_XENO_ASM_ARM_BITS_SHADOW_H */
diff --git a/include/asm-arm/system.h b/include/asm-arm/system.h
index 3cbf43b..2b7b734 100644
--- a/include/asm-arm/system.h
+++ b/include/asm-arm/system.h
@@ -69,6 +69,16 @@ typedef struct xnarchtcb {  /* Per-thread arch-dependent 
block */
struct mm_struct *active_mm;
struct thread_info ti;  /* Holds kernel-based thread info */
struct thread_info *tip;/* Pointer to the active thread 
info (ti or user->thread_info). */
+#ifdef XNARCH_HAVE_MAYDAY
+   struct {
+   

[Xenomai-git] Philippe Gerum : nucleus/timebase: convert to vfile

2010-06-18 Thread GIT version control
Module: xenomai-rpm
Branch: queue/vfile
Commit: 54a104951be5a45deeaa886384ea6d4d4015f6c2
URL:
http://git.xenomai.org/?p=xenomai-rpm.git;a=commit;h=54a104951be5a45deeaa886384ea6d4d4015f6c2

Author: Philippe Gerum 
Date:   Thu Jun 10 12:22:48 2010 +0200

nucleus/timebase: convert to vfile

---

 include/nucleus/timebase.h |   14 ++-
 ksrc/nucleus/timebase.c|  345 
 ksrc/nucleus/timer.c   |   51 +++
 3 files changed, 189 insertions(+), 221 deletions(-)

diff --git a/include/nucleus/timebase.h b/include/nucleus/timebase.h
index 5c8678e..40dc54a 100644
--- a/include/nucleus/timebase.h
+++ b/include/nucleus/timebase.h
@@ -30,6 +30,8 @@
 
 #if defined(__KERNEL__) || defined(__XENO_SIM__)
 
+#include 
+
 struct xntimer;
 
 typedef struct xntbops {
@@ -75,9 +77,9 @@ typedef struct xntbase {
 #define link2tbase(ln) container_of(ln, xntbase_t, link)
 
 #ifdef CONFIG_XENO_OPT_STATS
-   xnqueue_t timerq;   /* !< Timer holder in timebase. */
-
-   int timerq_rev; /* !< Revision (for non-atomic list walks). */
+   struct xnvfile_snapshot vfile;  /* !< Virtual file for access. */
+   struct xnvfile_rev_tag revtag; /* !< Revision (for non-atomic list 
walks). */
+   struct xnqueue timerq;  /* !< Timer holder in timebase. */
 #endif /* CONFIG_XENO_OPT_STATS */
 
 } xntbase_t;
@@ -322,8 +324,6 @@ do {\
removeq(&nktimebaseq, &nktbase.link);   \
 } while (0)
 
-#endif /* __KERNEL__ || __XENO_SIM__ */
-
 void xntbase_init_proc(void);
 
 void xntbase_cleanup_proc(void);
@@ -336,6 +336,10 @@ static inline void xntbase_declare_proc(xntbase_t *base) { 
}
 static inline void xntbase_remove_proc(xntbase_t *base) { }
 #endif /* !CONFIG_XENO_OPT_STATS */
 
+extern struct xnvfile_rev_tag tbaselist_tag;
+
+#endif /* __KERNEL__ || __XENO_SIM__ */
+
 /*...@}*/
 
 #endif /* !_XENO_NUCLEUS_TIMEBASE_H */
diff --git a/ksrc/nucleus/timebase.c b/ksrc/nucleus/timebase.c
index 48be711..d648fe1 100644
--- a/ksrc/nucleus/timebase.c
+++ b/ksrc/nucleus/timebase.c
@@ -165,6 +165,7 @@ int xntbase_alloc(const char *name, u_long period, u_long 
flags,
xntbase_declare_proc(base);
xnlock_get_irqsave(&nklock, s);
appendq(&nktimebaseq, &base->link);
+   xnvfile_touch_tag(&tbaselist_tag);
xnlock_put_irqrestore(&nklock, s);
 
xnarch_declare_tbase(base);
@@ -209,6 +210,7 @@ void xntbase_free(xntbase_t *base)
 
xnlock_get_irqsave(&nklock, s);
removeq(&nktimebaseq, &base->link);
+   xnvfile_touch_tag(&tbaselist_tag);
xnlock_put_irqrestore(&nklock, s);
 
xnarch_free_host_mem(base, sizeof(*base));
@@ -620,256 +622,225 @@ EXPORT_SYMBOL_GPL(xntbase_adjust_time);
 
 #ifdef CONFIG_PROC_FS
 
-#include 
+struct xnvfile_rev_tag tbaselist_tag;
 
-#ifdef CONFIG_XENO_OPT_STATS
+static struct xnvfile_snapshot_ops tbase_vfile_ops;
 
-#include 
-
-static struct proc_dir_entry *tmstat_proc_root;
-
-struct tmstat_seq_iterator {
-   int nentries;
-   struct tmstat_seq_info {
-   int cpu;
-   unsigned int scheduled;
-   unsigned int fired;
-   xnticks_t timeout;
-   xnticks_t interval;
-   xnflags_t status;
-   char handler[12];
-   char name[XNOBJECT_NAME_LEN];
-   } stat_info[1];
+struct tbase_vfile_priv {
+   struct xnholder *curr;
 };
 
-static void *tmstat_seq_start(struct seq_file *seq, loff_t *pos)
-{
-   struct tmstat_seq_iterator *iter = seq->private;
+struct tbase_vfile_data {
+   unsigned int enabled : 1;
+   unsigned int set : 1;
+   unsigned int isolated : 1;
+   unsigned int periodic : 1;
+   xnticks_t jiffies;
+   unsigned long tickvalue;
+   char name[XNOBJECT_NAME_LEN];
+};
 
-   if (*pos > iter->nentries)
-   return NULL;
+static struct xnvfile_snapshot tbase_vfile = {
+   .privsz = sizeof(struct tbase_vfile_priv),
+   .datasz = sizeof(struct tbase_vfile_data),
+   .tag = &tbaselist_tag,
+   .ops = &tbase_vfile_ops,
+};
 
-   if (*pos == 0)
-   return SEQ_START_TOKEN;
+static int tbase_vfile_rewind(struct xnvfile_snapshot_iterator *it)
+{
+   struct tbase_vfile_priv *priv = xnvfile_iterator_priv(it);
+
+   priv->curr = getheadq(&nktimebaseq);
 
-   return iter->stat_info + *pos - 1;
+   return countq(&nktimebaseq);
 }
 
-static void *tmstat_seq_next(struct seq_file *seq, void *v, loff_t *pos)
+static int tbase_vfile_next(struct xnvfile_snapshot_iterator *it, void *data)
 {
-   struct tmstat_seq_iterator *iter = seq->private;
+   struct tbase_vfile_priv *priv = xnvfile_iterator_priv(it);
+   struct tbase_vfile_data *p = data;
+   struct xntbase *base;
 
-   ++*pos;
+   if (priv->curr == NULL)
+   return 0;
 
-   if (*pos > iter->nentries)
-   return NULL;
+   base = link2tbas

[Xenomai-git] Philippe Gerum : uitron: convert to vfile

2010-06-18 Thread GIT version control
Module: xenomai-rpm
Branch: queue/vfile
Commit: 0f9b9df8c57e0a619a543d9e6b6a060b68dc1818
URL:
http://git.xenomai.org/?p=xenomai-rpm.git;a=commit;h=0f9b9df8c57e0a619a543d9e6b6a060b68dc1818

Author: Philippe Gerum 
Date:   Tue Jun  1 16:47:00 2010 +0200

uitron: convert to vfile

---

 ksrc/skins/uitron/flag.c   |  123 ---
 ksrc/skins/uitron/mbx.c|  119 +++
 ksrc/skins/uitron/module.c |9 +---
 ksrc/skins/uitron/sem.c|  118 +++---
 4 files changed, 231 insertions(+), 138 deletions(-)

diff --git a/ksrc/skins/uitron/flag.c b/ksrc/skins/uitron/flag.c
index c7f3c0d..ad9d85e 100644
--- a/ksrc/skins/uitron/flag.c
+++ b/ksrc/skins/uitron/flag.c
@@ -25,65 +25,102 @@ static xnmap_t *ui_flag_idmap;
 
 #ifdef CONFIG_PROC_FS
 
-static int __flag_read_proc(char *page,
-   char **start,
-   off_t off, int count, int *eof, void *data)
-{
-   uiflag_t *flag = (uiflag_t *)data;
-   char *p = page;
-   int len;
-   spl_t s;
+struct vfile_priv {
+   struct xnpholder *curr;
+   unsigned long value;
+};
 
-   xnlock_get_irqsave(&nklock, s);
+struct vfile_data {
+   UINT wfmode;
+   UINT waiptn;
+   char name[XNOBJECT_NAME_LEN];
+};
 
-   p += sprintf(p, "=0x%x, attr=%s\n", flag->flgvalue,
-flag->flgatr & TA_WMUL ? "TA_WMUL" : "TA_WSGL");
+static int vfile_rewind(struct xnvfile_snapshot_iterator *it)
+{
+   struct vfile_priv *priv = xnvfile_iterator_priv(it);
+   struct uiflag *flag = xnvfile_priv(it->vfile);
 
-   if (xnsynch_nsleepers(&flag->synchbase) > 0) {
-   xnpholder_t *holder;
+   priv->curr = getheadpq(xnsynch_wait_queue(&flag->synchbase));
+   priv->value = flag->flgvalue;
 
-   /* Pended flag -- dump waiters. */
+   return xnsynch_nsleepers(&flag->synchbase);
+}
 
-   holder = getheadpq(xnsynch_wait_queue(&flag->synchbase));
+static int vfile_next(struct xnvfile_snapshot_iterator *it, void *data)
+{
+   struct vfile_priv *priv = xnvfile_iterator_priv(it);
+   struct uiflag *flag = xnvfile_priv(it->vfile);
+   struct vfile_data *p = data;
+   struct xnthread *thread;
+   struct uitask *task;
 
-   while (holder) {
-   xnthread_t *sleeper = link2thread(holder, plink);
-   p += sprintf(p, "+%s\n", xnthread_name(sleeper));
-   holder = nextpq(xnsynch_wait_queue(&flag->synchbase), 
holder);
-   }
-   }
+   priv->value = flag->flgvalue; /* Refresh as we collect. */
 
-   xnlock_put_irqrestore(&nklock, s);
+   if (priv->curr == NULL)
+   return 0;   /* We are done. */
+
+   /* Fetch current waiter, advance list cursor. */
+   thread = link2thread(priv->curr, plink);
+   priv->curr = nextpq(xnsynch_wait_queue(&flag->synchbase),
+   priv->curr);
 
-   len = (p - page) - off;
-   if (len <= off + count)
-   *eof = 1;
-   *start = page + off;
-   if (len > count)
-   len = count;
-   if (len < 0)
-   len = 0;
+   /* Collect thread name to be output in ->show(). */
+   strncpy(p->name, xnthread_name(thread), sizeof(p->name));
+   task = thread2uitask(thread);
+   p->wfmode = task->wargs.flag.wfmode;
+   p->waiptn = task->wargs.flag.waiptn;
 
-   return len;
+   return 1;
 }
 
-extern xnptree_t __uitron_ptree;
+static int vfile_show(struct xnvfile_snapshot_iterator *it, void *data)
+{
+   struct vfile_priv *priv = xnvfile_iterator_priv(it);
+   struct vfile_data *p = data;
+
+   if (p == NULL) {/* Dump header. */
+   /* Always dump current flag value. */
+   xnvfile_printf(it, "=0x%lx\n", priv->value);
+   if (it->nrdata > 0)
+   xnvfile_printf(it, "\n%10s  %4s  %s\n",
+  "WAITPN", "WFMODE", "WAITER");
+   } else
+   xnvfile_printf(it, "0x%-8x  %4s  %.*s\n",
+  p->waiptn,
+  p->wfmode & TWF_ORW ? "OR" : "AND",
+  (int)sizeof(p->name), p->name);
+
+   return 0;
+}
 
-static xnpnode_t __flag_pnode = {
+static struct xnvfile_snapshot_ops vfile_ops = {
+   .rewind = vfile_rewind,
+   .next = vfile_next,
+   .show = vfile_show,
+};
 
-   .dir = NULL,
-   .type = "flags",
-   .entries = 0,
-   .read_proc = &__flag_read_proc,
-   .write_proc = NULL,
-   .root = &__uitron_ptree,
+extern struct xnptree __uitron_ptree;
+
+static struct xnpnode_file __flag_pnode = {
+   .node = {
+   .dirname = "flags",
+   .root = &__uitron_ptree,
+   .ops = &xnregistry_vfile_ops,
+   },
+   .vfile = {
+  

[Xenomai-git] Philippe Gerum : nucleus/intr: convert to vfile

2010-06-18 Thread GIT version control
Module: xenomai-rpm
Branch: queue/vfile
Commit: fa1ad013ff93926477422acbcdc521cd4c05df81
URL:
http://git.xenomai.org/?p=xenomai-rpm.git;a=commit;h=fa1ad013ff93926477422acbcdc521cd4c05df81

Author: Philippe Gerum 
Date:   Thu Jun 10 12:23:12 2010 +0200

nucleus/intr: convert to vfile

---

 ksrc/nucleus/intr.c |  155 ---
 1 files changed, 72 insertions(+), 83 deletions(-)

diff --git a/ksrc/nucleus/intr.c b/ksrc/nucleus/intr.c
index a6de4ea..300251e 100644
--- a/ksrc/nucleus/intr.c
+++ b/ksrc/nucleus/intr.c
@@ -983,28 +983,27 @@ int xnintr_query_next(int irq, xnintr_iterator_t 
*iterator, char *name_buf)
 
 #ifdef CONFIG_PROC_FS
 
-#include 
-#include 
+#include 
 
-static int format_irq_proc(unsigned int irq, char *str)
+static inline int format_irq_proc(unsigned int irq,
+ struct xnvfile_regular_iterator *it)
 {
-   xnintr_t *intr;
-   char *p = str;
+   struct xnintr *intr;
spl_t s;
 
if (rthal_virtual_irq_p(irq)) {
-   p += sprintf(p, " [virtual]");
-   return p - str;
+   xnvfile_puts(it, " [virtual]");
+   return 0;
} else if (irq == XNARCH_TIMER_IRQ) {
-   p += sprintf(p, " [timer]");
-   return p - str;
+   xnvfile_puts(it, " [timer]");
+   return 0;
 #ifdef CONFIG_SMP
} else if (irq == RTHAL_SERVICE_IPI0) {
-   p += sprintf(p, " [IPI]");
-   return p - str;
+   xnvfile_puts(it, " [IPI]");
+   return 0;
} else if (irq == RTHAL_CRITICAL_IPI) {
-   p += sprintf(p, " [critical sync]");
-   return p - str;
+   xnvfile_puts(it, " [critical sync]");
+   return 0;
 #endif /* CONFIG_SMP */
}
 
@@ -1012,134 +1011,124 @@ static int format_irq_proc(unsigned int irq, char 
*str)
 
intr = xnintr_shirq_first(irq);
if (intr) {
-   strcpy(p, ""); p += 8;
+   xnvfile_puts(it, "");
 
do {
-   *p = ' '; p += 1;
-   strcpy(p, intr->name); p += strlen(intr->name);
-
+   xnvfile_putc(it, ' ');
+   xnvfile_puts(it, intr->name);
intr = xnintr_shirq_next(intr);
} while (intr);
}
 
xnlock_put_irqrestore(&intrlock, s);
 
-   return p - str;
+   return 0;
 }
 
-static int irq_read_proc(char *page,
-char **start,
-off_t off, int count, int *eof, void *data)
+static int irq_vfile_show(struct xnvfile_regular_iterator *it,
+ void *data)
 {
-   int len = 0, cpu, irq;
-   char *p = page;
+   int cpu, irq;
 
-   p += sprintf(p, "IRQ ");
+   /* FIXME: We assume the entire output fits in a single page. */
 
-   for_each_online_cpu(cpu) {
-   p += sprintf(p, "CPU%d", cpu);
-   }
+   xnvfile_puts(it, "IRQ ");
+
+   for_each_online_cpu(cpu)
+   xnvfile_printf(it, "CPU%d", cpu);
 
for (irq = 0; irq < XNARCH_NR_IRQS; irq++) {
if (rthal_irq_handler(&rthal_domain, irq) == NULL)
continue;
 
-   p += sprintf(p, "\n%3d:", irq);
+   xnvfile_printf(it, "\n%3d:", irq);
 
for_each_online_cpu(cpu) {
-   p += sprintf(p, "%12lu",
-rthal_cpudata_irq_hits(&rthal_domain, cpu,
-   irq));
+   xnvfile_printf(it, "%12lu",
+  rthal_cpudata_irq_hits(&rthal_domain, 
cpu,
+ irq));
}
 
-   p += format_irq_proc(irq, p);
+   format_irq_proc(irq, it);
}
 
-   p += sprintf(p, "\n");
+   xnvfile_putc(it, '\n');
 
-   len = p - page - off;
-   if (len <= off + count)
-   *eof = 1;
-   *start = page + off;
-   if (len > count)
-   len = count;
-   if (len < 0)
-   len = 0;
-
-   return len;
+   return 0;
 }
 
+static struct xnvfile_regular_ops irq_vfile_ops = {
+   .show = irq_vfile_show,
+};
+
+static struct xnvfile_regular irq_vfile = {
+   .ops = &irq_vfile_ops,
+};
+
 #ifdef CONFIG_SMP
-static int affinity_read_proc(char *page,
- char **start,
- off_t off, int count, int *eof, void *data)
+
+static int affinity_vfile_show(struct xnvfile_regular_iterator *it,
+  void *data)
 {
unsigned long val = 0;
-   int len, cpu;
+   int cpu;
 
-   for (cpu = 0; cpu < sizeof(val) * 8; cpu++)
+ 

[Xenomai-git] Philippe Gerum : rtipc: convert to vfile

2010-06-18 Thread GIT version control
Module: xenomai-rpm
Branch: queue/vfile
Commit: c736de78731a792e7dc73b707ee52c9841c7e7b3
URL:
http://git.xenomai.org/?p=xenomai-rpm.git;a=commit;h=c736de78731a792e7dc73b707ee52c9841c7e7b3

Author: Philippe Gerum 
Date:   Thu May 27 15:47:14 2010 +0200

rtipc: convert to vfile

---

 ksrc/drivers/ipc/bufp.c  |   38 +-
 ksrc/drivers/ipc/iddp.c  |   38 +-
 ksrc/drivers/ipc/rtipc.c |9 +
 ksrc/drivers/ipc/xddp.c  |   38 +-
 4 files changed, 76 insertions(+), 47 deletions(-)

diff --git a/ksrc/drivers/ipc/bufp.c b/ksrc/drivers/ipc/bufp.c
index 7517b79..714849f 100644
--- a/ksrc/drivers/ipc/bufp.c
+++ b/ksrc/drivers/ipc/bufp.c
@@ -76,26 +76,38 @@ static struct xnmap *portmap;
 
 #ifdef CONFIG_PROC_FS
 
-static ssize_t __bufp_link_proc(char *buf, int count, void *data)
+static char *__bufp_link_target(void *obj)
 {
-   struct bufp_socket *sk = data;
-   return snprintf(buf, count, "%d", sk->name.sipc_port);
+   struct bufp_socket *sk = obj;
+   char *buf;
+
+   /* XXX: older kernels don't have kasprintf(). */
+   buf = kmalloc(32, GFP_KERNEL);
+   if (buf == NULL)
+   return buf;
+
+   snprintf(buf, 32, "%d", sk->name.sipc_port);
+
+   return buf;
 }
 
-static struct xnpnode __bufp_pnode = {
+extern struct xnptree rtipc_ptree;
 
-   .dir = NULL,
-   .type = "bufp",
-   .entries = 0,
-   .link_proc = &__bufp_link_proc,
-   .root = &rtipc_ptree,
+static struct xnpnode_link __bufp_pnode = {
+   .node = {
+   .dirname = "bufp",
+   .root = &rtipc_ptree,
+   .ops = &xnregistry_vlink_ops,
+   },
+   .target = __bufp_link_target,
 };
 
 #else /* !CONFIG_PROC_FS */
 
-static struct xnpnode __bufp_pnode = {
-
-   .type = "bufp"
+static struct xnpnode_link __bufp_pnode = {
+   .node = {
+   .dirname = "bufp",
+   },
 };
 
 #endif /* !CONFIG_PROC_FS */
@@ -717,7 +729,7 @@ static int __bufp_bind_socket(struct rtipc_private *priv,
 
if (*sk->label) {
ret = xnregistry_enter(sk->label, sk,
-  &sk->handle, &__bufp_pnode);
+  &sk->handle, &__bufp_pnode.node);
if (ret) {
xnarch_free_host_mem(sk->bufmem, sk->bufsz);
goto fail;
diff --git a/ksrc/drivers/ipc/iddp.c b/ksrc/drivers/ipc/iddp.c
index 8a1b079..706c119 100644
--- a/ksrc/drivers/ipc/iddp.c
+++ b/ksrc/drivers/ipc/iddp.c
@@ -81,26 +81,38 @@ static int poolwait;
 
 #ifdef CONFIG_PROC_FS
 
-static ssize_t __iddp_link_proc(char *buf, int count, void *data)
+static char *__iddp_link_target(void *obj)
 {
-   struct iddp_socket *sk = data;
-   return snprintf(buf, count, "%d", sk->name.sipc_port);
+   struct iddp_socket *sk = obj;
+   char *buf;
+
+   /* XXX: older kernels don't have kasprintf(). */
+   buf = kmalloc(32, GFP_KERNEL);
+   if (buf == NULL)
+   return buf;
+
+   snprintf(buf, 32, "%d", sk->name.sipc_port);
+
+   return buf;
 }
 
-static struct xnpnode __iddp_pnode = {
+extern struct xnptree rtipc_ptree;
 
-   .dir = NULL,
-   .type = "iddp",
-   .entries = 0,
-   .link_proc = &__iddp_link_proc,
-   .root = &rtipc_ptree,
+static struct xnpnode_link __iddp_pnode = {
+   .node = {
+   .dirname = "iddp",
+   .root = &rtipc_ptree,
+   .ops = &xnregistry_vlink_ops,
+   },
+   .target = __iddp_link_target,
 };
 
 #else /* !CONFIG_PROC_FS */
 
-static struct xnpnode __iddp_pnode = {
-
-   .type = "iddp"
+static struct xnpnode_link __iddp_pnode = {
+   .node = {
+   .dirname = "iddp",
+   },
 };
 
 #endif /* !CONFIG_PROC_FS */
@@ -578,7 +590,7 @@ static int __iddp_bind_socket(struct rtipc_private *priv,
 
if (*sk->label) {
ret = xnregistry_enter(sk->label, sk,
-  &sk->handle, &__iddp_pnode);
+  &sk->handle, &__iddp_pnode.node);
if (ret) {
if (poolsz > 0)
xnheap_destroy(&sk->privpool,
diff --git a/ksrc/drivers/ipc/rtipc.c b/ksrc/drivers/ipc/rtipc.c
index 71629cb..e5a0bc0 100644
--- a/ksrc/drivers/ipc/rtipc.c
+++ b/ksrc/drivers/ipc/rtipc.c
@@ -35,14 +35,7 @@ static struct rtipc_protocol *protocols[IPCPROTO_MAX] = {
 #endif
 };
 
-#ifdef CONFIG_PROC_FS
-struct xnptree rtipc_ptree = {
-
-   .dir = NULL,
-   .name = "rtipc",
-   .entries = 0,
-};
-#endif /* CONFIG_PROC_FS */
+DEFINE_XNPTREE(rtipc_ptree, "rtipc");
 
 int rtipc_get_arg(rtdm_user_info_t *user_info,
  void *dst, const void *src, size_t len)
diff --git a/ksrc/drivers/ipc/xddp.c b/ksrc/drivers/ipc/xddp.c
index c2a65e9..bcf272f 100644
--- a/ksrc/drivers/ipc/xddp.c
+++ b/ksrc/dr

[Xenomai-git] Philippe Gerum : vxworks: convert to vfile

2010-06-18 Thread GIT version control
Module: xenomai-rpm
Branch: queue/vfile
Commit: fb98e583dd83fcbfa6608e8f44ea4690163aa3d9
URL:
http://git.xenomai.org/?p=xenomai-rpm.git;a=commit;h=fb98e583dd83fcbfa6608e8f44ea4690163aa3d9

Author: Philippe Gerum 
Date:   Sun Jun  6 19:06:33 2010 +0200

vxworks: convert to vfile

---

 ksrc/skins/vxworks/module.c  |9 +--
 ksrc/skins/vxworks/msgQLib.c |  133 --
 ksrc/skins/vxworks/semLib.c  |  147 +++---
 ksrc/skins/vxworks/wdLib.c   |  121 ++-
 4 files changed, 256 insertions(+), 154 deletions(-)

diff --git a/ksrc/skins/vxworks/module.c b/ksrc/skins/vxworks/module.c
index 830df76..632f5d2 100644
--- a/ksrc/skins/vxworks/module.c
+++ b/ksrc/skins/vxworks/module.c
@@ -39,14 +39,7 @@ xntbase_t *wind_tbase;
 
 wind_rholder_t __wind_global_rholder;
 
-#ifdef CONFIG_PROC_FS
-xnptree_t __vxworks_ptree = {
-
-   .dir = NULL,
-   .name = "vxworks",
-   .entries = 0,
-};
-#endif /* CONFIG_PROC_FS */
+DEFINE_XNPTREE(__vxworks_ptree, "vxworks");
 
 int SKIN_INIT(vxworks)
 {
diff --git a/ksrc/skins/vxworks/msgQLib.c b/ksrc/skins/vxworks/msgQLib.c
index 0acb574..f762635 100644
--- a/ksrc/skins/vxworks/msgQLib.c
+++ b/ksrc/skins/vxworks/msgQLib.c
@@ -24,69 +24,102 @@ static int msgq_destroy_internal(wind_msgq_t *queue);
 
 #ifdef CONFIG_PROC_FS
 
-static int msgq_read_proc(char *page,
- char **start,
- off_t off, int count, int *eof, void *data)
-{
-   wind_msgq_t *queue = (wind_msgq_t *)data;
-   char *p = page;
-   int len;
-   spl_t s;
-
-   p += sprintf(p, "porder=%s:mlength=%u:mcount=%d\n",
-xnsynch_test_flags(&queue->synchbase,
-   XNSYNCH_PRIO) ? "prio" : "fifo",
-queue->msg_length, countq(&queue->msgq));
-
-   xnlock_get_irqsave(&nklock, s);
-
-   if (xnsynch_nsleepers(&queue->synchbase) > 0) {
-   xnpholder_t *holder;
+struct vfile_priv {
+   struct xnpholder *curr;
+   int flags;
+   unsigned int mlength;
+   int mcount;
+};
 
-   /* Pended queue -- dump waiters. */
+struct vfile_data {
+   char name[XNOBJECT_NAME_LEN];
+};
 
-   holder = getheadpq(xnsynch_wait_queue(&queue->synchbase));
+static int vfile_rewind(struct xnvfile_snapshot_iterator *it)
+{
+   struct vfile_priv *priv = xnvfile_iterator_priv(it);
+   wind_msgq_t *q = xnvfile_priv(it->vfile);
 
-   while (holder) {
-   xnthread_t *sleeper = link2thread(holder, plink);
-   p += sprintf(p, "+%s\n", xnthread_name(sleeper));
-   holder =
-   nextpq(xnsynch_wait_queue(&queue->synchbase),
-  holder);
-   }
-   }
+   q = wind_h2obj_active((MSG_Q_ID)q, WIND_MSGQ_MAGIC, wind_msgq_t);
+   if (q == NULL)
+   return -EIDRM;
 
-   xnlock_put_irqrestore(&nklock, s);
+   priv->curr = getheadpq(xnsynch_wait_queue(&q->synchbase));
+   priv->flags = xnsynch_test_flags(&q->synchbase, XNSYNCH_PRIO);
+   priv->mlength = q->msg_length;
+   priv->mcount = countq(&q->msgq);
 
-   len = (p - page) - off;
-   if (len <= off + count)
-   *eof = 1;
-   *start = page + off;
-   if (len > count)
-   len = count;
-   if (len < 0)
-   len = 0;
+   return xnsynch_nsleepers(&q->synchbase);
+}
 
-   return len;
+static int vfile_next(struct xnvfile_snapshot_iterator *it, void *data)
+{
+   struct vfile_priv *priv = xnvfile_iterator_priv(it);
+   wind_msgq_t *q = xnvfile_priv(it->vfile);
+   struct vfile_data *p = data;
+   struct xnthread *thread;
+
+   if (priv->curr == NULL)
+   return 0;   /* We are done. */
+
+   /* Fetch current waiter, advance list cursor. */
+   thread = link2thread(priv->curr, plink);
+   priv->curr = nextpq(xnsynch_wait_queue(&q->synchbase),
+   priv->curr);
+   /* Collect thread name to be output in ->show(). */
+   strncpy(p->name, xnthread_name(thread), sizeof(p->name));
+
+   return 1;
 }
 
-extern xnptree_t __vxworks_ptree;
+static int vfile_show(struct xnvfile_snapshot_iterator *it, void *data)
+{
+   struct vfile_priv *priv = xnvfile_iterator_priv(it);
+   struct vfile_data *p = data;
+
+   if (p == NULL) {/* Dump header. */
+   xnvfile_printf(it, 
+  "porder=%s:mlength=%u:mcount=%d\n",
+  priv->flags ? "prio" : "fifo",
+  priv->mlength,
+  priv->mcount);
+   if (it->nrdata > 0)
+   /* Queue is pended -- dump waiters */
+   xnvfile_printf(it, 
"---\n");
+   

[Xenomai-git] Philippe Gerum : nucleus/pod: convert to vfile

2010-06-18 Thread GIT version control
Module: xenomai-rpm
Branch: queue/vfile
Commit: 38154911d813248314d4f9c8931a9755369a3aab
URL:
http://git.xenomai.org/?p=xenomai-rpm.git;a=commit;h=38154911d813248314d4f9c8931a9755369a3aab

Author: Philippe Gerum 
Date:   Wed Jun  9 18:36:17 2010 +0200

nucleus/pod: convert to vfile

---

 ksrc/nucleus/pod.c |  262 +++
 1 files changed, 180 insertions(+), 82 deletions(-)

diff --git a/ksrc/nucleus/pod.c b/ksrc/nucleus/pod.c
index 7e8a3b7..a071085 100644
--- a/ksrc/nucleus/pod.c
+++ b/ksrc/nucleus/pod.c
@@ -3094,16 +3094,14 @@ EXPORT_SYMBOL_GPL(xnpod_set_thread_tslice);
 
 #if XENO_DEBUG(XNLOCK)
 
-xnlockinfo_t xnlock_stats[RTHAL_NR_CPUS];
+xnlockinfo_t xnlock_stats[XNARCH_NR_CPUS];
+EXPORT_SYMBOL_GPL(xnlock_stats);
 
-static int lock_read_proc(char *page,
- char **start,
- off_t off, int count, int *eof, void *data)
+static int lock_vfile_show(struct xnvfile_regular_iterator *it, void *data)
 {
xnlockinfo_t lockinfo;
-   int cpu, len = 0;
-   char *p = page;
spl_t s;
+   int cpu;
 
for_each_online_cpu(cpu) {
 
@@ -3112,11 +3110,11 @@ static int lock_read_proc(char *page,
xnlock_put_irqrestore(&nklock, s);
 
if (cpu > 0)
-   p += sprintf(p, "\n");
+   xnvfile_printf(it, "\n");
 
-   p += sprintf(p, "CPU%d:\n", cpu);
+   xnvfile_printf(it, "CPU%d:\n", cpu);
 
-   p += sprintf(p,
+   xnvfile_printf(it,
 "  longest locked section: %llu ns\n"
 "  spinning time: %llu ns\n"
 "  section entry: %s:%d (%s)\n",
@@ -3125,90 +3123,183 @@ static int lock_read_proc(char *page,
 lockinfo.file, lockinfo.line, lockinfo.function);
}
 
-   len = p - page - off;
+   return 0;
+}
 
-   if (len <= off + count)
-   *eof = 1;
-   *start = page + off;
-   if (len > count)
-   len = count;
-   if (len < 0)
-   len = 0;
+static struct xnvfile_regular_ops lock_vfile_ops = {
+   .show = lock_vfile_show,
+};
 
-   return len;
-}
-EXPORT_SYMBOL_GPL(xnlock_stats);
+static struct xnvfile_regular lock_vfile = {
+   .ops = &lock_vfile_ops,
+};
 
 #endif /* XENO_DEBUG(XNLOCK) */
 
-static int latency_read_proc(char *page,
-char **start,
-off_t off, int count, int *eof, void *data)
+static int latency_vfile_show(struct xnvfile_regular_iterator *it, void *data)
 {
-   int len;
-
-   len = sprintf(page, "%Lu\n", xnarch_tsc_to_ns(nklatency));
-   len -= off;
-   if (len <= off + count)
-   *eof = 1;
-   *start = page + off;
-   if (len > count)
-   len = count;
-   if (len < 0)
-   len = 0;
-
-   return len;
+   xnvfile_printf(it, "%Lu\n", xnarch_tsc_to_ns(nklatency));
+
+   return 0;
 }
 
-static int latency_write_proc(struct file *file,
- const char __user * buffer,
- unsigned long count, void *data)
+static ssize_t latency_vfile_store(struct xnvfile_input *input)
 {
-   char *end, buf[16];
-   long ns;
-   int n;
+   ssize_t ret;
+   long val;
 
-   n = count > sizeof(buf) - 1 ? sizeof(buf) - 1 : count;
+   ret = xnvfile_get_integer(input, &val);
+   if (ret < 0)
+   return ret;
 
-   if (copy_from_user(buf, buffer, n))
-   return -EFAULT;
+   nklatency = xnarch_ns_to_tsc(val);
 
-   buf[n] = '\0';
-   ns = simple_strtol(buf, &end, 0);
+   return ret;
+}
 
-   if ((*end != '\0' && !isspace(*end)) || ns < 0)
-   return -EINVAL;
+static struct xnvfile_regular_ops latency_vfile_ops = {
+   .show = latency_vfile_show,
+   .store = latency_vfile_store,
+};
+
+static struct xnvfile_regular latency_vfile = {
+   .ops = &latency_vfile_ops,
+};
+
+static int version_vfile_show(struct xnvfile_regular_iterator *it, void *data)
+{
+   xnvfile_printf(it, "%s\n", XENO_VERSION_STRING);
+
+   return 0;
+}
+
+static struct xnvfile_regular_ops version_vfile_ops = {
+   .show = version_vfile_show,
+};
+
+static struct xnvfile_regular version_vfile = {
+   .ops = &version_vfile_ops,
+};
+
+static int faults_vfile_show(struct xnvfile_regular_iterator *it, void *data)
+{
+   int cpu, trap;
+
+   xnvfile_puts(it, "TRAP ");
+
+   for_each_online_cpu(cpu)
+   xnvfile_printf(it, "CPU%d", cpu);
+
+   for (trap = 0; rthal_fault_labels[trap]; trap++) {
+   if (*rthal_fault_labels[trap] == '\0')
+   continue;
+
+   xnvfile_printf(it, "\n%3d: ", trap);
+
+   for_each_online_cpu(cpu)
+   xnvfile_printf(it, "%12u",
+ 

[Xenomai-git] Philippe Gerum : hal: convert to vfile

2010-06-18 Thread GIT version control
Module: xenomai-rpm
Branch: queue/vfile
Commit: 75e5f8d65244633299748973f7bb5b2d423a5883
URL:
http://git.xenomai.org/?p=xenomai-rpm.git;a=commit;h=75e5f8d65244633299748973f7bb5b2d423a5883

Author: Philippe Gerum 
Date:   Thu Jun 10 12:23:58 2010 +0200

hal: convert to vfile

Moved all vfiles to the nucleus.

---

 include/asm-generic/hal.h |   40 +++-
 ksrc/arch/generic/hal.c   |  222 +---
 ksrc/arch/generic/nmi.c   |   99 -
 3 files changed, 38 insertions(+), 323 deletions(-)

diff --git a/include/asm-generic/hal.h b/include/asm-generic/hal.h
index f90cafa..5ff7fb0 100644
--- a/include/asm-generic/hal.h
+++ b/include/asm-generic/hal.h
@@ -420,6 +420,13 @@ struct rthal_calibration_data {
unsigned long clock_freq;
 };
 
+struct rthal_apc_desc {
+   void (*handler)(void *cookie);
+   void *cookie;
+   const char *name;
+   unsigned long hits[RTHAL_NR_CPUS];
+};
+
 typedef int (*rthal_trap_handler_t)(unsigned trapno,
unsigned domid,
void *data);
@@ -438,7 +445,11 @@ extern volatile int rthal_sync_op;
 
 extern rthal_trap_handler_t rthal_trap_handler;
 
-extern unsigned rthal_realtime_faults[RTHAL_NR_CPUS][RTHAL_NR_FAULTS];
+extern unsigned int rthal_realtime_faults[RTHAL_NR_CPUS][RTHAL_NR_FAULTS];
+
+extern unsigned long rthal_apc_map;
+
+extern struct rthal_apc_desc rthal_apc_table[RTHAL_NR_APCS];
 
 extern int rthal_arch_init(void);
 
@@ -452,7 +463,7 @@ void rthal_critical_exit(unsigned long flags);
 
 #ifdef CONFIG_XENO_HW_NMI_DEBUG_LATENCY
 
-extern unsigned rthal_maxlat_us;
+extern unsigned int rthal_maxlat_us;
 
 extern unsigned long rthal_maxlat_tsc;
 
@@ -466,15 +477,11 @@ void rthal_nmi_arm(unsigned long delay);
 
 void rthal_nmi_disarm(void);
 
-void rthal_nmi_proc_register(void);
-
-void rthal_nmi_proc_unregister(void);
+void rthal_nmi_set_maxlat(unsigned int maxlat_us);
 
 #else /* !CONFIG_XENO_HW_NMI_DEBUG_LATENCY */
 #define rthal_nmi_init(efn)do { } while(0)
 #define rthal_nmi_release()do { } while(0)
-#define rthal_nmi_proc_register()  do { } while(0)
-#define rthal_nmi_proc_unregister()do { } while(0)
 #endif /* CONFIG_XENO_HW_NMI_DEBUG_LATENCY */
 
 /* Public interface */
@@ -561,25 +568,8 @@ static inline int rthal_cpu_supported(int cpu)
 }
 #endif /* !CONFIG_SMP */
 
-#ifdef CONFIG_PROC_FS
-
-#include 
-
-extern struct proc_dir_entry *rthal_proc_root;
-
-struct proc_dir_entry *rthal_add_proc_leaf(const char *name,
-  read_proc_t rdproc,
-  write_proc_t wrproc,
-  void *data,
-  struct proc_dir_entry *parent);
-
-struct proc_dir_entry *rthal_add_proc_seq(const char *name,
- struct file_operations *fops,
- size_t size,
- struct proc_dir_entry *parent);
-#endif /* CONFIG_PROC_FS */
-
 #ifdef CONFIG_IPIPE_TRACE
+
 #include 
 
 static inline int rthal_trace_max_begin(unsigned long v)
diff --git a/ksrc/arch/generic/hal.c b/ksrc/arch/generic/hal.c
index 8a5ec39..6239b0f 100644
--- a/ksrc/arch/generic/hal.c
+++ b/ksrc/arch/generic/hal.c
@@ -42,12 +42,7 @@
 #endif
 #include 
 #include 
-#include 
-#include 
 #include 
-#ifdef CONFIG_PROC_FS
-#include 
-#endif /* CONFIG_PROC_FS */
 #include 
 
 MODULE_LICENSE("GPL");
@@ -69,21 +64,10 @@ cpumask_t rthal_supported_cpus;
 EXPORT_SYMBOL(rthal_supported_cpus);
 #endif /* CONFIG_SMP */
 
-static struct {
-
-void (*handler) (void *cookie);
-void *cookie;
-const char *name;
-unsigned long hits[RTHAL_NR_CPUS];
-
-} rthal_apc_table[RTHAL_NR_APCS];
-
 static int rthal_init_done;
 
 static unsigned rthal_apc_virq;
 
-static unsigned long rthal_apc_map;
-
 static unsigned long rthal_apc_pending[RTHAL_NR_CPUS];
 
 static rthal_spinlock_t rthal_apc_lock = RTHAL_SPIN_LOCK_UNLOCKED;
@@ -98,6 +82,10 @@ rthal_trap_handler_t rthal_trap_handler;
 
 unsigned rthal_realtime_faults[RTHAL_NR_CPUS][RTHAL_NR_FAULTS];
 
+unsigned long rthal_apc_map;
+
+struct rthal_apc_desc rthal_apc_table[RTHAL_NR_APCS];
+
 volatile int rthal_sync_op;
 
 unsigned long rthal_critical_enter(void (*synch) (void))
@@ -615,190 +603,6 @@ int rthal_apc_schedule(int apc)
 return 0;
 }
 
-#ifdef CONFIG_PROC_FS
-
-struct proc_dir_entry *rthal_proc_root;
-
-static int hal_read_proc(char *page,
- char **start,
- off_t off, int count, int *eof, void *data)
-{
-int len, major, minor, patchlevel;
-
-major = IPIPE_MAJOR_NUMBER;
-minor = IPIPE_MINOR_NUMBER;
-patchlevel = IPIPE_PATCH_NUMBER;
-
-len = sprintf(page, "%d.%d-%.2d\n", major, minor, patchlevel);
-len -= off;
-if (len <= off + count)
-*eof = 1;
-*start = page + off;
-i

[Xenomai-git] Philippe Gerum : rtai: convert to vfile

2010-06-18 Thread GIT version control
Module: xenomai-rpm
Branch: queue/vfile
Commit: ac693d0e089036034c976bc172f9336fc34a632d
URL:
http://git.xenomai.org/?p=xenomai-rpm.git;a=commit;h=ac693d0e089036034c976bc172f9336fc34a632d

Author: Philippe Gerum 
Date:   Mon Jun  7 19:41:15 2010 +0200

rtai: convert to vfile

---

 ksrc/skins/rtai/fifo.c   |   78 ++--
 ksrc/skins/rtai/module.c |9 +
 ksrc/skins/rtai/shm.c|   81 +++---
 3 files changed, 95 insertions(+), 73 deletions(-)

diff --git a/ksrc/skins/rtai/fifo.c b/ksrc/skins/rtai/fifo.c
index d2724ff..3c0dd88 100644
--- a/ksrc/skins/rtai/fifo.c
+++ b/ksrc/skins/rtai/fifo.c
@@ -27,49 +27,63 @@ static RT_FIFO __fifo_table[CONFIG_XENO_OPT_PIPE_NRDEV];
 
 #ifdef CONFIG_PROC_FS
 
-extern xnptree_t __rtai_ptree;
+struct vfile_priv {
+   size_t bufsz;
+   size_t fillsz;
+   void *handler;
+   int refcnt;
+};
 
-static int __fifo_read_proc(char *page,
-   char **start,
-   off_t off, int count, int *eof, void *data)
+static int vfile_rewind(struct xnvfile_snapshot_iterator *it)
 {
-   RT_FIFO *p = data;
-   char *ptrW = page;
-   int len;
+   struct vfile_priv *priv = xnvfile_iterator_priv(it);
+   RT_FIFO *fifo = xnvfile_priv(it->vfile);
+
+   priv->bufsz = fifo->bufsz;
+   priv->fillsz = fifo->fillsz;
+   priv->handler = fifo->handler;
+   priv->refcnt = fifo->refcnt;
+
+   return 0;
+}
 
-   ptrW += sprintf(ptrW, "Size - Written  - F - Handler  - Ref\n");
+static int vfile_show(struct xnvfile_snapshot_iterator *it, void *data)
+{
+   struct vfile_priv *priv = xnvfile_iterator_priv(it);
 
+   xnvfile_printf(it, "Size - Written  - F - Handler  - Ref\n");
/* Output buffer:  xnpipe_mh_t *buffer; */
-   ptrW += sprintf(ptrW, "%08zX - %08zX - %p - %i\n",
-   p->bufsz, p->fillsz, p->handler, p->refcnt);
-
-   len = ptrW - page - off;
-   if (len <= off + count)
-   *eof = 1;
-   *start = page + off;
-   if (len > count)
-   len = count;
-   if (len < 0)
-   len = 0;
-
-   return len;
+   xnvfile_printf(it, "%08zX - %08zX - %p - %i\n",
+  priv->bufsz, priv->fillsz, priv->handler, priv->refcnt);
+
+   return 0;
 }
 
-static xnpnode_t __fifo_pnode = {
+static struct xnvfile_snapshot_ops vfile_ops = {
+   .rewind = vfile_rewind,
+   .show = vfile_show,
+};
 
-   .dir = NULL,
-   .type = "fifo",
-   .entries = 0,
-   .read_proc = &__fifo_read_proc,
-   .write_proc = NULL,
-   .root = &__rtai_ptree,
+extern struct xnptree __rtai_ptree;
+
+static struct xnpnode_file __fifo_pnode = {
+   .node = {
+   .dirname = "fifo",
+   .root = &__rtai_ptree,
+   .ops = &xnregistry_vfile_ops,
+   },
+   .vfile = {
+   .privsz = sizeof(struct vfile_priv),
+   .ops = &vfile_ops,
+   },
 };
 
 #else /* !CONFIG_PROC_FS */
 
-static xnpnode_t __fifo_pnode = {
-
-   .type = "fifo"
+static struct xnpnode_file __fifo_pnode = {
+   .node = {
+   .dirname = "fifo",
+   },
 };
 
 #endif /* !CONFIG_PROC_FS */
@@ -240,7 +254,7 @@ int rtf_create(unsigned minor, int size)
 
fifo->handle = 0;
snprintf(fifo->name, sizeof(fifo->name), "rtf%u", minor);
-   xnregistry_enter(fifo->name, fifo, &fifo->handle, &__fifo_pnode);
+   xnregistry_enter(fifo->name, fifo, &fifo->handle, &__fifo_pnode.node);
 
return minor;
 
diff --git a/ksrc/skins/rtai/module.c b/ksrc/skins/rtai/module.c
index 13367b5..32e35bb 100644
--- a/ksrc/skins/rtai/module.c
+++ b/ksrc/skins/rtai/module.c
@@ -42,14 +42,7 @@ MODULE_PARM_DESC(sync_time, "Set non-zero to synchronize on 
master time base");
 
 xntbase_t *rtai_tbase;
 
-#ifdef CONFIG_PROC_FS
-xnptree_t __rtai_ptree = {
-
-   .dir = NULL,
-   .name = "rtai",
-   .entries = 0,
-};
-#endif /* CONFIG_PROC_FS */
+DEFINE_XNPTREE(__rtai_ptree, "rtai");
 
 static void rtai_shutdown(int xtype)
 {
diff --git a/ksrc/skins/rtai/shm.c b/ksrc/skins/rtai/shm.c
index 96b7ae1..32508c4 100644
--- a/ksrc/skins/rtai/shm.c
+++ b/ksrc/skins/rtai/shm.c
@@ -55,47 +55,62 @@ xnqueue_t xnshm_allocq;
 
 #ifdef CONFIG_PROC_FS
 
-extern xnptree_t __rtai_ptree;
+struct vfile_priv {
+   int size;
+   char szName[6];
+   unsigned long name;
+   unsigned int refcnt;
+};
 
-static int __shm_read_proc(char *page,
-  char **start,
-  off_t off, int count, int *eof, void *data)
+static int vfile_rewind(struct xnvfile_snapshot_iterator *it)
 {
-   xnshm_a_t *p = data;
-   char *ptrW = page;
-   int len;
-
-   ptrW += sprintf(ptrW, "Name   - Ptr  - Size - Ref\n");
-   ptrW += sprintf(ptrW, "%s - %08lX - %08X - %i\n",
-   p->szName, p->name, p->size,

[Xenomai-git] Philippe Gerum : rtdm: convert to vfile

2010-06-18 Thread GIT version control
Module: xenomai-rpm
Branch: queue/vfile
Commit: c655437a44acd176c0fc44ae96032e342be77438
URL:
http://git.xenomai.org/?p=xenomai-rpm.git;a=commit;h=c655437a44acd176c0fc44ae96032e342be77438

Author: Philippe Gerum 
Date:   Thu Jun 17 12:27:42 2010 +0200

rtdm: convert to vfile

---

 include/rtdm/rtdm_driver.h |8 +-
 ksrc/skins/rtdm/device.c   |   17 +-
 ksrc/skins/rtdm/internal.h |   24 ++-
 ksrc/skins/rtdm/module.c   |   10 -
 ksrc/skins/rtdm/proc.c |  523 ++--
 5 files changed, 343 insertions(+), 239 deletions(-)

diff --git a/include/rtdm/rtdm_driver.h b/include/rtdm/rtdm_driver.h
index fd41690..4b1d054 100644
--- a/include/rtdm/rtdm_driver.h
+++ b/include/rtdm/rtdm_driver.h
@@ -39,6 +39,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 /* debug support */
@@ -517,8 +518,11 @@ struct rtdm_device {
 
/** Name of /proc entry for the device, must not be NULL */
const char *proc_name;
-   /** Set to device's /proc root entry after registration, do not modify 
*/
-   struct proc_dir_entry *proc_entry;
+#ifdef CONFIG_PROC_FS
+   /** Set to device's vfile data after registration, do not modify */
+   struct xnvfile_directory vfroot;
+   struct xnvfile_regular info_vfile;
+#endif
 
/** Driver definable device ID */
int device_id;
diff --git a/ksrc/skins/rtdm/device.c b/ksrc/skins/rtdm/device.c
index 3acc5ee..af097fb 100644
--- a/ksrc/skins/rtdm/device.c
+++ b/ksrc/skins/rtdm/device.c
@@ -213,7 +213,7 @@ int rtdm_dev_register(struct rtdm_device *device)
 
/* Sanity check: proc_name specified? */
XENO_ASSERT(RTDM, device->proc_name,
-   xnlogerr("RTDM: no /proc entry name specified\n");
+   xnlogerr("RTDM: no vfile (/proc) name specified\n");
return -EINVAL;);
 
switch (device->device_flags & RTDM_DEVICE_TYPE_MASK) {
@@ -310,10 +310,9 @@ int rtdm_dev_register(struct rtdm_device *device)
}
}
 
-#ifdef CONFIG_PROC_FS
-   if ((ret = rtdm_proc_register_device(device)) < 0)
+   ret = rtdm_proc_register_device(device);
+   if (ret)
goto err;
-#endif /* CONFIG_PROC_FS */
 
xnlock_get_irqsave(&rt_dev_lock, s);
list_add_tail(&device->reserved.entry,
@@ -350,10 +349,9 @@ int rtdm_dev_register(struct rtdm_device *device)
}
}
 
-#ifdef CONFIG_PROC_FS
-   if ((ret = rtdm_proc_register_device(device)) < 0)
+   ret = rtdm_proc_register_device(device);
+   if (ret)
goto err;
-#endif /* CONFIG_PROC_FS */
 
xnlock_get_irqsave(&rt_dev_lock, s);
list_add_tail(&device->reserved.entry,
@@ -443,10 +441,7 @@ int rtdm_dev_unregister(struct rtdm_device *device, 
unsigned int poll_delay)
 
xnlock_put_irqrestore(&rt_dev_lock, s);
 
-#ifdef CONFIG_PROC_FS
-   remove_proc_entry("information", device->proc_entry);
-   remove_proc_entry(device->proc_name, rtdm_proc_root);
-#endif /* CONFIG_PROC_FS */
+   rtdm_proc_unregister_device(device);
 
up(&nrt_dev_lock);
 
diff --git a/ksrc/skins/rtdm/internal.h b/ksrc/skins/rtdm/internal.h
index a05cd7d..74abed2 100644
--- a/ksrc/skins/rtdm/internal.h
+++ b/ksrc/skins/rtdm/internal.h
@@ -61,7 +61,6 @@ extern unsigned int devname_hashtab_size;
 extern unsigned int protocol_hashtab_size;
 extern struct list_head *rtdm_named_devices;
 extern struct list_head *rtdm_protocol_devices;
-extern struct proc_dir_entry *rtdm_proc_root;
 
 #ifdef MODULE
 #define rtdm_initialised 1
@@ -82,9 +81,28 @@ static inline void rtdm_dereference_device(struct 
rtdm_device *device)
 int __init rtdm_dev_init(void);
 void rtdm_dev_cleanup(void);
 
-int rtdm_proc_register_device(struct rtdm_device *device);
-int __init rtdm_proc_init(void);
+#ifdef CONFIG_PROC_FS
+int rtdm_proc_init(void);
 void rtdm_proc_cleanup(void);
+int rtdm_proc_register_device(struct rtdm_device *device);
+void rtdm_proc_unregister_device(struct rtdm_device *device);
+#else
+static inline int rtdm_proc_init(void)
+{
+   return 0;
+}
+void rtdm_proc_cleanup(void)
+{
+}
+static int rtdm_proc_register_device(struct rtdm_device *device)
+{
+   return 0;
+}
+static void rtdm_proc_unregister_device(struct rtdm_device *device)
+{
+}
+#endif
+
 void rtdm_apc_handler(void *cookie);
 
 #endif /* _RTDM_INTERNAL_H */
diff --git a/ksrc/skins/rtdm/module.c b/ksrc/skins/rtdm/module.c
index b5120e4..2ff8d7a 100644
--- a/ksrc/skins/rtdm/module.c
+++ b/ksrc/skins/rtdm/module.c
@@ -48,11 +48,7 @@ MODULE_PARM_DESC(tick_arg, "Fixed clock tick value (us), 0 
for tick-less mode");
 static void __exit rtdm_skin_shutdown(int xtype)
 {
rtdm_dev_cleanup();
-
-#ifdef CONFIG_PROC_FS
rtdm_proc_cleanup();
-#endif /* CONFIG_PROC_FS */
-
 #ifdef CONFIG_XENO_OPT_PERVASIVE
rtdm_syscal

[Xenomai-git] Philippe Gerum : ksrc, include: remove most direct dependencies on PROC_FS

2010-06-18 Thread GIT version control
Module: xenomai-rpm
Branch: queue/vfile
Commit: 5589ea343c948f325476ef951622003df329df6b
URL:
http://git.xenomai.org/?p=xenomai-rpm.git;a=commit;h=5589ea343c948f325476ef951622003df329df6b

Author: Philippe Gerum 
Date:   Sat Jun 19 00:13:34 2010 +0200

ksrc, include: remove most direct dependencies on PROC_FS

Now that we moved to vfiles, replace explicit dependencies on PROC_FS
by XENO_OPT_VFILE. Since vfiles are still based on procfs under the
hood, XENO_OPT_VFILE is automatically selected whenever PROC_FS is
available.

---

 include/asm-generic/wrappers.h |4 +-
 include/nucleus/pod.h  |8 ++--
 include/nucleus/registry.h |   10 ++--
 include/nucleus/sched.h|2 +-
 include/nucleus/shadow.h   |4 +-
 include/nucleus/vfile.h|6 +-
 include/rtai/rtai_proc_fs.h|   84 
 include/rtdm/rtdm_driver.h |2 +-
 ksrc/arch/arm/hal.c|3 -
 ksrc/arch/generic/hal.c|3 +
 ksrc/arch/powerpc/hal.c|3 -
 ksrc/drivers/ipc/bufp.c|6 +-
 ksrc/drivers/ipc/iddp.c|6 +-
 ksrc/drivers/ipc/xddp.c|6 +-
 ksrc/nucleus/Kconfig   |5 ++
 ksrc/nucleus/heap.c|4 +-
 ksrc/nucleus/intr.c|4 +-
 ksrc/nucleus/pipe.c|1 -
 ksrc/nucleus/pod.c |7 +--
 ksrc/nucleus/registry.c|   36 +
 ksrc/nucleus/sched-rt.c|6 +-
 ksrc/nucleus/sched-sporadic.c  |6 +-
 ksrc/nucleus/sched-tp.c|6 +-
 ksrc/nucleus/sched.c   |4 +-
 ksrc/nucleus/shadow.c  |   10 ++--
 ksrc/nucleus/timebase.c|4 +-
 ksrc/nucleus/timer.c   |4 +-
 ksrc/skins/native/alarm.c  |6 +-
 ksrc/skins/native/buffer.c |6 +-
 ksrc/skins/native/cond.c   |6 +-
 ksrc/skins/native/event.c  |6 +-
 ksrc/skins/native/heap.c   |6 +-
 ksrc/skins/native/intr.c   |6 +-
 ksrc/skins/native/mutex.c  |6 +-
 ksrc/skins/native/pipe.c   |6 +-
 ksrc/skins/native/queue.c  |6 +-
 ksrc/skins/native/sem.c|6 +-
 ksrc/skins/psos+/queue.c   |6 +-
 ksrc/skins/psos+/rn.c  |6 +-
 ksrc/skins/psos+/sem.c |6 +-
 ksrc/skins/rtai/fifo.c |6 +-
 ksrc/skins/rtai/shm.c  |6 +-
 ksrc/skins/rtdm/internal.h |7 +--
 ksrc/skins/rtdm/syscall.c  |4 +-
 ksrc/skins/uitron/flag.c   |6 +-
 ksrc/skins/uitron/mbx.c|6 +-
 ksrc/skins/uitron/sem.c|6 +-
 ksrc/skins/vrtx/event.c|6 +-
 ksrc/skins/vrtx/heap.c |6 +-
 ksrc/skins/vrtx/mb.c   |6 +-
 ksrc/skins/vrtx/mx.c   |6 +-
 ksrc/skins/vrtx/pt.c   |6 +-
 ksrc/skins/vrtx/queue.c|6 +-
 ksrc/skins/vrtx/sem.c  |6 +-
 ksrc/skins/vxworks/msgQLib.c   |6 +-
 ksrc/skins/vxworks/semLib.c|6 +-
 ksrc/skins/vxworks/wdLib.c |6 +-
 57 files changed, 169 insertions(+), 254 deletions(-)

diff --git a/include/asm-generic/wrappers.h b/include/asm-generic/wrappers.h
index 56fafbc..e706f68 100644
--- a/include/asm-generic/wrappers.h
+++ b/include/asm-generic/wrappers.h
@@ -579,7 +579,7 @@ static inline int wrap_raise_cap(int cap)
 }
 #endif /* LINUX_VERSION_CODE >= 2.6.29 */
 
-#ifdef CONFIG_PROC_FS
+#ifdef CONFIG_XENO_OPT_VFILE
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,30)
 #include 
 #include 
@@ -590,7 +590,7 @@ static inline void wrap_proc_dir_entry_owner(struct 
proc_dir_entry *entry)
 #else  /* LINUX_VERSION_CODE < KERNEL_VERSION(2,6,30) */
 #define wrap_proc_dir_entry_owner(entry) do { (void)entry; } while(0)
 #endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2,6,30) */
-#endif /* CONFIG_PROC_FS */
+#endif /* CONFIG_XENO_OPT_VFILE */
 
 #ifndef list_first_entry
 #define list_first_entry(ptr, type, member) \
diff --git a/include/nucleus/pod.h b/include/nucleus/pod.h
index 1ad6014..01ff0a7 100644
--- a/include/nucleus/pod.h
+++ b/include/nucleus/pod.h
@@ -71,7 +71,7 @@ struct xnpod {
xnsched_t sched[XNARCH_NR_CPUS];/*!< Per-cpu scheduler slots. */
 
xnqueue_t threadq;  /*!< All existing threads. */
-#ifdef CONFIG_PROC_FS
+#ifdef CONFIG_XENO_OPT_VFILE
struct xnvfile_rev_tag threadlist_tag;
 #endif
xnqueue_t tstartq,  /*!< Thread start hook queue. */
@@ -104,13 +104,13 @@ extern xnarch_cpumask_t nkaffinity;
 
 extern xnpod_t nkpod_struct;
 
-#ifdef CONFIG_PROC_FS
+#ifdef CONFIG_XENO_OPT_VFILE
 int xnpod_init_proc(void);
 void xnpod_cleanup_proc(void);
-#else /* !CONFIG_PROC_FS */
+#else /* !CONFIG_XENO_OPT_VFILE */
 static inline int xnpod_init_proc(void) { return 0; }
 static inline void xnpod_cleanup_proc(void) {}
-#endif /* !CONFIG_PROC_FS */
+#endif /* !CONFIG_XENO_OPT_VFILE */
 
 static inline int xnpod_mount(void)
 {
diff --git a/include/nucleus/registry.h b/include/nucleus/registry.h
index 34780f6..0f4acae 100644
--- a/include/nucleus/registry.h
+++ b/

[Xenomai-git] Philippe Gerum : psos: convert to vfile

2010-06-18 Thread GIT version control
Module: xenomai-rpm
Branch: queue/vfile
Commit: 605503fb8b78719b972cdab9510a03ae87d17954
URL:
http://git.xenomai.org/?p=xenomai-rpm.git;a=commit;h=605503fb8b78719b972cdab9510a03ae87d17954

Author: Philippe Gerum 
Date:   Mon Jun  7 19:41:23 2010 +0200

psos: convert to vfile

---

 ksrc/skins/psos+/module.c |9 +---
 ksrc/skins/psos+/queue.c  |  131 
 ksrc/skins/psos+/rn.c |  122 +++---
 ksrc/skins/psos+/sem.c|  117 +---
 4 files changed, 236 insertions(+), 143 deletions(-)

diff --git a/ksrc/skins/psos+/module.c b/ksrc/skins/psos+/module.c
index bdba58b..33ac213 100644
--- a/ksrc/skins/psos+/module.c
+++ b/ksrc/skins/psos+/module.c
@@ -52,14 +52,7 @@ xntbase_t *psos_tbase;
 
 psos_rholder_t __psos_global_rholder;
 
-#ifdef CONFIG_PROC_FS
-xnptree_t __psos_ptree = {
-
-   .dir = NULL,
-   .name = "psos",
-   .entries = 0,
-};
-#endif /* CONFIG_PROC_FS */
+DEFINE_XNPTREE(__psos_ptree, "psos");
 
 void k_fatal(u_long err_code, u_long flags)
 {
diff --git a/ksrc/skins/psos+/queue.c b/ksrc/skins/psos+/queue.c
index 703ca3b..beb776f 100644
--- a/ksrc/skins/psos+/queue.c
+++ b/ksrc/skins/psos+/queue.c
@@ -31,67 +31,102 @@ static u_long q_destroy_internal(psosqueue_t *queue);
 
 #ifdef CONFIG_PROC_FS
 
-static int msgq_read_proc(char *page,
- char **start,
- off_t off, int count, int *eof, void *data)
-{
-   psosqueue_t *queue = (psosqueue_t *)data;
-   char *p = page;
-   int len;
-   spl_t s;
-
-   p += sprintf(p, "maxnum=%lu:maxlen=%lu:mcount=%d\n",
-queue->maxnum, queue->maxlen, countq(&queue->inq));
+struct vfile_priv {
+   struct xnpholder *curr;
+   unsigned long maxnum;
+   unsigned long maxlen;
+   int msgcount;
+};
 
-   xnlock_get_irqsave(&nklock, s);
+struct vfile_data {
+   char name[XNOBJECT_NAME_LEN];
+};
 
-   if (xnsynch_nsleepers(&queue->synchbase) > 0) {
-   xnpholder_t *holder;
+static int vfile_rewind(struct xnvfile_snapshot_iterator *it)
+{
+   struct vfile_priv *priv = xnvfile_iterator_priv(it);
+   psosqueue_t *queue = xnvfile_priv(it->vfile);
 
-   /* Pended queue -- dump waiters. */
+   queue = psos_h2obj_active((u_long)queue, PSOS_QUEUE_MAGIC, psosqueue_t);
+   if (queue == NULL)
+   return -EIDRM;
 
-   holder = getheadpq(xnsynch_wait_queue(&queue->synchbase));
+   priv->curr = getheadpq(xnsynch_wait_queue(&queue->synchbase));
+   priv->maxnum = queue->maxnum;
+   priv->maxlen = queue->maxlen;
+   priv->msgcount = countq(&queue->inq);
 
-   while (holder) {
-   xnthread_t *sleeper = link2thread(holder, plink);
-   p += sprintf(p, "+%s\n", xnthread_name(sleeper));
-   holder =
-   nextpq(xnsynch_wait_queue(&queue->synchbase),
-  holder);
-   }
-   }
+   return xnsynch_nsleepers(&queue->synchbase);
+}
 
-   xnlock_put_irqrestore(&nklock, s);
+static int vfile_next(struct xnvfile_snapshot_iterator *it, void *data)
+{
+   struct vfile_priv *priv = xnvfile_iterator_priv(it);
+   psosqueue_t *queue = xnvfile_priv(it->vfile);
+   struct vfile_data *p = data;
+   struct xnthread *thread;
+
+   if (priv->curr == NULL)
+   return 0;   /* We are done. */
+
+   /* Fetch current waiter, advance list cursor. */
+   thread = link2thread(priv->curr, plink);
+   priv->curr = nextpq(xnsynch_wait_queue(&queue->synchbase),
+   priv->curr);
+   /* Collect thread name to be output in ->show(). */
+   strncpy(p->name, xnthread_name(thread), sizeof(p->name));
+
+   return 1;
+}
 
-   len = (p - page) - off;
-   if (len <= off + count)
-   *eof = 1;
-   *start = page + off;
-   if (len > count)
-   len = count;
-   if (len < 0)
-   len = 0;
+static int vfile_show(struct xnvfile_snapshot_iterator *it, void *data)
+{
+   struct vfile_priv *priv = xnvfile_iterator_priv(it);
+   struct vfile_data *p = data;
+
+   if (p == NULL) {/* Dump header. */
+   xnvfile_printf(it, 
+  "maxnum=%lu:maxlen=%lu:mcount=%d\n",
+  priv->maxnum,
+  priv->maxlen,
+  priv->msgcount);
+   if (it->nrdata > 0)
+   /* Queue is pended -- dump waiters */
+   xnvfile_printf(it, 
"---\n");
+   } else
+   xnvfile_printf(it, "%.*s\n",
+  (int)sizeof(p->name), p->name);
 
-   return len;
+   return 0;
 }
 
-extern xnptree_t __psos_ptree;
-
-sta

[Xenomai-git] Philippe Gerum : vrtx: convert to vfile

2010-06-18 Thread GIT version control
Module: xenomai-rpm
Branch: queue/vfile
Commit: 46c79af27b439ed5be3008555993efcfdee82e07
URL:
http://git.xenomai.org/?p=xenomai-rpm.git;a=commit;h=46c79af27b439ed5be3008555993efcfdee82e07

Author: Philippe Gerum 
Date:   Tue Jun  8 08:43:19 2010 +0200

vrtx: convert to vfile

---

 ksrc/skins/vrtx/event.c  |  130 --
 ksrc/skins/vrtx/heap.c   |   75 +++---
 ksrc/skins/vrtx/mb.c |  111 ---
 ksrc/skins/vrtx/module.c |9 +---
 ksrc/skins/vrtx/mx.c |  129 --
 ksrc/skins/vrtx/pt.c |   77 ---
 ksrc/skins/vrtx/queue.c  |  115 +---
 ksrc/skins/vrtx/sem.c|  112 ---
 8 files changed, 457 insertions(+), 301 deletions(-)

diff --git a/ksrc/skins/vrtx/event.c b/ksrc/skins/vrtx/event.c
index d0d30ec..402a6e0 100644
--- a/ksrc/skins/vrtx/event.c
+++ b/ksrc/skins/vrtx/event.c
@@ -27,72 +27,102 @@ static xnqueue_t vrtx_event_q;
 
 #ifdef CONFIG_PROC_FS
 
-static int __event_read_proc(char *page,
-char **start,
-off_t off, int count, int *eof, void *data)
-{
-   vrtxevent_t *evgroup = (vrtxevent_t *)data;
-   char *p = page;
-   int len;
-   spl_t s;
+struct vfile_priv {
+   struct xnpholder *curr;
+   int value;
+};
 
-   xnlock_get_irqsave(&nklock, s);
+struct vfile_data {
+   int opt;
+   int mask;
+   char name[XNOBJECT_NAME_LEN];
+};
 
-   p += sprintf(p, "=0x%x\n", evgroup->events);
+static int vfile_rewind(struct xnvfile_snapshot_iterator *it)
+{
+   struct vfile_priv *priv = xnvfile_iterator_priv(it);
+   struct vrtxevent *evgroup = xnvfile_priv(it->vfile);
 
-   if (xnsynch_nsleepers(&evgroup->synchbase) > 0) {
-   xnpholder_t *holder;
+   priv->curr = getheadpq(xnsynch_wait_queue(&evgroup->synchbase));
+   priv->value = evgroup->events;
 
-   /* Pended event -- dump waiters. */
+   return xnsynch_nsleepers(&evgroup->synchbase);
+}
 
-   holder = getheadpq(xnsynch_wait_queue(&evgroup->synchbase));
+static int vfile_next(struct xnvfile_snapshot_iterator *it, void *data)
+{
+   struct vfile_priv *priv = xnvfile_iterator_priv(it);
+   struct vrtxevent *evgroup = xnvfile_priv(it->vfile);
+   struct vfile_data *p = data;
+   struct xnthread *thread;
+   struct vrtxtask *task;
 
-   while (holder) {
-   xnthread_t *sleeper = link2thread(holder, plink);
-   vrtxtask_t *task = thread2vrtxtask(sleeper);
-   const char *mode =
-   (task->waitargs.evgroup.
-opt & 1) ? "all" : "any";
-   int mask = task->waitargs.evgroup.mask;
-   p += sprintf(p, "+%s (mask=0x%x, %s)\n",
-xnthread_name(sleeper), mask, mode);
-   holder =
-   nextpq(xnsynch_wait_queue(&evgroup->synchbase),
-  holder);
-   }
-   }
+   priv->value = evgroup->events; /* Refresh as we collect. */
 
-   xnlock_put_irqrestore(&nklock, s);
+   if (priv->curr == NULL)
+   return 0;   /* We are done. */
+
+   /* Fetch current waiter, advance list cursor. */
+   thread = link2thread(priv->curr, plink);
+   priv->curr = nextpq(xnsynch_wait_queue(&evgroup->synchbase),
+   priv->curr);
 
-   len = (p - page) - off;
-   if (len <= off + count)
-   *eof = 1;
-   *start = page + off;
-   if (len > count)
-   len = count;
-   if (len < 0)
-   len = 0;
+   /* Collect thread name to be output in ->show(). */
+   strncpy(p->name, xnthread_name(thread), sizeof(p->name));
+   task = thread2vrtxtask(thread);
+   p->opt = task->waitargs.evgroup.opt;
+   p->mask = task->waitargs.evgroup.mask;
 
-   return len;
+   return 1;
 }
 
-extern xnptree_t __vrtx_ptree;
+static int vfile_show(struct xnvfile_snapshot_iterator *it, void *data)
+{
+   struct vfile_priv *priv = xnvfile_iterator_priv(it);
+   struct vfile_data *p = data;
+
+   if (p == NULL) {/* Dump header. */
+   /* Always dump current event mask value. */
+   xnvfile_printf(it, "=0x%x\n", priv->value);
+   if (it->nrdata > 0)
+   xnvfile_printf(it, "\n%10s  %4s  %s\n",
+  "MASK", "MODE", "WAITER");
+   } else
+   xnvfile_printf(it, "0x%-8x  %4s  %.*s\n",
+  p->mask,
+  p->opt & 1 ? "all" : "any",
+  (int)sizeof(p->name), p->name);
+
+   return 0;
+}
 
-s

[Xenomai-git] Philippe Gerum : native: convert to vfile

2010-06-18 Thread GIT version control
Module: xenomai-rpm
Branch: queue/vfile
Commit: 00bc150999021ce16fe1235bbcbd00b09ec669cd
URL:
http://git.xenomai.org/?p=xenomai-rpm.git;a=commit;h=00bc150999021ce16fe1235bbcbd00b09ec669cd

Author: Philippe Gerum 
Date:   Thu Apr 29 18:22:32 2010 +0200

native: convert to vfile

---

 ksrc/nucleus/heap.c|2 +-
 ksrc/skins/native/alarm.c  |  127 +-
 ksrc/skins/native/buffer.c |  168 +++-
 ksrc/skins/native/cond.c   |  110 +
 ksrc/skins/native/event.c  |  132 ++-
 ksrc/skins/native/heap.c   |  142 +++--
 ksrc/skins/native/intr.c   |  137 ++--
 ksrc/skins/native/module.c |9 +--
 ksrc/skins/native/mutex.c  |  147 --
 ksrc/skins/native/pipe.c   |   40 +++
 ksrc/skins/native/queue.c  |  139 -
 ksrc/skins/native/sem.c|  124 +
 12 files changed, 792 insertions(+), 485 deletions(-)

diff --git a/ksrc/nucleus/heap.c b/ksrc/nucleus/heap.c
index 2b148fc..a7e3ae4 100644
--- a/ksrc/nucleus/heap.c
+++ b/ksrc/nucleus/heap.c
@@ -144,7 +144,7 @@ static int vfile_show(struct xnvfile_snapshot_iterator *it, 
void *data)
   p->usable_mem,
   p->used_mem,
   p->page_size,
-  sizeof(p->label),
+  (int)sizeof(p->label),
   p->label);
return 0;
 }
diff --git a/ksrc/skins/native/alarm.c b/ksrc/skins/native/alarm.c
index 1130dfb..eeb714a 100644
--- a/ksrc/skins/native/alarm.c
+++ b/ksrc/skins/native/alarm.c
@@ -45,67 +45,98 @@
 
 #ifdef CONFIG_PROC_FS
 
-static int __alarm_read_proc(char *page,
-char **start,
-off_t off, int count, int *eof, void *data)
-{
-   RT_ALARM *alarm = (RT_ALARM *)data;
-   char *p = page;
-   int len;
-   spl_t s;
+struct vfile_priv {
+   struct xnpholder *curr;
+   RTIME interval;
+   unsigned long expiries;
+};
 
-   xnlock_get_irqsave(&nklock, s);
+struct vfile_data {
+   char name[XNOBJECT_NAME_LEN];
+};
 
-   p += sprintf(p, "interval=%Lu:expiries=%lu\n",
-rt_timer_tsc2ns(xntimer_interval(&alarm->timer_base)),
-alarm->expiries);
+static int vfile_rewind(struct xnvfile_snapshot_iterator *it)
+{
+   struct vfile_priv *priv = xnvfile_iterator_priv(it);
+   RT_ALARM *alarm = xnvfile_priv(it->vfile);
 
-#ifdef CONFIG_XENO_OPT_PERVASIVE
-   {
-   xnpholder_t *holder =
-   getheadpq(xnsynch_wait_queue(&alarm->synch_base));
-
-   while (holder) {
-   xnthread_t *sleeper = link2thread(holder, plink);
-   p += sprintf(p, "+%s\n", xnthread_name(sleeper));
-   holder =
-   nextpq(xnsynch_wait_queue(&alarm->synch_base),
-  holder);
-   }
-   }
-#endif /* CONFIG_XENO_OPT_PERVASIVE */
+   alarm = xeno_h2obj_validate(alarm, XENO_ALARM_MAGIC, RT_ALARM);
+   if (alarm == NULL)
+   return -EIDRM;
 
-   xnlock_put_irqrestore(&nklock, s);
+   priv->curr = getheadpq(xnsynch_wait_queue(&alarm->synch_base));
+   priv->interval = rt_timer_tsc2ns(xntimer_interval(&alarm->timer_base));
+   priv->expiries = alarm->expiries;
 
-   len = (p - page) - off;
-   if (len <= off + count)
-   *eof = 1;
-   *start = page + off;
-   if (len > count)
-   len = count;
-   if (len < 0)
-   len = 0;
+   return xnsynch_nsleepers(&alarm->synch_base);
+}
 
-   return len;
+static int vfile_next(struct xnvfile_snapshot_iterator *it, void *data)
+{
+   struct vfile_priv *priv = xnvfile_iterator_priv(it);
+   RT_ALARM *alarm = xnvfile_priv(it->vfile);
+   struct vfile_data *p = data;
+   struct xnthread *thread;
+
+   if (priv->curr == NULL)
+   return 0;   /* We are done. */
+
+   /* Fetch current waiter, advance list cursor. */
+   thread = link2thread(priv->curr, plink);
+   priv->curr = nextpq(xnsynch_wait_queue(&alarm->synch_base),
+   priv->curr);
+   /* Collect thread name to be output in ->show(). */
+   strncpy(p->name, xnthread_name(thread), sizeof(p->name));
+
+   return 1;
 }
 
-extern xnptree_t __native_ptree;
+static int vfile_show(struct xnvfile_snapshot_iterator *it, void *data)
+{
+   struct vfile_priv *priv = xnvfile_iterator_priv(it);
+   struct vfile_data *p = data;
+
+   if (p == NULL) {/* Dump header. */
+   xnvfile_printf(it, "%8s  %s\n", "INTERVAL", "EXPIRIES");
+   xnvfile_printf(it, "%8Lu  

[Xenomai-git] Alexis Berlemont : analogy: [fake - loop] remove volatile keywords

2010-06-18 Thread GIT version control
Module: xenomai-abe
Branch: experimental
Commit: 39349242051ab0a25fb4275df6a8f900449b8b22
URL:
http://git.xenomai.org/?p=xenomai-abe.git;a=commit;h=39349242051ab0a25fb4275df6a8f900449b8b22

Author: Alexis Berlemont 
Date:   Sat Jun 19 00:33:01 2010 +0200

analogy: [fake - loop] remove volatile keywords

Remove the volatile keyword in front of concurrently accessed
variables and use, instead, RTDM_EXECUTE_ATOMICALLY. Maybe it is a bit
nicer even for some testing drivers.

---

 ksrc/drivers/analogy/testing/fake.c |   12 
 ksrc/drivers/analogy/testing/loop.c |   16 +++-
 2 files changed, 19 insertions(+), 9 deletions(-)

diff --git a/ksrc/drivers/analogy/testing/fake.c 
b/ksrc/drivers/analogy/testing/fake.c
index 27d6d88..878a28f 100644
--- a/ksrc/drivers/analogy/testing/fake.c
+++ b/ksrc/drivers/analogy/testing/fake.c
@@ -29,7 +29,7 @@ struct ai_priv {
/* Misc fields */
unsigned long amplitude_div;
unsigned long quanta_cnt;
-   volatile int timer_running;
+   int timer_running;
 
 };
 
@@ -115,7 +115,11 @@ static void ai_task_proc(void *arg)
uint64_t now_ns, elapsed_ns=0;
 
while(1) {
-   if(priv->timer_running != 0)
+   int running;
+
+   RTDM_EXECUTE_ATOMICALLY(running = priv->timer_running);
+
+   if(running)
{
int i = 0;
 
@@ -168,7 +172,7 @@ static int ai_cmd(a4l_subd_t *subd, a4l_cmd_t *cmd)
priv->current_ns = ((unsigned long)priv->last_ns);
priv->reminder_ns = 0;
   
-   priv->timer_running = 1;
+   RTDM_EXECUTE_ATOMICALLY(priv->timer_running = 1);
   
return 0;
   
@@ -193,7 +197,7 @@ static int ai_cancel(a4l_subd_t *subd)
 {
struct ai_priv *priv = (struct ai_priv *)subd->priv;
 
-   priv->timer_running = 0;
+   RTDM_EXECUTE_ATOMICALLY(priv->timer_running = 0);
 
return 0;
 }
diff --git a/ksrc/drivers/analogy/testing/loop.c 
b/ksrc/drivers/analogy/testing/loop.c
index 72748d8..f9c4bf8 100644
--- a/ksrc/drivers/analogy/testing/loop.c
+++ b/ksrc/drivers/analogy/testing/loop.c
@@ -44,7 +44,7 @@ struct loop_priv {
a4l_task_t loop_task;
 
/* Misc fields */
-   volatile int loop_running:1;
+   int loop_running;
uint16_t loop_insn_value;
 };
 typedef struct loop_priv lpprv_t;
@@ -78,8 +78,12 @@ static void loop_task_proc(void *arg)
}
 
while (1) {
+
+   int running;
+
+   RTDM_EXECUTE_ATOMICALLY(running = priv->loop_running);

-   if (priv->loop_running) {
+   if (running) {
uint16_t value;
int ret=0;

@@ -87,7 +91,6 @@ static void loop_task_proc(void *arg)

ret = a4l_buf_get(output_subd, 
  &value, sizeof(uint16_t));
-
if (ret == 0) {
 
a4l_info(dev, 
@@ -116,6 +119,7 @@ static void loop_task_proc(void *arg)
 int loop_cmd(a4l_subd_t *subd, a4l_cmd_t *cmd)
 {
a4l_info(subd->dev, "loop_cmd: (subd=%d)\n", subd->idx);  
+
return 0;
   
 }
@@ -127,7 +131,8 @@ int loop_trigger(a4l_subd_t *subd, lsampl_t trignum)
 
a4l_info(subd->dev, "loop_trigger: (subd=%d)\n", subd->idx);  
 
-   priv->loop_running = 1;
+   RTDM_EXECUTE_ATOMICALLY(priv->loop_running = 1);
+
return 0;
 }
 
@@ -138,7 +143,7 @@ int loop_cancel(a4l_subd_t *subd)
 
a4l_info(subd->dev, "loop_cancel: (subd=%d)\n", subd->idx);
 
-   priv->loop_running = 0;
+   RTDM_EXECUTE_ATOMICALLY(priv->loop_running = 0);
 
return 0;
 }
@@ -201,6 +206,7 @@ void setup_output_subd(a4l_subd_t *subd)
subd->rng_desc = &loop_rngdesc;
subd->chan_desc = &loop_chandesc;
subd->do_cmd = loop_cmd;
+   subd->cancel = loop_cancel;
subd->trigger = loop_trigger;
subd->cmd_mask = &loop_cmd_mask;
subd->insn_read = loop_insn_read;


___
Xenomai-git mailing list
Xenomai-git@gna.org
https://mail.gna.org/listinfo/xenomai-git


[Xenomai-git] Alexis Berlemont : analogy: add a detail in a4l_close doxygen doc

2010-06-18 Thread GIT version control
Module: xenomai-abe
Branch: experimental
Commit: dfc33ca84abfd752d985a5d390333b10f86bf74c
URL:
http://git.xenomai.org/?p=xenomai-abe.git;a=commit;h=dfc33ca84abfd752d985a5d390333b10f86bf74c

Author: Alexis Berlemont 
Date:   Sat Jun 19 00:39:42 2010 +0200

analogy: add a detail in a4l_close doxygen doc

---

 src/drvlib/analogy/descriptor.c |5 +
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/src/drvlib/analogy/descriptor.c b/src/drvlib/analogy/descriptor.c
index c5bb0bc..a7addc0 100644
--- a/src/drvlib/analogy/descriptor.c
+++ b/src/drvlib/analogy/descriptor.c
@@ -315,6 +315,11 @@ int a4l_open(a4l_desc_t * dsc, const char *fname)
 /**
  * @brief Close the Analogy device related with the descriptor
  *
+ * The file descriptor is associated with a context. The context is
+ * one of the enabler of asynchronous transfers. So, by closing the
+ * file descriptor, the programer must keep in mind that the currently
+ * occuring asynchronous transfer will cancelled.
+ *
  * @param[in] dsc Device descriptor
  *
  * @return 0 on success. Otherwise:


___
Xenomai-git mailing list
Xenomai-git@gna.org
https://mail.gna.org/listinfo/xenomai-git


[Xenomai-git] Alexis Berlemont : analogy: add an arbitrary sleep in cmd_write before closing the device

2010-06-18 Thread GIT version control
Module: xenomai-abe
Branch: experimental
Commit: ffd3562642484185911c8c316538dea2a4178796
URL:
http://git.xenomai.org/?p=xenomai-abe.git;a=commit;h=ffd3562642484185911c8c316538dea2a4178796

Author: Alexis Berlemont 
Date:   Sat Jun 19 00:45:16 2010 +0200

analogy: add an arbitrary sleep in cmd_write before closing the device

---

 src/utils/analogy/cmd_write.c |3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/src/utils/analogy/cmd_write.c b/src/utils/analogy/cmd_write.c
index 5ce9218..b65b8f6 100644
--- a/src/utils/analogy/cmd_write.c
+++ b/src/utils/analogy/cmd_write.c
@@ -22,6 +22,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -397,6 +398,8 @@ out_main:
if (dsc.sbdata != NULL)
free(dsc.sbdata);
 
+   sleep(1);
+
/* Release the file descriptor */
a4l_close(&dsc);
 


___
Xenomai-git mailing list
Xenomai-git@gna.org
https://mail.gna.org/listinfo/xenomai-git