mirror of
				https://github.com/qemu/qemu.git
				synced 2025-10-31 12:07:31 +00:00 
			
		
		
		
	 51b19950ca
			
		
	
	
		51b19950ca
		
	
	
	
	
		
			
			Some stream clients stream an endless stream of data while other clients stream data in packets. Stream interfaces usually have a way to signal the end of a packet or the last beat of a transfer. This adds an end-of-packet flag to the push interface. Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Reviewed-by: Francisco Iglesias <frasse.iglesias@gmail.com> Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> Message-Id: <20200506082513.18751-6-edgar.iglesias@gmail.com>
		
			
				
	
	
		
			35 lines
		
	
	
		
			801 B
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			35 lines
		
	
	
		
			801 B
		
	
	
	
		
			C
		
	
	
	
	
	
| #include "qemu/osdep.h"
 | |
| #include "hw/stream.h"
 | |
| #include "qemu/module.h"
 | |
| 
 | |
| size_t
 | |
| stream_push(StreamSlave *sink, uint8_t *buf, size_t len, bool eop)
 | |
| {
 | |
|     StreamSlaveClass *k =  STREAM_SLAVE_GET_CLASS(sink);
 | |
| 
 | |
|     return k->push(sink, buf, len, eop);
 | |
| }
 | |
| 
 | |
| bool
 | |
| stream_can_push(StreamSlave *sink, StreamCanPushNotifyFn notify,
 | |
|                 void *notify_opaque)
 | |
| {
 | |
|     StreamSlaveClass *k =  STREAM_SLAVE_GET_CLASS(sink);
 | |
| 
 | |
|     return k->can_push ? k->can_push(sink, notify, notify_opaque) : true;
 | |
| }
 | |
| 
 | |
| static const TypeInfo stream_slave_info = {
 | |
|     .name          = TYPE_STREAM_SLAVE,
 | |
|     .parent        = TYPE_INTERFACE,
 | |
|     .class_size = sizeof(StreamSlaveClass),
 | |
| };
 | |
| 
 | |
| 
 | |
| static void stream_slave_register_types(void)
 | |
| {
 | |
|     type_register_static(&stream_slave_info);
 | |
| }
 | |
| 
 | |
| type_init(stream_slave_register_types)
 |