]> sigrok.org Git - libsigrok.git/commitdiff
feed_queue: rename routines for submission of a single sample value
authorGerhard Sittig <redacted>
Sun, 15 Oct 2023 08:08:11 +0000 (10:08 +0200)
committerGerhard Sittig <redacted>
Mon, 16 Oct 2023 20:19:28 +0000 (22:19 +0200)
Common feed queue support originated from input module RLE compression.
Its API would accept a single sample value and optionally repeat that
value several times.

Rename the routines and its parameter for improved awareness. Adjust
existing callers: The asix-omega, atorch, kingst-la, rdtech-tc, and
rdtech-um acquisition device drivers, as well as the protocoldata,
stf, and vcd input modules.

See a word diff for the essence of the change.

src/hardware/asix-omega-rtm-cli/protocol.c
src/hardware/atorch/protocol.c
src/hardware/kingst-la2016/protocol.c
src/hardware/rdtech-tc/protocol.c
src/hardware/rdtech-um/protocol.c
src/input/feed_queue.c
src/input/protocoldata.c
src/input/stf.c
src/input/vcd.c
src/libsigrok-internal.h

index e72036bfb32338e32a02955736613a089459f40b..d74349516999a7222880965f3169bda40de79214 100644 (file)
@@ -215,7 +215,7 @@ static int omega_rtm_cli_process_rawdata(const struct sr_dev_inst *sdi)
                        devc->samples.remain_count -= count;
                }
                if (count) {
-                       ret = feed_queue_logic_submit(devc->samples.queue,
+                       ret = feed_queue_logic_submit_one(devc->samples.queue,
                                devc->samples.last_sample, count);
                        if (ret != SR_OK)
                                break;
@@ -229,13 +229,13 @@ static int omega_rtm_cli_process_rawdata(const struct sr_dev_inst *sdi)
                 * hand because future chunks might repeat it.
                 */
                write_u16le(devc->samples.last_sample, sample1);
-               ret = feed_queue_logic_submit(devc->samples.queue,
+               ret = feed_queue_logic_submit_one(devc->samples.queue,
                        devc->samples.last_sample, 1);
                if (ret != SR_OK)
                        break;
 
                write_u16le(devc->samples.last_sample, sample2);
-               ret = feed_queue_logic_submit(devc->samples.queue,
+               ret = feed_queue_logic_submit_one(devc->samples.queue,
                        devc->samples.last_sample, 1);
                if (ret != SR_OK)
                        break;
index 53f03313d0e226a86e4f0e11059a3a0699e6f9fd..595e619b5b80b6223840319a029f85d00ef529a2 100644 (file)
@@ -183,7 +183,7 @@ static void parse_report_msg(struct sr_dev_inst *sdi, const uint8_t *report_ptr)
 
        for (i = 0; i < devc->profile->channel_count; i++) {
                bv_get_value(&val, &devc->profile->channels[i].spec, report_ptr);
-               feed_queue_analog_submit(devc->feeds[i], val, 1);
+               feed_queue_analog_submit_one(devc->feeds[i], val, 1);
        }
 
        std_session_send_df_frame_end(sdi);
index ace0cd51d590777ec658d6ffdbd9fc8473de0b41..dd806eaa5e065acd0f9623c450045f58bebefdf7 100644 (file)
@@ -1391,7 +1391,7 @@ static void send_chunk(struct sr_dev_inst *sdi,
                        devc->total_samples += repetitions;
 
                        write_u32le(sample_buff, sample_value);
-                       feed_queue_logic_submit(devc->feed_queue,
+                       feed_queue_logic_submit_one(devc->feed_queue,
                                sample_buff, repetitions);
                        sr_sw_limits_update_samples_read(&devc->sw_limits,
                                repetitions);
@@ -1508,7 +1508,8 @@ static void stream_data(struct sr_dev_inst *sdi,
                for (bit_idx = 0; bit_idx < bit_count; bit_idx++) {
                        sample_value = stream->sample_data[bit_idx];
                        write_u32le(sample_buff, sample_value);
-                       feed_queue_logic_submit(devc->feed_queue, sample_buff, 1);
+                       feed_queue_logic_submit_one(devc->feed_queue,
+                               sample_buff, 1);
                }
                sr_sw_limits_update_samples_read(&devc->sw_limits, bit_count);
                devc->total_samples += bit_count;
index 99297ba6f8fb75595e1ec94110f2c849ca59fde8..291604a0c524e6887381d77d9a837263751793c2 100644 (file)
@@ -268,7 +268,7 @@ static int handle_poll_data(struct sr_dev_inst *sdi)
                ret = bv_get_value_len(&v, &pch->spec, poll_pkt, TC_POLL_LEN);
                if (ret != SR_OK)
                        break;
-               ret = feed_queue_analog_submit(devc->feeds[ch_idx], v, 1);
+               ret = feed_queue_analog_submit_one(devc->feeds[ch_idx], v, 1);
                if (ret != SR_OK)
                        break;
        }
index aa32768a6ff022dce664b5a10150cb697d1be0d0..806f9c2d49f0dc7b38691f2c69b823a1f3e2b12c 100644 (file)
@@ -214,7 +214,7 @@ static int process_data(struct sr_dev_inst *sdi,
                ret = bv_get_value_len(&v, &p->channels[ch_idx].spec, data, dlen);
                if (ret != SR_OK)
                        break;
-               ret = feed_queue_analog_submit(devc->feeds[ch_idx], v, 1);
+               ret = feed_queue_analog_submit_one(devc->feeds[ch_idx], v, 1);
                if (ret != SR_OK)
                        break;
        }
index 1647d8b0f2a6001a24cf2100ec5ff5aa6d38b024..4e01313dec0a33e26ddcf1b829656af56ce7e84f 100644 (file)
@@ -57,14 +57,14 @@ SR_API struct feed_queue_logic *feed_queue_logic_alloc(
        return q;
 }
 
-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_submit_one(struct feed_queue_logic *q,
+       const uint8_t *data, size_t repeat_count)
 {
        uint8_t *wrptr;
        int ret;
 
        wrptr = &q->data_bytes[q->fill_count * q->unit_size];
-       while (count--) {
+       while (repeat_count--) {
                memcpy(wrptr, data, q->unit_size);
                wrptr += q->unit_size;
                q->fill_count++;
@@ -201,12 +201,12 @@ SR_API int feed_queue_analog_scale_offset(struct feed_queue_analog *q,
        return SR_OK;
 }
 
-SR_API int feed_queue_analog_submit(struct feed_queue_analog *q,
-       float data, size_t count)
+SR_API int feed_queue_analog_submit_one(struct feed_queue_analog *q,
+       float data, size_t repeat_count)
 {
        int ret;
 
-       while (count--) {
+       while (repeat_count--) {
                q->data_values[q->fill_count++] = data;
                if (q->fill_count == q->alloc_count) {
                        ret = feed_queue_analog_flush(q);
index e8591b22296cec68b53ae6e2884fff3dbe0a0b10..c1d516f4aad08eefb6bbde29a011fb52cc088da8 100644 (file)
@@ -714,7 +714,8 @@ static int send_idle_capture(struct context *inc)
                return ret;
        count *= inc->curr_opts.samples_per_bit;
        while (count--) {
-               ret = feed_queue_logic_submit(inc->feed_logic, &data, sizeof(data));
+               ret = feed_queue_logic_submit_one(inc->feed_logic,
+                       &data, sizeof(data));
                if (ret != SR_OK)
                        return ret;
        }
@@ -738,7 +739,8 @@ static int send_idle_interframe(struct context *inc)
        if (ret != SR_OK)
                return ret;
        while (count--) {
-               ret = feed_queue_logic_submit(inc->feed_logic, &data, sizeof(data));
+               ret = feed_queue_logic_submit_one(inc->feed_logic,
+                       &data, sizeof(data));
                if (ret != SR_OK)
                        return ret;
        }
@@ -759,7 +761,7 @@ static int send_frame(struct sr_input *in)
                data = inc->sample_levels[index];
                count = inc->sample_widths[index];
                while (count--) {
-                       feed_queue_logic_submit(inc->feed_logic,
+                       feed_queue_logic_submit_one(inc->feed_logic,
                                &data, sizeof(data));
                }
        }
index 431b0cbc03893ba707cc3469d061d2f14bb72bdf..ddef5de6ee8bc2b72ef92f054329f194485e4c18 100644 (file)
@@ -623,7 +623,7 @@ static void add_sample(const struct sr_input *in, uint16_t data, size_t count)
                count -= inc->submit.samples_to_trigger;
        }
        if (send_first) {
-               (void)feed_queue_logic_submit(inc->submit.feed,
+               (void)feed_queue_logic_submit_one(inc->submit.feed,
                        unit_buffer, send_first);
                inc->submit.submit_count += send_first;
                inc->submit.samples_to_trigger -= send_first;
@@ -632,7 +632,7 @@ static void add_sample(const struct sr_input *in, uint16_t data, size_t count)
                feed_queue_logic_send_trigger(inc->submit.feed);
        }
        if (count) {
-               (void)feed_queue_logic_submit(inc->submit.feed,
+               (void)feed_queue_logic_submit_one(inc->submit.feed,
                        unit_buffer, count);
                inc->submit.submit_count += count;
                if (inc->submit.samples_to_trigger)
index bd7645714b447cb204e5e92618e458f0a593b88f..d5471a47163236f239fb7bef16d5fc9abcdf620b 100644 (file)
@@ -1152,7 +1152,7 @@ static void add_samples(const struct sr_input *in, size_t count, gboolean flush)
        inc = in->priv;
 
        if (inc->logic_count) {
-               feed_queue_logic_submit(inc->feed_logic,
+               feed_queue_logic_submit_one(inc->feed_logic,
                        inc->current_logic, count);
                if (flush)
                        feed_queue_logic_flush(inc->feed_logic);
@@ -1165,7 +1165,7 @@ static void add_samples(const struct sr_input *in, size_t count, gboolean flush)
                if (!q)
                        continue;
                value = inc->current_floats[vcd_ch->array_index];
-               feed_queue_analog_submit(q, value, count);
+               feed_queue_analog_submit_one(q, value, count);
                if (flush)
                        feed_queue_analog_flush(q);
        }
index c2c324c420917d5bb01ef8df268270d120e4cab1..7a67911dcc6240bd52443dfa9597f7c5c708a922 100644 (file)
@@ -2854,8 +2854,8 @@ struct feed_queue_analog;
 SR_API struct feed_queue_logic *feed_queue_logic_alloc(
        const struct sr_dev_inst *sdi,
        size_t sample_count, size_t unit_size);
-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_submit_one(struct feed_queue_logic *q,
+       const uint8_t *data, size_t repeat_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);
@@ -2867,8 +2867,8 @@ SR_API int feed_queue_analog_mq_unit(struct feed_queue_analog *q,
        enum sr_mq mq, enum sr_mqflag mq_flag, enum sr_unit unit);
 SR_API int feed_queue_analog_scale_offset(struct feed_queue_analog *q,
        const struct sr_rational *scale, const struct sr_rational *offset);
-SR_API int feed_queue_analog_submit(struct feed_queue_analog *q,
-       float data, size_t count);
+SR_API int feed_queue_analog_submit_one(struct feed_queue_analog *q,
+       float data, size_t repeat_count);
 SR_API int feed_queue_analog_flush(struct feed_queue_analog *q);
 SR_API void feed_queue_analog_free(struct feed_queue_analog *q);