std_session_send_df_header(sdi);
+ if (SAMPLES_PER_FRAME > 0)
+ std_session_send_frame_begin(sdi);
+
/* We use this timestamp to decide how many more samples to send. */
devc->start_us = g_get_monotonic_time();
devc->spent_us = 0;
static int dev_acquisition_stop(struct sr_dev_inst *sdi)
{
sr_session_source_remove(sdi->session, -1);
+
+ if (SAMPLES_PER_FRAME > 0)
+ std_session_send_frame_end(sdi);
+
std_session_send_df_end(sdi);
return SR_OK;
/* How many samples are outstanding since the last round? */
samples_todo = (todo_us * devc->cur_samplerate + G_USEC_PER_SEC - 1)
/ G_USEC_PER_SEC;
+
+ if (SAMPLES_PER_FRAME > 0)
+ samples_todo = SAMPLES_PER_FRAME;
+
if (devc->limit_samples > 0) {
if (devc->limit_samples < devc->sent_samples)
samples_todo = 0;
else if (devc->limit_samples - devc->sent_samples < samples_todo)
samples_todo = devc->limit_samples - devc->sent_samples;
}
+
/* Calculate the actual time covered by this run back from the sample
* count, rounded towards zero. This avoids getting stuck on a too-low
* time delta with no samples being sent due to round-off.
}
sr_dbg("Requested number of samples reached.");
sr_dev_acquisition_stop(sdi);
+ } else {
+ if (SAMPLES_PER_FRAME > 0) {
+ std_session_send_frame_end(sdi);
+ std_session_send_frame_begin(sdi);
+ }
}
return G_SOURCE_CONTINUE;
#define LOGIC_BUFSIZE 4096
/* Size of the analog pattern space per channel. */
#define ANALOG_BUFSIZE 4096
+/* This is a development feature: it starts a new frame every n samples. */
+#define SAMPLES_PER_FRAME 0
struct dev_context {
uint64_t cur_samplerate;