[Sound-open-firmware] [PATCH] component: xrun: Add XRUN convenience APIs for notification and trace

Liam Girdwood liam.r.girdwood at linux.intel.com
Tue Aug 22 23:35:06 CEST 2017


Add a simple convenience API to allow components to report XRUNs

Signed-off-by: Liam Girdwood <liam.r.girdwood at linux.intel.com>
---
 src/include/reef/audio/component.h | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/src/include/reef/audio/component.h b/src/include/reef/audio/component.h
index a8db2ec..2e76a86 100644
--- a/src/include/reef/audio/component.h
+++ b/src/include/reef/audio/component.h
@@ -41,6 +41,7 @@
 #include <reef/dma.h>
 #include <reef/stream.h>
 #include <reef/audio/buffer.h>
+#include <reef/audio/pipeline.h>
 #include <uapi/ipc.h>
 
 /* audio component states
@@ -356,4 +357,23 @@ static inline uint32_t comp_frame_bytes(struct comp_dev *dev)
 	}
 }
 
+/* XRUN handling */
+static inline void comp_underrun(struct comp_dev *dev, struct comp_buffer *source,
+	uint32_t copy_bytes)
+{
+	trace_comp("Xun");
+	trace_value((source->avail << 16) | copy_bytes);
+
+	pipeline_xrun(dev->pipeline, dev, (int32_t)source->avail - copy_bytes);
+}
+
+static inline void comp_overrun(struct comp_dev *dev, struct comp_buffer *sink,
+	uint32_t copy_bytes)
+{
+	trace_comp("Xov");
+	trace_value((sink->free << 16) | copy_bytes);
+
+	pipeline_xrun(dev->pipeline, dev, (int32_t)copy_bytes - sink->free);
+}
+
 #endif
-- 
2.11.0



More information about the Sound-open-firmware mailing list