Module: xenomai-2.5 Branch: master Commit: 957779281f73c60d68e6d9895c2fa3876795db0e URL: http://git.xenomai.org/?p=xenomai-2.5.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 *dev = a4l_get_dev(cxt); - a4l_buf_t *buf = cxt->buf; + a4l_buf_t *buf = cxt->buffer; a4l_subd_t *subd = buf->subd; a4l_bufcfg_t buf_cfg; @@ -593,7 +593,7 @@ 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_subd_t *subd = buf->subd; a4l_bufinfo_t info; unsigned long tmp_cnt; @@ -694,11 +694,11 @@ a4l_ioctl_bufinfo_out: return 0; } -ssize_t a4l_read(a4l_cxt_t * cxt, void *bufdata, size_t nbytes) +ssize_t a4l_read_buffer(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 *subd = buf->subd; + a4l_subd_t *subd = buf->subd; ssize_t count = 0; /* Basic checkings */ @@ -793,8 +793,7 @@ out_a4l_read: return count; } -ssize_t a4l_write(a4l_cxt_t *cxt, - const void *bufdata, size_t nbytes) +ssize_t a4l_write_buffer(a4l_cxt_t *cxt, const void *bufdata, size_t nbytes) { a4l_dev_t *dev = a4l_get_dev(cxt); a4l_buf_t *buf = cxt->buffer; @@ -934,7 +933,7 @@ int a4l_ioctl_poll(a4l_cxt_t * cxt, void *arg) unsigned long tmp_cnt = 0; a4l_dev_t *dev = a4l_get_dev(cxt); a4l_buf_t *buf = cxt->buffer; - a4l_buf_t *subd = buf->subd; + a4l_subd_t *subd = buf->subd; a4l_poll_t poll; if (!rtdm_in_rt_context() && rtdm_rt_capable(cxt->user_info)) diff --git a/ksrc/drivers/analogy/rtdm_interface.c b/ksrc/drivers/analogy/rtdm_interface.c index 8cfdf04..4eaada0 100644 --- a/ksrc/drivers/analogy/rtdm_interface.c +++ b/ksrc/drivers/analogy/rtdm_interface.c @@ -150,21 +150,18 @@ 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); 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); - if (err < 0) - goto out; + a4l_free_buffer(cxt->buffer); rtdm_free(cxt->buffer); -out: - return err; + return 0; } ssize_t a4l_read(struct rtdm_dev_context * context, @@ -181,7 +178,7 @@ ssize_t a4l_read(struct rtdm_dev_context * context, cxt->user_info = user_info; - return a4l_read(cxt, buf, nbytes); + return a4l_read_buffer(cxt, buf, nbytes); } ssize_t a4l_write(struct rtdm_dev_context * context, @@ -198,7 +195,7 @@ ssize_t a4l_write(struct rtdm_dev_context * context, cxt->user_info = user_info; - return a4l_write(cxt, buf, nbytes); + return a4l_write_buffer(cxt, buf, nbytes); } int a4l_ioctl(struct rtdm_dev_context *context, diff --git a/ksrc/drivers/analogy/transfer.c b/ksrc/drivers/analogy/transfer.c index 945402f..dc34997 100644 --- a/ksrc/drivers/analogy/transfer.c +++ b/ksrc/drivers/analogy/transfer.c @@ -53,7 +53,7 @@ int a4l_precleanup_transfer(a4l_cxt_t * cxt) __a4l_dbg(1, core_dbg, "a4l_precleanup_transfer: " - "subd[%d]->status=0x%08x\n", *status); + "subd[%d]->status=0x%08lx\n", i, *status); if (test_and_set_bit(A4L_SUBD_BUSY, status)) { __a4l_err("a4l_precleanup_transfer: " @@ -83,7 +83,6 @@ int a4l_cleanup_transfer(a4l_cxt_t * cxt) { a4l_dev_t *dev; a4l_trf_t *tsf; - int i; dev = a4l_get_dev(cxt); tsf = &dev->transfer; _______________________________________________ Xenomai-git mailing list Xenomai-git@gna.org https://mail.gna.org/listinfo/xenomai-git