]> sigrok.org Git - libsigrok.git/commitdiff
rigol-ds: Add initial Agilent MSO7034A support.
authorUwe Hermann <redacted>
Fri, 22 Jun 2018 20:37:10 +0000 (22:37 +0200)
committerUwe Hermann <redacted>
Fri, 22 Jun 2018 20:53:11 +0000 (22:53 +0200)
Digital channels (and various other features) are not yet supported.

contrib/60-libsigrok.rules
src/hardware/rigol-ds/api.c
src/hardware/rigol-ds/protocol.c
src/hardware/rigol-ds/protocol.h

index 3bed6c51275447c0f4e356c92528c36784b6c0f7..0013e2995a99703d84f03a7368704c68d483c12b 100644 (file)
@@ -42,6 +42,8 @@ ATTRS{idVendor}=="0957", ATTRS{idProduct}=="0618", ENV{ID_SIGROK}="1"
 ATTRS{idVendor}=="0957", ATTRS{idProduct}=="0607", ENV{ID_SIGROK}="1"
 # DSO1000 series
 ATTRS{idVendor}=="0957", ATTRS{idProduct}=="0588", ENV{ID_SIGROK}="1"
+# MSO7000A series
+ATTRS{idVendor}=="0957", ATTRS{idProduct}=="1735", ENV{ID_SIGROK}="1"
 
 # ASIX SIGMA
 # ASIX SIGMA2
index b34aeee6fea8d834943168b87fa05a06eae87e5f..bdc15b7de387e96b00133545b9cb02044beb235c 100644 (file)
@@ -159,6 +159,16 @@ static const char *data_sources[] = {
        "Segmented",
 };
 
+static const struct rigol_ds_command std_cmd[] = {
+       { CMD_GET_HORIZ_TRIGGERPOS, ":TIM:OFFS?" },
+       { CMD_SET_HORIZ_TRIGGERPOS, ":TIM:OFFS %s" },
+};
+
+static const struct rigol_ds_command mso7000a_cmd[] = {
+       { CMD_GET_HORIZ_TRIGGERPOS, ":TIM:POS?" },
+       { CMD_SET_HORIZ_TRIGGERPOS, ":TIM:POS %s" },
+};
+
 enum vendor {
        RIGOL,
        AGILENT,
@@ -172,6 +182,7 @@ enum series {
        DSO1000,
        DS1000Z,
        DS4000,
+       MSO7000A,
 };
 
 /* short name, full name */
@@ -198,6 +209,8 @@ static const struct rigol_ds_series supported_series[] = {
                {50, 1}, {1, 1000}, 12, 1200, 12000000},
        [DS4000] = {VENDOR(RIGOL), "DS4000", PROTOCOL_V4, FORMAT_IEEE488_2,
                {1000, 1}, {1, 1000}, 14, 1400, 14000},
+       [MSO7000A] = {VENDOR(AGILENT), "MSO7000A", PROTOCOL_V4, FORMAT_IEEE488_2,
+               {50, 1}, {2, 1000}, 10, 1000, 8000000},
 };
 
 #define SERIES(x) &supported_series[x]
@@ -210,52 +223,54 @@ static const struct rigol_ds_series supported_series[] = {
        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}, 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)},
-       {SERIES(DS4000), "DS4024", {1, 1000000000}, CH_INFO(4, false)},
+       {SERIES(VS5000), "VS5022", {20, 1000000000}, CH_INFO(2, false), std_cmd},
+       {SERIES(VS5000), "VS5042", {10, 1000000000}, CH_INFO(2, false), std_cmd},
+       {SERIES(VS5000), "VS5062", {5, 1000000000}, CH_INFO(2, false), std_cmd},
+       {SERIES(VS5000), "VS5102", {2, 1000000000}, CH_INFO(2, false), std_cmd},
+       {SERIES(VS5000), "VS5202", {2, 1000000000}, CH_INFO(2, false), std_cmd},
+       {SERIES(VS5000), "VS5022D", {20, 1000000000}, CH_INFO(2, true), std_cmd},
+       {SERIES(VS5000), "VS5042D", {10, 1000000000}, CH_INFO(2, true), std_cmd},
+       {SERIES(VS5000), "VS5062D", {5, 1000000000}, CH_INFO(2, true), std_cmd},
+       {SERIES(VS5000), "VS5102D", {2, 1000000000}, CH_INFO(2, true), std_cmd},
+       {SERIES(VS5000), "VS5202D", {2, 1000000000}, CH_INFO(2, true), std_cmd},
+       {SERIES(DS1000), "DS1052E", {5, 1000000000}, CH_INFO(2, false), std_cmd},
+       {SERIES(DS1000), "DS1102E", {2, 1000000000}, CH_INFO(2, false), std_cmd},
+       {SERIES(DS1000), "DS1152E", {2, 1000000000}, CH_INFO(2, false), std_cmd},
+       {SERIES(DS1000), "DS1052D", {5, 1000000000}, CH_INFO(2, true), std_cmd},
+       {SERIES(DS1000), "DS1102D", {2, 1000000000}, CH_INFO(2, true), std_cmd},
+       {SERIES(DS1000), "DS1152D", {2, 1000000000}, CH_INFO(2, true), std_cmd},
+       {SERIES(DS2000), "DS2072", {5, 1000000000}, CH_INFO(2, false), std_cmd},
+       {SERIES(DS2000), "DS2102", {5, 1000000000}, CH_INFO(2, false), std_cmd},
+       {SERIES(DS2000), "DS2202", {2, 1000000000}, CH_INFO(2, false), std_cmd},
+       {SERIES(DS2000), "DS2302", {1, 1000000000}, CH_INFO(2, false), std_cmd},
+       {SERIES(DS2000A), "DS2072A", {5, 1000000000}, CH_INFO(2, false), std_cmd},
+       {SERIES(DS2000A), "DS2102A", {5, 1000000000}, CH_INFO(2, false), std_cmd},
+       {SERIES(DS2000A), "DS2202A", {2, 1000000000}, CH_INFO(2, false), std_cmd},
+       {SERIES(DS2000A), "DS2302A", {1, 1000000000}, CH_INFO(2, false), std_cmd},
+       {SERIES(DS2000A), "MSO2072A", {5, 1000000000}, CH_INFO(2, true), std_cmd},
+       {SERIES(DS2000A), "MSO2102A", {5, 1000000000}, CH_INFO(2, true), std_cmd},
+       {SERIES(DS2000A), "MSO2202A", {2, 1000000000}, CH_INFO(2, true), std_cmd},
+       {SERIES(DS2000A), "MSO2302A", {1, 1000000000}, CH_INFO(2, true), std_cmd},
+       {SERIES(DSO1000), "DSO1002A", {5, 1000000000}, CH_INFO(2, false), std_cmd},
+       {SERIES(DSO1000), "DSO1004A", {5, 1000000000}, CH_INFO(4, false), std_cmd},
+       {SERIES(DSO1000), "DSO1012A", {2, 1000000000}, CH_INFO(2, false), std_cmd},
+       {SERIES(DSO1000), "DSO1014A", {2, 1000000000}, CH_INFO(4, false), std_cmd},
+       {SERIES(DSO1000), "DSO1022A", {2, 1000000000}, CH_INFO(2, false), std_cmd},
+       {SERIES(DSO1000), "DSO1024A", {2, 1000000000}, CH_INFO(4, false), std_cmd},
+       {SERIES(DS1000Z), "DS1054Z", {5, 1000000000}, CH_INFO(4, false), std_cmd},
+       {SERIES(DS1000Z), "DS1074Z", {5, 1000000000}, CH_INFO(4, false), std_cmd},
+       {SERIES(DS1000Z), "DS1104Z", {5, 1000000000}, CH_INFO(4, false), std_cmd},
+       {SERIES(DS1000Z), "DS1074Z-S", {5, 1000000000}, CH_INFO(4, false), std_cmd},
+       {SERIES(DS1000Z), "DS1104Z-S", {5, 1000000000}, CH_INFO(4, false), std_cmd},
+       {SERIES(DS1000Z), "DS1074Z Plus", {5, 1000000000}, CH_INFO(4, false), std_cmd},
+       {SERIES(DS1000Z), "DS1104Z Plus", {5, 1000000000}, CH_INFO(4, false), std_cmd},
+       {SERIES(DS1000Z), "MSO1074Z", {5, 1000000000}, CH_INFO(4, true), std_cmd},
+       {SERIES(DS1000Z), "MSO1104Z", {5, 1000000000}, CH_INFO(4, true), std_cmd},
+       {SERIES(DS1000Z), "MSO1074Z-S", {5, 1000000000}, CH_INFO(4, true), std_cmd},
+       {SERIES(DS1000Z), "MSO1104Z-S", {5, 1000000000}, CH_INFO(4, true), std_cmd},
+       {SERIES(DS4000), "DS4024", {1, 1000000000}, CH_INFO(4, false), std_cmd},
+       /* TODO: Digital channels are not yet supported on MSO7000A. */
+       {SERIES(MSO7000A), "MSO7034A", {2, 1000000000}, CH_INFO(4, false), mso7000a_cmd},
 };
 
 static struct sr_dev_driver rigol_ds_driver_info;
@@ -670,7 +685,8 @@ static int config_set(uint32_t key, GVariant *data,
                 * need to express this in seconds. */
                t_dbl = -(devc->horiz_triggerpos - 0.5) * devc->timebase * devc->num_timebases;
                g_ascii_formatd(buffer, sizeof(buffer), "%.6f", t_dbl);
-               return rigol_ds_config_set(sdi, ":TIM:OFFS %s", buffer);
+               return rigol_ds_config_set(sdi,
+                       devc->model->cmds[CMD_SET_HORIZ_TRIGGERPOS].str, buffer);
        case SR_CONF_TRIGGER_LEVEL:
                t_dbl = g_variant_get_double(data);
                g_ascii_formatd(buffer, sizeof(buffer), "%.3f", t_dbl);
index fed85861ffe72514ae2d0849738397e22ba3657d..a533f12a1f12451d8acd609ccd407ab8bb0f9cf3 100644 (file)
@@ -883,7 +883,8 @@ SR_PRIV int rigol_ds_get_dev_cfg(const struct sr_dev_inst *sdi)
        sr_dbg("Current trigger source %s", devc->trigger_source);
 
        /* Horizontal trigger position. */
-       if (sr_scpi_get_float(sdi->conn, ":TIM:OFFS?", &devc->horiz_triggerpos) != SR_OK)
+       if (sr_scpi_get_float(sdi->conn, devc->model->cmds[CMD_GET_HORIZ_TRIGGERPOS].str,
+                       &devc->horiz_triggerpos) != SR_OK)
                return SR_ERR;
        sr_dbg("Current horizontal trigger position %g", devc->horiz_triggerpos);
 
index b8eb54e7a15f16264af4e67f2656d082b77c6ef5..86669b40de0ebbb6e5727d86340e136b4ad35604 100644 (file)
@@ -74,6 +74,16 @@ struct rigol_ds_series {
        int buffer_samples;
 };
 
+enum cmds {
+       CMD_GET_HORIZ_TRIGGERPOS,
+       CMD_SET_HORIZ_TRIGGERPOS,
+};
+
+struct rigol_ds_command {
+       int cmd;
+       const char *str;
+};
+
 struct rigol_ds_model {
        const struct rigol_ds_series *series;
        const char *name;
@@ -82,6 +92,7 @@ struct rigol_ds_model {
        bool has_digital;
        const char **trigger_sources;
        unsigned int num_trigger_sources;
+       const struct rigol_ds_command *cmds;
 };
 
 enum wait_events {