Various minor cosmetics and consistency fixes.

This commit is contained in:
Uwe Hermann 2015-08-15 17:16:01 +02:00
parent ad0293f19c
commit c442ffda0f
13 changed files with 42 additions and 48 deletions

View File

@ -778,8 +778,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
if (devc->dslogic) { if (devc->dslogic) {
dslogic_trigger_request(sdi); dslogic_trigger_request(sdi);
} } else {
else {
start_transfers(sdi); start_transfers(sdi);
if ((ret = fx2lafw_command_start_acquisition(sdi)) != SR_OK) { if ((ret = fx2lafw_command_start_acquisition(sdi)) != SR_OK) {
fx2lafw_abort_acquisition(devc); fx2lafw_abort_acquisition(devc);

View File

@ -27,7 +27,7 @@
#include "protocol.h" #include "protocol.h"
/* Internal Headers */ /* Internal Headers */
static guchar calc_chksum_14(guchar* dta); static guchar calc_chksum_14(guchar *dta);
static int chk_msg14(struct sr_dev_inst *sdi); static int chk_msg14(struct sr_dev_inst *sdi);
/** Set or clear flags in devc->mqflags. */ /** Set or clear flags in devc->mqflags. */
@ -872,7 +872,7 @@ static void process_msg_inf_13(struct sr_dev_inst *sdi)
* @param buf Pointer to array of 14 data bytes. * @param buf Pointer to array of 14 data bytes.
* @param[in] raw Write only data bytes, no interpretation. * @param[in] raw Write only data bytes, no interpretation.
*/ */
void dump_msg14(guchar* buf, gboolean raw) void dump_msg14(guchar *buf, gboolean raw)
{ {
if (!buf) if (!buf)
return; return;
@ -896,7 +896,7 @@ void dump_msg14(guchar* buf, gboolean raw)
* @param[in] dta Pointer to array of 13 data bytes. * @param[in] dta Pointer to array of 13 data bytes.
* @return Checksum. * @return Checksum.
*/ */
static guchar calc_chksum_14(guchar* dta) static guchar calc_chksum_14(guchar *dta)
{ {
guchar cnt, chs; guchar cnt, chs;
@ -1261,7 +1261,7 @@ SR_PRIV int gmc_mh_2x_receive_data(int fd, int revents, void *cb_data)
* @param[in] params Further parameters (9 bytes) * @param[in] params Further parameters (9 bytes)
* @param[out] buf Buffer to create msg in (42 bytes). * @param[out] buf Buffer to create msg in (42 bytes).
*/ */
void create_cmd_14(guchar addr, guchar func, guchar* params, guchar* buf) void create_cmd_14(guchar addr, guchar func, guchar *params, guchar *buf)
{ {
uint8_t dta[GMC_REPLY_SIZE]; /* Unencoded message */ uint8_t dta[GMC_REPLY_SIZE]; /* Unencoded message */
int cnt; int cnt;

View File

@ -123,8 +123,8 @@ struct dev_context {
/* Forward declarations */ /* Forward declarations */
SR_PRIV int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi, SR_PRIV int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi,
const struct sr_channel_group *cg); const struct sr_channel_group *cg);
SR_PRIV void create_cmd_14(guchar addr, guchar func, guchar* params, guchar* buf); SR_PRIV void create_cmd_14(guchar addr, guchar func, guchar *params, guchar *buf);
SR_PRIV void dump_msg14(guchar* buf, gboolean raw); SR_PRIV void dump_msg14(guchar *buf, gboolean raw);
SR_PRIV int gmc_decode_model_bd(uint8_t mcode); SR_PRIV int gmc_decode_model_bd(uint8_t mcode);
SR_PRIV int gmc_decode_model_sm(uint8_t mcode); SR_PRIV int gmc_decode_model_sm(uint8_t mcode);
SR_PRIV int gmc_mh_1x_2x_receive_data(int fd, int revents, void *cb_data); SR_PRIV int gmc_mh_1x_2x_receive_data(int fd, int revents, void *cb_data);

View File

@ -472,10 +472,7 @@ static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *s
*data = g_variant_new_string(devc->triggersource); *data = g_variant_new_string(devc->triggersource);
break; break;
case SR_CONF_TRIGGER_SLOPE: case SR_CONF_TRIGGER_SLOPE:
if (devc->triggerslope == SLOPE_POSITIVE) s = (devc->triggerslope == SLOPE_POSITIVE) ? "r" : "f";
s = "r";
else
s = "f";
*data = g_variant_new_string(s); *data = g_variant_new_string(s);
break; break;
case SR_CONF_HORIZ_TRIGGERPOS: case SR_CONF_HORIZ_TRIGGERPOS:

View File

@ -198,7 +198,7 @@ SR_PRIV int mso_dac_out(const struct sr_dev_inst *sdi, uint16_t val)
return mso_send_control_message(devc->serial, ARRAY_AND_SIZE(ops)); return mso_send_control_message(devc->serial, ARRAY_AND_SIZE(ops));
} }
SR_PRIV inline uint16_t mso_calc_raw_from_mv(struct dev_context * devc) SR_PRIV uint16_t mso_calc_raw_from_mv(struct dev_context *devc)
{ {
return (uint16_t) (0x200 - return (uint16_t) (0x200 -
((devc->dso_trigger_voltage / devc->dso_probe_attn) / ((devc->dso_trigger_voltage / devc->dso_probe_attn) /

View File

@ -134,7 +134,7 @@ SR_PRIV int mso_read_buffer(struct sr_dev_inst *sdi);
SR_PRIV int mso_arm(const struct sr_dev_inst *sdi); SR_PRIV int mso_arm(const struct sr_dev_inst *sdi);
SR_PRIV int mso_force_capture(struct sr_dev_inst *sdi); SR_PRIV int mso_force_capture(struct sr_dev_inst *sdi);
SR_PRIV int mso_dac_out(const struct sr_dev_inst *sdi, uint16_t val); SR_PRIV int mso_dac_out(const struct sr_dev_inst *sdi, uint16_t val);
SR_PRIV inline uint16_t mso_calc_raw_from_mv(struct dev_context *devc); SR_PRIV uint16_t mso_calc_raw_from_mv(struct dev_context *devc);
SR_PRIV int mso_reset_fsm(struct sr_dev_inst *sdi); SR_PRIV int mso_reset_fsm(struct sr_dev_inst *sdi);
SR_PRIV int mso_toggle_led(struct sr_dev_inst *sdi, int state); SR_PRIV int mso_toggle_led(struct sr_dev_inst *sdi, int state);

View File

@ -20,7 +20,7 @@
*/ */
/** @file /** @file
* <em>Manson HCS-3xxx Series</em> power supply driver * <em>Manson HCS-3xxx series</em> power supply driver
* @internal * @internal
*/ */

View File

@ -62,7 +62,7 @@ SR_PRIV int hcs_send_cmd(struct sr_serial_dev_inst *serial, const char *cmd, ...
* @retval SR_ERR Error. * @retval SR_ERR Error.
* @retval SR_ERR_ARG Invalid argument. * @retval SR_ERR_ARG Invalid argument.
*/ */
SR_PRIV int hcs_read_reply(struct sr_serial_dev_inst *serial, int lines, char* buf, int buflen) SR_PRIV int hcs_read_reply(struct sr_serial_dev_inst *serial, int lines, char *buf, int buflen)
{ {
int l_recv = 0; int l_recv = 0;
int bufpos = 0; int bufpos = 0;

View File

@ -92,7 +92,7 @@ struct dev_context {
}; };
SR_PRIV int hcs_parse_volt_curr_mode(struct sr_dev_inst *sdi, char **tokens); SR_PRIV int hcs_parse_volt_curr_mode(struct sr_dev_inst *sdi, char **tokens);
SR_PRIV int hcs_read_reply(struct sr_serial_dev_inst *serial, int lines, char* buf, int buflen); SR_PRIV int hcs_read_reply(struct sr_serial_dev_inst *serial, int lines, char *buf, int buflen);
SR_PRIV int hcs_send_cmd(struct sr_serial_dev_inst *serial, const char *cmd, ...); SR_PRIV int hcs_send_cmd(struct sr_serial_dev_inst *serial, const char *cmd, ...);
SR_PRIV int hcs_receive_data(int fd, int revents, void *cb_data); SR_PRIV int hcs_receive_data(int fd, int revents, void *cb_data);

View File

@ -128,7 +128,7 @@ static struct sr_dev_inst *probe_device(struct sr_modbus_dev_inst *modbus)
int ret = maynuo_m97_get_model_version(modbus, &id, &version); int ret = maynuo_m97_get_model_version(modbus, &id, &version);
if (ret != SR_OK) if (ret != SR_OK)
return NULL; return NULL;
for (i=0; i<ARRAY_SIZE(supported_models); i++) for (i = 0; i < ARRAY_SIZE(supported_models); i++)
if (id == supported_models[i].id) { if (id == supported_models[i].id) {
model = &supported_models[i]; model = &supported_models[i];
break; break;

View File

@ -31,10 +31,10 @@
/* Forward declarations */ /* Forward declarations */
SR_PRIV struct sr_dev_driver motech_lps_301_driver_info; SR_PRIV struct sr_dev_driver motech_lps_301_driver_info;
SR_PRIV int lps_read_reply(struct sr_serial_dev_inst *serial, char **buf, int *buflen); SR_PRIV int lps_read_reply(struct sr_serial_dev_inst *serial, char **buf, int *buflen);
SR_PRIV int lps_send_va(struct sr_serial_dev_inst *serial, const char* fmt, va_list args); SR_PRIV int lps_send_va(struct sr_serial_dev_inst *serial, const char *fmt, va_list args);
SR_PRIV int lps_cmd_ok(struct sr_serial_dev_inst *serial, const char* fmt, ...); SR_PRIV int lps_cmd_ok(struct sr_serial_dev_inst *serial, const char *fmt, ...);
SR_PRIV int lps_cmd_reply(char* reply, struct sr_serial_dev_inst *serial, const char* fmt, ...); SR_PRIV int lps_cmd_reply(char *reply, struct sr_serial_dev_inst *serial, const char *fmt, ...);
SR_PRIV int lps_query_status(struct sr_dev_inst* sdi); SR_PRIV int lps_query_status(struct sr_dev_inst *sdi);
/* Serial communication parameters */ /* Serial communication parameters */
#define SERIALCOMM "2400/8n1/dtr=1/rts=1/flow=0" #define SERIALCOMM "2400/8n1/dtr=1/rts=1/flow=0"
@ -139,7 +139,7 @@ static int init_lps301(struct sr_dev_driver *di, struct sr_context *sr_ctx)
/** Send command to device with va_list. /** Send command to device with va_list.
*/ */
SR_PRIV int lps_send_va(struct sr_serial_dev_inst *serial, const char* fmt, va_list args) SR_PRIV int lps_send_va(struct sr_serial_dev_inst *serial, const char *fmt, va_list args)
{ {
int retc; int retc;
char auxfmt[LINELEN_MAX]; char auxfmt[LINELEN_MAX];
@ -160,7 +160,7 @@ SR_PRIV int lps_send_va(struct sr_serial_dev_inst *serial, const char* fmt, va_l
/** Send command to device. /** Send command to device.
*/ */
SR_PRIV int lps_send_req(struct sr_serial_dev_inst *serial, const char* fmt, ...) SR_PRIV int lps_send_req(struct sr_serial_dev_inst *serial, const char *fmt, ...)
{ {
int retc; int retc;
va_list args; va_list args;
@ -173,12 +173,12 @@ SR_PRIV int lps_send_req(struct sr_serial_dev_inst *serial, const char* fmt, ...
} }
/** Send command and consume simple OK reply. */ /** Send command and consume simple OK reply. */
SR_PRIV int lps_cmd_ok(struct sr_serial_dev_inst *serial, const char* fmt, ...) SR_PRIV int lps_cmd_ok(struct sr_serial_dev_inst *serial, const char *fmt, ...)
{ {
int retc; int retc;
va_list args; va_list args;
char buf[LINELEN_MAX]; char buf[LINELEN_MAX];
char* bufptr; char *bufptr;
int buflen; int buflen;
/* Send command */ /* Send command */
@ -203,12 +203,12 @@ SR_PRIV int lps_cmd_ok(struct sr_serial_dev_inst *serial, const char* fmt, ...)
/** Send command and read reply string. /** Send command and read reply string.
* @param reply Pointer to buffer of size LINELEN_MAX. Will be NUL-terminated. * @param reply Pointer to buffer of size LINELEN_MAX. Will be NUL-terminated.
*/ */
SR_PRIV int lps_cmd_reply(char* reply, struct sr_serial_dev_inst *serial, const char* fmt, ...) SR_PRIV int lps_cmd_reply(char *reply, struct sr_serial_dev_inst *serial, const char *fmt, ...)
{ {
int retc; int retc;
va_list args; va_list args;
char buf[LINELEN_MAX]; char buf[LINELEN_MAX];
char* bufptr; char *bufptr;
int buflen; int buflen;
reply[0] = '\0'; reply[0] = '\0';
@ -235,12 +235,12 @@ SR_PRIV int lps_cmd_reply(char* reply, struct sr_serial_dev_inst *serial, const
} }
/** Process integer value returned by STATUS command. */ /** Process integer value returned by STATUS command. */
SR_PRIV int lps_process_status(struct sr_dev_inst* sdi, int stat) SR_PRIV int lps_process_status(struct sr_dev_inst *sdi, int stat)
{ {
struct dev_context* devc; struct dev_context *devc;
int tracking_mode; int tracking_mode;
devc = (struct dev_context*)sdi->priv; devc = (struct dev_context *)sdi->priv;
sr_spew("Status: %d", stat); sr_spew("Status: %d", stat);
devc->channel_status[0].cc_mode = (stat & 0x01) != 0; devc->channel_status[0].cc_mode = (stat & 0x01) != 0;
@ -281,13 +281,13 @@ SR_PRIV int lps_process_status(struct sr_dev_inst* sdi, int stat)
} }
/** Send STATUS commend and process status string. */ /** Send STATUS commend and process status string. */
SR_PRIV int lps_query_status(struct sr_dev_inst* sdi) SR_PRIV int lps_query_status(struct sr_dev_inst *sdi)
{ {
char buf[LINELEN_MAX]; char buf[LINELEN_MAX];
int stat, ret; int stat, ret;
struct dev_context* devc; struct dev_context *devc;
devc = (struct dev_context*)sdi->priv; devc = (struct dev_context *)sdi->priv;
devc->req_sent_at = g_get_real_time(); devc->req_sent_at = g_get_real_time();
@ -520,7 +520,7 @@ static GSList *dev_list_lps301(const struct sr_dev_driver *di)
return ((struct drv_context *)(di->context))->instances; return ((struct drv_context *)(di->context))->instances;
} }
static void dev_clear_private(struct dev_context* devc) static void dev_clear_private(struct dev_context *devc)
{ {
int ch_idx; int ch_idx;
@ -794,8 +794,7 @@ static int config_list(uint32_t key, GVariant **data, const struct sr_dev_inst *
return SR_OK; return SR_OK;
} }
static int dev_acquisition_start(const struct sr_dev_inst *sdi, static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
void *cb_data)
{ {
struct dev_context *devc; struct dev_context *devc;
struct sr_serial_dev_inst *serial; struct sr_serial_dev_inst *serial;

View File

@ -31,8 +31,8 @@
#include "libsigrok.h" #include "libsigrok.h"
#include "libsigrok-internal.h" #include "libsigrok-internal.h"
SR_PRIV int lps_process_status(struct sr_dev_inst* sdi, int stat); SR_PRIV int lps_process_status(struct sr_dev_inst *sdi, int stat);
SR_PRIV int lps_send_req(struct sr_serial_dev_inst *serial, const char* fmt, ...); SR_PRIV int lps_send_req(struct sr_serial_dev_inst *serial, const char *fmt, ...);
#define LOG_PREFIX "motech-lps-30x" #define LOG_PREFIX "motech-lps-30x"
@ -61,7 +61,7 @@ struct channel_spec {
/** Model properties specification */ /** Model properties specification */
struct lps_modelspec { struct lps_modelspec {
lps_modelid modelid; lps_modelid modelid;
const char* modelstr; const char *modelstr;
uint8_t num_channels; uint8_t num_channels;
struct channel_spec channels[3]; struct channel_spec channels[3];
}; };
@ -79,7 +79,7 @@ typedef enum {
/** Status of a single channel. */ /** Status of a single channel. */
struct channel_status { struct channel_status {
/* Channel information (struct channel_info*). data (struct) owned by sdi, just a reference to address a single channel. */ /* Channel information (struct channel_info*). data (struct) owned by sdi, just a reference to address a single channel. */
GSList* info; GSList *info;
/* Received from device. */ /* Received from device. */
gdouble output_voltage_last; gdouble output_voltage_last;
gdouble output_current_last; gdouble output_current_last;
@ -93,7 +93,7 @@ struct channel_status {
/** Private, per-device-instance driver context. */ /** Private, per-device-instance driver context. */
struct dev_context { struct dev_context {
/* Model-specific information */ /* Model-specific information */
const struct lps_modelspec* model; const struct lps_modelspec *model;
/* Acquisition status */ /* Acquisition status */
gboolean acq_running; /**< Acquisition is running. */ gboolean acq_running; /**< Acquisition is running. */

View File

@ -43,7 +43,7 @@ static const uint32_t devopts[] = {
SR_PRIV struct sr_dev_driver norma_dmm_driver_info; SR_PRIV struct sr_dev_driver norma_dmm_driver_info;
SR_PRIV struct sr_dev_driver siemens_b102x_driver_info; SR_PRIV struct sr_dev_driver siemens_b102x_driver_info;
static const char* get_brandstr(struct sr_dev_driver* drv) static const char *get_brandstr(struct sr_dev_driver *drv)
{ {
if (drv == &norma_dmm_driver_info) if (drv == &norma_dmm_driver_info)
return "Norma"; return "Norma";
@ -51,9 +51,9 @@ static const char* get_brandstr(struct sr_dev_driver* drv)
return "Siemens"; return "Siemens";
} }
static const char* get_typestr(int type, struct sr_dev_driver* drv) static const char *get_typestr(int type, struct sr_dev_driver *drv)
{ {
static const char* nameref[5][2] = { static const char *nameref[5][2] = {
{"DM910", "B1024"}, {"DM910", "B1024"},
{"DM920", "B1025"}, {"DM920", "B1025"},
{"DM930", "B1026"}, {"DM930", "B1026"},
@ -71,7 +71,7 @@ static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx)
return std_init(sr_ctx, di, LOG_PREFIX); return std_init(sr_ctx, di, LOG_PREFIX);
} }
static GSList *scan(struct sr_dev_driver* drv, GSList *options) static GSList *scan(struct sr_dev_driver *drv, GSList *options)
{ {
struct sr_dev_inst *sdi; struct sr_dev_inst *sdi;
struct drv_context *drvc; struct drv_context *drvc;
@ -250,8 +250,7 @@ static int config_list(uint32_t key, GVariant **data, const struct sr_dev_inst *
return SR_OK; return SR_OK;
} }
static int dev_acquisition_start(const struct sr_dev_inst *sdi, static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
void *cb_data)
{ {
struct dev_context *devc; struct dev_context *devc;
struct sr_serial_dev_inst *serial; struct sr_serial_dev_inst *serial;