drivers: Shorten some unnecessarily long arrays.

This commit is contained in:
Uwe Hermann 2017-07-21 09:03:05 +02:00
parent 76d10d1324
commit f8195cb2da
11 changed files with 50 additions and 245 deletions

View File

@ -51,11 +51,7 @@ static const uint64_t samplerates[] = {
}; };
static const char *data_sources[] = { static const char *data_sources[] = {
"Live", "Live", "Log-Hand", "Log-Trig", "Log-Auto", "Log-Export",
"Log-Hand",
"Log-Trig",
"Log-Auto",
"Log-Export",
}; };
extern const struct agdmm_job agdmm_jobs_live[]; extern const struct agdmm_job agdmm_jobs_live[];

View File

@ -50,14 +50,8 @@ static const struct ftdi_chip_desc ft2232h_desc = {
.product = 0x6010, .product = 0x6010,
.samplerate_div = 20, .samplerate_div = 20,
.channel_names = { .channel_names = {
"ADBUS0", "ADBUS0", "ADBUS1", "ADBUS2", "ADBUS3",
"ADBUS1", "ADBUS4", "ADBUS5", "ADBUS6", "ADBUS7",
"ADBUS2",
"ADBUS3",
"ADBUS4",
"ADBUS5",
"ADBUS6",
"ADBUS7",
/* TODO: BDBUS[0..7] channels. */ /* TODO: BDBUS[0..7] channels. */
NULL NULL
} }
@ -68,14 +62,7 @@ static const struct ftdi_chip_desc ft232r_desc = {
.product = 0x6001, .product = 0x6001,
.samplerate_div = 30, .samplerate_div = 30,
.channel_names = { .channel_names = {
"TXD", "TXD", "RXD", "RTS#", "CTS#", "DTR#", "DSR#", "DCD#", "RI#",
"RXD",
"RTS#",
"CTS#",
"DTR#",
"DSR#",
"DCD#",
"RI#",
NULL NULL
} }
}; };

View File

@ -91,71 +91,24 @@ static const char *scope_trigger_slopes[] = {
}; };
static const char *compact2_trigger_sources[] = { static const char *compact2_trigger_sources[] = {
"CH1", "CH1", "CH2",
"CH2", "LINE", "EXT", "PATT", "BUS1", "BUS2",
"LINE", "D0", "D1", "D2", "D3", "D4", "D5", "D6", "D7",
"EXT",
"PATT",
"BUS1",
"BUS2",
"D0",
"D1",
"D2",
"D3",
"D4",
"D5",
"D6",
"D7",
NULL, NULL,
}; };
static const char *compact4_trigger_sources[] = { static const char *compact4_trigger_sources[] = {
"CH1", "CH1", "CH2", "CH3", "CH4",
"CH2", "LINE", "EXT", "PATT", "BUS1", "BUS2",
"CH3", "D0", "D1", "D2", "D3", "D4", "D5", "D6", "D7",
"CH4",
"LINE",
"EXT",
"PATT",
"BUS1",
"BUS2",
"D0",
"D1",
"D2",
"D3",
"D4",
"D5",
"D6",
"D7",
NULL, NULL,
}; };
static const char *compact4_dig16_trigger_sources[] = { static const char *compact4_dig16_trigger_sources[] = {
"CH1", "CH1", "CH2", "CH3", "CH4",
"CH2", "LINE", "EXT", "PATT", "BUS1", "BUS2",
"CH3", "D0", "D1", "D2", "D3", "D4", "D5", "D6", "D7",
"CH4", "D8", "D9", "D10", "D11", "D12", "D13", "D14", "D15",
"LINE",
"EXT",
"PATT",
"BUS1",
"BUS2",
"D0",
"D1",
"D2",
"D3",
"D4",
"D5",
"D6",
"D7",
"D8",
"D9",
"D10",
"D11",
"D12",
"D13",
"D14",
"D15",
NULL, NULL,
}; };
@ -219,29 +172,12 @@ static const uint64_t vdivs[][2] = {
}; };
static const char *scope_analog_channel_names[] = { static const char *scope_analog_channel_names[] = {
"CH1", "CH1", "CH2", "CH3", "CH4",
"CH2",
"CH3",
"CH4",
}; };
static const char *scope_digital_channel_names[] = { static const char *scope_digital_channel_names[] = {
"D0", "D0", "D1", "D2", "D3", "D4", "D5", "D6", "D7",
"D1", "D8", "D9", "D10", "D11", "D12", "D13", "D14", "D15",
"D2",
"D3",
"D4",
"D5",
"D6",
"D7",
"D8",
"D9",
"D10",
"D11",
"D12",
"D13",
"D14",
"D15",
}; };
static const struct scope_config scope_models[] = { static const struct scope_config scope_models[] = {

View File

@ -144,21 +144,16 @@ static const uint64_t vdivs[][2] = {
}; };
static const char *trigger_sources[] = { static const char *trigger_sources[] = {
"CH1", "CH1", "CH2", "EXT",
"CH2",
"EXT",
/* TODO: forced */ /* TODO: forced */
}; };
static const char *trigger_slopes[] = { static const char *trigger_slopes[] = {
"r", "r", "f",
"f",
}; };
static const char *coupling[] = { static const char *coupling[] = {
"AC", "AC", "DC", "GND",
"DC",
"GND",
}; };
static struct sr_dev_inst *dso_dev_new(const struct dso_profile *prof) static struct sr_dev_inst *dso_dev_new(const struct dso_profile *prof)

View File

@ -50,18 +50,15 @@ SR_PRIV const uint64_t kecheng_kc_330b_sample_intervals[][2] = {
}; };
static const char *weight_freq[] = { static const char *weight_freq[] = {
"A", "A", "C",
"C",
}; };
static const char *weight_time[] = { static const char *weight_time[] = {
"F", "F", "S",
"S",
}; };
static const char *data_sources[] = { static const char *data_sources[] = {
"Live", "Live", "Memory",
"Memory",
}; };
static int scan_kecheng(struct sr_dev_driver *di, static int scan_kecheng(struct sr_dev_driver *di,

View File

@ -84,19 +84,11 @@ static const char *coupling_options[] = {
}; };
static const char *scope_trigger_slopes[] = { static const char *scope_trigger_slopes[] = {
"POS", "POS", "NEG", NULL,
"NEG",
NULL,
}; };
static const char *trigger_sources[] = { static const char *trigger_sources[] = {
"C1", "C1", "C2", "C3", "C4", "LINE", "EXT", NULL,
"C2",
"C3",
"C4",
"LINE",
"EXT",
NULL,
}; };
static const struct sr_rational timebases[] = { static const struct sr_rational timebases[] = {
@ -170,10 +162,7 @@ static const struct sr_rational vdivs[] = {
}; };
static const char *scope_analog_channel_names[] = { static const char *scope_analog_channel_names[] = {
"CH1", "CH1", "CH2", "CH3", "CH4",
"CH2",
"CH3",
"CH4",
}; };
static const struct scope_config scope_models[] = { static const struct scope_config scope_models[] = {

View File

@ -200,12 +200,7 @@ static const struct rate_map rate_map[] = {
/* FIXME: Determine corresponding voltages */ /* FIXME: Determine corresponding voltages */
static const uint16_t la_threshold_map[] = { static const uint16_t la_threshold_map[] = {
0x8600, 0x8600, 0x8770, 0x88ff, 0x8c70, 0x8eff, 0x8fff,
0x8770,
0x88ff,
0x8c70,
0x8eff,
0x8fff,
}; };
#endif #endif

View File

@ -43,13 +43,11 @@ static const uint32_t devopts[] = {
}; };
static const char *weight_freq[] = { static const char *weight_freq[] = {
"A", "A", "C",
"C",
}; };
static const char *weight_time[] = { static const char *weight_time[] = {
"F", "F", "S",
"S",
}; };
static const uint64_t meas_ranges[][2] = { static const uint64_t meas_ranges[][2] = {
@ -60,8 +58,7 @@ static const uint64_t meas_ranges[][2] = {
}; };
static const char *data_sources[] = { static const char *data_sources[] = {
"Live", "Live", "Memory",
"Memory",
}; };
static GSList *scan(struct sr_dev_driver *di, GSList *options) static GSList *scan(struct sr_dev_driver *di, GSList *options)

View File

@ -127,52 +127,22 @@ static const uint64_t vdivs[][2] = {
}; };
static const char *trigger_sources[] = { static const char *trigger_sources[] = {
"CH1", "CH1", "CH2", "CH3", "CH4",
"CH2", "EXT", "AC Line",
"CH3", "D0", "D1", "D2", "D3", "D4", "D5", "D6", "D7",
"CH4", "D8", "D9", "D10", "D11", "D12", "D13", "D14", "D15",
"EXT",
"AC Line",
"D0",
"D1",
"D2",
"D3",
"D4",
"D5",
"D6",
"D7",
"D8",
"D9",
"D10",
"D11",
"D12",
"D13",
"D14",
"D15",
}; };
static const char *trigger_slopes[] = { static const char *trigger_slopes[] = {
"r", "r", "f",
"f",
}; };
static const char *coupling[] = { static const char *coupling[] = {
"AC", "AC", "DC", "GND",
"DC",
"GND",
}; };
static const uint64_t probe_factor[] = { static const uint64_t probe_factor[] = {
1, 1, 2, 5, 10, 20, 50, 100, 200, 500, 1000,
2,
5,
10,
20,
50,
100,
200,
500,
1000,
}; };
/* Do not change the order of entries */ /* Do not change the order of entries */

View File

@ -40,8 +40,7 @@ static const char *channel_names[] = {
}; };
static const char *data_sources[] = { static const char *data_sources[] = {
"Live", "Live", "Memory",
"Memory",
}; };
static GSList *scan(struct sr_dev_driver *di, GSList *options) static GSList *scan(struct sr_dev_driver *di, GSList *options)

View File

@ -23,44 +23,26 @@
#include "protocol.h" #include "protocol.h"
static const char *coupling_options[] = { static const char *coupling_options[] = {
"AC", "AC", "DC", "DC50", "GND",
"DC",
"DC50",
"GND",
NULL, NULL,
}; };
static const char *trigger_sources_2ch[] = { static const char *trigger_sources_2ch[] = {
"1", "1", "2", "LINE", "EXT",
"2",
"LINE",
"EXT",
NULL, NULL,
}; };
/* TODO: Is BITx handled correctly or is Dx required? */ /* TODO: Is BITx handled correctly or is Dx required? */
static const char *trigger_sources_4ch[] = { static const char *trigger_sources_4ch[] = {
"1", "1", "2", "3", "4",
"2", "LINE", "EXT", "BIT1",
"3", "BIT2", "BIT3", "BIT4", "BIT5", "BIT6", "BIT7", "BIT8",
"4",
"LINE",
"EXT",
"BIT1",
"BIT2",
"BIT3",
"BIT4",
"BIT5",
"BIT6",
"BIT7",
"BIT8",
NULL, NULL,
}; };
/* Note: Values must correlate to the trigger_slopes values. */ /* Note: Values must correlate to the trigger_slopes values. */
const char *dlm_trigger_slopes[3] = { const char *dlm_trigger_slopes[3] = {
"r", "r", "f",
"f",
NULL, NULL,
}; };
@ -130,56 +112,18 @@ const uint64_t dlm_vdivs[17][2] = {
}; };
static const char *scope_analog_channel_names[] = { static const char *scope_analog_channel_names[] = {
"1", "1", "2", "3", "4",
"2",
"3",
"4",
}; };
static const char *scope_digital_channel_names_8[] = { static const char *scope_digital_channel_names_8[] = {
"D0", "D0", "D1", "D2", "D3", "D4", "D5", "D6", "D7",
"D1",
"D2",
"D3",
"D4",
"D5",
"D6",
"D7",
}; };
static const char *scope_digital_channel_names_32[] = { static const char *scope_digital_channel_names_32[] = {
"A0", "A0", "A1", "A2", "A3", "A4", "A5", "A6", "A7",
"A1", "B0", "B1", "B2", "B3", "B4", "B5", "B6", "B7",
"A2", "C0", "C1", "C2", "C3", "C4", "C5", "C6", "C7",
"A3", "D0", "D1", "D2", "D3", "D4", "D5", "D6", "D7",
"A4",
"A5",
"A6",
"A7",
"B0",
"B1",
"B2",
"B3",
"B4",
"B5",
"B6",
"B7",
"C0",
"C1",
"C2",
"C3",
"C4",
"C5",
"C6",
"C7",
"D0",
"D1",
"D2",
"D3",
"D4",
"D5",
"D6",
"D7",
}; };
static const struct scope_config scope_models[] = { static const struct scope_config scope_models[] = {