#define LOG_PREFIX "demo"
-#define DEFAULT_NUM_LOGIC_PROBES 8
-#define DEFAULT_NUM_ANALOG_PROBES 4
+#define DEFAULT_NUM_LOGIC_CHANNELS 8
+#define DEFAULT_NUM_ANALOG_CHANNELS 4
/* The size in bytes of chunks to send through the session bus. */
#define LOGIC_BUFSIZE 4096
/**
* Spells "sigrok" across 8 channels using '0's (with '1's as
* "background") when displayed using the 'bits' output format.
- * The pattern is repeasted every 8 channels, shifted to the right
+ * The pattern is repeated every 8 channels, shifted to the right
* in time by one bit.
*/
PATTERN_SIGROK,
PATTERN_RANDOM,
/**
- * Incrementing number across 8 channels. The pattern is repeasted
+ * Incrementing number across 8 channels. The pattern is repeated
* every 8 channels, shifted to the right in time by one bit.
*/
PATTERN_INC,
};
static const int32_t scanopts[] = {
- SR_CONF_NUM_LOGIC_PROBES,
- SR_CONF_NUM_ANALOG_PROBES,
+ SR_CONF_NUM_LOGIC_CHANNELS,
+ SR_CONF_NUM_ANALOG_CHANNELS,
};
static const int devopts[] = {
drvc = di->priv;
- num_logic_channels = DEFAULT_NUM_LOGIC_PROBES;
- num_analog_channels = DEFAULT_NUM_ANALOG_PROBES;
+ num_logic_channels = DEFAULT_NUM_LOGIC_CHANNELS;
+ num_analog_channels = DEFAULT_NUM_ANALOG_CHANNELS;
for (l = options; l; l = l->next) {
src = l->data;
switch (src->key) {
- case SR_CONF_NUM_LOGIC_PROBES:
+ case SR_CONF_NUM_LOGIC_CHANNELS:
num_logic_channels = g_variant_get_int32(src->data);
break;
- case SR_CONF_NUM_ANALOG_PROBES:
+ case SR_CONF_NUM_ANALOG_CHANNELS:
num_analog_channels = g_variant_get_int32(src->data);
break;
}
cg->priv = NULL;
for (i = 0; i < num_logic_channels; i++) {
sprintf(channel_name, "D%d", i);
- if (!(ch = sr_probe_new(i, SR_PROBE_LOGIC, TRUE, channel_name)))
+ if (!(ch = sr_channel_new(i, SR_CHANNEL_LOGIC, TRUE, channel_name)))
return NULL;
sdi->channels = g_slist_append(sdi->channels, ch);
cg->channels = g_slist_append(cg->channels, ch);
pattern = 0;
for (i = 0; i < num_analog_channels; i++) {
sprintf(channel_name, "A%d", i);
- if (!(ch = sr_probe_new(i + num_logic_channels,
- SR_PROBE_ANALOG, TRUE, channel_name)))
+ if (!(ch = sr_channel_new(i + num_logic_channels,
+ SR_CHANNEL_ANALOG, TRUE, channel_name)))
return NULL;
sdi->channels = g_slist_append(sdi->channels, ch);
if (!cg)
return SR_ERR_CHANNEL_GROUP;
ch = cg->channels->data;
- if (ch->type == SR_PROBE_LOGIC) {
+ if (ch->type == SR_CHANNEL_LOGIC) {
pattern = devc->logic_pattern;
*data = g_variant_new_string(logic_pattern_str[pattern]);
- } else if (ch->type == SR_PROBE_ANALOG) {
+ } else if (ch->type == SR_CHANNEL_ANALOG) {
ag = cg->priv;
pattern = ag->pattern;
*data = g_variant_new_string(analog_pattern_str[pattern]);
} else
return SR_ERR_BUG;
break;
- case SR_CONF_NUM_LOGIC_PROBES:
+ case SR_CONF_NUM_LOGIC_CHANNELS:
*data = g_variant_new_int32(devc->num_logic_channels);
break;
- case SR_CONF_NUM_ANALOG_PROBES:
+ case SR_CONF_NUM_ANALOG_CHANNELS:
*data = g_variant_new_int32(devc->num_analog_channels);
break;
default:
stropt = g_variant_get_string(data, NULL);
ch = cg->channels->data;
pattern = -1;
- if (ch->type == SR_PROBE_LOGIC) {
+ if (ch->type == SR_CHANNEL_LOGIC) {
for (i = 0; i < ARRAY_SIZE(logic_pattern_str); i++) {
if (!strcmp(stropt, logic_pattern_str[i])) {
pattern = i;
memset(devc->logic_data, 0xff, LOGIC_BUFSIZE);
sr_dbg("Setting logic pattern to %s",
logic_pattern_str[pattern]);
- } else if (ch->type == SR_PROBE_ANALOG) {
+ } else if (ch->type == SR_CHANNEL_ANALOG) {
for (i = 0; i < ARRAY_SIZE(analog_pattern_str); i++) {
if (!strcmp(stropt, analog_pattern_str[i])) {
pattern = i;
devopts_cg, ARRAY_SIZE(devopts_cg), sizeof(int32_t));
break;
case SR_CONF_PATTERN_MODE:
- if (ch->type == SR_PROBE_LOGIC)
+ if (ch->type == SR_CHANNEL_LOGIC)
*data = g_variant_new_strv(logic_pattern_str,
ARRAY_SIZE(logic_pattern_str));
- else if (ch->type == SR_PROBE_ANALOG)
+ else if (ch->type == SR_CHANNEL_ANALOG)
*data = g_variant_new_strv(analog_pattern_str,
ARRAY_SIZE(analog_pattern_str));
else
GSList *l;
struct dev_context *devc;
+ (void)cb_data;
+
if (sdi->status != SR_ST_ACTIVE)
return SR_ERR_DEV_CLOSED;
/* Make channels to unbuffered. */
g_io_channel_set_buffered(devc->channel, FALSE);
- sr_session_source_add_channel(devc->channel, G_IO_IN | G_IO_ERR,
+ sr_session_source_add_channel(sdi->session, devc->channel, G_IO_IN | G_IO_ERR,
40, prepare_data, (void *)sdi);
/* Send header packet to the session bus. */
- std_session_send_df_header(cb_data, LOG_PREFIX);
+ std_session_send_df_header(sdi, LOG_PREFIX);
/* We use this timestamp to decide how many more samples to send. */
devc->starttime = g_get_monotonic_time();
devc = sdi->priv;
sr_dbg("Stopping acquisition.");
- sr_session_source_remove_channel(devc->channel);
+ sr_session_source_remove_channel(sdi->session, devc->channel);
g_io_channel_shutdown(devc->channel, FALSE, NULL);
g_io_channel_unref(devc->channel);
devc->channel = NULL;