scpi-pps: Add configurable sr_mqflags.

This commit is contained in:
Frank Stettner 2019-04-09 17:41:29 +02:00 committed by Uwe Hermann
parent fe4bb77492
commit f2bbcc330a
4 changed files with 28 additions and 17 deletions

View 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) { for (l = sdi->channels; l; l = l->next) {
ch = l->data; ch = l->data;
pch = ch->priv; 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) if (pch->hw_output_idx == j)
cg->channels = g_slist_append(cg->channels, ch); cg->channels = g_slist_append(cg->channels, ch);
} }

View 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 }, { "1", CH_IDX(0), PPS_OVP, SR_MQFLAG_DC },
{ "2", CH_IDX(1), PPS_OVP }, { "2", CH_IDX(1), PPS_OVP, SR_MQFLAG_DC },
{ "3", CH_IDX(2), PPS_OVP }, { "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 }, { "1", CH_IDX(0), PPS_OVP | PPS_OCP, SR_MQFLAG_DC },
{ "2", CH_IDX(1), PPS_OVP | PPS_OCP }, { "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 }, { "1", CH_IDX(0), PPS_OVP | PPS_OCP, SR_MQFLAG_DC },
{ "2", CH_IDX(1), PPS_OVP | PPS_OCP }, { "2", CH_IDX(1), PPS_OVP | PPS_OCP, SR_MQFLAG_DC },
{ "3", CH_IDX(2), PPS_OVP | PPS_OCP }, { "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].name = (char *)philips_pm2800_names[i];
(*channel_groups)[i].channel_index_mask = 1 << i; (*channel_groups)[i].channel_index_mask = 1 << i;
(*channel_groups)[i].features = PPS_OTP | PPS_OVP | PPS_OCP; (*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 }, { "1", CH_IDX(0), PPS_OVP, SR_MQFLAG_DC },
{ "2", CH_IDX(1), PPS_OVP }, { "2", CH_IDX(1), PPS_OVP, SR_MQFLAG_DC },
{ "3", CH_IDX(2), PPS_OVP }, { "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[] = {

View 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.meaning->channels = g_slist_append(NULL, devc->cur_acquisition_channel);
analog.num_samples = 1; analog.num_samples = 1;
analog.meaning->mq = pch->mq; analog.meaning->mq = pch->mq;
analog.meaning->mqflags = pch->mqflags;
if (pch->mq == SR_MQ_VOLTAGE) { if (pch->mq == SR_MQ_VOLTAGE) {
analog.meaning->unit = SR_UNIT_VOLT; analog.meaning->unit = SR_UNIT_VOLT;
analog.encoding->digits = ch_spec->voltage[4]; 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.encoding->digits = ch_spec->power[4];
analog.spec->spec_digits = ch_spec->power[3]; analog.spec->spec_digits = ch_spec->power[3];
} }
analog.meaning->mqflags = SR_MQFLAG_DC;
f = (float)g_variant_get_double(gvdata); f = (float)g_variant_get_double(gvdata);
g_variant_unref(gvdata); g_variant_unref(gvdata);
analog.data = &f; analog.data = &f;

View File

@ -126,10 +126,13 @@ struct channel_group_spec {
const char *name; const char *name;
uint64_t channel_index_mask; uint64_t channel_index_mask;
uint64_t features; uint64_t features;
/* The mqflags will only be applied to voltage and current channels! */
enum sr_mqflag mqflags;
}; };
struct pps_channel { struct pps_channel {
enum sr_mq mq; enum sr_mq mq;
enum sr_mqflag mqflags;
unsigned int hw_output_idx; unsigned int hw_output_idx;
const char *hwname; const char *hwname;
int digits; int digits;