struct sr_dev_inst *sdi;
struct drv_context *drvc;
struct dev_context *devc;
- struct sr_hwopt *opt;
+ struct sr_config *src;
struct sr_probe *probe;
struct sr_serial_dev_inst *serial;
GSList *l, *devices;
devices = NULL;
conn = serialcomm = NULL;
for (l = options; l; l = l->next) {
- opt = l->data;
- switch (opt->hwopt) {
+ src = l->data;
+ switch (src->key) {
case SR_HWOPT_CONN:
- conn = opt->value;
+ conn = src->value;
break;
case SR_HWOPT_SERIALCOMM:
- serialcomm = opt->value;
+ serialcomm = src->value;
break;
}
}
{
struct sr_datafeed_packet packet;
struct sr_datafeed_header header;
- struct sr_datafeed_meta_analog meta;
struct dev_context *devc;
if (!(devc = sdi->priv)) {
gettimeofday(&header.starttime, NULL);
sr_session_send(devc->cb_data, &packet);
- /* Send metadata about the SR_DF_ANALOG packets to come. */
- sr_dbg("Sending SR_DF_META_ANALOG.");
- packet.type = SR_DF_META_ANALOG;
- packet.payload = &meta;
- meta.num_probes = 1;
- sr_session_send(devc->cb_data, &packet);
-
/* Poll every 100ms, or whenever some data comes in. */
sr_source_add(devc->serial->fd, G_IO_IN, 100, agdmm_receive_data, (void *)sdi);
{
struct sr_datafeed_packet packet;
struct sr_datafeed_header header;
- struct sr_datafeed_meta_analog meta;
struct dev_context *devc;
int count, ret;
char *endianness;
gettimeofday(&header.starttime, NULL);
sr_session_send(devc->cb_data, &packet);
- /* Send metadata about the SR_DF_ANALOG packets to come. */
- sr_dbg("Sending SR_DF_META_ANALOG packet.");
- packet.type = SR_DF_META_ANALOG;
- packet.payload = &meta;
- meta.num_probes = devc->num_probes;
- sr_session_send(devc->cb_data, &packet);
-
/* Poll every 10ms, or whenever some data comes in. */
sr_source_add(devc->ufds[0].fd, devc->ufds[0].events, 10,
alsa_receive_data, (void *)sdi);
struct dev_context *devc;
struct sr_datafeed_packet *packet;
struct sr_datafeed_header *header;
- struct sr_datafeed_meta_logic meta;
struct clockselect_50 clockselect;
int frac, triggerpin, ret;
uint8_t triggerselect = 0;
gettimeofday(&header->starttime, NULL);
sr_session_send(devc->session_dev_id, packet);
- /* Send metadata about the SR_DF_LOGIC packets to come. */
- packet->type = SR_DF_META_LOGIC;
- packet->payload = &meta;
- meta.samplerate = devc->cur_samplerate;
- meta.num_probes = devc->num_probes;
- sr_session_send(devc->session_dev_id, packet);
-
/* Add capture source. */
sr_source_add(0, G_IO_IN, 10, receive_data, (void *)sdi);
struct dev_context *devc;
struct sr_datafeed_packet packet;
struct sr_datafeed_header header;
- struct sr_datafeed_meta_logic meta;
uint8_t buf[4];
int bytes_written;
gettimeofday(&header.starttime, NULL);
sr_session_send(devc->session_dev_id, &packet);
- /* Send metadata about the SR_DF_LOGIC packets to come. */
- packet.type = SR_DF_META_LOGIC;
- packet.payload = &meta;
- meta.samplerate = devc->cur_samplerate;
- meta.num_probes = NUM_PROBES;
- sr_session_send(devc->session_dev_id, &packet);
-
/* Time when we should be done (for detecting trigger timeouts). */
devc->done = (devc->divcount + 1) * 0.08388608 + time(NULL)
+ devc->trigger_timeout;
struct drv_context *drvc;
struct dev_context *devc;
struct sr_dev_inst *sdi;
- struct sr_hwopt *opt;
+ struct sr_config *src;
struct sr_probe *probe;
GSList *devices, *l;
const char *conn, *serialcomm;
conn = serialcomm = NULL;
for (l = options; l; l = l->next) {
- opt = l->data;
- switch (opt->hwopt) {
+ src = l->data;
+ switch (src->key) {
case SR_HWOPT_CONN:
- conn = opt->value;
+ conn = src->value;
break;
case SR_HWOPT_SERIALCOMM:
- serialcomm = opt->value;
+ serialcomm = src->value;
break;
}
}
{
struct sr_datafeed_packet packet;
struct sr_datafeed_header header;
- struct sr_datafeed_meta_analog meta;
struct dev_context *devc;
if (!(devc = sdi->priv)) {
gettimeofday(&header.starttime, NULL);
sr_session_send(devc->cb_data, &packet);
- /* Send metadata about the SR_DF_ANALOG packets to come. */
- sr_dbg("Sending SR_DF_META_ANALOG.");
- packet.type = SR_DF_META_ANALOG;
- packet.payload = &meta;
- meta.num_probes = 1;
- sr_session_send(devc->cb_data, &packet);
-
/* Poll every 150ms, or whenever some data comes in. */
sr_source_add(devc->serial->fd, G_IO_IN, 150, colead_slm_receive_data,
(void *)sdi);
{
struct sr_datafeed_packet *packet;
struct sr_datafeed_header *header;
- struct sr_datafeed_meta_logic meta;
struct dev_context *devc;
(void)sdi;
gettimeofday(&header->starttime, NULL);
sr_session_send(devc->session_dev_id, packet);
- /* Send metadata about the SR_DF_LOGIC packets to come. */
- packet->type = SR_DF_META_LOGIC;
- packet->payload = &meta;
- meta.samplerate = cur_samplerate;
- meta.num_probes = NUM_PROBES;
- sr_session_send(devc->session_dev_id, packet);
-
/* We use this timestamp to decide how many more samples to send. */
devc->starttime = g_get_monotonic_time();
static GSList *hw_scan(GSList *options)
{
- struct sr_hwopt *opt;
+ struct sr_config *src;
GSList *l, *devices;
int i;
const char *conn, *serialcomm;
conn = serialcomm = NULL;
for (l = options; l; l = l->next) {
- opt = l->data;
- switch (opt->hwopt) {
+ src = l->data;
+ switch (src->key) {
case SR_HWOPT_CONN:
- conn = opt->value;
+ conn = src->value;
break;
case SR_HWOPT_SERIALCOMM:
- serialcomm = opt->value;
+ serialcomm = src->value;
break;
}
}
{
struct sr_datafeed_packet packet;
struct sr_datafeed_header header;
- struct sr_datafeed_meta_analog meta;
struct dev_context *devc;
if (!(devc = sdi->priv)) {
gettimeofday(&header.starttime, NULL);
sr_session_send(devc->cb_data, &packet);
- /* Send metadata about the SR_DF_ANALOG packets to come. */
- sr_dbg("Sending SR_DF_META_ANALOG.");
- packet.type = SR_DF_META_ANALOG;
- packet.payload = &meta;
- meta.num_probes = 1;
- sr_session_send(devc->cb_data, &packet);
-
/* Poll every 100ms, or whenever some data comes in. */
sr_source_add(devc->serial->fd, G_IO_IN, 50, fluke_receive_data, (void *)sdi);
{
struct sr_datafeed_packet packet;
struct sr_datafeed_header header;
- struct sr_datafeed_meta_logic meta;
struct dev_context *devc;
struct drv_context *drvc;
struct libusb_transfer *transfer;
gettimeofday(&header.starttime, NULL);
sr_session_send(cb_data, &packet);
- /* Send metadata about the SR_DF_LOGIC packets to come. */
- packet.type = SR_DF_META_LOGIC;
- packet.payload = &meta;
- meta.samplerate = devc->cur_samplerate;
- meta.num_probes = devc->sample_wide ? 16 : 8;
- sr_session_send(cb_data, &packet);
-
if ((ret = command_start_acquisition(devc->usb->devhdl,
devc->cur_samplerate, devc->sample_wide)) != SR_OK) {
abort_acquisition(devc);
const struct libusb_pollfd **lupfd;
struct sr_datafeed_packet packet;
struct sr_datafeed_header header;
- struct sr_datafeed_meta_analog meta;
struct dev_context *devc;
struct drv_context *drvc = di->priv;
int i;
gettimeofday(&header.starttime, NULL);
sr_session_send(cb_data, &packet);
- /* Send metadata about the SR_DF_ANALOG packets to come. */
- packet.type = SR_DF_META_ANALOG;
- packet.payload = &meta;
- meta.num_probes = NUM_PROBES;
- sr_session_send(cb_data, &packet);
-
return SR_OK;
}
#define USB_CONFIGURATION 1
#define DSO_EP_IN 0x86
#define DSO_EP_OUT 0x02
-#define NUM_PROBES 2
/* FX2 renumeration delay in ms */
#define MAX_RENUM_DELAY_MS 3000
struct dev_context *devc;
struct sr_dev_inst *sdi;
struct sr_usb_dev_inst *usb;
- struct sr_hwopt *opt;
+ struct sr_config *src;
GSList *usb_devices, *devices, *l;
const char *conn;
conn = NULL;
for (l = options; l; l = l->next) {
- opt = l->data;
- switch (opt->hwopt) {
+ src = l->data;
+ switch (src->key) {
case SR_HWOPT_CONN:
- conn = opt->value;
+ conn = src->value;
break;
}
}
{
struct sr_datafeed_packet packet;
struct sr_datafeed_header header;
- struct sr_datafeed_meta_analog meta;
struct dev_context *devc;
struct drv_context *drvc = di->priv;
struct libusb_transfer *xfer_in, *xfer_out;
devc->log_size = xfer_in->buffer[1] + (xfer_in->buffer[2] << 8);
libusb_free_transfer(xfer_out);
- /* Send metadata about the SR_DF_ANALOG packets to come. */
- packet.type = SR_DF_META_ANALOG;
- packet.payload = &meta;
- meta.num_probes = 1;
- sr_session_send(devc->cb_data, &packet);
-
pfd = libusb_get_pollfds(drvc->sr_ctx->libusb_ctx);
for (i = 0; pfd[i]; i++) {
/* Handle USB events every 100ms, for decent latency. */
const char *conn = NULL;
const char *serialcomm = NULL;
GSList *l;
- struct sr_hwopt *opt;
+ struct sr_config *src;
struct udev *udev;
(void)options;
for (l = options; l; l = l->next) {
- opt = l->data;
- switch (opt->hwopt) {
+ src = l->data;
+ switch (src->key) {
case SR_HWOPT_CONN:
- conn = opt->value;
+ conn = src->value;
break;
case SR_HWOPT_SERIALCOMM:
- serialcomm = opt->value;
+ serialcomm = src->value;
break;
}
}
{
struct sr_datafeed_packet *packet;
struct sr_datafeed_header *header;
- struct sr_datafeed_meta_logic meta;
struct dev_context *devc;
int ret = SR_ERR;
gettimeofday(&header->starttime, NULL);
sr_session_send(cb_data, packet);
- packet->type = SR_DF_META_LOGIC;
- packet->payload = &meta;
- meta.samplerate = devc->cur_rate;
- meta.num_probes = NUM_PROBES;
- sr_session_send(cb_data, packet);
-
g_free(header);
g_free(packet);
struct dev_context *devc;
struct sr_dev_inst *sdi;
struct sr_usb_dev_inst *usb;
- struct sr_hwopt *opt;
+ struct sr_config *src;
struct sr_probe *probe;
libusb_device *dev;
GSList *usb_devices, *devices, *l;
conn = NULL;
for (l = options; l; l = l->next) {
- opt = l->data;
- switch (opt->hwopt) {
+ src = l->data;
+ switch (src->key) {
case SR_HWOPT_CONN:
- conn = opt->value;
+ conn = src->value;
break;
}
}
static GSList *hw_scan(GSList *options)
{
- struct sr_hwopt *opt;
+ struct sr_config *src;
struct sr_dev_inst *sdi;
struct drv_context *drvc;
struct dev_context *devc;
conn = serialcomm = NULL;
for (l = options; l; l = l->next) {
- opt = l->data;
- switch (opt->hwopt) {
+ src = l->data;
+ switch (src->key) {
case SR_HWOPT_CONN:
- conn = opt->value;
+ conn = src->value;
break;
case SR_HWOPT_SERIALCOMM:
- serialcomm = opt->value;
+ serialcomm = src->value;
break;
}
}
{
struct sr_datafeed_packet *packet;
struct sr_datafeed_header *header;
- struct sr_datafeed_meta_logic meta;
struct dev_context *devc;
uint32_t trigger_config[4];
uint32_t data;
gettimeofday(&header->starttime, NULL);
sr_session_send(cb_data, packet);
- /* Send metadata about the SR_DF_LOGIC packets to come. */
- packet->type = SR_DF_META_LOGIC;
- packet->payload = &meta;
- meta.samplerate = devc->cur_samplerate;
- meta.num_probes = NUM_PROBES;
- sr_session_send(cb_data, packet);
-
g_free(header);
g_free(packet);
#include "libsigrok-internal.h"
#include "protocol.h"
-#define NUM_PROBES 2
-
static const int hwcaps[] = {
SR_HWCAP_OSCILLOSCOPE,
SR_HWCAP_LIMIT_SAMPLES,
struct dev_context *devc;
struct sr_datafeed_packet packet;
struct sr_datafeed_header header;
- struct sr_datafeed_meta_analog meta;
char buf[256];
int len;
gettimeofday(&header.starttime, NULL);
sr_session_send(cb_data, &packet);
- /* Send metadata about the SR_DF_ANALOG packets to come. */
- packet.type = SR_DF_META_ANALOG;
- packet.payload = &meta;
- meta.num_probes = NUM_PROBES;
- sr_session_send(cb_data, &packet);
-
rigol_ds1xx2_send_data(devc->fd, ":CHAN1:SCAL?\n");
len = read(devc->fd, buf, sizeof(buf));
buf[len] = 0;
static GSList *hw_scan(GSList *options, int dmm)
{
- struct sr_hwopt *opt;
+ struct sr_config *src;
GSList *l, *devices;
const char *conn, *serialcomm;
conn = serialcomm = NULL;
for (l = options; l; l = l->next) {
- opt = l->data;
- switch (opt->hwopt) {
+ src = l->data;
+ switch (src->key) {
case SR_HWOPT_CONN:
- conn = opt->value;
+ conn = src->value;
break;
case SR_HWOPT_SERIALCOMM:
- serialcomm = opt->value;
+ serialcomm = src->value;
break;
}
}
{
struct sr_datafeed_packet packet;
struct sr_datafeed_header header;
- struct sr_datafeed_meta_analog meta;
struct dev_context *devc;
if (!(devc = sdi->priv)) {
gettimeofday(&header.starttime, NULL);
sr_session_send(devc->cb_data, &packet);
- /* Send metadata about the SR_DF_ANALOG packets to come. */
- sr_dbg("Sending SR_DF_META_ANALOG.");
- packet.type = SR_DF_META_ANALOG;
- packet.payload = &meta;
- meta.num_probes = 1;
- sr_session_send(devc->cb_data, &packet);
-
/* Poll every 50ms, or whenever some data comes in. */
sr_source_add(devc->serial->fd, G_IO_IN, 50,
dmms[dmm].receive_data, (void *)sdi);
struct drv_context *drvc;
struct dev_context *devc;
struct sr_dev_inst *sdi;
- struct sr_hwopt *opt;
+ struct sr_config *src;
struct sr_probe *probe;
GSList *devices, *l;
const char *conn, *serialcomm;
conn = serialcomm = NULL;
for (l = options; l; l = l->next) {
- if (!(opt = l->data)) {
+ if (!(src = l->data)) {
sr_err("Invalid option data, skipping.");
continue;
}
- switch (opt->hwopt) {
+ switch (src->key) {
case SR_HWOPT_CONN:
- conn = opt->value;
+ conn = src->value;
break;
case SR_HWOPT_SERIALCOMM:
- serialcomm = opt->value;
+ serialcomm = src->value;
break;
default:
- sr_err("Unknown option %d, skipping.", opt->hwopt);
+ sr_err("Unknown option %d, skipping.", src->key);
break;
}
}
{
struct sr_datafeed_packet packet;
struct sr_datafeed_header header;
- struct sr_datafeed_meta_analog meta;
struct dev_context *devc;
devc = sdi->priv;
gettimeofday(&header.starttime, NULL);
sr_session_send(devc->cb_data, &packet);
- /* Send metadata about the SR_DF_ANALOG packets to come. */
- sr_dbg("Sending SR_DF_META_ANALOG.");
- packet.type = SR_DF_META_ANALOG;
- packet.payload = &meta;
- meta.num_probes = 1;
- sr_session_send(devc->cb_data, &packet);
-
/* Poll every 500ms, or whenever some data comes in. */
sr_source_add(devc->serial->fd, G_IO_IN, 500,
tondaj_sl_814_receive_data, (void *)sdi);
{
struct sr_datafeed_packet packet;
struct sr_datafeed_header header;
- struct sr_datafeed_meta_analog meta;
struct dev_context *devc;
devc = sdi->priv;
gettimeofday(&header.starttime, NULL);
sr_session_send(devc->cb_data, &packet);
- /* Send metadata about the SR_DF_ANALOG packets to come. */
- sr_dbg("Sending SR_DF_META_ANALOG.");
- packet.type = SR_DF_META_ANALOG;
- packet.payload = &meta;
- meta.num_probes = 1;
- sr_session_send(devc->cb_data, &packet);
-
if (!strcmp(di->name, "uni-t-ut61d")) {
sr_source_add(0, 0, 10 /* poll_timeout */,
uni_t_ut61d_receive_data, (void *)sdi);
{
struct sr_datafeed_packet packet;
struct sr_datafeed_header header;
- struct sr_datafeed_meta_analog meta;
struct dev_context *devc;
struct drv_context *drvc = di->priv;
const struct libusb_pollfd **pfd;
header.feed_version = 1;
sr_session_send(devc->cb_data, &packet);
- /* Send metadata about the SR_DF_ANALOG packets to come. */
- packet.type = SR_DF_META_ANALOG;
- packet.payload = &meta;
- meta.num_probes = 1;
- sr_session_send(devc->cb_data, &packet);
-
pfd = libusb_get_pollfds(drvc->sr_ctx->libusb_ctx);
for (i = 0; pfd[i]; i++) {
/* Handle USB events every 100ms, for decent latency. */
struct sr_datafeed_packet packet;
struct sr_datafeed_logic logic;
struct sr_datafeed_header header;
- struct sr_datafeed_meta_logic meta;
//uint64_t samples_read;
int res;
unsigned int packet_num;
gettimeofday(&header.starttime, NULL);
sr_session_send(cb_data, &packet);
- /* Send metadata about the SR_DF_LOGIC packets to come. */
- packet.type = SR_DF_META_LOGIC;
- packet.payload = &meta;
- meta.samplerate = devc->cur_samplerate;
- meta.num_probes = devc->num_channels;
- sr_session_send(cb_data, &packet);
-
if (!(buf = g_try_malloc(PACKET_SIZE))) {
sr_err("zp: %s: buf malloc failed", __func__);
return SR_ERR_MALLOC;