From: Uwe Hermann Date: Fri, 22 Jun 2018 20:37:10 +0000 (+0200) Subject: rigol-ds: Add initial Agilent MSO7034A support. X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=0f523f2b45e84114add85cec5a97aed3f85f95e6;p=libsigrok.git rigol-ds: Add initial Agilent MSO7034A support. Digital channels (and various other features) are not yet supported. --- diff --git a/contrib/60-libsigrok.rules b/contrib/60-libsigrok.rules index 3bed6c51..0013e299 100644 --- a/contrib/60-libsigrok.rules +++ b/contrib/60-libsigrok.rules @@ -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 diff --git a/src/hardware/rigol-ds/api.c b/src/hardware/rigol-ds/api.c index b34aeee6..bdc15b7d 100644 --- a/src/hardware/rigol-ds/api.c +++ b/src/hardware/rigol-ds/api.c @@ -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); diff --git a/src/hardware/rigol-ds/protocol.c b/src/hardware/rigol-ds/protocol.c index fed85861..a533f12a 100644 --- a/src/hardware/rigol-ds/protocol.c +++ b/src/hardware/rigol-ds/protocol.c @@ -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); diff --git a/src/hardware/rigol-ds/protocol.h b/src/hardware/rigol-ds/protocol.h index b8eb54e7..86669b40 100644 --- a/src/hardware/rigol-ds/protocol.h +++ b/src/hardware/rigol-ds/protocol.h @@ -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 {