if (devc->dslogic) {
dslogic_trigger_request(sdi);
- }
- else {
+ } else {
start_transfers(sdi);
if ((ret = fx2lafw_command_start_acquisition(sdi)) != SR_OK) {
fx2lafw_abort_acquisition(devc);
#include "protocol.h"
/* 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);
/** Set or clear flags in devc->mqflags. */
* @param buf Pointer to array of 14 data bytes.
* @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)
return;
* @param[in] dta Pointer to array of 13 data bytes.
* @return Checksum.
*/
-static guchar calc_chksum_14(guchar* dta)
+static guchar calc_chksum_14(guchar *dta)
{
guchar cnt, chs;
* @param[in] params Further parameters (9 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 */
int cnt;
/* Forward declarations */
SR_PRIV int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi,
const struct sr_channel_group *cg);
-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 create_cmd_14(guchar addr, guchar func, guchar *params, guchar *buf);
+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_sm(uint8_t mcode);
SR_PRIV int gmc_mh_1x_2x_receive_data(int fd, int revents, void *cb_data);
*data = g_variant_new_string(devc->triggersource);
break;
case SR_CONF_TRIGGER_SLOPE:
- if (devc->triggerslope == SLOPE_POSITIVE)
- s = "r";
- else
- s = "f";
+ s = (devc->triggerslope == SLOPE_POSITIVE) ? "r" : "f";
*data = g_variant_new_string(s);
break;
case SR_CONF_HORIZ_TRIGGERPOS:
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 -
((devc->dso_trigger_voltage / devc->dso_probe_attn) /
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_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_toggle_led(struct sr_dev_inst *sdi, int state);
*/
/** @file
- * <em>Manson HCS-3xxx Series</em> power supply driver
+ * <em>Manson HCS-3xxx series</em> power supply driver
* @internal
*/
* @retval SR_ERR Error.
* @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 bufpos = 0;
};
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_receive_data(int fd, int revents, void *cb_data);
int ret = maynuo_m97_get_model_version(modbus, &id, &version);
if (ret != SR_OK)
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) {
model = &supported_models[i];
break;
/* Forward declarations */
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_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_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_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_reply(char *reply, struct sr_serial_dev_inst *serial, const char *fmt, ...);
+SR_PRIV int lps_query_status(struct sr_dev_inst *sdi);
/* Serial communication parameters */
#define SERIALCOMM "2400/8n1/dtr=1/rts=1/flow=0"
/** 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;
char auxfmt[LINELEN_MAX];
/** 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;
va_list args;
}
/** 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;
va_list args;
char buf[LINELEN_MAX];
- char* bufptr;
+ char *bufptr;
int buflen;
/* Send command */
/** Send command and read reply string.
* @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;
va_list args;
char buf[LINELEN_MAX];
- char* bufptr;
+ char *bufptr;
int buflen;
reply[0] = '\0';
}
/** 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;
- devc = (struct dev_context*)sdi->priv;
+ devc = (struct dev_context *)sdi->priv;
sr_spew("Status: %d", stat);
devc->channel_status[0].cc_mode = (stat & 0x01) != 0;
}
/** 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];
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();
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;
return SR_OK;
}
-static int dev_acquisition_start(const struct sr_dev_inst *sdi,
- void *cb_data)
+static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
{
struct dev_context *devc;
struct sr_serial_dev_inst *serial;
#include "libsigrok.h"
#include "libsigrok-internal.h"
-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_process_status(struct sr_dev_inst *sdi, int stat);
+SR_PRIV int lps_send_req(struct sr_serial_dev_inst *serial, const char *fmt, ...);
#define LOG_PREFIX "motech-lps-30x"
/** Model properties specification */
struct lps_modelspec {
lps_modelid modelid;
- const char* modelstr;
+ const char *modelstr;
uint8_t num_channels;
struct channel_spec channels[3];
};
/** Status of a single channel. */
struct channel_status {
/* 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. */
gdouble output_voltage_last;
gdouble output_current_last;
/** Private, per-device-instance driver context. */
struct dev_context {
/* Model-specific information */
- const struct lps_modelspec* model;
+ const struct lps_modelspec *model;
/* Acquisition status */
gboolean acq_running; /**< Acquisition is running. */
SR_PRIV struct sr_dev_driver norma_dmm_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)
return "Norma";
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"},
{"DM920", "B1025"},
{"DM930", "B1026"},
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 drv_context *drvc;
return SR_OK;
}
-static int dev_acquisition_start(const struct sr_dev_inst *sdi,
- void *cb_data)
+static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
{
struct dev_context *devc;
struct sr_serial_dev_inst *serial;