[Xenomai-git] Gilles Chanteperdrix : doc: regenerate

2010-08-02 Thread GIT version control
Module: xenomai-2.5
Branch: refs/tags/v2.5.4
Commit: f8fa3817958903243009396aca23c9efa58a
URL:
http://git.xenomai.org/?p=xenomai-2.5.git;a=commit;h=f8fa3817958903243009396aca23c9efa58a

Author: Gilles Chanteperdrix gilles.chanteperd...@xenomai.org
Date:   Mon Aug  2 12:49:35 2010 +0200

doc: regenerate

---

 doc/generated/html/api/8255_8c.html|2 +-
 doc/generated/html/api/8255_8h-source.html |2 +-
 doc/generated/html/api/8255_8h.html|2 +-
 doc/generated/html/api/alarm_8h-source.html|2 +-
 doc/generated/html/api/alarm_8h.html   |4 +-
 doc/generated/html/api/alarm_8h__incl.map  |   45 +-
 doc/generated/html/api/alarm_8h__incl.md5  |2 +-
 doc/generated/html/api/alarm_8h__incl.png  |  Bin 21931 - 23522 bytes
 .../html/api/analogy_2buffer_8h-source.html|  740 +-
 doc/generated/html/api/analogy_2buffer_8h.html |2 +-
 .../html/api/analogy_2types_8h-source.html |2 +-
 doc/generated/html/api/analogy_2types_8h.html  |2 +-
 doc/generated/html/api/analogy_8h-source.html  |2 +-
 doc/generated/html/api/analogy_8h.html |2 +-
 .../html/api/analogy__driver_8h-source.html|2 +-
 doc/generated/html/api/analogy__driver_8h.html |2 +-
 doc/generated/html/api/annotated.html  |2 +-
 doc/generated/html/api/apc_8h-source.html  |2 +-
 doc/generated/html/api/arm_2hal_8c.html|2 +-
 doc/generated/html/api/assert_8h-source.html   |2 +-
 doc/generated/html/api/async_8c.html   |2 +-
 doc/generated/html/api/bheap_8h-source.html|2 +-
 doc/generated/html/api/blackfin_2hal_8c.html   |2 +-
 doc/generated/html/api/blackfin_2nmi_8c.html   |2 +-
 doc/generated/html/api/bound__task_8c-example.html |2 +-
 doc/generated/html/api/bufd_8c.html|2 +-
 doc/generated/html/api/bufd_8h-source.html |2 +-
 doc/generated/html/api/bufd_8h.html|2 +-
 doc/generated/html/api/cancel_8h-source.html   |2 +-
 doc/generated/html/api/cb__lock_8h-source.html |2 +-
 .../html/api/channel__range_8h-source.html |2 +-
 doc/generated/html/api/channel__range_8h.html  |2 +-
 doc/generated/html/api/command_8c.html |2 +-
 doc/generated/html/api/command_8h-source.html  |2 +-
 doc/generated/html/api/command_8h.html |2 +-
 doc/generated/html/api/compiler_8h-source.html |2 +-
 doc/generated/html/api/cond__var_8c-example.html   |2 +-
 doc/generated/html/api/context_8h-source.html  |   57 +-
 doc/generated/html/api/context_8h.html |2 +-
 doc/generated/html/api/cross-link_8c-example.html  |2 +-
 doc/generated/html/api/deprecated.html |2 +-
 doc/generated/html/api/descriptor_8c.html  |2 +-
 doc/generated/html/api/descriptor_8h-source.html   |2 +-
 doc/generated/html/api/descriptor_8h.html  |2 +-
 doc/generated/html/api/device_8h-source.html   |   47 +-
 doc/generated/html/api/device_8h.html  |2 +-
 doc/generated/html/api/driver_8c.html  |2 +-
 doc/generated/html/api/driver_8h-source.html   |2 +-
 doc/generated/html/api/driver_8h.html  |2 +-
 doc/generated/html/api/driver__facilities_8c.html  |2 +-
 .../html/api/drivers_2analogy_2device_8c.html  |2 +-
 doc/generated/html/api/drvlib_8c.html  |4 +-
 doc/generated/html/api/drvlib_8c__incl.map |   52 +-
 doc/generated/html/api/drvlib_8c__incl.md5 |2 +-
 doc/generated/html/api/drvlib_8c__incl.png |  Bin 32293 - 32684 bytes
 doc/generated/html/api/event_8h-source.html|2 +-
 doc/generated/html/api/event_8h.html   |2 +-
 .../html/api/event__flags_8c-example.html  |2 +-
 doc/generated/html/api/examples.html   |2 +-
 doc/generated/html/api/files.html  |2 +-
 doc/generated/html/api/functions.html  |5 +-
 doc/generated/html/api/functions_func.html |2 +-
 doc/generated/html/api/functions_vars.html |5 +-
 doc/generated/html/api/generic_2hal_8c.html|2 +-
 doc/generated/html/api/generic_2nmi_8c.html|2 +-
 doc/generated/html/api/globals.html|   10 +-
 doc/generated/html/api/globals_0x63.html   |2 +-
 doc/generated/html/api/globals_0x66.html   |2 +-
 doc/generated/html/api/globals_0x6e.html   |2 +-
 doc/generated/html/api/globals_0x70.html   |2 +-
 doc/generated/html/api/globals_0x72.html   |2 +-
 doc/generated/html/api/globals_0x73.html   |2 +-
 doc/generated/html/api/globals_0x74.html   |2 +-
 doc/generated/html/api/globals_0x78.html   |2 +-
 doc/generated/html/api/globals_defs.html   |  

[Xenomai-git] Alexis Berlemont : analogy: the subdevice structure got a new status field (broken)

2010-08-02 Thread GIT version control
Module: xenomai-head
Branch: master
Commit: d4536f71d39d81bf2228bff161faafbab131deea
URL:
http://git.xenomai.org/?p=xenomai-head.git;a=commit;h=d4536f71d39d81bf2228bff161faafbab131deea

Author: Alexis Berlemont alexis.berlem...@gmail.com
Date:   Sun May 16 23:20:51 2010 +0200

analogy: the subdevice structure got a new status field (broken)

---

 include/analogy/subdevice.h |   26 +-
 1 files changed, 25 insertions(+), 1 deletions(-)

diff --git a/include/analogy/subdevice.h b/include/analogy/subdevice.h
index 1c3bcd4..11a345e 100644
--- a/include/analogy/subdevice.h
+++ b/include/analogy/subdevice.h
@@ -141,12 +141,28 @@
 
  /*! @} ANALOGY_SUBD_FT_xxx */
 
+/*!
+ * @anchor ANALOGY_SUBD_ST_xxx @name Subdevice status
+ * @brief Flags to define the subdevice's status
+ * @{
+ */
+
+/* Subdevice status flag(s) */
+/** 
+ * The subdevice is busy, a synchronous or an asynchronous acquisition
+ * is occuring
+ */
+#define A4L_SUBD_BUSY_NR 0
+#define A4L_SUBD_BUSY (1  A4L_SUBD_BUSY_NR)
+
+ /*! @} ANALOGY_SUBD_ST_xxx */
+
 #ifdef __KERNEL__
 
 /* --- Subdevice descriptor structure --- */
 
 struct a4l_device;
-struct a4l_driver;
+struct a4l_buffer;
 
 /*! 
  * @brief Structure describing the subdevice
@@ -160,9 +176,17 @@ struct a4l_subdevice {
 
struct a4l_device *dev;
   /** Containing device */
+
unsigned int idx;
  /** Subdevice index */
 
+   struct a4l_buffer *buf;
+  /** Linked buffer */
+
+   /* Subdevice's status (busy, linked?) */
+   unsigned long status;
+/** Subdevice's status */
+
/* Descriptors stuff */
unsigned long flags;
 /** Type flags */


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


[Xenomai-git] Alexis Berlemont : analogy: the transfer structure is left with a minimal role (broken)

2010-08-02 Thread GIT version control
Module: xenomai-head
Branch: master
Commit: 417d1ba03a521ca7d91bf84c01a3f4cc2b4a9039
URL:
http://git.xenomai.org/?p=xenomai-head.git;a=commit;h=417d1ba03a521ca7d91bf84c01a3f4cc2b4a9039

Author: Alexis Berlemont alexis.berlem...@gmail.com
Date:   Sun May 16 23:22:36 2010 +0200

analogy: the transfer structure is left with a minimal role (broken)

This structure should be renamed.

---

 include/analogy/transfer.h |   17 -
 1 files changed, 4 insertions(+), 13 deletions(-)

diff --git a/include/analogy/transfer.h b/include/analogy/transfer.h
index e6bdc3c..929022b 100644
--- a/include/analogy/transfer.h
+++ b/include/analogy/transfer.h
@@ -30,15 +30,14 @@
 #include analogy/buffer.h
 
 /* Status flags / bits */
-#define A4L_TSF_BUSY 0
-#define A4L_TSF_BULK 1
-#define A4L_TSF_MMAP 2
-#define A4L_TSF_CLEAN 3
+#define A4L_TSF_CLEAN 0
 
 /* Fields init values */
 #define A4L_IRQ_UNUSED (unsigned int)((unsigned short)(~0))
 #define A4L_IDX_UNUSED (unsigned int)(~0)
 
+/* TODO: IRQ handling must leave transfer for os_facilities */
+
 /* IRQ types */
 #define A4L_IRQ_SHARED RTDM_IRQTYPE_SHARED
 #define A4L_IRQ_EDGE RTDM_IRQTYPE_EDGE
@@ -51,24 +50,16 @@
 #ifdef __KERNEL__
 
 struct a4l_device;
-
 /* Analogy transfer descriptor */
 struct a4l_transfer {
 
/* Subdevices desc */
unsigned int nb_subd;
a4l_subd_t **subds;
-   int idx_read_subd;
-   int idx_write_subd;
-
-   /* Buffer desc */
-   a4l_buf_t **bufs;
 
/* IRQ in use */
+   /* TODO: irq_desc should vanish */
a4l_irq_desc_t irq_desc;
-
-   /* Events/status desc */
-   unsigned long *status;
 };
 typedef struct a4l_transfer a4l_trf_t;
 


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


[Xenomai-git] Alexis Berlemont : analogy: adapt a4l_set_dev() after a4l_context' s overhaul (broken)

2010-08-02 Thread GIT version control
Module: xenomai-head
Branch: master
Commit: e4c0bf113e52a91a2d156d69d1f9cd7e273295b0
URL:
http://git.xenomai.org/?p=xenomai-head.git;a=commit;h=e4c0bf113e52a91a2d156d69d1f9cd7e273295b0

Author: Alexis Berlemont alexis.berlem...@gmail.com
Date:   Sun May 16 23:55:48 2010 +0200

analogy: adapt a4l_set_dev() after a4l_context's overhaul (broken)

---

 ksrc/drivers/analogy/device.c |   10 --
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/ksrc/drivers/analogy/device.c b/ksrc/drivers/analogy/device.c
index b3ef9bf..4a3c879 100644
--- a/ksrc/drivers/analogy/device.c
+++ b/ksrc/drivers/analogy/device.c
@@ -59,9 +59,15 @@ int a4l_check_cleanup_devs(void)
return ret;
 }
 
-void a4l_set_dev(a4l_cxt_t * cxt)
+void a4l_set_dev(struct rtdm_dev_context *context)
 {
-   cxt-dev = (a4l_devs[a4l_get_minor(cxt)]);
+   /* Get the context's private structure */
+   a4l_cxt_t *cxt = (a4l_cxt_t *)context-dev_private;
+   /* Retrive the minor index */
+   static int minor = context-device-device_id;
+   
+   /* Fill the dev fields accordingly */
+   cxt-dev = (a4l_devs[minor]);
 }
 
 /* --- Device tab proc section --- */


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


[Xenomai-git] Alexis Berlemont : analogy: adapt open, r/w, select and ioctl functions ( broken)

2010-08-02 Thread GIT version control
Module: xenomai-head
Branch: master
Commit: 9799c5cdbbc4caa7a5f2ad2a22e9ac8436ed5aae
URL:
http://git.xenomai.org/?p=xenomai-head.git;a=commit;h=9799c5cdbbc4caa7a5f2ad2a22e9ac8436ed5aae

Author: Alexis Berlemont alexis.berlem...@gmail.com
Date:   Sun May 16 23:25:49 2010 +0200

analogy: adapt open, r/w, select and ioctl functions (broken)

---

 ksrc/drivers/analogy/rtdm_interface.c |  130 +++-
 1 files changed, 61 insertions(+), 69 deletions(-)

diff --git a/ksrc/drivers/analogy/rtdm_interface.c 
b/ksrc/drivers/analogy/rtdm_interface.c
index cbc3ca6..d37ce4c 100644
--- a/ksrc/drivers/analogy/rtdm_interface.c
+++ b/ksrc/drivers/analogy/rtdm_interface.c
@@ -121,125 +121,117 @@ void a4l_cleanup_proc(void)
 
 #endif /* CONFIG_PROC_FS */
 
-int a4l_rt_open(struct rtdm_dev_context *context,
-   rtdm_user_info_t * user_info, int flags)
+int a4l_open(struct rtdm_dev_context *context, 
+rtdm_user_info_t * user_info, int flags)
 {
-   a4l_cxt_t cxt;
+   a4l_cxt_t *cxt = (a4l_cxt_t *)context-dev_private;
 
-   a4l_init_cxt(context, user_info, cxt);
-   a4l_set_dev(cxt);
-   __a4l_dbg(1, core_dbg, 
- a4l_rt_open: minor=%d\n, a4l_get_minor(cxt));
+   /* Get a pointer on the selected device 
+  (thanks to minor index) */
+   a4l_set_dev(context);
+
+   /* Initialize the buffer structure */
+   a4l_init_buffer(cxt-buffer);
+
+   /* Allocate the asynchronous buffer 
+  NOTE: it should be interesting to allocate the buffer only
+  on demand especially if the system is short of memory
+  NOTE2: the default buffer size could be configured via
+  kernel config*/
+   a4l_alloc_buffer(cxt-buffer, A4L_DEFAULT_BFSIZE);
 
return 0;
 }
 
-int a4l_rt_close(struct rtdm_dev_context *context,
-rtdm_user_info_t * user_info)
+int a4l_close(struct rtdm_dev_context *context, rtdm_user_info_t * user_info)
 {
-   a4l_cxt_t cxt;
+   int err;
+   a4l_cxt_t *cxt = (a4l_cxt_t *)context-dev_private;
+
+   /* Cancel the maybe occuring asynchronous transfer */
+   err = a4l_cancel_buffer(cxt-buffer);
+   if (err  0) {
+   __a4l_err(close: unable to stop the asynchronous transfer\n); 
+   return err;
+   }
 
-   a4l_init_cxt(context, user_info, cxt);
-   a4l_set_dev(cxt);
-   __a4l_dbg(1, core_dbg, 
- a4l_rt_close: minor=%d\n, a4l_get_minor(cxt)); 
+   /* Free the buffer which was linked with this context */
+   err = a4l_free_buffer(cxt-buffer);
 
-   return a4l_cancel_transfers(cxt);;
+   return err;
 }
 
-ssize_t a4l_rt_read(struct rtdm_dev_context * context,
-   rtdm_user_info_t * user_info, void *buf, size_t nbytes)
+ssize_t a4l_read(struct rtdm_dev_context * context,
+rtdm_user_info_t * user_info, void *buf, size_t nbytes)
 {
-   a4l_cxt_t cxt;
+   a4l_cxt_t *cxt = (a4l_cxt_t *)context-dev_private;
 
+   /* Jump into the RT domain if possible */
if (!rtdm_in_rt_context()  rtdm_rt_capable(user_info))
return -ENOSYS;

-   a4l_init_cxt(context, user_info, cxt);
-   a4l_set_dev(cxt);
-
-   __a4l_dbg(1, core_dbg, 
- a4l_rt_read: minor=%d\n, a4l_get_minor(cxt));
-
if (nbytes == 0)
return 0;
 
-   return a4l_read(cxt, buf, nbytes);
+   cxt-user_info = user_info;
+
+   return a4l_read(cxt, buf, nbytes);
 }
 
-ssize_t a4l_rt_write(struct rtdm_dev_context * context,
-rtdm_user_info_t * user_info, const void *buf,
-size_t nbytes)
+ssize_t a4l_write(struct rtdm_dev_context * context,
+ rtdm_user_info_t *user_info, const void *buf, size_t nbytes)
 {
-   a4l_cxt_t cxt;
+   a4l_cxt_t *cxt = (a4l_cxt_t *)context-dev_private;
 
+   /* Jump into the RT domain if possible */
if (!rtdm_in_rt_context()  rtdm_rt_capable(user_info))
return -ENOSYS;
 
-   a4l_init_cxt(context, user_info, cxt);
-   a4l_set_dev(cxt);
-
-   __a4l_dbg(1, core_dbg, a4l_rt_write: minor=%d\n, a4l_get_minor(cxt));
-
if (nbytes == 0)
return 0;
 
-   return a4l_write(cxt, buf, nbytes);
+   cxt-user_info = user_info;
+
+   return a4l_write(cxt, buf, nbytes);
 }
 
-int a4l_rt_ioctl(struct rtdm_dev_context *context,
-rtdm_user_info_t * user_info,
-unsigned int request, void *arg)
+int a4l_ioctl(struct rtdm_dev_context *context,
+ rtdm_user_info_t *user_info, unsigned int request, void *arg)
 {
-   a4l_cxt_t cxt;
+   a4l_cxt_t *cxt = (a4l_cxt_t *)context-dev_private;
 
-   a4l_init_cxt(context, user_info, cxt);
-   a4l_set_dev(cxt);
-   __a4l_dbg(1, core_dbg, 
- a4l_rt_ioctl: minor=%d\n, a4l_get_minor(cxt));
+   cxt-user_info = user_info;
 
-   return 

[Xenomai-git] Alexis Berlemont : analogy: update a4l_set_dev() declaration (broken)

2010-08-02 Thread GIT version control
Module: xenomai-head
Branch: master
Commit: cd2dcbca86c340054fb4fd02b0ae379554980710
URL:
http://git.xenomai.org/?p=xenomai-head.git;a=commit;h=cd2dcbca86c340054fb4fd02b0ae379554980710

Author: Alexis Berlemont alexis.berlem...@gmail.com
Date:   Sun May 16 23:56:48 2010 +0200

analogy: update a4l_set_dev() declaration (broken)

---

 include/analogy/device.h |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/include/analogy/device.h b/include/analogy/device.h
index 27a3bd0..51b99b5 100644
--- a/include/analogy/device.h
+++ b/include/analogy/device.h
@@ -91,7 +91,7 @@ int a4l_rdproc_devs(char *page,
off_t off, int count, int *eof, void *data);
 
 /* --- Context related function / macro --- */
-void a4l_set_dev(a4l_cxt_t * cxt);
+void a4l_set_dev(struct rtdm_dev_context *context);
 #define a4l_get_dev(x) ((x)-dev)
 
 /* --- Upper layer functions --- */


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


[Xenomai-git] Alexis Berlemont : analogy: changes related with subdevice's status field ( broken)

2010-08-02 Thread GIT version control
Module: xenomai-head
Branch: master
Commit: c72b3cda90049db3a3e11a7e4f08319916366711
URL:
http://git.xenomai.org/?p=xenomai-head.git;a=commit;h=c72b3cda90049db3a3e11a7e4f08319916366711

Author: Alexis Berlemont alexis.berlem...@gmail.com
Date:   Mon May 17 00:08:40 2010 +0200

analogy: changes related with subdevice's status field (broken)

---

 include/analogy/subdevice.h  |8 
 ksrc/drivers/analogy/subdevice.c |2 +-
 ksrc/drivers/analogy/transfer.c  |   73 --
 3 files changed, 16 insertions(+), 67 deletions(-)

diff --git a/include/analogy/subdevice.h b/include/analogy/subdevice.h
index 11a345e..0f9e1c5 100644
--- a/include/analogy/subdevice.h
+++ b/include/analogy/subdevice.h
@@ -155,6 +155,14 @@
 #define A4L_SUBD_BUSY_NR 0
 #define A4L_SUBD_BUSY (1  A4L_SUBD_BUSY_NR)
 
+/** 
+ * The subdevice is about to be cleaned in the middle of the detach
+ * procedure
+ */
+#define A4L_SUBD_CLEAN_NR 1
+#define A4L_SUBD_CLEAN (1  A4L_SUBD_CLEAN_NR)
+
+
  /*! @} ANALOGY_SUBD_ST_xxx */
 
 #ifdef __KERNEL__
diff --git a/ksrc/drivers/analogy/subdevice.c b/ksrc/drivers/analogy/subdevice.c
index 28aa4a0..1278081 100644
--- a/ksrc/drivers/analogy/subdevice.c
+++ b/ksrc/drivers/analogy/subdevice.c
@@ -201,7 +201,7 @@ int a4l_ioctl_subdinfo(a4l_cxt_t * cxt, void *arg)
 
for (i = 0; i  dev-transfer.nb_subd; i++) {
subd_info[i].flags = dev-transfer.subds[i]-flags;
-   subd_info[i].status = dev-transfer.status[i];
+   subd_info[i].status = dev-transfer.subds[i]-status;
subd_info[i].nb_chan = 
(dev-transfer.subds[i]-chan_desc != NULL) ?
dev-transfer.subds[i]-chan_desc-length : 0;
diff --git a/ksrc/drivers/analogy/transfer.c b/ksrc/drivers/analogy/transfer.c
index c8a7d43..b1e511d 100644
--- a/ksrc/drivers/analogy/transfer.c
+++ b/ksrc/drivers/analogy/transfer.c
@@ -53,31 +53,26 @@ int a4l_precleanup_transfer(a4l_cxt_t * cxt)
}
 
for (i = 0; i  tsf-nb_subd; i++) {
+   unsigned long *status = tsf-subds[i]-status;
 
-   if (test_bit(A4L_TSF_MMAP, (tsf-status[i]))) {
-   __a4l_err(a4l_precleanup_transfer: 
- device busy, buffer must be unmapped\n);
-   err = -EPERM;
-   goto out_error;
-   }
-
-   if (test_and_set_bit(A4L_TSF_BUSY, (tsf-status[i]))) {
+   if (test_and_set_bit(A4L_SUBD_BUSY, status)) {
__a4l_err(a4l_precleanup_transfer: 
  device busy, acquisition occuring\n);
err = -EBUSY;
goto out_error;
} else
-   set_bit(A4L_TSF_CLEAN, (tsf-status[i]));
+   set_bit(A4L_SUBD_CLEAN, status);
}
 
return 0;
 
 out_error:
for (i = 0; i  tsf-nb_subd; i++) {
+   unsigned long *status = tsf-subds[i]-status;
 
-   if (test_bit(A4L_TSF_CLEAN, (tsf-status[i]))){
-   clear_bit(A4L_TSF_BUSY, (tsf-status[i]));
-   clear_bit(A4L_TSF_CLEAN, (tsf-status[i]));
+   if (test_bit(A4L_TSF_CLEAN, status)){
+   clear_bit(A4L_SUBD_BUSY, status);
+   clear_bit(A4L_SUBD_CLEAN, status);
}
}
 
@@ -97,21 +92,6 @@ int a4l_cleanup_transfer(a4l_cxt_t * cxt)
dev = a4l_get_dev(cxt);
tsf = dev-transfer;
 
-   /* Releases the various buffers */
-   if (tsf-status != NULL)
-   rtdm_free(tsf-status);
-
-   if (tsf-bufs != NULL) {
-   for (i = 0; i  tsf-nb_subd; i++) {
-   if (tsf-bufs[i] != NULL) {
-   a4l_free_buffer(tsf-bufs[i]);
-   a4l_cleanup_sync(tsf-bufs[i]-sync);
-   rtdm_free(tsf-bufs[i]);
-   }
-   }
-   rtdm_free(tsf-bufs);
-   }
-
/* Releases the pointers tab, if need be */
if (tsf-subds != NULL) {
rtdm_free(tsf-subds);
@@ -135,10 +115,6 @@ void a4l_presetup_transfer(a4l_cxt_t *cxt)
/* Clear the structure */
memset(tsf, 0, sizeof(a4l_trf_t));
 
-   /* We consider 0 can be valid index */
-   tsf-idx_read_subd = A4L_IDX_UNUSED;
-   tsf-idx_write_subd = A4L_IDX_UNUSED;
-
/* 0 is also considered as a valid IRQ, then 
   the IRQ number must be initialized with another value */
tsf-irq_desc.irq = A4L_IRQ_UNUSED;
@@ -186,41 +162,6 @@ int a4l_setup_transfer(a4l_cxt_t * cxt)
tsf-subds[i++] = subd;
}
 
-   /* Allocates various buffers */
-   tsf-bufs = rtdm_malloc(tsf-nb_subd * sizeof(a4l_buf_t *));
-   if (tsf-bufs == NULL) {
-   __a4l_err(a4l_setup_transfer: call2(alloc) failed 

[Xenomai-git] Alexis Berlemont : analogy: replace transfer setup functions with buffer setup ones (broken)

2010-08-02 Thread GIT version control
Module: xenomai-head
Branch: master
Commit: 5ffbfff63c660ab048c560b9695b110d6471478e
URL:
http://git.xenomai.org/?p=xenomai-head.git;a=commit;h=5ffbfff63c660ab048c560b9695b110d6471478e

Author: Alexis Berlemont alexis.berlem...@gmail.com
Date:   Mon May 17 23:31:20 2010 +0200

analogy: replace transfer setup functions with buffer setup ones (broken)

---

 ksrc/drivers/analogy/buffer.c  |3 +
 ksrc/drivers/analogy/command.c |   19 +++
 ksrc/drivers/analogy/instruction.c |2 +-
 ksrc/drivers/analogy/transfer.c|   98 +++
 4 files changed, 22 insertions(+), 100 deletions(-)

diff --git a/ksrc/drivers/analogy/buffer.c b/ksrc/drivers/analogy/buffer.c
index a27a1d6..92f1f4e 100644
--- a/ksrc/drivers/analogy/buffer.c
+++ b/ksrc/drivers/analogy/buffer.c
@@ -145,6 +145,9 @@ int a4l_setup_buffer(a4l_cxt_t *cxt, a4l_cmd_t *cmd)
}
buf_desc-end_count *= cmd-stop_arg;
}
+
+   __a4l_dbg(1, core_dbg,
+ a4l_setup_buffer: end_count=%lu\n, buf_desc-end_count);

return 0;
 }
diff --git a/ksrc/drivers/analogy/command.c b/ksrc/drivers/analogy/command.c
index a6c1dec..b300d9a 100644
--- a/ksrc/drivers/analogy/command.c
+++ b/ksrc/drivers/analogy/command.c
@@ -299,7 +299,8 @@ int a4l_ioctl_cmd(a4l_cxt_t * cxt, void *arg)
 {
int ret = 0, simul_flag = 0;
a4l_cmd_t *cmd_desc = NULL;
-   a4l_dev_t *dev = a4l_get_dev(cxt);
+   a4l_subd_t *subd;
+   a4l_dev_t *dev = a4l_get_dev(cxt);  
 
__a4l_dbg(1, core_dbg, 
  a4l_ioctl_cmd: minor=%d\n, a4l_get_minor(cxt));
@@ -344,11 +345,11 @@ int a4l_ioctl_cmd(a4l_cxt_t * cxt, void *arg)
__a4l_dbg(1, core_dbg, 
  a4l_ioctl_cmd: 1st cmd checks passed\n);
 
+   subd = dev-transfer.subds[cmd_desc-idx_subd];
+
/* Tests the command with the cmdtest function */
-   if (dev-transfer.subds[cmd_desc-idx_subd]-do_cmdtest != NULL)
-   ret = dev-transfer.subds[cmd_desc-idx_subd]-
-   do_cmdtest(dev-transfer.subds[cmd_desc-idx_subd], 
-  cmd_desc);
+   if (subd-do_cmdtest != NULL)
+   ret = subd-do_cmdtest(subd, cmd_desc);
if (ret != 0) {
__a4l_err(a4l_ioctl_cmd: driver's cmd_test failed\n);
goto out_ioctl_cmd;
@@ -363,17 +364,15 @@ int a4l_ioctl_cmd(a4l_cxt_t * cxt, void *arg)
}
 
/* Sets the concerned subdevice as busy */
-   ret = a4l_reserve_transfer(cxt, cmd_desc-idx_subd);
+   ret = a4l_reserve_subd(subd);
if (ret  0)
goto out_ioctl_cmd;
 
/* Gets the transfer system ready */
-   a4l_init_transfer(cxt, cmd_desc);
+   a4l_setup_buffer(cxt, cmd_desc);
 
/* Eventually launches the command */
-   ret = dev-transfer.subds[cmd_desc-idx_subd]-
-   do_cmd(dev-transfer.subds[cmd_desc-idx_subd], 
-  cmd_desc);
+   ret = subd-do_cmd(subd, cmd_desc);
 
if (ret != 0) {
a4l_cancel_transfer(cxt, cmd_desc-idx_subd);
diff --git a/ksrc/drivers/analogy/instruction.c 
b/ksrc/drivers/analogy/instruction.c
index 64c7a04..941fa69 100644
--- a/ksrc/drivers/analogy/instruction.c
+++ b/ksrc/drivers/analogy/instruction.c
@@ -266,7 +266,7 @@ int a4l_do_insn(a4l_cxt_t * cxt, a4l_kinsn_t * dsc)
 
/* Prevents the subdevice from being used during 
   the following operations */
-   ret = a4l_reserve_transfer(cxt, dsc-idx_subd);
+   ret = a4l_reserve_subd(subd);
if (ret  0)
goto out_do_insn;
 
diff --git a/ksrc/drivers/analogy/transfer.c b/ksrc/drivers/analogy/transfer.c
index b1e511d..9fc279a 100644
--- a/ksrc/drivers/analogy/transfer.c
+++ b/ksrc/drivers/analogy/transfer.c
@@ -39,10 +39,6 @@ int a4l_precleanup_transfer(a4l_cxt_t * cxt)
a4l_trf_t *tsf;
int i, err = 0;
 
-   __a4l_dbg(1, core_dbg, 
- a4l_precleanup_transfer: minor=%d\n, 
- a4l_get_minor(cxt));
-
dev = a4l_get_dev(cxt);
tsf = dev-transfer;
 
@@ -55,6 +51,10 @@ int a4l_precleanup_transfer(a4l_cxt_t * cxt)
for (i = 0; i  tsf-nb_subd; i++) {
unsigned long *status = tsf-subds[i]-status;
 
+   __a4l_dbg(1, core_dbg, 
+ a4l_precleanup_transfer: 
+ subd[%d]-status=0x%08x\n, *status);
+
if (test_and_set_bit(A4L_SUBD_BUSY, status)) {
__a4l_err(a4l_precleanup_transfer: 
  device busy, acquisition occuring\n);
@@ -70,7 +70,7 @@ out_error:
for (i = 0; i  tsf-nb_subd; i++) {
unsigned long *status = tsf-subds[i]-status;
 
-   if (test_bit(A4L_TSF_CLEAN, status)){
+   if (test_bit(A4L_SUBD_CLEAN, status)){
clear_bit(A4L_SUBD_BUSY, status);

[Xenomai-git] Alexis Berlemont : analogy: rewrite the cancel ioctl handler (broken)

2010-08-02 Thread GIT version control
Module: xenomai-head
Branch: master
Commit: 0c5e65bb66cc368965c76e62f01a61bc24470ae0
URL:
http://git.xenomai.org/?p=xenomai-head.git;a=commit;h=0c5e65bb66cc368965c76e62f01a61bc24470ae0

Author: Alexis Berlemont alexis.berlem...@gmail.com
Date:   Tue May 18 23:53:11 2010 +0200

analogy: rewrite the cancel ioctl handler (broken)

---

 ksrc/drivers/analogy/buffer.c   |   38 -
 ksrc/drivers/analogy/transfer.c |   45 ---
 2 files changed, 37 insertions(+), 46 deletions(-)

diff --git a/ksrc/drivers/analogy/buffer.c b/ksrc/drivers/analogy/buffer.c
index cb4beb7..bc162d3 100644
--- a/ksrc/drivers/analogy/buffer.c
+++ b/ksrc/drivers/analogy/buffer.c
@@ -155,7 +155,7 @@ int a4l_cancel_buffer(a4l_cxt_t *cxt)

int err = 0;

-   if (!subd !! !a4l_check_subd(subd))
+   if (!subd || !a4l_check_subd(subd))
return 0;
 
/* If a cancel function is registered, call it
@@ -547,6 +547,42 @@ int a4l_ioctl_mmap(a4l_cxt_t *cxt, void *arg)
 
 /* --- IOCTL / FOPS functions --- */
 
+int a4l_ioctl_cancel(a4l_cxt_t * cxt, void *arg)
+{
+   unsigned int idx_subd = (unsigned long)arg;
+   a4l_dev_t *dev = a4l_get_dev(cxt);
+   a4l_subd_t *subd;
+
+   /* Basically check the device */
+   if (!test_bit(A4L_DEV_ATTACHED, dev-flags)) {
+   __a4l_err(a4l_ioctl_cancel: operation not supported on 
+ an unattached device\n);
+   return -EINVAL;
+   }
+
+   if (cxt-buffer-subd == NULL) {
+   __a4l_err(a4l_ioctl_cancel: 
+ no acquisition to cancel on this context\n);
+   return -EINVAL;
+   }
+   
+   if (idx_subd = dev-transfer.nb_subd) {
+   __a4l_err(a4l_ioctl_cancel: bad subdevice index\n);
+   return -EINVAL;
+   }
+
+   subd = dev-transfer.subds[idx_subd];
+   
+   if (subd != cxt-buffer.subd) {
+   __a4l_err(a4l_ioctl_cancel: 
+ current context works on another subdevice 
+ (%d!=%d)\n, cxt-buffer.subd-idx, subd-idx);
+   return -EINVAL; 
+   }
+
+   return a4l_cancel_buffer(cxt);
+}
+
 int a4l_ioctl_bufcfg(a4l_cxt_t * cxt, void *arg)
 {
a4l_dev_t *dev = a4l_get_dev(cxt);
diff --git a/ksrc/drivers/analogy/transfer.c b/ksrc/drivers/analogy/transfer.c
index aa0ae82..945402f 100644
--- a/ksrc/drivers/analogy/transfer.c
+++ b/ksrc/drivers/analogy/transfer.c
@@ -290,49 +290,4 @@ int a4l_rdproc_transfer(char *page,
 
 #endif /* CONFIG_PROC_FS */
 
-/* --- IOCTL / FOPS functions --- */
-
-int a4l_ioctl_cancel(a4l_cxt_t * cxt, void *arg)
-{
-   unsigned int idx_subd = (unsigned long)arg;
-   a4l_dev_t *dev = a4l_get_dev(cxt);
-   a4l_subd_t *subd;
-
-   __a4l_dbg(1, core_dbg, 
- a4l_ioctl_cancel: minor=%d\n, a4l_get_minor(cxt));
-
-   /* Basically check the device */
-   if (!test_bit(A4L_DEV_ATTACHED, dev-flags)) {
-   __a4l_err(a4l_ioctl_cancel: operation not supported on 
- an unattached device\n);
-   return -EINVAL;
-   }
-
-   if (idx_subd = dev-transfer.nb_subd) {
-   __a4l_err(a4l_ioctl_cancel: bad subdevice index\n);
-   return -EINVAL;
-   }
-
-   if ((dev-transfer.subds[idx_subd]-flags  A4L_SUBD_TYPES) == 
-   A4L_SUBD_UNUSED) {
-   __a4l_err(a4l_ioctl_cancel: non functional subdevice\n);
-   return -EIO;
-   }
-
-   if (!(dev-transfer.subds[idx_subd]-flags  A4L_SUBD_CMD)) {
-   __a4l_err(a4l_ioctl_cancel: operation not supported, 
- synchronous only subdevice\n);
-   return -EIO;
-   }
-
-   subd = dev-transfer.subds[idx_subd];
-
-   if (!test_bit(A4L_TSF_BUSY, (dev-transfer.status[idx_subd]))) {
-   __a4l_err(a4l_ioctl_cancel: subdevice currently idle\n);
-   return -EINVAL;
-   }
-
-   return a4l_cancel_transfer(cxt, idx_subd);
-}
-
 #endif /* !DOXYGEN_CPP */


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


[Xenomai-git] Alexis Berlemont : analogy: update a4l_read and a4l_write (broken)

2010-08-02 Thread GIT version control
Module: xenomai-head
Branch: master
Commit: 1d0b89ad0e11f1fb631fdf2534ea81a42a2098f6
URL:
http://git.xenomai.org/?p=xenomai-head.git;a=commit;h=1d0b89ad0e11f1fb631fdf2534ea81a42a2098f6

Author: Alexis Berlemont alexis.berlem...@gmail.com
Date:   Wed May 19 00:15:00 2010 +0200

analogy: update a4l_read and a4l_write (broken)

---

 ksrc/drivers/analogy/buffer.c |   50 +---
 1 files changed, 16 insertions(+), 34 deletions(-)

diff --git a/ksrc/drivers/analogy/buffer.c b/ksrc/drivers/analogy/buffer.c
index bc162d3..9bd9829 100644
--- a/ksrc/drivers/analogy/buffer.c
+++ b/ksrc/drivers/analogy/buffer.c
@@ -773,28 +773,21 @@ a4l_ioctl_bufinfo_out:
 ssize_t a4l_read(a4l_cxt_t * cxt, void *bufdata, size_t nbytes)
 {
a4l_dev_t *dev = a4l_get_dev(cxt);
-   int idx_subd = dev-transfer.idx_read_subd;
-   a4l_buf_t *buf = dev-transfer.bufs[idx_subd];
+   a4l_buf_t *buf = cxt-buffer;
ssize_t count = 0;
 
/* Basic checkings */
+
if (!test_bit(A4L_DEV_ATTACHED, dev-flags)) {
__a4l_err(a4l_read: unattached device\n);
return -EINVAL;
}
 
-   if (!test_bit(A4L_TSF_BUSY, (dev-transfer.status[idx_subd]))) {
-   __a4l_err(a4l_read: idle subdevice\n);
+   if (!buf-subd || !test_bit(A4L_SUBD_BUSY, buf-subd-status)) {
+   __a4l_err(a4l_read: idle subdevice on this context\n);
return -ENOENT;
}
 
-   /* TODO: to be removed
-  Check the subdevice capabilities */
-   if ((dev-transfer.subds[idx_subd]-flags  A4L_SUBD_CMD) == 0) {   
   
-   __a4l_err(a4l_read: incoherent state\n);
-   return -EINVAL;
-   }
-
while (count  nbytes) {
 
/* Check the events */
@@ -825,10 +818,9 @@ ssize_t a4l_read(a4l_cxt_t * cxt, void *bufdata, size_t 
nbytes)
if (tmp_cnt  0) {
 
/* Performs the munge if need be */
-   if (dev-transfer.subds[idx_subd]-munge != NULL) {
-   __munge(dev-transfer.subds[idx_subd],
-   dev-transfer.subds[idx_subd]-munge,
-   buf, tmp_cnt);
+   if (buf-subd-munge != NULL) {
+   __munge(buf-subd, 
+   buf-subd-munge, buf, tmp_cnt);
 
/* Updates munge count */
buf-mng_count += tmp_cnt;
@@ -850,8 +842,7 @@ ssize_t a4l_read(a4l_cxt_t * cxt, void *bufdata, size_t 
nbytes)
 
/* If the driver does not work in bulk mode,
   we must leave this function */
-   if (!test_bit(A4L_TSF_BULK,
- (dev-transfer.status[idx_subd])))
+   if (!test_bit(A4L_BUF_BULK, buf-flags))
goto out_a4l_read;
}
/* If the acquisition is not over, we must not
@@ -876,28 +867,21 @@ ssize_t a4l_write(a4l_cxt_t *cxt,
  const void *bufdata, size_t nbytes)
 {
a4l_dev_t *dev = a4l_get_dev(cxt);
-   int idx_subd = dev-transfer.idx_write_subd;
-   a4l_buf_t *buf = dev-transfer.bufs[idx_subd];
+   a4l_buf_t *buf = cxt-buffer;
ssize_t count = 0;
 
/* Basic checkings */
+
if (!test_bit(A4L_DEV_ATTACHED, dev-flags)) {
__a4l_err(a4l_write: unattached device\n);
return -EINVAL;
}
 
-   if (!test_bit(A4L_TSF_BUSY, (dev-transfer.status[idx_subd]))) {
-   __a4l_err(a4l_write: idle subdevice\n);
+   if (!buf-subd || !test_bit(A4L_SUBD_BUSY, buf-subd-status)) {
+   __a4l_err(a4l_read: idle subdevice on this context\n);
return -ENOENT;
}
 
-   /* TODO: to be removed
-  Check the subdevice capabilities */
-   if ((dev-transfer.subds[idx_subd]-flags  A4L_SUBD_CMD) == 0) {   
-   __a4l_err(a4l_write: incoherent state\n);
-   return -EINVAL;
-   }
-
while (count  nbytes) {
 
/* Check the events */
@@ -928,10 +912,9 @@ ssize_t a4l_write(a4l_cxt_t *cxt,
}
 
/* Performs the munge if need be */
-   if (dev-transfer.subds[idx_subd]-munge != NULL) {
-   __munge(dev-transfer.subds[idx_subd],
-   dev-transfer.subds[idx_subd]-munge,
-   buf, tmp_cnt);
+   if (buf-subd-munge != NULL) {
+   __munge(buf-subd, 
+   buf-subd-munge, buf, tmp_cnt);
 
/* Updates munge count */
buf-mng_count += tmp_cnt;
@@ -945,8 +928,7 @@ ssize_t 

[Xenomai-git] Alexis Berlemont : analogy: fix bulk flag declaration in buffer.h (broken)

2010-08-02 Thread GIT version control
Module: xenomai-head
Branch: master
Commit: adb96dc6af6ebd10eab4e0e09c91e7fc3a3c0750
URL:
http://git.xenomai.org/?p=xenomai-head.git;a=commit;h=adb96dc6af6ebd10eab4e0e09c91e7fc3a3c0750

Author: Alexis Berlemont alexis.berlem...@gmail.com
Date:   Wed May 19 00:13:36 2010 +0200

analogy: fix bulk flag declaration in buffer.h (broken)

---

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

diff --git a/include/analogy/buffer.h b/include/analogy/buffer.h
index 49d2a9f..786c8e1 100644
--- a/include/analogy/buffer.h
+++ b/include/analogy/buffer.h
@@ -45,7 +45,7 @@
 
 /* Status bits */
 #define A4L_BUF_BULK_NR 8
-#define A4L_BUF_MAP_NR 8
+#define A4L_BUF_MAP_NR 9
 /* Status flags */
 #define A4L_BUF_BULK (1  A4L_BUF_BULK_NR)
 #define A4L_BUF_MAP (1  A4L_BUF_MAP_NR)
@@ -89,8 +89,8 @@ typedef struct a4l_buffer a4l_buf_t;
 /* Static inline Buffer related functions */
 
 /* Produce memcpy function */
-static inline int __produce(a4l_cxt_t * cxt,
-   a4l_buf_t * buf, void *pin, unsigned long count)
+static inline int __produce(a4l_cxt_t *cxt,
+   a4l_buf_t *buf, void *pin, unsigned long count)
 {
unsigned long start_ptr = (buf-prd_count % buf-size);
unsigned long tmp_cnt = count;
@@ -119,8 +119,8 @@ static inline int __produce(a4l_cxt_t * cxt,
 }
 
 /* Consume memcpy function */
-static inline int __consume(a4l_cxt_t * cxt,
-   a4l_buf_t * buf, void *pout, unsigned long count)
+static inline int __consume(a4l_cxt_t *cxt,
+   a4l_buf_t *buf, void *pout, unsigned long count)
 {
unsigned long start_ptr = (buf-cns_count % buf-size);
unsigned long tmp_cnt = count;


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


[Xenomai-git] Alexis Berlemont : analogy: last updates in the buffer part (broken)

2010-08-02 Thread GIT version control
Module: xenomai-head
Branch: master
Commit: f9ba3a5c1bff489f7515dd7269a160fab57d250c
URL:
http://git.xenomai.org/?p=xenomai-head.git;a=commit;h=f9ba3a5c1bff489f7515dd7269a160fab57d250c

Author: Alexis Berlemont alexis.berlem...@gmail.com
Date:   Wed May 19 23:35:12 2010 +0200

analogy: last updates in the buffer part (broken)

---

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

diff --git a/ksrc/drivers/analogy/buffer.c b/ksrc/drivers/analogy/buffer.c
index c9b1682..011753a 100644
--- a/ksrc/drivers/analogy/buffer.c
+++ b/ksrc/drivers/analogy/buffer.c
@@ -387,8 +387,8 @@ void a4l_unmap(struct vm_area_struct *area)
 }
 
 static struct vm_operations_struct a4l_vm_ops = {
-open:a4l_map,
-close:a4l_unmap,
+   .open = a4l_map,
+   .close = a4l_unmap,
 };
 
 int a4l_ioctl_mmap(a4l_cxt_t *cxt, void *arg)
@@ -397,9 +397,6 @@ int a4l_ioctl_mmap(a4l_cxt_t *cxt, void *arg)
a4l_dev_t *dev;
int ret;
 
-   __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()) {
@@ -511,9 +508,6 @@ int a4l_ioctl_bufcfg(a4l_cxt_t * cxt, void *arg)
a4l_dev_t *dev = a4l_get_dev(cxt);
a4l_bufcfg_t buf_cfg;
 
-   __a4l_dbg(1, core_dbg, 
- a4l_ioctl_bufcfg: minor=%d\n, a4l_get_minor(cxt));
-
/* As Linux API is used to allocate a virtual buffer,
   the calling process must not be in primary mode */
if (rtdm_in_rt_context()) {
@@ -580,9 +574,6 @@ int a4l_ioctl_bufinfo(a4l_cxt_t * cxt, void *arg)
unsigned long tmp_cnt;
int ret;
 
-   __a4l_dbg(1, core_dbg, 
- a4l_ioctl_bufinfo: minor=%d\n, a4l_get_minor(cxt));
-
if (!rtdm_in_rt_context()  rtdm_rt_capable(cxt-user_info))
return -ENOSYS;
 


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


[Xenomai-git] Alexis Berlemont : analogy: update all a4l_buf_* functions (broken)

2010-08-02 Thread GIT version control
Module: xenomai-head
Branch: master
Commit: 57686246885bc39ae775ea013b8d2bd361e512fd
URL:
http://git.xenomai.org/?p=xenomai-head.git;a=commit;h=57686246885bc39ae775ea013b8d2bd361e512fd

Author: Alexis Berlemont alexis.berlem...@gmail.com
Date:   Wed May 19 23:29:59 2010 +0200

analogy: update all a4l_buf_* functions (broken)

---

 include/analogy/buffer.h |   11 ++-
 ksrc/drivers/analogy/buffer.c|  157 --
 ksrc/drivers/analogy/driver_facilities.c |4 +-
 3 files changed, 51 insertions(+), 121 deletions(-)

diff --git a/include/analogy/buffer.h b/include/analogy/buffer.h
index 786c8e1..cf82811 100644
--- a/include/analogy/buffer.h
+++ b/include/analogy/buffer.h
@@ -329,9 +329,11 @@ static inline unsigned long __count_to_get(a4l_buf_t * buf)
 
 /* --- Buffer internal functions --- */
 
-int a4l_alloc_buffer(a4l_buf_t * buf_desc);
+void a4l_init_buffer(a4l_buf_t * buf_desc);
 
-void a4l_free_buffer(a4l_buf_t * buf_desc);
+int a4l_setup_buffer(a4l_cxt_t *cxt, a4l_cmd_t *cmd);
+
+int a4l_cancel_buffer(a4l_cxt_t *cxt);
 
 int a4l_buf_prepare_absput(struct a4l_subdevice *subd, 
   unsigned long count);
@@ -369,7 +371,10 @@ unsigned long a4l_buf_count(struct a4l_subdevice *subd);
 
 /* --- Current Command management function --- */
 
-a4l_cmd_t *a4l_get_cmd(struct a4l_subdevice *subd);
+static inline a4l_cmd_t *a4l_get_cmd(a4l_subd_t *subd)
+{
+   return (subd-buf) ? subd-buf-cur_cmd : NULL;
+}
 
 /* --- Munge related function --- */
 
diff --git a/ksrc/drivers/analogy/buffer.c b/ksrc/drivers/analogy/buffer.c
index 9bd9829..c9b1682 100644
--- a/ksrc/drivers/analogy/buffer.c
+++ b/ksrc/drivers/analogy/buffer.c
@@ -182,38 +182,17 @@ int a4l_cancel_buffer(a4l_cxt_t *cxt)
return err;
 }
 
-/* --- current Command management function --- */
-
-a4l_cmd_t *a4l_get_cmd(a4l_subd_t *subd)
-{
-   a4l_dev_t *dev = subd-dev;
-
-   /* Check that subdevice supports commands */
-   if (dev-transfer.bufs == NULL)
-   return NULL;
-
-   return dev-transfer.bufs[subd-idx]-cur_cmd;
-}
-
 /* --- Munge related function --- */
 
 int a4l_get_chan(a4l_subd_t *subd)
 {
-   a4l_dev_t *dev = subd-dev;
int i, j, tmp_count, tmp_size = 0;  
a4l_cmd_t *cmd;
 
-   /* Check that subdevice supports commands */
-   if (dev-transfer.bufs == NULL)
-   return -EINVAL;
-
-   /* Check a command is executed */
-   if (dev-transfer.bufs[subd-idx]-cur_cmd == NULL)
+   cmd = a4l_get_cmd(subd);
+   if (!cmd) 
return -EINVAL;
 
-   /* Retrieve the proper command descriptor */
-   cmd = dev-transfer.bufs[subd-idx]-cur_cmd;
-
/* There is no need to check the channel idx, 
   it has already been controlled in command_test */
 
@@ -252,185 +231,128 @@ int a4l_get_chan(a4l_subd_t *subd)
 
 int a4l_buf_prepare_absput(a4l_subd_t *subd, unsigned long count)
 {
-   a4l_dev_t *dev;
-   a4l_buf_t *buf;
-   
-   if ((subd-flags  A4L_SUBD_MASK_READ) == 0)
+   if ((subd-flags  A4L_SUBD_MASK_READ) == 0 || !subd-buf)
return -EINVAL;
 
-   dev = subd-dev;
-   buf = dev-transfer.bufs[subd-idx];
-
-   return __pre_abs_put(buf, count);
+   return __pre_abs_put(subd-buf, count);
 }
 
 
 int a4l_buf_commit_absput(a4l_subd_t *subd, unsigned long count)
 {
-   a4l_dev_t *dev;
-   a4l_buf_t *buf;
-   
-   if ((subd-flags  A4L_SUBD_MASK_READ) == 0)
+   if ((subd-flags  A4L_SUBD_MASK_READ) == 0 || !subd-buf)
return -EINVAL;
 
-   dev = subd-dev;
-   buf = dev-transfer.bufs[subd-idx];
-
-   return __abs_put(buf, count);
+   return __abs_put(subd-buf, count);
 }
 
 int a4l_buf_prepare_put(a4l_subd_t *subd, unsigned long count)
 {
-   a4l_dev_t *dev;
-   a4l_buf_t *buf;
-   
-   if ((subd-flags  A4L_SUBD_MASK_READ) == 0)
+   if ((subd-flags  A4L_SUBD_MASK_READ) == 0 || !subd-buf)
return -EINVAL;
 
-   dev = subd-dev;
-   buf = dev-transfer.bufs[subd-idx];
-
-   return __pre_put(buf, count);
+   return __pre_put(subd-buf, count);
 }
 
 int a4l_buf_commit_put(a4l_subd_t *subd, unsigned long count)
 {
-   a4l_dev_t *dev;
-   a4l_buf_t *buf;
-   
-   if ((subd-flags  A4L_SUBD_MASK_READ) == 0)
+   if ((subd-flags  A4L_SUBD_MASK_READ) == 0 || !subd-buf)
return -EINVAL;
 
-   dev = subd-dev;
-   buf = dev-transfer.bufs[subd-idx];
-
-   return __put(buf, count);   
+   return __put(subd-buf, count); 
 }
 
 int a4l_buf_put(a4l_subd_t *subd, void *bufdata, unsigned long count)
 {
int err;
-   a4l_dev_t *dev;
-   a4l_buf_t *buf;
-   
-   if ((subd-flags  A4L_SUBD_MASK_READ) == 0)
-   return -EINVAL;
 
-   dev = subd-dev;
-   buf = dev-transfer.bufs[subd-idx];
-
-   if (__count_to_put(buf)  count)
+   if ((subd-flags  

[Xenomai-git] Alexis Berlemont : analogy: update a4l_get_minor function (broken)

2010-08-02 Thread GIT version control
Module: xenomai-head
Branch: master
Commit: c01e2c73b3a7cd0b7e4fd70531f57895c43edc47
URL:
http://git.xenomai.org/?p=xenomai-head.git;a=commit;h=c01e2c73b3a7cd0b7e4fd70531f57895c43edc47

Author: Alexis Berlemont alexis.berlem...@gmail.com
Date:   Mon May 24 23:33:13 2010 +0200

analogy: update a4l_get_minor function (broken)

---

 include/analogy/context.h |   10 ++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/include/analogy/context.h b/include/analogy/context.h
index e0cf01c..2442b6c 100644
--- a/include/analogy/context.h
+++ b/include/analogy/context.h
@@ -25,6 +25,8 @@
 
 #if defined(__KERNEL__)  !defined(DOXYGEN_CPP)
 
+#include rtdm/rtdm_driver.h
+
 struct a4l_device;
 struct a4l_buffer;
 
@@ -43,6 +45,14 @@ struct a4l_device_context {
struct buffer buffer; 
 };
 
+static inline int a4l_get_minor(a4l_cxt_t *cxt)
+{
+   /* Get a pointer on the container structure */
+   struct rtdm_dev_context * rtdm_cxt = rtdm_private_to_context(cxt);
+   /* Get the minor index */
+   return rtdm_cxt-device-device_id;
+}
+
 #endif /* __KERNEL__  !DOXYGEN_CPP */
 
 #endif /* __ANALOGY_CONTEXT__ */


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


[Xenomai-git] Alexis Berlemont : analogy: declare the reserve / release functions at the subd level (broken)

2010-08-02 Thread GIT version control
Module: xenomai-head
Branch: master
Commit: 7f58510b4748a25aef03e17b1d4ded1f6bf4d96d
URL:
http://git.xenomai.org/?p=xenomai-head.git;a=commit;h=7f58510b4748a25aef03e17b1d4ded1f6bf4d96d

Author: Alexis Berlemont alexis.berlem...@gmail.com
Date:   Mon May 24 16:46:31 2010 +0200

analogy: declare the reserve / release functions at the subd level (broken)

---

 include/analogy/subdevice.h|2 ++
 ksrc/drivers/analogy/command.c |   33 -
 ksrc/drivers/analogy/instruction.c |2 +-
 ksrc/drivers/analogy/subdevice.c   |   15 +++
 4 files changed, 30 insertions(+), 22 deletions(-)

diff --git a/include/analogy/subdevice.h b/include/analogy/subdevice.h
index 0f9e1c5..ded82f3 100644
--- a/include/analogy/subdevice.h
+++ b/include/analogy/subdevice.h
@@ -290,6 +290,8 @@ a4l_subd_t * a4l_get_subd(struct a4l_device *dev, int idx);
 a4l_subd_t * a4l_alloc_subd(int sizeof_priv,
void (*setup)(a4l_subd_t *));
 int a4l_add_subd(struct a4l_device *dev, a4l_subd_t * subd);
+int a4l_reserve_subd(a4l_subd_t *subd);
+void a4l_release_subd(a4l_subd_t *subd);
 int a4l_ioctl_subdinfo(a4l_cxt_t * cxt, void *arg);
 int a4l_ioctl_chaninfo(a4l_cxt_t * cxt, void *arg);
 int a4l_ioctl_rnginfo(a4l_cxt_t * cxt, void *arg);
diff --git a/ksrc/drivers/analogy/command.c b/ksrc/drivers/analogy/command.c
index b300d9a..94d6137 100644
--- a/ksrc/drivers/analogy/command.c
+++ b/ksrc/drivers/analogy/command.c
@@ -90,11 +90,8 @@ void a4l_free_cmddesc(a4l_cmd_t * desc)
 
 int a4l_check_cmddesc(a4l_cxt_t * cxt, a4l_cmd_t * desc)
 {
-   int ret = 0;
a4l_dev_t *dev = a4l_get_dev(cxt);
-
-   __a4l_dbg(1, core_dbg, 
-a4l_check_cmddesc: minor=%d\n, a4l_get_minor(cxt));
+   a4l_subd_t *subd;
 
if (desc-idx_subd = dev-transfer.nb_subd) {
__a4l_err(a4l_check_cmddesc: 
@@ -103,25 +100,23 @@ int a4l_check_cmddesc(a4l_cxt_t * cxt, a4l_cmd_t * desc)
return -EINVAL;
}
 
-   if ((dev-transfer.subds[desc-idx_subd]-flags  A4L_SUBD_TYPES) == 
-   A4L_SUBD_UNUSED) {
+   subd = dev-transfer.subds[desc-idx_subd];
+
+   if ((subd-flags  A4L_SUBD_TYPES) == A4L_SUBD_UNUSED) {
__a4l_err(a4l_check_cmddesc: 
  subdevice type incoherent\n);
return -EIO;
}
 
-   if (!(dev-transfer.subds[desc-idx_subd]-flags  A4L_SUBD_CMD)) {
+   if (!(subd-flags  A4L_SUBD_CMD)) {
__a4l_err(a4l_check_cmddesc: operation not supported, 
  synchronous only subdevice\n);
return -EIO;
}
 
-   if (test_bit(A4L_TSF_BUSY, (dev-transfer.status[desc-idx_subd])))
-   return -EBUSY;
-
-   if (ret != 0) {
+   if (test_bit(A4L_SUBD_BUSY, subd-status)) {
__a4l_err(a4l_check_cmddesc: subdevice busy\n);
-   return ret;
+   return -EBUSY;
}
 
return a4l_check_chanlist(dev-transfer.subds[desc-idx_subd],
@@ -299,17 +294,13 @@ int a4l_ioctl_cmd(a4l_cxt_t * cxt, void *arg)
 {
int ret = 0, simul_flag = 0;
a4l_cmd_t *cmd_desc = NULL;
-   a4l_subd_t *subd;
a4l_dev_t *dev = a4l_get_dev(cxt);  
-
-   __a4l_dbg(1, core_dbg, 
- a4l_ioctl_cmd: minor=%d\n, a4l_get_minor(cxt));
+   a4l_subd_t *subd;
 
/* The command launching cannot be done in real-time because
   of some possible buffer allocations in the drivers */
-   if (rtdm_in_rt_context()) {
+   if (rtdm_in_rt_context())
return -ENOSYS;
-   }
 
/* Basically check the device */
if (!test_bit(A4L_DEV_ATTACHED, dev-flags)) {
@@ -373,13 +364,13 @@ int a4l_ioctl_cmd(a4l_cxt_t * cxt, void *arg)
 
/* Eventually launches the command */
ret = subd-do_cmd(subd, cmd_desc);
-
+   
if (ret != 0) {
-   a4l_cancel_transfer(cxt, cmd_desc-idx_subd);
+   a4l_cancel_buffer(cxt);
goto out_ioctl_cmd;
}
 
-  out_ioctl_cmd:
+out_ioctl_cmd:
if (ret != 0 || simul_flag == 1) {
a4l_free_cmddesc(cmd_desc);
rtdm_free(cmd_desc);
diff --git a/ksrc/drivers/analogy/instruction.c 
b/ksrc/drivers/analogy/instruction.c
index 941fa69..413c0d2 100644
--- a/ksrc/drivers/analogy/instruction.c
+++ b/ksrc/drivers/analogy/instruction.c
@@ -281,7 +281,7 @@ int a4l_do_insn(a4l_cxt_t * cxt, a4l_kinsn_t * dsc)
 out_do_insn:
 
/* Releases the subdevice from its reserved state */
-   a4l_cancel_transfer(cxt, dsc-idx_subd);
+   a4l_release_subd(subd);
 
return ret;
 }
diff --git a/ksrc/drivers/analogy/subdevice.c b/ksrc/drivers/analogy/subdevice.c
index 1278081..506b742 100644
--- a/ksrc/drivers/analogy/subdevice.c
+++ b/ksrc/drivers/analogy/subdevice.c
@@ -180,6 +180,21 @@ a4l_subd_t *a4l_get_subd(a4l_dev_t *dev, int idx)
return subd;
 }
 
+int 

[Xenomai-git] Alexis Berlemont : analogy: cosmetic changes (broken)

2010-08-02 Thread GIT version control
Module: xenomai-head
Branch: master
Commit: 6a938fc4aca54a01ed2ec8cfa68c076138186f36
URL:
http://git.xenomai.org/?p=xenomai-head.git;a=commit;h=6a938fc4aca54a01ed2ec8cfa68c076138186f36

Author: Alexis Berlemont alexis.berlem...@gmail.com
Date:   Mon May 24 16:44:03 2010 +0200

analogy: cosmetic changes (broken)

---

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

diff --git a/ksrc/drivers/analogy/buffer.c b/ksrc/drivers/analogy/buffer.c
index 011753a..0ca1b4c 100644
--- a/ksrc/drivers/analogy/buffer.c
+++ b/ksrc/drivers/analogy/buffer.c
@@ -35,7 +35,7 @@
 
 /* --- Initialization functions (init, alloc, free) --- */
 
-void a4l_free_buffer(a4l_buf_t * buf_desc)
+void a4l_free_buffer(a4l_buf_t *buf_desc)
 {
if (buf_desc-pg_list != NULL) {
rtdm_free(buf_desc-pg_list);
@@ -52,7 +52,7 @@ void a4l_free_buffer(a4l_buf_t * buf_desc)
}
 }
 
-int a4l_alloc_buffer(a4l_buf_t * buf_desc, int buf_size)
+int a4l_alloc_buffer(a4l_buf_t *buf_desc, int buf_size)
 {
int ret = 0;
char *vaddr, *vabase;
@@ -91,7 +91,7 @@ out_virt_contig_alloc:
return ret;
 }
 
-void a4l_init_buffer(a4l_buf_t * buf_desc)
+void a4l_init_buffer(a4l_buf_t *buf_desc)
 {
/* No command to process yet */
buf_desc-cur_cmd = NULL;


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


[Xenomai-git] Alexis Berlemont : analogy: update a4l_set_dev and remove useless info traces (broken)

2010-08-02 Thread GIT version control
Module: xenomai-head
Branch: master
Commit: 3015e49c2210d440ffbc44e5b00131b374a41146
URL:
http://git.xenomai.org/?p=xenomai-head.git;a=commit;h=3015e49c2210d440ffbc44e5b00131b374a41146

Author: Alexis Berlemont alexis.berlem...@gmail.com
Date:   Mon May 24 23:34:19 2010 +0200

analogy: update a4l_set_dev and remove useless info traces (broken)

---

 include/analogy/device.h  |2 +-
 ksrc/drivers/analogy/device.c |   39 +--
 2 files changed, 6 insertions(+), 35 deletions(-)

diff --git a/include/analogy/device.h b/include/analogy/device.h
index 51b99b5..6930a38 100644
--- a/include/analogy/device.h
+++ b/include/analogy/device.h
@@ -91,7 +91,7 @@ int a4l_rdproc_devs(char *page,
off_t off, int count, int *eof, void *data);
 
 /* --- Context related function / macro --- */
-void a4l_set_dev(struct rtdm_dev_context *context);
+void a4l_set_dev(a4l_cxt_t *cxt);
 #define a4l_get_dev(x) ((x)-dev)
 
 /* --- Upper layer functions --- */
diff --git a/ksrc/drivers/analogy/device.c b/ksrc/drivers/analogy/device.c
index 4a3c879..a2d23c8 100644
--- a/ksrc/drivers/analogy/device.c
+++ b/ksrc/drivers/analogy/device.c
@@ -43,8 +43,6 @@ void a4l_init_devs(void)
for (i = 0; i  A4L_NB_DEVICES; i++) {  
a4l_lock_init(a4l_devs[i].lock);
a4l_devs[i].transfer.irq_desc.irq = A4L_IRQ_UNUSED;
-   a4l_devs[i].transfer.idx_read_subd = A4L_IDX_UNUSED;
-   a4l_devs[i].transfer.idx_write_subd = A4L_IDX_UNUSED;
}
 }
 
@@ -59,13 +57,10 @@ int a4l_check_cleanup_devs(void)
return ret;
 }
 
-void a4l_set_dev(struct rtdm_dev_context *context)
+void a4l_set_dev(a4l_cxt_t *cxt)
 {
-   /* Get the context's private structure */
-   a4l_cxt_t *cxt = (a4l_cxt_t *)context-dev_private;
-   /* Retrive the minor index */
-   static int minor = context-device-device_id;
-   
+   /* Retrieve the minor index */
+   static int minor = a4l_get_minor(cxt);  
/* Fill the dev fields accordingly */
cxt-dev = (a4l_devs[minor]);
 }
@@ -208,9 +203,6 @@ int a4l_fill_lnkdesc(a4l_cxt_t * cxt,
char *tmpname = NULL;
void *tmpopts = NULL;
 
-   __a4l_dbg(1, core_dbg, 
- a4l_fill_lnkdesc: minor=%d\n, a4l_get_minor(cxt));
-
ret = rtdm_safe_copy_from_user(cxt-user_info,
   link_arg, arg, sizeof(a4l_lnkdesc_t));
if (ret != 0) {
@@ -285,9 +277,6 @@ int a4l_fill_lnkdesc(a4l_cxt_t * cxt,
 
 void a4l_free_lnkdesc(a4l_cxt_t * cxt, a4l_lnkdesc_t * link_arg)
 {
-   __a4l_dbg(1, core_dbg, 
- a4l_free_lnkdesc: minor=%d\n, a4l_get_minor(cxt));
-
if (link_arg-bname != NULL)
rtdm_free(link_arg-bname);
 
@@ -301,9 +290,6 @@ int a4l_assign_driver(a4l_cxt_t * cxt,
int ret = 0;
a4l_dev_t *dev = a4l_get_dev(cxt);
 
-   __a4l_dbg(1, core_dbg, 
- a4l_assign_driver: minor=%d\n, a4l_get_minor(cxt));
-
dev-driver = drv;
 
if (drv-privdata_size == 0)
@@ -355,9 +341,6 @@ int a4l_release_driver(a4l_cxt_t * cxt)
int ret = 0;
a4l_dev_t *dev = a4l_get_dev(cxt);
 
-   __a4l_dbg(1, core_dbg, 
- a4l_release_driver: minor=%d\n, a4l_get_minor(cxt));
-
if ((ret = dev-driver-detach(dev)) != 0)
goto out_release_driver;
 
@@ -388,9 +371,6 @@ int a4l_device_attach(a4l_cxt_t * cxt, void *arg)
a4l_lnkdesc_t link_arg;
a4l_drv_t *drv = NULL;
 
-   __a4l_dbg(1, core_dbg, 
- a4l_device_attach: minor=%d\n, a4l_get_minor(cxt));
-
if ((ret = a4l_fill_lnkdesc(cxt, link_arg, arg)) != 0)
goto out_attach;
 
@@ -412,9 +392,6 @@ int a4l_device_detach(a4l_cxt_t * cxt)
 {
a4l_dev_t *dev = a4l_get_dev(cxt);
 
-   __a4l_dbg(1, core_dbg, 
- a4l_device_detach: minor=%d\n, a4l_get_minor(cxt));
-
if (dev-driver == NULL) {
__a4l_err(a4l_device_detach: 
  incoherent state, driver not reachable\n);
@@ -430,9 +407,6 @@ int a4l_ioctl_devcfg(a4l_cxt_t * cxt, void *arg)
 {
int ret = 0;
 
-   __a4l_dbg(1, core_dbg, 
- a4l_ioctl_devcfg: minor=%d\n, a4l_get_minor(cxt));
-
if (rtdm_in_rt_context())
return -ENOSYS;
 
@@ -487,9 +461,6 @@ int a4l_ioctl_devinfo(a4l_cxt_t * cxt, void *arg)
a4l_dvinfo_t info;
a4l_dev_t *dev = a4l_get_dev(cxt);
 
-   __a4l_dbg(1, core_dbg, 
- a4l_ioctl_devinfo: minor=%d\n, a4l_get_minor(cxt));
-
memset(info, 0, sizeof(a4l_dvinfo_t));
 
if (test_bit(A4L_DEV_ATTACHED, dev-flags)) {
@@ -498,8 +469,8 @@ int a4l_ioctl_devinfo(a4l_cxt_t * cxt, void *arg)
 
memcpy(info.board_name, dev-driver-board_name, len);
info.nb_subd = dev-transfer.nb_subd;
-   info.idx_read_subd = dev-transfer.idx_read_subd;
- 

[Xenomai-git] Alexis Berlemont : analogy: minor fix in the subdevice structure declaration

2010-08-02 Thread GIT version control
Module: xenomai-head
Branch: master
Commit: 90e8bc069d31a4b4dbdd3e7e0089b0bb884c7f04
URL:
http://git.xenomai.org/?p=xenomai-head.git;a=commit;h=90e8bc069d31a4b4dbdd3e7e0089b0bb884c7f04

Author: Alexis Berlemont alexis.berlem...@gmail.com
Date:   Fri Jun  4 00:04:41 2010 +0200

analogy: minor fix in the subdevice structure declaration

---

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

diff --git a/include/analogy/buffer.h b/include/analogy/buffer.h
index cf82811..4846a4e 100644
--- a/include/analogy/buffer.h
+++ b/include/analogy/buffer.h
@@ -56,7 +56,7 @@ struct a4l_subdevice;
 struct a4l_buffer {
 
/* Added by the structure update */
-   a4l_subd_t *subd;
+   struct a4l_subdevice *subd;
 
/* Buffer's first virtual page pointer */
void *buf;


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


[Xenomai-git] Alexis Berlemont : analogy: add some helper macros to test the subdevice' s characteristics

2010-08-02 Thread GIT version control
Module: xenomai-head
Branch: master
Commit: 9f9df2ba10763c08f48f802bef32fb7f5854faa8
URL:
http://git.xenomai.org/?p=xenomai-head.git;a=commit;h=9f9df2ba10763c08f48f802bef32fb7f5854faa8

Author: Alexis Berlemont alexis.berlem...@gmail.com
Date:   Fri Jun  4 00:06:05 2010 +0200

analogy: add some helper macros to test the subdevice's characteristics

---

 include/analogy/subdevice.h |   16 ++--
 1 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/include/analogy/subdevice.h b/include/analogy/subdevice.h
index ded82f3..0337092 100644
--- a/include/analogy/subdevice.h
+++ b/include/analogy/subdevice.h
@@ -286,12 +286,24 @@ int a4l_check_chanlist(a4l_subd_t * subd,
 
 /* --- Upper layer functions --- */
 
+static inline int a4l_reserve_subd(a4l_subd_t *subd)
+{
+return test_and_set_bit(A4L_SUBD_BUSY, subd-status) ? -EBUSY : 0;
+}
+#define a4l_release_subd(x) clear_bit(A4L_SUBD_BUSY, (x)-status))
+#define a4l_subd_is_busy(x) test_bit(A4L_SUBD_BUSY, (x)-status))
+
+#define a4l_subd_is_input(x) ((A4L_SUBD_MASK_READ  (x)-flags) != 0)
+/* The following macro considers that a DIO subdevice is firstly an
+   output subdevice */
+#define a4l_subd_is_output(x) \
+   ((A4L_SUBD_MASK_WRITE  (x)-flags) != 0 || \
+(A4L_SUBD_DIO  (x)-flags) != 0)
+
 a4l_subd_t * a4l_get_subd(struct a4l_device *dev, int idx);
 a4l_subd_t * a4l_alloc_subd(int sizeof_priv,
void (*setup)(a4l_subd_t *));
 int a4l_add_subd(struct a4l_device *dev, a4l_subd_t * subd);
-int a4l_reserve_subd(a4l_subd_t *subd);
-void a4l_release_subd(a4l_subd_t *subd);
 int a4l_ioctl_subdinfo(a4l_cxt_t * cxt, void *arg);
 int a4l_ioctl_chaninfo(a4l_cxt_t * cxt, void *arg);
 int a4l_ioctl_rnginfo(a4l_cxt_t * cxt, void *arg);


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


[Xenomai-git] Alexis Berlemont : analogy: fix the buffer syscalls (ioctl + r/w) after buffer review (broken)

2010-08-02 Thread GIT version control
Module: xenomai-head
Branch: master
Commit: c76fc97b5493a8779f94233a01cdc8221633b7bb
URL:
http://git.xenomai.org/?p=xenomai-head.git;a=commit;h=c76fc97b5493a8779f94233a01cdc8221633b7bb

Author: Alexis Berlemont alexis.berlem...@gmail.com
Date:   Fri Jun  4 00:09:04 2010 +0200

analogy: fix the buffer syscalls (ioctl + r/w) after buffer review (broken)

---

 ksrc/drivers/analogy/buffer.c |  173 +
 1 files changed, 73 insertions(+), 100 deletions(-)

diff --git a/ksrc/drivers/analogy/buffer.c b/ksrc/drivers/analogy/buffer.c
index 0ca1b4c..d3db892 100644
--- a/ksrc/drivers/analogy/buffer.c
+++ b/ksrc/drivers/analogy/buffer.c
@@ -506,6 +506,8 @@ int a4l_ioctl_cancel(a4l_cxt_t * cxt, void *arg)
 int a4l_ioctl_bufcfg(a4l_cxt_t * cxt, void *arg)
 {
a4l_dev_t *dev = a4l_get_dev(cxt);
+   a4l_buf_t *buf = cxt-buf;
+   a4l_subd_t *subd = buf-subd;
a4l_bufcfg_t buf_cfg;
 
/* As Linux API is used to allocate a virtual buffer,
@@ -525,17 +527,9 @@ int a4l_ioctl_bufcfg(a4l_cxt_t * cxt, void *arg)
 arg, sizeof(a4l_bufcfg_t)) != 0)
return -EFAULT;
 
-   /* Check the subdevice */
-   if (buf_cfg.idx_subd = dev-transfer.nb_subd) {
-   __a4l_err(a4l_ioctl_bufcfg: subdevice index 
- out of range (idx=%d)\n, buf_cfg.idx_subd);
-   return -EINVAL;
-   }
-
-   if ((dev-transfer.subds[buf_cfg.idx_subd]-flags  A4L_SUBD_CMD) == 0) 
{
-   __a4l_err(a4l_ioctl_bufcfg: operation not supported, 
- synchronous only subdevice\n);
-   return -EINVAL;
+   if (subd  a4l_subd_is_busy(subd)) {
+   __a4l_err(a4l_ioctl_bufcfg: acquisition in progress\n);
+   return -EBUSY;
}
 
if (buf_cfg.buf_size  A4L_BUF_MAXSIZE) {
@@ -543,34 +537,26 @@ int a4l_ioctl_bufcfg(a4l_cxt_t * cxt, void *arg)
return -EINVAL;
}
 
-   /* If a transfer is occuring or if the buffer is mmapped,
-  no buffer size change is allowed */
-   if (test_bit(A4L_TSF_BUSY,
-(dev-transfer.status[buf_cfg.idx_subd]))) {
-   __a4l_err(a4l_ioctl_bufcfg: acquisition in progress\n);
-   return -EBUSY;
-   }
-
-   if (test_bit(A4L_TSF_MMAP,
-(dev-transfer.status[buf_cfg.idx_subd]))) {
+   if (test_bit(A4L_BUF_MAP, buf-flags)) {
__a4l_err(a4l_ioctl_bufcfg: please unmap before 
  configuring buffer\n);
return -EPERM;
}
 
-   /* Performs the re-allocation */
-   a4l_free_buffer(dev-transfer.bufs[buf_cfg.idx_subd]);
+   /* Free the buffer... */
+   a4l_free_buffer(buf);
 
-   dev-transfer.bufs[buf_cfg.idx_subd]-size = buf_cfg.buf_size;
-
-   return a4l_alloc_buffer(dev-transfer.bufs[buf_cfg.idx_subd]);
+   /* ...to reallocate it */
+   return a4l_alloc_buffer(buf, buf_cfg.buf_size);
 }
 
 int a4l_ioctl_bufinfo(a4l_cxt_t * cxt, void *arg)
 {
a4l_dev_t *dev = a4l_get_dev(cxt);
+   a4l_buf_t *buf = cxt-buffer;
+   a4l_buf_t *subd = buf-subd;
a4l_bufinfo_t info;
-   a4l_buf_t *buf;
+
unsigned long tmp_cnt;
int ret;
 
@@ -587,32 +573,17 @@ int a4l_ioctl_bufinfo(a4l_cxt_t * cxt, void *arg)
 info, arg, sizeof(a4l_bufinfo_t)) != 0)
return -EFAULT;
 
-   /* Check the subdevice */
-   if (info.idx_subd = dev-transfer.nb_subd) {
-   __a4l_err(a4l_ioctl_bufinfo: subdevice index 
- out of range (idx=%d)\n, info.idx_subd);
-   return -EINVAL;
-   }
-
-   if ((dev-transfer.subds[info.idx_subd]-flags  A4L_SUBD_CMD) == 0) {
-   __a4l_err(a4l_ioctl_bufinfo: operation not supported, 
- synchronous only subdevice\n);
-   return -EINVAL;
-   }
-
-   buf = dev-transfer.bufs[info.idx_subd];
 
/* If a transfer is not occuring, simply return buffer
   informations, otherwise make the transfer progress */
-   if (!test_bit(A4L_TSF_BUSY,
-  (dev-transfer.status[info.idx_subd]))) {
+   if (!subd || !a4l_subd_is_busy(subd)) {
info.rw_count = 0;
goto a4l_ioctl_bufinfo_out;
}
 
ret = __handle_event(buf);
 
-   if (info.idx_subd == dev-transfer.idx_read_subd) {
+   if (a4l_subd_is_input(sudb)) {
 
/* Updates consume count if rw_count is not null */
if (info.rw_count != 0)
@@ -629,7 +600,7 @@ int a4l_ioctl_bufinfo(a4l_cxt_t * cxt, void *arg)
a4l_cancel_buffer(cxt);
return ret;
}
-   } else if (info.idx_subd == dev-transfer.idx_write_subd) {
+   } else if (a4l_subd_is_output(sudb)) {
 
if (ret  0) {
 

[Xenomai-git] Alexis Berlemont : analogy: fix the declaration of the structure a4l_context (broken)

2010-08-02 Thread GIT version control
Module: xenomai-head
Branch: master
Commit: 58ebd5b7efe0cc0ac1e82991d12125ce34dfeee3
URL:
http://git.xenomai.org/?p=xenomai-head.git;a=commit;h=58ebd5b7efe0cc0ac1e82991d12125ce34dfeee3

Author: Alexis Berlemont alexis.berlem...@gmail.com
Date:   Sun Jun  6 16:21:44 2010 +0200

analogy: fix the declaration of the structure a4l_context (broken)

In the structure a4l_context, replace the field buffer by a pointer to
the structure a4l_buffer (a4l_buf_t - a4l_buf_t *). That fixes a bug
in the headers dependencies.

---

 include/analogy/context.h |3 ++-
 ksrc/drivers/analogy/buffer.c |   12 ++--
 ksrc/drivers/analogy/rtdm_interface.c |   14 ++
 3 files changed, 18 insertions(+), 11 deletions(-)

diff --git a/include/analogy/context.h b/include/analogy/context.h
index 2442b6c..3e61697 100644
--- a/include/analogy/context.h
+++ b/include/analogy/context.h
@@ -42,8 +42,9 @@ struct a4l_device_context {
/* The buffer structure contains everything to transfer data
   from asynchronous acquisition operations on a specific
   subdevice */
-   struct buffer buffer; 
+   struct a4l_buffer *buffer; 
 };
+typedef struct a4l_device_context a4l_cxt_t;
 
 static inline int a4l_get_minor(a4l_cxt_t *cxt)
 {
diff --git a/ksrc/drivers/analogy/buffer.c b/ksrc/drivers/analogy/buffer.c
index d3db892..1b413cc 100644
--- a/ksrc/drivers/analogy/buffer.c
+++ b/ksrc/drivers/analogy/buffer.c
@@ -493,10 +493,10 @@ int a4l_ioctl_cancel(a4l_cxt_t * cxt, void *arg)
 
subd = dev-transfer.subds[idx_subd];

-   if (subd != cxt-buffer.subd) {
+   if (subd != cxt-buffer-subd) {
__a4l_err(a4l_ioctl_cancel: 
  current context works on another subdevice 
- (%d!=%d)\n, cxt-buffer.subd-idx, subd-idx);
+ (%d!=%d)\n, cxt-buffer-subd-idx, subd-idx);
return -EINVAL; 
}
 
@@ -658,7 +658,7 @@ a4l_ioctl_bufinfo_out:
 ssize_t a4l_read(a4l_cxt_t * cxt, void *bufdata, size_t nbytes)
 {
a4l_dev_t *dev = a4l_get_dev(cxt);
-   a4l_buf_t *buf = cxt-buffer;
+   a4l_buf_t *buf = cxt-buffer;
a4l_buf_t *subd = buf-subd;
ssize_t count = 0;
 
@@ -758,7 +758,7 @@ ssize_t a4l_write(a4l_cxt_t *cxt,
  const void *bufdata, size_t nbytes)
 {
a4l_dev_t *dev = a4l_get_dev(cxt);
-   a4l_buf_t *buf = cxt-buffer;
+   a4l_buf_t *buf = cxt-buffer;
a4l_subd_t *subd = buf-subd;
ssize_t count = 0;
 
@@ -849,7 +849,7 @@ int a4l_select(a4l_cxt_t *cxt,
   enum rtdm_selecttype type, unsigned fd_index)
 {
a4l_dev_t *dev = a4l_get_dev(cxt);
-   a4l_buf_t *buf = cxt-buffer;
+   a4l_buf_t *buf = cxt-buffer;
a4l_subd_t *subd = buf-subd;
 
/* Basic checkings */
@@ -894,7 +894,7 @@ int a4l_ioctl_poll(a4l_cxt_t * cxt, void *arg)
int ret = 0;
unsigned long tmp_cnt = 0;
a4l_dev_t *dev = a4l_get_dev(cxt);
-   a4l_buf_t *buf = cxt-buffer;
+   a4l_buf_t *buf = cxt-buffer;
a4l_buf_t *subd = buf-subd;
a4l_poll_t poll;
 
diff --git a/ksrc/drivers/analogy/rtdm_interface.c 
b/ksrc/drivers/analogy/rtdm_interface.c
index 6525425..8cfdf04 100644
--- a/ksrc/drivers/analogy/rtdm_interface.c
+++ b/ksrc/drivers/analogy/rtdm_interface.c
@@ -131,14 +131,15 @@ int a4l_open(struct rtdm_dev_context *context,
a4l_set_dev(cxt);
 
/* Initialize the buffer structure */
-   a4l_init_buffer(cxt-buffer);
+   cxt-buffer = rtdm_malloc(sizeof(a4l_buf_t));
+   a4l_init_buffer(cxt-buffer);
 
/* Allocate the asynchronous buffer 
   NOTE: it should be interesting to allocate the buffer only
   on demand especially if the system is short of memory
   NOTE2: the default buffer size could be configured via
   kernel config*/
-   a4l_alloc_buffer(cxt-buffer, A4L_DEFAULT_BFSIZE);
+   a4l_alloc_buffer(cxt-buffer, A4L_DEFAULT_BFSIZE);
 
return 0;
 }
@@ -149,15 +150,20 @@ int a4l_close(struct rtdm_dev_context *context, 
rtdm_user_info_t * user_info)
a4l_cxt_t *cxt = (a4l_cxt_t *)rtdm_context_to_private(context);
 
/* Cancel the maybe occuring asynchronous transfer */
-   err = a4l_cancel_buffer(cxt-buffer);
+   err = a4l_cancel_buffer(cxt-buffer);
if (err  0) {
__a4l_err(close: unable to stop the asynchronous transfer\n); 
return err;
}
 
/* Free the buffer which was linked with this context */
-   err = a4l_free_buffer(cxt-buffer);
+   err = a4l_free_buffer(cxt-buffer);
+   if (err  0)
+   goto out;
 
+   rtdm_free(cxt-buffer);
+
+out:
return err;
 }
 


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


[Xenomai-git] Alexis Berlemont : analogy: prettify some subdevice tests (broken)

2010-08-02 Thread GIT version control
Module: xenomai-head
Branch: master
Commit: 966d4516f3716a53fcbc4cd54cac9149a3800c3c
URL:
http://git.xenomai.org/?p=xenomai-head.git;a=commit;h=966d4516f3716a53fcbc4cd54cac9149a3800c3c

Author: Alexis Berlemont alexis.berlem...@gmail.com
Date:   Thu Jun 10 22:44:21 2010 +0200

analogy: prettify some subdevice tests (broken)

---

 include/analogy/subdevice.h |   14 +++---
 1 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/include/analogy/subdevice.h b/include/analogy/subdevice.h
index 0337092..8649c8a 100644
--- a/include/analogy/subdevice.h
+++ b/include/analogy/subdevice.h
@@ -277,21 +277,19 @@ typedef struct a4l_rng_info_arg a4l_rnginfo_arg_t;
 
 #ifdef __KERNEL__
 
-/* --- Subdevice related functions --- */
+/* --- Subdevice related functions and macros --- */
+
 a4l_chan_t *a4l_get_chfeat(a4l_subd_t * sb, int idx);
-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 a4l_check_chanlist(a4l_subd_t * subd,
   unsigned char nb_chan, unsigned int *chans);
 
-/* --- Upper layer functions --- */
-
 static inline int a4l_reserve_subd(a4l_subd_t *subd)
 {
 return test_and_set_bit(A4L_SUBD_BUSY, subd-status) ? -EBUSY : 0;
 }
-#define a4l_release_subd(x) clear_bit(A4L_SUBD_BUSY, (x)-status))
-#define a4l_subd_is_busy(x) test_bit(A4L_SUBD_BUSY, (x)-status))
+#define a4l_release_subd(x) clear_bit(A4L_SUBD_BUSY, ((x)-status))
+#define a4l_subd_is_busy(x) (test_bit(A4L_SUBD_BUSY, ((x)-status)))
 
 #define a4l_subd_is_input(x) ((A4L_SUBD_MASK_READ  (x)-flags) != 0)
 /* The following macro considers that a DIO subdevice is firstly an
@@ -300,6 +298,8 @@ static inline int a4l_reserve_subd(a4l_subd_t *subd)
((A4L_SUBD_MASK_WRITE  (x)-flags) != 0 || \
 (A4L_SUBD_DIO  (x)-flags) != 0)
 
+/* --- Upper layer functions --- */
+
 a4l_subd_t * a4l_get_subd(struct a4l_device *dev, int idx);
 a4l_subd_t * a4l_alloc_subd(int sizeof_priv,
void (*setup)(a4l_subd_t *));


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


[Xenomai-git] Alexis Berlemont : analogy: fix a missing setting of the buf field in subdevice (broken)

2010-08-02 Thread GIT version control
Module: xenomai-head
Branch: master
Commit: 96a2611d16cca49a87d5a5bb9d36cd82e741b78a
URL:
http://git.xenomai.org/?p=xenomai-head.git;a=commit;h=96a2611d16cca49a87d5a5bb9d36cd82e741b78a

Author: Alexis Berlemont alexis.berlem...@gmail.com
Date:   Sat Jun 12 01:34:12 2010 +0200

analogy: fix a missing setting of the buf field in subdevice (broken)

---

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

diff --git a/ksrc/drivers/analogy/buffer.c b/ksrc/drivers/analogy/buffer.c
index a72b4ad..1134b8e 100644
--- a/ksrc/drivers/analogy/buffer.c
+++ b/ksrc/drivers/analogy/buffer.c
@@ -124,6 +124,12 @@ int a4l_setup_buffer(a4l_cxt_t *cxt, a4l_cmd_t *cmd)
return -EINVAL;
}
 
+   if (a4l_reserve_subd(buf_desc-subd)  0) {
+   __a4l_err(a4l_setup_buffer: subdevice %d already busy\n,
+ cmd-idx_subd);
+   return -EBUSY;
+   }
+
/* Checks if the transfer system has to work in bulk mode */
if (cmd-flags  A4L_CMD_BULK)
set_bit(A4L_BUF_BULK_NR, buf_desc-flags);
@@ -131,6 +137,9 @@ int a4l_setup_buffer(a4l_cxt_t *cxt, a4l_cmd_t *cmd)
/* Sets the working command */
buf_desc-cur_cmd = cmd;
 
+   /* Link the subdevice with the context's buffer */
+   buf_desc-subd-buf = buf_desc;
+
/* Computes the count to reach, if need be */
if (cmd-stop_src == TRIG_COUNT) {
for (i = 0; i  cmd-nb_chan; i++) {
@@ -167,9 +176,6 @@ int a4l_cancel_buffer(a4l_cxt_t *cxt)
__a4l_err(a4l_cancel: cancel handler failed (err=%d)\n, err);
}
 
-   a4l_release_subd(subd);
-   subd-buf = NULL;
-
if (buf_desc-cur_cmd != NULL) {
a4l_free_cmddesc(buf_desc-cur_cmd);
rtdm_free(buf_desc-cur_cmd);
@@ -178,6 +184,9 @@ int a4l_cancel_buffer(a4l_cxt_t *cxt)
 
a4l_init_buffer(buf_desc);
 
+   a4l_release_subd(subd);
+   subd-buf = NULL;
+
return err;
 }
 
diff --git a/ksrc/drivers/analogy/command.c b/ksrc/drivers/analogy/command.c
index 51aad35..da89c9a 100644
--- a/ksrc/drivers/analogy/command.c
+++ b/ksrc/drivers/analogy/command.c
@@ -354,14 +354,11 @@ int a4l_ioctl_cmd(a4l_cxt_t * cxt, void *arg)
goto out_ioctl_cmd;
}
 
-   /* Sets the concerned subdevice as busy */
-   ret = a4l_reserve_subd(subd);
+   /* Gets the transfer system ready */
+   ret = a4l_setup_buffer(cxt, cmd_desc);
if (ret  0)
goto out_ioctl_cmd;
 
-   /* Gets the transfer system ready */
-   a4l_setup_buffer(cxt, cmd_desc);
-
/* Eventually launches the command */
ret = subd-do_cmd(subd, cmd_desc);



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


[Xenomai-git] Alexis Berlemont : analogy: fix the last compilation problems

2010-08-02 Thread GIT version control
Module: xenomai-head
Branch: master
Commit: 957779281f73c60d68e6d9895c2fa3876795db0e
URL:
http://git.xenomai.org/?p=xenomai-head.git;a=commit;h=957779281f73c60d68e6d9895c2fa3876795db0e

Author: Alexis Berlemont alexis.berlem...@gmail.com
Date:   Fri Jun 11 00:01:01 2010 +0200

analogy: fix the last compilation problems

---

 include/analogy/buffer.h  |   22 --
 include/analogy/subdevice.h   |6 +++---
 ksrc/drivers/analogy/buffer.c |   25 -
 ksrc/drivers/analogy/rtdm_interface.c |   13 +
 ksrc/drivers/analogy/transfer.c   |3 +--
 5 files changed, 33 insertions(+), 36 deletions(-)

diff --git a/include/analogy/buffer.h b/include/analogy/buffer.h
index 4bd5db0..148c07f 100644
--- a/include/analogy/buffer.h
+++ b/include/analogy/buffer.h
@@ -35,20 +35,23 @@
 #include analogy/os_facilities.h
 #include analogy/context.h
 
-/* Events bits */
+/* --- Events bits / flags --- */
+
 #define A4L_BUF_EOBUF_NR 0
-#define A4L_BUF_ERROR_NR 1
-#define A4L_BUF_EOA_NR 2
-/* Events flags */
 #define A4L_BUF_EOBUF (1  A4L_BUF_EOBUF_NR)
+
+#define A4L_BUF_ERROR_NR 1
 #define A4L_BUF_ERROR (1  A4L_BUF_ERROR_NR)
+
+#define A4L_BUF_EOA_NR 2
 #define A4L_BUF_EOA (1  A4L_BUF_EOA_NR)
 
-/* Status bits */
+/* --- Status bits / flags --- */
+
 #define A4L_BUF_BULK_NR 8
-#define A4L_BUF_MAP_NR 9
-/* Status flags */
 #define A4L_BUF_BULK (1  A4L_BUF_BULK_NR)
+
+#define A4L_BUF_MAP_NR 9
 #define A4L_BUF_MAP (1  A4L_BUF_MAP_NR)
 
 struct a4l_subdevice;
@@ -391,9 +394,8 @@ int a4l_ioctl_mmap(a4l_cxt_t * cxt, void *arg);
 int a4l_ioctl_bufcfg(a4l_cxt_t * cxt, void *arg);
 int a4l_ioctl_bufinfo(a4l_cxt_t * cxt, void *arg);
 int a4l_ioctl_poll(a4l_cxt_t * cxt, void *arg);
-ssize_t a4l_read(a4l_cxt_t * cxt, void *bufdata, size_t nbytes);
-ssize_t a4l_write(a4l_cxt_t * cxt, 
- const void *bufdata, size_t nbytes);
+ssize_t a4l_read_buffer(a4l_cxt_t * cxt, void *bufdata, size_t nbytes);
+ssize_t a4l_write_buffer(a4l_cxt_t * cxt, const void *bufdata, size_t nbytes);
 int a4l_select(a4l_cxt_t *cxt, 
   rtdm_selector_t *selector,
   enum rtdm_selecttype type, unsigned fd_index);
diff --git a/include/analogy/subdevice.h b/include/analogy/subdevice.h
index 8649c8a..4223748 100644
--- a/include/analogy/subdevice.h
+++ b/include/analogy/subdevice.h
@@ -286,10 +286,10 @@ int a4l_check_chanlist(a4l_subd_t * subd,
 
 static inline int a4l_reserve_subd(a4l_subd_t *subd)
 {
-return test_and_set_bit(A4L_SUBD_BUSY, subd-status) ? -EBUSY : 0;
+return test_and_set_bit(A4L_SUBD_BUSY_NR, subd-status) ? -EBUSY : 0;
 }
-#define a4l_release_subd(x) clear_bit(A4L_SUBD_BUSY, ((x)-status))
-#define a4l_subd_is_busy(x) (test_bit(A4L_SUBD_BUSY, ((x)-status)))
+#define a4l_release_subd(x) clear_bit(A4L_SUBD_BUSY_NR, ((x)-flags))
+#define a4l_subd_is_busy(x) (test_bit(A4L_SUBD_BUSY_NR, ((x)-flags)))
 
 #define a4l_subd_is_input(x) ((A4L_SUBD_MASK_READ  (x)-flags) != 0)
 /* The following macro considers that a DIO subdevice is firstly an
diff --git a/ksrc/drivers/analogy/buffer.c b/ksrc/drivers/analogy/buffer.c
index ac1abce..a72b4ad 100644
--- a/ksrc/drivers/analogy/buffer.c
+++ b/ksrc/drivers/analogy/buffer.c
@@ -436,13 +436,13 @@ unsigned long a4l_buf_count(a4l_subd_t *subd)
 void a4l_map(struct vm_area_struct *area)
 {
unsigned long *status = (unsigned long *)area-vm_private_data;
-   set_bit(A4L_TSF_MMAP, status);
+   set_bit(A4L_BUF_MAP_NR, status);
 }
 
 void a4l_unmap(struct vm_area_struct *area)
 {
unsigned long *status = (unsigned long *)area-vm_private_data;
-   clear_bit(A4L_TSF_MMAP, status);
+   clear_bit(A4L_BUF_MAP_NR, status);
 }
 
 static struct vm_operations_struct a4l_vm_ops = {
@@ -454,6 +454,7 @@ int a4l_ioctl_mmap(a4l_cxt_t *cxt, void *arg)
 {
a4l_mmap_t map_cfg;
a4l_dev_t *dev;
+   a4l_buf_t *buf;
int ret;
 
/* The mmap operation cannot be performed in a 
@@ -463,6 +464,7 @@ int a4l_ioctl_mmap(a4l_cxt_t *cxt, void *arg)
}
 
dev = a4l_get_dev(cxt);
+   buf = cxt-buffer;
 
/* Basic checkings */
 
@@ -487,12 +489,10 @@ int a4l_ioctl_mmap(a4l_cxt_t *cxt, void *arg)
 
/* All the magic is here */
ret = rtdm_mmap_to_user(cxt-user_info,
-   dev-transfer.bufs[map_cfg.idx_subd]-buf,
+   buf-buf,
map_cfg.size,
PROT_READ | PROT_WRITE,
-   map_cfg.ptr,
-   a4l_vm_ops,
-   (dev-transfer.status[map_cfg.idx_subd]));
+   map_cfg.ptr, a4l_vm_ops, buf-flags);
 
if (ret  0) {
__a4l_err(a4l_ioctl_mmap: internal error, 
@@ -545,7 +545,7 @@ int a4l_ioctl_cancel(a4l_cxt_t * cxt, void *arg)
 int a4l_ioctl_bufcfg(a4l_cxt_t * cxt, void *arg)
 {
a4l_dev_t 

[Xenomai-git] Alexis Berlemont : analogy: fix compilation issues and review the mmap ioctl handler (broken)

2010-08-02 Thread GIT version control
Module: xenomai-head
Branch: master
Commit: c8f4e5434c2310d870ceb8f53cf74c73c0610762
URL:
http://git.xenomai.org/?p=xenomai-head.git;a=commit;h=c8f4e5434c2310d870ceb8f53cf74c73c0610762

Author: Alexis Berlemont alexis.berlem...@gmail.com
Date:   Thu Jun 10 22:35:06 2010 +0200

analogy: fix compilation issues and review the mmap ioctl handler (broken)

---

 ksrc/drivers/analogy/buffer.c |  200 -
 1 files changed, 119 insertions(+), 81 deletions(-)

diff --git a/ksrc/drivers/analogy/buffer.c b/ksrc/drivers/analogy/buffer.c
index 1b413cc..0826a93 100644
--- a/ksrc/drivers/analogy/buffer.c
+++ b/ksrc/drivers/analogy/buffer.c
@@ -121,7 +121,7 @@ int a4l_setup_buffer(a4l_cxt_t *cxt, a4l_cmd_t *cmd)
if (buf_desc-subd == NULL) {
__a4l_err(a4l_setup_buffer: subdevice index 
  out of range (%d)\n, cmd-idx_subd);
-   goto -EINVAL;
+   return -EINVAL;
}
 
/* Checks if the transfer system has to work in bulk mode */
@@ -155,7 +155,7 @@ int a4l_cancel_buffer(a4l_cxt_t *cxt)

int err = 0;

-   if (!subd || !a4l_check_subd(subd))
+   if (!subd || !a4l_subd_is_busy(subd))
return 0;
 
/* If a cancel function is registered, call it
@@ -164,12 +164,11 @@ int a4l_cancel_buffer(a4l_cxt_t *cxt)
   the cancel function can be used as as to (re)initialize 
   some component) */
if (subd-cancel != NULL  (err = subd-cancel(subd))  0) {
-   __a4l_err(a4l_cancel: 
- subdevice %d cancel handler failed (err=%d)\n,
- idx_subd, err);
+   __a4l_err(a4l_cancel: cancel handler failed (err=%d)\n, err);
}
 
a4l_release_subd(subd);
+   subd-buf = NULL;
 
if (buf_desc-cur_cmd != NULL) {
a4l_free_cmddesc(buf_desc-cur_cmd);
@@ -208,7 +207,7 @@ int a4l_get_chan(a4l_subd_t *subd)
/* Translation bits - bytes */
tmp_size /= 8;
 
-   tmp_count = dev-transfer.bufs[subd-idx]-mng_count % tmp_size;
+   tmp_count = subd-buf-mng_count % tmp_size;
 
/* Translation bytes - bits */
tmp_count *= 8;
@@ -231,116 +230,174 @@ int a4l_get_chan(a4l_subd_t *subd)
 
 int a4l_buf_prepare_absput(a4l_subd_t *subd, unsigned long count)
 {
-   if ((subd-flags  A4L_SUBD_MASK_READ) == 0 || !subd-buf)
+   a4l_buf_t *buf = subd-buf;
+
+   if (!buf || !a4l_subd_is_busy(subd))
+   return -ENOENT;
+
+   if (!a4l_subd_is_input(subd))
return -EINVAL;
 
-   return __pre_abs_put(subd-buf, count);
+   return __pre_abs_put(buf, count);
 }
 
 
 int a4l_buf_commit_absput(a4l_subd_t *subd, unsigned long count)
 {
-   if ((subd-flags  A4L_SUBD_MASK_READ) == 0 || !subd-buf)
+   a4l_buf_t *buf = subd-buf;
+
+   if (!buf || !a4l_subd_is_busy(subd))
+   return -ENOENT;
+
+   if (!a4l_subd_is_input(subd))
return -EINVAL;
 
-   return __abs_put(subd-buf, count);
+   return __abs_put(buf, count);
 }
 
 int a4l_buf_prepare_put(a4l_subd_t *subd, unsigned long count)
 {
-   if ((subd-flags  A4L_SUBD_MASK_READ) == 0 || !subd-buf)
+   a4l_buf_t *buf = subd-buf;
+
+   if (!buf || !a4l_subd_is_busy(subd))
+   return -ENOENT;
+
+   if (!a4l_subd_is_input(subd))
return -EINVAL;
 
-   return __pre_put(subd-buf, count);
+   return __pre_put(buf, count);
 }
 
 int a4l_buf_commit_put(a4l_subd_t *subd, unsigned long count)
 {
-   if ((subd-flags  A4L_SUBD_MASK_READ) == 0 || !subd-buf)
+   a4l_buf_t *buf = subd-buf;
+
+   if (!buf || !a4l_subd_is_busy(subd))
+   return -ENOENT;
+
+   if (!a4l_subd_is_input(subd))
return -EINVAL;
 
-   return __put(subd-buf, count); 
+   return __put(buf, count);   
 }
 
 int a4l_buf_put(a4l_subd_t *subd, void *bufdata, unsigned long count)
 {
+   a4l_buf_t *buf = subd-buf;
int err;
 
-   if ((subd-flags  A4L_SUBD_MASK_READ) == 0 || !subd-buf)
+   if (!buf || !a4l_subd_is_busy(subd))
+   return -ENOENT;
+
+   if (!a4l_subd_is_input(subd))
return -EINVAL;

-   if (__count_to_put(subd-buf)  count)
+   if (__count_to_put(buf)  count)
return -EAGAIN;
 
-   err = __produce(NULL, subd-buf, bufdata, count);
+   err = __produce(NULL, buf, bufdata, count);
if (err  0)
return err; 
 
-   err = __put(subd-buf, count);
+   err = __put(buf, count);
 
return err;
 }
 
 int a4l_buf_prepare_absget(a4l_subd_t *subd, unsigned long count)
 {
-   if ((subd-flags  A4L_SUBD_MASK_WRITE) == 0 || !subd-buf)
+   a4l_buf_t *buf = subd-buf;
+
+   if (!buf || !a4l_subd_is_busy(subd))
+   return -ENOENT;
+
+   if (!a4l_subd_is_output(subd))
return -EINVAL;
 
- 

[Xenomai-git] Alexis Berlemont : analogy: fix the subdevice status management

2010-08-02 Thread GIT version control
Module: xenomai-head
Branch: master
Commit: 32ac40ae6991c01d8ffeb1da789cb68127635b1e
URL:
http://git.xenomai.org/?p=xenomai-head.git;a=commit;h=32ac40ae6991c01d8ffeb1da789cb68127635b1e

Author: Alexis Berlemont alexis.berlem...@gmail.com
Date:   Sun Jun 13 00:39:13 2010 +0200

analogy: fix the subdevice status management

---

 include/analogy/subdevice.h |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/analogy/subdevice.h b/include/analogy/subdevice.h
index 4223748..5be036b 100644
--- a/include/analogy/subdevice.h
+++ b/include/analogy/subdevice.h
@@ -288,8 +288,8 @@ static inline int a4l_reserve_subd(a4l_subd_t *subd)
 {
 return test_and_set_bit(A4L_SUBD_BUSY_NR, subd-status) ? -EBUSY : 0;
 }
-#define a4l_release_subd(x) clear_bit(A4L_SUBD_BUSY_NR, ((x)-flags))
-#define a4l_subd_is_busy(x) (test_bit(A4L_SUBD_BUSY_NR, ((x)-flags)))
+#define a4l_release_subd(x) clear_bit(A4L_SUBD_BUSY_NR, ((x)-status))
+#define a4l_subd_is_busy(x) (test_bit(A4L_SUBD_BUSY_NR, ((x)-status)))
 
 #define a4l_subd_is_input(x) ((A4L_SUBD_MASK_READ  (x)-flags) != 0)
 /* The following macro considers that a DIO subdevice is firstly an


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


[Xenomai-git] Alexis Berlemont : analogy: fix test of subdevice status in a4l_write

2010-08-02 Thread GIT version control
Module: xenomai-head
Branch: master
Commit: 7b3d7424fd130f7daef6311f657d06caf246d327
URL:
http://git.xenomai.org/?p=xenomai-head.git;a=commit;h=7b3d7424fd130f7daef6311f657d06caf246d327

Author: Alexis Berlemont alexis.berlem...@gmail.com
Date:   Wed Jun 16 00:35:03 2010 +0200

analogy: fix test of subdevice status in a4l_write

---

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

diff --git a/ksrc/drivers/analogy/buffer.c b/ksrc/drivers/analogy/buffer.c
index 04922be..12b8b9b 100644
--- a/ksrc/drivers/analogy/buffer.c
+++ b/ksrc/drivers/analogy/buffer.c
@@ -828,7 +828,7 @@ ssize_t a4l_write_buffer(a4l_cxt_t *cxt, const void 
*bufdata, size_t nbytes)
return -EINVAL;
}
 
-   if (!subd || !test_bit(A4L_SUBD_BUSY, subd-status)) {
+   if (!subd || !a4l_subd_is_busy(subd)) {
__a4l_err(a4l_write: idle subdevice on this context\n);
return -ENOENT;
}


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


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

2010-08-02 Thread GIT version control
Module: xenomai-head
Branch: master
Commit: fd94953ecc91fde7ec1e9bf1605bd6b209bbfd73
URL:
http://git.xenomai.org/?p=xenomai-head.git;a=commit;h=fd94953ecc91fde7ec1e9bf1605bd6b209bbfd73

Author: Alexis Berlemont alexis.berlem...@gmail.com
Date:   Sat Jun 19 00:33:01 2010 +0200

analogy: [fake - loop] remove volatile keywords

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

---

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

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

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

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

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


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


[Xenomai-git] Alexis Berlemont : analogy: fix buffer initialization/cleanup calls at open /close times

2010-08-02 Thread GIT version control
Module: xenomai-head
Branch: master
Commit: 71b31cfcfd305af88130ffae71714af89eec61a2
URL:
http://git.xenomai.org/?p=xenomai-head.git;a=commit;h=71b31cfcfd305af88130ffae71714af89eec61a2

Author: Alexis Berlemont alexis.berlem...@gmail.com
Date:   Sun Jun 13 00:42:00 2010 +0200

analogy: fix buffer initialization/cleanup calls at open/close times

---

 include/analogy/buffer.h  |2 ++
 ksrc/drivers/analogy/buffer.c |   16 ++--
 ksrc/drivers/analogy/rtdm_interface.c |6 +-
 3 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/include/analogy/buffer.h b/include/analogy/buffer.h
index 148c07f..9e5ae8a 100644
--- a/include/analogy/buffer.h
+++ b/include/analogy/buffer.h
@@ -339,6 +339,8 @@ void a4l_free_buffer(a4l_buf_t *buf_desc);
 
 void a4l_init_buffer(a4l_buf_t * buf_desc);
 
+void a4l_cleanup_buffer(a4l_buf_t * buf_desc);
+
 int a4l_setup_buffer(a4l_cxt_t *cxt, a4l_cmd_t *cmd);
 
 int a4l_cancel_buffer(a4l_cxt_t *cxt);
diff --git a/ksrc/drivers/analogy/buffer.c b/ksrc/drivers/analogy/buffer.c
index 1134b8e..04922be 100644
--- a/ksrc/drivers/analogy/buffer.c
+++ b/ksrc/drivers/analogy/buffer.c
@@ -91,7 +91,7 @@ out_virt_contig_alloc:
return ret;
 }
 
-void a4l_init_buffer(a4l_buf_t *buf_desc)
+static void a4l_reinit_buffer(a4l_buf_t *buf_desc)
 {
/* No command to process yet */
buf_desc-cur_cmd = NULL;
@@ -111,6 +111,18 @@ void a4l_init_buffer(a4l_buf_t *buf_desc)
a4l_flush_sync(buf_desc-sync);
 }
 
+void a4l_init_buffer(a4l_buf_t *buf_desc)
+{
+
+   a4l_init_sync(buf_desc-sync);
+   a4l_reinit_buffer(buf_desc);
+}
+
+void a4l_cleanup_buffer(a4l_buf_t *buf_desc)
+{
+   a4l_cleanup_sync(buf_desc-sync);
+}
+
 int a4l_setup_buffer(a4l_cxt_t *cxt, a4l_cmd_t *cmd)
 {
a4l_buf_t *buf_desc = cxt-buffer;
@@ -182,7 +194,7 @@ int a4l_cancel_buffer(a4l_cxt_t *cxt)
buf_desc-cur_cmd = NULL;
}
 
-   a4l_init_buffer(buf_desc);
+   a4l_reinit_buffer(buf_desc);
 
a4l_release_subd(subd);
subd-buf = NULL;
diff --git a/ksrc/drivers/analogy/rtdm_interface.c 
b/ksrc/drivers/analogy/rtdm_interface.c
index 4eaada0..65acc86 100644
--- a/ksrc/drivers/analogy/rtdm_interface.c
+++ b/ksrc/drivers/analogy/rtdm_interface.c
@@ -156,9 +156,13 @@ int a4l_close(struct rtdm_dev_context *context, 
rtdm_user_info_t * user_info)
return err;
}
 
-   /* Free the buffer which was linked with this context */
+   /* Free the buffer which was linked with this context and... */
a4l_free_buffer(cxt-buffer);
 
+   /* ...free the other buffer resources (sync) and... */
+   a4l_cleanup_buffer(cxt-buffer);
+
+   /* ...free the structure */
rtdm_free(cxt-buffer);
 
return 0;


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


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

2010-08-02 Thread GIT version control
Module: xenomai-head
Branch: master
Commit: 129ae85977bbf4c9dbcdeab055ee3a406b11bf3b
URL:
http://git.xenomai.org/?p=xenomai-head.git;a=commit;h=129ae85977bbf4c9dbcdeab055ee3a406b11bf3b

Author: Alexis Berlemont alexis.berlem...@gmail.com
Date:   Sat Jun 19 00:39:42 2010 +0200

analogy: add a detail in a4l_close doxygen doc

---

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

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


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


[Xenomai-git] Alexis Berlemont : analogy: [loop] add a debug trace when trigger is called

2010-08-02 Thread GIT version control
Module: xenomai-head
Branch: master
Commit: f3b62df756e1eff269796de4e90b0032adf03e59
URL:
http://git.xenomai.org/?p=xenomai-head.git;a=commit;h=f3b62df756e1eff269796de4e90b0032adf03e59

Author: Alexis Berlemont alexis.berlem...@gmail.com
Date:   Wed Jun 16 00:34:20 2010 +0200

analogy: [loop] add a debug trace when trigger is called

---

 ksrc/drivers/analogy/testing/loop.c |3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/ksrc/drivers/analogy/testing/loop.c 
b/ksrc/drivers/analogy/testing/loop.c
index f73ad09..72748d8 100644
--- a/ksrc/drivers/analogy/testing/loop.c
+++ b/ksrc/drivers/analogy/testing/loop.c
@@ -124,6 +124,9 @@ int loop_cmd(a4l_subd_t *subd, a4l_cmd_t *cmd)
 int loop_trigger(a4l_subd_t *subd, lsampl_t trignum)
 {
lpprv_t *priv = (lpprv_t *)subd-dev-priv;
+
+   a4l_info(subd-dev, loop_trigger: (subd=%d)\n, subd-idx);  
+
priv-loop_running = 1;
return 0;
 }


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


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

2010-08-02 Thread GIT version control
Module: xenomai-head
Branch: master
Commit: 615c874b584149bfb230b2ae57fec36040b69c17
URL:
http://git.xenomai.org/?p=xenomai-head.git;a=commit;h=615c874b584149bfb230b2ae57fec36040b69c17

Author: Alexis Berlemont alexis.berlem...@gmail.com
Date:   Sat Jun 19 00:45:16 2010 +0200

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

---

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

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


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


[Xenomai-git] Alexis Berlemont : analogy: [ni_pcimio] really minor changes

2010-08-02 Thread GIT version control
Module: xenomai-head
Branch: master
Commit: 0de5f272ff9ae900efce328539b2c7bc9f1968ac
URL:
http://git.xenomai.org/?p=xenomai-head.git;a=commit;h=0de5f272ff9ae900efce328539b2c7bc9f1968ac

Author: Alexis Berlemont alexis.berlem...@gmail.com
Date:   Mon Jun 21 00:36:44 2010 +0200

analogy: [ni_pcimio] really minor changes

---

 .../analogy/national_instruments/mio_common.c  |5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/ksrc/drivers/analogy/national_instruments/mio_common.c 
b/ksrc/drivers/analogy/national_instruments/mio_common.c
index ead64b8..de1c570 100644
--- a/ksrc/drivers/analogy/national_instruments/mio_common.c
+++ b/ksrc/drivers/analogy/national_instruments/mio_common.c
@@ -3413,6 +3413,7 @@ int ni_cdio_cmd(a4l_subd_t *subd, a4l_cmd_t *cmd)
if (cmd-scan_begin_arg  CR_INVERT)
cdo_mode_bits |= CDO_Polarity_Bit;
ni_writel(cdo_mode_bits, M_Offset_CDO_Mode);
+
if (devpriv-io_bits) {
ni_writel(devpriv-dio_state, M_Offset_CDO_FIFO_Data);
ni_writel(CDO_SW_Update_Bit, M_Offset_CDIO_Command);
@@ -3423,10 +3424,10 @@ int ni_cdio_cmd(a4l_subd_t *subd, a4l_cmd_t *cmd)
output command with no lines configured as outputs);
return -EIO;
}
+
retval = ni_request_cdo_mite_channel(dev);
-   if (retval  0) {
+   if (retval  0)
return retval;
-   }

return 0;
 }


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


[Xenomai-git] Alexis Berlemont : analogy: [ni_pcimio] add the missing allocation of the digital ring

2010-08-02 Thread GIT version control
Module: xenomai-head
Branch: master
Commit: b95be3691aa0c0525df0110e60bd434e3132f384
URL:
http://git.xenomai.org/?p=xenomai-head.git;a=commit;h=b95be3691aa0c0525df0110e60bd434e3132f384

Author: Alexis Berlemont alexis.berlem...@gmail.com
Date:   Mon Jun 21 00:37:54 2010 +0200

analogy: [ni_pcimio] add the missing allocation of the digital ring

---

 ksrc/drivers/analogy/national_instruments/pcimio.c |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/ksrc/drivers/analogy/national_instruments/pcimio.c 
b/ksrc/drivers/analogy/national_instruments/pcimio.c
index 2df47a7..7e2e87e 100644
--- a/ksrc/drivers/analogy/national_instruments/pcimio.c
+++ b/ksrc/drivers/analogy/national_instruments/pcimio.c
@@ -1497,11 +1497,13 @@ static int pcimio_attach(a4l_dev_t *dev, a4l_lnkdesc_t 
*arg)
 
devpriv-ai_mite_ring = mite_alloc_ring(mite);
devpriv-ao_mite_ring = mite_alloc_ring(mite);
+   devpriv-cdo_mite_ring = mite_alloc_ring(mite);
devpriv-gpct_mite_ring[0] = mite_alloc_ring(mite);
devpriv-gpct_mite_ring[1] = mite_alloc_ring(mite);
 
if(devpriv-ai_mite_ring == NULL ||
   devpriv-ao_mite_ring == NULL ||
+  devpriv-cdo_mite_ring == NULL ||
   devpriv-gpct_mite_ring[0] == NULL ||
   devpriv-gpct_mite_ring[1] == NULL)
return -ENOMEM;


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


[Xenomai-git] Alexis Berlemont : analogy: remove a4l_subd_is_busy calls in analogy core

2010-08-02 Thread GIT version control
Module: xenomai-head
Branch: master
Commit: 66b3928db8b1736b350c351fcfe6ae5525e19e78
URL:
http://git.xenomai.org/?p=xenomai-head.git;a=commit;h=66b3928db8b1736b350c351fcfe6ae5525e19e78

Author: Alexis Berlemont alexis.berlem...@gmail.com
Date:   Wed Jun 23 21:01:46 2010 +0200

analogy: remove a4l_subd_is_busy calls in analogy core

---

 ksrc/drivers/analogy/buffer.c |   42 
 1 files changed, 21 insertions(+), 21 deletions(-)

diff --git a/ksrc/drivers/analogy/buffer.c b/ksrc/drivers/analogy/buffer.c
index 12b8b9b..b8b01d3 100644
--- a/ksrc/drivers/analogy/buffer.c
+++ b/ksrc/drivers/analogy/buffer.c
@@ -175,8 +175,8 @@ int a4l_cancel_buffer(a4l_cxt_t *cxt)
a4l_subd_t *subd = buf_desc-subd;

int err = 0;
-   
-   if (!subd || !a4l_subd_is_busy(subd))
+
+   if (!subd || !test_bit(A4L_SUBD_BUSY_NR, subd-status))
return 0;
 
/* If a cancel function is registered, call it
@@ -253,7 +253,7 @@ int a4l_buf_prepare_absput(a4l_subd_t *subd, unsigned long 
count)
 {
a4l_buf_t *buf = subd-buf;
 
-   if (!buf || !a4l_subd_is_busy(subd))
+   if (!buf || !test_bit(A4L_SUBD_BUSY_NR, subd-status))
return -ENOENT;
 
if (!a4l_subd_is_input(subd))
@@ -267,7 +267,7 @@ int a4l_buf_commit_absput(a4l_subd_t *subd, unsigned long 
count)
 {
a4l_buf_t *buf = subd-buf;
 
-   if (!buf || !a4l_subd_is_busy(subd))
+   if (!buf || !test_bit(A4L_SUBD_BUSY_NR, subd-status))
return -ENOENT;
 
if (!a4l_subd_is_input(subd))
@@ -280,7 +280,7 @@ int a4l_buf_prepare_put(a4l_subd_t *subd, unsigned long 
count)
 {
a4l_buf_t *buf = subd-buf;
 
-   if (!buf || !a4l_subd_is_busy(subd))
+   if (!buf || !test_bit(A4L_SUBD_BUSY_NR, subd-status))
return -ENOENT;
 
if (!a4l_subd_is_input(subd))
@@ -293,7 +293,7 @@ int a4l_buf_commit_put(a4l_subd_t *subd, unsigned long 
count)
 {
a4l_buf_t *buf = subd-buf;
 
-   if (!buf || !a4l_subd_is_busy(subd))
+   if (!buf || !test_bit(A4L_SUBD_BUSY_NR, subd-status))
return -ENOENT;
 
if (!a4l_subd_is_input(subd))
@@ -307,7 +307,7 @@ int a4l_buf_put(a4l_subd_t *subd, void *bufdata, unsigned 
long count)
a4l_buf_t *buf = subd-buf;
int err;
 
-   if (!buf || !a4l_subd_is_busy(subd))
+   if (!buf || !test_bit(A4L_SUBD_BUSY_NR, subd-status))
return -ENOENT;
 
if (!a4l_subd_is_input(subd))
@@ -329,7 +329,7 @@ int a4l_buf_prepare_absget(a4l_subd_t *subd, unsigned long 
count)
 {
a4l_buf_t *buf = subd-buf;
 
-   if (!buf || !a4l_subd_is_busy(subd))
+   if (!buf || !test_bit(A4L_SUBD_BUSY_NR, subd-status))
return -ENOENT;
 
if (!a4l_subd_is_output(subd))
@@ -342,7 +342,7 @@ int a4l_buf_commit_absget(a4l_subd_t *subd, unsigned long 
count)
 {
a4l_buf_t *buf = subd-buf;
 
-   if (!buf || !a4l_subd_is_busy(subd))
+   if (!buf || !test_bit(A4L_SUBD_BUSY_NR, subd-status))
return -ENOENT;
 
if (!a4l_subd_is_output(subd))
@@ -355,7 +355,7 @@ int a4l_buf_prepare_get(a4l_subd_t *subd, unsigned long 
count)
 {
a4l_buf_t *buf = subd-buf;
 
-   if (!buf || !a4l_subd_is_busy(subd))
+   if (!buf || !test_bit(A4L_SUBD_BUSY_NR, subd-status))
return -ENOENT;
 
if (!a4l_subd_is_output(subd))
@@ -370,7 +370,7 @@ int a4l_buf_commit_get(a4l_subd_t *subd, unsigned long 
count)
 
/* Basic checkings */
 
-   if (!buf || !a4l_subd_is_busy(subd))
+   if (!buf || !test_bit(A4L_SUBD_BUSY_NR, subd-status))
return -ENOENT;
 
if (!a4l_subd_is_output(subd))
@@ -386,12 +386,12 @@ int a4l_buf_get(a4l_subd_t *subd, void *bufdata, unsigned 
long count)
 
/* Basic checkings */
 
+   if (!buf || !test_bit(A4L_SUBD_BUSY_NR, subd-status))
+   return -ENOENT;
+
if (!a4l_subd_is_output(subd))
return -EINVAL;
 
-   if (!buf || !a4l_subd_is_busy(subd))
-   return -ENOENT;
-
if (__count_to_get(buf)  count)
return -EAGAIN;
 
@@ -418,7 +418,7 @@ int a4l_buf_evt(a4l_subd_t *subd, unsigned long evts)
   race conditions, not the framework */
 
/* Basic checking */
-   if (!buf || !a4l_subd_is_busy(subd))
+   if (!buf || !test_bit(A4L_SUBD_BUSY_NR, subd-status))
return -ENOENT;
 
/* Even if it is a little more complex,
@@ -441,7 +441,7 @@ unsigned long a4l_buf_count(a4l_subd_t *subd)
unsigned long ret = 0;
 
/* Basic checking */
-   if (!buf || !a4l_subd_is_busy(subd))
+   if (!buf || !test_bit(A4L_SUBD_BUSY_NR, subd-status))
return -ENOENT;
 
if (a4l_subd_is_input(subd))
@@ -587,7 +587,7 @@ int a4l_ioctl_bufcfg(a4l_cxt_t * cxt, void *arg)
 arg, sizeof(a4l_bufcfg_t)) != 0)
return 

[Xenomai-git] Alexis Berlemont : analogy: fix a bug in a4l_fill_desc() when called on an idle device

2010-08-02 Thread GIT version control
Module: xenomai-head
Branch: master
Commit: 89c98166b1fe4c62f043c8c795dcad6f020c451a
URL:
http://git.xenomai.org/?p=xenomai-head.git;a=commit;h=89c98166b1fe4c62f043c8c795dcad6f020c451a

Author: Alexis Berlemont alexis.berlem...@gmail.com
Date:   Mon Jun 28 00:35:30 2010 +0200

analogy: fix a bug in a4l_fill_desc() when called on an idle device

If we open an unattached device (thanks to a4l_open), the descriptor
field sbsize is worth 0. Before calling a4l_fill_desc, we need to
allocate a memory area so as to hold the device info data. According
to the manual page, malloc(0) does not have to return NULL. It can
return a pointer. So, we call a4l_fill_desc without any allocated
memory area. As there was no proper checking test in a4l_fill_desc,
there was a memory corruption bug.

---

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

diff --git a/src/drvlib/analogy/descriptor.c b/src/drvlib/analogy/descriptor.c
index a7addc0..6737265 100644
--- a/src/drvlib/analogy/descriptor.c
+++ b/src/drvlib/analogy/descriptor.c
@@ -229,6 +229,8 @@ static int __a4l_fill_desc(int fd, a4l_desc_t * dsc)
  *pass argument should be checked; check also the kernel log
  *(dmesg)
  * - -EFAULT is returned if a user - kernel transfer went wrong
+ * - -ENODEV is returned if the descriptor is incoherent (the device
+ *may be unattached)
  *
  */
 
@@ -251,6 +253,11 @@ int a4l_sys_desc(int fd, a4l_desc_t * dsc, int pass)
dsc-magic = MAGIC_BSC_DESC;
} else {
 
+   if (!dsc-sbsize) {
+   ret = -ENODEV;
+   goto out_a4l_sys_desc;
+   }
+
ret = __a4l_fill_desc(fd, dsc);
if (ret  0)
goto out_a4l_sys_desc;
@@ -350,6 +357,8 @@ int a4l_close(a4l_desc_t * dsc)
  *the dsc pointer should be checked; check also the kernel log
  *(dmesg)
  * - -EFAULT is returned if a user - kernel transfer went wrong
+ * - -ENODEV is returned if the descriptor is incoherent (the device
+ *may be unattached)
  *
  */
 int a4l_fill_desc(a4l_desc_t * dsc)


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


[Xenomai-git] Stefan Kisdaroczi : x86: add Intel ICH10_1 to rthal_smi_pci_tbl

2010-08-02 Thread GIT version control
Module: xenomai-head
Branch: master
Commit: bb3a99b7e31441e471553ba5cba8447c96bb7455
URL:
http://git.xenomai.org/?p=xenomai-head.git;a=commit;h=bb3a99b7e31441e471553ba5cba8447c96bb7455

Author: Stefan Kisdaroczi ki...@hispeed.ch
Date:   Mon Jul 19 10:45:45 2010 +0200

x86: add Intel ICH10_1 to rthal_smi_pci_tbl

---

 ksrc/arch/x86/smi.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/ksrc/arch/x86/smi.c b/ksrc/arch/x86/smi.c
index 2116899..93b5585 100644
--- a/ksrc/arch/x86/smi.c
+++ b/ksrc/arch/x86/smi.c
@@ -49,6 +49,7 @@ static struct pci_device_id rthal_smi_pci_tbl[] = {
{PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH7_0)},
{PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH7_1)},
{PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH8_4)},
+   {PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH10_1)},
{0,},
 };
 


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


[Xenomai-git] Alexis Berlemont : analogy: add comments in the buffer management code

2010-08-02 Thread GIT version control
Module: xenomai-head
Branch: master
Commit: 14bdb1d1e4334f0e6b0e9c3e8ba1ccb8669ef092
URL:
http://git.xenomai.org/?p=xenomai-head.git;a=commit;h=14bdb1d1e4334f0e6b0e9c3e8ba1ccb8669ef092

Author: Alexis Berlemont alexis.berlem...@gmail.com
Date:   Wed Jul 21 00:22:46 2010 +0200

analogy: add comments in the buffer management code

---

 include/analogy/buffer.h  |   52 
 ksrc/drivers/analogy/buffer.c |   23 +-
 2 files changed, 68 insertions(+), 7 deletions(-)

diff --git a/include/analogy/buffer.h b/include/analogy/buffer.h
index 9e5ae8a..b5be3f0 100644
--- a/include/analogy/buffer.h
+++ b/include/analogy/buffer.h
@@ -90,9 +90,12 @@ struct a4l_buffer {
 };
 typedef struct a4l_buffer a4l_buf_t;
 
-/* Static inline Buffer related functions */
+/* --- Static inline functions related with 
+   user-kernel data transfers --- */
 
-/* Produce memcpy function */
+/* The function __produce is an inline function which copies data into
+   the asynchronous buffer and takes care of the non-contiguous issue
+   when looping. This function is used in read and write operations */
 static inline int __produce(a4l_cxt_t *cxt,
a4l_buf_t *buf, void *pin, unsigned long count)
 {
@@ -122,7 +125,9 @@ static inline int __produce(a4l_cxt_t *cxt,
return ret;
 }
 
-/* Consume memcpy function */
+/* The function __consume is an inline function which copies data from
+   the asynchronous buffer and takes care of the non-contiguous issue
+   when looping. This function is used in read and write operations */
 static inline int __consume(a4l_cxt_t *cxt,
a4l_buf_t *buf, void *pout, unsigned long count)
 {
@@ -153,7 +158,9 @@ static inline int __consume(a4l_cxt_t *cxt,
return ret;
 }
 
-/* Munge procedure */
+/* The function __munge is an inline function which calls the
+   subdevice specific munge callback on contiguous windows within the
+   whole buffer. This function is used in read and write operations */
 static inline void __munge(struct a4l_subdevice * subd,
   void (*munge) (struct a4l_subdevice *, 
  void *, unsigned long),
@@ -176,7 +183,9 @@ static inline void __munge(struct a4l_subdevice * subd,
}
 }
 
-/* Event consumption function */
+/* The function __handle_event can only be called from process context
+   (not interrupt service routine). It allows the client process to
+   retrieve the buffer status which has been updated by the driver */
 static inline int __handle_event(a4l_buf_t * buf)
 {
int ret = 0;
@@ -194,7 +203,38 @@ static inline int __handle_event(a4l_buf_t * buf)
return ret;
 }
 
-/* Counters management functions */
+/* --- Counters management functions --- */
+
+/* Here, we may wonder why we need more than two counters / pointers.
+
+   Theoretically, we only need two counters (or two pointers):
+   - one which tells where the reader should be within the buffer
+   - one which tells where the writer should be within the buffer
+
+   With these two counters (or pointers), we just have to check that
+   the writer does not overtake the reader inside the ring buffer
+   BEFORE any read / write operations.
+
+   However, if one element is a DMA controller, we have to be more
+   careful. Generally a DMA transfer occurs like this:
+   DMA shot 
+  |- then DMA interrupt 
+ |- then DMA soft handler which checks the counter
+
+   So, the checkings occur AFTER the write operations.
+
+   Let's take an example: the reader is a software task and the writer
+   is a DMA controller. At the end of the DMA shot, the write counter
+   is higher than the read counter. Unfortunately, a read operation
+   occurs between the DMA shot and the DMA interrupt, so the handler
+   will not notice that an overflow occured.
+
+   That is why tmp_count comes into play: tmp_count records the
+   read/consumer current counter before the next DMA shot and once the
+   next DMA shot is done, we check that the updated writer/producer
+   counter is not higher than tmp_count. Thus we are sure that the DMA
+   writer has not overtaken the reader because it was not able to
+   overtake the n-1 value. */
 
 static inline int __pre_abs_put(a4l_buf_t * buf, unsigned long count)
 {
diff --git a/ksrc/drivers/analogy/buffer.c b/ksrc/drivers/analogy/buffer.c
index f9bcad7..8bd7d38 100644
--- a/ksrc/drivers/analogy/buffer.c
+++ b/ksrc/drivers/analogy/buffer.c
@@ -35,7 +35,11 @@
 
 /* --- Initialization functions (init, alloc, free) --- */
 
-void a4l_free_buffer(a4l_buf_t *buf_desc)
+/* The buffer charactistic is very close to the Comedi one: it is
+   allocated with vmalloc() and all physical addresses of the pages which
+   compose the virtual buffer are hold in a table */
+
+void a4l_free_buffer(a4l_buf_t * buf_desc)
 {
if (buf_desc-pg_list != NULL) {
rtdm_free(buf_desc-pg_list);
@@ -249,6 

[Xenomai-git] Gilles Chanteperdrix : testsuite: adapt run scripts to the --with-testdir option

2010-08-02 Thread GIT version control
Module: xenomai-head
Branch: master
Commit: e3acec6316f7929afb57d0670577b039c768aa54
URL:
http://git.xenomai.org/?p=xenomai-head.git;a=commit;h=e3acec6316f7929afb57d0670577b039c768aa54

Author: Gilles Chanteperdrix gilles.chanteperd...@xenomai.org
Date:   Sun Aug  1 15:36:51 2010 +0200

testsuite: adapt run scripts to the --with-testdir option

---

 src/testsuite/clocktest/Makefile.am  |2 +-
 src/testsuite/clocktest/Makefile.in  |2 +-
 src/testsuite/clocktest/runinfo.in   |2 +-
 src/testsuite/cyclic/Makefile.am |2 +-
 src/testsuite/cyclic/Makefile.in |2 +-
 src/testsuite/cyclic/runinfo.in  |2 +-
 src/testsuite/irqbench/Makefile.am   |2 +-
 src/testsuite/irqbench/Makefile.in   |2 +-
 src/testsuite/irqbench/runinfo.in|2 +-
 src/testsuite/klatency/Makefile.am   |2 +-
 src/testsuite/klatency/Makefile.in   |2 +-
 src/testsuite/klatency/runinfo.in|2 +-
 src/testsuite/latency/Makefile.am|2 +-
 src/testsuite/latency/Makefile.in|2 +-
 src/testsuite/latency/runinfo.in |2 +-
 src/testsuite/sigtest/Makefile.am|2 +-
 src/testsuite/sigtest/Makefile.in|2 +-
 src/testsuite/sigtest/runinfo.in |2 +-
 src/testsuite/switchtest/Makefile.am |2 +-
 src/testsuite/switchtest/Makefile.in |2 +-
 src/testsuite/switchtest/runinfo.in  |2 +-
 src/testsuite/unit/Makefile.am   |2 +-
 src/testsuite/unit/Makefile.in   |2 +-
 src/testsuite/unit/runinfo.in|   10 +-
 24 files changed, 28 insertions(+), 28 deletions(-)

diff --git a/src/testsuite/clocktest/Makefile.am 
b/src/testsuite/clocktest/Makefile.am
index 14f1755..9698d2d 100644
--- a/src/testsuite/clocktest/Makefile.am
+++ b/src/testsuite/clocktest/Makefile.am
@@ -18,7 +18,7 @@ clocktest_LDADD = \
 
 install-data-local:
$(mkinstalldirs) $(DESTDIR)$(rundir)
-   @sed -e's,@exec_prefix\@,$(exec_prefix),g' $(srcdir)/runinfo.in  
$(DESTDIR)$(rundir)/.runinfo
+   @sed -e's,@XENO_TEST_DIR\@,$(XENO_TEST_DIR),g' $(srcdir)/runinfo.in  
$(DESTDIR)$(rundir)/.runinfo
@echo #!/bin/sh  $(DESTDIR)$(rundir)/run
@echo \$${DESTDIR}$(exec_prefix)/bin/xeno-load \`dirname \$$0\` \$$* 
 $(DESTDIR)$(rundir)/run
@chmod +x $(DESTDIR)$(rundir)/run
diff --git a/src/testsuite/clocktest/Makefile.in 
b/src/testsuite/clocktest/Makefile.in
index 1888e40..a927cc1 100644
--- a/src/testsuite/clocktest/Makefile.in
+++ b/src/testsuite/clocktest/Makefile.in
@@ -586,7 +586,7 @@ uninstall-am: uninstall-local uninstall-testPROGRAMS
 
 install-data-local:
$(mkinstalldirs) $(DESTDIR)$(rundir)
-   @sed -e's,@exec_prefix\@,$(exec_prefix),g' $(srcdir)/runinfo.in  
$(DESTDIR)$(rundir)/.runinfo
+   @sed -e's,@XENO_TEST_DIR\@,$(XENO_TEST_DIR),g' $(srcdir)/runinfo.in  
$(DESTDIR)$(rundir)/.runinfo
@echo #!/bin/sh  $(DESTDIR)$(rundir)/run
@echo \$${DESTDIR}$(exec_prefix)/bin/xeno-load \`dirname \$$0\` \$$* 
 $(DESTDIR)$(rundir)/run
@chmod +x $(DESTDIR)$(rundir)/run
diff --git a/src/testsuite/clocktest/runinfo.in 
b/src/testsuite/clocktest/runinfo.in
index 1fe03b9..f030d69 100644
--- a/src/testsuite/clocktest/runinfo.in
+++ b/src/testsuite/clocktest/runinfo.in
@@ -1 +1 @@
-clocktest:posix:!...@exec_prefix@/bin/clocktest;popall:control_c
+clocktest:posix:!...@xeno_test_dir@/clocktest;popall:control_c
diff --git a/src/testsuite/cyclic/Makefile.am b/src/testsuite/cyclic/Makefile.am
index a8ff9ff..bcf32f7 100644
--- a/src/testsuite/cyclic/Makefile.am
+++ b/src/testsuite/cyclic/Makefile.am
@@ -18,7 +18,7 @@ cyclictest_LDADD = \
 
 install-data-local:
$(mkinstalldirs) $(DESTDIR)$(rundir)
-   @sed -e's,@exec_prefix\@,$(exec_prefix),g' $(srcdir)/runinfo.in  
$(DESTDIR)$(rundir)/.runinfo
+   @sed -e's,@XENO_TEST_DIR\@,$(XENO_TEST_DIR),g' $(srcdir)/runinfo.in  
$(DESTDIR)$(rundir)/.runinfo
@echo #!/bin/sh  $(DESTDIR)$(rundir)/run
@echo \$${DESTDIR}$(exec_prefix)/bin/xeno-load \`dirname \$$0\` \$$* 
 $(DESTDIR)$(rundir)/run
@chmod +x $(DESTDIR)$(rundir)/run
diff --git a/src/testsuite/cyclic/Makefile.in b/src/testsuite/cyclic/Makefile.in
index 058c5a4..b4871e4 100644
--- a/src/testsuite/cyclic/Makefile.in
+++ b/src/testsuite/cyclic/Makefile.in
@@ -586,7 +586,7 @@ uninstall-am: uninstall-local uninstall-testPROGRAMS
 
 install-data-local:
$(mkinstalldirs) $(DESTDIR)$(rundir)
-   @sed -e's,@exec_prefix\@,$(exec_prefix),g' $(srcdir)/runinfo.in  
$(DESTDIR)$(rundir)/.runinfo
+   @sed -e's,@XENO_TEST_DIR\@,$(XENO_TEST_DIR),g' $(srcdir)/runinfo.in  
$(DESTDIR)$(rundir)/.runinfo
@echo #!/bin/sh  $(DESTDIR)$(rundir)/run
@echo \$${DESTDIR}$(exec_prefix)/bin/xeno-load \`dirname \$$0\` \$$* 
 $(DESTDIR)$(rundir)/run
@chmod +x $(DESTDIR)$(rundir)/run
diff --git a/src/testsuite/cyclic/runinfo.in b/src/testsuite/cyclic/runinfo.in
index f3012d4..9a82e5d 100644
--- a/src/testsuite/cyclic/runinfo.in
+++ b/src/testsuite/cyclic/runinfo.in
@@ -1 +1 

[Xenomai-git] Gilles Chanteperdrix : native: add cancellation points

2010-08-02 Thread GIT version control
Module: xenomai-head
Branch: master
Commit: 3abdf95ed016b3b70bb08d5bd106917cdf057834
URL:
http://git.xenomai.org/?p=xenomai-head.git;a=commit;h=3abdf95ed016b3b70bb08d5bd106917cdf057834

Author: Gilles Chanteperdrix gilles.chanteperd...@xenomai.org
Date:   Sun Aug  1 19:02:08 2010 +0200

native: add cancellation points

---

 src/skins/native/cond.c  |   81 +++---
 src/skins/native/intr.c  |   11 ++-
 src/skins/native/queue.c |   60 ++---
 src/skins/native/sem.c   |   22 +++-
 src/skins/native/task.c  |   46 ++
 5 files changed, 192 insertions(+), 28 deletions(-)

diff --git a/src/skins/native/cond.c b/src/skins/native/cond.c
index f874678..cf7a639 100644
--- a/src/skins/native/cond.c
+++ b/src/skins/native/cond.c
@@ -16,6 +16,8 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.
  */
 
+#include pthread.h
+
 #include native/syscall.h
 #include native/mutex.h
 #include native/cond.h
@@ -39,12 +41,40 @@ int rt_cond_delete(RT_COND *cond)
return XENOMAI_SKINCALL1(__native_muxid, __native_cond_delete, cond);
 }
 
+struct rt_cond_cleanup_t {
+   RT_MUTEX *mutex;
+   unsigned saved_lockcnt;
+};
+
+static void __rt_cond_cleanup(void *data)
+{
+   struct rt_cond_cleanup_t *c = (struct rt_cond_cleanup_t *)data;
+   int err;
+
+   do {
+   err = XENOMAI_SKINCALL2(__native_muxid,
+   __native_cond_wait_epilogue, c-mutex,
+   c-saved_lockcnt);
+   } while (err == EINTR);
+
+#ifdef CONFIG_XENO_FASTSYNCH
+   c-mutex-lockcnt = c-saved_lockcnt;
+#endif /* CONFIG_XENO_FASTSYNCH */
+}
+
 int rt_cond_wait(RT_COND *cond, RT_MUTEX *mutex, RTIME timeout)
 {
-   int saved_lockcnt, err;
+   struct rt_cond_cleanup_t c = {
+   .mutex = mutex,
+   };
+   int err, oldtype;
+
+   pthread_cleanup_push(__rt_cond_cleanup, c);
+
+   pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, oldtype);
 
 #ifdef CONFIG_XENO_FASTSYNCH
-   saved_lockcnt = mutex-lockcnt;
+   c.saved_lockcnt = mutex-lockcnt;
 
err = XENOMAI_SKINCALL5(__native_muxid,
__native_cond_wait_prologue, cond, mutex,
@@ -53,54 +83,81 @@ int rt_cond_wait(RT_COND *cond, RT_MUTEX *mutex, RTIME 
timeout)
while (err == -EINTR)
err = XENOMAI_SKINCALL2(__native_muxid,
__native_cond_wait_epilogue, mutex,
-   saved_lockcnt);
+   c.saved_lockcnt);
+
+   pthread_setcanceltype(oldtype, NULL);
 
-   mutex-lockcnt = saved_lockcnt;
+   pthread_cleanup_pop(0);
+
+   mutex-lockcnt = c.saved_lockcnt;
 
 #else /* !CONFIG_XENO_FASTSYNCH */
err = XENOMAI_SKINCALL5(__native_muxid,
 __native_cond_wait_prologue, cond, mutex,
-saved_lockcnt, XN_RELATIVE, timeout);
+c.saved_lockcnt, XN_RELATIVE, timeout);
+
+   pthread_setcanceltype(oldtype, NULL);
+
+   pthread_cleanup_pop(0);
 
while (err == -EINTR)
err = XENOMAI_SKINCALL2(__native_muxid,
__native_cond_wait_epilogue, mutex,
-   saved_lockcnt);
+   c.saved_lockcnt);
 
 #endif /* !CONFIG_XENO_FASTSYNCH */
 
+   pthread_testcancel();
+
return err;
 }
 
 int rt_cond_wait_until(RT_COND *cond, RT_MUTEX *mutex, RTIME timeout)
 {
-   int saved_lockcnt, err;
+   struct rt_cond_cleanup_t c = {
+   .mutex = mutex,
+   };
+   int err, oldtype;
+
+   pthread_cleanup_push(__rt_cond_cleanup, c);
+
+   pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, oldtype);
 
 #ifdef CONFIG_XENO_FASTSYNCH
-   saved_lockcnt = mutex-lockcnt;
+   c.saved_lockcnt = mutex-lockcnt;
 
err = XENOMAI_SKINCALL5(__native_muxid,
__native_cond_wait_prologue, cond, mutex,
NULL, XN_REALTIME, timeout);
 
+   pthread_setcanceltype(oldtype, NULL);
+
+   pthread_cleanup_pop(0);
+
while (err == -EINTR)
err = XENOMAI_SKINCALL2(__native_muxid,
__native_cond_wait_epilogue, mutex,
-   saved_lockcnt);
+   c.saved_lockcnt);
 
-   mutex-lockcnt = saved_lockcnt;
+   mutex-lockcnt = c.saved_lockcnt;
 
 #else /* !CONFIG_XENO_FASTSYNCH */
err = XENOMAI_SKINCALL5(__native_muxid,
__native_cond_wait_prologue, cond, mutex,
-   saved_lockcnt, XN_REALTIME, timeout);
+   c.saved_lockcnt, XN_REALTIME, timeout);
+
+   

[Xenomai-git] Gilles Chanteperdrix : compat: add missing PCI ID for 2.4 kernels

2010-08-02 Thread GIT version control
Module: xenomai-head
Branch: master
Commit: c0dbfa66fdb93d7198abd8191f0d56339581eef7
URL:
http://git.xenomai.org/?p=xenomai-head.git;a=commit;h=c0dbfa66fdb93d7198abd8191f0d56339581eef7

Author: Gilles Chanteperdrix gilles.chanteperd...@xenomai.org
Date:   Sun Aug  1 21:41:23 2010 +0200

compat: add missing PCI ID for 2.4 kernels

---

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

diff --git a/include/asm-generic/pci_ids.h b/include/asm-generic/pci_ids.h
index 7bb9c29..4dfb7be 100644
--- a/include/asm-generic/pci_ids.h
+++ b/include/asm-generic/pci_ids.h
@@ -13,6 +13,9 @@
 #ifndef PCI_DEVICE_ID_INTEL_ICH8_4
 #define PCI_DEVICE_ID_INTEL_ICH8_4 0x2815
 #endif
+#ifndef PCI_DEVICE_ID_INTEL_ICH10_1
+#define PCI_DEVICE_ID_INTEL_ICH10_1 0x3a16
+#endif
 
 /* RTCAN */
 #ifndef PCI_VENDOR_ID_ESDGMBH


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


[Xenomai-git] Gilles Chanteperdrix : sched: avoid infinite reschedule loops

2010-08-02 Thread GIT version control
Module: xenomai-head
Branch: master
Commit: 7e2735614ebe515d57abeaa3ff6df375a7c4149f
URL:
http://git.xenomai.org/?p=xenomai-head.git;a=commit;h=7e2735614ebe515d57abeaa3ff6df375a7c4149f

Author: Gilles Chanteperdrix gilles.chanteperd...@xenomai.org
Date:   Mon Aug  2 01:19:45 2010 +0200

sched: avoid infinite reschedule loops

By resetting the switched variable to 0 upon restart of the scheduling
procedure.

---

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

diff --git a/ksrc/nucleus/pod.c b/ksrc/nucleus/pod.c
index 72f1568..27d0da8 100644
--- a/ksrc/nucleus/pod.c
+++ b/ksrc/nucleus/pod.c
@@ -2162,7 +2162,7 @@ static inline int __xnpod_test_resched(struct xnsched 
*sched)
 void __xnpod_schedule(struct xnsched *sched)
 {
struct xnthread *prev, *next, *curr = sched-curr;
-   int zombie, switched = 0, need_resched, shadow;
+   int zombie, switched, need_resched, shadow;
spl_t s;
 
if (xnarch_escalate())
@@ -2176,6 +2176,7 @@ void __xnpod_schedule(struct xnsched *sched)
 xnarch_user_pid(xnthread_archtcb(curr)) : -1,
 xnthread_current_priority(curr));
 reschedule:
+   switched = 0;
need_resched = __xnpod_test_resched(sched);
 #if !XENO_DEBUG(NUCLEUS)
if (!need_resched)


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


[Xenomai-git] Gilles Chanteperdrix : arm: upgrade adeos patches to 2.6.30-1.15-02, 2.6. 31-1.16-02, 2.6.33-1.17-02

2010-08-02 Thread GIT version control
Module: xenomai-head
Branch: master
Commit: e5e017db0837e9e4732932dc8a0ca6e8cc5d2606
URL:
http://git.xenomai.org/?p=xenomai-head.git;a=commit;h=e5e017db0837e9e4732932dc8a0ca6e8cc5d2606

Author: Gilles Chanteperdrix gilles.chanteperd...@xenomai.org
Date:   Sun Aug  1 19:14:56 2010 +0200

arm: upgrade adeos patches to 2.6.30-1.15-02, 2.6.31-1.16-02, 2.6.33-1.17-02

---

 patch = adeos-ipipe-2.6.30-arm-1.15-03.patch} |  275 -
 patch = adeos-ipipe-2.6.31-arm-1.16-02.patch} |  427 +++-
 patch = adeos-ipipe-2.6.33-arm-1.17-02.patch} |  315 +--
 3 files changed, 861 insertions(+), 156 deletions(-)

diff --git a/ksrc/arch/arm/patches/adeos-ipipe-2.6.30-arm-1.15-02.patch 
b/ksrc/arch/arm/patches/adeos-ipipe-2.6.30-arm-1.15-03.patch
similarity index 98%
rename from ksrc/arch/arm/patches/adeos-ipipe-2.6.30-arm-1.15-02.patch
rename to ksrc/arch/arm/patches/adeos-ipipe-2.6.30-arm-1.15-03.patch
index 70b4925..3a114fd 100644
--- a/ksrc/arch/arm/patches/adeos-ipipe-2.6.30-arm-1.15-02.patch
+++ b/ksrc/arch/arm/patches/adeos-ipipe-2.6.30-arm-1.15-03.patch
@@ -466,7 +466,7 @@ index 000..28dc372
 +#endif /* __ASM_ARM_FCSE_H */
 diff --git a/arch/arm/include/asm/ipipe.h b/arch/arm/include/asm/ipipe.h
 new file mode 100644
-index 000..7d9b735
+index 000..bb5cc43
 --- /dev/null
 +++ b/arch/arm/include/asm/ipipe.h
 @@ -0,0 +1,274 @@
@@ -501,10 +501,10 @@ index 000..7d9b735
 +#include linux/ipipe_percpu.h
 +#include mach/irqs.h/* For __IPIPE_FEATURE_PIC_MUTE */
 +
-+#define IPIPE_ARCH_STRING 1.15-02
++#define IPIPE_ARCH_STRING 1.15-03
 +#define IPIPE_MAJOR_NUMBER1
 +#define IPIPE_MINOR_NUMBER15
-+#define IPIPE_PATCH_NUMBER2
++#define IPIPE_PATCH_NUMBER3
 +
 +#ifdef CONFIG_SMP
 +#error I-pipe/arm: SMP not yet implemented
@@ -4815,6 +4815,61 @@ index 1e93dfe..8374fa2 100644
 +EXPORT_SYMBOL(__ipipe_mach_release_timer);
 +
 +#endif /* CONFIG_IPIPE */
+diff --git a/arch/arm/mach-ixp4xx/include/mach/platform.h 
b/arch/arm/mach-ixp4xx/include/mach/platform.h
+index e824c02..126b297 100644
+--- a/arch/arm/mach-ixp4xx/include/mach/platform.h
 b/arch/arm/mach-ixp4xx/include/mach/platform.h
+@@ -72,8 +72,8 @@ extern unsigned long ixp4xx_exp_bus_size;
+ /*
+  * Clock Speed Definitions.
+  */
+-#define IXP4XX_PERIPHERAL_BUS_CLOCK   (66) /* 66Mhzi APB BUS   */ 
+-#define IXP4XX_UART_XTAL  14745600
++#define IXP4XX_PERIPHERAL_BUS_CLOCK   (66) /* 66Mhzi APB BUS   */
++#define IXP4XX_UART_XTAL  14745600
+ 
+ /*
+  * This structure provide a means for the board setup code
+@@ -138,7 +138,7 @@ extern struct pci_bus *ixp4xx_scan_bus(int nr, struct 
pci_sys_data *sys);
+  */
+ /* GPIO pin types */
+ #define IXP4XX_GPIO_OUT   0x1
+-#define IXP4XX_GPIO_IN0x2
++#define IXP4XX_GPIO_IN0x2
+ 
+ /* GPIO signal types */
+ #define IXP4XX_GPIO_LOW   0
+@@ -150,10 +150,14 @@ extern struct pci_bus *ixp4xx_scan_bus(int nr, struct 
pci_sys_data *sys);
+ 
+ static inline void gpio_line_config(u8 line, u32 direction)
+ {
++  unsigned long flags;
++
++  local_irq_save_hw(flags);
+   if (direction == IXP4XX_GPIO_IN)
+   *IXP4XX_GPIO_GPOER |= (1  line);
+   else
+   *IXP4XX_GPIO_GPOER = ~(1  line);
++  local_irq_restore_hw(flags);
+ }
+ 
+ static inline void gpio_line_get(u8 line, int *value)
+@@ -163,11 +167,14 @@ static inline void gpio_line_get(u8 line, int *value)
+ 
+ static inline void gpio_line_set(u8 line, int value)
+ {
++  unsigned long flags;
++
++  local_irq_save_hw(flags);
+   if (value == IXP4XX_GPIO_HIGH)
+   *IXP4XX_GPIO_GPOUTR |= (1  line);
+   else if (value == IXP4XX_GPIO_LOW)
+   *IXP4XX_GPIO_GPOUTR = ~(1  line);
++  local_irq_restore_hw(flags);
+ }
+ 
+ #endif // __ASSEMBLY__
+-
 diff --git a/arch/arm/mach-mx3/devices.c b/arch/arm/mach-mx3/devices.c
 index 380be0c..28a8c3c 100644
 --- a/arch/arm/mach-mx3/devices.c
@@ -5495,6 +5550,35 @@ index 63c5ab6..089b68f 100644
}
}
  }
+diff --git a/arch/arm/mach-sa1100/gpio.c b/arch/arm/mach-sa1100/gpio.c
+index 0d3829a..873f883 100644
+--- a/arch/arm/mach-sa1100/gpio.c
 b/arch/arm/mach-sa1100/gpio.c
+@@ -32,9 +32,9 @@ static int sa1100_direction_input(struct gpio_chip *chip, 
unsigned offset)
+ {
+   unsigned long flags;
+ 
+-  local_irq_save(flags);
++  local_irq_save_hw(flags);
+   GPDR = ~GPIO_GPIO(offset);
+-  local_irq_restore(flags);
++  local_irq_restore_hw(flags);
+   return 0;
+ }
+ 
+@@ -42,10 +42,10 @@ static int sa1100_direction_output(struct gpio_chip *chip, 
unsigned offset, int
+ {
+   unsigned long flags;
+ 
+-  local_irq_save(flags);
++  local_irq_save_hw(flags);
+   sa1100_gpio_set(chip, offset, value);
+   GPDR |= GPIO_GPIO(offset);
+-  local_irq_restore(flags);
++  local_irq_restore_hw(flags);
+   return 0;
+ }
+