]> sigrok.org Git - libsigrok.git/commitdiff
rigol-ds: Rename the CHANINFO macro and comment it
authorValentin Ochs <redacted>
Thu, 24 May 2018 20:59:52 +0000 (22:59 +0200)
committerUwe Hermann <redacted>
Thu, 21 Jun 2018 22:47:09 +0000 (00:47 +0200)
src/hardware/rigol-ds/api.c

index 825d965ad7321439080272a504a030c64b895f45..9514d6db888682c9567051c4a8d622359e521065 100644 (file)
@@ -132,6 +132,7 @@ static const char *trigger_sources_2_chans[] = {
        "D0", "D1", "D2", "D3", "D4", "D5", "D6", "D7",
        "D8", "D9", "D10", "D11", "D12", "D13", "D14", "D15",
 };
+
 static const char *trigger_sources_4_chans[] = {
        "CH1", "CH2", "CH3", "CH4",
        "EXT", "AC Line",
@@ -197,54 +198,60 @@ static const struct rigol_ds_series supported_series[] = {
 };
 
 #define SERIES(x) &supported_series[x]
-#define CHANINFO(num, digital) num, digital, trigger_sources_##num##_chans, digital ? ARRAY_SIZE(trigger_sources_##num##_chans) : (num + 2)
+/*
+ * Use a macro to select the correct list of trigger sources and its length
+ * based on the number of analog channels and presence of digital channels.
+ */
+#define CH_INFO(num, digital) \
+       num, digital, trigger_sources_##num##_chans, \
+       digital ? ARRAY_SIZE(trigger_sources_##num##_chans) : (num + 2)
 /* series, model, min timebase, analog channels, digital */
 static const struct rigol_ds_model supported_models[] = {
-       {SERIES(VS5000), "VS5022", {20, 1000000000}, CHANINFO(2, false)},
-       {SERIES(VS5000), "VS5042", {10, 1000000000}, CHANINFO(2, false)},
-       {SERIES(VS5000), "VS5062", {5, 1000000000}, CHANINFO(2, false)},
-       {SERIES(VS5000), "VS5102", {2, 1000000000}, CHANINFO(2, false)},
-       {SERIES(VS5000), "VS5202", {2, 1000000000}, CHANINFO(2, false)},
-       {SERIES(VS5000), "VS5022D", {20, 1000000000}, CHANINFO(2, true)},
-       {SERIES(VS5000), "VS5042D", {10, 1000000000}, CHANINFO(2, true)},
-       {SERIES(VS5000), "VS5062D", {5, 1000000000}, CHANINFO(2, true)},
-       {SERIES(VS5000), "VS5102D", {2, 1000000000}, CHANINFO(2, true)},
-       {SERIES(VS5000), "VS5202D", {2, 1000000000}, CHANINFO(2, true)},
-       {SERIES(DS1000), "DS1052E", {5, 1000000000}, CHANINFO(2, false)},
-       {SERIES(DS1000), "DS1102E", {2, 1000000000}, CHANINFO(2, false)},
-       {SERIES(DS1000), "DS1152E", {2, 1000000000}, CHANINFO(2, false)},
-       {SERIES(DS1000), "DS1052D", {5, 1000000000}, CHANINFO(2, true)},
-       {SERIES(DS1000), "DS1102D", {2, 1000000000}, CHANINFO(2, true)},
-       {SERIES(DS1000), "DS1152D", {2, 1000000000}, CHANINFO(2, true)},
-       {SERIES(DS2000), "DS2072", {5, 1000000000}, CHANINFO(2, false)},
-       {SERIES(DS2000), "DS2102", {5, 1000000000}, CHANINFO(2, false)},
-       {SERIES(DS2000), "DS2202", {2, 1000000000}, CHANINFO(2, false)},
-       {SERIES(DS2000), "DS2302", {1, 1000000000}, CHANINFO(2, false)},
-       {SERIES(DS2000A), "DS2072A", {5, 1000000000}, CHANINFO(2, false)},
-       {SERIES(DS2000A), "DS2102A", {5, 1000000000}, CHANINFO(2, false)},
-       {SERIES(DS2000A), "DS2202A", {2, 1000000000}, CHANINFO(2, false)},
-       {SERIES(DS2000A), "DS2302A", {1, 1000000000}, CHANINFO(2, false)},
-       {SERIES(DS2000A), "MSO2072A", {5, 1000000000}, CHANINFO(2, true)},
-       {SERIES(DS2000A), "MSO2102A", {5, 1000000000}, CHANINFO(2, true)},
-       {SERIES(DS2000A), "MSO2202A", {2, 1000000000}, CHANINFO(2, true)},
-       {SERIES(DS2000A), "MSO2302A", {1, 1000000000}, CHANINFO(2, true)},
-       {SERIES(DSO1000), "DSO1002A", {5, 1000000000}, CHANINFO(2, false)},
-       {SERIES(DSO1000), "DSO1004A", {5, 1000000000}, CHANINFO(4, false)},
-       {SERIES(DSO1000), "DSO1012A", {2, 1000000000}, CHANINFO(2, false)},
-       {SERIES(DSO1000), "DSO1014A", {2, 1000000000}, CHANINFO(4, false)},
-       {SERIES(DSO1000), "DSO1022A", {2, 1000000000}, CHANINFO(2, false)},
-       {SERIES(DSO1000), "DSO1024A", {2, 1000000000}, CHANINFO(4, false)},
-       {SERIES(DS1000Z), "DS1054Z", {5, 1000000000}, CHANINFO(4, false)},
-       {SERIES(DS1000Z), "DS1074Z", {5, 1000000000}, CHANINFO(4, false)},
-       {SERIES(DS1000Z), "DS1104Z", {5, 1000000000}, CHANINFO(4, false)},
-       {SERIES(DS1000Z), "DS1074Z-S", {5, 1000000000}, CHANINFO(4, false)},
-       {SERIES(DS1000Z), "DS1104Z-S", {5, 1000000000}, CHANINFO(4, false)},
-       {SERIES(DS1000Z), "DS1074Z Plus", {5, 1000000000}, CHANINFO(4, false)},
-       {SERIES(DS1000Z), "DS1104Z Plus", {5, 1000000000}, CHANINFO(4, false)},
-       {SERIES(DS1000Z), "MSO1074Z", {5, 1000000000}, CHANINFO(4, true)},
-       {SERIES(DS1000Z), "MSO1104Z", {5, 1000000000}, CHANINFO(4, true)},
-       {SERIES(DS1000Z), "MSO1074Z-S", {5, 1000000000}, CHANINFO(4, true)},
-       {SERIES(DS1000Z), "MSO1104Z-S", {5, 1000000000}, CHANINFO(4, true)},
+       {SERIES(VS5000), "VS5022", {20, 1000000000}, CH_INFO(2, false)},
+       {SERIES(VS5000), "VS5042", {10, 1000000000}, CH_INFO(2, false)},
+       {SERIES(VS5000), "VS5062", {5, 1000000000}, CH_INFO(2, false)},
+       {SERIES(VS5000), "VS5102", {2, 1000000000}, CH_INFO(2, false)},
+       {SERIES(VS5000), "VS5202", {2, 1000000000}, CH_INFO(2, false)},
+       {SERIES(VS5000), "VS5022D", {20, 1000000000}, CH_INFO(2, true)},
+       {SERIES(VS5000), "VS5042D", {10, 1000000000}, CH_INFO(2, true)},
+       {SERIES(VS5000), "VS5062D", {5, 1000000000}, CH_INFO(2, true)},
+       {SERIES(VS5000), "VS5102D", {2, 1000000000}, CH_INFO(2, true)},
+       {SERIES(VS5000), "VS5202D", {2, 1000000000}, CH_INFO(2, true)},
+       {SERIES(DS1000), "DS1052E", {5, 1000000000}, CH_INFO(2, false)},
+       {SERIES(DS1000), "DS1102E", {2, 1000000000}, CH_INFO(2, false)},
+       {SERIES(DS1000), "DS1152E", {2, 1000000000}, CH_INFO(2, false)},
+       {SERIES(DS1000), "DS1052D", {5, 1000000000}, CH_INFO(2, true)},
+       {SERIES(DS1000), "DS1102D", {2, 1000000000}, CH_INFO(2, true)},
+       {SERIES(DS1000), "DS1152D", {2, 1000000000}, CH_INFO(2, true)},
+       {SERIES(DS2000), "DS2072", {5, 1000000000}, CH_INFO(2, false)},
+       {SERIES(DS2000), "DS2102", {5, 1000000000}, CH_INFO(2, false)},
+       {SERIES(DS2000), "DS2202", {2, 1000000000}, CH_INFO(2, false)},
+       {SERIES(DS2000), "DS2302", {1, 1000000000}, CH_INFO(2, false)},
+       {SERIES(DS2000A), "DS2072A", {5, 1000000000}, CH_INFO(2, false)},
+       {SERIES(DS2000A), "DS2102A", {5, 1000000000}, CH_INFO(2, false)},
+       {SERIES(DS2000A), "DS2202A", {2, 1000000000}, CH_INFO(2, false)},
+       {SERIES(DS2000A), "DS2302A", {1, 1000000000}, CH_INFO(2, false)},
+       {SERIES(DS2000A), "MSO2072A", {5, 1000000000}, CH_INFO(2, true)},
+       {SERIES(DS2000A), "MSO2102A", {5, 1000000000}, CH_INFO(2, true)},
+       {SERIES(DS2000A), "MSO2202A", {2, 1000000000}, CH_INFO(2, true)},
+       {SERIES(DS2000A), "MSO2302A", {1, 1000000000}, CH_INFO(2, true)},
+       {SERIES(DSO1000), "DSO1002A", {5, 1000000000}, CH_INFO(2, false)},
+       {SERIES(DSO1000), "DSO1004A", {5, 1000000000}, CH_INFO(4, false)},
+       {SERIES(DSO1000), "DSO1012A", {2, 1000000000}, CH_INFO(2, false)},
+       {SERIES(DSO1000), "DSO1014A", {2, 1000000000}, CH_INFO(4, false)},
+       {SERIES(DSO1000), "DSO1022A", {2, 1000000000}, CH_INFO(2, false)},
+       {SERIES(DSO1000), "DSO1024A", {2, 1000000000}, CH_INFO(4, false)},
+       {SERIES(DS1000Z), "DS1054Z", {5, 1000000000}, CH_INFO(4, false)},
+       {SERIES(DS1000Z), "DS1074Z", {5, 1000000000}, CH_INFO(4, false)},
+       {SERIES(DS1000Z), "DS1104Z", {5, 1000000000}, CH_INFO(4, false)},
+       {SERIES(DS1000Z), "DS1074Z-S", {5, 1000000000}, CH_INFO(4, false)},
+       {SERIES(DS1000Z), "DS1104Z-S", {5, 1000000000}, CH_INFO(4, false)},
+       {SERIES(DS1000Z), "DS1074Z Plus", {5, 1000000000}, CH_INFO(4, false)},
+       {SERIES(DS1000Z), "DS1104Z Plus", {5, 1000000000}, CH_INFO(4, false)},
+       {SERIES(DS1000Z), "MSO1074Z", {5, 1000000000}, CH_INFO(4, true)},
+       {SERIES(DS1000Z), "MSO1104Z", {5, 1000000000}, CH_INFO(4, true)},
+       {SERIES(DS1000Z), "MSO1074Z-S", {5, 1000000000}, CH_INFO(4, true)},
+       {SERIES(DS1000Z), "MSO1104Z-S", {5, 1000000000}, CH_INFO(4, true)},
 };
 
 static struct sr_dev_driver rigol_ds_driver_info;