diff --git a/contrib/60-libsigrok.rules b/contrib/60-libsigrok.rules index cfb5daa49..f95a43ff0 100644 --- a/contrib/60-libsigrok.rules +++ b/contrib/60-libsigrok.rules @@ -249,6 +249,9 @@ ATTRS{idVendor}=="1ab1", ATTRS{idProduct}=="0e11", ENV{ID_SIGROK}="1" # Rigol MSO5000 series ATTRS{idVendor}=="1ab1", ATTRS{idProduct}=="0515", ENV{ID_SIGROK}="1" +# Rigol DHO800 and DHO900 series +ATTRS{idVendor}=="1ab1", ATTRS{idProduct}=="044c", ENV{ID_SIGROK}="1" + # Rohde&Schwarz HMO series mixed-signal oscilloscope (previously branded Hameg) VCP/USBTMC mode ATTRS{idVendor}=="0aad", ATTRS{idProduct}=="0117", ENV{ID_SIGROK}="1" ATTRS{idVendor}=="0aad", ATTRS{idProduct}=="0118", ENV{ID_SIGROK}="1" diff --git a/src/hardware/rigol-ds/api.c b/src/hardware/rigol-ds/api.c index 6703d1cea..810ae0e49 100644 --- a/src/hardware/rigol-ds/api.c +++ b/src/hardware/rigol-ds/api.c @@ -105,6 +105,7 @@ static const uint64_t timebases[][2] = { static const uint64_t vdivs[][2] = { /* microvolts */ + { 200, 1000000 }, { 500, 1000000 }, /* millivolts */ { 1, 1000 }, @@ -185,6 +186,8 @@ enum series { DS4000, MSO5000, MSO7000A, + DHO800, + DHO900, }; /* short name, full name */ @@ -217,6 +220,10 @@ static const struct rigol_ds_series supported_series[] = { {1000, 1}, {500, 1000000}, 10, 1000, 0}, [MSO7000A] = {VENDOR(AGILENT), "MSO7000A", PROTOCOL_V4, FORMAT_IEEE488_2, {50, 1}, {2, 1000}, 10, 1000, 8000000}, + [DHO800] = {VENDOR(RIGOL), "DHO800", PROTOCOL_V6, FORMAT_IEEE488_2, + {500, 1}, {500, 1000000}, 10, 1000, 10000000}, + [DHO900] = {VENDOR(RIGOL), "DHO900", PROTOCOL_V6, FORMAT_IEEE488_2, + {500, 1}, {200, 1000000}, 10, 1000, 10000000}, }; #define SERIES(x) &supported_series[x] @@ -291,6 +298,14 @@ static const struct rigol_ds_model supported_models[] = { {SERIES(MSO5000), "MSO5354", {1, 1000000000}, CH_INFO(4, true), std_cmd}, /* TODO: Digital channels are not yet supported on MSO7000A. */ {SERIES(MSO7000A), "MSO7034A", {2, 1000000000}, CH_INFO(4, false), mso7000a_cmd}, + {SERIES(DHO800), "DHO802", {5, 1000000000}, CH_INFO(2, false), std_cmd}, + {SERIES(DHO800), "DHO804", {5, 1000000000}, CH_INFO(4, false), std_cmd}, + {SERIES(DHO800), "DHO812", {5, 1000000000}, CH_INFO(2, false), std_cmd}, + {SERIES(DHO800), "DHO814", {5, 1000000000}, CH_INFO(4, false), std_cmd}, + {SERIES(DHO900), "DHO914", {2, 1000000000}, CH_INFO(4, true), std_cmd}, + {SERIES(DHO900), "DHO914S", {2, 1000000000}, CH_INFO(4, true), std_cmd}, + {SERIES(DHO900), "DHO924", {2, 1000000000}, CH_INFO(4, true), std_cmd}, + {SERIES(DHO900), "DHO924S", {2, 1000000000}, CH_INFO(4, true), std_cmd}, }; static struct sr_dev_driver rigol_ds_driver_info; @@ -913,20 +928,43 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi) some_digital = TRUE; /* Turn on LA module if currently off. */ if (!devc->la_enabled) { - if (rigol_ds_config_set(sdi, protocol >= PROTOCOL_V3 ? - ":LA:STAT ON" : ":LA:DISP ON") != SR_OK) + switch (protocol) { + case PROTOCOL_V1: + case PROTOCOL_V2: + cmd = ":LA:DISP ON"; + break; + case PROTOCOL_V3: + case PROTOCOL_V4: + case PROTOCOL_V5: + cmd = ":LA:STAT ON"; + break; + case PROTOCOL_V6: + cmd = ":LA:ENAB ON"; + break; + } + if (rigol_ds_config_set(sdi, cmd) != SR_OK) return SR_ERR; devc->la_enabled = TRUE; } } if (ch->enabled != devc->digital_channels[ch->index]) { /* Enabled channel is currently disabled, or vice versa. */ - if (protocol >= PROTOCOL_V5) - cmd = ":LA:DISP D%d,%s"; - else if (protocol >= PROTOCOL_V3) - cmd = ":LA:DIG%d:DISP %s"; - else + switch (protocol) { + case PROTOCOL_V1: + case PROTOCOL_V2: cmd = ":DIG%d:TURN %s"; + break; + case PROTOCOL_V3: + case PROTOCOL_V4: + cmd = ":LA:DIG%d:DISP %s"; + break; + case PROTOCOL_V5: + cmd = ":LA:DISP D%d,%s"; + break; + case PROTOCOL_V6: + cmd = ":LA:DIG:ENAB %"; + break; + } if (rigol_ds_config_set(sdi, cmd, ch->index, ch->enabled ? "ON" : "OFF") != SR_OK) @@ -940,11 +978,24 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi) return SR_ERR; /* Turn off LA module if on and no digital channels selected. */ - if (devc->la_enabled && !some_digital) - if (rigol_ds_config_set(sdi, - devc->model->series->protocol >= PROTOCOL_V3 ? - ":LA:STAT OFF" : ":LA:DISP OFF") != SR_OK) + if (devc->la_enabled && !some_digital) { + switch (protocol) { + case PROTOCOL_V1: + case PROTOCOL_V2: + cmd = ":LA:DISP OFF"; + break; + case PROTOCOL_V3: + case PROTOCOL_V4: + case PROTOCOL_V5: + cmd = ":LA:STAT OFF"; + break; + case PROTOCOL_V6: + cmd = ":LA:ENAB OFF"; + break; + } + if (rigol_ds_config_set(sdi, cmd) != SR_OK) return SR_ERR; + } /* Set memory mode. */ if (devc->data_source == DATA_SOURCE_SEGMENTED) { @@ -970,6 +1021,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi) break; } case PROTOCOL_V5: + case PROTOCOL_V6: /* The frame limit has to be read on the fly, just set up * reading of the first frame */ if (rigol_ds_config_set(sdi, "REC:CURR 1") != SR_OK) @@ -984,7 +1036,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi) devc->analog_frame_size = analog_frame_size(sdi); devc->digital_frame_size = digital_frame_size(sdi); - switch (devc->model->series->protocol) { + switch (protocol) { case PROTOCOL_V2: if (rigol_ds_config_set(sdi, ":ACQ:MEMD LONG") != SR_OK) return SR_ERR; @@ -1021,7 +1073,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi) (devc->timebase * devc->model->series->num_horizontal_divs); } else { float xinc; - if (devc->model->series->protocol < PROTOCOL_V3) { + if (protocol < PROTOCOL_V3) { sr_err("Cannot get samplerate (below V3)."); return SR_ERR; } diff --git a/src/hardware/rigol-ds/protocol.c b/src/hardware/rigol-ds/protocol.c index 05aaf113f..a2d349303 100644 --- a/src/hardware/rigol-ds/protocol.c +++ b/src/hardware/rigol-ds/protocol.c @@ -385,6 +385,7 @@ SR_PRIV int rigol_ds_capture_start(const struct sr_dev_inst *sdi) case PROTOCOL_V3: case PROTOCOL_V4: case PROTOCOL_V5: + case PROTOCOL_V6: if (first_frame && rigol_ds_config_set(sdi, ":WAV:FORM BYTE") != SR_OK) return SR_ERR; if (devc->data_source == DATA_SOURCE_LIVE) { @@ -499,6 +500,7 @@ SR_PRIV int rigol_ds_channel_start(const struct sr_dev_inst *sdi) break; case PROTOCOL_V4: case PROTOCOL_V5: + case PROTOCOL_V6: if (ch->type == SR_CHANNEL_ANALOG) { if (rigol_ds_config_set(sdi, ":WAV:SOUR CHAN%d", ch->index + 1) != SR_OK) @@ -828,7 +830,7 @@ SR_PRIV int rigol_ds_receive(int fd, int revents, void *cb_data) * next frame and read it back instead. */ if (devc->data_source == DATA_SOURCE_SEGMENTED && - devc->model->series->protocol == PROTOCOL_V5) { + devc->model->series->protocol >= PROTOCOL_V5) { int frames = 0; if (rigol_ds_config_set(sdi, "REC:CURR %d", devc->num_frames + 1) != SR_OK) return SR_ERR; @@ -882,20 +884,41 @@ SR_PRIV int rigol_ds_get_dev_cfg(const struct sr_dev_inst *sdi) /* Digital channel state. */ if (devc->model->has_digital) { - if (sr_scpi_get_bool(sdi->conn, - devc->model->series->protocol >= PROTOCOL_V3 ? - ":LA:STAT?" : ":LA:DISP?", - &devc->la_enabled) != SR_OK) + switch (devc->model->series->protocol) { + case PROTOCOL_V1: + case PROTOCOL_V2: + cmd = ":LA:DISP?"; + break; + case PROTOCOL_V3: + case PROTOCOL_V4: + case PROTOCOL_V5: + cmd = ":LA:STAT?"; + break; + case PROTOCOL_V6: + cmd = ":LA:ENAB?"; + break; + } + if (sr_scpi_get_bool(sdi->conn, cmd, &devc->la_enabled) != SR_OK) return SR_ERR; sr_dbg("Logic analyzer %s, current digital channel state:", devc->la_enabled ? "enabled" : "disabled"); for (i = 0; i < ARRAY_SIZE(devc->digital_channels); i++) { - if (devc->model->series->protocol >= PROTOCOL_V5) - cmd = g_strdup_printf(":LA:DISP? D%d", i); - else if (devc->model->series->protocol >= PROTOCOL_V3) - cmd = g_strdup_printf(":LA:DIG%d:DISP?", i); - else + switch (devc->model->series->protocol) { + case PROTOCOL_V1: + case PROTOCOL_V2: cmd = g_strdup_printf(":DIG%d:TURN?", i); + break; + case PROTOCOL_V3: + case PROTOCOL_V4: + cmd = g_strdup_printf(":LA:DIG%d:DISP?", i); + break; + case PROTOCOL_V5: + cmd = g_strdup_printf(":LA:DISP? D%d", i); + break; + case PROTOCOL_V6: + cmd = g_strdup_printf(":LA:DIG:ENAB? D%d", i); + break; + } res = sr_scpi_get_bool(sdi->conn, cmd, &devc->digital_channels[i]); g_free(cmd); if (res != SR_OK) diff --git a/src/hardware/rigol-ds/protocol.h b/src/hardware/rigol-ds/protocol.h index e2efffa22..dbfbf1464 100644 --- a/src/hardware/rigol-ds/protocol.h +++ b/src/hardware/rigol-ds/protocol.h @@ -43,6 +43,7 @@ enum protocol_version { PROTOCOL_V3, /* DS2000, DSO1000 */ PROTOCOL_V4, /* DS1000Z */ PROTOCOL_V5, /* MSO5000 */ + PROTOCOL_V6, /* DHO800, DHO900 */ }; enum data_format {