From: Uwe Hermann Date: Sat, 21 Mar 2015 19:12:50 +0000 (+0100) Subject: Channel names consistency fixes and simplifications. X-Git-Tag: libsigrok-0.4.0~569 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=0f34cb472368be61aa2e7bc9d9d1b25bb28aa560;p=libsigrok.git Channel names consistency fixes and simplifications. --- diff --git a/src/hardware/asix-sigma/asix-sigma.c b/src/hardware/asix-sigma/asix-sigma.c index 0482daeb..1ca841e9 100644 --- a/src/hardware/asix-sigma/asix-sigma.c +++ b/src/hardware/asix-sigma/asix-sigma.c @@ -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); diff --git a/src/hardware/beaglelogic/api.c b/src/hardware/beaglelogic/api.c index 74795caf..4fae9b80 100644 --- a/src/hardware/beaglelogic/api.c +++ b/src/hardware/beaglelogic/api.c @@ -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); diff --git a/src/hardware/center-3xx/api.c b/src/hardware/center-3xx/api.c index adf56bd9..1d2a5669 100644 --- a/src/hardware/center-3xx/api.c +++ b/src/hardware/center-3xx/api.c @@ -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); diff --git a/src/hardware/chronovu-la/api.c b/src/hardware/chronovu-la/api.c index 379b0a4a..fc5212f4 100644 --- a/src/hardware/chronovu-la/api.c +++ b/src/hardware/chronovu-la/api.c @@ -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); diff --git a/src/hardware/fx2lafw/api.c b/src/hardware/fx2lafw/api.c index 6fd89795..baa1476d 100644 --- a/src/hardware/fx2lafw/api.c +++ b/src/hardware/fx2lafw/api.c @@ -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[] = { diff --git a/src/hardware/hantek-dso/api.c b/src/hardware/hantek-dso/api.c index 4e3c6886..c990a5c5 100644 --- a/src/hardware/hantek-dso/api.c +++ b/src/hardware/hantek-dso/api.c @@ -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]); diff --git a/src/hardware/ikalogic-scanalogic2/api.c b/src/hardware/ikalogic-scanalogic2/api.c index abdbfd72..070357b3 100644 --- a/src/hardware/ikalogic-scanalogic2/api.c +++ b/src/hardware/ikalogic-scanalogic2/api.c @@ -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; diff --git a/src/hardware/ikalogic-scanaplus/api.c b/src/hardware/ikalogic-scanaplus/api.c index 37eecbd0..487fc217 100644 --- a/src/hardware/ikalogic-scanaplus/api.c +++ b/src/hardware/ikalogic-scanaplus/api.c @@ -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); diff --git a/src/hardware/link-mso19/api.c b/src/hardware/link-mso19/api.c index 98e253fe..89718894 100644 --- a/src/hardware/link-mso19/api.c +++ b/src/hardware/link-mso19/api.c @@ -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 diff --git a/src/hardware/openbench-logic-sniffer/api.c b/src/hardware/openbench-logic-sniffer/api.c index ddced7f3..4e776a54 100644 --- a/src/hardware/openbench-logic-sniffer/api.c +++ b/src/hardware/openbench-logic-sniffer/api.c @@ -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. */ diff --git a/src/hardware/pipistrello-ols/api.c b/src/hardware/pipistrello-ols/api.c index 3e02bc28..defb3978 100644 --- a/src/hardware/pipistrello-ols/api.c +++ b/src/hardware/pipistrello-ols/api.c @@ -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. */ diff --git a/src/hardware/saleae-logic16/api.c b/src/hardware/saleae-logic16/api.c index ae77bd86..c82bac80 100644 --- a/src/hardware/saleae-logic16/api.c +++ b/src/hardware/saleae-logic16/api.c @@ -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]); diff --git a/src/hardware/uni-t-ut32x/api.c b/src/hardware/uni-t-ut32x/api.c index bd792ea1..4d963afb 100644 --- a/src/hardware/uni-t-ut32x/api.c +++ b/src/hardware/uni-t-ut32x/api.c @@ -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; diff --git a/src/hardware/zeroplus-logic-cube/api.c b/src/hardware/zeroplus-logic-cube/api.c index cb5df66e..48845c7a 100644 --- a/src/hardware/zeroplus-logic-cube/api.c +++ b/src/hardware/zeroplus-logic-cube/api.c @@ -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;