"Parallel",
};
-static struct pps_model models[] = {
+static const struct pps_model models[] = {
{ PPS_3203T_3S, "PPS3203T-3S",
CHANMODE_INDEPENDENT | CHANMODE_SERIES | CHANMODE_PARALLEL,
3,
struct sr_channel_group *cg;
struct sr_serial_dev_inst *serial;
GSList *l, *devices;
- struct pps_model *model;
+ const struct pps_model *model;
uint8_t packet[PACKET_SIZE];
unsigned int i;
int delay_ms, ret;
/** Private, per-device-instance driver context. */
struct dev_context {
/* Model-specific information */
- struct pps_model *model;
+ const struct pps_model *model;
/* Acquisition state */
gboolean acquisition_running;
#define USB_TIMEOUT 500
-static char char_map[128] = {
+static const char char_map[128] = {
[0x20] = '-',
[0x5F] = '0',
[0x50] = '1',
#include "protocol.h"
/* Length of expected payload for each token. */
-static int token_payloads[][2] = {
+static const int token_payloads[][2] = {
{ TOKEN_WEIGHT_TIME_FAST, 0 },
{ TOKEN_WEIGHT_TIME_SLOW, 0 },
{ TOKEN_HOLD_MAX, 0 },
};
/* The ChronoVu LA8/LA16 can have multiple VID/PID pairs. */
-static struct {
+static const struct {
uint16_t vid;
uint16_t pid;
int model;
SR_HZ(1),
};
-static uint8_t pattern_sigrok[] = {
+static const uint8_t pattern_sigrok[] = {
0x4c, 0x92, 0x92, 0x92, 0x64, 0x00, 0x00, 0x00,
0x82, 0xfe, 0xfe, 0x82, 0x00, 0x00, 0x00, 0x00,
0x7c, 0x82, 0x82, 0x92, 0x74, 0x00, 0x00, 0x00,
SR_PRIV struct sr_dev_driver flukedmm_driver_info;
-static char *scan_conn[] = {
+static const char *scan_conn[] = {
/* 287/289 */
"115200/8n1",
/* 187/189 */
const struct sr_channel_group *cg)
{
unsigned int i;
- struct scope_config *model;
+ const struct scope_config *model;
model = devc->model_config;
int ret, cg_type;
unsigned int i;
struct dev_context *devc;
- struct scope_config *model;
+ const struct scope_config *model;
struct scope_state *state;
if (!sdi || !(devc = sdi->priv))
unsigned int i, j;
char command[MAX_COMMAND_SIZE], float_str[30];
struct dev_context *devc;
- struct scope_config *model;
+ const struct scope_config *model;
struct scope_state *state;
const char *tmp;
uint64_t p, q;
{
int cg_type = CG_NONE;
struct dev_context *devc = NULL;
- struct scope_config *model = NULL;
+ const struct scope_config *model = NULL;
if (sdi && (devc = sdi->priv)) {
if ((cg_type = check_channel_group(devc, cg)) == CG_INVALID)
char command[MAX_COMMAND_SIZE];
struct sr_channel *ch;
struct dev_context *devc;
- struct scope_config *model;
+ const struct scope_config *model;
devc = sdi->priv;
model = devc->model_config;
gboolean *pod_enabled, setup_changed;
char command[MAX_COMMAND_SIZE];
struct scope_state *state;
- struct scope_config *model;
+ const struct scope_config *model;
struct sr_channel *ch;
struct dev_context *devc;
struct sr_scpi_dev_inst *scpi;
"D15",
};
-static struct scope_config scope_models[] = {
+static const struct scope_config scope_models[] = {
{
.name = {"HMO722", "HMO1022", "HMO1522", "HMO2022", NULL},
.analog_channels = 2,
},
};
-static void scope_state_dump(struct scope_config *config,
+static void scope_state_dump(const struct scope_config *config,
struct scope_state *state)
{
unsigned int i;
}
static int analog_channel_state_get(struct sr_scpi_dev_inst *scpi,
- struct scope_config *config,
+ const struct scope_config *config,
struct scope_state *state)
{
unsigned int i, j;
}
static int digital_channel_state_get(struct sr_scpi_dev_inst *scpi,
- struct scope_config *config,
+ const struct scope_config *config,
struct scope_state *state)
{
unsigned int i;
{
struct dev_context *devc;
struct scope_state *state;
- struct scope_config *config;
+ const struct scope_config *config;
int tmp;
unsigned int i;
{
struct dev_context *devc;
struct scope_state *state;
- struct scope_config *config;
+ const struct scope_config *config;
float tmp_float;
unsigned int i;
return SR_OK;
}
-static struct scope_state *scope_state_new(struct scope_config *config)
+static struct scope_state *scope_state_new(const struct scope_config *config)
{
struct scope_state *state;
/** Private, per-device-instance driver context. */
struct dev_context {
- void *model_config;
+ const void *model_config;
void *model_state;
struct sr_channel_group **analog_groups;
};
/* Note: The IKALOGIC ScanaPLUS always samples at 100MHz. */
-static uint64_t samplerates[1] = { SR_MHZ(100) };
+static const uint64_t samplerates[1] = { SR_MHZ(100) };
SR_PRIV struct sr_dev_driver ikalogic_scanaplus_driver_info;
};
/* Note: All models have one power supply output only. */
-static struct hcs_model models[] = {
+static const struct hcs_model models[] = {
{ MANSON_HCS_3100, "HCS-3100", "3100", { 1, 18, 0.1 }, { 0, 10, 0.10 } },
{ MANSON_HCS_3102, "HCS-3102", "3102", { 1, 36, 0.1 }, { 0, 5, 0.01 } },
{ MANSON_HCS_3104, "HCS-3104", "3104", { 1, 60, 0.1 }, { 0, 2.5, 0.01 } },
/** Private, per-device-instance driver context. */
struct dev_context {
- struct hcs_model *model; /**< Model informaion. */
+ const struct hcs_model *model; /**< Model informaion. */
uint64_t limit_samples;
uint64_t limit_msec;
"Track2",
};
-static struct lps_modelspec models[] = {
+static const struct lps_modelspec models[] = {
{ LPS_UNKNOWN, "Dummy", 0,
{
/** Private, per-device-instance driver context. */
struct dev_context {
/* Model-specific information */
- struct lps_modelspec* model;
+ const struct lps_modelspec* model;
/* Acquisition status */
gboolean acq_running; /**< Aquisition is running. */
SR_CONF_POWER_SUPPLY,
};
-static struct pps_channel_instance pci[] = {
+static const struct pps_channel_instance pci[] = {
{ SR_MQ_VOLTAGE, SCPI_CMD_GET_MEAS_VOLTAGE, "V" },
{ SR_MQ_CURRENT, SCPI_CMD_GET_MEAS_CURRENT, "I" },
{ SR_MQ_POWER, SCPI_CMD_GET_MEAS_POWER, "P" },
if (device->num_channels) {
/* Static channels and groups. */
- channels = device->channels;
+ channels = (struct channel_spec *)device->channels;
num_channels = device->num_channels;
- channel_groups = device->channel_groups;
+ channel_groups = (struct channel_group_spec *)device->channel_groups;
num_channel_groups = device->num_channel_groups;
} else {
/* Channels and groups need to be probed. */
{
struct dev_context *devc;
struct sr_channel *ch;
- struct channel_spec *ch_spec;
+ const struct channel_spec *ch_spec;
GVariant *gvar;
GVariantBuilder gvb;
int ret, i;
SR_CONF_OUTPUT_ENABLED | SR_CONF_GET | SR_CONF_SET,
};
-struct channel_spec rigol_dp821a_ch[] = {
+const struct channel_spec rigol_dp821a_ch[] = {
{ "1", { 0, 60, 0.001 }, { 0, 1, 0.0001 } },
{ "2", { 0, 8, 0.001 }, { 0, 10, 0.001 } },
};
-struct channel_spec rigol_dp831_ch[] = {
+const struct channel_spec rigol_dp831_ch[] = {
{ "1", { 0, 8, 0.001 }, { 0, 5, 0.0003 } },
{ "2", { 0, 30, 0.001 }, { 0, 2, 0.0001 } },
{ "3", { 0, -30, 0.001 }, { 0, 2, 0.0001 } },
};
-struct channel_spec rigol_dp832_ch[] = {
+const struct channel_spec rigol_dp832_ch[] = {
{ "1", { 0, 30, 0.001 }, { 0, 3, 0.001 } },
{ "2", { 0, 30, 0.001 }, { 0, 3, 0.001 } },
{ "3", { 0, 5, 0.001 }, { 0, 3, 0.001 } },
};
-struct channel_group_spec rigol_dp820_cg[] = {
+const struct channel_group_spec rigol_dp820_cg[] = {
{ "1", CH_IDX(0), PPS_OVP | PPS_OCP },
{ "2", CH_IDX(1), PPS_OVP | PPS_OCP },
};
-struct channel_group_spec rigol_dp830_cg[] = {
+const struct channel_group_spec rigol_dp830_cg[] = {
{ "1", CH_IDX(0), PPS_OVP | PPS_OCP },
{ "2", CH_IDX(1), PPS_OVP | PPS_OCP },
{ "3", CH_IDX(2), PPS_OVP | PPS_OCP },
};
-struct scpi_command rigol_dp800_cmd[] = {
+const struct scpi_command rigol_dp800_cmd[] = {
{ SCPI_CMD_REMOTE, "SYST:REMOTE" },
{ SCPI_CMD_LOCAL, "SYST:LOCAL" },
{ SCPI_CMD_BEEPER, "SYST:BEEP:STAT?" },
SR_CONF_OUTPUT_CURRENT_LIMIT | SR_CONF_GET | SR_CONF_SET | SR_CONF_LIST,
};
-struct channel_spec hp_6632b_ch[] = {
+const struct channel_spec hp_6632b_ch[] = {
{ "1", { 0, 20.475, 0.005 }, { 0, 5.1188, 0.00132 } },
};
-struct channel_group_spec hp_6632b_cg[] = {
+const struct channel_group_spec hp_6632b_cg[] = {
{ "1", CH_IDX(0), 0 },
};
-struct scpi_command hp_6632b_cmd[] = {
+const struct scpi_command hp_6632b_cmd[] = {
{ SCPI_CMD_GET_OUTPUT_ENABLED, "OUTP:STAT?" },
{ SCPI_CMD_SET_OUTPUT_ENABLE, "OUTP:STAT ON" },
{ SCPI_CMD_SET_OUTPUT_DISABLE, "OUTP:STAT OFF" },
PM2800_MOD_120V_1A,
};
-static struct philips_pm2800_module_spec {
+static const struct philips_pm2800_module_spec {
/* Min, max, programming resolution. */
float voltage[3];
float current[3];
[PM2800_MOD_120V_1A] = { { 0, 120, 0.030 }, { -1, 1, 0.00025 } },
};
-static struct philips_pm2800_model {
+static const struct philips_pm2800_model {
unsigned int chassis;
unsigned int num_modules;
unsigned int set;
{ 3, 2, 3, { PM2800_MOD_8V_15A, PM2800_MOD_8V_15A, 0 } },
};
-static char *philips_pm2800_names[] = { "1", "2", "3" };
+static const char *philips_pm2800_names[] = { "1", "2", "3" };
static int philips_pm2800_probe_channels(struct sr_dev_inst *sdi,
struct sr_scpi_hw_info *hw_info,
struct channel_spec **channels, unsigned int *num_channels,
struct channel_group_spec **channel_groups, unsigned int *num_channel_groups)
{
- struct philips_pm2800_model *model;
- struct philips_pm2800_module_spec *spec;
+ const struct philips_pm2800_model *model;
+ const struct philips_pm2800_module_spec *spec;
unsigned int chassis, num_modules, set, module, m, i;
(void)sdi;
sr_dbg("output %d: %.0f - %.0fV, %.0f - %.0fA", i + 1,
spec->voltage[0], spec->voltage[1],
spec->current[0], spec->current[1]);
- (*channels)[i].name = philips_pm2800_names[i];
+ (*channels)[i].name = (char *)philips_pm2800_names[i];
memcpy(&((*channels)[i].voltage), spec, sizeof(float) * 6);
- (*channel_groups)[i].name = philips_pm2800_names[i];
+ (*channel_groups)[i].name = (char *)philips_pm2800_names[i];
(*channel_groups)[i].channel_index_mask = 1 << i;
(*channel_groups)[i].features = PPS_OTP | PPS_OVP | PPS_OCP;
}
return SR_OK;
}
-struct scpi_command philips_pm2800_cmd[] = {
+const struct scpi_command philips_pm2800_cmd[] = {
{ SCPI_CMD_SELECT_CHANNEL, ":INST:NSEL %s" },
{ SCPI_CMD_GET_MEAS_VOLTAGE, ":MEAS:VOLT?" },
{ SCPI_CMD_GET_MEAS_CURRENT, ":MEAS:CURR?" },
#include <stdarg.h>
#include "protocol.h"
-SR_PRIV char *scpi_cmd_get(const struct sr_dev_inst *sdi, int command)
+SR_PRIV const char *scpi_cmd_get(const struct sr_dev_inst *sdi, int command)
{
struct dev_context *devc;
unsigned int i;
- char *cmd;
+ const char *cmd;
devc = sdi->priv;
cmd = NULL;
struct sr_scpi_dev_inst *scpi;
va_list args;
int ret;
- char *cmd;
+ const char *cmd;
if (!(cmd = scpi_cmd_get(sdi, command))) {
/* Device does not implement this command, that's OK. */
va_list args;
double d;
int ret;
- char *cmd, *s;
+ char *s;
+ const char *cmd;
if (!(cmd = scpi_cmd_get(sdi, command))) {
/* Device does not implement this command, that's OK. */
};
struct scpi_pps {
- char *vendor;
- char *model;
+ const char *vendor;
+ const char *model;
uint64_t features;
const uint32_t *devopts;
unsigned int num_devopts;
const uint32_t *devopts_cg;
unsigned int num_devopts_cg;
- struct channel_spec *channels;
+ const struct channel_spec *channels;
unsigned int num_channels;
- struct channel_group_spec *channel_groups;
+ const struct channel_group_spec *channel_groups;
unsigned int num_channel_groups;
- struct scpi_command *commands;
+ const struct scpi_command *commands;
unsigned int num_commands;
int (*probe_channels) (struct sr_dev_inst *sdi, struct sr_scpi_hw_info *hwinfo,
struct channel_spec **channels, unsigned int *num_channels,
};
struct channel_spec {
- char *name;
+ const char *name;
/* Min, max, programming resolution. */
float voltage[3];
float current[3];
struct scpi_command {
int command;
- char *string;
+ const char *string;
};
struct channel_group_spec {
- char *name;
+ const char *name;
uint64_t channel_index_mask;
uint64_t features;
};
struct pps_channel {
int mq;
unsigned int hw_output_idx;
- char *hwname;
+ const char *hwname;
};
struct pps_channel_instance {
int mq;
int command;
- char *prefix;
+ const char *prefix;
};
struct pps_channel_group {
};
const char *get_vendor(const char *raw_vendor);
-SR_PRIV char *scpi_cmd_get(const struct sr_dev_inst *sdi, int command);
+SR_PRIV const char *scpi_cmd_get(const struct sr_dev_inst *sdi, int command);
SR_PRIV int scpi_cmd(const struct sr_dev_inst *sdi, int command, ...);
SR_PRIV int scpi_cmd_resp(const struct sr_dev_inst *sdi, GVariant **gvar,
const GVariantType *gvtype, int command, ...);
REQUEST, VALID, PARSE, DETAILS, sizeof(struct CHIPSET##_info) \
}
-SR_PRIV struct dmm_info *serial_dmm_drivers[] = {
+SR_PRIV const struct dmm_info *serial_dmm_drivers[] = {
DMM(
"bbcgm-2010", metex14,
"BBC Goertz Metrawatt", "M2110", "1200/7n2", 1200,
SR_CONF_LIMIT_MSEC | SR_CONF_SET,
};
-unsigned char TESTO_x35_REQUEST[] = { 0x12, 0, 0, 0, 1, 1, 0x55, 0xd1, 0xb7 };
-struct testo_model models[] = {
+static const uint8_t TESTO_x35_REQUEST[] = { 0x12, 0, 0, 0, 1, 1, 0x55, 0xd1, 0xb7 };
+
+static const struct testo_model models[] = {
{ "435", 9, TESTO_x35_REQUEST },
};
libusb_bulk_transfer(usb->devhdl, EP_IN, buf, MAX_REPLY_SIZE, &len, 10);
} while (len > 2);
- if (libusb_bulk_transfer(usb->devhdl, EP_OUT, devc->model->request,
+ if (libusb_bulk_transfer(usb->devhdl, EP_OUT, (unsigned char *)devc->model->request,
devc->model->request_size, &devc->reply_size, 10) < 0)
return SR_ERR;
usb = sdi->conn;
libusb_fill_bulk_transfer(devc->out_transfer, usb->devhdl, EP_OUT,
- devc->model->request, devc->model->request_size,
+ (unsigned char *)devc->model->request, devc->model->request_size,
receive_transfer, (void *)sdi, 100);
if ((ret = libusb_submit_transfer(devc->out_transfer) != 0)) {
sr_err("Failed to request packet: %s.", libusb_error_name(ret));
struct testo_model {
char *name;
int request_size;
- unsigned char *request;
+ const uint8_t *request;
};
/** Private, per-device-instance driver context. */
struct dev_context {
/* Model-specific information */
- struct testo_model *model;
+ const struct testo_model *model;
/* Acquisition settings */
uint64_t limit_msec;
/* Temporary state across callbacks */
struct libusb_transfer *out_transfer;
- unsigned char reply[MAX_REPLY_SIZE];
+ uint8_t reply[MAX_REPLY_SIZE];
int reply_size;
};
SR_PRIV int testo_probe_channels(struct sr_dev_inst *sdi);
SR_PRIV void receive_transfer(struct libusb_transfer *transfer);
SR_PRIV int testo_request_packet(const struct sr_dev_inst *sdi);
-SR_PRIV gboolean testo_check_packet_prefix(unsigned char *buf, int len);
+SR_PRIV gboolean testo_check_packet_prefix(uint8_t *buf, int len);
SR_PRIV uint16_t crc16_mcrf4xx(uint16_t crc, uint8_t *data, size_t len);
SR_PRIV void testo_receive_packet(const struct sr_dev_inst *sdi);
SR_PRIV struct sr_dev_driver tenma_72_7745_driver_info;
SR_PRIV struct sr_dev_driver tenma_72_7750_driver_info;
-SR_PRIV struct dmm_info udmms[] = {
+SR_PRIV const struct dmm_info udmms[] = {
{
"Tecpel", "DMM-8061", 2400,
FS9721_PACKET_SIZE,
#include "libsigrok-internal.h"
#include "protocol.h"
-extern struct dmm_info udmms[];
+extern const struct dmm_info udmms[];
/*
* Driver for various UNI-T multimeters (and rebranded ones).
SR_PRIV struct sr_dev_driver yokogawa_dlm_driver_info;
-static char *MANUFACTURER_ID = "YOKOGAWA";
-static char *MANUFACTURER_NAME = "Yokogawa";
+static const char *MANUFACTURER_ID = "YOKOGAWA";
+static const char *MANUFACTURER_NAME = "Yokogawa";
static const uint32_t drvopts[] = {
SR_CONF_LOGIC_ANALYZER,
const struct sr_channel_group *cg)
{
unsigned int i;
- struct scope_config *model;
+ const struct scope_config *model;
model = devc->model_config;
int ret, cg_type;
unsigned int i;
struct dev_context *devc;
- struct scope_config *model;
+ const struct scope_config *model;
struct scope_state *state;
if (!sdi || !(devc = sdi->priv))
unsigned int i, j;
char float_str[30];
struct dev_context *devc;
- struct scope_config *model;
+ const struct scope_config *model;
struct scope_state *state;
const char *tmp;
uint64_t p, q;
{
int cg_type = CG_NONE;
struct dev_context *devc = NULL;
- struct scope_config *model = NULL;
+ const struct scope_config *model = NULL;
if (sdi && (devc = sdi->priv)) {
if ((cg_type = check_channel_group(devc, cg)) == CG_INVALID)
unsigned int i;
gboolean *pod_enabled, setup_changed;
struct scope_state *state;
- struct scope_config *model;
+ const struct scope_config *model;
struct sr_channel *ch;
struct dev_context *devc;
struct sr_scpi_dev_inst *scpi;
"D7"
};
-static struct scope_config scope_models[] = {
+static const struct scope_config scope_models[] = {
{
.model_id = {"710105", "710115", "710125", NULL},
.model_name = {"DLM2022", "DLM2032", "DLM2052", NULL},
* @param config This is the scope configuration.
* @param state The current scope state to print.
*/
-static void scope_state_dump(struct scope_config *config,
+static void scope_state_dump(const struct scope_config *config,
struct scope_state *state)
{
unsigned int i;
* @return SR_ERR on error, SR_OK otherwise.
*/
static int analog_channel_state_get(struct sr_scpi_dev_inst *scpi,
- struct scope_config *config,
+ const struct scope_config *config,
struct scope_state *state)
{
int i, j;
* @return SR_ERR on error, SR_OK otherwise.
*/
static int digital_channel_state_get(struct sr_scpi_dev_inst *scpi,
- struct scope_config *config,
+ const struct scope_config *config,
struct scope_state *state)
{
unsigned int i;
{
struct dev_context *devc;
struct scope_state *state;
- struct scope_config *config;
+ const struct scope_config *config;
float tmp_float;
gchar *response;
int i;
*
* @return The newly allocated scope_state struct.
*/
-static struct scope_state *dlm_scope_state_new(struct scope_config *config)
+static struct scope_state *dlm_scope_state_new(const struct scope_config *config)
{
struct scope_state *state;
/** Private, per-device-instance driver context. */
struct dev_context {
- void *model_config;
+ const void *model_config;
void *model_state;
struct sr_channel_group **analog_groups;
return SR_OK;
}
-static char *get_line_termination(GString *buf)
+static const char *get_line_termination(GString *buf)
{
- char *term;
+ const char *term;
term = NULL;
if (g_strstr_len(buf->str, buf->len, "\r\n"))
struct context *inc;
GString *new_buf;
int len, ret;
- char *termination, *p;
+ char *p;
+ const char *termination;
inc = in->priv;
size_t read;
};
-static struct {
+static const struct {
uint16_t vendor_id;
uint16_t product_id;
const char *serialcomm;