input: optionally send trigger markers from common feed queue helper
authorGerhard Sittig <gerhard.sittig@gmx.net>
Wed, 22 Dec 2021 12:17:59 +0000 (13:17 +0100)
committerGerhard Sittig <gerhard.sittig@gmx.net>
Wed, 22 Dec 2021 19:04:28 +0000 (20:04 +0100)
This further simplifies callers, which need not care about flushing
previously queued samples before a trigger packet is sent. The queue
itself handles the order of packet initiation.

src/input/feed_queue.c
src/libsigrok-internal.h

index bd5c16c7f621947f55cd43dd8f641acb3874edab..b25fa77affdc8b7f90731dafa62ed5ef6b6ab9ab 100644 (file)
@@ -95,6 +95,21 @@ SR_API int feed_queue_logic_flush(struct feed_queue_logic *q)
        return SR_OK;
 }
 
+SR_API int feed_queue_logic_send_trigger(struct feed_queue_logic *q)
+{
+       int ret;
+
+       ret = feed_queue_logic_flush(q);
+       if (ret != SR_OK)
+               return ret;
+
+       ret = std_session_send_df_trigger(q->sdi);
+       if (ret != SR_OK)
+               return ret;
+
+       return SR_OK;
+}
+
 SR_API void feed_queue_logic_free(struct feed_queue_logic *q)
 {
 
index 7b64c71463ef793b8e17c5a83832a6225f4cac30..4e4143009a9c506f2ab34ab58583a3c784bce296 100644 (file)
@@ -2692,6 +2692,7 @@ SR_API struct feed_queue_logic *feed_queue_logic_alloc(
 SR_API int feed_queue_logic_submit(struct feed_queue_logic *q,
        const uint8_t *data, size_t count);
 SR_API int feed_queue_logic_flush(struct feed_queue_logic *q);
+SR_API int feed_queue_logic_send_trigger(struct feed_queue_logic *q);
 SR_API void feed_queue_logic_free(struct feed_queue_logic *q);
 
 SR_API struct feed_queue_analog *feed_queue_analog_alloc(