From: Uwe Hermann Date: Fri, 14 Mar 2014 20:21:09 +0000 (+0100) Subject: Replace channel_group.probes with channel_group.channels. X-Git-Tag: libsigrok-0.3.0~111 X-Git-Url: http://sigrok.org/gitweb/?p=libsigrok.git;a=commitdiff_plain;h=a68bf88e3a6ba0184f1d6aea4ce26b9a2950a513 Replace channel_group.probes with channel_group.channels. This fixes parts of bug #259. --- diff --git a/hardware/atten-pps3xxx/api.c b/hardware/atten-pps3xxx/api.c index 1ed78718..a52c4e4d 100644 --- a/hardware/atten-pps3xxx/api.c +++ b/hardware/atten-pps3xxx/api.c @@ -171,7 +171,7 @@ static GSList *scan(GSList *options, int modelid) sdi->probes = g_slist_append(sdi->probes, probe); cg = g_malloc(sizeof(struct sr_channel_group)); cg->name = g_strdup(channel); - cg->probes = g_slist_append(NULL, probe); + cg->channels = g_slist_append(NULL, probe); cg->priv = NULL; sdi->channel_groups = g_slist_append(sdi->channel_groups, cg); } @@ -232,7 +232,7 @@ static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi, } } else { /* We only ever have one channel per channel group in this driver. */ - probe = channel_group->probes->data; + probe = channel_group->channels->data; channel = probe->index; switch (key) { @@ -323,7 +323,7 @@ static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi, } else { /* Channel group specified: per-channel options. */ /* We only ever have one channel per channel group in this driver. */ - probe = channel_group->probes->data; + probe = channel_group->channels->data; channel = probe->index; switch (key) { @@ -403,7 +403,7 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, if (!sdi) return SR_ERR_ARG; /* We only ever have one channel per channel group in this driver. */ - probe = channel_group->probes->data; + probe = channel_group->channels->data; channel = probe->index; switch (key) { diff --git a/hardware/demo/demo.c b/hardware/demo/demo.c index 754e72f7..19742309 100644 --- a/hardware/demo/demo.c +++ b/hardware/demo/demo.c @@ -306,14 +306,14 @@ static GSList *scan(GSList *options) if (!(cg = g_try_malloc(sizeof(struct sr_channel_group)))) return NULL; cg->name = g_strdup("Logic"); - cg->probes = NULL; + cg->channels = NULL; cg->priv = NULL; for (i = 0; i < num_logic_probes; i++) { sprintf(probe_name, "D%d", i); if (!(probe = sr_probe_new(i, SR_PROBE_LOGIC, TRUE, probe_name))) return NULL; sdi->probes = g_slist_append(sdi->probes, probe); - cg->probes = g_slist_append(cg->probes, probe); + cg->channels = g_slist_append(cg->channels, probe); } sdi->channel_groups = g_slist_append(NULL, cg); @@ -331,12 +331,12 @@ static GSList *scan(GSList *options) if (!(cg = g_try_malloc(sizeof(struct sr_channel_group)))) return NULL; cg->name = g_strdup(probe_name); - cg->probes = g_slist_append(NULL, probe); + cg->channels = g_slist_append(NULL, probe); /* Every channel group gets a generator struct. */ if (!(ag = g_try_malloc(sizeof(struct analog_gen)))) return NULL; - ag->packet.probes = cg->probes; + ag->packet.probes = cg->channels; ag->packet.mq = 0; ag->packet.mqflags = 0; ag->packet.unit = SR_UNIT_VOLT; @@ -407,7 +407,7 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi, case SR_CONF_PATTERN_MODE: if (!channel_group) return SR_ERR_CHANNEL_GROUP; - probe = channel_group->probes->data; + probe = channel_group->channels->data; if (probe->type == SR_PROBE_LOGIC) { pattern = devc->logic_pattern; *data = g_variant_new_string(logic_pattern_str[pattern]); @@ -466,7 +466,7 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, if (!channel_group) return SR_ERR_CHANNEL_GROUP; stropt = g_variant_get_string(data, NULL); - probe = channel_group->probes->data; + probe = channel_group->channels->data; pattern = -1; if (probe->type == SR_PROBE_LOGIC) { for (i = 0; i < ARRAY_SIZE(logic_pattern_str); i++) { @@ -545,7 +545,7 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, return SR_ERR_NA; } } else { - probe = channel_group->probes->data; + probe = channel_group->channels->data; switch (key) { case SR_CONF_DEVICE_OPTIONS: *data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32, diff --git a/hardware/hameg-hmo/api.c b/hardware/hameg-hmo/api.c index 243b8d6d..6b6e5ab7 100644 --- a/hardware/hameg-hmo/api.c +++ b/hardware/hameg-hmo/api.c @@ -133,10 +133,10 @@ static void clear_helper(void *priv) hmo_scope_state_free(devc->model_state); for (i = 0; i < model->analog_channels; ++i) - g_slist_free(devc->analog_groups[i].probes); + g_slist_free(devc->analog_groups[i].channels); for (i = 0; i < model->digital_pods; ++i) { - g_slist_free(devc->digital_groups[i].probes); + g_slist_free(devc->digital_groups[i].channels); g_free(devc->digital_groups[i].name); } diff --git a/hardware/hameg-hmo/protocol.c b/hardware/hameg-hmo/protocol.c index 263e4f9c..6dda2d35 100644 --- a/hardware/hameg-hmo/protocol.c +++ b/hardware/hameg-hmo/protocol.c @@ -621,7 +621,7 @@ SR_PRIV int hmo_init_device(struct sr_dev_inst *sdi) devc->analog_groups[i].name = (char *)(*scope_models[model_index].analog_names)[i]; - devc->analog_groups[i].probes = g_slist_append(NULL, probe); + devc->analog_groups[i].channels = g_slist_append(NULL, probe); sdi->channel_groups = g_slist_append(sdi->channel_groups, &devc->analog_groups[i]); @@ -642,8 +642,8 @@ SR_PRIV int hmo_init_device(struct sr_dev_inst *sdi) return SR_ERR_MALLOC; sdi->probes = g_slist_append(sdi->probes, probe); - devc->digital_groups[i < 8 ? 0 : 1].probes = g_slist_append( - devc->digital_groups[i < 8 ? 0 : 1].probes, probe); + devc->digital_groups[i < 8 ? 0 : 1].channels = g_slist_append( + devc->digital_groups[i < 8 ? 0 : 1].channels, probe); } devc->model_config = &scope_models[model_index]; diff --git a/hardware/rigol-ds/api.c b/hardware/rigol-ds/api.c index 1ce9c6cd..917e3de6 100644 --- a/hardware/rigol-ds/api.c +++ b/hardware/rigol-ds/api.c @@ -240,9 +240,9 @@ static void clear_helper(void *priv) g_free(devc->coupling[1]); g_free(devc->trigger_source); g_free(devc->trigger_slope); - g_slist_free(devc->analog_groups[0].probes); - g_slist_free(devc->analog_groups[1].probes); - g_slist_free(devc->digital_group.probes); + g_slist_free(devc->analog_groups[0].channels); + g_slist_free(devc->analog_groups[1].channels); + g_slist_free(devc->digital_group.channels); } static int dev_clear(void) @@ -338,7 +338,7 @@ static struct sr_dev_inst *probe_device(struct sr_scpi_dev_inst *scpi) probe = sr_probe_new(i, SR_PROBE_ANALOG, TRUE, channel_name); sdi->probes = g_slist_append(sdi->probes, probe); devc->analog_groups[i].name = channel_name; - devc->analog_groups[i].probes = g_slist_append(NULL, probe); + devc->analog_groups[i].channels = g_slist_append(NULL, probe); sdi->channel_groups = g_slist_append(sdi->channel_groups, &devc->analog_groups[i]); } @@ -352,8 +352,8 @@ static struct sr_dev_inst *probe_device(struct sr_scpi_dev_inst *scpi) if (!probe) return NULL; sdi->probes = g_slist_append(sdi->probes, probe); - devc->digital_group.probes = g_slist_append( - devc->digital_group.probes, probe); + devc->digital_group.channels = g_slist_append( + devc->digital_group.channels, probe); } devc->digital_group.name = "LA"; sdi->channel_groups = g_slist_append(sdi->channel_groups, @@ -498,7 +498,7 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi, } if (channel_group) { - probe = g_slist_nth_data(channel_group->probes, 0); + probe = g_slist_nth_data(channel_group->channels, 0); if (!probe) return SR_ERR; if (probe->type == SR_PROBE_ANALOG) { diff --git a/libsigrok.h b/libsigrok.h index d389b97f..48bddab4 100644 --- a/libsigrok.h +++ b/libsigrok.h @@ -64,16 +64,16 @@ extern "C" { /** Status/error codes returned by libsigrok functions. */ enum { - SR_OK = 0, /**< No error. */ - SR_ERR = -1, /**< Generic/unspecified error. */ - SR_ERR_MALLOC = -2, /**< Malloc/calloc/realloc error. */ - SR_ERR_ARG = -3, /**< Function argument error. */ - SR_ERR_BUG = -4, /**< Errors hinting at internal bugs. */ - SR_ERR_SAMPLERATE = -5, /**< Incorrect samplerate. */ - SR_ERR_NA = -6, /**< Not applicable. */ - SR_ERR_DEV_CLOSED = -7, /**< Device is closed, but needs to be open. */ - SR_ERR_TIMEOUT = -8, /**< A timeout occurred. */ - SR_ERR_PROBE_GROUP= -9, /**< A channel group must be specified. */ + SR_OK = 0, /**< No error. */ + SR_ERR = -1, /**< Generic/unspecified error. */ + SR_ERR_MALLOC = -2, /**< Malloc/calloc/realloc error. */ + SR_ERR_ARG = -3, /**< Function argument error. */ + SR_ERR_BUG = -4, /**< Errors hinting at internal bugs. */ + SR_ERR_SAMPLERATE = -5, /**< Incorrect samplerate. */ + SR_ERR_NA = -6, /**< Not applicable. */ + SR_ERR_DEV_CLOSED = -7, /**< Device is closed, but must be open. */ + SR_ERR_TIMEOUT = -8, /**< A timeout occurred. */ + SR_ERR_CHANNEL_GROUP = -9, /**< A channel group must be specified. */ /* * Note: When adding entries here, don't forget to also update the @@ -619,12 +619,12 @@ struct sr_probe { char *trigger; }; -/** Structure for groups of probes that have common properties. */ +/** Structure for groups of channels that have common properties. */ struct sr_channel_group { /** Name of the channel group. */ char *name; - /** List of sr_probe structs of the probes belonging to this group. */ - GSList *probes; + /** List of sr_probe structs of the channels belonging to this group. */ + GSList *channels; /** Private data for driver use. */ void *priv; };