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

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

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: rewrite the cancel ioctl handler (broken)

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

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