blob: 4439ecdf0b98854b397e1781e9f2d06160a7570e [file] [log] [blame]
Peter Maydell18c86e22016-01-26 18:17:29 +00001#include "qemu/osdep.h"
Paolo Bonzini83c9f4c2013-02-04 15:40:22 +01002#include "hw/stream.h"
Peter A. G. Crosthwaite669b4982012-08-10 13:16:11 +10003
Peter Crosthwaite35e60bf2013-04-16 10:27:16 +10004size_t
Peter Crosthwaite42bb9c92013-04-16 10:28:35 +10005stream_push(StreamSlave *sink, uint8_t *buf, size_t len)
Peter A. G. Crosthwaite669b4982012-08-10 13:16:11 +10006{
7 StreamSlaveClass *k = STREAM_SLAVE_GET_CLASS(sink);
8
Peter Crosthwaite42bb9c92013-04-16 10:28:35 +10009 return k->push(sink, buf, len);
Peter Crosthwaite35e60bf2013-04-16 10:27:16 +100010}
11
12bool
13stream_can_push(StreamSlave *sink, StreamCanPushNotifyFn notify,
14 void *notify_opaque)
15{
16 StreamSlaveClass *k = STREAM_SLAVE_GET_CLASS(sink);
17
18 return k->can_push ? k->can_push(sink, notify, notify_opaque) : true;
Peter A. G. Crosthwaite669b4982012-08-10 13:16:11 +100019}
20
Andreas Färber8c43a6f2013-01-10 16:19:07 +010021static const TypeInfo stream_slave_info = {
Peter A. G. Crosthwaite669b4982012-08-10 13:16:11 +100022 .name = TYPE_STREAM_SLAVE,
23 .parent = TYPE_INTERFACE,
24 .class_size = sizeof(StreamSlaveClass),
25};
26
27
28static void stream_slave_register_types(void)
29{
30 type_register_static(&stream_slave_info);
31}
32
33type_init(stream_slave_register_types)