]> sigrok.org Git - libsigrok.git/commitdiff
Use std_session_send_df_trigger() where possible.
authorUwe Hermann <redacted>
Wed, 8 Apr 2020 21:21:39 +0000 (23:21 +0200)
committerUwe Hermann <redacted>
Wed, 8 Apr 2020 21:21:39 +0000 (23:21 +0200)
13 files changed:
src/hardware/asix-sigma/protocol.c
src/hardware/chronovu-la/protocol.c
src/hardware/dreamsourcelab-dslogic/protocol.c
src/hardware/hantek-4032l/protocol.c
src/hardware/hung-chang-dso-2100/protocol.c
src/hardware/ikalogic-scanalogic2/protocol.c
src/hardware/ipdbg-la/protocol.c
src/hardware/lecroy-logicstudio/protocol.c
src/hardware/openbench-logic-sniffer/protocol.c
src/hardware/pipistrello-ols/protocol.c
src/hardware/zeroplus-logic-cube/api.c
src/input/trace32_ad.c
src/soft-trigger.c

index 3c29aad9f3a33dfc75615a5e2535f4018fb5d06e..d040b37ca59143868dcb9212e570763f449ba6f4 100644 (file)
@@ -907,10 +907,8 @@ static void sigma_decode_dram_cluster(struct sigma_dram_cluster *dram_cluster,
                }
 
                /* Only send trigger if explicitly enabled. */
-               if (devc->use_triggers) {
-                       packet.type = SR_DF_TRIGGER;
-                       sr_session_send(sdi, &packet);
-               }
+               if (devc->use_triggers)
+                       std_session_send_df_trigger(sdi);
        }
 
        /*
index 3966b99e81fa994c0376089495314723d249ac8b..da772f5b1d8f5ffcdb1d3ab46227dad39dc2922d 100644 (file)
@@ -494,9 +494,7 @@ SR_PRIV void cv_send_block_to_session_bus(const struct sr_dev_inst *sdi, int blo
        /* Send the SR_DF_TRIGGER packet to the session bus. */
        sr_spew("Sending SR_DF_TRIGGER packet, sample = %d.",
                (block * BS) + trigger_point);
-       packet.type = SR_DF_TRIGGER;
-       packet.payload = NULL;
-       sr_session_send(sdi, &packet);
+       std_session_send_df_trigger(sdi);
 
        /* If at least one sample is located after the trigger... */
        if (trigger_point < (BS - 1)) {
index 584f3b1bec1a3a81e1ea59862faa6b9a3619c57d..bb98d61a4b4f467f4eafa5cfb5d487b6a20f79ac 100644 (file)
@@ -776,7 +776,6 @@ static void LIBUSB_CALL receive_transfer(struct libusb_transfer *transfer)
                (DSLOGIC_ATOMIC_BYTES * channel_count);
 
        gboolean packet_has_error = FALSE;
-       struct sr_datafeed_packet packet;
        unsigned int num_samples;
        int trigger_offset;
 
@@ -856,9 +855,7 @@ static void LIBUSB_CALL receive_transfer(struct libusb_transfer *transfer)
                        devc->sent_samples += trigger_offset;
                        /* Trigger position. */
                        devc->trigger_pos = 0;
-                       packet.type = SR_DF_TRIGGER;
-                       packet.payload = NULL;
-                       sr_session_send(sdi, &packet);
+                       std_session_send_df_trigger(sdi);
                        /* Post trigger samples. */
                        num_samples -= trigger_offset;
                        send_data(sdi, devc->deinterleave_buffer
index f316793184a4c4b042757cd592b4a41ec8803d38..a5b90ac56227f8128ec7cffdc6108a6dafc82817 100644 (file)
@@ -114,10 +114,6 @@ static void send_data(struct sr_dev_inst *sdi,
                .type = SR_DF_LOGIC,
                .payload = &logic
        };
-       const struct sr_datafeed_packet trig = {
-               .type = SR_DF_TRIGGER,
-               .payload = NULL
-       };
        size_t trigger_offset;
 
        if (devc->trigger_pos >= devc->sent_samples &&
@@ -129,7 +125,7 @@ static void send_data(struct sr_dev_inst *sdi,
                        sr_session_send(sdi, &packet);
 
                /* Send trigger position. */
-               sr_session_send(sdi, &trig);
+               std_session_send_df_trigger(sdi);
 
                /* Send rest of data. */
                logic.length = (sample_count - trigger_offset) * sizeof(uint32_t);
index 69efb14d3c332b125334490b4ebc901ed25794be..3df5b3f291a2422ad1ddcd3996275b43358f8907 100644 (file)
@@ -396,12 +396,8 @@ static int read_subframe(const struct sr_dev_inst *sdi, uint8_t *buf)
                        if (interleave)
                                num *= 2;
                        if (!devc->step) {
-                               struct sr_datafeed_packet packet = {
-                                       .type = SR_DF_TRIGGER
-                               };
-
                                push_samples(sdi, buf, 6);
-                               sr_session_send(sdi, &packet);
+                               std_session_send_df_trigger(sdi);
                                buf += 6;
                                num -= 6;
                        }
index b1a85b03a621110d64a16c4397d2f01f1524be7f..f4ceb67ab4b26b2f1ea569c7682c357cddb9b219 100644 (file)
@@ -122,10 +122,8 @@ static void process_sample_data(const struct sr_dev_inst *sdi)
                         * through the capture ratio.
                         */
                        if (devc->trigger_type != TRIGGER_TYPE_NONE &&
-                                       devc->pre_trigger_samples == 0) {
-                               packet.type = SR_DF_TRIGGER;
-                               sr_session_send(sdi, &packet);
-                       }
+                                       devc->pre_trigger_samples == 0)
+                               std_session_send_df_trigger(sdi);
                }
 
                for (; k >= 0; k--) {
@@ -164,8 +162,7 @@ static void process_sample_data(const struct sr_dev_inst *sdi)
                                logic.data = buffer;
                                sr_session_send(sdi, &packet);
 
-                               packet.type = SR_DF_TRIGGER;
-                               sr_session_send(sdi, &packet);
+                               std_session_send_df_trigger(sdi);
 
                                n = 0;
                        }
index df61b6ac8e0f643cefa59c31fd4ab4c7eacde471..b125f1efc8502aec362ed20be82393398c6e3bb9 100644 (file)
@@ -338,8 +338,7 @@ SR_PRIV int ipdbg_la_receive_data(int fd, int revents, void *cb_data)
                }
 
                /* Send the trigger. */
-               packet.type = SR_DF_TRIGGER;
-               sr_session_send(cb_data, &packet);
+               std_session_send_df_trigger(cb_data);
 
                /* Send post-trigger samples. */
                packet.type = SR_DF_LOGIC;
index 7b3a41a69d30c026a3272b87dafd3f895a5390d9..b7bf8b593e6606b86e773942156afc13974f3e87 100644 (file)
@@ -1003,7 +1003,6 @@ static void LIBUSB_CALL recv_bulk_transfer(struct libusb_transfer *xfer)
        const struct sr_dev_inst *sdi;
        struct dev_context *devc;
        struct drv_context *drvc;
-       struct sr_datafeed_packet packet;
        uint32_t bytes_left, length;
        uint16_t read_offset, trigger_offset;
 
@@ -1069,10 +1068,7 @@ static void LIBUSB_CALL recv_bulk_transfer(struct libusb_transfer *xfer)
        }
 
        /* Here comes the trigger. */
-       packet.type = SR_DF_TRIGGER;
-       packet.payload = NULL;
-
-       sr_session_send(sdi, &packet);
+       std_session_send_df_trigger(sdi);
 
        /* Send post-trigger samples. */
        while (bytes_left > 0) {
index e6adae0ac42dd68360bec7d6767143b3e11886aa..7be70b3da30153ec50b4421531ef899c443505be 100644 (file)
@@ -515,8 +515,7 @@ SR_PRIV int ols_receive_data(int fd, int revents, void *cb_data)
                        }
 
                        /* Send the trigger. */
-                       packet.type = SR_DF_TRIGGER;
-                       sr_session_send(sdi, &packet);
+                       std_session_send_df_trigger(sdi);
 
                        /* Send post-trigger samples. */
                        packet.type = SR_DF_LOGIC;
index 62515050511b67ead751998e9f7bdd44ee100cc0..f0ef680527abc48d925f9dae6b9bbcb1adeb5add 100644 (file)
@@ -636,8 +636,7 @@ SR_PRIV int p_ols_receive_data(int fd, int revents, void *cb_data)
                        }
 
                        /* Send the trigger. */
-                       packet.type = SR_DF_TRIGGER;
-                       sr_session_send(sdi, &packet);
+                       std_session_send_df_trigger(sdi);
 
                        /* Send post-trigger samples. */
                        packet.type = SR_DF_LOGIC;
index 36aef79544a3bfac8f7e69492211211cd6376a76..9d15fe6c97c13ec7e915e3036861ba348e228f30 100644 (file)
@@ -583,12 +583,8 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
                        buf_offset += logic.length;
                }
 
-               if (samples_read == trigger_offset) {
-                       /* Send out trigger */
-                       packet.type = SR_DF_TRIGGER;
-                       packet.payload = NULL;
-                       sr_session_send(sdi, &packet);
-               }
+               if (samples_read == trigger_offset)
+                       std_session_send_df_trigger(sdi);
 
                /* Send out data (or data after trigger) */
                packet.type = SR_DF_LOGIC;
index c55568edd1b6c486ef9e2fa716d6b8ab521c0540..46a15ca665589ded468a58bfb6b1777a855ff96a 100644 (file)
@@ -447,7 +447,6 @@ static void flush_output_buffer(struct sr_input *in)
 
 static void process_record_pi(struct sr_input *in, gsize start)
 {
-       struct sr_datafeed_packet packet;
        struct context *inc;
        uint64_t timestamp, next_timestamp;
        uint32_t pod_data;
@@ -580,10 +579,7 @@ static void process_record_pi(struct sr_input *in, gsize start)
        if (timestamp == inc->trigger_timestamp && !inc->trigger_sent) {
                sr_dbg("Trigger @%lf s, record #%d.",
                        timestamp * TIMESTAMP_RESOLUTION, inc->cur_record);
-
-               packet.type = SR_DF_TRIGGER;
-               packet.payload = NULL;
-               sr_session_send(in->sdi, &packet);
+               std_session_send_df_trigger(in->sdi);
                inc->trigger_sent = TRUE;
        }
 
@@ -610,7 +606,6 @@ static void process_record_pi(struct sr_input *in, gsize start)
 
 static void process_record_iprobe(struct sr_input *in, gsize start)
 {
-       struct sr_datafeed_packet packet;
        struct context *inc;
        uint64_t timestamp, next_timestamp;
        char single_payload[3];
@@ -633,10 +628,7 @@ static void process_record_iprobe(struct sr_input *in, gsize start)
        if (timestamp == inc->trigger_timestamp && !inc->trigger_sent) {
                sr_dbg("Trigger @%lf s, record #%d.",
                        timestamp * TIMESTAMP_RESOLUTION, inc->cur_record);
-
-               packet.type = SR_DF_TRIGGER;
-               packet.payload = NULL;
-               sr_session_send(in->sdi, &packet);
+               std_session_send_df_trigger(in->sdi);
                inc->trigger_sent = TRUE;
        }
 
index 0c5bb466da416100719f617c397badf7f4ca8d63..1f81fae54e11575d226cb1fd0aaf9fc0ef9a9ddb 100644 (file)
@@ -175,7 +175,6 @@ static gboolean logic_check_match(struct soft_trigger_logic *stl,
 SR_PRIV int soft_trigger_logic_check(struct soft_trigger_logic *stl,
                uint8_t *buf, int len, int *pre_trigger_samples)
 {
-       struct sr_datafeed_packet packet;
        struct sr_trigger_stage *stage;
        struct sr_trigger_match *match;
        GSList *l, *l_stage;
@@ -216,9 +215,7 @@ SR_PRIV int soft_trigger_logic_check(struct soft_trigger_logic *stl,
                                /* Fire trigger. */
                                offset = i / stl->unitsize;
 
-                               packet.type = SR_DF_TRIGGER;
-                               packet.payload = NULL;
-                               sr_session_send(stl->sdi, &packet);
+                               std_session_send_df_trigger(stl->sdi);
                                break;
                        }
                } else if (stl->cur_stage > 0) {