Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhance blocks API #1064

Merged
merged 6 commits into from
Oct 10, 2023
Merged

Enhance blocks API #1064

merged 6 commits into from
Oct 10, 2023

Conversation

pcercuei
Copy link
Contributor

@pcercuei pcercuei commented Oct 5, 2023

This is a subset of #1035, which does not depend on the DMABUF IIO interface being merged into the upstream Linux kernel.

I create a separate PR so that these can be merged sooner.

Make sure that the transfer size requested (in bytes) is not bigger than
the size of the block itself.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Previously, the 'bytes_used' was only used when enqueueing a TX
transfer; for RX transfers, the full size of the iio_block was always
used. This was arbitrary and confusing.

Now, the 'bytes_used' field will be used for RX transfers as well.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
When calling iio_block_enqueue(), if 'bytes_used' is set to zero, then
the full block is transferred.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
The bytes_used field can now be set to 0 to default to the block size.

Note that for RX transfers, iio_block_enqueue() was already called
with bytes_used == 0, which previously meant "transmit 0 bytes and
queue for receive". Because the "bytes_used" field is now handled as
for RX buffers as well, the behaviour is now "queue for receiving a
block size worth of data" which is functionally the same.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
A iio_err() check was performed on the wrong variable.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Older development versions of Libiio v1.x will try to enqueue blocks of
size 0, which is not supported anymore by the current Libiio and IIOD.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Copy link
Contributor

@rgetz rgetz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did not test - but makes sense.

@pcercuei pcercuei merged commit 26957d9 into main Oct 10, 2023
25 checks passed
@pcercuei pcercuei deleted the pcercuei/better-blocks-api branch October 10, 2023 15:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants