sr_sw_limits_acquisition_start(&devc->limits);
std_session_send_df_header(sdi);
- /* Poll every 10ms, or whenever some data comes in. */
serial = sdi->conn;
serial_source_add(sdi->session, serial, G_IO_IN, 10,
agdmm_receive_data, (void *)sdi);
const struct agdmm_recv *recvs;
};
-/* Private, per-device-instance driver context. */
struct dev_context {
const struct agdmm_profile *profile;
struct sr_sw_limits limits;
int data_source;
- /* Runtime. */
const struct agdmm_job *jobs;
int current_job;
gboolean job_running;
std_session_send_df_header(sdi);
- /* Poll every 50ms, or whenever some data comes in. */
serial_source_add(sdi->session, serial, G_IO_IN, 50,
appa_55ii_receive_data, (void *)sdi);
DATA_SOURCE_MEMORY,
};
-/** Private, per-device-instance driver context. */
struct dev_context {
- /* Acquisition settings */
struct sr_sw_limits limits;
gboolean data_source; /**< Whether to read live samples or memory */
- /* Temporary state across callbacks */
uint8_t buf[APPA_55II_BUF_SIZE];
unsigned int buf_len;
uint8_t log_buf[64];
GVariantBuilder gvb;
if (!cg) {
- /* No channel group: global options. */
return STD_CONFIG_LIST(key, data, sdi, cg, scanopts, drvopts, devopts);
} else {
switch (key) {
return SR_ERR;
}
- /* Poll every 100ms, or whenever some data comes in. */
serial_source_add(sdi->session, serial, G_IO_IN, 100,
reloadpro_receive_data, (void *)sdi);
#define RELOADPRO_BUFSIZE 100
-/** Private, per-device-instance driver context. */
struct dev_context {
struct sr_sw_limits limits;
uint8_t buf[RELOADPRO_BUFSIZE];
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-/*
- * ASIX SIGMA/SIGMA2 logic analyzer driver
- */
-
#include <config.h>
#include "protocol.h"
ftdi_init(&devc->ftdic);
- /* Look for SIGMAs. */
-
if ((ret = ftdi_usb_find_all(&devc->ftdic, &devlist,
USB_VENDOR, USB_PRODUCT)) <= 0) {
if (ret < 0)
devc->capture_ratio = 50;
devc->use_triggers = 0;
- /* Register SIGMA device. */
sdi = g_malloc0(sizeof(struct sr_dev_inst));
sdi->status = SR_ST_INITIALIZING;
sdi->vendor = g_strdup(USB_VENDOR_NAME);
sdi->priv = devc;
- /* We will open the device again when we need it. */
ftdi_list_free(&devlist);
return std_scan_complete(di, g_slist_append(NULL, sdi));
return SR_OK;
}
-
/* Software trigger to determine exact trigger position. */
static int get_trigger_offset(uint8_t *samples, uint16_t last_sample,
struct sigma_trigger *t)
uint16_t lastsample;
};
-/* Private, per-device-instance driver context. */
struct dev_context {
struct ftdi_context ftdic;
uint64_t cur_samplerate;
devc = sdi->priv;
if (!cg) {
- /* No channel group: global options. */
switch (key) {
case SR_CONF_CHANNEL_CONFIG:
*data = g_variant_new_string(channel_modes[devc->channel_mode]);
ret = SR_OK;
devc = sdi->priv;
if (!cg) {
- /* No channel group: global options. */
switch (key) {
case SR_CONF_CHANNEL_CONFIG:
sval = g_variant_get_string(data, NULL);
return SR_ERR_NA;
}
} else {
- /* Channel group specified: per-channel options. */
/* We only ever have one channel per channel group in this driver. */
ch = cg->channels->data;
channel = ch->index;
devc = (sdi) ? sdi->priv : NULL;
if (!cg) {
- /* No channel group: global options. */
switch (key) {
case SR_CONF_SCAN_OPTIONS:
case SR_CONF_DEVICE_OPTIONS:
return SR_ERR_NA;
}
} else {
- /* Channel group specified: per-channel options. */
-
/* We only ever have one channel per channel group in this driver. */
ch = cg->channels->data;
channel = ch->index;
gboolean output_enabled_set;
};
-/** Private, per-device-instance driver context. */
struct dev_context {
- /* Model-specific information */
const struct pps_model *model;
- /* Acquisition state */
gboolean acquisition_running;
- /* Operational state */
gboolean config_dirty;
struct per_channel_config *config;
/* Blocking write timeout for packet. */
int channel_mode_set;
gboolean over_current_protection_set;
- /* Temporary state across callbacks */
uint8_t packet[PACKET_SIZE];
int packet_size;
PROBE_TEMP,
};
-/** Private, per-device-instance driver context. */
struct dev_context {
uint64_t samplerate;
struct sr_sw_limits limits;
#include "protocol.h"
#include "beaglelogic.h"
-/* Scan options */
static const uint32_t scanopts[] = {
SR_CONF_NUM_LOGIC_CHANNELS,
};
SR_CONF_LOGIC_ANALYZER,
};
-/* Hardware capabilities */
static const uint32_t devopts[] = {
SR_CONF_CONTINUOUS,
SR_CONF_LIMIT_SAMPLES | SR_CONF_GET | SR_CONF_SET,
SR_CONF_NUM_LOGIC_CHANNELS | SR_CONF_GET,
};
-/* Trigger matching capabilities */
static const int32_t soft_trigger_matches[] = {
SR_TRIGGER_ZERO,
SR_TRIGGER_ONE,
beaglelogic_set_sampleunit(devc);
beaglelogic_close(devc);
- /* Signal */
sr_info("BeagleLogic device found at "BEAGLELOGIC_DEV_NODE);
- /* Fill the channels */
for (i = 0; i < maxch; i++)
sr_channel_new(sdi, i, SR_CHANNEL_LOGIC, TRUE,
channel_names[i]);
#define SAMPLEUNIT_TO_BYTES(x) ((x) == 1 ? 1 : 2)
-/** Private, per-device-instance driver context. */
struct dev_context {
- /* Model-specific information */
int max_channels;
uint32_t fw_ver;
- /* Acquisition settings: see beaglelogic.h */
uint64_t cur_samplerate;
uint64_t limit_samples;
uint32_t sampleunit;
uint32_t bufunitsize;
uint32_t buffersize;
- /* Operational state */
int fd;
GPollFD pollfd;
int last_error;
if ((ret = sr_usb_open(drvc->sr_ctx->libusb_ctx, usb)) < 0)
return SR_ERR;
- /* Detach kernel drivers which grabbed this device (if any). */
if (libusb_kernel_driver_active(usb->devhdl, 0) == 1) {
ret = libusb_detach_kernel_driver(usb->devhdl, 0);
if (ret < 0) {
devc->detached_kernel_driver = 1;
}
- /* Claim interface 0. */
if ((ret = libusb_claim_interface(usb->devhdl, 0)) < 0) {
sr_err("Failed to claim interface 0: %s.",
libusb_error_name(ret));
#define LOG_PREFIX "brymen-bm86x"
-/** Private, per-device-instance driver context. */
struct dev_context {
- /* Acquisition settings */
struct sr_sw_limits sw_limits;
-
- /* Operational state */
- int detached_kernel_driver;/**< Whether kernel driver was detached or not */
-
- /* Temporary state across callbacks */
+ int detached_kernel_driver; /**< Whether kernel driver was detached or not */
int interrupt_pending;
};
if (!conn)
return NULL;
- if (serialcomm) {
- /* Use the provided comm specs. */
+ if (serialcomm)
devices = brymen_scan(di, conn, serialcomm);
- } else {
- /* But 9600/8n1 should work all of the time. */
+ else
devices = brymen_scan(di, conn, "9600/8n1/dtr=1/rts=1");
- }
return devices;
}
sr_sw_limits_acquisition_start(&devc->sw_limits);
std_session_send_df_header(sdi);
- /* Poll every 50ms, or whenever some data comes in. */
serial = sdi->conn;
serial_source_add(sdi->session, serial, G_IO_IN, 50,
brymen_dmm_receive_data, (void *)sdi);
PACKET_INVALID_HEADER,
};
-/** Private, per-device-instance driver context. */
struct dev_context {
struct sr_sw_limits sw_limits;
std_session_send_df_header(sdi);
- /* Poll every 100ms, or whenever some data comes in. */
serial = sdi->conn;
serial_source_add(sdi->session, serial, G_IO_IN, 150,
cem_dt_885x_receive_data, (void *)sdi);
DATA_SOURCE_MEMORY,
};
-/** Private, per-device-instance driver context. */
struct dev_context {
- /* Device state */
enum sr_mqflag cur_mqflags;
int recording;
int cur_meas_range;
int cur_data_source;
- /* Acquisition settings */
uint64_t limit_samples;
- /* Operational state */
int state;
uint64_t num_samples;
gboolean enable_data_source_memory;
- /* Temporary state across callbacks */
unsigned char cmd;
unsigned char token;
int buf_len;
if (!conn)
return NULL;
- if (serialcomm) {
- /* Use the provided comm specs. */
+ if (serialcomm)
devices = center_scan(conn, serialcomm, idx);
- } else {
- /* Try the default. */
+ else
devices = center_scan(conn, center_devs[idx].conn, idx);
- }
return std_scan_complete(center_devs[idx].di, devices);
}
std_session_send_df_header(sdi);
- /* Poll every 500ms, or whenever some data comes in. */
serial = sdi->conn;
serial_source_add(sdi->session, serial, G_IO_IN, 500,
center_devs[idx].receive_data, (void *)sdi);
#define SERIAL_BUFSIZE 256
-/** Private, per-device-instance driver context. */
struct dev_context {
struct sr_sw_limits sw_limits;
ret = SR_OK;
- /* Allocate memory for our private device context. */
devc = g_malloc0(sizeof(struct dev_context));
/* Set some sane defaults. */
/* We now know the device, set its max. samplerate as default. */
devc->cur_samplerate = devc->prof->max_samplerate;
- /* Register the device with libsigrok. */
sdi = g_malloc0(sizeof(struct sr_dev_inst));
sdi->status = SR_ST_INACTIVE;
sdi->vendor = g_strdup("ChronoVu");
devc = sdi->priv;
- /* Allocate memory for the FTDI context and initialize it. */
if (!(devc->ftdic = ftdi_new())) {
sr_err("Failed to initialize libftdi.");
return SR_ERR;
sr_dbg("Opening %s device (%04x:%04x).", devc->prof->modelname,
devc->usb_vid, devc->usb_pid);
- /* Open the device. */
if ((ret = ftdi_usb_open_desc(devc->ftdic, devc->usb_vid,
devc->usb_pid, devc->prof->iproduct, NULL)) < 0) {
sr_err("Failed to open FTDI device (%d): %s.",
goto err_ftdi_free;
}
- /* Purge RX/TX buffers in the FTDI chip. */
if ((ret = ftdi_usb_purge_buffers(devc->ftdic)) < 0) {
sr_err("Failed to purge FTDI buffers (%d): %s.",
ret, ftdi_get_error_string(devc->ftdic));
goto err_ftdi_free;
}
- /* Enable flow control in the FTDI chip. */
if ((ret = ftdi_setflowctrl(devc->ftdic, SIO_RTS_CTS_HS)) < 0) {
sr_err("Failed to enable FTDI flow control (%d): %s.",
ret, ftdi_get_error_string(devc->ftdic));
goto err_ftdi_free;
}
- /* Wait 100ms. */
g_usleep(100 * 1000);
return SR_OK;
struct cv_profile {
int model;
const char *modelname;
- const char *iproduct; /* USB iProduct string */
+ const char *iproduct;
unsigned int num_channels;
uint64_t max_samplerate;
const int num_trigger_matches;
float trigger_constant;
};
-/* Private, per-device-instance driver context. */
struct dev_context {
- /** Device profile struct for this device. */
const struct cv_profile *prof;
-
- /** FTDI device context (used by libftdi). */
struct ftdi_context *ftdic;
-
- /** The currently configured samplerate of the device. */
uint64_t cur_samplerate;
-
- /** The current sampling limit (in ms). */
uint64_t limit_msec;
-
- /** The current sampling limit (in number of samples). */
uint64_t limit_samples;
/**
uint64_t samplerates[255];
};
-/* protocol.c */
extern SR_PRIV const char *cv_channel_names[];
extern const struct cv_profile cv_profiles[];
SR_PRIV void cv_fill_samplerates_if_needed(const struct sr_dev_inst *sdi);
sr_sw_limits_acquisition_start(&devc->limits);
std_session_send_df_header(sdi);
- /* Poll every 150ms, or whenever some data comes in. */
serial = sdi->conn;
serial_source_add(sdi->session, serial, G_IO_IN, 150,
colead_slm_receive_data, (void *)sdi);
COMMAND_SENT,
};
-/** Private, per-device-instance driver context. */
struct dev_context {
struct sr_sw_limits limits;
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-/**
- * @file
- *
- * <em>Conrad DIGI 35 CPU</em> power supply driver
- *
- * @internal
- */
-
#include <config.h>
#include "protocol.h"
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-/**
- * @file
- * <em>Conrad DIGI 35 CPU</em> power supply driver
- * @internal
- */
-
#include <config.h>
#include "protocol.h"
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-/**
- * @file
- *
- * <em>Conrad DIGI 35 CPU</em> power supply driver
- *
- * @internal
- */
-
#ifndef LIBSIGROK_HARDWARE_CONRAD_DIGI_35_CPU_PROTOCOL_H
#define LIBSIGROK_HARDWARE_CONRAD_DIGI_35_CPU_PROTOCOL_H
/* Size of the analog pattern space per channel. */
#define ANALOG_BUFSIZE 4096
-/* Private, per-device-instance driver context. */
struct dev_context {
uint64_t cur_samplerate;
uint64_t limit_samples;
/* Analog patterns we can generate. */
enum {
- /**
- * Square wave.
- */
PATTERN_SQUARE,
PATTERN_SINE,
PATTERN_TRIANGLE,
SR_CONF_CLOCK_EDGE | SR_CONF_GET | SR_CONF_SET | SR_CONF_LIST,
};
-/* Names assigned to available edge slope choices. */
static const char *const signal_edge_names[] = {
[DS_EDGE_RISING] = "rising",
[DS_EDGE_FALLING] = "falling",
}
}
- /* Skip if the device was not found. */
if (!prof)
continue;
*/
int64_t fw_updated;
- /* Supported samplerates */
const uint64_t *samplerates;
int num_samplerates;
- /* Device/capture settings */
uint64_t cur_samplerate;
uint64_t limit_samples;
uint64_t capture_ratio;
- /* Operational settings */
gboolean acq_aborted;
unsigned int sent_samples;
sr_sw_limits_acquisition_start(&devc->limits);
std_session_send_df_header(sdi);
- /* Poll every 100ms, or whenever some data comes in. */
serial = sdi->conn;
serial_source_add(sdi->session, serial, G_IO_IN, 50,
fluke_receive_data, (void *)sdi);
int timeout;
};
-/* Private, per-device-instance driver context. */
struct dev_context {
const struct flukedmm_profile *profile;
struct sr_sw_limits limits;
- /* Runtime. */
char buf[FLUKEDMM_BUFSIZE];
int buflen;
int64_t cmd_sent_at;
return;
}
- /* Allocate memory for our private device context. */
devc = g_malloc0(sizeof(struct dev_context));
/* Allocate memory for the incoming data. */
}
sr_dbg("Found an FTDI device: %s.", model);
- /* Register the device with libsigrok. */
sdi = g_malloc0(sizeof(struct sr_dev_inst));
sdi->status = SR_ST_INACTIVE;
sdi->vendor = vendor;
}
}
- /* Allocate memory for the FTDI context (ftdic) and initialize it. */
ftdic = ftdi_new();
if (!ftdic) {
sr_err("Failed to initialize libftdi.");
goto err_ftdi_free;
}
- /* Purge RX/TX buffers in the FTDI chip. */
ret = ftdi_usb_purge_buffers(devc->ftdic);
if (ret < 0) {
sr_err("Failed to purge FTDI RX/TX buffers (%d): %s.",
goto err_dev_open_close_ftdic;
}
- /* Reset the FTDI bitmode. */
ret = ftdi_set_bitmode(devc->ftdic, 0x00, BITMODE_RESET);
if (ret < 0) {
sr_err("Failed to reset the FTDI chip bitmode (%d): %s.",
char *channel_names[];
};
-/** Private, per-device-instance driver context. */
struct dev_context {
struct ftdi_context *ftdic;
const struct ftdi_chip_desc *desc;
}
}
- /* Skip if the device was not found. */
if (!prof)
continue;
*/
int64_t fw_updated;
- /* Supported samplerates */
const uint64_t *samplerates;
int num_samplerates;
- /* Device/capture settings */
uint64_t cur_samplerate;
uint64_t limit_samples;
uint64_t capture_ratio;
- /* Operational settings */
gboolean trigger_fired;
gboolean acq_aborted;
gboolean sample_wide;
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-/**
- * @file
- *
- * Gossen Metrawatt Metrahit 1x/2x drivers
- *
- * @internal
- */
-
#include <config.h>
#include <string.h>
#include "protocol.h"
sr_sw_limits_acquisition_start(&devc->limits);
std_session_send_df_header(sdi);
- /* Poll every 40ms, or whenever some data comes in. */
serial = sdi->conn;
serial_source_add(sdi->session, serial, G_IO_IN, 40,
gmc_mh_1x_2x_receive_data, (void *)sdi);
sr_sw_limits_acquisition_start(&devc->limits);
std_session_send_df_header(sdi);
- /* Poll every 40ms, or whenever some data comes in. */
serial = sdi->conn;
serial_source_add(sdi->session, serial, G_IO_IN, 40,
gmc_mh_2x_receive_data, (void *)sdi);
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-/**
- * @file
- *
- * Gossen Metrawatt Metrahit 1x/2x drivers
- *
- * @internal
- */
-
#include <config.h>
#include <math.h>
#include <string.h>
#include "protocol.h"
-/* Internal Headers */
static guchar calc_chksum_14(guchar *dta);
static int chk_msg14(struct sr_dev_inst *sdi);
}
}
-/** Request one measurement from 2x multimeter (msg 8).
- *
- */
+/** Request one measurement from 2x multimeter (msg 8). */
int req_meas14(const struct sr_dev_inst *sdi)
{
struct dev_context *devc;
return SR_OK;
}
-/** Decode model in "send mode".
+/**
+ * Decode model in "send mode".
*
* @param[in] mcode Model code.
* @return Model code.
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-/**
- * @file
- *
- * Gossen Metrawatt Metrahit 1x/2x drivers
- *
- * @internal
- */
-
#ifndef LIBSIGROK_HARDWARE_GMC_MH_1X_2X_PROTOCOL_H
#define LIBSIGROK_HARDWARE_GMC_MH_1X_2X_PROTOCOL_H
METRAHIT_29S = METRAHIT_28S + 1,
};
-/** Private, per-device-instance driver context. */
struct dev_context {
- /* Model-specific information */
enum model model; /**< Model code. */
- /* Acquisition settings */
struct sr_sw_limits limits;
- /* Operational state */
gboolean settings_ok; /**< Settings msg received yet. */
int msg_type; /**< Message type (MSGID_INF, ...). */
int msg_len; /**< Message length (valid when msg, curr. type known).*/
int64_t req_sent_at; /**< Request sent. */
gboolean response_pending; /**< Request sent, response is pending. */
- /* Temporary state across callbacks */
uint8_t buf[GMC_BUFSIZE]; /**< Buffer for read callback */
int buflen; /**< Data len in buf */
};
-/* 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 int gmc_decode_model_bd(uint8_t mcode);
WAIT_FOR_TRANSFER_OF_CHANNEL_DATA_COMPLETE,
};
-/** Private, per-device-instance driver context. */
struct dev_context {
enum gds_state state;
uint64_t cur_acq_frame;
uint64_t sample_rate;
};
-/** Private, per-device-instance driver context. */
struct dev_context {
const void *model_config;
void *model_state;
static int set_mq_volt(struct sr_scpi_dev_inst *scpi, enum sr_mqflag flags);
static int set_mq_amp(struct sr_scpi_dev_inst *scpi, enum sr_mqflag flags);
static int set_mq_ohm(struct sr_scpi_dev_inst *scpi, enum sr_mqflag flags);
+
/*
* The source for the frequency measurement can be either AC voltage, AC+DC
* voltage, AC current, or AC+DC current. Configuring this is not yet
CONN_REAR,
};
-/** Private, per-device-instance driver context. */
struct dev_context {
- /* Model-specific information */
/* Information about rear card option, or NULL if unknown */
const struct rear_card_info *rear_card;
- /* Acquisition settings */
enum sr_mq measurement_mq;
enum sr_mqflag measurement_mq_flags;
enum sr_unit measurement_unit;
unsigned int num_active_channels;
struct sr_channel *current_channel;
- /* Operational state */
enum acquisition_state acq_state;
enum channel_conn input_loc;
uint64_t num_samples;
#define MAX_RETRIES 4
#define NUM_CHANNELS 2
-/** Private, per-device-instance driver context. */
struct dev_context {
- /* Acquisition settings */
GSList *enabled_channel;
uint8_t channel;
uint8_t rate;
uint8_t offset[2];
uint8_t gain[2];
- /* Operational state */
uint64_t frame_limit;
uint64_t frame;
uint64_t probe[2];
uint8_t retries;
gboolean adc2;
- /* Temporary state across callbacks */
float *samples;
float factor;
gboolean state_known;
if (sr_usb_open(drvc->sr_ctx->libusb_ctx, usb) != SR_OK)
return SR_ERR;
- /*
- * Determine if a kernel driver is active on this interface and, if so,
- * detach it.
- */
if (libusb_kernel_driver_active(usb->devhdl, USB_INTERFACE) == 1) {
ret = libusb_detach_kernel_driver(usb->devhdl, USB_INTERFACE);
if (ret < 0) {
if (sr_usb_open(drvc->sr_ctx->libusb_ctx, &usb) != SR_OK)
return SR_ERR;
- /*
- * Determine if a kernel driver is active on this interface and, if so,
- * detach it.
- */
if (libusb_kernel_driver_active(usb.devhdl, USB_INTERFACE) == 1) {
ret = libusb_detach_kernel_driver(usb.devhdl,
USB_INTERFACE);
STATE_WAIT_DEVICE_READY
};
-/** Private, per-device-instance driver context. */
struct dev_context {
/* Current selected samplerate. */
uint64_t samplerate;
SR_CONF_SAMPLERATE | SR_CONF_GET | SR_CONF_SET | SR_CONF_LIST,
};
-/* Channels are numbered 1-9. */
static const char *channel_names[] = {
"1", "2", "3", "4", "5", "6", "7", "8", "9",
};
(void)options;
- /* Allocate memory for our private device context. */
devc = g_malloc0(sizeof(struct dev_context));
/* Allocate memory for the incoming compressed samples. */
goto err_free_compressed_buf;
}
- /* Allocate memory for the FTDI context (ftdic) and initialize it. */
if (!(devc->ftdic = ftdi_new())) {
sr_err("Failed to initialize libftdi.");
goto err_free_sample_buf;
}
- /* Check for the device and temporarily open it. */
ret = ftdi_usb_open_desc(devc->ftdic, USB_VENDOR_ID, USB_DEVICE_ID,
USB_IPRODUCT, NULL);
if (ret < 0) {
goto err_free_ftdic;
}
- /* Register the device with libsigrok. */
sdi = g_malloc0(sizeof(struct sr_dev_inst));
sdi->status = SR_ST_INACTIVE;
sdi->vendor = g_strdup(USB_VENDOR_NAME);
for (i = 0; i < ARRAY_SIZE(channel_names); i++)
sr_channel_new(sdi, i, SR_CHANNEL_LOGIC, TRUE, channel_names[i]);
- /* Close device. We'll reopen it again when we need it. */
scanaplus_close(devc);
return std_scan_complete(di, g_slist_append(NULL, sdi));
scanaplus_close(devc);
err_free_ftdic:
- ftdi_free(devc->ftdic); /* NOT free() or g_free()! */
+ ftdi_free(devc->ftdic);
err_free_sample_buf:
g_free(devc->sample_buf);
err_free_compressed_buf:
devc = sdi->priv;
- /* Select interface A, otherwise communication will fail. */
ret = ftdi_set_interface(devc->ftdic, INTERFACE_A);
if (ret < 0) {
sr_err("Failed to set FTDI interface A (%d): %s", ret,
return SR_ERR;
}
- /* Open the device. */
ret = ftdi_usb_open_desc(devc->ftdic, USB_VENDOR_ID, USB_DEVICE_ID,
USB_IPRODUCT, NULL);
if (ret < 0) {
return SR_ERR;
}
- /* Purge RX/TX buffers in the FTDI chip. */
if ((ret = ftdi_usb_purge_buffers(devc->ftdic)) < 0) {
sr_err("Failed to purge FTDI RX/TX buffers (%d): %s.",
ret, ftdi_get_error_string(devc->ftdic));
goto err_dev_open_close_ftdic;
}
- /* Reset the FTDI bitmode. */
ret = ftdi_set_bitmode(devc->ftdic, 0xff, BITMODE_RESET);
if (ret < 0) {
sr_err("Failed to reset the FTDI chip bitmode (%d): %s.",
goto err_dev_open_close_ftdic;
}
- /* Set FTDI bitmode to "sync FIFO". */
ret = ftdi_set_bitmode(devc->ftdic, 0xff, BITMODE_SYNCFF);
if (ret < 0) {
sr_err("Failed to put FTDI chip into sync FIFO mode (%d): %s.",
goto err_dev_open_close_ftdic;
}
- /* Set the FTDI latency timer to 2. */
ret = ftdi_set_latency_timer(devc->ftdic, 2);
if (ret < 0) {
sr_err("Failed to set FTDI latency timer (%d): %s.",
goto err_dev_open_close_ftdic;
}
- /* Set the FTDI read data chunk size to 64kB. */
ret = ftdi_read_data_set_chunksize(devc->ftdic, 64 * 1024);
if (ret < 0) {
sr_err("Failed to set FTDI read data chunk size (%d): %s.",
#define COMPRESSED_BUF_SIZE (64 * 1024)
-/* Private, per-device-instance driver context. */
struct dev_context {
- /** FTDI device context (used by libftdi). */
struct ftdi_context *ftdic;
-
- /** The current sampling limit (in ms). */
uint64_t limit_msec;
-
- /** The current sampling limit (in number of samples). */
uint64_t limit_samples;
uint8_t *compressed_buf;
#include <config.h>
#include <string.h>
#include "protocol.h"
+
extern const uint64_t kecheng_kc_330b_sample_intervals[][2];
SR_PRIV int kecheng_kc_330b_handle_events(int fd, int revents, void *cb_data)
DEVICE_INACTIVE,
};
-/** Private, per-device-instance driver context. */
struct dev_context {
- /* Acquisition settings */
uint64_t limit_samples;
int sample_interval;
int alarm_low;
enum sr_mqflag mqflags;
int data_source;
- /* Operational state */
int state;
gboolean config_dirty;
uint64_t num_samples;
struct libusb_transfer *xfer;
unsigned char buf[128];
- /* Temporary state across callbacks */
gint64 last_live_request;
-
};
SR_PRIV int kecheng_kc_330b_handle_events(int fd, int revents, void *cb_data);
sr_sw_limits_acquisition_start(&devc->limits);
std_session_send_df_header(sdi);
- /* Poll every 50ms, or whenever some data comes in. */
serial_source_add(sdi->session, serial, G_IO_IN, 50,
kern_scale_receive_data, (void *)sdi);
#define SCALE_BUFSIZE 256
-/** Private, per-device-instance driver context. */
struct dev_context {
struct sr_sw_limits limits;
};
static const uint32_t drvopts[] = {
- /* Device class */
SR_CONF_POWER_SUPPLY,
};
static const uint32_t devopts[] = {
- /* Device class */
- /* Acquisition modes. */
SR_CONF_CONTINUOUS,
SR_CONF_LIMIT_SAMPLES | SR_CONF_GET | SR_CONF_SET,
SR_CONF_LIMIT_MSEC | SR_CONF_GET | SR_CONF_SET,
- /* Device configuration */
SR_CONF_VOLTAGE | SR_CONF_GET,
SR_CONF_VOLTAGE_TARGET | SR_CONF_GET | SR_CONF_SET | SR_CONF_LIST,
SR_CONF_CURRENT | SR_CONF_GET,
sr_dbg("Found: %s %s (idx %d, ID '%s').", models[model_id].vendor,
models[model_id].name, model_id, models[model_id].id);
- /* Init device instance, etc. */
sdi = g_malloc0(sizeof(struct sr_dev_inst));
sdi->status = SR_ST_INACTIVE;
sdi->vendor = g_strdup(models[model_id].vendor);
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-/**
- * @file
- * Korad KAxxxxP power supply driver
- * @internal
- */
-
#ifndef LIBSIGROK_HARDWARE_KORAD_KAXXXXP_PROTOCOL_H
#define LIBSIGROK_HARDWARE_KORAD_KAXXXXP_PROTOCOL_H
KAXXXXP_RECALL,
};
-/** Private, per-device-instance driver context. */
struct dev_context {
- /* Model-specific information */
const struct korad_kaxxxxp_model *model; /**< Model information. */
- /* Acquisition settings */
struct sr_sw_limits limits;
int64_t req_sent_at;
gboolean reply_pending;
- /* Operational state */
float current; /**< Last current value [A] read from device. */
float current_max; /**< Output current set. */
float voltage; /**< Last voltage value [V] read from device. */
gboolean ocp_enabled; /**< Output current protection enabled. */
gboolean ovp_enabled; /**< Output voltage protection enabled. */
- /* Temporary state across callbacks */
int target; /**< What reply to expect. */
int program; /**< Program to store or recall. */
char reply[6];
#define SLEEP_US_LONG (5 * 1000)
#define SLEEP_US_SHORT (1 * 1000)
-/** Private, per-device-instance driver context. */
struct dev_context {
const struct elusb_profile *profile;
+
/* Generic EL-USB */
unsigned char config[MAX_CONFIGBLOCK_SIZE];
unsigned int log_size;
unsigned int logged_samples;
unsigned int rcvd_samples;
uint64_t limit_samples;
+
/* Model-specific */
/* EL-USB-CO: these are something like scaling and calibration values
* fixed per device, used to convert the sample values to CO ppm. */
struct samplerate_info;
-/** Private, per-device-instance driver context. */
struct dev_context {
struct libusb_transfer *intr_xfer;
struct libusb_transfer *bulk_xfer;
devc = sdi->priv;
scpi = sdi->conn;
+
/* Preset empty results. */
g_slist_free(devc->enabled_channels);
devc->enabled_channels = NULL;
uint64_t sample_rate;
};
-/** Private, per-device-instance driver context. */
struct dev_context {
const void *model_config;
void *model_state;
return SR_OK;
}
-/* This stops acquisition on ALL devices, ignoring dev_index. */
static int dev_acquisition_stop(struct sr_dev_inst *sdi)
{
stop_acquisition(sdi);
uint8_t spimode;
};
-/* Private, per-device-instance driver context. */
struct dev_context {
/* info */
uint8_t hwmodel;
uint16_t offset_range;
uint64_t limit_samples;
uint64_t num_samples;
+
/* register cache */
uint8_t ctlbase1;
uint8_t ctlbase2;
- /* state */
+
uint8_t la_threshold;
uint64_t cur_rate;
uint8_t dso_probe_attn;
* along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
-/**
- * @file
- *
- * <em>Manson HCS-3xxx series</em> power supply driver
- *
- * @internal
- */
-
#include <config.h>
#include "protocol.h"
};
static const uint32_t drvopts[] = {
- /* Device class */
SR_CONF_POWER_SUPPLY,
};
static const uint32_t devopts[] = {
- /* Device class */
- /* Acquisition modes. */
SR_CONF_CONTINUOUS,
SR_CONF_LIMIT_SAMPLES | SR_CONF_GET | SR_CONF_SET,
SR_CONF_LIMIT_MSEC | SR_CONF_GET | SR_CONF_SET,
- /* Device configuration */
SR_CONF_VOLTAGE | SR_CONF_GET,
SR_CONF_VOLTAGE_TARGET | SR_CONF_GET | SR_CONF_SET | SR_CONF_LIST,
SR_CONF_CURRENT | SR_CONF_GET,
}
g_strfreev(tokens);
- /* Init device instance, etc. */
sdi = g_malloc0(sizeof(struct sr_dev_inst));
sdi->status = SR_ST_INACTIVE;
sdi->vendor = g_strdup("Manson");
devc->reply_pending = FALSE;
devc->req_sent_at = 0;
- /* Poll every 10ms, or whenever some data comes in. */
serial = sdi->conn;
serial_source_add(sdi->session, serial, G_IO_IN, 10,
hcs_receive_data, (void *)sdi);
* along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
-/**
- * @file
- *
- * <em>Manson HCS-3xxx Series</em> power supply driver
- *
- * @internal
- */
-
#include <config.h>
#include "protocol.h"
* along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
-/**
- * @file
- *
- * <em>Manson HCS-3xxx Series</em> power supply driver
- *
- * @internal
- */
-
#ifndef LIBSIGROK_HARDWARE_MANSON_HCS_3XXX_PROTOCOL_H
#define LIBSIGROK_HARDWARE_MANSON_HCS_3XXX_PROTOCOL_H
double current[3]; /**< Min, max, step */
};
-/** Private, per-device-instance driver context. */
struct dev_context {
const struct hcs_model *model; /**< Model information. */
devc = (sdi) ? sdi->priv : NULL;
if (!cg) {
- /* No channel group: global options. */
return STD_CONFIG_LIST(key, data, sdi, cg, scanopts, drvopts, devopts);
} else {
switch (key) {
unsigned int max_power;
};
-/** Private, per-device-instance driver context. */
struct dev_context {
- /* Model-specific information */
const struct maynuo_m97_model *model;
-
- /* Acquisition settings */
struct sr_sw_limits limits;
-
- /* Operational state */
int expecting_registers;
};
if (!conn)
return NULL;
- if (serialcomm) {
- /* Use the provided comm specs. */
+ if (serialcomm)
devices = mic_scan(conn, serialcomm, idx);
- } else {
- /* Try the default. */
+ else
devices = mic_scan(conn, mic_devs[idx].conn, idx);
- }
return devices;
}
sr_sw_limits_acquisition_start(&devc->limits);
std_session_send_df_header(sdi);
- /* Poll every 100ms, or whenever some data comes in. */
serial = sdi->conn;
serial_source_add(sdi->session, serial, G_IO_IN, 100,
mic_devs[idx].receive_data, (void *)sdi);
#define SERIAL_BUFSIZE 256
-/** Private, per-device-instance driver context. */
struct dev_context {
struct sr_sw_limits limits;
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-/**
- * @file
- *
- * <em>Motech LPS-30x series</em> power supply driver
- *
- * @internal
- */
-
#include <config.h>
#include <ctype.h>
#include <math.h>
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"
#define VENDOR_MOTECH "Motech"
-/** Driver scanning options. */
static const uint32_t scanopts[] = {
SR_CONF_CONN,
SR_CONF_SERIALCOMM,
};
-/** Driver capabilities generic. */
static const uint32_t drvopts[] = {
- /* Device class */
SR_CONF_POWER_SUPPLY,
};
-/** Hardware capabilities generic. */
static const uint32_t devopts[] = {
- /* Device class */
- /* Acquisition modes. */
SR_CONF_CONTINUOUS,
SR_CONF_LIMIT_SAMPLES | SR_CONF_GET | SR_CONF_SET,
SR_CONF_LIMIT_MSEC | SR_CONF_GET | SR_CONF_SET,
- /* Device configuration */
SR_CONF_CHANNEL_CONFIG | SR_CONF_GET | SR_CONF_SET | SR_CONF_LIST,
};
SR_CONF_ENABLED | SR_CONF_GET | SR_CONF_SET,
};
-/** Hardware capabilities channel 3. (LPS-304/305 only). */
+/** Hardware capabilities channel 3 (LPS-304/305 only). */
static const uint32_t devopts_ch3[] = {
SR_CONF_VOLTAGE | SR_CONF_GET,
SR_CONF_ENABLED | SR_CONF_GET | SR_CONF_SET,
},
};
-/** 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)
{
int retc;
return SR_OK;
}
-/** Send command to device.
- */
+/** Send command to device. */
SR_PRIV int lps_send_req(struct sr_serial_dev_inst *serial, const char *fmt, ...)
{
int retc;
return SR_ERR; /* Timeout! */
}
-/** Scan for LPS-300 series device.
- */
+/** Scan for LPS-300 series device. */
static GSList *do_scan(lps_modelid modelid, struct sr_dev_driver *drv, GSList *options)
{
struct sr_dev_inst *sdi;
devc = sdi->priv;
if (!cg) {
- /* No channel group: global options. */
switch (key) {
case SR_CONF_LIMIT_SAMPLES:
case SR_CONF_LIMIT_MSEC:
/* We only ever have one channel per channel group in this driver. */
ch = cg->channels->data;
ch_idx = ch->index;
+
switch (key) {
case SR_CONF_VOLTAGE:
*data = g_variant_new_double(devc->channel_status[ch_idx].output_voltage_last);
return SR_ERR_NA;
if (!cg) {
- /* No channel group: global options. */
switch (key) {
case SR_CONF_LIMIT_MSEC:
case SR_CONF_LIMIT_SAMPLES:
return SR_ERR_NA;
}
} else {
- /* Channel group specified: per-channel options. */
/* We only ever have one channel per channel group in this driver. */
ch = cg->channels->data;
ch_idx = ch->index;
devc = (sdi) ? sdi->priv : NULL;
- /* Device options, independent from channel groups. */
if (!cg) {
switch (key) {
case SR_CONF_SCAN_OPTIONS:
}
}
- /* Device options, depending on channel groups. */
+ /* We only ever have one channel per channel group in this driver. */
ch = cg->channels->data;
ch_idx = ch->index;
+
switch (key) {
case SR_CONF_DEVICE_OPTIONS:
if ((ch_idx == 0) || (ch_idx == 1)) /* CH1, CH2 */
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-/**
- * @file
- *
- * <em>Motech LPS-30x series</em> power supply driver
- *
- * @internal
- */
-
#include <config.h>
#include <errno.h>
#include <string.h>
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-/**
- * @file
- *
- * <em>Motech LPS-30x series</em> power supply driver
- *
- * @internal
- */
-
#ifndef LIBSIGROK_HARDWARE_MOTECH_LPS_30X_PROTOCOL_H
#define LIBSIGROK_HARDWARE_MOTECH_LPS_30X_PROTOCOL_H
gdouble output_current_max;
};
-/** Private, per-device-instance driver context. */
struct dev_context {
- /* Model-specific information */
const struct lps_modelspec *model;
- /* Acquisition status */
gboolean acq_running; /**< Acquisition is running. */
struct sr_sw_limits limits;
acquisition_req acq_req; /**< Current request. */
uint8_t acq_req_pending; /**< Request pending. 0=none, 1=reply, 2=OK */
- /* Operational state */
struct channel_status channel_status[MAX_CHANNELS];
guint8 tracking_mode; /**< 0=off, 1=Tracking from CH1, 2=Tracking from CH2. */
- /* Temporary state across callbacks */
int64_t req_sent_at; /**< Request sent. */
gchar buf[LINELEN_MAX]; /**< Buffer for read callback */
int buflen; /**< Data len in buf */
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-/** @file
- * Norma DM9x0/Siemens B102x DMMs driver.
- * @internal
- */
-
#include <config.h>
#include "protocol.h"
sr_sw_limits_acquisition_start(&devc->limits);
std_session_send_df_header(sdi);
- /* Poll every 100ms, or whenever some data comes in. */
serial = sdi->conn;
serial_source_add(sdi->session, serial, G_IO_IN, 100,
norma_dmm_receive_data, (void *)sdi);
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-/**
- * @file
- *
- * Norma DM9x0/Siemens B102x DMMs driver.
- *
- * @internal
- */
-
#include <config.h>
#include "protocol.h"
#include <libsigrok/libsigrok.h>
#include "libsigrok-internal.h"
-/**
- * @file
- *
- * Norma DM9x0/Siemens B102x DMMs driver.
- *
- * @internal
- */
-
#define LOG_PREFIX "norma-dmm"
#define NMADMM_BUFSIZE 256
/** Strings for requests. */
extern const struct nmadmm_req nmadmm_requests[];
-/** Private, per-device-instance driver context. */
struct dev_context {
- /* Model-specific information */
int type; /**< DM9x0, e.g. 5 = DM950 */
- /* Acquisition settings */
struct sr_sw_limits limits;
- /* Operational state */
int last_req; /**< Last request. */
int64_t req_sent_at; /**< Request sent. */
gboolean last_req_pending; /**< Last request not answered yet. */
int lowbatt; /**< Low battery. 1=low, 2=critical. */
- /* Temporary state across callbacks */
uint8_t buf[NMADMM_BUFSIZE]; /**< Buffer for read callback */
int buflen; /**< Data len in buf */
};
#define FLAG_FILTER (1 << 1)
#define FLAG_DEMUX (1 << 0)
-/* Private, per-device-instance driver context. */
struct dev_context {
- /* Fixed device settings */
int max_channels;
uint32_t max_samples;
uint32_t max_samplerate;
uint32_t protocol_version;
- /* Acquisition settings */
uint64_t cur_samplerate;
uint32_t cur_samplerate_divider;
uint64_t limit_samples;
int num_stages;
uint16_t flag_reg;
- /* Operational states */
unsigned int num_transfers;
unsigned int num_samples;
int num_bytes;
int cnt_samples;
int cnt_samples_rle;
- /* Temporary variables */
unsigned int rle_count;
unsigned char sample[4];
unsigned char tmp_sample[4];
std_session_send_df_header(sdi);
- /* Poll every 150ms, or whenever some data comes in. */
serial = sdi->conn;
serial_source_add(sdi->session, serial, G_IO_IN, 150,
pce_322a_receive_data, (void *)sdi);
MEM_STATE_GET_MEMORY_BLOCK,
};
-/** Private, per-device-instance driver context. */
struct dev_context {
- /* Model-specific information */
uint64_t cur_mqflags;
uint8_t cur_meas_range;
- /* Acquisition settings */
uint8_t cur_data_source;
uint64_t limit_samples;
- /* Operational state */
uint64_t num_samples;
/* Memory reading state */
uint16_t memory_block_counter; /* Number of memory blocks retrieved so far. */
uint8_t memory_block_cursor; /* Number of bytes retrieved in current memory block. */
- /* Temporary state across callbacks. */
uint8_t buffer[BUFFER_SIZE];
int buffer_len;
int buffer_skip; /* Number of bytes to skip in memory mode. */
devices = NULL;
- /* Allocate memory for our private device context. */
devc = g_malloc0(sizeof(struct dev_context));
- /* Device-specific settings */
devc->max_samplebytes = devc->max_samplerate = devc->protocol_version = 0;
- /* Acquisition settings */
devc->limit_samples = devc->capture_ratio = 0;
devc->trigger_at = -1;
devc->channel_mask = 0xffffffff;
devc->flag_reg = 0;
- /* Allocate memory for the incoming ftdi data. */
devc->ftdi_buf = g_malloc0(FTDI_BUF_SIZE);
- /* Allocate memory for the FTDI context (ftdic) and initialize it. */
if (!(devc->ftdic = ftdi_new())) {
sr_err("Failed to initialize libftdi.");
goto err_free_ftdi_buf;;
}
- /* Try to open the FTDI device */
- if (p_ols_open(devc) != SR_OK) {
+ if (p_ols_open(devc) != SR_OK)
goto err_free_ftdic;
- }
/* The discovery procedure is like this: first send the Reset
* command (0x00) 5 times, since the device could be anywhere
goto err_close_ftdic;
}
- /* Close device. We'll reopen it again when we need it. */
p_ols_close(devc);
/* Parse the metadata. */
err_close_ftdic:
p_ols_close(devc);
err_free_ftdic:
- ftdi_free(devc->ftdic); /* NOT free() or g_free()! */
+ ftdi_free(devc->ftdic);
err_free_ftdi_buf:
g_free(devc->ftdi_buf);
g_free(devc);
/* Note: Caller checks devc and devc->ftdic. */
- /* Select interface B, otherwise communication will fail. */
ret = ftdi_set_interface(devc->ftdic, INTERFACE_B);
if (ret < 0) {
sr_err("Failed to set FTDI interface B (%d): %s", ret,
return SR_ERR;
}
- /* Check for the device and temporarily open it. */
ret = ftdi_usb_open_desc(devc->ftdic, USB_VENDOR_ID, USB_DEVICE_ID,
USB_IPRODUCT, NULL);
if (ret < 0) {
return SR_ERR;
}
- /* Purge RX/TX buffers in the FTDI chip. */
if ((ret = ftdi_usb_purge_buffers(devc->ftdic)) < 0) {
sr_err("Failed to purge FTDI RX/TX buffers (%d): %s.",
ret, ftdi_get_error_string(devc->ftdic));
goto err_open_close_ftdic;
}
- /* Reset the FTDI bitmode. */
ret = ftdi_set_bitmode(devc->ftdic, 0xff, BITMODE_RESET);
if (ret < 0) {
sr_err("Failed to reset the FTDI chip bitmode (%d): %s.",
goto err_open_close_ftdic;
}
- /* Set the FTDI latency timer to 16. */
ret = ftdi_set_latency_timer(devc->ftdic, 16);
if (ret < 0) {
sr_err("Failed to set FTDI latency timer (%d): %s.",
goto err_open_close_ftdic;
}
- /* Set the FTDI read data chunk size to 64kB. */
ret = ftdi_read_data_set_chunksize(devc->ftdic, 64 * 1024);
if (ret < 0) {
sr_err("Failed to set FTDI read data chunk size (%d): %s.",
#define FLAG_FILTER (1 << 1)
#define FLAG_DEMUX (1 << 0)
-/* Private, per-device-instance driver context. */
struct dev_context {
- /** FTDI device context (used by libftdi). */
struct ftdi_context *ftdic;
uint8_t *ftdi_buf;
- /* Fixed device settings */
int max_channels;
uint32_t max_samplebytes;
uint32_t max_samplerate;
uint32_t protocol_version;
- /* Acquisition settings */
uint64_t cur_samplerate;
uint32_t cur_samplerate_divider;
uint32_t max_samples;
int num_stages;
uint16_t flag_reg;
- /* Operational states */
unsigned int num_transfers;
unsigned int num_samples;
int num_bytes;
unsigned int cnt_samples;
int cnt_samples_rle;
- /* Temporary variables */
unsigned int rle_count;
unsigned char sample[4];
unsigned char tmp_sample[4];
WAIT_STOP, /* Wait for scope stopping (only single shots) */
};
-/** Private, per-device-instance driver context. */
struct dev_context {
- /* Device model */
const struct rigol_ds_model *model;
enum data_format format;
float trigger_level;
char *coupling[MAX_ANALOG_CHANNELS];
- /* Operational state */
-
/* Number of frames received in total. */
uint64_t num_frames;
/* GSList entry for the current channel. */
double power_min;
};
-/** Private, per-device-instance driver context. */
struct dev_context {
- /* Model-specific information */
const struct rs_device_model *model_config;
};
*/
#define CONV_BUFFER_SIZE (2 * 8 * 16384 + CONV_BATCH_SIZE)
-/** Private, per-device-instance driver context. */
struct dev_context {
- /* Acquisition settings */
unsigned int dig_channel_cnt;
uint16_t dig_channel_mask;
uint16_t dig_channel_masks[16];
uint64_t dig_samplerate;
- /* Operational state */
uint32_t lfsr;
- /* Temporary state across callbacks */
unsigned int num_transfers;
unsigned int submitted_transfers;
struct libusb_transfer **transfers;
- /* Conversion buffer */
uint8_t *conv_buffer;
unsigned int conv_size;
unsigned int batch_index;
FPGA_VARIANT_MCUPRO /* mcupro clone v4.6 with Actel FPGA */
};
-/** Private, per-device-instance driver context. */
struct dev_context {
/** Distinguishing between original Logic16 and clones */
enum fpga_variant fpga_variant;
return SR_ERR_ARG;
if (cg)
- /* Channel group specified. */
select_channel(sdi, cg->channels->data);
devc = sdi->priv;
devc = (sdi) ? sdi->priv : NULL;
if (!cg) {
- /* No channel group: global options. */
switch (key) {
case SR_CONF_SCAN_OPTIONS:
case SR_CONF_DEVICE_OPTIONS:
return SR_ERR_NA;
}
} else {
- /* Channel group specified. */
/*
* Per-channel-group options depending on a channel are actually
* done with the first channel. Channel groups in PPS can have
};
/* Chroma 62000 series DC source */
-
static const uint32_t chroma_62000_devopts[] = {
SR_CONF_CONTINUOUS,
};
};
/* HP 663xx series */
-
static const uint32_t hp_6630a_devopts[] = {
SR_CONF_CONTINUOUS,
SR_CONF_ENABLED | SR_CONF_SET,
agilent_n5700a_cmd,
.probe_channels = NULL,
},
+
/* Agilent N5767A */
{ "Agilent", "N5767A", 0,
ARRAY_AND_SIZE(agilent_n5700a_devopts),
agilent_n5700a_cmd,
.probe_channels = NULL,
},
+
/* Chroma 61604 */
{ "Chroma", "61604", 0,
ARRAY_AND_SIZE(chroma_61604_devopts),
chroma_61604_cmd,
.probe_channels = NULL,
},
+
/* Chroma 62000 series */
{ "Chroma", "620[0-9]{2}P-[0-9]{2,3}-[0-9]{1,3}", 0,
ARRAY_AND_SIZE(chroma_62000_devopts),
chroma_62000_cmd,
.probe_channels = chroma_62000p_probe_channels,
},
+
/* HP 6633A */
{ "HP", "6633A", 0,
ARRAY_AND_SIZE(hp_6630a_devopts),
STATE_STOP,
};
-/** Private, per-device-instance driver context. */
struct dev_context {
- /* Model-specific information */
const struct scpi_pps *device;
- /* Operational state */
gboolean beeper_was_set;
struct channel_spec *channels;
struct channel_group_spec *channel_groups;
- /* Temporary state across callbacks */
struct sr_channel *cur_channel;
};
sr_sw_limits_acquisition_start(&devc->limits);
std_session_send_df_header(sdi);
- /* Poll every 50ms, or whenever some data comes in. */
serial = sdi->conn;
serial_source_add(sdi->session, serial, G_IO_IN, 50,
receive_data, (void *)sdi);
#define DMM_BUFSIZE 256
-/** Private, per-device-instance driver context. */
struct dev_context {
struct sr_sw_limits limits;
#include <libsigrok-internal.h>
#include "protocol.h"
-/* Supported device scan options.
- */
static const uint32_t scanopts[] = {
SR_CONF_CONN,
};
-/* Driver capabilities.
- */
static const uint32_t drvopts[] = {
SR_CONF_LOGIC_ANALYZER,
};
-/* Supported trigger match conditions.
- */
static const int32_t trigger_matches[] = {
SR_TRIGGER_ZERO,
SR_TRIGGER_ONE,
SR_TRIGGER_FALLING,
};
-/* Names assigned to available trigger sources.
- */
static const char *const trigger_source_names[] = {
[TRIGGER_CHANNELS] = "CH",
[TRIGGER_EXT_TRG] = "TRG",
};
-/* Names assigned to available edge slope choices.
- */
static const char *const signal_edge_names[] = {
[EDGE_POSITIVE] = "r",
[EDGE_NEGATIVE] = "f",
};
-/* Create a new sigrok device instance for the indicated LWLA model.
- */
static struct sr_dev_inst *dev_inst_new(const struct model_info *model)
{
struct sr_dev_inst *sdi;
int i;
char name[8];
- /* Initialize private device context. */
devc = g_malloc0(sizeof(struct dev_context));
devc->model = model;
devc->active_fpga_config = FPGA_NOCONF;
devc->samplerate = model->samplerates[0];
devc->channel_mask = (UINT64_C(1) << model->num_channels) - 1;
- /* Create sigrok device instance. */
sdi = g_malloc0(sizeof(struct sr_dev_inst));
sdi->status = SR_ST_INACTIVE;
sdi->vendor = g_strdup(VENDOR_NAME);
sdi->model = g_strdup(model->name);
sdi->priv = devc;
- /* Generate list of logic channels. */
for (i = 0; i < model->num_channels; i++) {
- /* The LWLA series simply number channels from CH1 to CHxx. */
g_snprintf(name, sizeof(name), "CH%d", i + 1);
sr_channel_new(sdi, i, SR_CHANNEL_LOGIC, TRUE, name);
}
return sdi;
}
-/* Scan for SysClk LWLA devices and create a device instance for each one.
- */
static GSList *scan(struct sr_dev_driver *di, GSList *options)
{
GSList *conn_devices, *devices, *node;
return SR_OK;
}
-/* Open and initialize device.
- */
static int dev_open(struct sr_dev_inst *sdi)
{
struct drv_context *drvc;
return ret;
}
-/* Shutdown and close device. */
static int dev_close(struct sr_dev_inst *sdi)
{
struct dev_context *devc;
return FALSE;
}
-/* Read device configuration setting.
- */
static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi,
const struct sr_channel_group *cg)
{
return -1;
}
-/* Write device configuration setting.
- */
static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi,
const struct sr_channel_group *cg)
{
return SR_OK;
}
-/* Apply channel configuration change.
- */
static int config_channel_set(const struct sr_dev_inst *sdi,
struct sr_channel *ch, unsigned int changes)
{
return SR_OK;
}
-/* Derive trigger masks from the session's trigger configuration.
- */
+/* Derive trigger masks from the session's trigger configuration. */
static int prepare_trigger_masks(const struct sr_dev_inst *sdi)
{
uint64_t trigger_mask, trigger_values, trigger_edge_mask;
return SR_OK;
}
-/* Apply current device configuration to the hardware.
- */
static int config_commit(const struct sr_dev_inst *sdi)
{
struct dev_context *devc;
return lwla_start_acquisition(sdi);
}
-/* Request that a running capture operation be stopped.
- */
static int dev_acquisition_stop(struct sr_dev_inst *sdi)
{
struct dev_context *devc;
return SR_OK;
}
-/* SysClk LWLA driver descriptor.
- */
static struct sr_dev_driver sysclk_lwla_driver_info = {
.name = "sysclk-lwla",
.longname = "SysClk LWLA series",
*/
#define PACKET_SIZE (5000 * 4 * 5)
-/** LWLA protocol command ID codes.
- */
+/** LWLA protocol command ID codes. */
enum command_id {
CMD_READ_REG = 1,
CMD_WRITE_REG = 2,
STATUS_MEM_AVAIL = 1 << 6,
};
-/** LWLA1034 run-length encoding states.
- */
+/** LWLA1034 run-length encoding states. */
enum rle_state {
RLE_STATE_DATA,
RLE_STATE_LEN
};
-/** Register address/value pair.
- */
+/** Register address/value pair. */
struct regval {
unsigned int reg;
uint32_t val;
};
-/** LWLA sample acquisition and decompression state.
- */
+/** LWLA sample acquisition and decompression state. */
struct acquisition_state {
uint64_t samples_max; /* maximum number of samples to process */
uint64_t samples_done; /* number of samples sent to the session bus */
#include "lwla.h"
#include "protocol.h"
-/* Number of logic channels.
- */
+/* Number of logic channels. */
#define NUM_CHANNELS 16
-/* Unit size for the sigrok logic datafeed.
- */
+/* Unit size for the sigrok logic datafeed. */
#define UNIT_SIZE ((NUM_CHANNELS + 7) / 8)
-/* Size of the acquisition buffer in device memory units.
- */
+/* Size of the acquisition buffer in device memory units. */
#define MEMORY_DEPTH (256 * 1024) /* 256k x 32 bit */
-/* Capture memory read start address.
- */
+/* Capture memory read start address. */
#define READ_START_ADDR 2
-/* Number of device memory units (32 bit) to read at a time.
- */
+/* Number of device memory units (32 bit) to read at a time. */
#define READ_CHUNK_LEN 250
-/** LWLA1016 register addresses.
- */
+/** LWLA1016 register addresses. */
enum reg_addr {
REG_CHAN_MASK = 0x1000, /* bit mask of enabled channels */
REG_DIV_COUNT = 0x10BC, /* write */
};
-/** Flag bits for REG_MEM_CTRL.
- */
+/** Flag bits for REG_MEM_CTRL. */
enum mem_ctrl_flag {
MEM_CTRL_RESET = 1 << 0,
MEM_CTRL_WRITE = 1 << 1,
};
-/** Flag bits for REG_CAP_CTRL.
- */
+/** Flag bits for REG_CAP_CTRL. */
enum cap_ctrl_flag {
CAP_CTRL_FIFO32_FULL = 1 << 0, /* "fifo32_ful" bit */
CAP_CTRL_FIFO64_FULL = 1 << 1, /* "fifo64_ful" bit */
CAP_CTRL_CNTR_NOT_ENDR = 1 << 6, /* "cntr_not_endr" bit */
};
-/* Available FPGA configurations.
- */
+/* Available FPGA configurations. */
enum fpga_config {
FPGA_100 = 0, /* 100 MS/s, no compression */
FPGA_100_TS, /* 100 MS/s, timing-state mode */
};
-/* FPGA bitstream resource filenames.
- */
+/* FPGA bitstream resource filenames. */
static const char bitstream_map[][32] = {
[FPGA_100] = "sysclk-lwla1016-100.rbf",
[FPGA_100_TS] = "sysclk-lwla1016-100-ts.rbf",
};
-/* Demangle incoming sample data from the transfer buffer.
- */
+/* Demangle incoming sample data from the transfer buffer. */
static void read_response(struct acquisition_state *acq)
{
uint32_t *in_p, *out_p;
acq->samples_done += run_samples;
}
-/* Demangle and decompress incoming sample data from the transfer buffer.
- */
+/* Demangle and decompress incoming sample data from the transfer buffer. */
static void read_response_rle(struct acquisition_state *acq)
{
uint32_t *in_p;
return SR_OK;
}
-/* Select and transfer FPGA bitstream for the current configuration.
- */
+/* Select and transfer FPGA bitstream for the current configuration. */
static int apply_fpga_config(const struct sr_dev_inst *sdi)
{
struct dev_context *devc;
return ret;
}
-/* Perform initialization self test.
- */
+/* Perform initialization self test. */
static int device_init_check(const struct sr_dev_inst *sdi)
{
static const struct regval mem_reset[] = {
return SR_OK;
}
-/* Model descriptor for the LWLA1016.
- */
+/* Model descriptor for the LWLA1016. */
SR_PRIV const struct model_info lwla1016_info = {
.name = "LWLA1016",
.num_channels = NUM_CHANNELS,
#include "lwla.h"
#include "protocol.h"
-/* Number of logic channels.
- */
+/* Number of logic channels. */
#define NUM_CHANNELS 34
-/* Bit mask covering all logic channels.
- */
+/* Bit mask covering all logic channels. */
#define ALL_CHANNELS_MASK ((UINT64_C(1) << NUM_CHANNELS) - 1)
-/* Unit size for the sigrok logic datafeed.
- */
+/* Unit size for the sigrok logic datafeed. */
#define UNIT_SIZE ((NUM_CHANNELS + 7) / 8)
-/* Size of the acquisition buffer in device memory units.
- */
+/* Size of the acquisition buffer in device memory units. */
#define MEMORY_DEPTH (256 * 1024) /* 256k x 36 bit */
-/* Capture memory read start address.
- */
+/* Capture memory read start address. */
#define READ_START_ADDR 4
/* Number of device memory units (36 bit) to read at a time. Slices of 8
*/
#define READ_CHUNK_LEN (28 * 8)
-/* Bit mask for the RLE repeat-count-follows flag.
- */
+/* Bit mask for the RLE repeat-count-follows flag. */
#define RLE_FLAG_LEN_FOLLOWS (UINT64_C(1) << 35)
/* Start index and count for bulk long register reads.
#define READ_LREGS_START LREG_MEM_FILL
#define READ_LREGS_COUNT (LREG_STATUS + 1 - READ_LREGS_START)
-/** LWLA1034 register addresses.
- */
+/** LWLA1034 register addresses. */
enum reg_addr {
REG_MEM_CTRL = 0x1074, /* capture buffer control */
REG_MEM_FILL = 0x1078, /* capture buffer fill level */
REG_LONG_HIGH = 0x10BC, /* long register high word */
};
-/** Flag bits for REG_MEM_CTRL.
- */
+/** Flag bits for REG_MEM_CTRL. */
enum mem_ctrl_flag {
MEM_CTRL_WRITE = 1 << 0, /* "wr1rd0" bit */
MEM_CTRL_CLR_IDX = 1 << 1, /* "clr_idx" bit */
};
-/* LWLA1034 long register addresses.
- */
+/* LWLA1034 long register addresses. */
enum long_reg_addr {
LREG_CHAN_MASK = 0, /* channel enable mask */
LREG_DIV_COUNT = 1, /* clock divider max count */
LREG_TEST_ID = 100, /* constant test ID */
};
-/** Flag bits for LREG_CAP_CTRL.
- */
+/** Flag bits for LREG_CAP_CTRL. */
enum cap_ctrl_flag {
CAP_CTRL_TRG_EN = 1 << 0, /* "trg_en" bit */
CAP_CTRL_CLR_TIMEBASE = 1 << 2, /* "do_clr_timebase" bit */
CAP_CTRL_CLR_COUNTER = 1 << 6, /* "clr_cntr0" bit */
};
-/* Available FPGA configurations.
- */
+/* Available FPGA configurations. */
enum fpga_config {
FPGA_OFF = 0, /* FPGA shutdown config */
FPGA_INT, /* internal clock config */
FPGA_EXTNEG, /* external clock, falling edge config */
};
-/* FPGA bitstream resource filenames.
- */
+/* FPGA bitstream resource filenames. */
static const char bitstream_map[][32] = {
[FPGA_OFF] = "sysclk-lwla1034-off.rbf",
[FPGA_INT] = "sysclk-lwla1034-int.rbf",
[FPGA_EXTNEG] = "sysclk-lwla1034-extneg.rbf",
};
-/* Read 64-bit long register.
- */
+/* Read 64-bit long register. */
static int read_long_reg(const struct sr_usb_dev_inst *usb,
uint32_t addr, uint64_t *value)
{
return SR_OK;
}
-/* Queue access sequence for a long register write.
- */
+/* Queue access sequence for a long register write. */
static void queue_long_regval(struct acquisition_state *acq,
uint32_t addr, uint64_t value)
{
lwla_queue_regval(acq, REG_LONG_STROBE, 0);
}
-/* Helper to fill in the long register bulk write command.
- */
+/* Helper to fill in the long register bulk write command. */
static inline void bulk_long_set(struct acquisition_state *acq,
unsigned int idx, uint64_t value)
{
acq->xfer_buf_out[4 * idx + 6] = LWLA_WORD_3(value);
}
-/* Helper for dissecting the response to a long register bulk read.
- */
+/* Helper for dissecting the response to a long register bulk read. */
static inline uint64_t bulk_long_get(const struct acquisition_state *acq,
unsigned int idx)
{
return SR_ERR;
}
-/* Select and transfer FPGA bitstream for the current configuration.
- */
+/* Select and transfer FPGA bitstream for the current configuration. */
static int apply_fpga_config(const struct sr_dev_inst *sdi)
{
struct dev_context *devc;
return ret;
}
-/* Perform initialization self test.
- */
+/* Perform initialization self test. */
static int device_init_check(const struct sr_dev_inst *sdi)
{
uint64_t value;
return detect_short_transfer_quirk(sdi);
}
-/* Set up the device in preparation for an acquisition session.
- */
+/* Set up the device in preparation for an acquisition session. */
static int setup_acquisition(const struct sr_dev_inst *sdi)
{
static const struct regval capture_init[] = {
return SR_OK;
}
-/** Model descriptor for the LWLA1034.
- */
+/** Model descriptor for the LWLA1034. */
SR_PRIV const struct model_info lwla1034_info = {
.name = "LWLA1034",
.num_channels = NUM_CHANNELS,
#include "protocol.h"
#include "lwla.h"
-/* Submit an already filled-in USB transfer.
- */
+/* Submit an already filled-in USB transfer. */
static int submit_transfer(struct dev_context *devc,
struct libusb_transfer *xfer)
{
return SR_OK;
}
-/* Set up transfer for the next register in a write sequence.
- */
+/* Set up transfer for the next register in a write sequence. */
static void next_reg_write(struct acquisition_state *acq)
{
struct regval *regval;
acq->xfer_out->length = 4 * sizeof(acq->xfer_buf_out[0]);
}
-/* Set up transfer for the next register in a read sequence.
- */
+/* Set up transfer for the next register in a read sequence. */
static void next_reg_read(struct acquisition_state *acq)
{
unsigned int addr;
acq->xfer_out->length = 2 * sizeof(acq->xfer_buf_out[0]);
}
-/* Decode the response to a register read request.
- */
+/* Decode the response to a register read request. */
static int read_reg_response(struct acquisition_state *acq)
{
uint32_t value;
return SR_OK;
}
-/* Enter a new state and submit the corresponding request to the device.
- */
+/* Enter a new state and submit the corresponding request to the device. */
static int submit_request(const struct sr_dev_inst *sdi,
enum protocol_state state)
{
return submit_transfer(devc, acq->xfer_out);
}
-/* Evaluate and act on the response to a capture status request.
- */
+/* Evaluate and act on the response to a capture status request. */
static void handle_status_response(const struct sr_dev_inst *sdi)
{
struct dev_context *devc;
}
}
-/* Evaluate and act on the response to a capture length request.
- */
+/* Evaluate and act on the response to a capture length request. */
static void handle_length_response(const struct sr_dev_inst *sdi)
{
struct dev_context *devc;
submit_request(sdi, STATE_READ_PREPARE);
}
-/* Evaluate and act on the response to a capture memory read request.
- */
+/* Evaluate and act on the response to a capture memory read request. */
static void handle_read_response(const struct sr_dev_inst *sdi)
{
struct dev_context *devc;
submit_request(sdi, STATE_READ_FINISH);
}
-/* Destroy and unset the acquisition state record.
- */
+/* Destroy and unset the acquisition state record. */
static void clear_acquisition_state(const struct sr_dev_inst *sdi)
{
struct dev_context *devc;
}
}
-/* USB I/O source callback.
- */
+/* USB I/O source callback. */
static int transfer_event(int fd, int revents, void *cb_data)
{
const struct sr_dev_inst *sdi;
return G_SOURCE_REMOVE;
}
-/* USB output transfer completion callback.
- */
+/* USB output transfer completion callback. */
static void LIBUSB_CALL transfer_out_completed(struct libusb_transfer *transfer)
{
const struct sr_dev_inst *sdi;
}
}
-/* USB input transfer completion callback.
- */
+/* USB input transfer completion callback. */
static void LIBUSB_CALL transfer_in_completed(struct libusb_transfer *transfer)
{
const struct sr_dev_inst *sdi;
}
}
-/* Set up the acquisition state record.
- */
+/* Set up the acquisition state record. */
static int init_acquisition_state(const struct sr_dev_inst *sdi)
{
struct dev_context *devc;
struct acquisition_state;
-/* USB vendor and product IDs.
- */
+/* USB vendor and product IDs. */
enum {
USB_VID_SYSCLK = 0x2961,
USB_PID_LWLA1016 = 0x6688,
USB_PID_LWLA1034 = 0x6689,
};
-/* USB device characteristics.
- */
+/* USB device characteristics. */
enum {
USB_CONFIG = 1,
USB_INTERFACE = 0,
USB_TIMEOUT_MS = 1000,
};
-/** USB device end points.
- */
+/** USB device end points. */
enum usb_endpoint {
EP_COMMAND = 2,
EP_CONFIG = 4,
EP_REPLY = 6 | LIBUSB_ENDPOINT_IN
};
-/** LWLA1034 clock sources.
- */
+/** LWLA1034 clock sources. */
enum clock_source {
CLOCK_INTERNAL = 0,
CLOCK_EXT_CLK,
};
-/** LWLA1034 trigger sources.
- */
+/** LWLA1034 trigger sources. */
enum trigger_source {
TRIGGER_CHANNELS = 0,
TRIGGER_EXT_TRG,
};
-/** Edge choices for the LWLA1034 external clock and trigger inputs.
- */
+/** Edge choices for the LWLA1034 external clock and trigger inputs. */
enum signal_edge {
EDGE_POSITIVE = 0,
EDGE_NEGATIVE,
FPGA_NOCONF = -1,
};
-/** Acquisition protocol states.
- */
+/** Acquisition protocol states. */
enum protocol_state {
/* idle states */
STATE_IDLE = 0,
STATE_READ_REQUEST,
};
-/** Private, per-device-instance driver context.
- */
struct dev_context {
uint64_t samplerate; /* requested samplerate */
uint64_t limit_msec; /* requested capture duration in ms */
enum signal_edge cfg_trigger_slope; /* ext trigger slope setting */
};
-/** LWLA model descriptor.
- */
+/** LWLA model descriptor. */
struct model_info {
char name[12];
int num_channels;
std_session_send_df_header(sdi);
- /* Poll every 50ms, or whenever some data comes in. */
serial_source_add(sdi->session, serial, G_IO_IN, 50,
teleinfo_receive_data, (void *)sdi);
#define TELEINFO_BUF_SIZE 256
-/** Private, per-device-instance driver context. */
struct dev_context {
- /* Acquisition settings */
struct sr_sw_limits sw_limits;
-
- /* Operational state */
enum optarif optarif; /**< The device mode (which measures are reported) */
-
- /* Temporary state across callbacks */
uint8_t buf[TELEINFO_BUF_SIZE];
int buf_len;
};
usb_get_port_path(devlist[i], connection_id, sizeof(connection_id));
- /* Hardcode the 435 for now.*/
+ /* Hardcode the 435 for now. */
if (strcmp(product, "testo 435/635/735"))
continue;
const uint8_t *request;
};
-/** Private, per-device-instance driver context. */
struct dev_context {
- /* Model-specific information */
const struct testo_model *model;
-
- /* Acquisition settings */
struct sr_sw_limits sw_limits;
- /* Operational state */
uint8_t channel_units[MAX_CHANNELS];
int num_channels;
- /* Temporary state across callbacks */
struct libusb_transfer *out_transfer;
uint8_t reply[MAX_REPLY_SIZE];
int reply_size;
sr_sw_limits_acquisition_start(&devc->limits);
- /* Poll every 500ms, or whenever some data comes in. */
serial = sdi->conn;
serial_source_add(sdi->session, serial, G_IO_IN, 500,
tondaj_sl_814_receive_data, (void *)sdi);
#define LOG_PREFIX "tondaj-sl-814"
-/** Private, per-device-instance driver context. */
struct dev_context {
struct sr_sw_limits limits;
int state;
std_session_send_df_header(sdi);
- sr_session_source_add(sdi->session, -1, 0, 10 /* poll_timeout */,
+ sr_session_source_add(sdi->session, -1, 0, 10,
uni_t_dmm_receive_data, (void *)sdi);
return SR_OK;
usb = sdi->conn;
- /* Detach kernel drivers which grabbed this device (if any). */
if (libusb_kernel_driver_active(usb->devhdl, 0) == 1) {
ret = libusb_detach_kernel_driver(usb->devhdl, 0);
if (ret < 0) {
}
}
- /* Claim interface 0. */
if ((ret = libusb_claim_interface(usb->devhdl, 0)) < 0) {
sr_err("Failed to claim interface 0: %s.",
libusb_error_name(ret));
#define DMM_BUFSIZE 256
-/** Private, per-device-instance driver context. */
struct dev_context {
struct sr_sw_limits limits;
CMD_GET_STORED = 7,
};
-/** Private, per-device-instance driver context. */
struct dev_context {
- /* Acquisition settings */
uint64_t limit_samples;
gboolean data_source;
- /* Operational state */
uint64_t num_samples;
unsigned char buf[8];
struct libusb_transfer *xfer;
- /* Temporary state across callbacks */
unsigned char packet[32];
int packet_len;
};
if (ret != SR_OK)
return ret;
- /* The device reports as HID class, so the kernel would have
- * claimed it. */
if (libusb_kernel_driver_active(usb->devhdl, 0) == 1) {
if ((ret = libusb_detach_kernel_driver(usb->devhdl, 0)) < 0) {
sr_err("Failed to detach kernel driver: %s.",
#define DMM_DATA_SIZE 14
-/** Private, per-device-instance driver context. */
struct dev_context {
struct sr_sw_limits limits;
};
devc = (sdi) ? sdi->priv : NULL;
model = (devc) ? devc->model_config : NULL;
- /*
- * If cg is NULL, only the SR_CONF_DEVICE_OPTIONS that are not
- * specific to a channel group must be returned.
- */
if (!cg) {
switch (key) {
case SR_CONF_SCAN_OPTIONS:
devc->current_channel = devc->enabled_channels;
dlm_channel_data_request(sdi);
- /* Call our callback when data comes in or after 5ms. */
sr_scpi_source_add(sdi->session, scpi, G_IO_IN, 5,
dlm_data_receive, (void *)sdi);
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-/**
- * @file
- *
- * <em>Yokogawa DL/DLM series</em> oscilloscope driver
- * @internal
- */
-
#include <config.h>
#include "scpi.h"
#include "protocol.h"
uint32_t samples_per_frame;
};
-/** Private, per-device-instance driver context. */
struct dev_context {
const void *model_config;
void *model_state;
prof = &zeroplus_models[j];
}
}
- /* Skip if the device was not found. */
+
if (!prof)
continue;
sr_info("Found ZEROPLUS %s.", prof->model_name);
- /* Register the device with libsigrok. */
sdi = g_malloc0(sizeof(struct sr_dev_inst));
sdi->status = SR_ST_INACTIVE;
sdi->vendor = g_strdup(VENDOR_NAME);
sdi->serial_num = g_strdup(serial_num);
sdi->connection_id = g_strdup(connection_id);
- /* Allocate memory for our private driver context. */
devc = g_malloc0(sizeof(struct dev_context));
sdi->priv = devc;
devc->prof = prof;
devc->memory_size = MEMORY_SIZE_8K;
// memset(devc->trigger_buffer, 0, NUM_TRIGGER_STAGES);
- /* Fill in channellist according to this device's profile. */
for (j = 0; j < devc->num_channels; j++)
sr_channel_new(sdi, j, SR_CHANNEL_LOGIC, TRUE,
channel_names[j]);
return SR_OK;
}
-/* TODO: This stops acquisition on ALL devices, ignoring dev_index. */
static int dev_acquisition_stop(struct sr_dev_inst *sdi)
{
struct sr_usb_dev_inst *usb;
#define LOG_PREFIX "zeroplus"
-/* Private, per-device-instance driver context. */
struct dev_context {
uint64_t cur_samplerate;
uint64_t max_samplerate;
* @param[in] cg The channel group on the device instance for which to list
* the values, or NULL. If this device instance doesn't
* have channel groups, this must not be != NULL.
+ * If cg is NULL, this function will return the "common" device
+ * instance options that are channel-group independent. Otherwise
+ * it will return the channel-group specific options.
* @param[in] key The configuration key (SR_CONF_*).
* @param[in,out] data A pointer to a GVariant where the list will be stored.
* The caller is given ownership of the GVariant and must thus
"NONE", "PARALLEL", "SERIES", "AUTO",
};
-/** Private, per-device-instance driver context. */
struct dev_context {
- /** The number of frames. */
struct dev_limit_counter frame_count;
- /** The time limit counter. */
struct dev_time_counter time_count;
- /** Data buffer. */
struct dev_buffer *buf;
/** The frequency of the test signal (index to frequencies[]). */
std_session_send_df_header(sdi);
- /* Poll every 50ms, or whenever some data comes in. */
serial = sdi->conn;
serial_source_add(sdi->session, serial, G_IO_IN, 50,
receive_data, (void *)sdi);