Constify a few arrays and variables.

This commit is contained in:
Uwe Hermann 2015-03-20 14:48:20 +01:00
parent 53cda65a6b
commit 329733d92c
30 changed files with 95 additions and 92 deletions

View File

@ -60,7 +60,7 @@ static const char *channel_modes[] = {
"Parallel",
};
static struct pps_model models[] = {
static const struct pps_model models[] = {
{ PPS_3203T_3S, "PPS3203T-3S",
CHANMODE_INDEPENDENT | CHANMODE_SERIES | CHANMODE_PARALLEL,
3,
@ -92,7 +92,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options, int modelid)
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;

View File

@ -74,7 +74,7 @@ struct per_channel_config {
/** 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;

View File

@ -23,7 +23,7 @@
#define USB_TIMEOUT 500
static char char_map[128] = {
static const char char_map[128] = {
[0x20] = '-',
[0x5F] = '0',
[0x50] = '1',

View File

@ -21,7 +21,7 @@
#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 },

View File

@ -39,7 +39,7 @@ static const int32_t trigger_matches[] = {
};
/* The ChronoVu LA8/LA16 can have multiple VID/PID pairs. */
static struct {
static const struct {
uint16_t vid;
uint16_t pid;
int model;

View File

@ -168,7 +168,7 @@ static const uint64_t samplerates[] = {
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,

View File

@ -41,7 +41,7 @@ static const uint32_t devopts[] = {
SR_PRIV struct sr_dev_driver flukedmm_driver_info;
static char *scan_conn[] = {
static const char *scan_conn[] = {
/* 287/289 */
"115200/8n1",
/* 187/189 */

View File

@ -180,7 +180,7 @@ static int check_channel_group(struct dev_context *devc,
const struct sr_channel_group *cg)
{
unsigned int i;
struct scope_config *model;
const struct scope_config *model;
model = devc->model_config;
@ -206,7 +206,7 @@ static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *s
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))
@ -331,7 +331,7 @@ static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sd
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;
@ -501,7 +501,7 @@ static int config_list(uint32_t key, GVariant **data, const struct sr_dev_inst *
{
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)
@ -572,7 +572,7 @@ SR_PRIV int hmo_request_data(const struct sr_dev_inst *sdi)
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;
@ -640,7 +640,7 @@ static int hmo_setup_channels(const struct sr_dev_inst *sdi)
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;

View File

@ -194,7 +194,7 @@ static const char *scope_digital_channel_names[] = {
"D15",
};
static struct scope_config scope_models[] = {
static const struct scope_config scope_models[] = {
{
.name = {"HMO722", "HMO1022", "HMO1522", "HMO2022", NULL},
.analog_channels = 2,
@ -257,7 +257,7 @@ static struct scope_config scope_models[] = {
},
};
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;
@ -326,7 +326,7 @@ static int scope_state_get_array_option(struct sr_scpi_dev_inst *scpi,
}
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;
@ -381,7 +381,7 @@ static int analog_channel_state_get(struct sr_scpi_dev_inst *scpi,
}
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;
@ -414,7 +414,7 @@ SR_PRIV int hmo_update_sample_rate(const struct sr_dev_inst *sdi)
{
struct dev_context *devc;
struct scope_state *state;
struct scope_config *config;
const struct scope_config *config;
int tmp;
unsigned int i;
@ -476,7 +476,7 @@ SR_PRIV int hmo_scope_state_get(struct sr_dev_inst *sdi)
{
struct dev_context *devc;
struct scope_state *state;
struct scope_config *config;
const struct scope_config *config;
float tmp_float;
unsigned int i;
@ -539,7 +539,7 @@ SR_PRIV int hmo_scope_state_get(struct sr_dev_inst *sdi)
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;

View File

@ -90,7 +90,7 @@ struct scope_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;

View File

@ -42,7 +42,7 @@ static const char *channel_names[] = {
};
/* 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;

View File

@ -52,7 +52,7 @@ static const uint32_t devopts[] = {
};
/* 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 } },

View File

@ -66,7 +66,7 @@ struct hcs_model {
/** 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;

View File

@ -88,7 +88,7 @@ static const char *channel_modes[] = {
"Track2",
};
static struct lps_modelspec models[] = {
static const struct lps_modelspec models[] = {
{ LPS_UNKNOWN, "Dummy", 0,
{

View File

@ -95,7 +95,7 @@ struct channel_status {
/** 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. */

View File

@ -33,7 +33,7 @@ static const uint32_t drvopts[] = {
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" },
@ -104,9 +104,9 @@ static struct sr_dev_inst *probe_device(struct sr_scpi_dev_inst *scpi)
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. */
@ -419,7 +419,7 @@ static int config_list(uint32_t key, GVariant **data, const struct sr_dev_inst *
{
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;

View File

@ -63,35 +63,35 @@ static const uint32_t rigol_dp800_devopts_cg[] = {
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?" },
@ -136,15 +136,15 @@ static const uint32_t hp_6632b_devopts[] = {
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" },
@ -183,7 +183,7 @@ enum philips_pm2800_modules {
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];
@ -198,7 +198,7 @@ static struct philips_pm2800_module_spec {
[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;
@ -226,15 +226,15 @@ static struct philips_pm2800_model {
{ 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;
@ -270,9 +270,9 @@ static int philips_pm2800_probe_channels(struct sr_dev_inst *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;
}
@ -281,7 +281,7 @@ static int philips_pm2800_probe_channels(struct sr_dev_inst *sdi,
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?" },

View File

@ -21,11 +21,11 @@
#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;
@ -44,7 +44,7 @@ SR_PRIV int scpi_cmd(const struct sr_dev_inst *sdi, int command, ...)
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. */
@ -66,7 +66,8 @@ SR_PRIV int scpi_cmd_resp(const struct sr_dev_inst *sdi, GVariant **gvar,
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. */

View File

@ -77,18 +77,18 @@ enum pps_features {
};
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,
@ -96,7 +96,7 @@ struct scpi_pps {
};
struct channel_spec {
char *name;
const char *name;
/* Min, max, programming resolution. */
float voltage[3];
float current[3];
@ -104,11 +104,11 @@ struct channel_spec {
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;
};
@ -116,13 +116,13 @@ struct channel_group_spec {
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 {
@ -153,7 +153,7 @@ struct dev_context {
};
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, ...);

View File

@ -280,7 +280,7 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data)
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,

View File

@ -36,8 +36,9 @@ static const uint32_t devopts[] = {
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 },
};

View File

@ -76,7 +76,7 @@ SR_PRIV int testo_probe_channels(struct sr_dev_inst *sdi)
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;
@ -153,7 +153,7 @@ SR_PRIV int testo_request_packet(const struct sr_dev_inst *sdi)
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));

View File

@ -48,13 +48,13 @@
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;
@ -69,7 +69,7 @@ struct dev_context {
/* Temporary state across callbacks */
struct libusb_transfer *out_transfer;
unsigned char reply[MAX_REPLY_SIZE];
uint8_t reply[MAX_REPLY_SIZE];
int reply_size;
};
@ -77,7 +77,7 @@ SR_PRIV int testo_set_serial_params(struct sr_usb_dev_inst *usb);
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);

View File

@ -61,7 +61,7 @@ SR_PRIV struct sr_dev_driver voltcraft_vc960_driver_info;
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,

View File

@ -24,7 +24,7 @@
#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).

View File

@ -23,8 +23,8 @@
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,
@ -178,7 +178,7 @@ static int check_channel_group(struct dev_context *devc,
const struct sr_channel_group *cg)
{
unsigned int i;
struct scope_config *model;
const struct scope_config *model;
model = devc->model_config;
@ -203,7 +203,7 @@ static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *s
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))
@ -322,7 +322,7 @@ static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sd
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;
@ -474,7 +474,7 @@ static int config_list(uint32_t key, GVariant **data, const struct sr_dev_inst *
{
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)
@ -572,7 +572,7 @@ static int dlm_setup_channels(const struct sr_dev_inst *sdi)
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;

View File

@ -168,7 +168,7 @@ static const char *scope_digital_channel_names[] = {
"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},
@ -235,7 +235,7 @@ static struct scope_config scope_models[] = {
* @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;
@ -376,7 +376,7 @@ static int array_float_get(gchar *value, const uint64_t array[][2],
* @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;
@ -439,7 +439,7 @@ static int analog_channel_state_get(struct sr_scpi_dev_inst *scpi,
* @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;
@ -514,7 +514,7 @@ SR_PRIV int dlm_scope_state_query(struct sr_dev_inst *sdi)
{
struct dev_context *devc;
struct scope_state *state;
struct scope_config *config;
const struct scope_config *config;
float tmp_float;
gchar *response;
int i;
@ -588,7 +588,7 @@ SR_PRIV int dlm_scope_state_query(struct sr_dev_inst *sdi)
*
* @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;

View File

@ -105,7 +105,7 @@ struct scope_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;

View File

@ -454,9 +454,9 @@ static int init(struct sr_input *in, GHashTable *options)
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"))
@ -581,7 +581,8 @@ static int initial_receive(const struct sr_input *in)
struct context *inc;
GString *new_buf;
int len, ret;
char *termination, *p;
char *p;
const char *termination;
inc = in->priv;

View File

@ -36,7 +36,7 @@ struct scpi_serial {
size_t read;
};
static struct {
static const struct {
uint16_t vendor_id;
uint16_t product_id;
const char *serialcomm;