X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fhardware%2Fsiglent-sds%2Fapi.c;h=846399b678c4a8a3af56864e99ffbf27173b9d87;hb=HEAD;hp=ce7288190f3d5e44cda080c03cdd2fcb02ec7fe8;hpb=023c6114c518f45f09b40ef31c80bc69617d7d19;p=libsigrok.git diff --git a/src/hardware/siglent-sds/api.c b/src/hardware/siglent-sds/api.c index ce728819..76955e6d 100644 --- a/src/hardware/siglent-sds/api.c +++ b/src/hardware/siglent-sds/api.c @@ -201,35 +201,35 @@ static const struct siglent_sds_series supported_series[] = { #define SERIES(x) &supported_series[x] /* series, model, min timebase, analog channels, digital */ static const struct siglent_sds_model supported_models[] = { - { SERIES(SDS1000CML), "SDS1152CML", { 20, 1000000000 }, 2, false, 0 }, - { SERIES(SDS1000CML), "SDS1102CML", { 10, 1000000000 }, 2, false, 0 }, - { SERIES(SDS1000CML), "SDS1072CML", { 5, 1000000000 }, 2, false, 0 }, - { SERIES(SDS1000CNL), "SDS1202CNL", { 20, 1000000000 }, 2, false, 0 }, - { SERIES(SDS1000CNL), "SDS1102CNL", { 10, 1000000000 }, 2, false, 0 }, - { SERIES(SDS1000CNL), "SDS1072CNL", { 5, 1000000000 }, 2, false, 0 }, - { SERIES(SDS1000DL), "SDS1202DL", { 20, 1000000000 }, 2, false, 0 }, - { SERIES(SDS1000DL), "SDS1102DL", { 10, 1000000000 }, 2, false, 0 }, - { SERIES(SDS1000DL), "SDS1022DL", { 5, 1000000000 }, 2, false, 0 }, - { SERIES(SDS1000DL), "SDS1052DL", { 5, 1000000000 }, 2, false, 0 }, - { SERIES(SDS1000DL), "SDS1052DL+", { 5, 1000000000 }, 2, false, 0 }, - { SERIES(SDS1000X), "SDS1102X", { 2, 1000000000 }, 2, false, 0 }, - { SERIES(SDS1000XP), "SDS1102X+", { 2, 1000000000 }, 2, false, 0 }, - { SERIES(SDS1000X), "SDS1202X", { 2, 1000000000 }, 2, false, 0 }, - { SERIES(SDS1000XP), "SDS1202X+", { 2, 1000000000 }, 2, false, 0 }, - { SERIES(SDS1000XE), "SDS1202X-E", { 1, 1000000000 }, 2, false, 0 }, - { SERIES(SDS1000XE), "SDS1104X-E", { 1, 1000000000 }, 4, true, 16 }, - { SERIES(SDS1000XE), "SDS1204X-E", { 1, 1000000000 }, 4, true, 16 }, - { SERIES(SDS2000X), "SDS2072X", { 2, 1000000000 }, 2, false, 0 }, - { SERIES(SDS2000X), "SDS2074X", { 2, 1000000000 }, 4, false, 0 }, - { SERIES(SDS2000X), "SDS2102X", { 2, 1000000000 }, 2, false, 0 }, - { SERIES(SDS2000X), "SDS2104X", { 2, 1000000000 }, 4, false, 0 }, - { SERIES(SDS2000X), "SDS2202X", { 2, 1000000000 }, 2, false, 0 }, - { SERIES(SDS2000X), "SDS2204X", { 2, 1000000000 }, 4, false, 0 }, - { SERIES(SDS2000X), "SDS2302X", { 2, 1000000000 }, 2, false, 0 }, - { SERIES(SDS2000X), "SDS2304X", { 2, 1000000000 }, 4, false, 0 }, + { SERIES(SDS1000CML), "SDS1152CML", { 20, 1000000000 }, 2, FALSE, 0 }, + { SERIES(SDS1000CML), "SDS1102CML", { 10, 1000000000 }, 2, FALSE, 0 }, + { SERIES(SDS1000CML), "SDS1072CML", { 5, 1000000000 }, 2, FALSE, 0 }, + { SERIES(SDS1000CNL), "SDS1202CNL", { 20, 1000000000 }, 2, FALSE, 0 }, + { SERIES(SDS1000CNL), "SDS1102CNL", { 10, 1000000000 }, 2, FALSE, 0 }, + { SERIES(SDS1000CNL), "SDS1072CNL", { 5, 1000000000 }, 2, FALSE, 0 }, + { SERIES(SDS1000DL), "SDS1202DL", { 20, 1000000000 }, 2, FALSE, 0 }, + { SERIES(SDS1000DL), "SDS1102DL", { 10, 1000000000 }, 2, FALSE, 0 }, + { SERIES(SDS1000DL), "SDS1022DL", { 5, 1000000000 }, 2, FALSE, 0 }, + { SERIES(SDS1000DL), "SDS1052DL", { 5, 1000000000 }, 2, FALSE, 0 }, + { SERIES(SDS1000DL), "SDS1052DL+", { 5, 1000000000 }, 2, FALSE, 0 }, + { SERIES(SDS1000X), "SDS1102X", { 2, 1000000000 }, 2, FALSE, 0 }, + { SERIES(SDS1000XP), "SDS1102X+", { 2, 1000000000 }, 2, FALSE, 0 }, + { SERIES(SDS1000X), "SDS1202X", { 2, 1000000000 }, 2, FALSE, 0 }, + { SERIES(SDS1000XP), "SDS1202X+", { 2, 1000000000 }, 2, FALSE, 0 }, + { SERIES(SDS1000XE), "SDS1202X-E", { 1, 1000000000 }, 2, FALSE, 0 }, + { SERIES(SDS1000XE), "SDS1104X-E", { 1, 1000000000 }, 4, TRUE, 16 }, + { SERIES(SDS1000XE), "SDS1204X-E", { 1, 1000000000 }, 4, TRUE, 16 }, + { SERIES(SDS2000X), "SDS2072X", { 2, 1000000000 }, 2, FALSE, 0 }, + { SERIES(SDS2000X), "SDS2074X", { 2, 1000000000 }, 4, FALSE, 0 }, + { SERIES(SDS2000X), "SDS2102X", { 2, 1000000000 }, 2, FALSE, 0 }, + { SERIES(SDS2000X), "SDS2104X", { 2, 1000000000 }, 4, FALSE, 0 }, + { SERIES(SDS2000X), "SDS2202X", { 2, 1000000000 }, 2, FALSE, 0 }, + { SERIES(SDS2000X), "SDS2204X", { 2, 1000000000 }, 4, FALSE, 0 }, + { SERIES(SDS2000X), "SDS2302X", { 2, 1000000000 }, 2, FALSE, 0 }, + { SERIES(SDS2000X), "SDS2304X", { 2, 1000000000 }, 4, FALSE, 0 }, }; -SR_PRIV struct sr_dev_driver siglent_sds_driver_info; +static struct sr_dev_driver siglent_sds_driver_info; static void clear_helper(void *priv) { @@ -257,10 +257,6 @@ static struct sr_dev_inst *probe_device(struct sr_scpi_dev_inst *scpi) const struct siglent_sds_model *model; gchar *channel_name; - sr_dbg("Setting Communication Headers to off."); - if (sr_scpi_send(scpi, "CHDR OFF") != SR_OK) - return NULL; - if (sr_scpi_get_hw_id(scpi, &hw_info) != SR_OK) { sr_info("Couldn't get IDN response, retrying."); sr_scpi_close(scpi); @@ -284,6 +280,10 @@ static struct sr_dev_inst *probe_device(struct sr_scpi_dev_inst *scpi) return NULL; } + sr_dbg("Setting Communication Headers to off."); + if (sr_scpi_send(scpi, "CHDR OFF") != SR_OK) + return NULL; + sdi = g_malloc0(sizeof(struct sr_dev_inst)); sdi->vendor = g_strdup(model->series->vendor->name); sdi->model = g_strdup(model->name); @@ -305,17 +305,13 @@ static struct sr_dev_inst *probe_device(struct sr_scpi_dev_inst *scpi) channel_name = g_strdup_printf("CH%d", i + 1); ch = sr_channel_new(sdi, i, SR_CHANNEL_ANALOG, TRUE, channel_name); - devc->analog_groups[i] = g_malloc0(sizeof(struct sr_channel_group)); - - devc->analog_groups[i]->name = channel_name; + devc->analog_groups[i] = sr_channel_group_new(sdi, + channel_name, NULL); devc->analog_groups[i]->channels = g_slist_append(NULL, ch); - sdi->channel_groups = g_slist_append(sdi->channel_groups, - devc->analog_groups[i]); } if (devc->model->has_digital) { - devc->digital_group = g_malloc0(sizeof(struct sr_channel_group)); - + devc->digital_group = sr_channel_group_new(sdi, "LA", NULL); for (i = 0; i < ARRAY_SIZE(devc->digital_channels); i++) { channel_name = g_strdup_printf("D%d", i); ch = sr_channel_new(sdi, i, SR_CHANNEL_LOGIC, TRUE, channel_name); @@ -323,9 +319,6 @@ static struct sr_dev_inst *probe_device(struct sr_scpi_dev_inst *scpi) devc->digital_group->channels = g_slist_append( devc->digital_group->channels, ch); } - devc->digital_group->name = g_strdup("LA"); - sdi->channel_groups = g_slist_append(sdi->channel_groups, - devc->digital_group); } for (i = 0; i < ARRAY_SIZE(timebases); i++) { @@ -799,7 +792,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi) struct sr_scpi_dev_inst *scpi; struct dev_context *devc; struct sr_channel *ch; - struct sr_datafeed_packet packet; gboolean some_digital; GSList *l, *d; @@ -900,8 +892,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi) return SR_ERR; /* Start of first frame. */ - packet.type = SR_DF_FRAME_BEGIN; - sr_session_send(sdi, &packet); + std_session_send_df_frame_begin(sdi); return SR_OK; } @@ -923,7 +914,7 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi) return SR_OK; } -SR_PRIV struct sr_dev_driver siglent_sds_driver_info = { +static struct sr_dev_driver siglent_sds_driver_info = { .name = "siglent-sds", .longname = "Siglent SDS1000/SDS2000", .api_version = 1, @@ -941,5 +932,4 @@ SR_PRIV struct sr_dev_driver siglent_sds_driver_info = { .dev_acquisition_stop = dev_acquisition_stop, .context = NULL, }; - SR_REGISTER_DEV_DRIVER(siglent_sds_driver_info);