*data = g_variant_new_uint64(devc->limit_samples);
break;
case SR_CONF_PATTERN_MODE:
- if (devc->flag_reg & FLAG_EXTERNAL_TEST_MODE)
+ if (devc->capture_flags & CAPTURE_FLAG_EXTERNAL_TEST_MODE)
*data = g_variant_new_string(STR_PATTERN_EXTERNAL);
- else if (devc->flag_reg & FLAG_INTERNAL_TEST_MODE)
+ else if (devc->capture_flags & CAPTURE_FLAG_INTERNAL_TEST_MODE)
*data = g_variant_new_string(STR_PATTERN_INTERNAL);
else
*data = g_variant_new_string(STR_PATTERN_NONE);
break;
case SR_CONF_RLE:
- *data = g_variant_new_boolean(devc->flag_reg & FLAG_RLE ? TRUE : FALSE);
+ *data = g_variant_new_boolean(devc->capture_flags & CAPTURE_FLAG_RLE ? TRUE : FALSE);
break;
default:
return SR_ERR_NA;
case SR_CONF_EXTERNAL_CLOCK:
if (g_variant_get_boolean(data)) {
sr_info("Enabling external clock.");
- devc->flag_reg |= FLAG_CLOCK_EXTERNAL;
+ devc->capture_flags |= CAPTURE_FLAG_CLOCK_EXTERNAL;
} else {
sr_info("Disabled external clock.");
- devc->flag_reg &= ~FLAG_CLOCK_EXTERNAL;
+ devc->capture_flags &= ~CAPTURE_FLAG_CLOCK_EXTERNAL;
}
break;
case SR_CONF_PATTERN_MODE:
flag = 0x0000;
} else if (!strcmp(stropt, STR_PATTERN_INTERNAL)) {
sr_info("Enabling internal test mode.");
- flag = FLAG_INTERNAL_TEST_MODE;
+ flag = CAPTURE_FLAG_INTERNAL_TEST_MODE;
} else if (!strcmp(stropt, STR_PATTERN_EXTERNAL)) {
sr_info("Enabling external test mode.");
- flag = FLAG_EXTERNAL_TEST_MODE;
+ flag = CAPTURE_FLAG_EXTERNAL_TEST_MODE;
} else {
return SR_ERR;
}
- devc->flag_reg &= ~FLAG_INTERNAL_TEST_MODE;
- devc->flag_reg &= ~FLAG_EXTERNAL_TEST_MODE;
- devc->flag_reg |= flag;
+ devc->capture_flags &= ~CAPTURE_FLAG_INTERNAL_TEST_MODE;
+ devc->capture_flags &= ~CAPTURE_FLAG_EXTERNAL_TEST_MODE;
+ devc->capture_flags |= flag;
break;
case SR_CONF_SWAP:
if (g_variant_get_boolean(data)) {
sr_info("Enabling channel swapping.");
- devc->flag_reg |= FLAG_SWAP_CHANNELS;
+ devc->capture_flags |= CAPTURE_FLAG_SWAP_CHANNELS;
} else {
sr_info("Disabling channel swapping.");
- devc->flag_reg &= ~FLAG_SWAP_CHANNELS;
+ devc->capture_flags &= ~CAPTURE_FLAG_SWAP_CHANNELS;
}
break;
case SR_CONF_RLE:
if (g_variant_get_boolean(data)) {
sr_info("Enabling RLE.");
- devc->flag_reg |= FLAG_RLE;
+ devc->capture_flags |= CAPTURE_FLAG_RLE;
} else {
sr_info("Disabling RLE.");
- devc->flag_reg &= ~FLAG_RLE;
+ devc->capture_flags &= ~CAPTURE_FLAG_RLE;
}
break;
default:
if (!sdi)
return SR_ERR_ARG;
devc = sdi->priv;
- if (devc->flag_reg & FLAG_RLE)
+ if (devc->capture_flags & CAPTURE_FLAG_RLE)
return SR_ERR_NA;
if (devc->max_samples == 0)
/* Device didn't specify sample memory size in metadata. */
/* Flag register. */
sr_dbg("Setting intpat %s, extpat %s, RLE %s, noise_filter %s, demux %s",
- devc->flag_reg & FLAG_INTERNAL_TEST_MODE ? "on": "off",
- devc->flag_reg & FLAG_EXTERNAL_TEST_MODE ? "on": "off",
- devc->flag_reg & FLAG_RLE ? "on" : "off",
- devc->flag_reg & FLAG_FILTER ? "on": "off",
- devc->flag_reg & FLAG_DEMUX ? "on" : "off");
+ devc->capture_flags & CAPTURE_FLAG_INTERNAL_TEST_MODE ? "on": "off",
+ devc->capture_flags & CAPTURE_FLAG_EXTERNAL_TEST_MODE ? "on": "off",
+ devc->capture_flags & CAPTURE_FLAG_RLE ? "on" : "off",
+ devc->capture_flags & CAPTURE_FLAG_NOISE_FILTER ? "on": "off",
+ devc->capture_flags & CAPTURE_FLAG_DEMUX ? "on" : "off");
/*
* Enable/disable OLS channel groups in the flag register according
* to the channel mask. 1 means "disable channel".
*/
- devc->flag_reg |= ~(ols_changrp_mask << 2) & 0x3c;
- arg[0] = devc->flag_reg & 0xff;
- arg[1] = devc->flag_reg >> 8;
+ devc->capture_flags |= ~(ols_changrp_mask << 2) & 0x3c;
+ arg[0] = devc->capture_flags & 0xff;
+ arg[1] = devc->capture_flags >> 8;
arg[2] = arg[3] = 0x00;
if (send_longcommand(serial, CMD_SET_FLAGS, arg) != SR_OK)
return SR_ERR;
if (samplerate > CLOCK_RATE) {
sr_info("Enabling demux mode.");
- devc->flag_reg |= FLAG_DEMUX;
- devc->flag_reg &= ~FLAG_FILTER;
+ devc->capture_flags |= CAPTURE_FLAG_DEMUX;
+ devc->capture_flags &= ~CAPTURE_FLAG_NOISE_FILTER;
devc->cur_samplerate_divider = (CLOCK_RATE * 2 / samplerate) - 1;
} else {
sr_info("Disabling demux mode.");
- devc->flag_reg &= ~FLAG_DEMUX;
- devc->flag_reg |= FLAG_FILTER;
+ devc->capture_flags &= ~CAPTURE_FLAG_DEMUX;
+ devc->capture_flags |= CAPTURE_FLAG_NOISE_FILTER;
devc->cur_samplerate_divider = (CLOCK_RATE / samplerate) - 1;
}
* from the requested.
*/
devc->cur_samplerate = CLOCK_RATE / (devc->cur_samplerate_divider + 1);
- if (devc->flag_reg & FLAG_DEMUX)
+ if (devc->capture_flags & CAPTURE_FLAG_DEMUX)
devc->cur_samplerate *= 2;
if (devc->cur_samplerate != samplerate)
sr_info("Can't match samplerate %" PRIu64 ", using %"
num_ols_changrp = 0;
for (i = 0x20; i > 0x02; i >>= 1) {
- if ((devc->flag_reg & i) == 0) {
+ if ((devc->capture_flags & i) == 0) {
num_ols_changrp++;
}
}
sample = devc->sample[0] | (devc->sample[1] << 8) \
| (devc->sample[2] << 16) | (devc->sample[3] << 24);
sr_dbg("Received sample 0x%.*x.", devc->num_bytes * 2, sample);
- if (devc->flag_reg & FLAG_RLE) {
+ if (devc->capture_flags & CAPTURE_FLAG_RLE) {
/*
* In RLE mode the high bit of the sample is the
* "count" flag, meaning this sample is the number
j = 0;
memset(devc->tmp_sample, 0, 4);
for (i = 0; i < 4; i++) {
- if (((devc->flag_reg >> 2) & (1 << i)) == 0) {
+ if (((devc->capture_flags >> 2) & (1 << i)) == 0) {
/*
* This channel group was
* enabled, copy from received
* sample.
*/
devc->tmp_sample[i] = devc->sample[j++];
- } else if (devc->flag_reg & FLAG_DEMUX && (i > 2)) {
+ } else if (devc->capture_flags & CAPTURE_FLAG_DEMUX && (i > 2)) {
/* group 2 & 3 get added to 0 & 1 */
devc->tmp_sample[i - 2] = devc->sample[j++];
}
/* Trigger config */
#define TRIGGER_START (1 << 3)
-/* Bitmasks for CMD_FLAGS */
+/* Bitmasks for capture_flags */
/* 12-13 unused, 14-15 RLE mode (we hardcode mode 0). */
-#define FLAG_INTERNAL_TEST_MODE (1 << 11)
-#define FLAG_EXTERNAL_TEST_MODE (1 << 10)
-#define FLAG_SWAP_CHANNELS (1 << 9)
-#define FLAG_RLE (1 << 8)
-#define FLAG_SLOPE_FALLING (1 << 7)
-#define FLAG_CLOCK_EXTERNAL (1 << 6)
-#define FLAG_CHANNELGROUP_4 (1 << 5)
-#define FLAG_CHANNELGROUP_3 (1 << 4)
-#define FLAG_CHANNELGROUP_2 (1 << 3)
-#define FLAG_CHANNELGROUP_1 (1 << 2)
-#define FLAG_FILTER (1 << 1)
-#define FLAG_DEMUX (1 << 0)
+#define CAPTURE_FLAG_INTERNAL_TEST_MODE (1 << 11)
+#define CAPTURE_FLAG_EXTERNAL_TEST_MODE (1 << 10)
+#define CAPTURE_FLAG_SWAP_CHANNELS (1 << 9)
+#define CAPTURE_FLAG_RLE (1 << 8)
+#define CAPTURE_FLAG_SLOPE_FALLING (1 << 7)
+#define CAPTURE_FLAG_CLOCK_EXTERNAL (1 << 6)
+#define CAPTURE_FLAG_CHANNELGROUP_4 (1 << 5)
+#define CAPTURE_FLAG_CHANNELGROUP_3 (1 << 4)
+#define CAPTURE_FLAG_CHANNELGROUP_2 (1 << 3)
+#define CAPTURE_FLAG_CHANNELGROUP_1 (1 << 2)
+#define CAPTURE_FLAG_NOISE_FILTER (1 << 1)
+#define CAPTURE_FLAG_DEMUX (1 << 0)
/* Capture context magic numbers */
#define OLS_NO_TRIGGER (-1)
uint32_t trigger_mask[NUM_TRIGGER_STAGES];
uint32_t trigger_value[NUM_TRIGGER_STAGES];
int num_stages;
- uint16_t flag_reg;
+ uint16_t capture_flags;
unsigned int num_transfers;
unsigned int num_samples;