From bd7e885ae780493e37a58418a6f0197a4a3b951a Mon Sep 17 00:00:00 2001 From: Anton Staaf Date: Mon, 8 Jun 2015 10:40:43 -0700 Subject: Stream: Remove in_stream/out_stream interface The in_stream and out_stream interfaces were a first attempt at providing an abstraction for multiple stream like devices (usart, USB, I2C/LPC host interfaces...). But, by baking the queue into the device it proved to be hard to use and required additional resources (task or deferred hook) to handle passing data from one stream to another. Since then the queue policy and producer/consumer interfaces have replaced the stream interfaces. This CL removes the old stream interfaces and updates the only users (deleting the test echo code from the discovery-stm32f072 board and updating the mcdp28x0 driver to use the queue interfaces). Signed-off-by: Anton Staaf BRANCH=None BUG=None TEST=make buildall -j Change-Id: Ic0d2abf81eafc4fb2e61172540151f2d0ba45caf Reviewed-on: https://chromium-review.googlesource.com/276163 Reviewed-by: Todd Broch Commit-Queue: Anton Staaf Trybot-Ready: Anton Staaf Tested-by: Anton Staaf --- include/stream_adaptor.h | 107 ----------------------------------------------- 1 file changed, 107 deletions(-) delete mode 100644 include/stream_adaptor.h (limited to 'include/stream_adaptor.h') diff --git a/include/stream_adaptor.h b/include/stream_adaptor.h deleted file mode 100644 index 3074231ef3..0000000000 --- a/include/stream_adaptor.h +++ /dev/null @@ -1,107 +0,0 @@ -/* Copyright 2015 The Chromium OS Authors. All rights reserved. - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ -#ifndef INCLUDE_STREAM_ADAPTOR_H -#define INCLUDE_STREAM_ADAPTOR_H - -#include "common.h" -#include "in_stream.h" -#include "out_stream.h" -#include "consumer.h" -#include "producer.h" -#include "queue.h" -#include "queue_policies.h" - -/* - * +..........+ +..........+------+...........+ - * . .<------------->. | | . - * . Producer . +---------+ . Consumer | ISFQ | In Stream . - * . .->| Queue |->. | | . - * +..........+ +---------+ +..........+------+...........+ - */ - -struct in_stream_from_queue { - struct consumer consumer; - struct in_stream in; -}; - -/* - * - */ -extern struct in_stream_ops const in_stream_from_queue_in_stream_ops; -extern struct consumer_ops const in_stream_from_queue_consumer_ops; - -#define IN_STREAM_FROM_QUEUE(QUEUE, READY) \ - ((struct in_stream_from_queue) { \ - .consumer = { \ - .queue = &QUEUE, \ - .ops = &in_stream_from_queue_consumer_ops, \ - }, \ - .in = { \ - .ready = READY, \ - .ops = &in_stream_from_queue_in_stream_ops, \ - }, \ - }) - -/* - * +..........+ +..........+------+............+ - * . .<------------->. | | . - * . Consumer . +---------+ . Producer | OSFQ | Out Stream . - * . .<-| Queue |<-. | | . - * +..........+ +---------+ +..........+------+............+ - */ - -struct out_stream_from_queue { - struct producer producer; - struct out_stream out; -}; - -/* - * - */ -extern struct out_stream_ops const out_stream_from_queue_out_stream_ops; -extern struct producer_ops const out_stream_from_queue_producer_ops; - -#define OUT_STREAM_FROM_QUEUE(QUEUE, READY) \ - ((struct out_stream_from_queue) { \ - .producer = { \ - .queue = &QUEUE, \ - .ops = &out_stream_from_queue_producer_ops, \ - }, \ - .out = { \ - .ready = READY, \ - .ops = &out_stream_from_queue_out_stream_ops, \ - }, \ - }) - -/* - * Given a forward declared device configuration called NAME that implements - * producer and consumer interfaces construct RX/TX queues and expose them as - * streams called _in and _out. - */ -#define IO_STREAM_CONFIG(NAME, RX_SIZE, TX_SIZE, IN_READY, OUT_READY) \ - struct in_stream_from_queue const CONCAT2(NAME, _in); \ - \ - struct queue const CONCAT2(NAME, _rx_queue) = \ - QUEUE_DIRECT(RX_SIZE, \ - uint8_t, \ - NAME.producer, \ - CONCAT2(NAME, _in).consumer); \ - struct in_stream_from_queue const CONCAT2(NAME, _in) = \ - IN_STREAM_FROM_QUEUE(CONCAT2(NAME, _rx_queue), \ - IN_READY); \ - \ - \ - struct out_stream_from_queue const CONCAT2(NAME, _out); \ - \ - struct queue const CONCAT2(NAME, _tx_queue) = \ - QUEUE_DIRECT(TX_SIZE, \ - uint8_t, \ - CONCAT2(NAME, _out).producer, \ - NAME.consumer); \ - struct out_stream_from_queue const CONCAT2(NAME, _out) = \ - OUT_STREAM_FROM_QUEUE(CONCAT2(NAME, _tx_queue), \ - OUT_READY); - -#endif /* INCLUDE_STREAM_ADAPTOR_H */ -- cgit v1.2.1