mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-12-30 02:20:48 +00:00
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 <robotboy@chromium.org> BRANCH=None BUG=None TEST=make buildall -j Change-Id: Ic0d2abf81eafc4fb2e61172540151f2d0ba45caf Reviewed-on: https://chromium-review.googlesource.com/276163 Reviewed-by: Todd Broch <tbroch@chromium.org> Commit-Queue: Anton Staaf <robotboy@chromium.org> Trybot-Ready: Anton Staaf <robotboy@chromium.org> Tested-by: Anton Staaf <robotboy@chromium.org>
44 lines
1.1 KiB
C
44 lines
1.1 KiB
C
/* 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.
|
|
*
|
|
* Queue policies.
|
|
*/
|
|
#include "queue_policies.h"
|
|
#include "util.h"
|
|
|
|
#include <stddef.h>
|
|
|
|
void queue_add_direct(struct queue_policy const *policy, size_t count)
|
|
{
|
|
struct queue_policy_direct const *direct =
|
|
DOWNCAST(policy, struct queue_policy_direct, policy);
|
|
|
|
if (count && direct->consumer->ops->written)
|
|
direct->consumer->ops->written(direct->consumer, count);
|
|
}
|
|
|
|
void queue_remove_direct(struct queue_policy const *policy, size_t count)
|
|
{
|
|
struct queue_policy_direct const *direct =
|
|
DOWNCAST(policy, struct queue_policy_direct, policy);
|
|
|
|
if (count && direct->producer->ops->read)
|
|
direct->producer->ops->read(direct->producer, count);
|
|
}
|
|
|
|
struct producer const null_producer = {
|
|
.queue = NULL,
|
|
.ops = &((struct producer_ops const) {
|
|
.read = NULL,
|
|
}),
|
|
};
|
|
|
|
struct consumer const null_consumer = {
|
|
.queue = NULL,
|
|
.ops = &((struct consumer_ops const) {
|
|
.written = NULL,
|
|
.flush = NULL,
|
|
}),
|
|
};
|