Channel names consistency fixes and simplifications.

This commit is contained in:
Uwe Hermann 2015-03-21 20:12:50 +01:00
parent db24496ac8
commit 0f34cb4723
14 changed files with 24 additions and 40 deletions

View 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);

View 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);

View 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);

View 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);

View 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[] = {

View 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]);

View 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;

View 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);

View 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

View 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. */

View 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. */

View 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]);

View 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;

View 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;