Commit graph

6 commits

Author SHA1 Message Date
Jon Szymaniak
8ee61cd808 libbladeRF: Submit BLADERF_STREAM_SHUTDOWN without waiting on stream
Normally, we want to wait for the stream to be running before
submitting a buffer. However, BLADERF_STREAM_SHUTDOWN is a special
case; we want to always submit this immediately so that we can
end a stream, even if it's not currently running.

This commit fixes #244.
2014-05-11 14:50:51 -04:00
Jon Szymaniak
25c25f5a36 libbladeRF: Ensure async stream is running before submitting transfers
Erroneous behavior has been observed with GRC flowgraphs, where stream
buffers are submitted before the underlying async stream is running.

Although I have not been able to replicate this, this patch should
ensure that a buffer submission is delayed until after the async
stream has been initialized and is starting to run.
2014-05-06 21:59:42 -04:00
David Brenner
7548a8b698 libbladeRF: Fixed minor comment typos 2014-05-04 15:36:00 -04:00
Jon Szymaniak
2caa67a624 libbladeRF: Refactored async stream implementation, non-callback buf submission
To support cases where callbacks would need to block (which they can't),
the async stream implementation has been modified to support
bladerf_submit_stream_buffer(), which allows buffers to be submitted for
transfer outside of the callback functions.

There are some caveats to using this; the documentation has been updated
to note where care should be taken with lock acquisition.
2014-03-30 20:30:30 -04:00
Jon Szymaniak
fd072df449 libbladeRF: Hold lock while executing stream callbacks
Per the libusb documentation, the libusb async callbacks must be
executed atomically.

In half-duplex cases where one thread is sitting in a bladerf_stream()
call, this was a problem.  However, in full-duplex cases, we can have
two threads, each calling a libusb handle_events fn, enter the callback
for a single module. This would result in:
    - Buffers being passed to user callbacks in the wrong order
    - Stream state and error conditions being corrupted
2014-03-22 14:52:15 -04:00
Jon Szymaniak
d586e44bec libbladeRF: Moved stream code and definitions to stream.c/.h
Re-arranged some code in preparation for making changes to the async
stream implementation.
2014-03-22 14:10:55 -04:00