Replace some 'pg' with 'cg'.
(since 'probe groups' are now called 'channel groups') This fixes parts of bug #259.
This commit is contained in:
parent
660e398fe9
commit
40fd0264f9
|
@ -43,7 +43,7 @@ static const int32_t devopts[] = {
|
||||||
SR_CONF_OVER_CURRENT_PROTECTION,
|
SR_CONF_OVER_CURRENT_PROTECTION,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const int32_t devopts_pg[] = {
|
static const int32_t devopts_cg[] = {
|
||||||
SR_CONF_OUTPUT_VOLTAGE,
|
SR_CONF_OUTPUT_VOLTAGE,
|
||||||
SR_CONF_OUTPUT_VOLTAGE_MAX,
|
SR_CONF_OUTPUT_VOLTAGE_MAX,
|
||||||
SR_CONF_OUTPUT_CURRENT,
|
SR_CONF_OUTPUT_CURRENT,
|
||||||
|
@ -88,7 +88,7 @@ static GSList *scan(GSList *options, int modelid)
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
struct sr_config *src;
|
struct sr_config *src;
|
||||||
struct sr_probe *probe;
|
struct sr_probe *probe;
|
||||||
struct sr_channel_group *pg;
|
struct sr_channel_group *cg;
|
||||||
struct sr_serial_dev_inst *serial;
|
struct sr_serial_dev_inst *serial;
|
||||||
GSList *l, *devices;
|
GSList *l, *devices;
|
||||||
struct pps_model *model;
|
struct pps_model *model;
|
||||||
|
@ -169,11 +169,11 @@ static GSList *scan(GSList *options, int modelid)
|
||||||
snprintf(channel, 10, "CH%d", i + 1);
|
snprintf(channel, 10, "CH%d", i + 1);
|
||||||
probe = sr_probe_new(i, SR_PROBE_ANALOG, TRUE, channel);
|
probe = sr_probe_new(i, SR_PROBE_ANALOG, TRUE, channel);
|
||||||
sdi->probes = g_slist_append(sdi->probes, probe);
|
sdi->probes = g_slist_append(sdi->probes, probe);
|
||||||
pg = g_malloc(sizeof(struct sr_channel_group));
|
cg = g_malloc(sizeof(struct sr_channel_group));
|
||||||
pg->name = g_strdup(channel);
|
cg->name = g_strdup(channel);
|
||||||
pg->probes = g_slist_append(NULL, probe);
|
cg->probes = g_slist_append(NULL, probe);
|
||||||
pg->priv = NULL;
|
cg->priv = NULL;
|
||||||
sdi->channel_groups = g_slist_append(sdi->channel_groups, pg);
|
sdi->channel_groups = g_slist_append(sdi->channel_groups, cg);
|
||||||
}
|
}
|
||||||
|
|
||||||
devc = g_malloc0(sizeof(struct dev_context));
|
devc = g_malloc0(sizeof(struct dev_context));
|
||||||
|
@ -409,7 +409,7 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
||||||
switch (key) {
|
switch (key) {
|
||||||
case SR_CONF_DEVICE_OPTIONS:
|
case SR_CONF_DEVICE_OPTIONS:
|
||||||
*data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32,
|
*data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32,
|
||||||
devopts_pg, ARRAY_SIZE(devopts_pg), sizeof(int32_t));
|
devopts_cg, ARRAY_SIZE(devopts_cg), sizeof(int32_t));
|
||||||
break;
|
break;
|
||||||
case SR_CONF_OUTPUT_VOLTAGE_MAX:
|
case SR_CONF_OUTPUT_VOLTAGE_MAX:
|
||||||
g_variant_builder_init(&gvb, G_VARIANT_TYPE_ARRAY);
|
g_variant_builder_init(&gvb, G_VARIANT_TYPE_ARRAY);
|
||||||
|
|
|
@ -139,7 +139,7 @@ static const int devopts[] = {
|
||||||
SR_CONF_LIMIT_MSEC,
|
SR_CONF_LIMIT_MSEC,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const int devopts_pg[] = {
|
static const int devopts_cg[] = {
|
||||||
SR_CONF_PATTERN_MODE,
|
SR_CONF_PATTERN_MODE,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -257,7 +257,7 @@ static GSList *scan(GSList *options)
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
struct sr_dev_inst *sdi;
|
struct sr_dev_inst *sdi;
|
||||||
struct sr_probe *probe;
|
struct sr_probe *probe;
|
||||||
struct sr_channel_group *pg;
|
struct sr_channel_group *cg;
|
||||||
struct sr_config *src;
|
struct sr_config *src;
|
||||||
struct analog_gen *ag;
|
struct analog_gen *ag;
|
||||||
GSList *devices, *l;
|
GSList *devices, *l;
|
||||||
|
@ -303,19 +303,19 @@ static GSList *scan(GSList *options)
|
||||||
devc->analog_channel_groups = NULL;
|
devc->analog_channel_groups = NULL;
|
||||||
|
|
||||||
/* Logic probes, all in one channel group. */
|
/* Logic probes, all in one channel group. */
|
||||||
if (!(pg = g_try_malloc(sizeof(struct sr_channel_group))))
|
if (!(cg = g_try_malloc(sizeof(struct sr_channel_group))))
|
||||||
return NULL;
|
return NULL;
|
||||||
pg->name = g_strdup("Logic");
|
cg->name = g_strdup("Logic");
|
||||||
pg->probes = NULL;
|
cg->probes = NULL;
|
||||||
pg->priv = NULL;
|
cg->priv = NULL;
|
||||||
for (i = 0; i < num_logic_probes; i++) {
|
for (i = 0; i < num_logic_probes; i++) {
|
||||||
sprintf(probe_name, "D%d", i);
|
sprintf(probe_name, "D%d", i);
|
||||||
if (!(probe = sr_probe_new(i, SR_PROBE_LOGIC, TRUE, probe_name)))
|
if (!(probe = sr_probe_new(i, SR_PROBE_LOGIC, TRUE, probe_name)))
|
||||||
return NULL;
|
return NULL;
|
||||||
sdi->probes = g_slist_append(sdi->probes, probe);
|
sdi->probes = g_slist_append(sdi->probes, probe);
|
||||||
pg->probes = g_slist_append(pg->probes, probe);
|
cg->probes = g_slist_append(cg->probes, probe);
|
||||||
}
|
}
|
||||||
sdi->channel_groups = g_slist_append(NULL, pg);
|
sdi->channel_groups = g_slist_append(NULL, cg);
|
||||||
|
|
||||||
/* Analog probes, channel groups and pattern generators. */
|
/* Analog probes, channel groups and pattern generators. */
|
||||||
|
|
||||||
|
@ -328,24 +328,24 @@ static GSList *scan(GSList *options)
|
||||||
sdi->probes = g_slist_append(sdi->probes, probe);
|
sdi->probes = g_slist_append(sdi->probes, probe);
|
||||||
|
|
||||||
/* Every analog probe gets its own channel group. */
|
/* Every analog probe gets its own channel group. */
|
||||||
if (!(pg = g_try_malloc(sizeof(struct sr_channel_group))))
|
if (!(cg = g_try_malloc(sizeof(struct sr_channel_group))))
|
||||||
return NULL;
|
return NULL;
|
||||||
pg->name = g_strdup(probe_name);
|
cg->name = g_strdup(probe_name);
|
||||||
pg->probes = g_slist_append(NULL, probe);
|
cg->probes = g_slist_append(NULL, probe);
|
||||||
|
|
||||||
/* Every channel group gets a generator struct. */
|
/* Every channel group gets a generator struct. */
|
||||||
if (!(ag = g_try_malloc(sizeof(struct analog_gen))))
|
if (!(ag = g_try_malloc(sizeof(struct analog_gen))))
|
||||||
return NULL;
|
return NULL;
|
||||||
ag->packet.probes = pg->probes;
|
ag->packet.probes = cg->probes;
|
||||||
ag->packet.mq = 0;
|
ag->packet.mq = 0;
|
||||||
ag->packet.mqflags = 0;
|
ag->packet.mqflags = 0;
|
||||||
ag->packet.unit = SR_UNIT_VOLT;
|
ag->packet.unit = SR_UNIT_VOLT;
|
||||||
ag->packet.data = ag->pattern_data;
|
ag->packet.data = ag->pattern_data;
|
||||||
ag->pattern = pattern;
|
ag->pattern = pattern;
|
||||||
pg->priv = ag;
|
cg->priv = ag;
|
||||||
|
|
||||||
sdi->channel_groups = g_slist_append(sdi->channel_groups, pg);
|
sdi->channel_groups = g_slist_append(sdi->channel_groups, cg);
|
||||||
devc->analog_channel_groups = g_slist_append(devc->analog_channel_groups, pg);
|
devc->analog_channel_groups = g_slist_append(devc->analog_channel_groups, cg);
|
||||||
|
|
||||||
if (++pattern == ARRAY_SIZE(analog_pattern_str))
|
if (++pattern == ARRAY_SIZE(analog_pattern_str))
|
||||||
pattern = 0;
|
pattern = 0;
|
||||||
|
@ -549,7 +549,7 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
||||||
switch (key) {
|
switch (key) {
|
||||||
case SR_CONF_DEVICE_OPTIONS:
|
case SR_CONF_DEVICE_OPTIONS:
|
||||||
*data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32,
|
*data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32,
|
||||||
devopts_pg, ARRAY_SIZE(devopts_pg), sizeof(int32_t));
|
devopts_cg, ARRAY_SIZE(devopts_cg), sizeof(int32_t));
|
||||||
break;
|
break;
|
||||||
case SR_CONF_PATTERN_MODE:
|
case SR_CONF_PATTERN_MODE:
|
||||||
if (probe->type == SR_PROBE_LOGIC)
|
if (probe->type == SR_PROBE_LOGIC)
|
||||||
|
@ -617,7 +617,7 @@ static int prepare_data(int fd, int revents, void *cb_data)
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
struct sr_datafeed_packet packet;
|
struct sr_datafeed_packet packet;
|
||||||
struct sr_datafeed_logic logic;
|
struct sr_datafeed_logic logic;
|
||||||
struct sr_channel_group *pg;
|
struct sr_channel_group *cg;
|
||||||
struct analog_gen *ag;
|
struct analog_gen *ag;
|
||||||
GSList *l;
|
GSList *l;
|
||||||
uint64_t logic_todo, analog_todo, expected_samplenum, analog_samples, sending_now;
|
uint64_t logic_todo, analog_todo, expected_samplenum, analog_samples, sending_now;
|
||||||
|
@ -658,8 +658,8 @@ static int prepare_data(int fd, int revents, void *cb_data)
|
||||||
if (devc->num_analog_probes > 0 && analog_todo > 0) {
|
if (devc->num_analog_probes > 0 && analog_todo > 0) {
|
||||||
sending_now = 0;
|
sending_now = 0;
|
||||||
for (l = devc->analog_channel_groups; l; l = l->next) {
|
for (l = devc->analog_channel_groups; l; l = l->next) {
|
||||||
pg = l->data;
|
cg = l->data;
|
||||||
ag = pg->priv;
|
ag = cg->priv;
|
||||||
packet.type = SR_DF_ANALOG;
|
packet.type = SR_DF_ANALOG;
|
||||||
packet.payload = &ag->packet;
|
packet.payload = &ag->packet;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue