return SR_ERR;
delaycount = readcount * (1 - devc->capture_ratio / 100.0);
- devc->trigger_at = (readcount - delaycount) * 4 - devc->num_stages;
+ devc->trigger_at_smpl = (readcount - delaycount) * 4 - devc->num_stages;
for (i = 0; i <= devc->num_stages; i++) {
sr_dbg("Setting OLS stage %d trigger.", i);
if ((ret = set_trigger(sdi, i)) != SR_OK)
struct dev_context *devc;
devc = g_malloc0(sizeof(struct dev_context));
- devc->trigger_at = -1;
+ devc->trigger_at_smpl = OLS_NO_TRIGGER;
return devc;
}
sr_dbg("Received %d bytes, %d samples, %d decompressed samples.",
devc->cnt_bytes, devc->cnt_samples,
devc->cnt_samples_rle);
- if (devc->trigger_at != -1) {
+ if (devc->trigger_at_smpl != OLS_NO_TRIGGER) {
/*
* A trigger was set up, so we need to tell the frontend
* about it.
*/
- if (devc->trigger_at > 0) {
+ if (devc->trigger_at_smpl > 0) {
/* There are pre-trigger samples, send those first. */
packet.type = SR_DF_LOGIC;
packet.payload = &logic;
- logic.length = devc->trigger_at * 4;
+ logic.length = devc->trigger_at_smpl * 4;
logic.unitsize = 4;
logic.data = devc->raw_sample_buf +
(devc->limit_samples - devc->num_samples) * 4;
/* Send post-trigger samples. */
packet.type = SR_DF_LOGIC;
packet.payload = &logic;
- logic.length = (devc->num_samples * 4) - (devc->trigger_at * 4);
+ logic.length = (devc->num_samples * 4) - (devc->trigger_at_smpl * 4);
logic.unitsize = 4;
- logic.data = devc->raw_sample_buf + devc->trigger_at * 4 +
+ logic.data = devc->raw_sample_buf + devc->trigger_at_smpl * 4 +
(devc->limit_samples - devc->num_samples) * 4;
sr_session_send(sdi, &packet);
} else {
#define FLAG_FILTER (1 << 1)
#define FLAG_DEMUX (1 << 0)
+/* Capture context magic numbers */
+#define OLS_NO_TRIGGER (-1)
+
struct dev_context {
/* constant device properties: */
int max_channels;
uint32_t cur_samplerate_divider;
uint64_t limit_samples;
uint64_t capture_ratio;
- int trigger_at;
+ int trigger_at_smpl;
uint32_t channel_mask;
uint32_t trigger_mask[NUM_TRIGGER_STAGES];
uint32_t trigger_value[NUM_TRIGGER_STAGES];