scpi-pps: Use software sample and time limits.
This commit is contained in:
parent
49f7cb2425
commit
88e4daa9ff
|
@ -100,6 +100,7 @@ static struct sr_dev_inst *probe_device(struct sr_scpi_dev_inst *scpi,
|
||||||
|
|
||||||
devc = g_malloc0(sizeof(struct dev_context));
|
devc = g_malloc0(sizeof(struct dev_context));
|
||||||
devc->device = device;
|
devc->device = device;
|
||||||
|
sr_sw_limits_init(&devc->limits);
|
||||||
sdi->priv = devc;
|
sdi->priv = devc;
|
||||||
|
|
||||||
if (device->num_channels) {
|
if (device->num_channels) {
|
||||||
|
@ -400,6 +401,8 @@ static int config_get(uint32_t key, GVariant **data,
|
||||||
case SR_CONF_REGULATION:
|
case SR_CONF_REGULATION:
|
||||||
gvtype = G_VARIANT_TYPE_STRING;
|
gvtype = G_VARIANT_TYPE_STRING;
|
||||||
cmd = SCPI_CMD_GET_OUTPUT_REGULATION;
|
cmd = SCPI_CMD_GET_OUTPUT_REGULATION;
|
||||||
|
default:
|
||||||
|
return sr_sw_limits_config_get(&devc->limits, key, data);
|
||||||
}
|
}
|
||||||
if (!gvtype)
|
if (!gvtype)
|
||||||
return SR_ERR_NA;
|
return SR_ERR_NA;
|
||||||
|
@ -533,7 +536,7 @@ static int config_set(uint32_t key, GVariant *data,
|
||||||
SCPI_CMD_SET_OVER_TEMPERATURE_PROTECTION_DISABLE);
|
SCPI_CMD_SET_OVER_TEMPERATURE_PROTECTION_DISABLE);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
ret = SR_ERR_NA;
|
ret = sr_sw_limits_config_set(&devc->limits, key, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_free(channel_group_name);
|
g_free(channel_group_name);
|
||||||
|
@ -640,6 +643,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
|
||||||
scpi_pps_receive_data, (void *)sdi)) != SR_OK)
|
scpi_pps_receive_data, (void *)sdi)) != SR_OK)
|
||||||
return ret;
|
return ret;
|
||||||
std_session_send_df_header(sdi);
|
std_session_send_df_header(sdi);
|
||||||
|
sr_sw_limits_acquisition_start(&devc->limits);
|
||||||
|
|
||||||
return SR_OK;
|
return SR_OK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,6 +33,8 @@
|
||||||
/* Agilent/Keysight N5700A series */
|
/* Agilent/Keysight N5700A series */
|
||||||
static const uint32_t agilent_n5700a_devopts[] = {
|
static const uint32_t agilent_n5700a_devopts[] = {
|
||||||
SR_CONF_CONTINUOUS,
|
SR_CONF_CONTINUOUS,
|
||||||
|
SR_CONF_LIMIT_SAMPLES | SR_CONF_GET | SR_CONF_SET,
|
||||||
|
SR_CONF_LIMIT_MSEC | SR_CONF_GET | SR_CONF_SET,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const uint32_t agilent_n5700a_devopts_cg[] = {
|
static const uint32_t agilent_n5700a_devopts_cg[] = {
|
||||||
|
@ -87,6 +89,8 @@ static const struct scpi_command agilent_n5700a_cmd[] = {
|
||||||
/* Chroma 61600 series AC source */
|
/* Chroma 61600 series AC source */
|
||||||
static const uint32_t chroma_61604_devopts[] = {
|
static const uint32_t chroma_61604_devopts[] = {
|
||||||
SR_CONF_CONTINUOUS,
|
SR_CONF_CONTINUOUS,
|
||||||
|
SR_CONF_LIMIT_SAMPLES | SR_CONF_GET | SR_CONF_SET,
|
||||||
|
SR_CONF_LIMIT_MSEC | SR_CONF_GET | SR_CONF_SET,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const uint32_t chroma_61604_devopts_cg[] = {
|
static const uint32_t chroma_61604_devopts_cg[] = {
|
||||||
|
@ -133,6 +137,8 @@ static const struct scpi_command chroma_61604_cmd[] = {
|
||||||
/* Chroma 62000 series DC source */
|
/* Chroma 62000 series DC source */
|
||||||
static const uint32_t chroma_62000_devopts[] = {
|
static const uint32_t chroma_62000_devopts[] = {
|
||||||
SR_CONF_CONTINUOUS,
|
SR_CONF_CONTINUOUS,
|
||||||
|
SR_CONF_LIMIT_SAMPLES | SR_CONF_GET | SR_CONF_SET,
|
||||||
|
SR_CONF_LIMIT_MSEC | SR_CONF_GET | SR_CONF_SET,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const uint32_t chroma_62000_devopts_cg[] = {
|
static const uint32_t chroma_62000_devopts_cg[] = {
|
||||||
|
@ -224,6 +230,8 @@ static int chroma_62000p_probe_channels(struct sr_dev_inst *sdi,
|
||||||
/* Rigol DP700 series */
|
/* Rigol DP700 series */
|
||||||
static const uint32_t rigol_dp700_devopts[] = {
|
static const uint32_t rigol_dp700_devopts[] = {
|
||||||
SR_CONF_CONTINUOUS,
|
SR_CONF_CONTINUOUS,
|
||||||
|
SR_CONF_LIMIT_SAMPLES | SR_CONF_GET | SR_CONF_SET,
|
||||||
|
SR_CONF_LIMIT_MSEC | SR_CONF_GET | SR_CONF_SET,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const uint32_t rigol_dp700_devopts_cg[] = {
|
static const uint32_t rigol_dp700_devopts_cg[] = {
|
||||||
|
@ -291,6 +299,8 @@ static const struct scpi_command rigol_dp700_cmd[] = {
|
||||||
static const uint32_t rigol_dp800_devopts[] = {
|
static const uint32_t rigol_dp800_devopts[] = {
|
||||||
SR_CONF_CONTINUOUS,
|
SR_CONF_CONTINUOUS,
|
||||||
SR_CONF_OVER_TEMPERATURE_PROTECTION | SR_CONF_GET | SR_CONF_SET,
|
SR_CONF_OVER_TEMPERATURE_PROTECTION | SR_CONF_GET | SR_CONF_SET,
|
||||||
|
SR_CONF_LIMIT_SAMPLES | SR_CONF_GET | SR_CONF_SET,
|
||||||
|
SR_CONF_LIMIT_MSEC | SR_CONF_GET | SR_CONF_SET,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const uint32_t rigol_dp800_devopts_cg[] = {
|
static const uint32_t rigol_dp800_devopts_cg[] = {
|
||||||
|
@ -375,6 +385,8 @@ static const struct scpi_command rigol_dp800_cmd[] = {
|
||||||
/* HP 663xx series */
|
/* HP 663xx series */
|
||||||
static const uint32_t hp_6630a_devopts[] = {
|
static const uint32_t hp_6630a_devopts[] = {
|
||||||
SR_CONF_CONTINUOUS,
|
SR_CONF_CONTINUOUS,
|
||||||
|
SR_CONF_LIMIT_SAMPLES | SR_CONF_GET | SR_CONF_SET,
|
||||||
|
SR_CONF_LIMIT_MSEC | SR_CONF_GET | SR_CONF_SET,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const uint32_t hp_6630a_devopts_cg[] = {
|
static const uint32_t hp_6630a_devopts_cg[] = {
|
||||||
|
@ -389,6 +401,8 @@ static const uint32_t hp_6630a_devopts_cg[] = {
|
||||||
|
|
||||||
static const uint32_t hp_6630b_devopts[] = {
|
static const uint32_t hp_6630b_devopts[] = {
|
||||||
SR_CONF_CONTINUOUS,
|
SR_CONF_CONTINUOUS,
|
||||||
|
SR_CONF_LIMIT_SAMPLES | SR_CONF_GET | SR_CONF_SET,
|
||||||
|
SR_CONF_LIMIT_MSEC | SR_CONF_GET | SR_CONF_SET,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const uint32_t hp_6630b_devopts_cg[] = {
|
static const uint32_t hp_6630b_devopts_cg[] = {
|
||||||
|
@ -465,6 +479,8 @@ static const struct scpi_command hp_6630b_cmd[] = {
|
||||||
/* Philips/Fluke PM2800 series */
|
/* Philips/Fluke PM2800 series */
|
||||||
static const uint32_t philips_pm2800_devopts[] = {
|
static const uint32_t philips_pm2800_devopts[] = {
|
||||||
SR_CONF_CONTINUOUS,
|
SR_CONF_CONTINUOUS,
|
||||||
|
SR_CONF_LIMIT_SAMPLES | SR_CONF_GET | SR_CONF_SET,
|
||||||
|
SR_CONF_LIMIT_MSEC | SR_CONF_GET | SR_CONF_SET,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const uint32_t philips_pm2800_devopts_cg[] = {
|
static const uint32_t philips_pm2800_devopts_cg[] = {
|
||||||
|
@ -613,6 +629,8 @@ static const struct scpi_command philips_pm2800_cmd[] = {
|
||||||
|
|
||||||
static const uint32_t rs_hmc8043_devopts[] = {
|
static const uint32_t rs_hmc8043_devopts[] = {
|
||||||
SR_CONF_CONTINUOUS,
|
SR_CONF_CONTINUOUS,
|
||||||
|
SR_CONF_LIMIT_SAMPLES | SR_CONF_GET | SR_CONF_SET,
|
||||||
|
SR_CONF_LIMIT_MSEC | SR_CONF_GET | SR_CONF_SET,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const uint32_t rs_hmc8043_devopts_cg[] = {
|
static const uint32_t rs_hmc8043_devopts_cg[] = {
|
||||||
|
|
|
@ -32,7 +32,7 @@ SR_PRIV int scpi_pps_receive_data(int fd, int revents, void *cb_data)
|
||||||
struct sr_analog_encoding encoding;
|
struct sr_analog_encoding encoding;
|
||||||
struct sr_analog_meaning meaning;
|
struct sr_analog_meaning meaning;
|
||||||
struct sr_analog_spec spec;
|
struct sr_analog_spec spec;
|
||||||
const struct sr_dev_inst *sdi;
|
struct sr_dev_inst *sdi;
|
||||||
int channel_group_cmd;
|
int channel_group_cmd;
|
||||||
char *channel_group_name;
|
char *channel_group_name;
|
||||||
struct pps_channel *pch;
|
struct pps_channel *pch;
|
||||||
|
@ -116,5 +116,13 @@ SR_PRIV int scpi_pps_receive_data(int fd, int revents, void *cb_data)
|
||||||
sr_next_enabled_channel(sdi, devc->cur_acquisition_channel);
|
sr_next_enabled_channel(sdi, devc->cur_acquisition_channel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (devc->cur_acquisition_channel == sr_next_enabled_channel(sdi, NULL))
|
||||||
|
/* First enabled channel, so each channel has been sampled */
|
||||||
|
sr_sw_limits_update_samples_read(&devc->limits, 1);
|
||||||
|
|
||||||
|
/* Stop if limits have been hit. */
|
||||||
|
if (sr_sw_limits_check(&devc->limits))
|
||||||
|
sr_dev_acquisition_stop(sdi);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -147,6 +147,7 @@ struct dev_context {
|
||||||
struct channel_group_spec *channel_groups;
|
struct channel_group_spec *channel_groups;
|
||||||
|
|
||||||
struct sr_channel *cur_acquisition_channel;
|
struct sr_channel *cur_acquisition_channel;
|
||||||
|
struct sr_sw_limits limits;
|
||||||
};
|
};
|
||||||
|
|
||||||
SR_PRIV extern unsigned int num_pps_profiles;
|
SR_PRIV extern unsigned int num_pps_profiles;
|
||||||
|
|
Loading…
Reference in New Issue