]> sigrok.org Git - libsigrok.git/commitdiff
Replace channel_group.probes with channel_group.channels.
authorUwe Hermann <redacted>
Fri, 14 Mar 2014 20:21:09 +0000 (21:21 +0100)
committerUwe Hermann <redacted>
Tue, 25 Mar 2014 19:58:54 +0000 (20:58 +0100)
This fixes parts of bug #259.

hardware/atten-pps3xxx/api.c
hardware/demo/demo.c
hardware/hameg-hmo/api.c
hardware/hameg-hmo/protocol.c
hardware/rigol-ds/api.c
libsigrok.h

index 1ed7871894d36f7d8be94bb347aecb94d19a58d9..a52c4e4d130a33af0b4f008e05e4df6fe3796324 100644 (file)
@@ -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) {
index 754e72f74216485d3891d6aa2ebb35979b53ace2..19742309aea4dd27e247def400910a798ba837f8 100644 (file)
@@ -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,
index 243b8d6d39b78935a55a0d2f73e30138400df2d1..6b6e5ab79a3bc5a91ded4b00dbfb1ad03994c0df 100644 (file)
@@ -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);
        }
 
index 263e4f9c08ccd7d7b257d59447b09fc130fd3d72..6dda2d353b14b81fffeedbe5e2eb406c33524152 100644 (file)
@@ -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];
index 1ce9c6cd721779d90a2347c37501d997a93c4516..917e3de6bfa79638e7b0df2e66bb7b876e622453 100644 (file)
@@ -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) {
index d389b97fdb707156f041f76051fd83265a1dd05a..48bddab475c6a04d5d4a598f84939fdf402c4759 100644 (file)
@@ -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;
 };