]> sigrok.org Git - libsigrok.git/commitdiff
Channel names consistency fixes and simplifications.
authorUwe Hermann <redacted>
Sat, 21 Mar 2015 19:12:50 +0000 (20:12 +0100)
committerUwe Hermann <redacted>
Sun, 22 Mar 2015 01:15:30 +0000 (02:15 +0100)
14 files changed:
src/hardware/asix-sigma/asix-sigma.c
src/hardware/beaglelogic/api.c
src/hardware/center-3xx/api.c
src/hardware/chronovu-la/api.c
src/hardware/fx2lafw/api.c
src/hardware/hantek-dso/api.c
src/hardware/ikalogic-scanalogic2/api.c
src/hardware/ikalogic-scanaplus/api.c
src/hardware/link-mso19/api.c
src/hardware/openbench-logic-sniffer/api.c
src/hardware/pipistrello-ols/api.c
src/hardware/saleae-logic16/api.c
src/hardware/uni-t-ut32x/api.c
src/hardware/zeroplus-logic-cube/api.c

index 0482daeb6fd830f54d482ece31f0d89054188959..1ca841e9aade53c7dc960c3e407b4a5b07c71d48 100644 (file)
@@ -382,8 +382,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
        sdi->driver = di;
 
        for (i = 0; i < ARRAY_SIZE(channel_names); i++)
-               sr_channel_new(sdi, i, SR_CHANNEL_LOGIC, TRUE,
-                                   channel_names[i]);
+               sr_channel_new(sdi, i, SR_CHANNEL_LOGIC, TRUE, channel_names[i]);
 
        devices = g_slist_append(devices, sdi);
        drvc->instances = g_slist_append(drvc->instances, sdi);
index 74795caf42dee540e2be1d7606f3bbd1fa58861d..4fae9b803b507507305d5eaff27f52be704d6d35 100644 (file)
@@ -47,10 +47,9 @@ static const int32_t soft_trigger_matches[] = {
        SR_TRIGGER_EDGE,
 };
 
-/* Channels are numbered 0-13 */
-SR_PRIV const char *beaglelogic_channel_names[] = {
-       "P8_45", "P8_46", "P8_43", "P8_44", "P8_41", "P8_42", "P8_39", "P8_40",
-       "P8_27", "P8_29", "P8_28", "P8_30", "P8_21", "P8_20", NULL,
+SR_PRIV const char *channel_names[] = {
+       "P8_45", "P8_46", "P8_43", "P8_44", "P8_41", "P8_42", "P8_39",
+       "P8_40", "P8_27", "P8_29", "P8_28", "P8_30", "P8_21", "P8_20",
 };
 
 /* Possible sample rates : 10 Hz to 100 MHz = (100 / x) MHz */
@@ -136,7 +135,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
        /* Fill the channels */
        for (i = 0; i < maxch; i++)
                sr_channel_new(sdi, i, SR_CHANNEL_LOGIC, TRUE,
-                               beaglelogic_channel_names[i]);
+                               channel_names[i]);
 
        sdi->priv = devc;
        drvc->instances = g_slist_append(drvc->instances, sdi);
index adf56bd9acd1688a08b30636e222bcd2d7f553e4..1d2a5669831a28c2fac8a1ddf356744c46ef155d 100644 (file)
@@ -37,7 +37,6 @@ static const uint32_t devopts[] = {
 
 static const char *channel_names[] = {
        "T1", "T2", "T3", "T4",
-       NULL,
 };
 
 SR_PRIV struct sr_dev_driver center_309_driver_info;
@@ -96,10 +95,8 @@ static GSList *center_scan(const char *conn, const char *serialcomm, int idx)
        sdi->priv = devc;
        sdi->driver = center_devs[idx].di;
 
-       for (i = 0; i <  center_devs[idx].num_channels; i++) {
-               sr_channel_new(sdi, i, SR_CHANNEL_ANALOG,
-                                   TRUE, channel_names[i]);
-       }
+       for (i = 0; i < center_devs[idx].num_channels; i++)
+               sr_channel_new(sdi, i, SR_CHANNEL_ANALOG, TRUE, channel_names[i]);
 
        drvc->instances = g_slist_append(drvc->instances, sdi);
        devices = g_slist_append(devices, sdi);
index 379b0a4a7100ee7fdd142377433287403cbf6179..fc5212f4409522fc0605e78b2ce4dd652d295eb8 100644 (file)
@@ -128,7 +128,7 @@ static int add_device(int idx, int model, GSList **devices)
 
        for (i = 0; i < devc->prof->num_channels; i++)
                sr_channel_new(sdi, i, SR_CHANNEL_LOGIC, TRUE,
-                                   cv_channel_names[i]);
+                               cv_channel_names[i]);
 
        *devices = g_slist_append(*devices, sdi);
        drvc->instances = g_slist_append(drvc->instances, sdi);
index 6fd89795624f3a79a1f1e95e74c810cdebf2cb8a..baa1476d0bbd022ada03d6ed382e31354f5c30cf 100644 (file)
@@ -106,9 +106,8 @@ static const uint32_t devopts[] = {
 };
 
 static const char *channel_names[] = {
-       "0",  "1",  "2",  "3",  "4",  "5",  "6",  "7",
-       "8",  "9", "10", "11", "12", "13", "14", "15",
-       NULL,
+       "0", "1", "2", "3", "4", "5", "6", "7",
+       "8", "9", "10", "11", "12", "13", "14", "15",
 };
 
 static const int32_t soft_trigger_matches[] = {
index 4e3c6886ad9e8216d998f4d8c7e1b10e8e99739f..c990a5c53cbb6f1901a00003c2fe161739ba99de 100644 (file)
@@ -69,7 +69,6 @@ static const uint32_t devopts_cg[] = {
 
 static const char *channel_names[] = {
        "CH1", "CH2",
-       NULL,
 };
 
 static const uint64_t buffersizes_32k[] = {
@@ -181,7 +180,7 @@ static struct sr_dev_inst *dso_dev_new(const struct dso_profile *prof)
         * Add only the real channels -- EXT isn't a source of data, only
         * a trigger source internal to the device.
         */
-       for (i = 0; channel_names[i]; i++) {
+       for (i = 0; i < ARRAY_SIZE(channel_names); i++) {
                ch = sr_channel_new(sdi, i, SR_CHANNEL_ANALOG, TRUE, channel_names[i]);
                cg = g_malloc0(sizeof(struct sr_channel_group));
                cg->name = g_strdup(channel_names[i]);
index abdbfd7228c562f8570f134c35fc4a54fb1626b3..070357b3fc5bee267b896135d4de12125145d63f 100644 (file)
@@ -49,7 +49,6 @@ SR_PRIV const uint64_t sl2_samplerates[NUM_SAMPLERATES] = {
 
 static const char *channel_names[] = {
        "0", "1", "2", "3",
-       NULL,
 };
 
 SR_PRIV struct sr_dev_driver ikalogic_scanalogic2_driver_info;
@@ -118,9 +117,9 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
                sdi->inst_type = SR_INST_USB;
                sdi->conn = usb;
 
-               for (i = 0; channel_names[i]; i++)
-                       devc->channels[i] = sr_channel_new(sdi, i, SR_CHANNEL_LOGIC,
-                               TRUE, channel_names[i]);
+               for (i = 0; i < ARRAY_SIZE(channel_names); i++)
+                       devc->channels[i] = sr_channel_new(sdi, i,
+                               SR_CHANNEL_LOGIC, TRUE, channel_names[i]);
 
                devc->state = STATE_IDLE;
                devc->next_state = STATE_IDLE;
index 37eecbd0ab10528ed85f0cbbf55c1f9c304ffcdb..487fc2178c7817f21a788999071942b0a3ceec55 100644 (file)
@@ -38,7 +38,6 @@ static const uint32_t devopts[] = {
 /* Channels are numbered 1-9. */
 static const char *channel_names[] = {
        "1", "2", "3", "4", "5", "6", "7", "8", "9",
-       NULL,
 };
 
 /* Note: The IKALOGIC ScanaPLUS always samples at 100MHz. */
@@ -125,9 +124,8 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
        sdi->driver = di;
        sdi->priv = devc;
 
-       for (i = 0; channel_names[i]; i++)
-               sr_channel_new(sdi, i, SR_CHANNEL_LOGIC, TRUE,
-                                   channel_names[i]);
+       for (i = 0; i < ARRAY_SIZE(channel_names); i++)
+               sr_channel_new(sdi, i, SR_CHANNEL_LOGIC, TRUE, channel_names[i]);
 
        devices = g_slist_append(devices, sdi);
        drvc->instances = g_slist_append(drvc->instances, sdi);
index 98e253fee3e77593d7b6f44e447960d546f799c5..89718894e7fab93be6de47d585d735c03be649ad 100644 (file)
@@ -38,9 +38,9 @@ static const uint32_t devopts[] = {
  *
  * See also: http://www.linkinstruments.com/images/mso19_1113.gif
  */
-SR_PRIV const char *mso19_channel_names[] = {
+static const char *channel_names[] = {
        /* Note: DSO needs to be first. */
-       "DSO", "0", "1", "2", "3", "4", "5", "6", "7", NULL,
+       "DSO", "0", "1", "2", "3", "4", "5", "6", "7",
 };
 
 static const uint64_t samplerates[] = {
@@ -215,8 +215,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
 
                for (i = 0; i < NUM_CHANNELS; i++) {
                        chtype = (i == 0) ? SR_CHANNEL_ANALOG : SR_CHANNEL_LOGIC;
-                       sr_channel_new(sdi, i, chtype, TRUE,
-                                           mso19_channel_names[i]);
+                       sr_channel_new(sdi, i, chtype, TRUE, channel_names[i]);
                }
 
                //Add the driver
index ddced7f3b79ba4be189f079568f0183b0dbb91ab..4e776a544dae5d56a677d7491aa86b87e2fc0ab0 100644 (file)
@@ -74,7 +74,6 @@ SR_PRIV const char *ols_channel_names[] = {
        "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12",
        "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23",
        "24", "25", "26", "27", "28", "29", "30", "31",
-       NULL,
 };
 
 /* Default supported samplerates, can be overridden by device metadata. */
index 3e02bc2868ed3e0636dbcafe97cc8e66da1d3e0f..defb39785d32eb994fd954ba55f1598360ddb90c 100644 (file)
@@ -65,7 +65,6 @@ SR_PRIV const char *p_ols_channel_names[] = {
        "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12",
        "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23",
        "24", "25", "26", "27", "28", "29", "30", "31",
-       NULL,
 };
 
 /* Default supported samplerates, can be overridden by device metadata. */
index ae77bd8671952f15186ac6dc386283e7b91404f6..c82bac80783c4a795f35b310256baf8df154ec8d 100644 (file)
@@ -66,7 +66,6 @@ static const int32_t soft_trigger_matches[] = {
 static const char *channel_names[] = {
        "0", "1", "2", "3", "4", "5", "6", "7", "8",
        "9", "10", "11", "12", "13", "14", "15",
-       NULL,
 };
 
 static const struct {
@@ -205,7 +204,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
                sdi->driver = di;
                sdi->connection_id = g_strdup(connection_id);
 
-               for (j = 0; channel_names[j]; j++)
+               for (j = 0; i < ARRAY_SIZE(channel_names); j++)
                        sr_channel_new(sdi, j, SR_CHANNEL_LOGIC, TRUE,
                                            channel_names[j]);
 
index bd792ea1e2354190b7b2ca77670c669b031e7ccc..4d963afb0c0cf8ff274283df557f410c51b798f9 100644 (file)
@@ -28,10 +28,8 @@ static const uint32_t devopts[] = {
        SR_CONF_DATA_SOURCE | SR_CONF_GET | SR_CONF_SET | SR_CONF_LIST,
 };
 
-static char *channels[] = {
-       "T1",
-       "T2",
-       "T1-T2",
+static const char *channel_names[] = {
+       "T1", "T2", "T1-T2",
 };
 
 static const char *data_sources[] = {
@@ -84,7 +82,8 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
                        sdi->inst_type = SR_INST_USB;
                        sdi->conn = l->data;
                        for (i = 0; i < 3; i++)
-                               sr_channel_new(sdi, i, SR_CHANNEL_ANALOG, TRUE, channels[i]);
+                               sr_channel_new(sdi, i, SR_CHANNEL_ANALOG, TRUE,
+                                               channel_names[i]);
                        devc = g_malloc0(sizeof(struct dev_context));
                        sdi->priv = devc;
                        devc->limit_samples = 0;
index cb5df66e1a3f557aa1c15756cba1ebca3dfcd06b..48845c7a2c26b62f37f4bbc23d834d0420b8fc37 100644 (file)
@@ -76,7 +76,6 @@ static const char *channel_names[] = {
        "B0", "B1", "B2", "B3", "B4", "B5", "B6", "B7",
        "C0", "C1", "C2", "C3", "C4", "C5", "C6", "C7",
        "D0", "D1", "D2", "D3", "D4", "D5", "D6", "D7",
-       NULL,
 };
 
 SR_PRIV struct sr_dev_driver zeroplus_logic_cube_driver_info;