X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fhardware%2Frigol-ds%2Fapi.c;h=95de8f6a0d7b30339a7fd6756ba3d4bfe556d0f6;hb=0f5dcee6cea4288a429876d0c38e429dded4b75e;hp=01914ff85c61d3f4e7c3abc628aed86ca66c923e;hpb=19f31c8acec775a35482328f517cb08dc66c4d66;p=libsigrok.git diff --git a/src/hardware/rigol-ds/api.c b/src/hardware/rigol-ds/api.c index 01914ff8..95de8f6a 100644 --- a/src/hardware/rigol-ds/api.c +++ b/src/hardware/rigol-ds/api.c @@ -42,7 +42,7 @@ static const uint32_t drvopts[] = { }; static const uint32_t devopts[] = { - SR_CONF_LIMIT_FRAMES | SR_CONF_SET, + SR_CONF_LIMIT_FRAMES | SR_CONF_GET | SR_CONF_SET, SR_CONF_SAMPLERATE | SR_CONF_GET, SR_CONF_TIMEBASE | SR_CONF_GET | SR_CONF_SET | SR_CONF_LIST, SR_CONF_NUM_HDIV | SR_CONF_GET, @@ -275,6 +275,7 @@ static const struct rigol_ds_model supported_models[] = { {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), "DS1102Z-E", {2, 1000000000}, CH_INFO(2, false), std_cmd}, {SERIES(DS1000Z), "DS1202Z-E", {2, 1000000000}, CH_INFO(2, 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}, @@ -293,6 +294,8 @@ static const struct rigol_ds_model supported_models[] = { static struct sr_dev_driver rigol_ds_driver_info; +static int analog_frame_size(const struct sr_dev_inst *); + static void clear_helper(struct dev_context *devc) { unsigned int i; @@ -570,6 +573,9 @@ static int config_get(uint32_t key, GVariant **data, else *data = g_variant_new_string("Segmented"); break; + case SR_CONF_LIMIT_FRAMES: + *data = g_variant_new_uint64(devc->limit_frames); + break; case SR_CONF_SAMPLERATE: *data = g_variant_new_uint64(devc->sample_rate); break; @@ -876,9 +882,11 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi) gboolean some_digital; GSList *l; char *cmd; + int protocol; scpi = sdi->conn; devc = sdi->priv; + protocol = devc->model->series->protocol; devc->num_frames = 0; devc->num_frames_segmented = 0; @@ -902,7 +910,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi) /* Only one list entry for older protocols. All channels are * retrieved together when this entry is processed. */ if (ch->enabled && ( - devc->model->series->protocol > PROTOCOL_V3 || + protocol > PROTOCOL_V3 || !some_digital)) devc->enabled_channels = g_slist_append( devc->enabled_channels, ch); @@ -910,8 +918,7 @@ 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, - devc->model->series->protocol >= PROTOCOL_V3 ? + if (rigol_ds_config_set(sdi, protocol >= PROTOCOL_V3 ? ":LA:STAT ON" : ":LA:DISP ON") != SR_OK) return SR_ERR; devc->la_enabled = TRUE; @@ -919,9 +926,9 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi) } if (ch->enabled != devc->digital_channels[ch->index]) { /* Enabled channel is currently disabled, or vice versa. */ - if (devc->model->series->protocol >= PROTOCOL_V5) + if (protocol >= PROTOCOL_V5) cmd = ":LA:DISP D%d,%s"; - else if (devc->model->series->protocol >= PROTOCOL_V3) + else if (protocol >= PROTOCOL_V3) cmd = ":LA:DIG%d:DISP %s"; else cmd = ":DIG%d:TURN %s"; @@ -946,11 +953,20 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi) /* Set memory mode. */ if (devc->data_source == DATA_SOURCE_SEGMENTED) { - switch (devc->model->series->protocol) { + switch (protocol) { + case PROTOCOL_V1: + case PROTOCOL_V2: + /* V1 and V2 do not have segmented data */ + sr_err("Data source 'Segmented' not supported on this model"); + break; + case PROTOCOL_V3: case PROTOCOL_V4: { int frames = 0; - sr_scpi_get_int(sdi->conn, "FUNC:WREP:FEND?", &frames); + if (sr_scpi_get_int(sdi->conn, + protocol == PROTOCOL_V4 ? "FUNC:WREP:FEND?" : + "FUNC:WREP:FMAX?", &frames) != SR_OK) + return SR_ERR; if (frames <= 0) { sr_err("No segmented data available"); return SR_ERR;