From: Alexis Berlemont <alexis.berlemont@domain.hid>
To: Daniele Nicolodi <daniele@domain.hid>
Cc: xenomai-core <xenomai@xenomai.org>
Subject: Re: [Xenomai-core] [PULL REQUEST] analogy: bug fixes
Date: Mon, 29 Mar 2010 00:47:17 +0200 [thread overview]
Message-ID: <20100328224717.GA2542@domain.hid> (raw)
In-Reply-To: <4BAB6947.8020803@domain.hid>
Hi,
Sorry for the late reply.
Daniele Nicolodi wrote:
> Daniele Nicolodi wrote:
> > Alexis Berlemont wrote:
> >> 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.
>
> > 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).
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.
>
> What do you think?
>
> Cheers,
> --
> Daniele
--
Alexis.
next prev parent reply other threads:[~2010-03-28 22:47 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-20 0:28 [Xenomai-core] [PULL REQUEST] analogy: bug fixes Alexis Berlemont
2010-03-20 12:56 ` Daniele Nicolodi
2010-03-21 20:59 ` Alexis Berlemont
2010-03-24 10:48 ` Daniele Nicolodi
2010-03-24 23:44 ` Alexis Berlemont
2010-03-25 0:05 ` Daniele Nicolodi
2010-03-25 13:46 ` Daniele Nicolodi
2010-03-28 22:47 ` Alexis Berlemont [this message]
2010-03-29 18:02 ` Daniele Nicolodi
-- strict thread matches above, loose matches on Subject: below --
2010-07-07 23:13 [Xenomai-core] [PULL REQUEST] analogy " Alexis Berlemont
2010-07-08 9:14 ` Gilles Chanteperdrix
2010-07-09 13:15 ` Alexis Berlemont
2010-01-15 0:51 [Xenomai-core] [PULL REQUEST] analogy: " Alexis Berlemont
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100328224717.GA2542@domain.hid \
--to=alexis.berlemont@domain.hid \
--cc=daniele@domain.hid \
--cc=xenomai@xenomai.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.