analogy: bug fixes
The following changes since commit 8cfc1103fe1cf9e700698e8230baf562ffb5cf06:
Gilles Chanteperdrix (1):
x86 syscalls: make __xn_get_eip a macro
are available in the git repository at:
git://git.xenomai.org/xenomai-abe.git analogy
Alexis Berlemont (16):
analogy: in insn_read, no more real-time mode and automatic subd
selection
analogy: in insn_write, no more real-time mode and automatic subd
selection
analogy: improve robustness of the detach procedure
analogy: minor changes in comments
analogy: fix a potential missing initialization of the subd
descriptor
analogy: make a4l_config_subd support open drain configuration
analogy: [pcimio] fix many race conditions in DMA output transfers
analogy: make __pre_abs_get more robust at ends of acquisitions
analogy: fix a bug in cmd_read with real-time mode enabled
analogy: remove rt_task_set_mode from test programs
analogy: change the error code in case of context error (-EPERM
-> -ENOSYS)
analogy: [loop] add the asynchronous callbacks for the write
subdevice
analogy: in cmd_{read, write}, replace a4l_sys_* by a4l_async_*
analogy: declare a4l_async_read and a4l_async_write in analogy.h
analogy: add a description of TRIG_WAKE_EOS
analogy: at close time, cancel any busy subdevice
Daniele Nicolodi (2):
analogy: [pcimio] enable subdevice buffer mmapping
analogy: fix a bug in a4l_ioctl_bufinfo when idle
Stefan Schaal (1):
analogy: add a4l_config_subd() declaration in analogy.h
include/analogy/analogy.h | 9 + include/analogy/buffer.h | 28 ++++- include/analogy/command.h | 2 +- include/analogy/transfer.h | 3 + ksrc/drivers/analogy/buffer.c | 17 ++- ksrc/drivers/analogy/device.c | 37 +++-- .../analogy/national_instruments/mio_common.c | 102 ++++++++------ ksrc/drivers/analogy/national_instruments/mite.c | 17 ++- ksrc/drivers/analogy/rtdm_interface.c | 5 +- ksrc/drivers/analogy/testing/loop.c | 23 ++- ksrc/drivers/analogy/transfer.c | 69 ++++++++-- src/drvlib/analogy/sync.c | 3 +- src/utils/analogy/cmd_read.c | 33 +---- src/utils/analogy/cmd_write.c | 13 +-- src/utils/analogy/insn_bits.c | 20 +++ src/utils/analogy/insn_read.c | 145 ++++++++---------- src/utils/analogy/insn_write.c | 154 +++++++++----------- 17 files changed, 374 insertions(+), 306 deletions(-)
Quoted 7 lines · Alexis Berlemont
The following changes since commit
8cfc1103fe1cf9e700698e8230baf562ffb5cf06:
Gilles Chanteperdrix (1):
x86 syscalls: make__xn_get_eipa macroare available in the git repository at:
git://git.xenomai.org/xenomai-abe.gitanalogy
Hello. Looking at your pull request, I see that my patch for correct buffer handling when using .stop_src = TRIG_NONE is not included. Does the patch need some more work? Or it simply get lost on the way?
Thanks. Cheers,
Signature · 1 line
Daniele
Quoted 5 lines · Daniele Nicolodi
Quoted 4 lines · Alexis Berlemont
The following changes since commit
8cfc1103fe1cf9e700698e8230baf562ffb5cf06:
Gilles Chanteperdrix (1):
x86 syscalls: make__xn_get_eipa macro
Quoted 7 lines
Quoted 3 lines
are available in the git repository at:
git://git.xenomai.org/xenomai-abe.gitanalogyHello. Looking at your pull request, I see that my patch for correct buffer handling when using .stop_src =
TRIG_NONEis not included. Does the patch need some more work? Or it simply get lost on the way?
I have not forgotten it. I did not include it for two reasons:
- I have not found time to (fully) test it
- I wanted to properly modify the test program cmd_read so as to allow continuous acquisisitions
Quoted 5 lines
Thanks. Cheers,
Signature · 1 line
Daniele
Signature · 1 line
Alexis.
Quoted 8 lines · Alexis Berlemont
Quoted 7 lines · Daniele Nicolodi
Quoted 6 lines · Alexis Berlemont
The following changes since commit
8cfc1103fe1cf9e700698e8230baf562ffb5cf06:
Gilles Chanteperdrix (1):
x86 syscalls: make__xn_get_eipa macroare available in the git repository at:
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
git://git.xenomai.org/xenomai-abe.gitanalogyHello. Looking at your pull request, I see that my patch for correct buffer handling when using .stop_src =
TRIG_NONEis not included. Does the patch need some more work? Or it simply get lost on the way?I have not forgotten it. I did not include it for two reasons:
- I have not found time to (fully) test it
- I wanted to properly modify the test programcmd_readso as to allow continuous acquisisitions
Hi Alexis. Sorry for the late response. That's fine, I just wanted to be sure that the patch was not dropped by mistake. I'll test continuous output today and let you know if any other bugfix is necessary. I can also look into providing a patch for cmd_read and cmd_write.
Cheers,
Signature · 1 line
Daniele
Hi,
Quoted 18 lines · Daniele Nicolodi
Quoted 8 lines · Alexis Berlemont
Quoted 7 lines · Daniele Nicolodi
Quoted 6 lines · Alexis Berlemont
The following changes since commit
8cfc1103fe1cf9e700698e8230baf562ffb5cf06:
Gilles Chanteperdrix (1):
x86 syscalls: make__xn_get_eipa macroare available in the git repository at:
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
git://git.xenomai.org/xenomai-abe.gitanalogyHello. Looking at your pull request, I see that my patch for correct buffer handling when using .stop_src =
TRIG_NONEis not included. Does the patch need some more work? Or it simply get lost on the way?I have not forgotten it. I did not include it for two reasons:
- I have not found time to (fully) test it
- I wanted to properly modify the test programcmd_readso as to allow continuous acquisisitions
Quoted 4 lines
Hi Alexis. Sorry for the late response. That's fine, I just wanted to be sure that the patch was not dropped by mistake. I'll test continuous output today and let you know if any other bugfix is necessary. I can also look into providing a patch for
cmd_readandcmd_write.
If you want to test infinite acquisitions right now, you can clone my git repository. I just pushed the modifications on it. I have not made a pull request yet because I want to be sure there is no regression.
Your patch did not integrate fixes for both directions (read and write). So, I had to modify it.
I also modified cmd_read; with the option -S set to 0, an infinite acquisition will be configured.
Any patch from you is welcome (cmd_write or anything else), so do not hesitate to send them.
Quoted 4 lines
Cheers,
Signature · 1 line
Daniele
Signature · 1 line
Alexis.
Quoted 3 lines · Alexis Berlemont
If you want to test infinite acquisitions right now, you can clone my git repository. I just pushed the modifications on it. I have not made a pull request yet because I want to be sure there is no regression.
Thanks! I'll test it as soon as possible.
I think I just stumbled into the ring buffer bug you fixed in your repository :-) It took me a while to understand if the problem was in the hardware, in my code, or somewhere else in the stack...
Now I just have to find where the carpenters broke the cable that brings internet connection to my lab and fix it... :-(
Cheers,
Signature · 1 line
Daniele
Quoted 6 lines · Daniele Nicolodi
Quoted 3 lines · Alexis Berlemont
If you want to test infinite acquisitions right now, you can clone my git repository. I just pushed the modifications on it. I have not made a pull request yet because I want to be sure there is no regression.
Thanks! I'll test it as soon as possible.
I'm testing it now.
Quoted 3 lines
I think I just stumbled into the ring buffer bug you fixed in your repository :-) It took me a while to understand if the problem was in the hardware, in my code, or somewhere else in the stack...
Unfortunately my ring buffer problem is not fixed by you patch. What I'm experiencing is exposed by this (pseudo) code:
a4l_open(dsc, device)a4l_mmap(dsc, subdevice, bufsize, &map)a4l_snd_command(dsc, cmd)
/* preload buffer */
written = write_to_buffer(map, bufsize)
/* send internal trigger */
a4l_snd_insn(dsc,
cnt = 0;
while (1)
a4l_mark_bufrw(dsc, subdevice, written, towrite); cnt += written;
/* 1 */
written = write_buffer(map + (cnt % bufsize), towrite)
The problem is that at the place marked with (1) the total extension of the buffer region that gets written exceeds the ring buffer allocated memory. That is ((cnt % bufsize) + towrite) > bufsize !
I do not know if this should be handled in my code, or in the driver. This situation is not handled in the cmd_write example code (where a simple memcpy() is done).
What do you think?
Cheers,
Signature · 1 line
Daniele
Hi,
Sorry for the late reply.
Quoted 35 lines · Daniele Nicolodi
Quoted 6 lines · Daniele Nicolodi
Quoted 3 lines · Alexis Berlemont
If you want to test infinite acquisitions right now, you can clone my git repository. I just pushed the modifications on it. I have not made a pull request yet because I want to be sure there is no regression.
Thanks! I'll test it as soon as possible.
I'm testing it now.
Quoted 3 lines
I think I just stumbled into the ring buffer bug you fixed in your repository :-) It took me a while to understand if the problem was in the hardware, in my code, or somewhere else in the stack...
Unfortunately my ring buffer problem is not fixed by you patch. What I'm experiencing is exposed by this (pseudo) code:
a4l_open(dsc, device)a4l_mmap(dsc, subdevice, bufsize, &map)a4l_snd_command(dsc, cmd)/* preload buffer */
written =write_to_buffer(map, bufsize)/* send internal trigger */
a4l_snd_insn(dsc,cnt = 0;
while (1)
a4l_mark_bufrw(dsc, subdevice, written, towrite); cnt += written;
/* 1 */
written =write_buffer(map + (cnt % bufsize), towrite)
Quoted 7 lines
The problem is that at the place marked with (1) the total extension of the buffer region that gets written exceeds the ring buffer allocated memory. That is ((cnt % bufsize) + towrite) > bufsize !
I do not know if this should be handled in my code, or in the driver. This situation is not handled in the
cmd_writeexample code (where a simplememcpy()is done).
There is a bug in cmd_write and cmd_read. I have should have taken into account the buffers edges. I will fix it. The function a4l_mark_bufrw() is not designed to handle boundaries, that is why its arguments represent data size not addresses.
Quoted 6 lines
What do you think?
Cheers,
Signature · 1 line
Daniele
Signature · 1 line
Alexis.
Quoted 4 lines · Alexis Berlemont
There is a bug in
cmd_writeandcmd_read. I have should have taken into account the buffers edges. I will fix it. The functiona4l_mark_bufrw()is not designed to handle boundaries, that is why its arguments represent data size not addresses.
That makes sense. I can provide a patch for cmd_read and cmd_write, as i got the same kind of code working in my own test programs, but I'm quite busy right now...
Cheers,
Signature · 1 line
Daniele