]> sigrok.org Git - libsigrok.git/commitdiff
scpi-pps: Add configurable sr_mqflags.
authorFrank Stettner <redacted>
Tue, 9 Apr 2019 15:41:29 +0000 (17:41 +0200)
committerUwe Hermann <redacted>
Wed, 17 Apr 2019 15:44:56 +0000 (17:44 +0200)
src/hardware/scpi-pps/api.c
src/hardware/scpi-pps/profiles.c
src/hardware/scpi-pps/protocol.c
src/hardware/scpi-pps/protocol.h

index 8fff5748d44208a49234b7c7b9362a19d5787f8e..104a020d84e06859f716b0603963a8f81f32fd89 100644 (file)
@@ -152,6 +152,13 @@ static struct sr_dev_inst *probe_device(struct sr_scpi_dev_inst *scpi,
                                for (l = sdi->channels; l; l = l->next) {
                                        ch = l->data;
                                        pch = ch->priv;
                                for (l = sdi->channels; l; l = l->next) {
                                        ch = l->data;
                                        pch = ch->priv;
+                                       /* Add mqflags from channel_group_spec only to voltage
+                                        * and current channels
+                                        */
+                                       if (pch->mq == SR_MQ_VOLTAGE || pch->mq == SR_MQ_CURRENT)
+                                               pch->mqflags = cgs->mqflags;
+                                       else
+                                               pch->mqflags = 0;
                                        if (pch->hw_output_idx == j)
                                                cg->channels = g_slist_append(cg->channels, ch);
                                }
                                        if (pch->hw_output_idx == j)
                                                cg->channels = g_slist_append(cg->channels, ch);
                                }
index ef1a12ad13abe59a046eafc45e3521c3c9f1cbf1..a83e0396d2619b58bd15cf4915155e835a02316c 100644 (file)
@@ -48,7 +48,7 @@ static const uint32_t agilent_n5700a_devopts_cg[] = {
 };
 
 static const struct channel_group_spec agilent_n5700a_cg[] = {
 };
 
 static const struct channel_group_spec agilent_n5700a_cg[] = {
-       { "1", CH_IDX(0), PPS_OVP | PPS_OCP },
+       { "1", CH_IDX(0), PPS_OVP | PPS_OCP, SR_MQFLAG_DC },
 };
 
 static const struct channel_spec agilent_n5767a_ch[] = {
 };
 
 static const struct channel_spec agilent_n5767a_ch[] = {
@@ -109,9 +109,9 @@ static const struct channel_spec bk_9130_ch[] = {
 };
 
 static const struct channel_group_spec bk_9130_cg[] = {
 };
 
 static const struct channel_group_spec bk_9130_cg[] = {
-       { "1", CH_IDX(0), PPS_OVP },
-       { "2", CH_IDX(1), PPS_OVP },
-       { "3", CH_IDX(2), PPS_OVP },
+       { "1", CH_IDX(0), PPS_OVP, SR_MQFLAG_DC },
+       { "2", CH_IDX(1), PPS_OVP, SR_MQFLAG_DC },
+       { "3", CH_IDX(2), PPS_OVP, SR_MQFLAG_DC },
 };
 
 static const struct scpi_command bk_9130_cmd[] = {
 };
 
 static const struct scpi_command bk_9130_cmd[] = {
@@ -156,7 +156,7 @@ static const struct channel_spec chroma_61604_ch[] = {
 };
 
 static const struct channel_group_spec chroma_61604_cg[] = {
 };
 
 static const struct channel_group_spec chroma_61604_cg[] = {
-       { "1", CH_IDX(0), PPS_OVP | PPS_OCP },
+       { "1", CH_IDX(0), PPS_OVP | PPS_OCP, SR_MQFLAG_AC },
 };
 
 static const struct scpi_command chroma_61604_cmd[] = {
 };
 
 static const struct scpi_command chroma_61604_cmd[] = {
@@ -199,7 +199,7 @@ static const uint32_t chroma_62000_devopts_cg[] = {
 };
 
 static const struct channel_group_spec chroma_62000_cg[] = {
 };
 
 static const struct channel_group_spec chroma_62000_cg[] = {
-       { "1", CH_IDX(0), PPS_OVP | PPS_OCP },
+       { "1", CH_IDX(0), PPS_OVP | PPS_OCP, SR_MQFLAG_DC },
 };
 
 static const struct scpi_command chroma_62000_cmd[] = {
 };
 
 static const struct scpi_command chroma_62000_cmd[] = {
@@ -305,7 +305,7 @@ static const struct channel_spec rigol_dp712_ch[] = {
 };
 
 static const struct channel_group_spec rigol_dp700_cg[] = {
 };
 
 static const struct channel_group_spec rigol_dp700_cg[] = {
-       { "1", CH_IDX(0), PPS_OVP | PPS_OCP },
+       { "1", CH_IDX(0), PPS_OVP | PPS_OCP, SR_MQFLAG_DC },
 };
 
 /* Same as the DP800 series, except for the missing :SYST:OTP* commands. */
 };
 
 /* Same as the DP800 series, except for the missing :SYST:OTP* commands. */
@@ -383,14 +383,14 @@ static const struct channel_spec rigol_dp832_ch[] = {
 };
 
 static const struct channel_group_spec rigol_dp820_cg[] = {
 };
 
 static const struct channel_group_spec rigol_dp820_cg[] = {
-       { "1", CH_IDX(0), PPS_OVP | PPS_OCP },
-       { "2", CH_IDX(1), PPS_OVP | PPS_OCP },
+       { "1", CH_IDX(0), PPS_OVP | PPS_OCP, SR_MQFLAG_DC },
+       { "2", CH_IDX(1), PPS_OVP | PPS_OCP, SR_MQFLAG_DC },
 };
 
 static const struct channel_group_spec rigol_dp830_cg[] = {
 };
 
 static const struct channel_group_spec rigol_dp830_cg[] = {
-       { "1", CH_IDX(0), PPS_OVP | PPS_OCP },
-       { "2", CH_IDX(1), PPS_OVP | PPS_OCP },
-       { "3", CH_IDX(2), PPS_OVP | PPS_OCP },
+       { "1", CH_IDX(0), PPS_OVP | PPS_OCP, SR_MQFLAG_DC },
+       { "2", CH_IDX(1), PPS_OVP | PPS_OCP, SR_MQFLAG_DC },
+       { "3", CH_IDX(2), PPS_OVP | PPS_OCP, SR_MQFLAG_DC },
 };
 
 static const struct scpi_command rigol_dp800_cmd[] = {
 };
 
 static const struct scpi_command rigol_dp800_cmd[] = {
@@ -491,7 +491,7 @@ static const struct channel_spec hp_6634b_ch[] = {
 };
 
 static const struct channel_group_spec hp_663xx_cg[] = {
 };
 
 static const struct channel_group_spec hp_663xx_cg[] = {
-       { "1", CH_IDX(0), 0 },
+       { "1", CH_IDX(0), 0, SR_MQFLAG_DC },
 };
 
 static const struct scpi_command hp_6630a_cmd[] = {
 };
 
 static const struct scpi_command hp_6630a_cmd[] = {
@@ -826,6 +826,7 @@ static int philips_pm2800_probe_channels(struct sr_dev_inst *sdi,
                (*channel_groups)[i].name = (char *)philips_pm2800_names[i];
                (*channel_groups)[i].channel_index_mask = 1 << i;
                (*channel_groups)[i].features = PPS_OTP | PPS_OVP | PPS_OCP;
                (*channel_groups)[i].name = (char *)philips_pm2800_names[i];
                (*channel_groups)[i].channel_index_mask = 1 << i;
                (*channel_groups)[i].features = PPS_OTP | PPS_OVP | PPS_OCP;
+               (*channel_groups)[i].mqflags = SR_MQFLAG_DC;
        }
        *num_channels = *num_channel_groups = num_modules;
 
        }
        *num_channels = *num_channel_groups = num_modules;
 
@@ -878,9 +879,9 @@ static const struct channel_spec rs_hmc8043_ch[] = {
 };
 
 static const struct channel_group_spec rs_hmc8043_cg[] = {
 };
 
 static const struct channel_group_spec rs_hmc8043_cg[] = {
-       { "1", CH_IDX(0), PPS_OVP },
-       { "2", CH_IDX(1), PPS_OVP },
-       { "3", CH_IDX(2), PPS_OVP },
+       { "1", CH_IDX(0), PPS_OVP, SR_MQFLAG_DC },
+       { "2", CH_IDX(1), PPS_OVP, SR_MQFLAG_DC },
+       { "3", CH_IDX(2), PPS_OVP, SR_MQFLAG_DC },
 };
 
 static const struct scpi_command rs_hmc8043_cmd[] = {
 };
 
 static const struct scpi_command rs_hmc8043_cmd[] = {
index 762fcae1ec8ed434a3095ad4cb410f617bcecd04..b6e60b9622e24e55f13d5411d91594836db75e91 100644 (file)
@@ -105,6 +105,7 @@ SR_PRIV int scpi_pps_receive_data(int fd, int revents, void *cb_data)
        analog.meaning->channels = g_slist_append(NULL, devc->cur_acquisition_channel);
        analog.num_samples = 1;
        analog.meaning->mq = pch->mq;
        analog.meaning->channels = g_slist_append(NULL, devc->cur_acquisition_channel);
        analog.num_samples = 1;
        analog.meaning->mq = pch->mq;
+       analog.meaning->mqflags = pch->mqflags;
        if (pch->mq == SR_MQ_VOLTAGE) {
                analog.meaning->unit = SR_UNIT_VOLT;
                analog.encoding->digits = ch_spec->voltage[4];
        if (pch->mq == SR_MQ_VOLTAGE) {
                analog.meaning->unit = SR_UNIT_VOLT;
                analog.encoding->digits = ch_spec->voltage[4];
@@ -118,7 +119,6 @@ SR_PRIV int scpi_pps_receive_data(int fd, int revents, void *cb_data)
                analog.encoding->digits = ch_spec->power[4];
                analog.spec->spec_digits = ch_spec->power[3];
        }
                analog.encoding->digits = ch_spec->power[4];
                analog.spec->spec_digits = ch_spec->power[3];
        }
-       analog.meaning->mqflags = SR_MQFLAG_DC;
        f = (float)g_variant_get_double(gvdata);
        g_variant_unref(gvdata);
        analog.data = &f;
        f = (float)g_variant_get_double(gvdata);
        g_variant_unref(gvdata);
        analog.data = &f;
index e9da0d6dd6e82fe6022cbb12ec6faa97370251d2..04f3a0b00c3cf4323dfd4eebf6f9a844a2e693ec 100644 (file)
@@ -126,10 +126,13 @@ struct channel_group_spec {
        const char *name;
        uint64_t channel_index_mask;
        uint64_t features;
        const char *name;
        uint64_t channel_index_mask;
        uint64_t features;
+       /* The mqflags will only be applied to voltage and current channels! */
+       enum sr_mqflag mqflags;
 };
 
 struct pps_channel {
        enum sr_mq mq;
 };
 
 struct pps_channel {
        enum sr_mq mq;
+       enum sr_mqflag mqflags;
        unsigned int hw_output_idx;
        const char *hwname;
        int digits;
        unsigned int hw_output_idx;
        const char *hwname;
        int digits;