hameg-hmo: Get SCPI_CMD_GET_HORIZONTAL_DIV at runtime.
Get the number of horizontal divisions from the device (at runtime) instead of hardcoding its value in the driver.
This commit is contained in:
parent
a12456f1bb
commit
29a9b1a0bd
|
@ -34,6 +34,7 @@ static const char *hameg_scpi_dialect[] = {
|
|||
[SCPI_CMD_GET_DIG_DATA] = ":FORM UINT,8;:POD%d:DATA?",
|
||||
[SCPI_CMD_GET_TIMEBASE] = ":TIM:SCAL?",
|
||||
[SCPI_CMD_SET_TIMEBASE] = ":TIM:SCAL %s",
|
||||
[SCPI_CMD_GET_HORIZONTAL_DIV] = ":TIM:DIV?",
|
||||
[SCPI_CMD_GET_COUPLING] = ":CHAN%d:COUP?",
|
||||
[SCPI_CMD_SET_COUPLING] = ":CHAN%d:COUP %s",
|
||||
[SCPI_CMD_GET_SAMPLE_RATE] = ":ACQ:SRAT?",
|
||||
|
@ -71,6 +72,7 @@ static const char *rohde_schwarz_log_not_pod_scpi_dialect[] = {
|
|||
[SCPI_CMD_GET_DIG_DATA] = ":FORM UINT,8;:LOG%d:DATA?",
|
||||
[SCPI_CMD_GET_TIMEBASE] = ":TIM:SCAL?",
|
||||
[SCPI_CMD_SET_TIMEBASE] = ":TIM:SCAL %s",
|
||||
[SCPI_CMD_GET_HORIZONTAL_DIV] = ":TIM:DIV?",
|
||||
[SCPI_CMD_GET_COUPLING] = ":CHAN%d:COUP?",
|
||||
[SCPI_CMD_SET_COUPLING] = ":CHAN%d:COUP %s",
|
||||
[SCPI_CMD_GET_SAMPLE_RATE] = ":ACQ:SRAT?",
|
||||
|
@ -364,7 +366,6 @@ static struct scope_config scope_models[] = {
|
|||
.vdivs = &vdivs,
|
||||
.num_vdivs = ARRAY_SIZE(vdivs),
|
||||
|
||||
.num_xdivs = 12,
|
||||
.num_ydivs = 8,
|
||||
|
||||
.scpi_dialect = &hameg_scpi_dialect,
|
||||
|
@ -406,7 +407,6 @@ static struct scope_config scope_models[] = {
|
|||
.vdivs = &vdivs,
|
||||
.num_vdivs = ARRAY_SIZE(vdivs),
|
||||
|
||||
.num_xdivs = 12,
|
||||
.num_ydivs = 8,
|
||||
|
||||
.scpi_dialect = &hameg_scpi_dialect,
|
||||
|
@ -448,7 +448,6 @@ static struct scope_config scope_models[] = {
|
|||
.vdivs = &vdivs,
|
||||
.num_vdivs = ARRAY_SIZE(vdivs),
|
||||
|
||||
.num_xdivs = 12,
|
||||
.num_ydivs = 8,
|
||||
|
||||
.scpi_dialect = &hameg_scpi_dialect,
|
||||
|
@ -490,7 +489,6 @@ static struct scope_config scope_models[] = {
|
|||
.vdivs = &vdivs,
|
||||
.num_vdivs = ARRAY_SIZE(vdivs),
|
||||
|
||||
.num_xdivs = 12,
|
||||
.num_ydivs = 8,
|
||||
|
||||
.scpi_dialect = &hameg_scpi_dialect,
|
||||
|
@ -531,7 +529,6 @@ static struct scope_config scope_models[] = {
|
|||
.vdivs = &vdivs,
|
||||
.num_vdivs = ARRAY_SIZE(vdivs),
|
||||
|
||||
.num_xdivs = 12,
|
||||
.num_ydivs = 8,
|
||||
|
||||
.scpi_dialect = &hameg_scpi_dialect,
|
||||
|
@ -572,7 +569,6 @@ static struct scope_config scope_models[] = {
|
|||
.vdivs = &vdivs,
|
||||
.num_vdivs = ARRAY_SIZE(vdivs),
|
||||
|
||||
.num_xdivs = 12,
|
||||
.num_ydivs = 8,
|
||||
|
||||
.scpi_dialect = &rohde_schwarz_log_not_pod_scpi_dialect,
|
||||
|
@ -613,7 +609,6 @@ static struct scope_config scope_models[] = {
|
|||
.vdivs = &vdivs,
|
||||
.num_vdivs = ARRAY_SIZE(vdivs),
|
||||
|
||||
.num_xdivs = 12,
|
||||
.num_ydivs = 8,
|
||||
|
||||
.scpi_dialect = &rohde_schwarz_log_not_pod_scpi_dialect,
|
||||
|
@ -654,7 +649,6 @@ static struct scope_config scope_models[] = {
|
|||
.vdivs = &vdivs,
|
||||
.num_vdivs = ARRAY_SIZE(vdivs),
|
||||
|
||||
.num_xdivs = 12,
|
||||
.num_ydivs = 8,
|
||||
|
||||
.scpi_dialect = &rohde_schwarz_log_not_pod_scpi_dialect,
|
||||
|
@ -695,7 +689,6 @@ static struct scope_config scope_models[] = {
|
|||
.vdivs = &vdivs,
|
||||
.num_vdivs = ARRAY_SIZE(vdivs),
|
||||
|
||||
.num_xdivs = 12,
|
||||
.num_ydivs = 8,
|
||||
|
||||
.scpi_dialect = &rohde_schwarz_log_not_pod_scpi_dialect,
|
||||
|
@ -736,7 +729,6 @@ static struct scope_config scope_models[] = {
|
|||
.vdivs = &vdivs,
|
||||
.num_vdivs = ARRAY_SIZE(vdivs),
|
||||
|
||||
.num_xdivs = 12,
|
||||
.num_ydivs = 8,
|
||||
|
||||
.scpi_dialect = &rohde_schwarz_log_not_pod_scpi_dialect,
|
||||
|
@ -1091,6 +1083,12 @@ SR_PRIV int hmo_scope_state_get(struct sr_dev_inst *sdi)
|
|||
|
||||
state->timebase = i;
|
||||
|
||||
/* Determine the number of horizontal (x) divisions. */
|
||||
if (sr_scpi_get_int(sdi->conn,
|
||||
(*config->scpi_dialect)[SCPI_CMD_GET_HORIZONTAL_DIV],
|
||||
(int *)&config->num_xdivs) != SR_OK)
|
||||
return SR_ERR;
|
||||
|
||||
if (sr_scpi_get_float(sdi->conn,
|
||||
(*config->scpi_dialect)[SCPI_CMD_GET_HORIZ_TRIGGERPOS],
|
||||
&tmp_float) != SR_OK)
|
||||
|
@ -1182,6 +1180,7 @@ SR_PRIV int hmo_init_device(struct sr_dev_inst *sdi)
|
|||
sr_dbg("Unsupported device.");
|
||||
return SR_ERR_NA;
|
||||
}
|
||||
|
||||
/* Configure the number of PODs given the number of digital channels. */
|
||||
scope_models[model_index].digital_pods = scope_models[model_index].digital_channels / DIGITAL_CHANNELS_PER_POD;
|
||||
|
||||
|
|
|
@ -73,8 +73,8 @@ struct scope_config {
|
|||
const uint64_t (*vdivs)[][2];
|
||||
const uint8_t num_vdivs;
|
||||
|
||||
const uint8_t num_xdivs;
|
||||
const uint8_t num_ydivs;
|
||||
unsigned int num_xdivs;
|
||||
const unsigned int num_ydivs;
|
||||
|
||||
const char *(*scpi_dialect)[];
|
||||
};
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
enum {
|
||||
SCPI_CMD_GET_TIMEBASE = 1,
|
||||
SCPI_CMD_SET_TIMEBASE,
|
||||
SCPI_CMD_GET_HORIZONTAL_DIV,
|
||||
SCPI_CMD_GET_VERTICAL_SCALE,
|
||||
SCPI_CMD_SET_VERTICAL_SCALE,
|
||||
SCPI_CMD_GET_TRIGGER_SLOPE,
|
||||
|
|
Loading…
Reference in New Issue