scpi-pps: Add init_acquisition() and update_status() for device specific
acquisition functions.
This commit is contained in:
parent
8b5eadf427
commit
7e66bf0586
|
@ -2,7 +2,7 @@
|
|||
* This file is part of the libsigrok project.
|
||||
*
|
||||
* Copyright (C) 2014 Bert Vermeulen <bert@biot.com>
|
||||
* Copyright (C) 2017 Frank Stettner <frank-stettner@gmx.net>
|
||||
* Copyright (C) 2017,2019 Frank Stettner <frank-stettner@gmx.net>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -705,6 +705,10 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
|
|||
/* Prime the pipe with the first channel. */
|
||||
devc->cur_acquisition_channel = sr_next_enabled_channel(sdi, NULL);
|
||||
|
||||
/* Device specific initialization before aquisition starts. */
|
||||
if (devc->device->init_aquisition)
|
||||
devc->device->init_aquisition(sdi);
|
||||
|
||||
if ((ret = sr_scpi_source_add(sdi->session, scpi, G_IO_IN, 10,
|
||||
scpi_pps_receive_data, (void *)sdi)) != SR_OK)
|
||||
return ret;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* Copyright (C) 2014 Bert Vermeulen <bert@biot.com>
|
||||
* Copyright (C) 2015 Google, Inc.
|
||||
* (Written by Alexandru Gagniuc <mrnuke@google.com> for Google, Inc.)
|
||||
* Copyright (C) 2017 Frank Stettner <frank-stettner@gmx.net>
|
||||
* Copyright (C) 2017,2019 Frank Stettner <frank-stettner@gmx.net>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -740,6 +740,8 @@ SR_PRIV const struct scpi_pps pps_profiles[] = {
|
|||
ARRAY_AND_SIZE(agilent_n5700a_cg),
|
||||
agilent_n5700a_cmd,
|
||||
.probe_channels = NULL,
|
||||
.init_aquisition = NULL,
|
||||
.update_status = NULL,
|
||||
},
|
||||
|
||||
/* Agilent N5767A */
|
||||
|
@ -750,6 +752,8 @@ SR_PRIV const struct scpi_pps pps_profiles[] = {
|
|||
ARRAY_AND_SIZE(agilent_n5700a_cg),
|
||||
agilent_n5700a_cmd,
|
||||
.probe_channels = NULL,
|
||||
.init_aquisition = NULL,
|
||||
.update_status = NULL,
|
||||
},
|
||||
|
||||
/* BK Precision 9310 */
|
||||
|
@ -760,6 +764,8 @@ SR_PRIV const struct scpi_pps pps_profiles[] = {
|
|||
ARRAY_AND_SIZE(bk_9130_cg),
|
||||
bk_9130_cmd,
|
||||
.probe_channels = NULL,
|
||||
.init_aquisition = NULL,
|
||||
.update_status = NULL,
|
||||
},
|
||||
|
||||
/* Chroma 61604 */
|
||||
|
@ -770,6 +776,8 @@ SR_PRIV const struct scpi_pps pps_profiles[] = {
|
|||
ARRAY_AND_SIZE(chroma_61604_cg),
|
||||
chroma_61604_cmd,
|
||||
.probe_channels = NULL,
|
||||
.init_aquisition = NULL,
|
||||
.update_status = NULL,
|
||||
},
|
||||
|
||||
/* Chroma 62000 series */
|
||||
|
@ -780,6 +788,8 @@ SR_PRIV const struct scpi_pps pps_profiles[] = {
|
|||
NULL, 0,
|
||||
chroma_62000_cmd,
|
||||
.probe_channels = chroma_62000p_probe_channels,
|
||||
.init_aquisition = NULL,
|
||||
.update_status = NULL,
|
||||
},
|
||||
|
||||
/* HP 6633A */
|
||||
|
@ -790,6 +800,8 @@ SR_PRIV const struct scpi_pps pps_profiles[] = {
|
|||
ARRAY_AND_SIZE(hp_663xx_cg),
|
||||
hp_6630a_cmd,
|
||||
.probe_channels = NULL,
|
||||
.init_aquisition = NULL,
|
||||
.update_status = NULL,
|
||||
},
|
||||
|
||||
/* HP 6631B */
|
||||
|
@ -800,6 +812,8 @@ SR_PRIV const struct scpi_pps pps_profiles[] = {
|
|||
ARRAY_AND_SIZE(hp_663xx_cg),
|
||||
hp_6630b_cmd,
|
||||
.probe_channels = NULL,
|
||||
.init_aquisition = NULL,
|
||||
.update_status = NULL,
|
||||
},
|
||||
|
||||
/* HP 6632B */
|
||||
|
@ -810,6 +824,8 @@ SR_PRIV const struct scpi_pps pps_profiles[] = {
|
|||
ARRAY_AND_SIZE(hp_663xx_cg),
|
||||
hp_6630b_cmd,
|
||||
.probe_channels = NULL,
|
||||
.init_aquisition = NULL,
|
||||
.update_status = NULL,
|
||||
},
|
||||
|
||||
/* HP 66332A */
|
||||
|
@ -820,6 +836,8 @@ SR_PRIV const struct scpi_pps pps_profiles[] = {
|
|||
ARRAY_AND_SIZE(hp_663xx_cg),
|
||||
hp_6630b_cmd,
|
||||
.probe_channels = NULL,
|
||||
.init_aquisition = NULL,
|
||||
.update_status = NULL,
|
||||
},
|
||||
|
||||
/* HP 6633B */
|
||||
|
@ -830,6 +848,8 @@ SR_PRIV const struct scpi_pps pps_profiles[] = {
|
|||
ARRAY_AND_SIZE(hp_663xx_cg),
|
||||
hp_6630b_cmd,
|
||||
.probe_channels = NULL,
|
||||
.init_aquisition = NULL,
|
||||
.update_status = NULL,
|
||||
},
|
||||
|
||||
/* HP 6634B */
|
||||
|
@ -840,6 +860,8 @@ SR_PRIV const struct scpi_pps pps_profiles[] = {
|
|||
ARRAY_AND_SIZE(hp_663xx_cg),
|
||||
hp_6630b_cmd,
|
||||
.probe_channels = NULL,
|
||||
.init_aquisition = NULL,
|
||||
.update_status = NULL,
|
||||
},
|
||||
|
||||
/* Rigol DP700 series */
|
||||
|
@ -850,6 +872,8 @@ SR_PRIV const struct scpi_pps pps_profiles[] = {
|
|||
ARRAY_AND_SIZE(rigol_dp700_cg),
|
||||
rigol_dp700_cmd,
|
||||
.probe_channels = NULL,
|
||||
.init_aquisition = NULL,
|
||||
.update_status = NULL,
|
||||
},
|
||||
{ "Rigol", "^DP712$", SCPI_DIALECT_UNKNOWN, 0,
|
||||
ARRAY_AND_SIZE(rigol_dp700_devopts),
|
||||
|
@ -858,6 +882,8 @@ SR_PRIV const struct scpi_pps pps_profiles[] = {
|
|||
ARRAY_AND_SIZE(rigol_dp700_cg),
|
||||
rigol_dp700_cmd,
|
||||
.probe_channels = NULL,
|
||||
.init_aquisition = NULL,
|
||||
.update_status = NULL,
|
||||
},
|
||||
|
||||
/* Rigol DP800 series */
|
||||
|
@ -868,6 +894,8 @@ SR_PRIV const struct scpi_pps pps_profiles[] = {
|
|||
ARRAY_AND_SIZE(rigol_dp820_cg),
|
||||
rigol_dp800_cmd,
|
||||
.probe_channels = NULL,
|
||||
.init_aquisition = NULL,
|
||||
.update_status = NULL,
|
||||
},
|
||||
{ "Rigol", "^DP831A$", SCPI_DIALECT_UNKNOWN, PPS_OTP,
|
||||
ARRAY_AND_SIZE(rigol_dp800_devopts),
|
||||
|
@ -876,6 +904,8 @@ SR_PRIV const struct scpi_pps pps_profiles[] = {
|
|||
ARRAY_AND_SIZE(rigol_dp830_cg),
|
||||
rigol_dp800_cmd,
|
||||
.probe_channels = NULL,
|
||||
.init_aquisition = NULL,
|
||||
.update_status = NULL,
|
||||
},
|
||||
{ "Rigol", "^(DP832|DP832A)$", SCPI_DIALECT_UNKNOWN, PPS_OTP,
|
||||
ARRAY_AND_SIZE(rigol_dp800_devopts),
|
||||
|
@ -884,6 +914,8 @@ SR_PRIV const struct scpi_pps pps_profiles[] = {
|
|||
ARRAY_AND_SIZE(rigol_dp830_cg),
|
||||
rigol_dp800_cmd,
|
||||
.probe_channels = NULL,
|
||||
.init_aquisition = NULL,
|
||||
.update_status = NULL,
|
||||
},
|
||||
|
||||
/* Philips/Fluke PM2800 series */
|
||||
|
@ -894,6 +926,8 @@ SR_PRIV const struct scpi_pps pps_profiles[] = {
|
|||
NULL, 0,
|
||||
philips_pm2800_cmd,
|
||||
philips_pm2800_probe_channels,
|
||||
.init_aquisition = NULL,
|
||||
.update_status = NULL,
|
||||
},
|
||||
|
||||
/* Rohde & Schwarz HMC8043 */
|
||||
|
@ -904,6 +938,8 @@ SR_PRIV const struct scpi_pps pps_profiles[] = {
|
|||
ARRAY_AND_SIZE(rs_hmc8043_cg),
|
||||
rs_hmc8043_cmd,
|
||||
.probe_channels = NULL,
|
||||
.init_aquisition = NULL,
|
||||
.update_status = NULL,
|
||||
},
|
||||
};
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
* This file is part of the libsigrok project.
|
||||
*
|
||||
* Copyright (C) 2014 Bert Vermeulen <bert@biot.com>
|
||||
* Copyright (C) 2019 Frank Stettner <frank-stettner@gmx.net>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -27,6 +28,7 @@
|
|||
SR_PRIV int scpi_pps_receive_data(int fd, int revents, void *cb_data)
|
||||
{
|
||||
struct dev_context *devc;
|
||||
const struct scpi_pps *device;
|
||||
struct sr_datafeed_packet packet;
|
||||
struct sr_datafeed_analog analog;
|
||||
struct sr_analog_encoding encoding;
|
||||
|
@ -52,6 +54,9 @@ SR_PRIV int scpi_pps_receive_data(int fd, int revents, void *cb_data)
|
|||
if (!(devc = sdi->priv))
|
||||
return TRUE;
|
||||
|
||||
if (!(device = devc->device))
|
||||
return TRUE;
|
||||
|
||||
pch = devc->cur_acquisition_channel->priv;
|
||||
|
||||
channel_group_cmd = 0;
|
||||
|
@ -61,6 +66,15 @@ SR_PRIV int scpi_pps_receive_data(int fd, int revents, void *cb_data)
|
|||
channel_group_name = pch->hwname;
|
||||
}
|
||||
|
||||
/*
|
||||
* When the current channel is the first in the array, perform the device
|
||||
* specific status update first.
|
||||
*/
|
||||
if (devc->cur_acquisition_channel == sr_next_enabled_channel(sdi, NULL) &&
|
||||
device->update_status) {
|
||||
device->update_status(sdi);
|
||||
}
|
||||
|
||||
if (pch->mq == SR_MQ_VOLTAGE) {
|
||||
gvtype = G_VARIANT_TYPE_DOUBLE;
|
||||
cmd = SCPI_CMD_GET_MEAS_VOLTAGE;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* This file is part of the libsigrok project.
|
||||
*
|
||||
* Copyright (C) 2014 Bert Vermeulen <bert@biot.com>
|
||||
* Copyright (C) 2017 Frank Stettner <frank-stettner@gmx.net>
|
||||
* Copyright (C) 2017,2019 Frank Stettner <frank-stettner@gmx.net>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -107,6 +107,8 @@ struct scpi_pps {
|
|||
int (*probe_channels) (struct sr_dev_inst *sdi, struct sr_scpi_hw_info *hwinfo,
|
||||
struct channel_spec **channels, unsigned int *num_channels,
|
||||
struct channel_group_spec **channel_groups, unsigned int *num_channel_groups);
|
||||
int (*init_aquisition) (const struct sr_dev_inst *sdi);
|
||||
int (*update_status) (const struct sr_dev_inst *sdi);
|
||||
};
|
||||
|
||||
struct channel_spec {
|
||||
|
|
Loading…
Reference in New Issue