0x01, 0x03, 0x03, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01,
};
- int i, ret, timeout = 10000;
+ int i, ret, timeout = (10 * 1000);
uint8_t data;
/* Section 2. part 1), do the FPGA suicide. */
if (data & (1 << 5))
return 0;
/* The D6 was not asserted yet, wait a bit. */
- g_usleep(10000);
+ g_usleep(10 * 1000);
}
return SR_ERR_TIMEOUT;
}
/* Four times the speed of sigmalogan - Works well. */
- ret = ftdi_set_baudrate(ftdic, 750000);
+ ret = ftdi_set_baudrate(ftdic, 750 * 1000);
if (ret < 0) {
sr_err("ftdi_set_baudrate failed: %s",
ftdi_get_error_string(ftdic));
"ms, baudrate = %d).", serial->port, timeout_ms, baudrate);
/* Assume 8n1 transmission. That is 10 bits for every byte. */
- byte_delay_us = 10 * (1000000 / baudrate);
+ byte_delay_us = 10 * ((1000 * 1000) / baudrate);
start = g_get_monotonic_time();
packet_len = i = ibuf = len = 0;
#define SERIALCOMM "9600/8n1"
/* 23ms is the longest interval between tokens. */
-#define MAX_SCAN_TIME 25 * 1000
+#define MAX_SCAN_TIME_US (25 * 1000)
static const uint32_t scanopts[] = {
SR_CONF_CONN,
devices = NULL;
drvc = di->priv;
start = g_get_monotonic_time();
- while (g_get_monotonic_time() - start < MAX_SCAN_TIME) {
+ while (g_get_monotonic_time() - start < MAX_SCAN_TIME_US) {
if (serial_read_nonblocking(serial, &c, 1) == 1 && c == 0xa5) {
/* Found one. */
sdi = g_malloc0(sizeof(struct sr_dev_inst));
#define SAMPLES_PER_PACKET 50
/* Various temporary storage, at least 8 bytes. */
-#define BUF_SIZE SAMPLES_PER_PACKET * 2
+#define BUF_SIZE (SAMPLES_PER_PACKET * 2)
/* When in hold mode, force the last measurement out at this interval.
* We're using 50ms, which duplicates the non-hold 20Hz update rate. */
-#define HOLD_REPEAT_INTERVAL 50 * 1000
+#define HOLD_REPEAT_INTERVAL (50 * 1000)
enum {
TOKEN_WEIGHT_TIME_FAST = 0x02,
* Wait 50ms to ensure that the device does not swallow any of the
* following commands.
*/
- g_usleep(50000);
+ g_usleep(50 * 1000);
return SR_OK;
}
/* How many samples should we have sent by now? */
time = g_get_monotonic_time();
elapsed = time - devc->starttime;
- expected_samplenum = elapsed * devc->cur_samplerate / 1000000;
+ expected_samplenum = elapsed * devc->cur_samplerate / (1000 * 1000);
/* But never more than the limit, if there is one. */
if (!devc->continuous)
break;
/* The Scopemeter 199B, at least, requires this
* after all the 115k/9.6k confusion. */
- g_usleep(5000);
+ g_usleep(5 * 1000);
}
}
#include "protocol.h"
#include "dslogic.h"
-#define FW_BUFSIZE 4096
+#define FW_BUFSIZE (4 * 1024)
+
int dslogic_fpga_firmware_upload(const struct sr_dev_inst *sdi,
const char *filename)
{
gint64 timeout_us;
model = METRAHIT_NONE;
- timeout_us = g_get_monotonic_time() + 1 * 1000 * 1000;
+ timeout_us = g_get_monotonic_time() + (1 * 1000 * 1000);
/*
* Try to find message consisting of device code and several
goto exit_err;
/* Wait for reply from device(s) for up to 2s. */
- timeout_us = g_get_monotonic_time() + 2*1000*1000;
+ timeout_us = g_get_monotonic_time() + (2 * 1000 * 1000);
while (timeout_us > g_get_monotonic_time()) {
/* Receive reply (14 bytes) */
if (sdi->status == SR_ST_ACTIVE) {
if (devc->response_pending) {
gint64 elapsed_us = g_get_monotonic_time() - devc->req_sent_at;
- if (elapsed_us > 1*1000*1000) /* Timeout! */
+ if (elapsed_us > (1 * 1000 * 1000)) /* Timeout! */
devc->response_pending = FALSE;
}
if (!devc->response_pending) {
sr_info("Write some data and wait 3s to turn on powered off device...");
if (serial_write_blocking(serial, msg, sizeof(msg), 0) < 0)
return SR_ERR;
- g_usleep(1*1000*1000);
+ g_usleep(1 * 1000 * 1000);
if (serial_write_blocking(serial, msg, sizeof(msg), 0) < 0)
return SR_ERR;
- g_usleep(1*1000*1000);
+ g_usleep(1 * 1000 * 1000);
if (serial_write_blocking(serial, msg, sizeof(msg), 0) < 0)
return SR_ERR;
- g_usleep(1*1000*1000);
+ g_usleep(1 * 1000 * 1000);
serial_flush(serial);
}
if (serial_write_blocking(sdi->conn, msg, sizeof(msg), 0) < 0)
return SR_ERR;
else
- g_usleep(2000000); /* Wait to ensure transfer before interface switched off. */
+ g_usleep(2 * 1000 * 1000); /* Wait to ensure transfer before interface switched off. */
break;
case SR_CONF_LIMIT_MSEC:
devc->limit_msec = g_variant_get_uint64(data);
};
static const uint64_t buffersizes_32k[] = {
- 10240, 32768,
+ (10 * 1024), (32 * 1024),
};
static const uint64_t buffersizes_512k[] = {
- 10240, 524288,
+ (10 * 1024), (512 * 1024),
};
static const uint64_t buffersizes_14k[] = {
- 10240, 14336,
+ (10 * 1024), (14 * 1024),
};
static const struct dso_profile dev_profiles[] = {
#define EEPROM_CHANNEL_OFFSETS 0x08
/* All models have this for their "fast" mode. */
-#define FRAMESIZE_SMALL 10240
+#define FRAMESIZE_SMALL (10 * 1024)
enum control_requests {
CTRL_READ_EEPROM = 0xa2,
libusb_fill_control_transfer(devc->xfer_in, usb->devhdl,
devc->xfer_buf_in, sl2_receive_transfer_in,
- sdi, USB_TIMEOUT);
+ sdi, USB_TIMEOUT_MS);
libusb_fill_control_transfer(devc->xfer_out, usb->devhdl,
devc->xfer_buf_out, sl2_receive_transfer_out,
- sdi, USB_TIMEOUT);
+ sdi, USB_TIMEOUT_MS);
memset(buffer, 0, sizeof(buffer));
{
return libusb_control_transfer(dev_handle, USB_REQUEST_TYPE_IN,
USB_HID_GET_REPORT, USB_HID_REPORT_TYPE_FEATURE, USB_INTERFACE,
- (unsigned char *)data, PACKET_LENGTH, USB_TIMEOUT);
+ (unsigned char *)data, PACKET_LENGTH, USB_TIMEOUT_MS);
}
SR_PRIV int sl2_transfer_out(libusb_device_handle *dev_handle, uint8_t *data)
{
return libusb_control_transfer(dev_handle, USB_REQUEST_TYPE_OUT,
USB_HID_SET_REPORT, USB_HID_REPORT_TYPE_FEATURE, USB_INTERFACE,
- (unsigned char *)data, PACKET_LENGTH, USB_TIMEOUT);
+ (unsigned char *)data, PACKET_LENGTH, USB_TIMEOUT_MS);
}
#define USB_VID_PID "20a0.4123"
#define USB_INTERFACE 0
-#define USB_TIMEOUT 5000
+#define USB_TIMEOUT_MS (5 * 1000)
#define USB_REQUEST_TYPE_IN (LIBUSB_REQUEST_TYPE_CLASS | \
LIBUSB_RECIPIENT_INTERFACE | LIBUSB_ENDPOINT_IN)
#define LOG_PREFIX "ikalogic-scanaplus"
-#define COMPRESSED_BUF_SIZE (64 * 1024)
+#define COMPRESSED_BUF_SIZE (64 * 1024)
/* Private, per-device-instance driver context. */
struct dev_context {
#define LOG_PREFIX "kecheng-kc-330b"
-#define EP_IN 0x80 | 1
+#define EP_IN (0x80 | 1)
#define EP_OUT 2
/* 500ms */
;
libusb_fill_bulk_transfer(xfer_in, usb->devhdl, LASCAR_EP_IN,
- resp, sizeof(resp), mark_xfer, 0, 10000);
+ resp, sizeof(resp), mark_xfer, 0, BULK_XFER_TIMEOUT);
if (libusb_submit_transfer(xfer_in) != 0) {
libusb_free_transfer(xfer_in);
libusb_free_transfer(xfer_out);
tv.tv_sec = 0;
tv.tv_usec = 0;
while (!xfer_in->user_data || !xfer_out->user_data) {
- g_usleep(5000);
+ g_usleep(SLEEP_US_LONG);
libusb_handle_events_timeout(drvc->sr_ctx->libusb_ctx, &tv);
}
if (xfer_in->user_data != GINT_TO_POINTER(1) ||
/* Keep a read request waiting in the wings, ready to pounce
* the moment the device sends something. */
libusb_fill_bulk_transfer(xfer_in, dev_hdl, LASCAR_EP_IN,
- buf, 256, mark_xfer, 0, 10000);
+ buf, 256, mark_xfer, 0, BULK_XFER_TIMEOUT);
if (libusb_submit_transfer(xfer_in) != 0)
goto cleanup;
start = 0;
break;
}
- g_usleep(5000);
+ g_usleep(SLEEP_US_LONG);
libusb_handle_events_timeout(drvc->sr_ctx->libusb_ctx, &tv);
}
if (!start) {
start = 0;
break;
}
- g_usleep(5000);
+ g_usleep(SLEEP_US_LONG);
libusb_handle_events_timeout(drvc->sr_ctx->libusb_ctx, &tv);
}
if (!start) {
libusb_cancel_transfer(xfer_out);
start = g_get_monotonic_time();
while (!xfer_in->user_data || !xfer_out->user_data) {
- if (g_get_monotonic_time() - start > 10000)
+ if (g_get_monotonic_time() - start > EVENTS_TIMEOUT)
break;
- g_usleep(1000);
+ g_usleep(SLEEP_US_SHORT);
libusb_handle_events_timeout(drvc->sr_ctx->libusb_ctx, &tv);
}
}
/* Keep a read request waiting in the wings, ready to pounce
* the moment the device sends something. */
libusb_fill_bulk_transfer(xfer_in, dev_hdl, LASCAR_EP_IN,
- buf, 256, mark_xfer, 0, 10000);
+ buf, 256, mark_xfer, 0, BULK_XFER_TIMEOUT);
if (libusb_submit_transfer(xfer_in) != 0) {
ret = SR_ERR;
goto cleanup;
tv.tv_sec = 0;
tv.tv_usec = 0;
while (!xfer_out->user_data) {
- g_usleep(5000);
+ g_usleep(SLEEP_US_LONG);
libusb_handle_events_timeout(drvc->sr_ctx->libusb_ctx, &tv);
}
goto cleanup;
}
while (!xfer_in->user_data || !xfer_out->user_data) {
- g_usleep(5000);
+ g_usleep(SLEEP_US_LONG);
libusb_handle_events_timeout(drvc->sr_ctx->libusb_ctx, &tv);
}
libusb_cancel_transfer(xfer_out);
start = g_get_monotonic_time();
while (!xfer_in->user_data || !xfer_out->user_data) {
- if (g_get_monotonic_time() - start > 10000)
+ if (g_get_monotonic_time() - start > EVENTS_TIMEOUT)
break;
- g_usleep(1000);
+ g_usleep(SLEEP_US_SHORT);
libusb_handle_events_timeout(drvc->sr_ctx->libusb_ctx, &tv);
}
}
break;
for (i = 0; i < samples; i++) {
s = (buf[i * 2] << 8) | buf[i * 2 + 1];
- analog.data[i] = (s * devc->co_high + devc->co_low) / 1000000;
+ analog.data[i] = (s * devc->co_high + devc->co_low) / (1000 * 1000);
if (analog.data[i] < 0.0)
analog.data[i] = 0.0;
}
#define LASCAR_INTERFACE 0
#define LASCAR_EP_IN 0x82
#define LASCAR_EP_OUT 2
-/* Max 100ms for a device to positively identify. */
-#define SCAN_TIMEOUT 100000
#define MAX_CONFIGBLOCK_SIZE 256
+/* Max 100ms for a device to positively identify. */
+#define SCAN_TIMEOUT (100 * 1000)
+#define BULK_XFER_TIMEOUT (10 * 1000)
+#define EVENTS_TIMEOUT (10 * 1000)
+#define SLEEP_US_LONG (5 * 1000)
+#define SLEEP_US_SHORT (1 * 1000)
+
/** Private, per-device-instance driver context. */
struct dev_context {
void *cb_data;
SR_HZ(1),
};
+#define RESPONSE_DELAY_US (10 * 1000)
+
SR_PRIV struct sr_dev_driver ols_driver_info;
static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx)
}
send_shortcommand(serial, CMD_ID);
- /* Wait 10ms for a response. */
- g_usleep(10000);
+ g_usleep(RESPONSE_DELAY_US);
if (sp_input_waiting(serial->data) == 0) {
sr_dbg("Didn't get any reply.");
*/
send_shortcommand(serial, CMD_METADATA);
- /* Wait 10ms for a response. */
- g_usleep(10000);
+ g_usleep(RESPONSE_DELAY_US);
if (sp_input_waiting(serial->data) != 0) {
/* Got metadata. */
if (tmp & 0x10) {
sr_warn("Single shot acquisition failed, retrying...");
/* Sleep a bit, otherwise the single shot will often fail */
- g_usleep(500000);
+ g_usleep(500 * 1000);
rigol_ds_config_set(sdi, ":SING");
rigol_ds_set_wait_event(devc, WAIT_STOP);
return SR_ERR;
* it too much with SCPI requests but don't wait too
* long for short sample frame sizes.
*/
- g_usleep(devc->analog_frame_size < 15000 ? 100000 : 1000000);
+ g_usleep(devc->analog_frame_size < (15 * 1000) ? (100 * 1000) : (1000 * 1000));
/* "READ,nnnn" (still working) or "IDLE,nnnn" (finished) */
if (sr_scpi_get_string(sdi->conn, ":WAV:STAT?", &buf) != SR_OK)
if (parse_int(buf + 5, &len) != SR_OK)
return SR_ERR;
- } while (buf[0] == 'R' && len < 1000000);
+ } while (buf[0] == 'R' && len < (1000 * 1000));
}
rigol_ds_set_wait_event(devc, WAIT_NONE);
if (devc->model->series->protocol == PROTOCOL_V2) {
/* The DS1000 series needs this stupid delay, *OPC? doesn't work. */
sr_spew("delay %dms", 100);
- g_usleep(100000);
+ g_usleep(100 * 1000);
return SR_OK;
} else {
return sr_scpi_get_opc(sdi->conn);
#define LOG_PREFIX "rigol-ds"
/* Size of acquisition buffers */
-#define ACQ_BUFFER_SIZE 32768
+#define ACQ_BUFFER_SIZE (32 * 1024)
/* Maximum number of samples to retrieve at once. */
-#define ACQ_BLOCK_SIZE 30000
+#define ACQ_BLOCK_SIZE (30 * 1000)
#define MAX_ANALOG_CHANNELS 4
#define MAX_DIGITAL_CHANNELS 16
#include <errno.h>
#include <glib/gstdio.h>
-#define BITSTREAM_MAX_SIZE 262144 /* bitstream size limit for safety */
-#define BITSTREAM_HEADER_SIZE 4 /* transfer header size in bytes */
+#define BITSTREAM_MAX_SIZE (256 * 1024) /* bitstream size limit for safety */
+#define BITSTREAM_HEADER_SIZE 4 /* transfer header size in bytes */
/* Load a bitstream file into memory. Returns a newly allocated array
* consisting of a 32-bit length field followed by the bitstream data.
/* Transfer the entire bitstream in one URB. */
ret = libusb_bulk_transfer(usb->devhdl, EP_BITSTREAM,
- stream, length, &xfer_len, USB_TIMEOUT);
+ stream, length, &xfer_len, USB_TIMEOUT_MS);
g_free(stream);
if (ret != 0) {
sr_info("FPGA bitstream download of %d bytes done.", xfer_len);
/* This delay appears to be necessary for reliable operation. */
- g_usleep(30000);
+ g_usleep(30 * 1000);
return SR_OK;
}
xfer_len = 0;
ret = libusb_bulk_transfer(usb->devhdl, EP_COMMAND,
(unsigned char *)command, cmd_len * 2,
- &xfer_len, USB_TIMEOUT);
+ &xfer_len, USB_TIMEOUT_MS);
if (ret != 0) {
sr_dbg("Failed to send command %d: %s.",
LWLA_TO_UINT16(command[0]), libusb_error_name(ret));
xfer_len = 0;
ret = libusb_bulk_transfer(usb->devhdl, EP_REPLY,
(unsigned char *)reply, reply_len * 4,
- &xfer_len, USB_TIMEOUT);
+ &xfer_len, USB_TIMEOUT_MS);
if (ret != 0) {
sr_dbg("Failed to receive reply: %s.", libusb_error_name(ret));
return SR_ERR;
uint64_t divider_count;
uint64_t trigger_mask;
uint64_t memory_limit;
- uint16_t command[3 + 10*4];
+ uint16_t command[3 + (10 * 4)];
devc = sdi->priv;
acq = devc->acquisition;
libusb_fill_bulk_transfer(acq->xfer_out, usb->devhdl, EP_COMMAND,
(unsigned char *)acq->xfer_buf_out, 0,
&receive_transfer_out,
- (struct sr_dev_inst *)sdi, USB_TIMEOUT);
+ (struct sr_dev_inst *)sdi, USB_TIMEOUT_MS);
libusb_fill_bulk_transfer(acq->xfer_in, usb->devhdl, EP_REPLY,
(unsigned char *)acq->xfer_buf_in,
sizeof acq->xfer_buf_in,
&receive_transfer_in,
- (struct sr_dev_inst *)sdi, USB_TIMEOUT);
+ (struct sr_dev_inst *)sdi, USB_TIMEOUT_MS);
regvals = devc->reg_write_seq;
#define USB_VID_PID "2961.6689"
#define USB_INTERFACE 0
-#define USB_TIMEOUT 3000 /* ms */
+#define USB_TIMEOUT_MS 3000
#define NUM_CHANNELS 34
/** Unit and packet size for the sigrok logic datafeed.
*/
#define UNIT_SIZE ((NUM_CHANNELS + 7) / 8)
-#define PACKET_LENGTH 10000 /* units */
+#define PACKET_LENGTH (10 * 1000) /* units */
/** Size of the acquisition buffer in device memory units.
*/
#define USB_INTERFACE 0
#define USB_CONFIGURATION 1
-#define EP_IN 0x80 | 2
+#define EP_IN (0x80 | 2)
#define EP_OUT 2
enum {
#define VICTOR_PID 0xd237
#define VICTOR_VENDOR "Victor"
#define VICTOR_INTERFACE 0
-#define VICTOR_ENDPOINT LIBUSB_ENDPOINT_IN | 1
+#define VICTOR_ENDPOINT (LIBUSB_ENDPOINT_IN | 1)
SR_PRIV struct sr_dev_driver victor_dmm_driver_info;
static int dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data);
#define LOG_PREFIX "yokogawa-dlm"
#define MAX_INSTRUMENT_VERSIONS 4
-#define RECEIVE_BUFFER_SIZE (4096)
+#define RECEIVE_BUFFER_SIZE 4096
/* See Communication Interface User's Manual on p. 268 (:WAVeform:ALL:SEND?). */
-#define DLM_MAX_FRAME_LENGTH (12500)
+#define DLM_MAX_FRAME_LENGTH 12500
/* See Communication Interface User's Manual on p. 269 (:WAVeform:SEND?). */
-#define DLM_DIVISION_FOR_WORD_FORMAT (3200)
-#define DLM_DIVISION_FOR_BYTE_FORMAT (12.5)
+#define DLM_DIVISION_FOR_WORD_FORMAT 3200
+#define DLM_DIVISION_FOR_BYTE_FORMAT 12.5
enum trigger_slopes {
SLOPE_POSITIVE,
gboolean data_pending;
};
-/*--- api.c -----------------------------------------------------------------*/
SR_PRIV int dlm_data_request(const struct sr_dev_inst *sdi);
-
-/*--- protocol.c ------------------------------------------------------------*/
SR_PRIV int dlm_model_get(char *model_id, char **model_name, int *model_index);
SR_PRIV int dlm_device_init(struct sr_dev_inst *sdi, int model_index);
SR_PRIV int dlm_data_receive(int fd, int revents, void *cb_data);
-
SR_PRIV void dlm_scope_state_destroy(struct scope_state *state);
SR_PRIV int dlm_scope_state_query(struct sr_dev_inst *sdi);
SR_PRIV int dlm_sample_rate_query(const struct sr_dev_inst *sdi);
-
SR_PRIV int dlm_channel_data_request(const struct sr_dev_inst *sdi);
#endif
LIBUSB_RECIPIENT_INTERFACE)
#define EP1_BULK_IN (LIBUSB_ENDPOINT_IN | 1)
-#define TIMEOUT 5000 /* Timeout in ms */
+#define TIMEOUT_MS (5 * 1000)
enum {
REQ_READBULK = 0x82,
int ret;
ret = libusb_control_transfer(devh, CTRL_OUT, 0xc, REQ_WRITEADDR,
- 0, packet, 1, TIMEOUT);
+ 0, packet, 1, TIMEOUT_MS);
if (ret != 1)
sr_err("%s: %s.", __func__, libusb_error_name(ret));
return ret;
int ret;
ret = libusb_control_transfer(devh, CTRL_OUT, 0xc, REQ_WRITEDATA,
- 0, packet, 1, TIMEOUT);
+ 0, packet, 1, TIMEOUT_MS);
if (ret != 1)
sr_err("%s: %s.", __func__, libusb_error_name(ret));
return ret;
int ret;
ret = libusb_control_transfer(devh, CTRL_IN, 0xc, REQ_READDATA,
- 0, packet, 1, TIMEOUT);
+ 0, packet, 1, TIMEOUT_MS);
if (ret != 1)
sr_err("%s: %s, val=%hhx.", __func__,
libusb_error_name(ret), packet[0]);
int ret, transferred = 0;
ret = libusb_control_transfer(devh, CTRL_OUT, 0x4, REQ_READBULK,
- 0, packet, 8, TIMEOUT);
+ 0, packet, 8, TIMEOUT_MS);
if (ret != 8)
sr_err("%s: libusb_control_transfer: %s.", __func__,
libusb_error_name(ret));
ret = libusb_bulk_transfer(devh, EP1_BULK_IN, buffer, size,
- &transferred, TIMEOUT);
+ &transferred, TIMEOUT_MS);
if (ret < 0)
sr_err("%s: libusb_bulk_transfer: %s.", __func__,
libusb_error_name(ret));
SR_PRIV unsigned int get_memory_size(int type)
{
if (type == MEMORY_SIZE_8K)
- return 8 * 1024;
+ return (8 * 1024);
else if (type <= MEMORY_SIZE_8M)
return (32 * 1024) << type;
else
devc->limit_samples = samples;
- if (samples <= 2 * 1024)
+ if (samples <= (2 * 1024))
devc->memory_size = MEMORY_SIZE_8K;
- else if (samples <= 16 * 1024)
+ else if (samples <= (16 * 1024))
devc->memory_size = MEMORY_SIZE_64K;
else
devc->memory_size = 19 - clz(samples - 1);
#define LOG_PREFIX "input/chronovu-la8"
#define DEFAULT_NUM_CHANNELS 8
-#define DEFAULT_SAMPLERATE 100000000L
-#define MAX_CHUNK_SIZE 4096
-#define CHRONOVU_LA8_FILESIZE 8 * 1024 * 1024 + 5
+#define DEFAULT_SAMPLERATE SR_MHZ(100)
+#define MAX_CHUNK_SIZE (4 * 1024)
+#define CHRONOVU_LA8_FILESIZE ((8 * 1024 * 1024) + 5)
struct context {
gboolean started;
g_string_append(out, " %oA");
break;
case SR_UNIT_CONCENTRATION:
- g_string_append_printf(out, "%f ppm", value * 1000000);
+ g_string_append_printf(out, "%f ppm", value * (1000 * 1000));
break;
case SR_UNIT_REVOLUTIONS_PER_MINUTE:
si_printf(value, out, "RPM");
#define LOG_PREFIX "scpi"
#define SCPI_READ_RETRIES 100
-#define SCPI_READ_RETRY_TIMEOUT 10000
+#define SCPI_READ_RETRY_TIMEOUT_US (10 * 1000)
/**
* Parse a string representation of a boolean-like value into a gboolean.
sr_scpi_get_bool(scpi, SCPI_CMD_OPC, &opc);
if (opc)
return SR_OK;
- g_usleep(SCPI_READ_RETRY_TIMEOUT);
+ g_usleep(SCPI_READ_RETRY_TIMEOUT_US);
}
return SR_ERR;
#include "libsigrok-internal.h"
#define LOG_PREFIX "scpi_vxi"
-#define VXI_DEFAULT_TIMEOUT 2000 /* in ms */
+#define VXI_DEFAULT_TIMEOUT_MS 2000
struct scpi_vxi {
char *address;
/* Set link parameters */
link_parms.clientId = (long) vxi->client;
link_parms.lockDevice = 0;
- link_parms.lock_timeout = VXI_DEFAULT_TIMEOUT;
+ link_parms.lock_timeout = VXI_DEFAULT_TIMEOUT_MS;
link_parms.device = "inst0";
if (!(link_resp = create_link_1(&link_parms, vxi->client))) {
len = strlen(terminated_command);
write_parms.lid = vxi->link;
- write_parms.io_timeout = VXI_DEFAULT_TIMEOUT;
- write_parms.lock_timeout = VXI_DEFAULT_TIMEOUT;
+ write_parms.io_timeout = VXI_DEFAULT_TIMEOUT_MS;
+ write_parms.lock_timeout = VXI_DEFAULT_TIMEOUT_MS;
write_parms.flags = DF_END;
write_parms.data.data_len = MIN(len, vxi->max_send_size);
write_parms.data.data_val = terminated_command;
Device_ReadResp *read_resp;
read_parms.lid = vxi->link;
- read_parms.io_timeout = VXI_DEFAULT_TIMEOUT;
- read_parms.lock_timeout = VXI_DEFAULT_TIMEOUT;
+ read_parms.io_timeout = VXI_DEFAULT_TIMEOUT_MS;
+ read_parms.lock_timeout = VXI_DEFAULT_TIMEOUT_MS;
read_parms.flags = 0;
read_parms.termChar = 0;
read_parms.requestSize = maxlen;
}
/* Assume 8n1 transmission. That is 10 bits for every byte. */
- byte_delay_us = 10 * (1000000 / baudrate);
+ byte_delay_us = 10 * ((1000 * 1000) / baudrate);
start = g_get_monotonic_time();
i = ibuf = len = 0;
#include "../include/libsigrok/libsigrok.h"
#include "lib.h"
-#define BUFSIZE 1000000
+#define BUFSIZE (1000 * 1000)
enum {
CHECK_ALL_LOW,