]> sigrok.org Git - libsigrok.git/commitdiff
sysclk-lwla: Make use of the probe index again.
authorDaniel Elstner <redacted>
Wed, 15 Jan 2014 10:09:06 +0000 (11:09 +0100)
committerDaniel Elstner <redacted>
Wed, 15 Jan 2014 20:44:59 +0000 (21:44 +0100)
(configure_probes): sr_probe::index has been un-deprecated,
so use it instead of relying on the list order.

hardware/sysclk-lwla/api.c

index 38e2e97001d98d5a5a91d5f011165e03557638c7..05010275c7db664b7652071149892c2e25cde032 100644 (file)
@@ -357,18 +357,17 @@ static int configure_probes(const struct sr_dev_inst *sdi)
        devc->trigger_edge_mask = 0;
        devc->trigger_values = 0;
 
-       for (node = sdi->probes, probe_bit = 1;
-                       node != NULL;
-                       node = node->next, probe_bit <<= 1) {
-
-               if (probe_bit >= ((uint64_t)1 << NUM_PROBES)) {
-                       sr_err("Channels over the limit of %d.", NUM_PROBES);
-                       return SR_ERR;
-               }
+       for (node = sdi->probes; node != NULL; node = node->next) {
                probe = node->data;
                if (!probe || !probe->enabled)
                        continue;
 
+               if (probe->index >= NUM_PROBES) {
+                       sr_err("Channel index %d out of range.", probe->index);
+                       return SR_ERR_BUG;
+               }
+               probe_bit = (uint64_t)1 << probe->index;
+
                /* Enable input channel for this probe. */
                devc->channel_mask |= probe_bit;