SR_PRIV struct sr_dev_driver rohde_schwarz_sme_0x_driver_info;
-static const char * manufacturer = "Rohde&Schwarz";
-
-static const struct rs_device_model device_models[] = {{
- .model_str = "SME02",
- .freq_max = SR_GHZ(1.5),
- .freq_min = SR_KHZ(5),
- .power_max = 16,
- .power_min = -144
-}, {
- .model_str = "SME03E",
- .freq_max = SR_GHZ(2.2),
- .freq_min = SR_KHZ(5),
- .power_max = 16,
- .power_min = -144
-}, {
- .model_str = "SME03A",
- .freq_max = SR_GHZ(3),
- .freq_min = SR_KHZ(5),
- .power_max = 16,
- .power_min = -144
-}, {
- .model_str = "SME03",
- .freq_max = SR_GHZ(3),
- .freq_min = SR_KHZ(5),
- .power_max = 16,
- .power_min = -144
-}, {
- .model_str = "SME06",
- .freq_max = SR_GHZ(1.5),
- .freq_min = SR_KHZ(5),
- .power_max = 16,
- .power_min = -144
-}};
+static const char *manufacturer = "Rohde&Schwarz";
+
+static const struct rs_device_model device_models[] = {
+ {
+ .model_str = "SME02",
+ .freq_max = SR_GHZ(1.5),
+ .freq_min = SR_KHZ(5),
+ .power_max = 16,
+ .power_min = -144
+ },
+ {
+ .model_str = "SME03E",
+ .freq_max = SR_GHZ(2.2),
+ .freq_min = SR_KHZ(5),
+ .power_max = 16,
+ .power_min = -144
+ },
+ {
+ .model_str = "SME03A",
+ .freq_max = SR_GHZ(3),
+ .freq_min = SR_KHZ(5),
+ .power_max = 16,
+ .power_min = -144
+ },
+ {
+ .model_str = "SME03",
+ .freq_max = SR_GHZ(3),
+ .freq_min = SR_KHZ(5),
+ .power_max = 16,
+ .power_min = -144
+ },
+ {
+ .model_str = "SME06",
+ .freq_max = SR_GHZ(1.5),
+ .freq_min = SR_KHZ(5),
+ .power_max = 16,
+ .power_min = -144
+ }
+};
static const uint32_t scanopts[] = {
SR_CONF_CONN,
SR_CONF_AMPLITUDE | SR_CONF_GET | SR_CONF_SET | SR_CONF_LIST,
};
-static int check_manufacturer(const char *str)
-{
- if (!strcmp(str, manufacturer)) {
- return SR_OK;
- }
-
- return SR_ERR;
-}
-
static int rs_init_device(struct sr_dev_inst *sdi)
{
struct dev_context *devc;
goto fail;
}
- if (check_manufacturer(hw_info->manufacturer) != SR_OK) {
+ if (strcmp(hw_info->manufacturer, manufacturer) != 0) {
goto fail;
}
static int dev_open(struct sr_dev_inst *sdi)
{
- if (sdi->status != SR_ST_ACTIVE && sr_scpi_open(sdi->conn) != SR_OK) {
+ if ((sdi->status != SR_ST_ACTIVE) && (sr_scpi_open(sdi->conn) != SR_OK)) {
return SR_ERR;
}
RS_CMD_GET_POWER
};
-static char * commands[] = {
+static char *commands[] = {
[RS_CMD_CONTROL_REMOTE] = "\n",
[RS_CMD_SET_FREQ] = "FREQ %.1fHz",
[RS_CMD_SET_POWER] = "POW %.1fdBm",
return sr_scpi_send(scpi, commands[RS_CMD_CONTROL_REMOTE]);
}
-SR_PRIV int rs_sme0x_get_freq(const struct sr_dev_inst *sdi, double * freq) {
+SR_PRIV int rs_sme0x_get_freq(const struct sr_dev_inst *sdi, double *freq) {
if (sr_scpi_get_double(sdi->conn, commands[RS_CMD_GET_FREQ], freq) != SR_OK) {
return SR_ERR;
}
return SR_OK;
}
-SR_PRIV int rs_sme0x_get_power(const struct sr_dev_inst *sdi, double * power) {
+SR_PRIV int rs_sme0x_get_power(const struct sr_dev_inst *sdi, double *power) {
if (sr_scpi_get_double(sdi->conn, commands[RS_CMD_GET_POWER], power) != SR_OK) {
return SR_ERR;
}
devc = sdi->priv;
config = devc->model_config;
- if (freq > config->freq_max || freq < config->freq_min) {
+ if ((freq > config->freq_max) || (freq < config->freq_min)) {
return SR_ERR_ARG;
}
devc = sdi->priv;
config = devc->model_config;
- if (power > config->power_max || power < config->power_min) {
+ if ((power > config->power_max) || (power < config->power_min)) {
return SR_ERR_ARG;
}
};
struct rs_device_model {
- const char * model_str;
+ const char *model_str;
double freq_max;
double freq_min;
double power_max;
/** Private, per-device-instance driver context. */
struct dev_context {
/* Model-specific information */
- const struct rs_device_model * model_config;
+ const struct rs_device_model *model_config;
};
SR_PRIV int rs_sme0x_receive_data(int fd, int revents, void *cb_data);
SR_PRIV int rs_sme0x_mode_remote(struct sr_scpi_dev_inst *scpi);
SR_PRIV int rs_sme0x_close(struct sr_dev_inst *sdi);
-SR_PRIV int rs_sme0x_get_freq(const struct sr_dev_inst *sdi, double * freq);
-SR_PRIV int rs_sme0x_get_power(const struct sr_dev_inst *sdi, double * power);
+SR_PRIV int rs_sme0x_get_freq(const struct sr_dev_inst *sdi, double *freq);
+SR_PRIV int rs_sme0x_get_power(const struct sr_dev_inst *sdi, double *power);
SR_PRIV int rs_sme0x_set_freq(const struct sr_dev_inst *sdi, double freq);
SR_PRIV int rs_sme0x_set_power(const struct sr_dev_inst *sdi, double power);