[Xenomai-git] Stefan Kisdaroczi : debian: sync with 2.5.2-2 from debian.org

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

Author: Stefan Kisdaroczi ki...@hispeed.ch
Date:   Mon May  3 10:37:09 2010 +0200

debian: sync with 2.5.2-2 from debian.org

---

 debian/changelog|   17 +
 debian/libxenomai1.dirs |1 +
 debian/libxenomai1.lintian  |7 ++-
 debian/libxenomai1.modprobe |3 +++
 debian/libxenomai1.postinst |   20 ++--
 debian/libxenomai1.xenomai.init |1 -
 debian/rules|2 ++
 debian/xenomai-runtime.install  |1 +
 8 files changed, 48 insertions(+), 4 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 6d2d3cf..9f001a9 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,20 @@
+xenomai (2.5.2-2) unstable; urgency=low
+
+  * Added patch from Stefan Kisdaroczi ki...@hispeed.ch:
+- Create group xenomai on install
+- Added a init-script which sets /sys/.../xenomai_gid if
+  /sys/.../xenomai_gid exists
+- Added a modprobe-script that adds the xenomai_gid parameter if the user
+  did call modprobe without xenomai_gid=
+
+ -- Roland Stigge sti...@antcom.de  Sun, 02 May 2010 17:06:14 +0200
+
+xenomai (2.5.2-1) unstable; urgency=low
+
+  * New upstream release
+
+ -- Roland Stigge sti...@antcom.de  Mon, 29 Mar 2010 20:51:07 +0200
+
 xenomai (2.5.1-4) unstable; urgency=low
 
   * Added patches by Stefan Kisdaroczi ki...@hispeed.ch:
diff --git a/debian/libxenomai1.dirs b/debian/libxenomai1.dirs
index 1737ea1..35f4b51 100644
--- a/debian/libxenomai1.dirs
+++ b/debian/libxenomai1.dirs
@@ -1,2 +1,3 @@
+etc/modprobe.d
 etc/udev/rules.d
 usr/share/lintian/overrides
diff --git a/debian/libxenomai1.lintian b/debian/libxenomai1.lintian
index fe0da46..f5694a3 100644
--- a/debian/libxenomai1.lintian
+++ b/debian/libxenomai1.lintian
@@ -1,2 +1,7 @@
-# no contained shared library names refer to xenomai, therefore own name
+# The package libxenomai1 first didn't contain a library called *xenomai*.
+# Therefore, I called it libxenomai1. Now, upstream introduced libxenomai0 in
+# the package.  I'm leaving the package name libxenomai1 for now since
+# downgrading the number in the package name is probably a bad idea, and
+# synchronizing the package name with the SO version number isn't easily
+# possible anyway since the package contains several libraries.
 libxenomai1: package-name-doesnt-match-sonames libanalogy1 libnative3 libpsos0 
libpthread-rt1 librtai0 librtdk0 librtdm1 libuitron0 libvrtx0 libvxworks1 
libxenomai0
diff --git a/debian/libxenomai1.modprobe b/debian/libxenomai1.modprobe
new file mode 100644
index 000..1953854
--- /dev/null
+++ b/debian/libxenomai1.modprobe
@@ -0,0 +1,3 @@
+install xeno_nucleus /sbin/modprobe --ignore-install xeno_nucleus 
$CMDLINE_OPTS \
+  $(/usr/bin/test $(/bin/echo -n '$CMDLINE_OPTS' | /bin/grep xenomai_gid) \
+|| /usr/bin/getent group xenomai | /usr/bin/cut -d: -f3 | /bin/sed -e 
's/^/xenomai_gid\=/')
diff --git a/debian/libxenomai1.postinst b/debian/libxenomai1.postinst
index 8afc6fc..97c3476 100644
--- a/debian/libxenomai1.postinst
+++ b/debian/libxenomai1.postinst
@@ -1,6 +1,22 @@
 #!/bin/sh -e
 
-rm -f /etc/udev/rules.d/xenomai.rules
-ln -sf ../xenomai.rules /etc/udev/rules.d/xenomai.rules
+case $1 in
+configure)
+# Add the xenomai group unless it's already there
+if ! getent group xenomai /dev/null; then
+addgroup --quiet --system xenomai || true
+fi
+rm -f /etc/udev/rules.d/xenomai.rules
+ln -sf ../xenomai.rules /etc/udev/rules.d/xenomai.rules
+;;
+
+abort-upgrade|abort-remove|abort-deconfigure)
+;;
+
+*)
+echo postinst called with unknown argument \`$1' 2
+exit 1
+;;
+esac
 
 #DEBHELPER#
diff --git a/debian/libxenomai1.xenomai.init b/debian/libxenomai1.xenomai.init
index ebb5092..e243b5e 100644
--- a/debian/libxenomai1.xenomai.init
+++ b/debian/libxenomai1.xenomai.init
@@ -24,7 +24,6 @@ case $1 in
 echo -1  $FILENAME
 ;;
   restart|force-reload)
-$0 stop
 $0 start
 ;;
   *)
diff --git a/debian/rules b/debian/rules
index 4cb53a3..e39977d 100755
--- a/debian/rules
+++ b/debian/rules
@@ -38,6 +38,7 @@ endif
CONFIG_OPTS += --prefix=/usr \
--includedir=/usr/include/xenomai \
--mandir=/usr/share/man \
+   --with-testdir=/usr/lib/xenomai
 
 ifneq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE))
CONFIG_OPTS += --build $(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE)
@@ -97,6 +98,7 @@ install: build
for f in $(CURDIR)/ksrc/nucleus/udev/*.rules ; do \
cat $$f  $(CURDIR)/debian/libxenomai1/etc/udev/xenomai.rules ; \
done
+   install -m 644 debian/libxenomai1.modprobe 
$(CURDIR)/debian/libxenomai1/etc/modprobe.d/xenomai.conf
# 

[Xenomai-git] Gilles Chanteperdrix : arm: handle correctly primary mode VFP exceptions

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

Author: Gilles Chanteperdrix gilles.chanteperd...@xenomai.org
Date:   Tue May  4 01:35:19 2010 +0200

arm: handle correctly primary mode VFP exceptions

---

 include/asm-arm/bits/pod.h |   16 +++-
 include/asm-arm/hal.h  |5 +-
 include/asm-arm/system.h   |  231 +++-
 ksrc/arch/arm/switch.S |   12 +-
 4 files changed, 147 insertions(+), 117 deletions(-)

diff --git a/include/asm-arm/bits/pod.h b/include/asm-arm/bits/pod.h
index f8965f7..9304250 100644
--- a/include/asm-arm/bits/pod.h
+++ b/include/asm-arm/bits/pod.h
@@ -142,8 +142,20 @@ static inline void xnarch_enable_fpu(xnarchtcb_t *tcb)
   pick the correct FPU context.
*/
if (likely(!tcb-is_root)
-   || (tcb-fpup  tcb-fpup == rthal_task_fpenv(tcb-user_task)))
-   rthal_enable_fpu();
+   || (tcb-fpup  tcb-fpup == rthal_task_fpenv(tcb-user_task))) {
+   unsigned fpexc = rthal_enable_fpu();
+   if (likely(!(fpexc  RTHAL_VFP_ANY_EXC)
+   !(rthal_vfp_fmrx(FPSCR)  FPSCR_IXE)))
+   return;
+
+   /* If current process has pending exceptions it is
+  illegal to restore the FPEXC register with them, we must
+  save the fpu state and disable them, to get linux
+  fpu fault handler take care of them correctly. */
+   rthal_save_fpu(tcb-fpup, fpexc);
+   last_VFP_context[smp_processor_id()] = NULL;
+   rthal_disable_fpu();
+   }
 #else /* !CONFIG_VFP */
if (!tcb-user_task)
rthal_enable_fpu();
diff --git a/include/asm-arm/hal.h b/include/asm-arm/hal.h
index 1d731aa..1787094 100644
--- a/include/asm-arm/hal.h
+++ b/include/asm-arm/hal.h
@@ -249,10 +249,13 @@ extern union vfp_state *last_VFP_context[NR_CPUS];
 #define rthal_disable_fpu() \
 rthal_vfp_fmxr(FPEXC, rthal_vfp_fmrx(FPEXC)  ~FPEXC_EN)
 
+#define RTHAL_VFP_ANY_EXC \
+   (FPEXC_EX|FPEXC_DEX|FPEXC_FP2V|FPEXC_VV|FPEXC_TRAP_MASK)
+
 #define rthal_enable_fpu() \
 ({ \
unsigned _fpexc = rthal_vfp_fmrx(FPEXC) | FPEXC_EN; \
-   rthal_vfp_fmxr(FPEXC, _fpexc);  \
+   rthal_vfp_fmxr(FPEXC, _fpexc  ~RTHAL_VFP_ANY_EXC); \
_fpexc; \
 })
 
diff --git a/include/asm-arm/system.h b/include/asm-arm/system.h
index ebc1b7d..3cbf43b 100644
--- a/include/asm-arm/system.h
+++ b/include/asm-arm/system.h
@@ -3,7 +3,7 @@
  *
  * ARM port
  *   Copyright (C) 2005 Stelian Pop
- *   
+ *
  * 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
@@ -11,7 +11,7 @@
  *
  * 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
+ * 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
@@ -29,66 +29,66 @@
 #include asm-generic/xenomai/system.h
 #include asm/xenomai/syscall.h
 
-#define XNARCH_THREAD_STACKSZ   4096
+#define XNARCH_THREAD_STACKSZ  4096
 
-#define xnarch_stack_size(tcb)  ((tcb)-stacksize)
+#define xnarch_stack_size(tcb) ((tcb)-stacksize)
 #define xnarch_stack_base(tcb) ((tcb)-stackbase)
 #define xnarch_stack_end(tcb)  ((caddr_t)(tcb)-stackbase - (tcb)-stacksize)
-#define xnarch_user_task(tcb)   ((tcb)-user_task)
-#define xnarch_user_pid(tcb)((tcb)-user_task-pid)
+#define xnarch_user_task(tcb)  ((tcb)-user_task)
+#define xnarch_user_pid(tcb)   ((tcb)-user_task-pid)
 
 struct xnthread;
 struct task_struct;
 
 typedef struct xnarchtcb {  /* Per-thread arch-dependent block */
 
-/* Kernel mode side */
+   /* Kernel mode side */
 
 #ifdef CONFIG_XENO_HW_FPU
-rthal_fpenv_t fpuenv;
-rthal_fpenv_t *fpup;   /* Pointer to the FPU backup area */
-struct task_struct *user_fpu_owner;
-/* Pointer the the FPU owner in userspace:
-   - NULL for RT K threads,
-   - last_task_used_math for Linux US threads (only current or NULL when 
MP)
-   - current for RT US threads.
-*/
-unsigned is_root;
-#define xnarch_fpu_ptr(tcb) ((tcb)-fpup)
+   rthal_fpenv_t fpuenv;
+   rthal_fpenv_t *fpup;/* Pointer to the FPU backup area */
+   struct task_struct *user_fpu_owner;
+   /* Pointer the the FPU owner in userspace:
+  - NULL for RT K threads,
+  - 

[Xenomai-git] Gilles Chanteperdrix : arm: add missing #include

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

Author: Gilles Chanteperdrix gilles.chanteperd...@xenomai.org
Date:   Tue May  4 03:44:01 2010 +0200

arm: add missing #include

avoids the compilation warning:
wrappers.h:88: warning: IPIPE_MAJOR_NUMBER is not defined

---

 include/asm-arm/wrappers.h |   17 +
 1 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/include/asm-arm/wrappers.h b/include/asm-arm/wrappers.h
index 42d90b7..08ac004 100644
--- a/include/asm-arm/wrappers.h
+++ b/include/asm-arm/wrappers.h
@@ -24,11 +24,12 @@
 #error Pure kernel header included from user-space!
 #endif
 
-#include asm-generic/xenomai/wrappers.h /* Read the generic portion. */
+#include linux/ipipe.h
 #include linux/interrupt.h
+#include asm-generic/xenomai/wrappers.h /* Read the generic portion. */
 
 #define wrap_phys_mem_prot(filp,pfn,size,prot) (prot)
- 
+
 #define wrap_strncpy_from_user(dstP, srcP, n)  __strncpy_from_user(dstP, srcP, 
n)
 
 #define rthal_irq_desc_status(irq) (rthal_irq_descp(irq)-status)
@@ -70,13 +71,13 @@ extern void (*fp_init)(union fp_state *);
 #define rthal_irq_chip_end(irq)  ({ rthal_irq_descp(irq)-ipipe_end(irq, 
rthal_irq_descp(irq)); 0; })
 typedef irq_handler_t rthal_irq_host_handler_t;
 #define rthal_mark_irq_disabled(irq) do {  \
-rthal_irq_desc_status(irq) |= IRQ_DISABLED; \
-rthal_irq_descp(irq)-depth = 1;\
-} while(0);
+   rthal_irq_desc_status(irq) |= IRQ_DISABLED; \
+   rthal_irq_descp(irq)-depth = 1;\
+   } while(0);
 #define rthal_mark_irq_enabled(irq) do { \
-rthal_irq_desc_status(irq) = ~IRQ_DISABLED; \
-rthal_irq_descp(irq)-depth = 0; \
-} while(0);
+   rthal_irq_desc_status(irq) = ~IRQ_DISABLED; \
+   rthal_irq_descp(irq)-depth = 0; \
+   } while(0);
 static inline void fp_init(union fp_state *state)
 {
 /* FIXME: This is insufficient. */


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


[Xenomai-git] Philippe Gerum : arm: convert to I-pipe sysinfo v2

2010-05-04 Thread GIT version control
Module: xenomai-rpm
Branch: for-upstream
Commit: 957bfd6acb444b3f44a453def9401dff49f7d17f
URL:
http://git.xenomai.org/?p=xenomai-rpm.git;a=commit;h=957bfd6acb444b3f44a453def9401dff49f7d17f

Author: Philippe Gerum r...@xenomai.org
Date:   Sun May  2 12:19:26 2010 +0200

arm: convert to I-pipe sysinfo v2

---

 include/asm-arm/bits/init.h   |2 +-
 include/asm-arm/bits/shadow.h |   22 +++---
 include/asm-arm/bits/timer.h  |2 +-
 include/asm-arm/hal.h |   17 -
 ksrc/arch/arm/hal.c   |2 +-
 5 files changed, 30 insertions(+), 15 deletions(-)

diff --git a/include/asm-arm/bits/init.h b/include/asm-arm/bits/init.h
index 2fd959f..a6ecc17 100644
--- a/include/asm-arm/bits/init.h
+++ b/include/asm-arm/bits/init.h
@@ -82,7 +82,7 @@ static inline int xnarch_init(void)
set_cpus_allowed(current, cpumask_of_cpu(0));
 #endif /* CONFIG_SMP  MODULE */
 
-   xnarch_init_timeconv(RTHAL_CPU_FREQ);
+   xnarch_init_timeconv(RTHAL_CLOCK_FREQ);
 
ret = xnarch_calibrate_sched();
if (ret)
diff --git a/include/asm-arm/bits/shadow.h b/include/asm-arm/bits/shadow.h
index 6625d92..a396510 100644
--- a/include/asm-arm/bits/shadow.h
+++ b/include/asm-arm/bits/shadow.h
@@ -138,26 +138,26 @@ static inline int xnarch_local_syscall(struct pt_regs 
*regs)
if (error)
return error;
 
-   switch (ipipe_info.archdep.tsc.type) {
+   switch (RTHAL_TSC_INFO(ipipe_info).type) {
case IPIPE_TSC_TYPE_FREERUNNING:
info.type = __XN_TSC_TYPE_FREERUNNING,
-   info.u.fr.counter = ipipe_info.archdep.tsc.u.fr.counter;
-   info.u.fr.mask = ipipe_info.archdep.tsc.u.fr.mask;
-   info.u.fr.tsc = ipipe_info.archdep.tsc.u.fr.tsc;
+   info.u.fr.counter = 
RTHAL_TSC_INFO(ipipe_info).u.fr.counter;
+   info.u.fr.mask = RTHAL_TSC_INFO(ipipe_info).u.fr.mask;
+   info.u.fr.tsc = RTHAL_TSC_INFO(ipipe_info).u.fr.tsc;
break;
case IPIPE_TSC_TYPE_DECREMENTER:
info.type = __XN_TSC_TYPE_DECREMENTER,
-   info.u.dec.counter = 
ipipe_info.archdep.tsc.u.dec.counter;
-   info.u.dec.mask = ipipe_info.archdep.tsc.u.dec.mask;
-   info.u.dec.last_cnt = 
ipipe_info.archdep.tsc.u.dec.last_cnt;
-   info.u.dec.tsc = ipipe_info.archdep.tsc.u.dec.tsc;
+   info.u.dec.counter = 
RTHAL_TSC_INFO(ipipe_info).u.dec.counter;
+   info.u.dec.mask = 
RTHAL_TSC_INFO(ipipe_info).u.dec.mask;
+   info.u.dec.last_cnt = 
RTHAL_TSC_INFO(ipipe_info).u.dec.last_cnt;
+   info.u.dec.tsc = RTHAL_TSC_INFO(ipipe_info).u.dec.tsc;
break;
 #ifdef IPIPE_TSC_TYPE_FREERUNNING_COUNTDOWN
case IPIPE_TSC_TYPE_FREERUNNING_COUNTDOWN:
info.type = __XN_TSC_TYPE_FREERUNNING_COUNTDOWN,
-   info.u.fr.counter = ipipe_info.archdep.tsc.u.fr.counter;
-   info.u.fr.mask = ipipe_info.archdep.tsc.u.fr.mask;
-   info.u.fr.tsc = ipipe_info.archdep.tsc.u.fr.tsc;
+   info.u.fr.counter = 
RTHAL_TSC_INFO(ipipe_info).u.fr.counter;
+   info.u.fr.mask = RTHAL_TSC_INFO(ipipe_info).u.fr.mask;
+   info.u.fr.tsc = RTHAL_TSC_INFO(ipipe_info).u.fr.tsc;
break;
 #endif /* IPIPE_TSC_TYPE_FREERUNNING_COUNTDOWN */
case IPIPE_TSC_TYPE_NONE:
diff --git a/include/asm-arm/bits/timer.h b/include/asm-arm/bits/timer.h
index c68e268..90e9de1 100644
--- a/include/asm-arm/bits/timer.h
+++ b/include/asm-arm/bits/timer.h
@@ -30,7 +30,7 @@
 static inline void xnarch_program_timer_shot(unsigned long delay)
 {
rthal_timer_program_shot(rthal_imuldiv_ceil
-(delay, RTHAL_TIMER_FREQ, RTHAL_CPU_FREQ));
+(delay, RTHAL_TIMER_FREQ, RTHAL_CLOCK_FREQ));
 }
 
 static inline int xnarch_send_timer_ipi(xnarch_cpumask_t mask)
diff --git a/include/asm-arm/hal.h b/include/asm-arm/hal.h
index 1787094..2dae6da 100644
--- a/include/asm-arm/hal.h
+++ b/include/asm-arm/hal.h
@@ -126,7 +126,22 @@ static inline __attribute_const__ unsigned long ffnz 
(unsigned long ul)
 #include asm/mach/irq.h
 #include asm/cacheflush.h
 
-#define RTHAL_TIMER_IRQ   __ipipe_mach_timerint
+#ifndef RTHAL_TIMER_IRQ
+/*
+ * Default setting, unless pre-set in the machine-dependent section.
+ */
+#ifdef __IPIPE_FEATURE_SYSINFO_V2
+#define RTHAL_TIMER_IRQ__ipipe_mach_hrtimer_irq
+#else
+#define RTHAL_TIMER_IRQ__ipipe_mach_timerint
+#endif /* __IPIPE_FEATURE_SYSINFO_V2 */
+#endif /* RTHAL_TIMER_IRQ */
+
+#ifdef __IPIPE_FEATURE_SYSINFO_V2
+#define RTHAL_TSC_INFO(p)  

[Xenomai-git] Alexis Berlemont : analogy: fix a misuse of channel descriptors in a4l_get_chan

2010-05-04 Thread GIT version control
Module: xenomai-abe
Branch: analogy
Commit: ae588033a71f56f7236b202bc0a64ddb13c3a999
URL:
http://git.xenomai.org/?p=xenomai-abe.git;a=commit;h=ae588033a71f56f7236b202bc0a64ddb13c3a999

Author: Alexis Berlemont alexis.berlem...@gmail.com
Date:   Fri Apr  2 22:52:30 2010 +0200

analogy: fix a misuse of channel descriptors in a4l_get_chan

The mode of the channel descriptor (global or specific) was not taken
into account so as to find out the channel index.

---

 ksrc/drivers/analogy/buffer.c |   18 +++---
 1 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/ksrc/drivers/analogy/buffer.c b/ksrc/drivers/analogy/buffer.c
index bbd79ec..3ec558a 100644
--- a/ksrc/drivers/analogy/buffer.c
+++ b/ksrc/drivers/analogy/buffer.c
@@ -112,7 +112,7 @@ a4l_cmd_t *a4l_get_cmd(a4l_subd_t *subd)
 int a4l_get_chan(a4l_subd_t *subd)
 {
a4l_dev_t *dev = subd-dev;
-   int i, tmp_count, tmp_size = 0; 
+   int i, j, tmp_count, tmp_size = 0;  
a4l_cmd_t *cmd;
 
/* Check that subdevice supports commands */
@@ -132,9 +132,11 @@ int a4l_get_chan(a4l_subd_t *subd)
/* We assume channels can have different sizes;
   so, we have to compute the global size of the channels
   in this command... */
-   for (i = 0; i  cmd-nb_chan; i++)
-   tmp_size += dev-transfer.subds[subd-idx]-chan_desc-
-   chans[CR_CHAN(cmd-chan_descs[i])].nb_bits;
+   for (i = 0; i  cmd-nb_chan; i++) {
+   j = (subd-chan_desc-mode != A4L_CHAN_GLOBAL_CHANDESC) ? 
+   CR_CHAN(cmd-chan_descs[i]) : 0;
+   tmp_size += subd-chan_desc-chans[j].nb_bits;
+   }
 
/* Translation bits - bytes */
tmp_size /= 8;
@@ -146,9 +148,11 @@ int a4l_get_chan(a4l_subd_t *subd)
 
/* ...and find the channel the last munged sample 
   was related with */
-   for (i = 0; tmp_count  0  i  cmd-nb_chan; i++)
-   tmp_count -= dev-transfer.subds[subd-idx]-chan_desc-
-   chans[CR_CHAN(cmd-chan_descs[i])].nb_bits;
+   for (i = 0; tmp_count  0  i  cmd-nb_chan; i++) {
+   j = (subd-chan_desc-mode != A4L_CHAN_GLOBAL_CHANDESC) ? 
+   CR_CHAN(cmd-chan_descs[i]) : 0;
+   tmp_count -= subd-chan_desc-chans[j].nb_bits;
+   }
 
if (tmp_count == 0)
return i;


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


[Xenomai-git] Daniele Nicolodi : analogy: make a4l_find_range return the index of the selected range

2010-05-04 Thread GIT version control
Module: xenomai-abe
Branch: analogy
Commit: 53470e6a5881c1174255746c3a0ba551e8b048cc
URL:
http://git.xenomai.org/?p=xenomai-abe.git;a=commit;h=53470e6a5881c1174255746c3a0ba551e8b048cc

Author: Daniele Nicolodi nicol...@science.unitn.it
Date:   Sun Apr  4 01:45:00 2010 +0200

analogy: make a4l_find_range return the index of the selected range

a4l_find_range did not provide the index of the most suitable
range. This patch fix this issue by making the function return the
index. -ENOENT is returned if no range was found.

---

 src/drvlib/analogy/range.c |   40 +++-
 1 files changed, 23 insertions(+), 17 deletions(-)

diff --git a/src/drvlib/analogy/range.c b/src/drvlib/analogy/range.c
index 934c52a..fc4e302 100644
--- a/src/drvlib/analogy/range.c
+++ b/src/drvlib/analogy/range.c
@@ -154,8 +154,9 @@ int a4l_sizeof_subd(a4l_sbinfo_t *subd)
  * @param[in] max Maximal limit value
  * @param[out] rng Found range
  *
- * @return 0 on success. Otherwise:
+ * @return The index of the most suitable range on success. Otherwise:
  *
+ * - -ENOENT is returned if a suitable range is not found.
  * - -EINVAL is returned if some argument is missing or wrong;
  *idx_subd, idx_chan and the dsc pointer should be checked; check
  *also the kernel log (dmesg); WARNING: a4l_fill_desc() should
@@ -171,10 +172,14 @@ int a4l_find_range(a4l_desc_t * dsc,
int i, ret;
long lmin, lmax;
a4l_chinfo_t *chinfo;
-   a4l_rnginfo_t *rnginfo;
+   a4l_rnginfo_t *rnginfo, *tmp = NULL;
+   unsigned int idx_rng = -ENOENT;
+
+   if (rng != NULL)
+   *rng = NULL;
 
/* Basic checkings */
-   if (dsc == NULL || rng == NULL)
+   if (dsc == NULL)
return -EINVAL;
 
/* a4l_fill_desc() must have been called on this descriptor */
@@ -184,38 +189,39 @@ int a4l_find_range(a4l_desc_t * dsc,
/* Retrieves the ranges count */
ret = a4l_get_chinfo(dsc, idx_subd, idx_chan, chinfo);
if (ret  0)
-   goto out_get_range;
+   return ret;
 
/* Initializes variables */
lmin = (long)(min * A4L_RNG_FACTOR);
lmax = (long)(max * A4L_RNG_FACTOR);
-   *rng = NULL;
 
/* Performs the research */
for (i = 0; i  chinfo-nb_rng; i++) {
 
ret = a4l_get_rnginfo(dsc, idx_subd, idx_chan, i, rnginfo);
if (ret  0)
-   goto out_get_range;
+   return ret;
 
if (A4L_RNG_UNIT(rnginfo-flags) == unit 
rnginfo-min = lmin  rnginfo-max = lmax) {
 
-   if (*rng != NULL) {
-   if (rnginfo-min = (*rng)-min 
-   rnginfo-max = (*rng)-max)
-   *rng = rnginfo;
-   } else
-   *rng = rnginfo;
+   if (tmp != NULL) {
+   if (rnginfo-min = tmp-min 
+   rnginfo-max = tmp-max) {
+   idx_rng = i;
+   tmp = rnginfo;
+   }
+   } else {
+   idx_rng = i;
+   tmp = rnginfo;
+   }
}
}
 
-out_get_range:
-
-   if (ret  0)
-   *rng = NULL;
+   if (rng != NULL)
+   *rng = tmp;
 
-   return ret;
+   return idx_rng;
 }
 
 /**


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


[Xenomai-git] Alexis Berlemont : analogy: make cmd_read work with infinite acquisitions ( -S 0)

2010-05-04 Thread GIT version control
Module: xenomai-abe
Branch: analogy
Commit: c27464ca9171fc2f1e769f62a1924cf43eb2fb8a
URL:
http://git.xenomai.org/?p=xenomai-abe.git;a=commit;h=c27464ca9171fc2f1e769f62a1924cf43eb2fb8a

Author: Alexis Berlemont alexis.berlem...@gmail.com
Date:   Mon Mar 22 22:37:33 2010 +0100

analogy: make cmd_read work with infinite acquisitions (-S 0)

---

 src/utils/analogy/cmd_read.c |6 --
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/utils/analogy/cmd_read.c b/src/utils/analogy/cmd_read.c
index ee65dc9..fb21081 100644
--- a/src/utils/analogy/cmd_read.c
+++ b/src/utils/analogy/cmd_read.c
@@ -244,6 +244,7 @@ int main(int argc, char *argv[])
 
/* Update the command structure */
cmd.scan_end_arg = cmd.nb_chan;
+   cmd.stop_src = cmd.stop_arg != 0 ? TRIG_COUNT : TRIG_NONE;
 
if (real_time != 0) {
 
@@ -328,8 +329,9 @@ int main(int argc, char *argv[])
 
if (verbose != 0) {
printf(cmd_read: scan size = %u\n, scan_size);
-   printf(cmd_read: size to read = %u\n,
-  scan_size * cmd.stop_arg);
+   if (cmd.stop_arg != 0)
+   printf(cmd_read: size to read = %u\n,
+  scan_size * cmd.stop_arg);
}
 
/* Cancel any former command which might be in progress */


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


[Xenomai-git] Alexis Berlemont : analogy: fix buffer checkings so as to allow infinite acquisitions

2010-05-04 Thread GIT version control
Module: xenomai-abe
Branch: analogy
Commit: 85b497d9a9589c547ae2829292f9557a09875324
URL:
http://git.xenomai.org/?p=xenomai-abe.git;a=commit;h=85b497d9a9589c547ae2829292f9557a09875324

Author: Alexis Berlemont alexis.berlem...@gmail.com
Date:   Mon Mar 22 01:00:01 2010 +0100

analogy: fix buffer checkings so as to allow infinite acquisitions

With unlimited acquisitions (cmd.stop_src == TRIG_NONE), the field
end_count displayed by the buffer descriptor is set to 0. Many
checkings in buffer.h did not properly handle this case.

---

 include/analogy/buffer.h |   11 ++-
 1 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/include/analogy/buffer.h b/include/analogy/buffer.h
index 0ab93ba..007f01e 100644
--- a/include/analogy/buffer.h
+++ b/include/analogy/buffer.h
@@ -201,7 +201,6 @@ static inline int __pre_put(a4l_buf_t * buf, unsigned long 
count)
 
 static inline int __pre_abs_get(a4l_buf_t * buf, unsigned long count)
 {
-
/* The first time, we expect the buffer to be properly filled
before the trigger occurence; by the way, we need tmp_count to
have been initialized and tmp_count is updated right here */
@@ -213,7 +212,7 @@ static inline int __pre_abs_get(a4l_buf_t * buf, unsigned 
long count)
last time, the DMA channel can easily overtake the tmp
frontier because no more data were sent from user space;
therefore no useless alarm should be sent */
-   if ((long)(count - buf-end_count)  0)
+   if (buf-end_count != 0  (long)(count - buf-end_count)  0)
goto out;
 
/* Once the exception are passed, we check that the DMA
@@ -253,7 +252,7 @@ static inline int __abs_put(a4l_buf_t * buf, unsigned long 
count)
if ((old / buf-size) != (count / buf-size))
set_bit(A4L_BUF_EOBUF_NR, buf-evt_flags);
 
-   if ((long)(count - buf-end_count) = 0)
+   if (buf-end_count != 0  (long)(count - buf-end_count) = 0)
set_bit(A4L_BUF_EOA_NR, buf-evt_flags);
 
return 0;
@@ -276,7 +275,7 @@ static inline int __abs_get(a4l_buf_t * buf, unsigned long 
count)
if ((old / buf-size) != count / buf-size)
set_bit(A4L_BUF_EOBUF_NR, buf-evt_flags);
 
-   if ((long)(count - buf-end_count) = 0)
+   if (buf-end_count != 0  (long)(count - buf-end_count) = 0)
set_bit(A4L_BUF_EOA_NR, buf-evt_flags);
 
return 0;
@@ -303,7 +302,9 @@ static inline unsigned long __count_to_get(a4l_buf_t * buf)
 {
unsigned long ret;
 
-   if (buf-end_count != 0  (long)(buf-end_count - buf-prd_count)  0)
+   /* If the acquisition is unlimited (end_count == 0), we must
+  not take into account end_count */
+   if (buf-end_count == 0 || (long)(buf-end_count - buf-prd_count)  0)
ret = buf-prd_count;
else
ret = buf-end_count;


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


[Xenomai-git] Daniele Nicolodi : analogy: minor change (white spaces removals)

2010-05-04 Thread GIT version control
Module: xenomai-abe
Branch: analogy
Commit: 5516e24c54b6eb06b553a64d2232300c0a98f014
URL:
http://git.xenomai.org/?p=xenomai-abe.git;a=commit;h=5516e24c54b6eb06b553a64d2232300c0a98f014

Author: Daniele Nicolodi nicol...@science.unitn.it
Date:   Sun Apr  4 15:09:29 2010 +0200

analogy: minor change (white spaces removals)

---

 src/drvlib/analogy/range.c |   24 
 1 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/src/drvlib/analogy/range.c b/src/drvlib/analogy/range.c
index fc4e302..51b0405 100644
--- a/src/drvlib/analogy/range.c
+++ b/src/drvlib/analogy/range.c
@@ -130,7 +130,7 @@ int a4l_sizeof_subd(a4l_sbinfo_t *subd)
   channels are acquired in one shot); for other kind of
   subdevice, the user must use a4l_sizeof_chan() so as to
   find out the size of the channel he wants to use */
-   if ((subd-flags  A4L_SUBD_TYPES) != A4L_SUBD_DIO  
+   if ((subd-flags  A4L_SUBD_TYPES) != A4L_SUBD_DIO 
(subd-flags  A4L_SUBD_TYPES) != A4L_SUBD_DI 
(subd-flags  A4L_SUBD_TYPES) != A4L_SUBD_DO)
return -EINVAL;
@@ -233,7 +233,7 @@ int a4l_find_range(a4l_desc_t * dsc,
  *
  * @param[in] chan Channel descriptor
  * @param[in] rng Range descriptor
- * @param[out] dst Ouput buffer 
+ * @param[out] dst Ouput buffer
  * @param[in] src Input buffer
  * @param[in] cnt Count of transfer to copy
  *
@@ -257,7 +257,7 @@ int a4l_rawtoul(a4l_chinfo_t * chan, unsigned long *dst, 
void *src, int cnt)
if (chan == NULL)
return -EINVAL;
 
-   /* Find out the size in memory */ 
+   /* Find out the size in memory */
size = a4l_sizeof_chan(chan);
 
/* Get the suitable accessor */
@@ -285,7 +285,7 @@ int a4l_rawtoul(a4l_chinfo_t * chan, unsigned long *dst, 
void *src, int cnt)
j++;
}
 
-   return j;   
+   return j;
 }
 
 /**
@@ -293,7 +293,7 @@ int a4l_rawtoul(a4l_chinfo_t * chan, unsigned long *dst, 
void *src, int cnt)
  *
  * @param[in] chan Channel descriptor
  * @param[in] rng Range descriptor
- * @param[out] dst Ouput buffer 
+ * @param[out] dst Ouput buffer
  * @param[in] src Input buffer
  * @param[in] cnt Count of conversion to perform
  *
@@ -322,7 +322,7 @@ int a4l_rawtof(a4l_chinfo_t * chan,
if (rng == NULL || chan == NULL)
return -EINVAL;
 
-   /* Find out the size in memory */ 
+   /* Find out the size in memory */
size = a4l_sizeof_chan(chan);
 
/* Get the suitable accessor */
@@ -366,7 +366,7 @@ int a4l_rawtof(a4l_chinfo_t * chan,
  *
  * @param[in] chan Channel descriptor
  * @param[in] rng Range descriptor
- * @param[out] dst Ouput buffer 
+ * @param[out] dst Ouput buffer
  * @param[in] src Input buffer
  * @param[in] cnt Count of conversion to perform
  *
@@ -395,7 +395,7 @@ int a4l_rawtod(a4l_chinfo_t * chan,
if (rng == NULL || chan == NULL)
return -EINVAL;
 
-   /* Find out the size in memory */ 
+   /* Find out the size in memory */
size = a4l_sizeof_chan(chan);
 
/* Get the suitable accessor */
@@ -443,7 +443,7 @@ int a4l_rawtod(a4l_chinfo_t * chan,
  *
  * @param[in] chan Channel descriptor
  * @param[in] rng Range descriptor
- * @param[out] dst Ouput buffer 
+ * @param[out] dst Ouput buffer
  * @param[in] src Input buffer
  * @param[in] cnt Count of transfer to copy
  *
@@ -495,7 +495,7 @@ int a4l_ultoraw(a4l_chinfo_t * chan, void *dst, unsigned 
long *src, int cnt)
j++;
}
 
-   return j;   
+   return j;
 }
 
 /**
@@ -503,7 +503,7 @@ int a4l_ultoraw(a4l_chinfo_t * chan, void *dst, unsigned 
long *src, int cnt)
  *
  * @param[in] chan Channel descriptor
  * @param[in] rng Range descriptor
- * @param[out] dst Ouput buffer 
+ * @param[out] dst Ouput buffer
  * @param[in] src Input buffer
  * @param[in] cnt Count of conversion to perform
  *
@@ -573,7 +573,7 @@ int a4l_ftoraw(a4l_chinfo_t * chan,
  *
  * @param[in] chan Channel descriptor
  * @param[in] rng Range descriptor
- * @param[out] dst Ouput buffer 
+ * @param[out] dst Ouput buffer
  * @param[in] src Input buffer
  * @param[in] cnt Count of conversion to perform
  *


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


[Xenomai-git] Alexis Berlemont : analogy: minor change in the header command.h

2010-05-04 Thread GIT version control
Module: xenomai-abe
Branch: analogy
Commit: 7711cf1c34ffebd8113c6d5d15724650eda72e64
URL:
http://git.xenomai.org/?p=xenomai-abe.git;a=commit;h=7711cf1c34ffebd8113c6d5d15724650eda72e64

Author: Alexis Berlemont alexis.berlem...@gmail.com
Date:   Thu Apr 15 01:41:55 2010 +0200

analogy: minor change in the header command.h

---

 include/analogy/command.h |   15 ++-
 1 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/include/analogy/command.h b/include/analogy/command.h
index 29120bf..ef53d91 100644
--- a/include/analogy/command.h
+++ b/include/analogy/command.h
@@ -171,11 +171,8 @@
 
  /*! @} CHAN_RNG_AREF */
 
-#if defined(__KERNEL__)  !defined(DOXYGEN_CPP)
-/* Channels macros only useful for the kernel side */
-#define CR_CHAN(a) CHAN(a)
-#define CR_RNG(a) (((a)16)0xff)
-#define CR_AREF(a) (((a)24)0xf)
+#if !defined(DOXYGEN_CPP)
+
 #define CR_FLAGS_MASK 0xfc00
 #define CR_ALT_FILTER (126)
 #define CR_DITHER CR_ALT_FILTER
@@ -183,8 +180,16 @@
 #define CR_ALT_SOURCE (127)
 #define CR_EDGE(128)
 #define CR_INVERT (129)
+
+#if defined(__KERNEL__) 
+/* Channels macros only useful for the kernel side */
+#define CR_CHAN(a) CHAN(a)
+#define CR_RNG(a) (((a)16)0xff)
+#define CR_AREF(a) (((a)24)0xf)
 #endif /* __KERNEL__ */
 
+#endif /* !DOXYGEN_CPP */
+
 /*! 
  * @brief Structure describing the asynchronous instruction
  * @see a4l_snd_command()


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


[Xenomai-git] Alexis Berlemont : analogy: add the test program cmd_bits (beta version)

2010-05-04 Thread GIT version control
Module: xenomai-abe
Branch: analogy
Commit: 81102feb54b5dba1a7cc81feb5aaa32bd4b05dc4
URL:
http://git.xenomai.org/?p=xenomai-abe.git;a=commit;h=81102feb54b5dba1a7cc81feb5aaa32bd4b05dc4

Author: Alexis Berlemont alexis.berlem...@gmail.com
Date:   Thu Apr 15 01:44:34 2010 +0200

analogy: add the test program cmd_bits (beta version)

---

 src/utils/analogy/Makefile.am |   10 +-
 src/utils/analogy/cmd_bits.c  |  256 +
 2 files changed, 263 insertions(+), 3 deletions(-)

diff --git a/src/utils/analogy/Makefile.am b/src/utils/analogy/Makefile.am
index d695eae..f82942e 100644
--- a/src/utils/analogy/Makefile.am
+++ b/src/utils/analogy/Makefile.am
@@ -1,6 +1,6 @@
 sbin_PROGRAMS = analogy_config
 
-bin_PROGRAMS = cmd_read cmd_write insn_read insn_write insn_bits
+bin_PROGRAMS = cmd_read cmd_write cmd_bits insn_read insn_write insn_bits
 
 CPPFLAGS = \
@XENO_USER_CFLAGS@ \
@@ -29,17 +29,21 @@ cmd_write_LDADD = \
../../skins/rtdm/librtdm.la \
../../skins/common/libxenomai.la
 
+cmd_bits_SOURCES = cmd_bits.c
+cmd_bits_LDADD = \
+   ../../drvlib/analogy/libanalogy.la \
+   ../../skins/rtdm/librtdm.la \
+   ../../skins/common/libxenomai.la
+
 insn_read_SOURCES = insn_read.c
 insn_read_LDADD = \
../../drvlib/analogy/libanalogy.la \
-   ../../skins/native/libnative.la \
../../skins/rtdm/librtdm.la \
../../skins/common/libxenomai.la
 
 insn_write_SOURCES = insn_write.c
 insn_write_LDADD = \
../../drvlib/analogy/libanalogy.la \
-   ../../skins/native/libnative.la \
../../skins/rtdm/librtdm.la \
../../skins/common/libxenomai.la
 
diff --git a/src/utils/analogy/cmd_bits.c b/src/utils/analogy/cmd_bits.c
new file mode 100644
index 000..0afb69f
--- /dev/null
+++ b/src/utils/analogy/cmd_bits.c
@@ -0,0 +1,256 @@
+
+/**
+ * @file
+ * Analogy for Linux, digital command test program
+ *
+ * @note Copyright (C) 1997-2000 David A. Schleef d...@schleef.org
+ * @note Copyright (C) 2008 Alexis Berlemont alexis.berlem...@free.fr
+ *
+ * Xenomai is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Xenomai is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Xenomai; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include stdint.h
+#include stdio.h
+#include stdlib.h
+#include sys/mman.h
+#include errno.h
+#include getopt.h
+
+#include analogy/analogy.h
+
+#define FILENAME analogy0
+
+static char *filename = FILENAME;
+static int verbose;
+
+/* TODO: to be removed */
+static unsigned int chans[4] = {0, 1, 2, 3};
+
+/* The command to send by default */
+a4l_cmd_t cmd = {
+   .idx_subd = -1,
+   .flags = 0,
+   .start_src = TRIG_INT,
+   .start_arg = 0,
+   .scan_begin_src = TRIG_EXT,
+   .scan_begin_arg = 0, /* in ns */
+   .convert_src = TRIG_NOW,
+   .convert_arg = 0, /* in ns */
+   .scan_end_src = TRIG_COUNT,
+   .scan_end_arg = 4,
+   .stop_src = TRIG_NONE,
+   .stop_arg = 0,
+   .nb_chan = 4,
+   .chan_descs = chans,
+};
+
+struct option cmd_bits_opts[] = {
+   {verbose, no_argument, NULL, 'v'},
+   {device, required_argument, NULL, 'd'},
+   {subdevice, required_argument, NULL, 's'},
+   {help, no_argument, NULL, 'h'},
+   {0},
+};
+
+void do_print_usage(void)
+{
+   fprintf(stdout, usage:\tcmd_bits [OPTS] bits_values mask\n);
+   fprintf(stdout, \tOPTS:\t -v, --verbose: verbose output\n);
+   fprintf(stdout,
+   \t\t -d, --device: 
+   device filename (analogy0, analogy1, ...)\n);
+   fprintf(stdout, \t\t -s, --subdevice: subdevice index\n);
+   fprintf(stdout, \t\t -h, --help: print this help\n);
+}
+
+int main(int argc, char *argv[])
+{
+   int i = 0, err = 0;
+   a4l_desc_t dsc = { .sbdata = NULL };
+   a4l_sbinfo_t *sbinfo;
+   int scan_size, idx_subd = -1;
+   int value, mask = 0;
+
+   /* Compute arguments */
+   while ((err = getopt_long(argc,
+ argv,
+ vd:s:h, cmd_bits_opts, NULL)) = 0) {
+   switch (err) {
+   case 'v':
+   verbose = 1;
+   break;
+   case 'd':
+   filename = optarg;
+   break;
+   case 's':
+   idx_subd = strtoul(optarg, NULL, 0);
+   break;
+   case 'h':
+  

[Xenomai-git] Alexis Berlemont : analogy: add triggering in cmd_bits

2010-05-04 Thread GIT version control
Module: xenomai-abe
Branch: analogy
Commit: 33f8d9db31c73db1e942066a3f6a1daf539896c2
URL:
http://git.xenomai.org/?p=xenomai-abe.git;a=commit;h=33f8d9db31c73db1e942066a3f6a1daf539896c2

Author: Alexis Berlemont alexis.berlem...@gmail.com
Date:   Wed Apr 21 00:28:01 2010 +0200

analogy: add triggering in cmd_bits

---

 src/utils/analogy/cmd_bits.c |   23 ++-
 1 files changed, 22 insertions(+), 1 deletions(-)

diff --git a/src/utils/analogy/cmd_bits.c b/src/utils/analogy/cmd_bits.c
index 0afb69f..aa0e082 100644
--- a/src/utils/analogy/cmd_bits.c
+++ b/src/utils/analogy/cmd_bits.c
@@ -56,6 +56,12 @@ a4l_cmd_t cmd = {
.chan_descs = chans,
 };
 
+a4l_insn_t insn = {
+   .type = A4L_INSN_INTTRIG,
+   .idx_subd = -1,
+   .data_size = 0,
+};
+
 struct option cmd_bits_opts[] = {
{verbose, no_argument, NULL, 'v'},
{device, required_argument, NULL, 'd'},
@@ -83,6 +89,9 @@ int main(int argc, char *argv[])
int scan_size, idx_subd = -1;
int value, mask = 0;
 
+   /* Trigger status, written data..., before triggering */
+   int triggered = 0, total = 0, trigger_threshold = 128;
+
/* Compute arguments */
while ((err = getopt_long(argc,
  argv,
@@ -185,7 +194,7 @@ int main(int argc, char *argv[])
goto out_cmd_bits;
}
 
-   cmd.idx_subd = idx_subd;
+   cmd.idx_subd = insn.idx_subd = idx_subd;
 
if ((sbinfo-flags  A4L_SUBD_TYPES) != A4L_SUBD_DIO 
(sbinfo-flags  A4L_SUBD_TYPES) != A4L_SUBD_DO) {
@@ -240,6 +249,18 @@ int main(int argc, char *argv[])
cmd_bits: a4l_write failed (err=%d)\n, err);
goto out_cmd_bits;
}
+   
+   total += err;
+
+   if (!triggered  total  trigger_threshold) {
+   err = a4l_snd_insn(dsc, insn);
+   if (err  0) {
+   fprintf(stderr, 
+   cmd_bits: triggering failed 
(err=%d)\n,
+   err);
+   goto out_cmd_bits;
+   }
+   }
 
} while (err  0);  
 


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


[Xenomai-git] Alexis Berlemont : analogy: minor cosmetic fix

2010-05-04 Thread GIT version control
Module: xenomai-abe
Branch: analogy
Commit: d82e71d39a4513d298ca8b37a944e1133eb5065c
URL:
http://git.xenomai.org/?p=xenomai-abe.git;a=commit;h=d82e71d39a4513d298ca8b37a944e1133eb5065c

Author: Alexis Berlemont alexis.berlem...@gmail.com
Date:   Thu Apr 15 01:42:39 2010 +0200

analogy: minor cosmetic fix

---

 ksrc/drivers/analogy/subdevice.c |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/ksrc/drivers/analogy/subdevice.c b/ksrc/drivers/analogy/subdevice.c
index 2d7811d..28aa4a0 100644
--- a/ksrc/drivers/analogy/subdevice.c
+++ b/ksrc/drivers/analogy/subdevice.c
@@ -67,19 +67,19 @@ a4l_rngdesc_t range_fake = RNG_GLOBAL(rng_fake);
 
 /* --- Basic channel / range management functions --- */
 
-a4l_chan_t *a4l_get_chfeat(a4l_subd_t * sb, int idx)
+a4l_chan_t *a4l_get_chfeat(a4l_subd_t *sb, int idx)
 {
int i = (sb-chan_desc-mode != A4L_CHAN_GLOBAL_CHANDESC) ? idx : 0;
return (sb-chan_desc-chans[i]);
 }
 
-a4l_rng_t *a4l_get_rngfeat(a4l_subd_t * sb, int chidx, int rngidx)
+a4l_rng_t *a4l_get_rngfeat(a4l_subd_t *sb, int chidx, int rngidx)
 {
int i = (sb-rng_desc-mode != A4L_RNG_GLOBAL_RNGDESC) ? chidx : 0;
return (sb-rng_desc-rngtabs[i]-rngs[rngidx]);
 }
 
-int a4l_check_chanlist(a4l_subd_t * subd,
+int a4l_check_chanlist(a4l_subd_t *subd,
   unsigned char nb_chan, unsigned int *chans)
 {
int i, j;


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


[Xenomai-git] Alexis Berlemont : analogy: in the core, call rtdm_in_rt_context() instead of a4l_test_rt()

2010-05-04 Thread GIT version control
Module: xenomai-abe
Branch: analogy
Commit: 9466cbb9e80298638153bb36e50ed410b6e246c3
URL:
http://git.xenomai.org/?p=xenomai-abe.git;a=commit;h=9466cbb9e80298638153bb36e50ed410b6e246c3

Author: Alexis Berlemont alexis.berlem...@gmail.com
Date:   Wed Apr 21 01:02:17 2010 +0200

analogy: in the core, call rtdm_in_rt_context() instead of a4l_test_rt()

---

 ksrc/drivers/analogy/buffer.c |   13 +++--
 ksrc/drivers/analogy/device.c |2 +-
 2 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/ksrc/drivers/analogy/buffer.c b/ksrc/drivers/analogy/buffer.c
index 3ec558a..d882810 100644
--- a/ksrc/drivers/analogy/buffer.c
+++ b/ksrc/drivers/analogy/buffer.c
@@ -400,7 +400,7 @@ int a4l_ioctl_mmap(a4l_cxt_t *cxt, void *arg)
 
/* The mmap operation cannot be performed in a 
   real-time context */
-   if (a4l_test_rt() != 0) {
+   if (rtdm_in_rt_context() != 0) {
return -ENOSYS;
}
 
@@ -475,7 +475,7 @@ int a4l_ioctl_bufcfg(a4l_cxt_t * cxt, void *arg)
 
/* As Linux API is used to allocate a virtual buffer,
   the calling process must not be in primary mode */
-   if (a4l_test_rt() != 0) {
+   if (rtdm_in_rt_context() != 0) {
return -ENOSYS;
}
 
@@ -730,7 +730,7 @@ ssize_t a4l_read(a4l_cxt_t * cxt, void *bufdata, size_t 
nbytes)
/* If the acquisition is not over, we must not
   leave the function without having read a least byte */
else {
-   ret = a4l_wait_sync((buf-sync), a4l_test_rt());
+   ret = a4l_wait_sync((buf-sync), rtdm_in_rt_context());
if (ret  0) {
if (ret == -ERESTARTSYS)
ret = -EINTR;
@@ -823,7 +823,7 @@ ssize_t a4l_write(a4l_cxt_t *cxt,
goto out_a4l_write;
} else {
/* The buffer is full, we have to wait for a slot to 
free */
-   ret = a4l_wait_sync((buf-sync), a4l_test_rt());
+   ret = a4l_wait_sync((buf-sync), rtdm_in_rt_context());
if (ret  0) {
if (ret == -ERESTARTSYS)
ret = -EINTR;
@@ -953,11 +953,12 @@ int a4l_ioctl_poll(a4l_cxt_t * cxt, void *arg)
goto out_poll;
 
if (poll.arg == A4L_INFINITE)
-   ret = a4l_wait_sync((buf-sync), a4l_test_rt());
+   ret = a4l_wait_sync((buf-sync), rtdm_in_rt_context());
else {
unsigned long long ns = ((unsigned long long)poll.arg) *
((unsigned long long)NSEC_PER_MSEC);
-   ret = a4l_timedwait_sync((buf-sync), a4l_test_rt(), ns);
+   ret = a4l_timedwait_sync((buf-sync), 
+rtdm_in_rt_context(), ns);
}
 
if (ret == 0) {
diff --git a/ksrc/drivers/analogy/device.c b/ksrc/drivers/analogy/device.c
index ec40b95..a840ada 100644
--- a/ksrc/drivers/analogy/device.c
+++ b/ksrc/drivers/analogy/device.c
@@ -427,7 +427,7 @@ int a4l_ioctl_devcfg(a4l_cxt_t * cxt, void *arg)
__a4l_dbg(1, core_dbg, 
  a4l_ioctl_devcfg: minor=%d\n, a4l_get_minor(cxt));
 
-   if (a4l_test_rt() != 0)
+   if (rtdm_in_rt_context() != 0)
return -ENOSYS;
 
if (arg == NULL) {


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


[Xenomai-git] Alexis Berlemont : analogy: remove useless device declarations in read / write syscalls handlers

2010-05-04 Thread GIT version control
Module: xenomai-abe
Branch: analogy
Commit: 70d495dc8f8ac8da98ff54ec06219238474c417d
URL:
http://git.xenomai.org/?p=xenomai-abe.git;a=commit;h=70d495dc8f8ac8da98ff54ec06219238474c417d

Author: Alexis Berlemont alexis.berlem...@gmail.com
Date:   Wed Apr 28 00:29:19 2010 +0200

analogy: remove useless device declarations in read / write syscalls handlers

---

 ksrc/drivers/analogy/rtdm_interface.c |4 
 1 files changed, 0 insertions(+), 4 deletions(-)

diff --git a/ksrc/drivers/analogy/rtdm_interface.c 
b/ksrc/drivers/analogy/rtdm_interface.c
index 99abf2f..2973b59 100644
--- a/ksrc/drivers/analogy/rtdm_interface.c
+++ b/ksrc/drivers/analogy/rtdm_interface.c
@@ -151,11 +151,9 @@ ssize_t a4l_rt_read(struct rtdm_dev_context * context,
rtdm_user_info_t * user_info, void *buf, size_t nbytes)
 {
a4l_cxt_t cxt;
-   a4l_dev_t *dev;
 
a4l_init_cxt(context, user_info, cxt);
a4l_set_dev(cxt);
-   dev = a4l_get_dev(cxt);
 
__a4l_dbg(1, core_dbg, 
  a4l_rt_read: minor=%d\n, a4l_get_minor(cxt));
@@ -171,11 +169,9 @@ ssize_t a4l_rt_write(struct rtdm_dev_context * context,
 size_t nbytes)
 {
a4l_cxt_t cxt;
-   a4l_dev_t *dev;
 
a4l_init_cxt(context, user_info, cxt);
a4l_set_dev(cxt);
-   dev = a4l_get_dev(cxt);
 
__a4l_dbg(1, core_dbg, a4l_rt_write: minor=%d\n, a4l_get_minor(cxt));
 


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


[Xenomai-git] Alexis Berlemont : analogy: fix a stupid bug in the use of rtdm_rt_capable( )

2010-05-04 Thread GIT version control
Module: xenomai-abe
Branch: analogy
Commit: 237c0525568813f474cf2fa21e5165b7a25f6792
URL:
http://git.xenomai.org/?p=xenomai-abe.git;a=commit;h=237c0525568813f474cf2fa21e5165b7a25f6792

Author: Alexis Berlemont alexis.berlem...@gmail.com
Date:   Tue May  4 23:13:35 2010 +0200

analogy: fix a stupid bug in the use of rtdm_rt_capable()

---

 ksrc/drivers/analogy/buffer.c |8 
 ksrc/drivers/analogy/command.c|2 +-
 ksrc/drivers/analogy/device.c |2 +-
 ksrc/drivers/analogy/instruction.c|4 ++--
 ksrc/drivers/analogy/rtdm_interface.c |4 ++--
 5 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/ksrc/drivers/analogy/buffer.c b/ksrc/drivers/analogy/buffer.c
index 916a571..ecbc379 100644
--- a/ksrc/drivers/analogy/buffer.c
+++ b/ksrc/drivers/analogy/buffer.c
@@ -391,7 +391,7 @@ int a4l_ioctl_mmap(a4l_cxt_t *cxt, void *arg)
 
/* The mmap operation cannot be performed in a 
   real-time context */
-   if (rtdm_in_rt_context() != 0) {
+   if (rtdm_in_rt_context()) {
return -ENOSYS;
}
 
@@ -469,7 +469,7 @@ int a4l_ioctl_bufcfg(a4l_cxt_t * cxt, void *arg)
 
/* As Linux API is used to allocate a virtual buffer,
   the calling process must not be in primary mode */
-   if (rtdm_in_rt_context() != 0) {
+   if (rtdm_in_rt_context()) {
return -ENOSYS;
}
 
@@ -536,7 +536,7 @@ int a4l_ioctl_bufinfo(a4l_cxt_t * cxt, void *arg)
__a4l_dbg(1, core_dbg, 
  a4l_ioctl_bufinfo: minor=%d\n, a4l_get_minor(cxt));
 
-   if (rtdm_rt_capable(cxt-user_info) != 0)
+   if (!rtdm_in_rt_context()  rtdm_rt_capable(cxt-user_info))
return -ENOSYS;
 
/* Basic checking */
@@ -882,7 +882,7 @@ int a4l_ioctl_poll(a4l_cxt_t * cxt, void *arg)
a4l_buf_t *buf;
a4l_poll_t poll;
 
-   if (rtdm_rt_capable(cxt-user_info) != 0)
+   if (!rtdm_in_rt_context()  rtdm_rt_capable(cxt-user_info))
return -ENOSYS;
 
/* Basic checking */
diff --git a/ksrc/drivers/analogy/command.c b/ksrc/drivers/analogy/command.c
index 05e4d78..7550fbc 100644
--- a/ksrc/drivers/analogy/command.c
+++ b/ksrc/drivers/analogy/command.c
@@ -304,7 +304,7 @@ int a4l_ioctl_cmd(a4l_cxt_t * cxt, void *arg)
__a4l_dbg(1, core_dbg, 
  a4l_ioctl_cmd: minor=%d\n, a4l_get_minor(cxt));
 
-   if (rtdm_rt_capable(cxt-user_info) != 0)
+   if (!rtdm_in_rt_context()  rtdm_rt_capable(cxt-user_info))
return -ENOSYS;
 
/* Basically check the device */
diff --git a/ksrc/drivers/analogy/device.c b/ksrc/drivers/analogy/device.c
index a840ada..b3ef9bf 100644
--- a/ksrc/drivers/analogy/device.c
+++ b/ksrc/drivers/analogy/device.c
@@ -427,7 +427,7 @@ int a4l_ioctl_devcfg(a4l_cxt_t * cxt, void *arg)
__a4l_dbg(1, core_dbg, 
  a4l_ioctl_devcfg: minor=%d\n, a4l_get_minor(cxt));
 
-   if (rtdm_in_rt_context() != 0)
+   if (rtdm_in_rt_context())
return -ENOSYS;
 
if (arg == NULL) {
diff --git a/ksrc/drivers/analogy/instruction.c 
b/ksrc/drivers/analogy/instruction.c
index a95c8c5..64c7a04 100644
--- a/ksrc/drivers/analogy/instruction.c
+++ b/ksrc/drivers/analogy/instruction.c
@@ -292,7 +292,7 @@ int a4l_ioctl_insn(a4l_cxt_t * cxt, void *arg)
a4l_kinsn_t insn;
a4l_dev_t *dev = a4l_get_dev(cxt);
 
-   if (rtdm_rt_capable(cxt-user_info) != 0)
+   if (!rtdm_in_rt_context()  rtdm_rt_capable(cxt-user_info))
return -ENOSYS;
 
/* Basic checking */
@@ -394,7 +394,7 @@ int a4l_ioctl_insnlist(a4l_cxt_t * cxt, void *arg)
a4l_kilst_t ilst;
a4l_dev_t *dev = a4l_get_dev(cxt);
 
-   if (rtdm_rt_capable(cxt-user_info) != 0)
+   if (!rtdm_in_rt_context()  rtdm_rt_capable(cxt-user_info))
return -ENOSYS;
 
/* Basic checking */
diff --git a/ksrc/drivers/analogy/rtdm_interface.c 
b/ksrc/drivers/analogy/rtdm_interface.c
index 00c2d51..cbc3ca6 100644
--- a/ksrc/drivers/analogy/rtdm_interface.c
+++ b/ksrc/drivers/analogy/rtdm_interface.c
@@ -152,7 +152,7 @@ ssize_t a4l_rt_read(struct rtdm_dev_context * context,
 {
a4l_cxt_t cxt;
 
-   if (rtdm_rt_capable(user_info) != 0)
+   if (!rtdm_in_rt_context()  rtdm_rt_capable(user_info))
return -ENOSYS;

a4l_init_cxt(context, user_info, cxt);
@@ -173,7 +173,7 @@ ssize_t a4l_rt_write(struct rtdm_dev_context * context,
 {
a4l_cxt_t cxt;
 
-   if (rtdm_rt_capable(user_info) != 0)
+   if (!rtdm_in_rt_context()  rtdm_rt_capable(user_info))
return -ENOSYS;
 
a4l_init_cxt(context, user_info, cxt);


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


[Xenomai-git] Alexis Berlemont : analogy: make the command registering perform in NRT context

2010-05-04 Thread GIT version control
Module: xenomai-abe
Branch: analogy
Commit: 6bc3c76a01f004c80518497d9d1a205d73babf2e
URL:
http://git.xenomai.org/?p=xenomai-abe.git;a=commit;h=6bc3c76a01f004c80518497d9d1a205d73babf2e

Author: Alexis Berlemont alexis.berlem...@gmail.com
Date:   Tue May  4 23:38:30 2010 +0200

analogy: make the command registering perform in NRT context

Theorically, the command ioctl could be performed in
real-time. However, with the introduction of rtdm_rt_capable(), we
were able to notice a problem in the NI driver: some
pci_alloc_consistent() calls could be done inside some command
callbacks. So, the quickest fix was to confine cmd ioctls to NRT
domain. The influence is minimal as the next syscall (insn trigger or
read / write) will make the process switch.

---

 ksrc/drivers/analogy/command.c |5 -
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/ksrc/drivers/analogy/command.c b/ksrc/drivers/analogy/command.c
index 7550fbc..a6c1dec 100644
--- a/ksrc/drivers/analogy/command.c
+++ b/ksrc/drivers/analogy/command.c
@@ -304,8 +304,11 @@ int a4l_ioctl_cmd(a4l_cxt_t * cxt, void *arg)
__a4l_dbg(1, core_dbg, 
  a4l_ioctl_cmd: minor=%d\n, a4l_get_minor(cxt));
 
-   if (!rtdm_in_rt_context()  rtdm_rt_capable(cxt-user_info))
+   /* The command launching cannot be done in real-time because
+  of some possible buffer allocations in the drivers */
+   if (rtdm_in_rt_context()) {
return -ENOSYS;
+   }
 
/* Basically check the device */
if (!test_bit(A4L_DEV_ATTACHED, dev-flags)) {


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


[Xenomai-git] Philippe Gerum : arm: convert to I-pipe sysinfo v2

2010-05-04 Thread GIT version control
Module: xenomai-2.5
Branch: master
Commit: 957bfd6acb444b3f44a453def9401dff49f7d17f
URL:
http://git.xenomai.org/?p=xenomai-2.5.git;a=commit;h=957bfd6acb444b3f44a453def9401dff49f7d17f

Author: Philippe Gerum r...@xenomai.org
Date:   Sun May  2 12:19:26 2010 +0200

arm: convert to I-pipe sysinfo v2

---

 include/asm-arm/bits/init.h   |2 +-
 include/asm-arm/bits/shadow.h |   22 +++---
 include/asm-arm/bits/timer.h  |2 +-
 include/asm-arm/hal.h |   17 -
 ksrc/arch/arm/hal.c   |2 +-
 5 files changed, 30 insertions(+), 15 deletions(-)

diff --git a/include/asm-arm/bits/init.h b/include/asm-arm/bits/init.h
index 2fd959f..a6ecc17 100644
--- a/include/asm-arm/bits/init.h
+++ b/include/asm-arm/bits/init.h
@@ -82,7 +82,7 @@ static inline int xnarch_init(void)
set_cpus_allowed(current, cpumask_of_cpu(0));
 #endif /* CONFIG_SMP  MODULE */
 
-   xnarch_init_timeconv(RTHAL_CPU_FREQ);
+   xnarch_init_timeconv(RTHAL_CLOCK_FREQ);
 
ret = xnarch_calibrate_sched();
if (ret)
diff --git a/include/asm-arm/bits/shadow.h b/include/asm-arm/bits/shadow.h
index 6625d92..a396510 100644
--- a/include/asm-arm/bits/shadow.h
+++ b/include/asm-arm/bits/shadow.h
@@ -138,26 +138,26 @@ static inline int xnarch_local_syscall(struct pt_regs 
*regs)
if (error)
return error;
 
-   switch (ipipe_info.archdep.tsc.type) {
+   switch (RTHAL_TSC_INFO(ipipe_info).type) {
case IPIPE_TSC_TYPE_FREERUNNING:
info.type = __XN_TSC_TYPE_FREERUNNING,
-   info.u.fr.counter = ipipe_info.archdep.tsc.u.fr.counter;
-   info.u.fr.mask = ipipe_info.archdep.tsc.u.fr.mask;
-   info.u.fr.tsc = ipipe_info.archdep.tsc.u.fr.tsc;
+   info.u.fr.counter = 
RTHAL_TSC_INFO(ipipe_info).u.fr.counter;
+   info.u.fr.mask = RTHAL_TSC_INFO(ipipe_info).u.fr.mask;
+   info.u.fr.tsc = RTHAL_TSC_INFO(ipipe_info).u.fr.tsc;
break;
case IPIPE_TSC_TYPE_DECREMENTER:
info.type = __XN_TSC_TYPE_DECREMENTER,
-   info.u.dec.counter = 
ipipe_info.archdep.tsc.u.dec.counter;
-   info.u.dec.mask = ipipe_info.archdep.tsc.u.dec.mask;
-   info.u.dec.last_cnt = 
ipipe_info.archdep.tsc.u.dec.last_cnt;
-   info.u.dec.tsc = ipipe_info.archdep.tsc.u.dec.tsc;
+   info.u.dec.counter = 
RTHAL_TSC_INFO(ipipe_info).u.dec.counter;
+   info.u.dec.mask = 
RTHAL_TSC_INFO(ipipe_info).u.dec.mask;
+   info.u.dec.last_cnt = 
RTHAL_TSC_INFO(ipipe_info).u.dec.last_cnt;
+   info.u.dec.tsc = RTHAL_TSC_INFO(ipipe_info).u.dec.tsc;
break;
 #ifdef IPIPE_TSC_TYPE_FREERUNNING_COUNTDOWN
case IPIPE_TSC_TYPE_FREERUNNING_COUNTDOWN:
info.type = __XN_TSC_TYPE_FREERUNNING_COUNTDOWN,
-   info.u.fr.counter = ipipe_info.archdep.tsc.u.fr.counter;
-   info.u.fr.mask = ipipe_info.archdep.tsc.u.fr.mask;
-   info.u.fr.tsc = ipipe_info.archdep.tsc.u.fr.tsc;
+   info.u.fr.counter = 
RTHAL_TSC_INFO(ipipe_info).u.fr.counter;
+   info.u.fr.mask = RTHAL_TSC_INFO(ipipe_info).u.fr.mask;
+   info.u.fr.tsc = RTHAL_TSC_INFO(ipipe_info).u.fr.tsc;
break;
 #endif /* IPIPE_TSC_TYPE_FREERUNNING_COUNTDOWN */
case IPIPE_TSC_TYPE_NONE:
diff --git a/include/asm-arm/bits/timer.h b/include/asm-arm/bits/timer.h
index c68e268..90e9de1 100644
--- a/include/asm-arm/bits/timer.h
+++ b/include/asm-arm/bits/timer.h
@@ -30,7 +30,7 @@
 static inline void xnarch_program_timer_shot(unsigned long delay)
 {
rthal_timer_program_shot(rthal_imuldiv_ceil
-(delay, RTHAL_TIMER_FREQ, RTHAL_CPU_FREQ));
+(delay, RTHAL_TIMER_FREQ, RTHAL_CLOCK_FREQ));
 }
 
 static inline int xnarch_send_timer_ipi(xnarch_cpumask_t mask)
diff --git a/include/asm-arm/hal.h b/include/asm-arm/hal.h
index 1787094..2dae6da 100644
--- a/include/asm-arm/hal.h
+++ b/include/asm-arm/hal.h
@@ -126,7 +126,22 @@ static inline __attribute_const__ unsigned long ffnz 
(unsigned long ul)
 #include asm/mach/irq.h
 #include asm/cacheflush.h
 
-#define RTHAL_TIMER_IRQ   __ipipe_mach_timerint
+#ifndef RTHAL_TIMER_IRQ
+/*
+ * Default setting, unless pre-set in the machine-dependent section.
+ */
+#ifdef __IPIPE_FEATURE_SYSINFO_V2
+#define RTHAL_TIMER_IRQ__ipipe_mach_hrtimer_irq
+#else
+#define RTHAL_TIMER_IRQ__ipipe_mach_timerint
+#endif /* __IPIPE_FEATURE_SYSINFO_V2 */
+#endif /* RTHAL_TIMER_IRQ */
+
+#ifdef __IPIPE_FEATURE_SYSINFO_V2
+#define RTHAL_TSC_INFO(p)  

[Xenomai-git] Alexis Berlemont : analogy: fix ring-buffer issues

2010-05-04 Thread GIT version control
Module: xenomai-2.5
Branch: master
Commit: 80948f1da391d5b89f05cce36cbc2a1d638d4641
URL:
http://git.xenomai.org/?p=xenomai-2.5.git;a=commit;h=80948f1da391d5b89f05cce36cbc2a1d638d4641

Author: Alexis Berlemont alexis.berlem...@gmail.com
Date:   Mon Mar 22 00:15:13 2010 +0100

analogy: fix ring-buffer issues

---

 include/analogy/buffer.h |   32 
 1 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/include/analogy/buffer.h b/include/analogy/buffer.h
index 0e8f279..0ab93ba 100644
--- a/include/analogy/buffer.h
+++ b/include/analogy/buffer.h
@@ -87,11 +87,11 @@ static inline int __produce(a4l_cxt_t * cxt,
int ret = 0;
 
while (ret == 0  tmp_cnt != 0) {
-   /* Checks the data copy can be performed contiguously */
+   /* Check the data copy can be performed contiguously */
unsigned long blk_size = (start_ptr + tmp_cnt  buf-size) ?
buf-size - start_ptr : tmp_cnt;
 
-   /* Performs the copy */
+   /* Perform the copy */
if (cxt == NULL)
memcpy(buf-buf + start_ptr, pin, blk_size);
else
@@ -99,7 +99,7 @@ static inline int __produce(a4l_cxt_t * cxt,
   buf-buf + start_ptr,
   pin, blk_size);
 
-   /* Updates pointers/counts */
+   /* Update pointers/counts */
pin += blk_size;
tmp_cnt -= blk_size;
start_ptr = 0;
@@ -117,11 +117,11 @@ static inline int __consume(a4l_cxt_t * cxt,
int ret = 0;
 
while (ret == 0  tmp_cnt != 0) {
-   /* Checks the data copy can be performed contiguously */
+   /* Check the data copy can be performed contiguously */
unsigned long blk_size = (start_ptr + tmp_cnt  buf-size) ?
buf-size - start_ptr : tmp_cnt;
 
-   /* Performs the copy */
+   /* Perform the copy */
if (cxt == NULL)
memcpy(pout, buf-buf + start_ptr, blk_size);
else
@@ -130,7 +130,7 @@ static inline int __consume(a4l_cxt_t * cxt,
 buf-buf + start_ptr,
 blk_size);
 
-   /* Updates pointers/counts */
+   /* Update pointers/counts */
pout += blk_size;
tmp_cnt -= blk_size;
start_ptr = 0;
@@ -149,14 +149,14 @@ static inline void __munge(struct a4l_subdevice * subd,
unsigned long tmp_cnt = count;
 
while (tmp_cnt != 0) {
-   /* Checks the data copy can be performed contiguously */
+   /* Check the data copy can be performed contiguously */
unsigned long blk_size = (start_ptr + tmp_cnt  buf-size) ?
buf-size - start_ptr : tmp_cnt;
 
-   /* Performs the munge operation */
+   /* Perform the munge operation */
munge(subd, buf-buf + start_ptr, blk_size);
 
-   /* Updates the start pointer and the count */
+   /* Update the start pointer and the count */
tmp_cnt -= blk_size;
start_ptr = 0;
}
@@ -245,7 +245,7 @@ static inline int __abs_put(a4l_buf_t * buf, unsigned long 
count)
 {
unsigned long old = buf-prd_count;
 
-   if (buf-prd_count = count)
+   if ((long)(buf-prd_count - count) = 0)
return -EINVAL;
 
buf-prd_count = count;
@@ -253,7 +253,7 @@ static inline int __abs_put(a4l_buf_t * buf, unsigned long 
count)
if ((old / buf-size) != (count / buf-size))
set_bit(A4L_BUF_EOBUF_NR, buf-evt_flags);
 
-   if (count = buf-end_count)
+   if ((long)(count - buf-end_count) = 0)
set_bit(A4L_BUF_EOA_NR, buf-evt_flags);
 
return 0;
@@ -268,7 +268,7 @@ static inline int __abs_get(a4l_buf_t * buf, unsigned long 
count)
 {
unsigned long old = buf-cns_count;
 
-   if (buf-cns_count = count)
+   if ((long)(buf-cns_count - count) = 0)
return -EINVAL;
 
buf-cns_count = count;
@@ -276,7 +276,7 @@ static inline int __abs_get(a4l_buf_t * buf, unsigned long 
count)
if ((old / buf-size) != count / buf-size)
set_bit(A4L_BUF_EOBUF_NR, buf-evt_flags);
 
-   if (count = buf-end_count)
+   if ((long)(count - buf-end_count) = 0)
set_bit(A4L_BUF_EOA_NR, buf-evt_flags);
 
return 0;
@@ -291,7 +291,7 @@ static inline unsigned long __count_to_put(a4l_buf_t * buf)
 {
unsigned long ret;
 
-   if (buf-size + buf-cns_count  buf-prd_count)
+   if ((long) (buf-size + buf-cns_count - buf-prd_count)  0)
ret = buf-size + buf-cns_count - buf-prd_count;
else

[Xenomai-git] Alexis Berlemont : analogy: make cmd_read work with infinite acquisitions ( -S 0)

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

Author: Alexis Berlemont alexis.berlem...@gmail.com
Date:   Mon Mar 22 22:37:33 2010 +0100

analogy: make cmd_read work with infinite acquisitions (-S 0)

---

 src/utils/analogy/cmd_read.c |6 --
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/utils/analogy/cmd_read.c b/src/utils/analogy/cmd_read.c
index ee65dc9..fb21081 100644
--- a/src/utils/analogy/cmd_read.c
+++ b/src/utils/analogy/cmd_read.c
@@ -244,6 +244,7 @@ int main(int argc, char *argv[])
 
/* Update the command structure */
cmd.scan_end_arg = cmd.nb_chan;
+   cmd.stop_src = cmd.stop_arg != 0 ? TRIG_COUNT : TRIG_NONE;
 
if (real_time != 0) {
 
@@ -328,8 +329,9 @@ int main(int argc, char *argv[])
 
if (verbose != 0) {
printf(cmd_read: scan size = %u\n, scan_size);
-   printf(cmd_read: size to read = %u\n,
-  scan_size * cmd.stop_arg);
+   if (cmd.stop_arg != 0)
+   printf(cmd_read: size to read = %u\n,
+  scan_size * cmd.stop_arg);
}
 
/* Cancel any former command which might be in progress */


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


[Xenomai-git] Alexis Berlemont : analogy: fix a misuse of channel descriptors in a4l_get_chan

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

Author: Alexis Berlemont alexis.berlem...@gmail.com
Date:   Fri Apr  2 22:52:30 2010 +0200

analogy: fix a misuse of channel descriptors in a4l_get_chan

The mode of the channel descriptor (global or specific) was not taken
into account so as to find out the channel index.

---

 ksrc/drivers/analogy/buffer.c |   18 +++---
 1 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/ksrc/drivers/analogy/buffer.c b/ksrc/drivers/analogy/buffer.c
index bbd79ec..3ec558a 100644
--- a/ksrc/drivers/analogy/buffer.c
+++ b/ksrc/drivers/analogy/buffer.c
@@ -112,7 +112,7 @@ a4l_cmd_t *a4l_get_cmd(a4l_subd_t *subd)
 int a4l_get_chan(a4l_subd_t *subd)
 {
a4l_dev_t *dev = subd-dev;
-   int i, tmp_count, tmp_size = 0; 
+   int i, j, tmp_count, tmp_size = 0;  
a4l_cmd_t *cmd;
 
/* Check that subdevice supports commands */
@@ -132,9 +132,11 @@ int a4l_get_chan(a4l_subd_t *subd)
/* We assume channels can have different sizes;
   so, we have to compute the global size of the channels
   in this command... */
-   for (i = 0; i  cmd-nb_chan; i++)
-   tmp_size += dev-transfer.subds[subd-idx]-chan_desc-
-   chans[CR_CHAN(cmd-chan_descs[i])].nb_bits;
+   for (i = 0; i  cmd-nb_chan; i++) {
+   j = (subd-chan_desc-mode != A4L_CHAN_GLOBAL_CHANDESC) ? 
+   CR_CHAN(cmd-chan_descs[i]) : 0;
+   tmp_size += subd-chan_desc-chans[j].nb_bits;
+   }
 
/* Translation bits - bytes */
tmp_size /= 8;
@@ -146,9 +148,11 @@ int a4l_get_chan(a4l_subd_t *subd)
 
/* ...and find the channel the last munged sample 
   was related with */
-   for (i = 0; tmp_count  0  i  cmd-nb_chan; i++)
-   tmp_count -= dev-transfer.subds[subd-idx]-chan_desc-
-   chans[CR_CHAN(cmd-chan_descs[i])].nb_bits;
+   for (i = 0; tmp_count  0  i  cmd-nb_chan; i++) {
+   j = (subd-chan_desc-mode != A4L_CHAN_GLOBAL_CHANDESC) ? 
+   CR_CHAN(cmd-chan_descs[i]) : 0;
+   tmp_count -= subd-chan_desc-chans[j].nb_bits;
+   }
 
if (tmp_count == 0)
return i;


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


[Xenomai-git] Daniele Nicolodi : analogy: make a4l_find_range return the index of the selected range

2010-05-04 Thread GIT version control
Module: xenomai-2.5
Branch: master
Commit: 53470e6a5881c1174255746c3a0ba551e8b048cc
URL:
http://git.xenomai.org/?p=xenomai-2.5.git;a=commit;h=53470e6a5881c1174255746c3a0ba551e8b048cc

Author: Daniele Nicolodi nicol...@science.unitn.it
Date:   Sun Apr  4 01:45:00 2010 +0200

analogy: make a4l_find_range return the index of the selected range

a4l_find_range did not provide the index of the most suitable
range. This patch fix this issue by making the function return the
index. -ENOENT is returned if no range was found.

---

 src/drvlib/analogy/range.c |   40 +++-
 1 files changed, 23 insertions(+), 17 deletions(-)

diff --git a/src/drvlib/analogy/range.c b/src/drvlib/analogy/range.c
index 934c52a..fc4e302 100644
--- a/src/drvlib/analogy/range.c
+++ b/src/drvlib/analogy/range.c
@@ -154,8 +154,9 @@ int a4l_sizeof_subd(a4l_sbinfo_t *subd)
  * @param[in] max Maximal limit value
  * @param[out] rng Found range
  *
- * @return 0 on success. Otherwise:
+ * @return The index of the most suitable range on success. Otherwise:
  *
+ * - -ENOENT is returned if a suitable range is not found.
  * - -EINVAL is returned if some argument is missing or wrong;
  *idx_subd, idx_chan and the dsc pointer should be checked; check
  *also the kernel log (dmesg); WARNING: a4l_fill_desc() should
@@ -171,10 +172,14 @@ int a4l_find_range(a4l_desc_t * dsc,
int i, ret;
long lmin, lmax;
a4l_chinfo_t *chinfo;
-   a4l_rnginfo_t *rnginfo;
+   a4l_rnginfo_t *rnginfo, *tmp = NULL;
+   unsigned int idx_rng = -ENOENT;
+
+   if (rng != NULL)
+   *rng = NULL;
 
/* Basic checkings */
-   if (dsc == NULL || rng == NULL)
+   if (dsc == NULL)
return -EINVAL;
 
/* a4l_fill_desc() must have been called on this descriptor */
@@ -184,38 +189,39 @@ int a4l_find_range(a4l_desc_t * dsc,
/* Retrieves the ranges count */
ret = a4l_get_chinfo(dsc, idx_subd, idx_chan, chinfo);
if (ret  0)
-   goto out_get_range;
+   return ret;
 
/* Initializes variables */
lmin = (long)(min * A4L_RNG_FACTOR);
lmax = (long)(max * A4L_RNG_FACTOR);
-   *rng = NULL;
 
/* Performs the research */
for (i = 0; i  chinfo-nb_rng; i++) {
 
ret = a4l_get_rnginfo(dsc, idx_subd, idx_chan, i, rnginfo);
if (ret  0)
-   goto out_get_range;
+   return ret;
 
if (A4L_RNG_UNIT(rnginfo-flags) == unit 
rnginfo-min = lmin  rnginfo-max = lmax) {
 
-   if (*rng != NULL) {
-   if (rnginfo-min = (*rng)-min 
-   rnginfo-max = (*rng)-max)
-   *rng = rnginfo;
-   } else
-   *rng = rnginfo;
+   if (tmp != NULL) {
+   if (rnginfo-min = tmp-min 
+   rnginfo-max = tmp-max) {
+   idx_rng = i;
+   tmp = rnginfo;
+   }
+   } else {
+   idx_rng = i;
+   tmp = rnginfo;
+   }
}
}
 
-out_get_range:
-
-   if (ret  0)
-   *rng = NULL;
+   if (rng != NULL)
+   *rng = tmp;
 
-   return ret;
+   return idx_rng;
 }
 
 /**


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


[Xenomai-git] Alexis Berlemont : analogy: [pcimio] register the digital trigger routine

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

Author: Alexis Berlemont alexis.berlem...@gmail.com
Date:   Thu Apr 15 01:40:38 2010 +0200

analogy: [pcimio] register the digital trigger routine

---

 .../analogy/national_instruments/mio_common.c  |   18 ++
 1 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/ksrc/drivers/analogy/national_instruments/mio_common.c 
b/ksrc/drivers/analogy/national_instruments/mio_common.c
index a51a3cd..96d3100 100644
--- a/ksrc/drivers/analogy/national_instruments/mio_common.c
+++ b/ksrc/drivers/analogy/national_instruments/mio_common.c
@@ -3365,8 +3365,9 @@ int ni_cdio_cmdtest(a4l_subd_t *subd, a4l_cmd_t *cmd)
return -EINVAL;
}
 
-   if (cmd-scan_begin_arg != 
-   PACK_FLAGS(CDO_Sample_Source_Select_Mask, 0, 0, CR_INVERT))
+   if ((cmd-scan_begin_arg  
+PACK_FLAGS(CDO_Sample_Source_Select_Mask, 0, 0, CR_INVERT)) !=
+   cmd-scan_begin_arg)
return -EINVAL;
 
if (cmd-convert_arg != 0) {
@@ -3404,8 +3405,8 @@ int ni_cdio_cmd(a4l_subd_t *subd, a4l_cmd_t *cmd)
switch (cmd-scan_begin_src) {
case TRIG_EXT:
cdo_mode_bits |=
-   CR_CHAN(cmd-
-   scan_begin_arg)  CDO_Sample_Source_Select_Mask;
+   CR_CHAN(cmd-scan_begin_arg)  
+   CDO_Sample_Source_Select_Mask;
break;
default:
BUG();
@@ -3429,8 +3430,6 @@ int ni_cdio_cmd(a4l_subd_t *subd, a4l_cmd_t *cmd)
return retval;
}

-   /* TODO: manage the trigger function */
-
return 0;
 }
 
@@ -5036,19 +5035,22 @@ int ni_E_init(a4l_dev_t *dev)
subd-insn_bits = ni_m_series_dio_insn_bits_8;
else
subd-insn_bits = ni_m_series_dio_insn_bits_32;
+
subd-insn_config = ni_m_series_dio_insn_config;
 
 #if (defined(CONFIG_XENO_DRIVERS_ANALOGY_NI_MITE) || \
  defined(CONFIG_XENO_DRIVERS_ANALOGY_NI_MITE_MODULE))
 
-   a4l_dbg(1, drv_dbg, dev, 
-   mio_common: DIO: command feature available\n);
+   a4l_dbg(1, drv_dbg, dev, 
+   mio_common: DIO: command feature available\n);
 
subd-flags |= A4L_SUBD_CMD;
subd-do_cmd = ni_cdio_cmd;
subd-do_cmdtest = ni_cdio_cmdtest;
subd-cmd_mask = mio_dio_cmd_mask;
subd-cancel = ni_cdio_cancel;
+   subd-trigger = ni_cdo_inttrig;
+
 #endif /* CONFIG_XENO_DRIVERS_ANALOGY_NI_MITE */
 
ni_writel(CDO_Reset_Bit | CDI_Reset_Bit, M_Offset_CDIO_Command);


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


[Xenomai-git] Alexis Berlemont : analogy: add the test program cmd_bits (beta version)

2010-05-04 Thread GIT version control
Module: xenomai-2.5
Branch: master
Commit: 81102feb54b5dba1a7cc81feb5aaa32bd4b05dc4
URL:
http://git.xenomai.org/?p=xenomai-2.5.git;a=commit;h=81102feb54b5dba1a7cc81feb5aaa32bd4b05dc4

Author: Alexis Berlemont alexis.berlem...@gmail.com
Date:   Thu Apr 15 01:44:34 2010 +0200

analogy: add the test program cmd_bits (beta version)

---

 src/utils/analogy/Makefile.am |   10 +-
 src/utils/analogy/cmd_bits.c  |  256 +
 2 files changed, 263 insertions(+), 3 deletions(-)

diff --git a/src/utils/analogy/Makefile.am b/src/utils/analogy/Makefile.am
index d695eae..f82942e 100644
--- a/src/utils/analogy/Makefile.am
+++ b/src/utils/analogy/Makefile.am
@@ -1,6 +1,6 @@
 sbin_PROGRAMS = analogy_config
 
-bin_PROGRAMS = cmd_read cmd_write insn_read insn_write insn_bits
+bin_PROGRAMS = cmd_read cmd_write cmd_bits insn_read insn_write insn_bits
 
 CPPFLAGS = \
@XENO_USER_CFLAGS@ \
@@ -29,17 +29,21 @@ cmd_write_LDADD = \
../../skins/rtdm/librtdm.la \
../../skins/common/libxenomai.la
 
+cmd_bits_SOURCES = cmd_bits.c
+cmd_bits_LDADD = \
+   ../../drvlib/analogy/libanalogy.la \
+   ../../skins/rtdm/librtdm.la \
+   ../../skins/common/libxenomai.la
+
 insn_read_SOURCES = insn_read.c
 insn_read_LDADD = \
../../drvlib/analogy/libanalogy.la \
-   ../../skins/native/libnative.la \
../../skins/rtdm/librtdm.la \
../../skins/common/libxenomai.la
 
 insn_write_SOURCES = insn_write.c
 insn_write_LDADD = \
../../drvlib/analogy/libanalogy.la \
-   ../../skins/native/libnative.la \
../../skins/rtdm/librtdm.la \
../../skins/common/libxenomai.la
 
diff --git a/src/utils/analogy/cmd_bits.c b/src/utils/analogy/cmd_bits.c
new file mode 100644
index 000..0afb69f
--- /dev/null
+++ b/src/utils/analogy/cmd_bits.c
@@ -0,0 +1,256 @@
+
+/**
+ * @file
+ * Analogy for Linux, digital command test program
+ *
+ * @note Copyright (C) 1997-2000 David A. Schleef d...@schleef.org
+ * @note Copyright (C) 2008 Alexis Berlemont alexis.berlem...@free.fr
+ *
+ * Xenomai is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Xenomai is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Xenomai; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include stdint.h
+#include stdio.h
+#include stdlib.h
+#include sys/mman.h
+#include errno.h
+#include getopt.h
+
+#include analogy/analogy.h
+
+#define FILENAME analogy0
+
+static char *filename = FILENAME;
+static int verbose;
+
+/* TODO: to be removed */
+static unsigned int chans[4] = {0, 1, 2, 3};
+
+/* The command to send by default */
+a4l_cmd_t cmd = {
+   .idx_subd = -1,
+   .flags = 0,
+   .start_src = TRIG_INT,
+   .start_arg = 0,
+   .scan_begin_src = TRIG_EXT,
+   .scan_begin_arg = 0, /* in ns */
+   .convert_src = TRIG_NOW,
+   .convert_arg = 0, /* in ns */
+   .scan_end_src = TRIG_COUNT,
+   .scan_end_arg = 4,
+   .stop_src = TRIG_NONE,
+   .stop_arg = 0,
+   .nb_chan = 4,
+   .chan_descs = chans,
+};
+
+struct option cmd_bits_opts[] = {
+   {verbose, no_argument, NULL, 'v'},
+   {device, required_argument, NULL, 'd'},
+   {subdevice, required_argument, NULL, 's'},
+   {help, no_argument, NULL, 'h'},
+   {0},
+};
+
+void do_print_usage(void)
+{
+   fprintf(stdout, usage:\tcmd_bits [OPTS] bits_values mask\n);
+   fprintf(stdout, \tOPTS:\t -v, --verbose: verbose output\n);
+   fprintf(stdout,
+   \t\t -d, --device: 
+   device filename (analogy0, analogy1, ...)\n);
+   fprintf(stdout, \t\t -s, --subdevice: subdevice index\n);
+   fprintf(stdout, \t\t -h, --help: print this help\n);
+}
+
+int main(int argc, char *argv[])
+{
+   int i = 0, err = 0;
+   a4l_desc_t dsc = { .sbdata = NULL };
+   a4l_sbinfo_t *sbinfo;
+   int scan_size, idx_subd = -1;
+   int value, mask = 0;
+
+   /* Compute arguments */
+   while ((err = getopt_long(argc,
+ argv,
+ vd:s:h, cmd_bits_opts, NULL)) = 0) {
+   switch (err) {
+   case 'v':
+   verbose = 1;
+   break;
+   case 'd':
+   filename = optarg;
+   break;
+   case 's':
+   idx_subd = strtoul(optarg, NULL, 0);
+   break;
+   case 'h':
+   

[Xenomai-git] Alexis Berlemont : analogy: minor cosmetic fix

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

Author: Alexis Berlemont alexis.berlem...@gmail.com
Date:   Thu Apr 15 01:42:39 2010 +0200

analogy: minor cosmetic fix

---

 ksrc/drivers/analogy/subdevice.c |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/ksrc/drivers/analogy/subdevice.c b/ksrc/drivers/analogy/subdevice.c
index 2d7811d..28aa4a0 100644
--- a/ksrc/drivers/analogy/subdevice.c
+++ b/ksrc/drivers/analogy/subdevice.c
@@ -67,19 +67,19 @@ a4l_rngdesc_t range_fake = RNG_GLOBAL(rng_fake);
 
 /* --- Basic channel / range management functions --- */
 
-a4l_chan_t *a4l_get_chfeat(a4l_subd_t * sb, int idx)
+a4l_chan_t *a4l_get_chfeat(a4l_subd_t *sb, int idx)
 {
int i = (sb-chan_desc-mode != A4L_CHAN_GLOBAL_CHANDESC) ? idx : 0;
return (sb-chan_desc-chans[i]);
 }
 
-a4l_rng_t *a4l_get_rngfeat(a4l_subd_t * sb, int chidx, int rngidx)
+a4l_rng_t *a4l_get_rngfeat(a4l_subd_t *sb, int chidx, int rngidx)
 {
int i = (sb-rng_desc-mode != A4L_RNG_GLOBAL_RNGDESC) ? chidx : 0;
return (sb-rng_desc-rngtabs[i]-rngs[rngidx]);
 }
 
-int a4l_check_chanlist(a4l_subd_t * subd,
+int a4l_check_chanlist(a4l_subd_t *subd,
   unsigned char nb_chan, unsigned int *chans)
 {
int i, j;


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


[Xenomai-git] Alexis Berlemont : analogy: minor change in the header command.h

2010-05-04 Thread GIT version control
Module: xenomai-2.5
Branch: master
Commit: 7711cf1c34ffebd8113c6d5d15724650eda72e64
URL:
http://git.xenomai.org/?p=xenomai-2.5.git;a=commit;h=7711cf1c34ffebd8113c6d5d15724650eda72e64

Author: Alexis Berlemont alexis.berlem...@gmail.com
Date:   Thu Apr 15 01:41:55 2010 +0200

analogy: minor change in the header command.h

---

 include/analogy/command.h |   15 ++-
 1 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/include/analogy/command.h b/include/analogy/command.h
index 29120bf..ef53d91 100644
--- a/include/analogy/command.h
+++ b/include/analogy/command.h
@@ -171,11 +171,8 @@
 
  /*! @} CHAN_RNG_AREF */
 
-#if defined(__KERNEL__)  !defined(DOXYGEN_CPP)
-/* Channels macros only useful for the kernel side */
-#define CR_CHAN(a) CHAN(a)
-#define CR_RNG(a) (((a)16)0xff)
-#define CR_AREF(a) (((a)24)0xf)
+#if !defined(DOXYGEN_CPP)
+
 #define CR_FLAGS_MASK 0xfc00
 #define CR_ALT_FILTER (126)
 #define CR_DITHER CR_ALT_FILTER
@@ -183,8 +180,16 @@
 #define CR_ALT_SOURCE (127)
 #define CR_EDGE(128)
 #define CR_INVERT (129)
+
+#if defined(__KERNEL__) 
+/* Channels macros only useful for the kernel side */
+#define CR_CHAN(a) CHAN(a)
+#define CR_RNG(a) (((a)16)0xff)
+#define CR_AREF(a) (((a)24)0xf)
 #endif /* __KERNEL__ */
 
+#endif /* !DOXYGEN_CPP */
+
 /*! 
  * @brief Structure describing the asynchronous instruction
  * @see a4l_snd_command()


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


[Xenomai-git] Alexis Berlemont : analogy: minor fix in insn_bits

2010-05-04 Thread GIT version control
Module: xenomai-2.5
Branch: master
Commit: 511a91628b6cc21a9d338e16c28fccc19278128b
URL:
http://git.xenomai.org/?p=xenomai-2.5.git;a=commit;h=511a91628b6cc21a9d338e16c28fccc19278128b

Author: Alexis Berlemont alexis.berlem...@gmail.com
Date:   Wed Apr 21 00:25:54 2010 +0200

analogy: minor fix in insn_bits

---

 src/utils/analogy/insn_bits.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/utils/analogy/insn_bits.c b/src/utils/analogy/insn_bits.c
index 9e672c4..192f897 100644
--- a/src/utils/analogy/insn_bits.c
+++ b/src/utils/analogy/insn_bits.c
@@ -1,6 +1,6 @@
 /**
  * @file
- * Analogy for Linux, instruction write test program
+ * Analogy for Linux, instruction bits test program
  *
  * @note Copyright (C) 1997-2000 David A. Schleef d...@schleef.org
  * @note Copyright (C) 2008 Alexis Berlemont alexis.berlem...@free.fr


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


[Xenomai-git] Alexis Berlemont : analogy: add triggering in cmd_bits

2010-05-04 Thread GIT version control
Module: xenomai-2.5
Branch: master
Commit: 33f8d9db31c73db1e942066a3f6a1daf539896c2
URL:
http://git.xenomai.org/?p=xenomai-2.5.git;a=commit;h=33f8d9db31c73db1e942066a3f6a1daf539896c2

Author: Alexis Berlemont alexis.berlem...@gmail.com
Date:   Wed Apr 21 00:28:01 2010 +0200

analogy: add triggering in cmd_bits

---

 src/utils/analogy/cmd_bits.c |   23 ++-
 1 files changed, 22 insertions(+), 1 deletions(-)

diff --git a/src/utils/analogy/cmd_bits.c b/src/utils/analogy/cmd_bits.c
index 0afb69f..aa0e082 100644
--- a/src/utils/analogy/cmd_bits.c
+++ b/src/utils/analogy/cmd_bits.c
@@ -56,6 +56,12 @@ a4l_cmd_t cmd = {
.chan_descs = chans,
 };
 
+a4l_insn_t insn = {
+   .type = A4L_INSN_INTTRIG,
+   .idx_subd = -1,
+   .data_size = 0,
+};
+
 struct option cmd_bits_opts[] = {
{verbose, no_argument, NULL, 'v'},
{device, required_argument, NULL, 'd'},
@@ -83,6 +89,9 @@ int main(int argc, char *argv[])
int scan_size, idx_subd = -1;
int value, mask = 0;
 
+   /* Trigger status, written data..., before triggering */
+   int triggered = 0, total = 0, trigger_threshold = 128;
+
/* Compute arguments */
while ((err = getopt_long(argc,
  argv,
@@ -185,7 +194,7 @@ int main(int argc, char *argv[])
goto out_cmd_bits;
}
 
-   cmd.idx_subd = idx_subd;
+   cmd.idx_subd = insn.idx_subd = idx_subd;
 
if ((sbinfo-flags  A4L_SUBD_TYPES) != A4L_SUBD_DIO 
(sbinfo-flags  A4L_SUBD_TYPES) != A4L_SUBD_DO) {
@@ -240,6 +249,18 @@ int main(int argc, char *argv[])
cmd_bits: a4l_write failed (err=%d)\n, err);
goto out_cmd_bits;
}
+   
+   total += err;
+
+   if (!triggered  total  trigger_threshold) {
+   err = a4l_snd_insn(dsc, insn);
+   if (err  0) {
+   fprintf(stderr, 
+   cmd_bits: triggering failed 
(err=%d)\n,
+   err);
+   goto out_cmd_bits;
+   }
+   }
 
} while (err  0);  
 


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


[Xenomai-git] Alexis Berlemont : analogy: in the core, call rtdm_in_rt_context() instead of a4l_test_rt()

2010-05-04 Thread GIT version control
Module: xenomai-2.5
Branch: master
Commit: 9466cbb9e80298638153bb36e50ed410b6e246c3
URL:
http://git.xenomai.org/?p=xenomai-2.5.git;a=commit;h=9466cbb9e80298638153bb36e50ed410b6e246c3

Author: Alexis Berlemont alexis.berlem...@gmail.com
Date:   Wed Apr 21 01:02:17 2010 +0200

analogy: in the core, call rtdm_in_rt_context() instead of a4l_test_rt()

---

 ksrc/drivers/analogy/buffer.c |   13 +++--
 ksrc/drivers/analogy/device.c |2 +-
 2 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/ksrc/drivers/analogy/buffer.c b/ksrc/drivers/analogy/buffer.c
index 3ec558a..d882810 100644
--- a/ksrc/drivers/analogy/buffer.c
+++ b/ksrc/drivers/analogy/buffer.c
@@ -400,7 +400,7 @@ int a4l_ioctl_mmap(a4l_cxt_t *cxt, void *arg)
 
/* The mmap operation cannot be performed in a 
   real-time context */
-   if (a4l_test_rt() != 0) {
+   if (rtdm_in_rt_context() != 0) {
return -ENOSYS;
}
 
@@ -475,7 +475,7 @@ int a4l_ioctl_bufcfg(a4l_cxt_t * cxt, void *arg)
 
/* As Linux API is used to allocate a virtual buffer,
   the calling process must not be in primary mode */
-   if (a4l_test_rt() != 0) {
+   if (rtdm_in_rt_context() != 0) {
return -ENOSYS;
}
 
@@ -730,7 +730,7 @@ ssize_t a4l_read(a4l_cxt_t * cxt, void *bufdata, size_t 
nbytes)
/* If the acquisition is not over, we must not
   leave the function without having read a least byte */
else {
-   ret = a4l_wait_sync((buf-sync), a4l_test_rt());
+   ret = a4l_wait_sync((buf-sync), rtdm_in_rt_context());
if (ret  0) {
if (ret == -ERESTARTSYS)
ret = -EINTR;
@@ -823,7 +823,7 @@ ssize_t a4l_write(a4l_cxt_t *cxt,
goto out_a4l_write;
} else {
/* The buffer is full, we have to wait for a slot to 
free */
-   ret = a4l_wait_sync((buf-sync), a4l_test_rt());
+   ret = a4l_wait_sync((buf-sync), rtdm_in_rt_context());
if (ret  0) {
if (ret == -ERESTARTSYS)
ret = -EINTR;
@@ -953,11 +953,12 @@ int a4l_ioctl_poll(a4l_cxt_t * cxt, void *arg)
goto out_poll;
 
if (poll.arg == A4L_INFINITE)
-   ret = a4l_wait_sync((buf-sync), a4l_test_rt());
+   ret = a4l_wait_sync((buf-sync), rtdm_in_rt_context());
else {
unsigned long long ns = ((unsigned long long)poll.arg) *
((unsigned long long)NSEC_PER_MSEC);
-   ret = a4l_timedwait_sync((buf-sync), a4l_test_rt(), ns);
+   ret = a4l_timedwait_sync((buf-sync), 
+rtdm_in_rt_context(), ns);
}
 
if (ret == 0) {
diff --git a/ksrc/drivers/analogy/device.c b/ksrc/drivers/analogy/device.c
index ec40b95..a840ada 100644
--- a/ksrc/drivers/analogy/device.c
+++ b/ksrc/drivers/analogy/device.c
@@ -427,7 +427,7 @@ int a4l_ioctl_devcfg(a4l_cxt_t * cxt, void *arg)
__a4l_dbg(1, core_dbg, 
  a4l_ioctl_devcfg: minor=%d\n, a4l_get_minor(cxt));
 
-   if (a4l_test_rt() != 0)
+   if (rtdm_in_rt_context() != 0)
return -ENOSYS;
 
if (arg == NULL) {


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


[Xenomai-git] Alexis Berlemont : analogy: remove useless device declarations in read / write syscalls handlers

2010-05-04 Thread GIT version control
Module: xenomai-2.5
Branch: master
Commit: 70d495dc8f8ac8da98ff54ec06219238474c417d
URL:
http://git.xenomai.org/?p=xenomai-2.5.git;a=commit;h=70d495dc8f8ac8da98ff54ec06219238474c417d

Author: Alexis Berlemont alexis.berlem...@gmail.com
Date:   Wed Apr 28 00:29:19 2010 +0200

analogy: remove useless device declarations in read / write syscalls handlers

---

 ksrc/drivers/analogy/rtdm_interface.c |4 
 1 files changed, 0 insertions(+), 4 deletions(-)

diff --git a/ksrc/drivers/analogy/rtdm_interface.c 
b/ksrc/drivers/analogy/rtdm_interface.c
index 99abf2f..2973b59 100644
--- a/ksrc/drivers/analogy/rtdm_interface.c
+++ b/ksrc/drivers/analogy/rtdm_interface.c
@@ -151,11 +151,9 @@ ssize_t a4l_rt_read(struct rtdm_dev_context * context,
rtdm_user_info_t * user_info, void *buf, size_t nbytes)
 {
a4l_cxt_t cxt;
-   a4l_dev_t *dev;
 
a4l_init_cxt(context, user_info, cxt);
a4l_set_dev(cxt);
-   dev = a4l_get_dev(cxt);
 
__a4l_dbg(1, core_dbg, 
  a4l_rt_read: minor=%d\n, a4l_get_minor(cxt));
@@ -171,11 +169,9 @@ ssize_t a4l_rt_write(struct rtdm_dev_context * context,
 size_t nbytes)
 {
a4l_cxt_t cxt;
-   a4l_dev_t *dev;
 
a4l_init_cxt(context, user_info, cxt);
a4l_set_dev(cxt);
-   dev = a4l_get_dev(cxt);
 
__a4l_dbg(1, core_dbg, a4l_rt_write: minor=%d\n, a4l_get_minor(cxt));
 


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


[Xenomai-git] Alexis Berlemont : analogy: add calls to rtdm_rt_capable() in ioctl handlers

2010-05-04 Thread GIT version control
Module: xenomai-2.5
Branch: master
Commit: 6a18c52710d8cc73f1036343b9ff67ab191de235
URL:
http://git.xenomai.org/?p=xenomai-2.5.git;a=commit;h=6a18c52710d8cc73f1036343b9ff67ab191de235

Author: Alexis Berlemont alexis.berlem...@gmail.com
Date:   Wed Apr 21 01:17:07 2010 +0200

analogy: add calls to rtdm_rt_capable() in ioctl handlers

Analogy now integrates calls to rtdm_rt_capable() in many ioctl
handlers. Not all of them were updated: the ioctls in charge of
the description of the board configuration  (dev_info, subd_info,
chan_info, rng_info) needs no real-time warranty in any way.

---

 ksrc/drivers/analogy/buffer.c  |   30 ++
 ksrc/drivers/analogy/command.c |3 +++
 ksrc/drivers/analogy/instruction.c |6 ++
 ksrc/drivers/analogy/transfer.c|3 +++
 4 files changed, 30 insertions(+), 12 deletions(-)

diff --git a/ksrc/drivers/analogy/buffer.c b/ksrc/drivers/analogy/buffer.c
index d882810..916a571 100644
--- a/ksrc/drivers/analogy/buffer.c
+++ b/ksrc/drivers/analogy/buffer.c
@@ -389,6 +389,12 @@ int a4l_ioctl_mmap(a4l_cxt_t *cxt, void *arg)
__a4l_dbg(1, core_dbg, 
  a4l_ioctl_mmap: minor=%d\n, a4l_get_minor(cxt));
 
+   /* The mmap operation cannot be performed in a 
+  real-time context */
+   if (rtdm_in_rt_context() != 0) {
+   return -ENOSYS;
+   }
+
dev = a4l_get_dev(cxt);
 
/* Basically check the device */
@@ -398,12 +404,6 @@ int a4l_ioctl_mmap(a4l_cxt_t *cxt, void *arg)
return -EINVAL;
}
 
-   /* The mmap operation cannot be performed in a 
-  real-time context */
-   if (rtdm_in_rt_context() != 0) {
-   return -ENOSYS;
-   }
-
/* Recover the argument structure */
if (rtdm_safe_copy_from_user(cxt-user_info,
 map_cfg, arg, sizeof(a4l_mmap_t)) != 0)
@@ -467,18 +467,18 @@ int a4l_ioctl_bufcfg(a4l_cxt_t * cxt, void *arg)
__a4l_dbg(1, core_dbg, 
  a4l_ioctl_bufcfg: minor=%d\n, a4l_get_minor(cxt));
 
-   /* Basic checking */
-   if (!test_bit(A4L_DEV_ATTACHED, dev-flags)) {
-   __a4l_err(a4l_ioctl_bufcfg: unattached device\n);
-   return -EINVAL;
-   }
-
/* As Linux API is used to allocate a virtual buffer,
   the calling process must not be in primary mode */
if (rtdm_in_rt_context() != 0) {
return -ENOSYS;
}
 
+   /* Basic checking */
+   if (!test_bit(A4L_DEV_ATTACHED, dev-flags)) {
+   __a4l_err(a4l_ioctl_bufcfg: unattached device\n);
+   return -EINVAL;
+   }
+
if (rtdm_safe_copy_from_user(cxt-user_info,
 buf_cfg, 
 arg, sizeof(a4l_bufcfg_t)) != 0)
@@ -536,6 +536,9 @@ int a4l_ioctl_bufinfo(a4l_cxt_t * cxt, void *arg)
__a4l_dbg(1, core_dbg, 
  a4l_ioctl_bufinfo: minor=%d\n, a4l_get_minor(cxt));
 
+   if (rtdm_rt_capable(cxt-user_info) != 0)
+   return -ENOSYS;
+
/* Basic checking */
if (!test_bit(A4L_DEV_ATTACHED, dev-flags)) {
__a4l_err(a4l_ioctl_bufinfo: unattached device\n);
@@ -879,6 +882,9 @@ int a4l_ioctl_poll(a4l_cxt_t * cxt, void *arg)
a4l_buf_t *buf;
a4l_poll_t poll;
 
+   if (rtdm_rt_capable(cxt-user_info) != 0)
+   return -ENOSYS;
+
/* Basic checking */
if (!test_bit(A4L_DEV_ATTACHED, dev-flags)) {
__a4l_err(a4l_poll: unattached device\n);
diff --git a/ksrc/drivers/analogy/command.c b/ksrc/drivers/analogy/command.c
index d58f05f..05e4d78 100644
--- a/ksrc/drivers/analogy/command.c
+++ b/ksrc/drivers/analogy/command.c
@@ -304,6 +304,9 @@ int a4l_ioctl_cmd(a4l_cxt_t * cxt, void *arg)
__a4l_dbg(1, core_dbg, 
  a4l_ioctl_cmd: minor=%d\n, a4l_get_minor(cxt));
 
+   if (rtdm_rt_capable(cxt-user_info) != 0)
+   return -ENOSYS;
+
/* Basically check the device */
if (!test_bit(A4L_DEV_ATTACHED, dev-flags)) {
__a4l_err(a4l_ioctl_cmd: cannot command 
diff --git a/ksrc/drivers/analogy/instruction.c 
b/ksrc/drivers/analogy/instruction.c
index f3a4ed7..a95c8c5 100644
--- a/ksrc/drivers/analogy/instruction.c
+++ b/ksrc/drivers/analogy/instruction.c
@@ -292,6 +292,9 @@ int a4l_ioctl_insn(a4l_cxt_t * cxt, void *arg)
a4l_kinsn_t insn;
a4l_dev_t *dev = a4l_get_dev(cxt);
 
+   if (rtdm_rt_capable(cxt-user_info) != 0)
+   return -ENOSYS;
+
/* Basic checking */
if (!test_bit(A4L_DEV_ATTACHED, dev-flags)) {
__a4l_err(a4l_ioctl_insn: unattached device\n);
@@ -391,6 +394,9 @@ int a4l_ioctl_insnlist(a4l_cxt_t * cxt, void *arg)
a4l_kilst_t ilst;
a4l_dev_t *dev = a4l_get_dev(cxt);
 
+   if (rtdm_rt_capable(cxt-user_info) != 0)
+   return -ENOSYS;
+
/* Basic 

[Xenomai-git] Alexis Berlemont : analogy: add rtdm_rt_capable() calls in read / write syscall handlers

2010-05-04 Thread GIT version control
Module: xenomai-2.5
Branch: master
Commit: 31c12acb45847abfee77c2df37f1c7fa02d7b007
URL:
http://git.xenomai.org/?p=xenomai-2.5.git;a=commit;h=31c12acb45847abfee77c2df37f1c7fa02d7b007

Author: Alexis Berlemont alexis.berlem...@gmail.com
Date:   Wed Apr 28 00:33:14 2010 +0200

analogy: add rtdm_rt_capable() calls in read / write syscall handlers

---

 ksrc/drivers/analogy/rtdm_interface.c |6 ++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/ksrc/drivers/analogy/rtdm_interface.c 
b/ksrc/drivers/analogy/rtdm_interface.c
index 2973b59..00c2d51 100644
--- a/ksrc/drivers/analogy/rtdm_interface.c
+++ b/ksrc/drivers/analogy/rtdm_interface.c
@@ -152,6 +152,9 @@ ssize_t a4l_rt_read(struct rtdm_dev_context * context,
 {
a4l_cxt_t cxt;
 
+   if (rtdm_rt_capable(user_info) != 0)
+   return -ENOSYS;
+   
a4l_init_cxt(context, user_info, cxt);
a4l_set_dev(cxt);
 
@@ -170,6 +173,9 @@ ssize_t a4l_rt_write(struct rtdm_dev_context * context,
 {
a4l_cxt_t cxt;
 
+   if (rtdm_rt_capable(user_info) != 0)
+   return -ENOSYS;
+
a4l_init_cxt(context, user_info, cxt);
a4l_set_dev(cxt);
 


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


[Xenomai-git] Alexis Berlemont : analogy: fix a stupid bug in the use of rtdm_rt_capable( )

2010-05-04 Thread GIT version control
Module: xenomai-2.5
Branch: master
Commit: 237c0525568813f474cf2fa21e5165b7a25f6792
URL:
http://git.xenomai.org/?p=xenomai-2.5.git;a=commit;h=237c0525568813f474cf2fa21e5165b7a25f6792

Author: Alexis Berlemont alexis.berlem...@gmail.com
Date:   Tue May  4 23:13:35 2010 +0200

analogy: fix a stupid bug in the use of rtdm_rt_capable()

---

 ksrc/drivers/analogy/buffer.c |8 
 ksrc/drivers/analogy/command.c|2 +-
 ksrc/drivers/analogy/device.c |2 +-
 ksrc/drivers/analogy/instruction.c|4 ++--
 ksrc/drivers/analogy/rtdm_interface.c |4 ++--
 5 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/ksrc/drivers/analogy/buffer.c b/ksrc/drivers/analogy/buffer.c
index 916a571..ecbc379 100644
--- a/ksrc/drivers/analogy/buffer.c
+++ b/ksrc/drivers/analogy/buffer.c
@@ -391,7 +391,7 @@ int a4l_ioctl_mmap(a4l_cxt_t *cxt, void *arg)
 
/* The mmap operation cannot be performed in a 
   real-time context */
-   if (rtdm_in_rt_context() != 0) {
+   if (rtdm_in_rt_context()) {
return -ENOSYS;
}
 
@@ -469,7 +469,7 @@ int a4l_ioctl_bufcfg(a4l_cxt_t * cxt, void *arg)
 
/* As Linux API is used to allocate a virtual buffer,
   the calling process must not be in primary mode */
-   if (rtdm_in_rt_context() != 0) {
+   if (rtdm_in_rt_context()) {
return -ENOSYS;
}
 
@@ -536,7 +536,7 @@ int a4l_ioctl_bufinfo(a4l_cxt_t * cxt, void *arg)
__a4l_dbg(1, core_dbg, 
  a4l_ioctl_bufinfo: minor=%d\n, a4l_get_minor(cxt));
 
-   if (rtdm_rt_capable(cxt-user_info) != 0)
+   if (!rtdm_in_rt_context()  rtdm_rt_capable(cxt-user_info))
return -ENOSYS;
 
/* Basic checking */
@@ -882,7 +882,7 @@ int a4l_ioctl_poll(a4l_cxt_t * cxt, void *arg)
a4l_buf_t *buf;
a4l_poll_t poll;
 
-   if (rtdm_rt_capable(cxt-user_info) != 0)
+   if (!rtdm_in_rt_context()  rtdm_rt_capable(cxt-user_info))
return -ENOSYS;
 
/* Basic checking */
diff --git a/ksrc/drivers/analogy/command.c b/ksrc/drivers/analogy/command.c
index 05e4d78..7550fbc 100644
--- a/ksrc/drivers/analogy/command.c
+++ b/ksrc/drivers/analogy/command.c
@@ -304,7 +304,7 @@ int a4l_ioctl_cmd(a4l_cxt_t * cxt, void *arg)
__a4l_dbg(1, core_dbg, 
  a4l_ioctl_cmd: minor=%d\n, a4l_get_minor(cxt));
 
-   if (rtdm_rt_capable(cxt-user_info) != 0)
+   if (!rtdm_in_rt_context()  rtdm_rt_capable(cxt-user_info))
return -ENOSYS;
 
/* Basically check the device */
diff --git a/ksrc/drivers/analogy/device.c b/ksrc/drivers/analogy/device.c
index a840ada..b3ef9bf 100644
--- a/ksrc/drivers/analogy/device.c
+++ b/ksrc/drivers/analogy/device.c
@@ -427,7 +427,7 @@ int a4l_ioctl_devcfg(a4l_cxt_t * cxt, void *arg)
__a4l_dbg(1, core_dbg, 
  a4l_ioctl_devcfg: minor=%d\n, a4l_get_minor(cxt));
 
-   if (rtdm_in_rt_context() != 0)
+   if (rtdm_in_rt_context())
return -ENOSYS;
 
if (arg == NULL) {
diff --git a/ksrc/drivers/analogy/instruction.c 
b/ksrc/drivers/analogy/instruction.c
index a95c8c5..64c7a04 100644
--- a/ksrc/drivers/analogy/instruction.c
+++ b/ksrc/drivers/analogy/instruction.c
@@ -292,7 +292,7 @@ int a4l_ioctl_insn(a4l_cxt_t * cxt, void *arg)
a4l_kinsn_t insn;
a4l_dev_t *dev = a4l_get_dev(cxt);
 
-   if (rtdm_rt_capable(cxt-user_info) != 0)
+   if (!rtdm_in_rt_context()  rtdm_rt_capable(cxt-user_info))
return -ENOSYS;
 
/* Basic checking */
@@ -394,7 +394,7 @@ int a4l_ioctl_insnlist(a4l_cxt_t * cxt, void *arg)
a4l_kilst_t ilst;
a4l_dev_t *dev = a4l_get_dev(cxt);
 
-   if (rtdm_rt_capable(cxt-user_info) != 0)
+   if (!rtdm_in_rt_context()  rtdm_rt_capable(cxt-user_info))
return -ENOSYS;
 
/* Basic checking */
diff --git a/ksrc/drivers/analogy/rtdm_interface.c 
b/ksrc/drivers/analogy/rtdm_interface.c
index 00c2d51..cbc3ca6 100644
--- a/ksrc/drivers/analogy/rtdm_interface.c
+++ b/ksrc/drivers/analogy/rtdm_interface.c
@@ -152,7 +152,7 @@ ssize_t a4l_rt_read(struct rtdm_dev_context * context,
 {
a4l_cxt_t cxt;
 
-   if (rtdm_rt_capable(user_info) != 0)
+   if (!rtdm_in_rt_context()  rtdm_rt_capable(user_info))
return -ENOSYS;

a4l_init_cxt(context, user_info, cxt);
@@ -173,7 +173,7 @@ ssize_t a4l_rt_write(struct rtdm_dev_context * context,
 {
a4l_cxt_t cxt;
 
-   if (rtdm_rt_capable(user_info) != 0)
+   if (!rtdm_in_rt_context()  rtdm_rt_capable(user_info))
return -ENOSYS;
 
a4l_init_cxt(context, user_info, cxt);


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


[Xenomai-git] Alexis Berlemont : analogy: make the command registering perform in NRT context

2010-05-04 Thread GIT version control
Module: xenomai-2.5
Branch: master
Commit: 6bc3c76a01f004c80518497d9d1a205d73babf2e
URL:
http://git.xenomai.org/?p=xenomai-2.5.git;a=commit;h=6bc3c76a01f004c80518497d9d1a205d73babf2e

Author: Alexis Berlemont alexis.berlem...@gmail.com
Date:   Tue May  4 23:38:30 2010 +0200

analogy: make the command registering perform in NRT context

Theorically, the command ioctl could be performed in
real-time. However, with the introduction of rtdm_rt_capable(), we
were able to notice a problem in the NI driver: some
pci_alloc_consistent() calls could be done inside some command
callbacks. So, the quickest fix was to confine cmd ioctls to NRT
domain. The influence is minimal as the next syscall (insn trigger or
read / write) will make the process switch.

---

 ksrc/drivers/analogy/command.c |5 -
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/ksrc/drivers/analogy/command.c b/ksrc/drivers/analogy/command.c
index 7550fbc..a6c1dec 100644
--- a/ksrc/drivers/analogy/command.c
+++ b/ksrc/drivers/analogy/command.c
@@ -304,8 +304,11 @@ int a4l_ioctl_cmd(a4l_cxt_t * cxt, void *arg)
__a4l_dbg(1, core_dbg, 
  a4l_ioctl_cmd: minor=%d\n, a4l_get_minor(cxt));
 
-   if (!rtdm_in_rt_context()  rtdm_rt_capable(cxt-user_info))
+   /* The command launching cannot be done in real-time because
+  of some possible buffer allocations in the drivers */
+   if (rtdm_in_rt_context()) {
return -ENOSYS;
+   }
 
/* Basically check the device */
if (!test_bit(A4L_DEV_ATTACHED, dev-flags)) {


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


[Xenomai-git] Gilles Chanteperdrix : Merge commit 'analogy' into pending

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

Author: Gilles Chanteperdrix gilles.chanteperd...@xenomai.org
Date:   Tue May  4 23:55:29 2010 +0200

Merge commit 'analogy' into pending

---




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