From: Ralf Date: Fri, 23 Oct 2020 18:15:12 +0000 (+0200) Subject: rigol-dg: Announce counter channels for dg1000z only X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=70cdf23e8b78fa8885042507bbabca3af8f88d4b;p=libsigrok.git rigol-dg: Announce counter channels for dg1000z only --- diff --git a/src/hardware/rigol-dg/api.c b/src/hardware/rigol-dg/api.c index f9a90e68..37679cd6 100644 --- a/src/hardware/rigol-dg/api.c +++ b/src/hardware/rigol-dg/api.c @@ -290,72 +290,84 @@ static const struct device_spec device_models[] = { ARRAY_AND_SIZE(dg1000z_devopts_cg), ARRAY_AND_SIZE(dg811_channels), cmdset_dg1000z, + TRUE, }, { "Rigol Technologies", "DG812", ARRAY_AND_SIZE(dg1000z_devopts), ARRAY_AND_SIZE(dg1000z_devopts_cg), ARRAY_AND_SIZE(dg812_channels), cmdset_dg1000z, + TRUE, }, { "Rigol Technologies", "DG821", ARRAY_AND_SIZE(dg1000z_devopts), ARRAY_AND_SIZE(dg1000z_devopts_cg), ARRAY_AND_SIZE(dg821_channels), cmdset_dg1000z, + TRUE, }, { "Rigol Technologies", "DG822", ARRAY_AND_SIZE(dg1000z_devopts), ARRAY_AND_SIZE(dg1000z_devopts_cg), ARRAY_AND_SIZE(dg822_channels), cmdset_dg1000z, + TRUE, }, { "Rigol Technologies", "DG831", ARRAY_AND_SIZE(dg1000z_devopts), ARRAY_AND_SIZE(dg1000z_devopts_cg), ARRAY_AND_SIZE(dg831_channels), cmdset_dg1000z, + TRUE, }, { "Rigol Technologies", "DG832", ARRAY_AND_SIZE(dg1000z_devopts), ARRAY_AND_SIZE(dg1000z_devopts_cg), ARRAY_AND_SIZE(dg832_channels), cmdset_dg1000z, + TRUE, }, { "Rigol Technologies", "DG952", ARRAY_AND_SIZE(dg1000z_devopts), ARRAY_AND_SIZE(dg1000z_devopts_cg), ARRAY_AND_SIZE(dg952_channels), cmdset_dg1000z, + TRUE, }, { "Rigol Technologies", "DG972", ARRAY_AND_SIZE(dg1000z_devopts), ARRAY_AND_SIZE(dg1000z_devopts_cg), ARRAY_AND_SIZE(dg972_channels), cmdset_dg1000z, + TRUE, }, { "Rigol Technologies", "DG992", ARRAY_AND_SIZE(dg1000z_devopts), ARRAY_AND_SIZE(dg1000z_devopts_cg), ARRAY_AND_SIZE(dg992_channels), cmdset_dg1000z, + TRUE, }, { "Rigol Technologies", "DG1022Z", ARRAY_AND_SIZE(dg1000z_devopts), ARRAY_AND_SIZE(dg1000z_devopts_cg), ARRAY_AND_SIZE(dg1022z_channels), cmdset_dg1000z, + TRUE, }, { "Rigol Technologies", "DG1032Z", ARRAY_AND_SIZE(dg1000z_devopts), ARRAY_AND_SIZE(dg1000z_devopts_cg), ARRAY_AND_SIZE(dg1032z_channels), cmdset_dg1000z, + TRUE, }, { "Rigol Technologies", "DG1062Z", ARRAY_AND_SIZE(dg1000z_devopts), ARRAY_AND_SIZE(dg1000z_devopts_cg), ARRAY_AND_SIZE(dg1062z_channels), cmdset_dg1000z, + TRUE, }, /* MSO5000 devices*/ { "Rigol Technologies", "MSO5354", @@ -363,36 +375,42 @@ static const struct device_spec device_models[] = { ARRAY_AND_SIZE(mso5000_devopts_cg), ARRAY_AND_SIZE(mso5000_channels), cmdset_mso5000, + FALSE, }, { "Rigol Technologies", "MSO5204", ARRAY_AND_SIZE(mso5000_devopts), ARRAY_AND_SIZE(mso5000_devopts_cg), ARRAY_AND_SIZE(mso5000_channels), cmdset_mso5000, + FALSE, }, { "Rigol Technologies", "MSO5104", ARRAY_AND_SIZE(mso5000_devopts), ARRAY_AND_SIZE(mso5000_devopts_cg), ARRAY_AND_SIZE(mso5000_channels), cmdset_mso5000, + FALSE, }, { "Rigol Technologies", "MSO5102", ARRAY_AND_SIZE(mso5000_devopts), ARRAY_AND_SIZE(mso5000_devopts_cg), ARRAY_AND_SIZE(mso5000_channels), cmdset_mso5000, + FALSE, }, { "Rigol Technologies", "MSO5074", ARRAY_AND_SIZE(mso5000_devopts), ARRAY_AND_SIZE(mso5000_devopts_cg), ARRAY_AND_SIZE(mso5000_channels), cmdset_mso5000, + FALSE, }, { "Rigol Technologies", "MSO5072", ARRAY_AND_SIZE(mso5000_devopts), ARRAY_AND_SIZE(mso5000_devopts_cg), ARRAY_AND_SIZE(mso5000_channels), cmdset_mso5000, + FALSE, }, }; @@ -479,11 +497,13 @@ static struct sr_dev_inst *probe_device(struct sr_scpi_dev_inst *scpi) cg->channels = g_slist_append(cg->channels, ch); } - /* Create channels for the frequency counter output. */ - ch = sr_channel_new(sdi, ch_idx++, SR_CHANNEL_ANALOG, TRUE, "FREQ1"); - ch = sr_channel_new(sdi, ch_idx++, SR_CHANNEL_ANALOG, TRUE, "PERIOD1"); - ch = sr_channel_new(sdi, ch_idx++, SR_CHANNEL_ANALOG, TRUE, "DUTY1"); - ch = sr_channel_new(sdi, ch_idx++, SR_CHANNEL_ANALOG, TRUE, "WIDTH1"); + if (device->has_counter) { + /* Create channels for the frequency counter output. */ + ch = sr_channel_new(sdi, ch_idx++, SR_CHANNEL_ANALOG, TRUE, "FREQ1"); + ch = sr_channel_new(sdi, ch_idx++, SR_CHANNEL_ANALOG, TRUE, "PERIOD1"); + ch = sr_channel_new(sdi, ch_idx++, SR_CHANNEL_ANALOG, TRUE, "DUTY1"); + ch = sr_channel_new(sdi, ch_idx++, SR_CHANNEL_ANALOG, TRUE, "WIDTH1"); + } /* Put device back to "local" mode, in case only a scan was done... */ command = sr_scpi_cmd_get(devc->cmdset, PSG_CMD_SETUP_LOCAL); diff --git a/src/hardware/rigol-dg/protocol.h b/src/hardware/rigol-dg/protocol.h index 02e1acdc..9093aa52 100644 --- a/src/hardware/rigol-dg/protocol.h +++ b/src/hardware/rigol-dg/protocol.h @@ -124,6 +124,7 @@ struct device_spec { const struct channel_spec *channels; const uint32_t num_channels; const struct scpi_command *cmdset; + const gboolean has_counter; }; struct dev_context {