summaryrefslogtreecommitdiff
path: root/include/stream_adaptor.h
Commit message (Collapse)AuthorAgeFilesLines
* Cleanup: Use compound literals for static initializationAnton Staaf2015-05-271-13/+12
| | | | | | | | | | | | | | | | | | This just makes a couple of convenience macros a little prettier using compound literals. Signed-off-by: Anton Staaf <robotboy@chromium.org> BRANCH=None BUG=None TEST=make buildall -j Change-Id: I2bcd846067dbbe000b0ecb36c1d8da2d8cd730b3 Reviewed-on: https://chromium-review.googlesource.com/273287 Trybot-Ready: Anton Staaf <robotboy@chromium.org> Tested-by: Anton Staaf <robotboy@chromium.org> Reviewed-by: Bill Richardson <wfrichar@chromium.org> Commit-Queue: Anton Staaf <robotboy@chromium.org>
* Producer/Consumer: Refactor to use Queue policiesAnton Staaf2015-05-261-23/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously the Producer and Consumer interfaces tracked the Consumer and Producer respectively at the other end of the queue that they interacted with. This was done to avoid modifying the queue implementation, but resulted in a rougher interface that required additional initialization steps and prevented alternative configurations; many producers and one consumer for example. This commit uses the new queue policies to track this information. The new direct policy behaves as the old producer and consumers did. Now the producers and consumers are just named references to the queue that they work on and a convenient location for a notification callback when the queue is updated in a way that is relevent to the producer or consumer. All users of Producer and Consumer have been updated including the stream adaptors which are in use by the echo test code and the mcdp28x0 driver. Use of the stream adaptors has also been simplified. Signed-off-by: Anton Staaf <robotboy@chromium.org> BRANCH=None BUG=None TEST=make buildall -j Manual testing of Ryu (P5) and discovery board echo task Change-Id: I704be6378a31b4e20f5063295eff9943e4900409 Reviewed-on: https://chromium-review.googlesource.com/271792 Reviewed-by: Anton Staaf <robotboy@chromium.org> Commit-Queue: Anton Staaf <robotboy@chromium.org> Trybot-Ready: Anton Staaf <robotboy@chromium.org> Tested-by: Anton Staaf <robotboy@chromium.org>
* Streams: Define a lower level abstraction for queue accessAnton Staaf2015-02-241-0/+80
This adds a new pair of interfaces called producer and consumer which are simpler (in that they don't hold onto the underlying queue) than the stream interfaces. This makes it easier to share a single queue between the endpoints that will manipulate it. It was not possible to share a queue between two objects that implemented the in_stream and out_stream interfaces. This also adds a pair of adaptors that can convert a producer or consumer into a stream of the correct type. These adaptors will be used for existing code once the usb-stream and usart drivers are converted over to use the producer/consumer interfaces instead of the stream interfaces. Signed-off-by: Anton Staaf <robotboy@chromium.org> BRANCH=None BUG=None TEST=make buildall -j Change-Id: I42b4b1ac15cca28e1adc6d3cea315f15e17a0b4d Reviewed-on: https://chromium-review.googlesource.com/250941 Trybot-Ready: Anton Staaf <robotboy@chromium.org> Tested-by: Anton Staaf <robotboy@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org> Commit-Queue: Anton Staaf <robotboy@chromium.org>