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.
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;
* 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;
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);
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);
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;
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;
}
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;
}
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++;
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);
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;
}
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;
}
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));
}
}
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;
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)
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);
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);
}
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);
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);