linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@jic23.retrosnub.co.uk>
To: "Gaëtan Carlier" <gcembed@gmail.com>
Cc: linux-iio@vger.kernel.org
Subject: Re: Buffer size for iio_push_to_buffers_with_timestamp()
Date: Sat, 11 May 2019 09:48:24 +0100	[thread overview]
Message-ID: <20190511094824.5f57f6fa@archlinux> (raw)
In-Reply-To: <affaf789-9292-20b6-010c-8cb8ef75e177@gmail.com>

On Thu, 9 May 2019 12:54:34 +0200
Gaëtan Carlier <gcembed@gmail.com> wrote:

> Dear,
> 
> I have a question about the function iio_push_to_buffers_with_timestamp().
> 
> How kernel knows the size of the buffer ? Should the buffer always be 128 bits (with last 64 bits for timestamp) ?
Hi Gaëtan,

All fields in IIO buffers are 'naturally' aligned and must be power of 2 size
(8, 16, 32, 64)

This function is a bit 'odd' in that it needs a buffer that has space to insert
the 64 bit aligned, 64 bit timestamp.

So if your devices other channels fit in 64 bits then your conclusion is
correct.  If you have more channels then it may well be that the buffer
is already greater than 64 bits long before leaving space for the timestamp
and hence your buffer may need to be 192, 256 etc..

Hope that answers your question,

Jonathan

> 
> Best regards,
> Gaëtan.


  reply	other threads:[~2019-05-11  8:48 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-09 10:54 Buffer size for iio_push_to_buffers_with_timestamp() Gaëtan Carlier
2019-05-11  8:48 ` Jonathan Cameron [this message]
2019-05-12 13:53   ` Gaëtan Carlier
2019-05-18  8:54     ` Jonathan Cameron

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=20190511094824.5f57f6fa@archlinux \
    --to=jic23@jic23.retrosnub.co.uk \
    --cc=gcembed@gmail.com \
    --cc=linux-iio@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).