uint64_t limit_samples;
snd_pcm_t *capture_handle;
snd_pcm_hw_params_t *hw_params;
- gpointer session_id;
+ void *session_dev_id;
};
static int hw_init(const char *devinfo)
return TRUE;
}
-static int hw_dev_acquisition_start(int dev_index, void *session_dev_id)
+static int hw_dev_acquisition_start(int dev_index, void *cb_data)
{
struct sr_dev_inst *sdi;
struct context *ctx;
return SR_ERR;
}
- ctx->session_id = session_dev_id;
+ ctx->session_dev_id = cb_data;
sr_source_add(ufds[0].fd, ufds[0].events, 10, receive_data, sdi);
packet.type = SR_DF_HEADER;
header.num_analog_probes = NUM_PROBES;
header.num_logic_probes = 0;
header.protocol_id = SR_PROTO_RAW;
- sr_session_send(session_dev_id, &packet);
+ sr_session_send(cb_data, &packet);
g_free(ufds);
return SR_OK;
}
-static int hw_dev_acquisition_stop(int dev_index, void *session_dev_id)
+/* TODO: This stops acquisition on ALL devices, ignoring dev_index. */
+static int hw_dev_acquisition_stop(int dev_index, void *cb_data)
{
/* Avoid compiler warnings. */
- dev_index = dev_index;
- session_dev_id = session_dev_id;
+ (void)dev_index;
+ (void)cb_data;
return SR_OK;
}
"asix-sigma-phasor.fw", /* Frequency counter */
};
-static int hw_dev_acquisition_stop(int dev_index, void *session_data);
+static int hw_dev_acquisition_stop(int dev_index, void *cb_data);
static int sigma_read(void *buf, size_t size, struct context *ctx)
{
*/
static int decode_chunk_ts(uint8_t *buf, uint16_t *lastts,
uint16_t *lastsample, int triggerpos,
- uint16_t limit_chunk, void *session_data)
+ uint16_t limit_chunk, void *cb_data)
{
- struct sr_dev_inst *sdi = session_data;
+ struct sr_dev_inst *sdi = cb_data;
struct context *ctx = sdi->priv;
uint16_t tsdiff, ts;
uint16_t samples[65536 * ctx->samples_per_event];
logic.length = tosend * sizeof(uint16_t);
logic.unitsize = 2;
logic.data = samples + sent;
- sr_session_send(ctx->session_id, &packet);
+ sr_session_send(ctx->session_dev_id, &packet);
sent += tosend;
}
logic.length = tosend * sizeof(uint16_t);
logic.unitsize = 2;
logic.data = samples;
- sr_session_send(ctx->session_id, &packet);
+ sr_session_send(ctx->session_dev_id, &packet);
sent += tosend;
}
/* Only send trigger if explicitly enabled. */
if (ctx->use_triggers) {
packet.type = SR_DF_TRIGGER;
- sr_session_send(ctx->session_id, &packet);
+ sr_session_send(ctx->session_dev_id, &packet);
}
}
logic.length = tosend * sizeof(uint16_t);
logic.unitsize = 2;
logic.data = samples + sent;
- sr_session_send(ctx->session_id, &packet);
+ sr_session_send(ctx->session_dev_id, &packet);
}
*lastsample = samples[n - 1];
if (ctx->state.chunks_downloaded >= numchunks) {
/* End of samples. */
packet.type = SR_DF_END;
- sr_session_send(ctx->session_id, &packet);
+ sr_session_send(ctx->session_dev_id, &packet);
ctx->state.state = SIGMA_IDLE;
return SR_OK;
}
-static int hw_dev_acquisition_start(int dev_index, void *session_data)
+static int hw_dev_acquisition_start(int dev_index, void *cb_data)
{
struct sr_dev_inst *sdi;
struct context *ctx;
gettimeofday(&ctx->start_tv, 0);
sigma_set_register(WRITE_MODE, 0x0d, ctx);
- ctx->session_id = session_data;
+ ctx->session_dev_id = cb_data;
/* Send header packet to the session bus. */
packet.type = SR_DF_HEADER;
gettimeofday(&header.starttime, NULL);
header.samplerate = ctx->cur_samplerate;
header.num_logic_probes = ctx->num_probes;
- sr_session_send(session_data, &packet);
+ sr_session_send(ctx->session_dev_id, &packet);
/* Add capture source. */
sr_source_add(0, G_IO_IN, 10, receive_data, sdi);
return SR_OK;
}
-static int hw_dev_acquisition_stop(int dev_index, void *session_data)
+static int hw_dev_acquisition_stop(int dev_index, void *cb_data)
{
struct sr_dev_inst *sdi;
struct context *ctx;
uint8_t modestatus;
/* Avoid compiler warnings. */
- (void)session_data;
+ (void)cb_data;
if (!(sdi = sr_dev_inst_get(dev_insts, dev_index))) {
sr_err("sigma: %s: sdi was NULL", __func__);
struct sigma_trigger trigger;
int use_triggers;
struct sigma_state state;
- gpointer session_id;
+ void *session_dev_id;
};
#endif
uint64_t limit_samples;
/** TODO */
- gpointer session_id;
+ void *session_dev_id;
/**
* A buffer containing some (mangled) samples from the device.
/* Function prototypes. */
static int la8_close_usb_reset_sequencer(struct context *ctx);
-static int hw_dev_acquisition_stop(int dev_index, void *session_data);
+static int hw_dev_acquisition_stop(int dev_index, void *cb_data);
static int la8_reset(struct context *ctx);
static void fill_supported_samplerates_if_needed(void)
ctx->cur_samplerate = SR_MHZ(100); /* 100MHz == max. samplerate */
ctx->limit_msec = 0;
ctx->limit_samples = 0;
- ctx->session_id = NULL;
+ ctx->session_dev_id = NULL;
memset(ctx->mangled_buf, 0, BS);
ctx->final_buf = NULL;
ctx->trigger_pattern = 0x00; /* Value irrelevant, see trigger_mask. */
logic.length = BS;
logic.unitsize = 1;
logic.data = ctx->final_buf + (block * BS);
- sr_session_send(ctx->session_id, &packet);
+ sr_session_send(ctx->session_dev_id, &packet);
return;
}
logic.length = trigger_point;
logic.unitsize = 1;
logic.data = ctx->final_buf + (block * BS);
- sr_session_send(ctx->session_id, &packet);
+ sr_session_send(ctx->session_dev_id, &packet);
}
/* Send the SR_DF_TRIGGER packet to the session bus. */
(block * BS) + trigger_point);
packet.type = SR_DF_TRIGGER;
packet.payload = NULL;
- sr_session_send(ctx->session_id, &packet);
+ sr_session_send(ctx->session_dev_id, &packet);
/* If at least one sample is located after the trigger... */
if (trigger_point < (BS - 1)) {
logic.length = BS - trigger_point;
logic.unitsize = 1;
logic.data = ctx->final_buf + (block * BS) + trigger_point;
- sr_session_send(ctx->session_id, &packet);
+ sr_session_send(ctx->session_dev_id, &packet);
}
}
return TRUE;
}
-static int hw_dev_acquisition_start(int dev_index, void *session_data)
+static int hw_dev_acquisition_start(int dev_index, void *cb_data)
{
struct sr_dev_inst *sdi;
struct context *ctx;
sr_dbg("la8: Acquisition started successfully.");
- ctx->session_id = session_data;
+ ctx->session_dev_id = cb_data;
/* Send header packet to the session bus. */
sr_dbg("la8: Sending SR_DF_HEADER.");
gettimeofday(&header.starttime, NULL);
header.samplerate = ctx->cur_samplerate;
header.num_logic_probes = NUM_PROBES;
- sr_session_send(session_data, &packet);
+ sr_session_send(ctx->session_dev_id, &packet);
/* Time when we should be done (for detecting trigger timeouts). */
ctx->done = (ctx->divcount + 1) * 0.08388608 + time(NULL)
return SR_OK;
}
-static int hw_dev_acquisition_stop(int dev_index, void *session_data)
+static int hw_dev_acquisition_stop(int dev_index, void *cb_data)
{
struct sr_dev_inst *sdi;
struct context *ctx;
/* Send end packet to the session bus. */
sr_dbg("la8: Sending SR_DF_END.");
packet.type = SR_DF_END;
- sr_session_send(session_data, &packet);
+ sr_session_send(cb_data, &packet);
return SR_OK;
}
uint8_t thread_running;
uint64_t samples_counter;
int dev_index;
- gpointer session_data;
+ void *session_dev_id;
GTimer *timer;
};
static GThread *my_thread;
static int thread_running;
-static int hw_dev_acquisition_stop(int dev_index, void *session_data);
+static int hw_dev_acquisition_stop(int dev_index, void *cb_data);
static int hw_init(const char *devinfo)
{
return TRUE;
}
-static int hw_dev_acquisition_start(int dev_index, void *session_data)
+static int hw_dev_acquisition_start(int dev_index, void *cb_data)
{
struct sr_datafeed_packet *packet;
struct sr_datafeed_header *header;
}
mydata->sample_generator = default_pattern;
- mydata->session_data = session_data;
+ mydata->session_dev_id = cb_data;
mydata->dev_index = dev_index;
mydata->samples_counter = 0;
g_io_channel_set_buffered(channels[1], FALSE);
sr_source_add(mydata->pipe_fds[0], G_IO_IN | G_IO_ERR, 40,
- receive_data, session_data);
+ receive_data, mydata->session_dev_id);
/* Run the demo thread. */
g_thread_init(NULL);
gettimeofday(&header->starttime, NULL);
header->samplerate = cur_samplerate;
header->num_logic_probes = NUM_PROBES;
- sr_session_send(session_data, packet);
+ sr_session_send(mydata->session_dev_id, packet);
g_free(header);
g_free(packet);
return SR_OK;
}
-static int hw_dev_acquisition_stop(int dev_index, void *session_data)
+/* TODO: This stops acquisition on ALL devices, ignoring dev_index. */
+static int hw_dev_acquisition_stop(int dev_index, void *cb_data)
{
/* Avoid compiler warnings. */
(void)dev_index;
- (void)session_data;
+ (void)cb_data;
/* Stop generate thread. */
thread_running = 0;
* The FX2 gave up. End the acquisition, the frontend
* will work out that the samplecount is short.
*/
- hw_dev_acquisition_stop(-1, ctx->session_data);
+ hw_dev_acquisition_stop(-1, ctx->session_dev_id);
}
return;
} else {
logic.length = cur_buflen;
logic.unitsize = 1;
logic.data = cur_buf;
- sr_session_send(ctx->session_data, &packet);
+ sr_session_send(ctx->session_dev_id, &packet);
g_free(cur_buf);
num_samples += cur_buflen;
if (ctx->limit_samples &&
(unsigned int) num_samples > ctx->limit_samples) {
- hw_dev_acquisition_stop(-1, ctx->session_data);
+ hw_dev_acquisition_stop(-1, ctx->session_dev_id);
}
}
-static int hw_dev_acquisition_start(int dev_index, void *session_data)
+static int hw_dev_acquisition_start(int dev_index, void *cb_data)
{
struct sr_dev_inst *sdi;
struct sr_datafeed_packet *packet;
if (!(sdi = sr_dev_inst_get(dev_insts, dev_index)))
return SR_ERR;
ctx = sdi->priv;
- ctx->session_data = session_data;
+ ctx->session_dev_id = cb_data;
if (!(packet = g_try_malloc(sizeof(struct sr_datafeed_packet)))) {
sr_err("fx2lafw: %s: packet malloc failed", __func__);
gettimeofday(&header->starttime, NULL);
header->samplerate = 24000000UL;
header->num_logic_probes = ctx->profile->num_probes;
- sr_session_send(session_data, packet);
+ sr_session_send(session_dev_id, packet);
g_free(header);
g_free(packet);
return SR_OK;
}
-/* This stops acquisition on ALL devices, ignoring dev_index. */
-static int hw_dev_acquisition_stop(int dev_index, void *session_data)
+/* TODO: This stops acquisition on ALL devices, ignoring dev_index. */
+static int hw_dev_acquisition_stop(int dev_index, void *session_dev_id)
{
struct sr_datafeed_packet packet;
(void)dev_index;
packet.type = SR_DF_END;
- sr_session_send(session_data, &packet);
+ sr_session_send(session_dev_id, &packet);
receive_transfer(NULL);
/* Device/Capture Settings */
uint64_t limit_samples;
- void *session_data;
+ void *session_dev_id;
struct sr_usb_dev_inst *usb;
};
logic.length = 1024;
logic.unitsize = 1;
logic.data = logic_out;
- sr_session_send(ctx->session_id, &packet);
+ sr_session_send(ctx->session_dev_id, &packet);
// Dont bother fixing this yet, keep it "old style"
/*
packet.length = 1024;
packet.unitsize = sizeof(double);
packet.payload = analog_out;
- sr_session_send(ctx->session_id, &packet);
+ sr_session_send(ctx->session_dev_id, &packet);
*/
packet.type = SR_DF_END;
- sr_session_send(ctx->session_id, &packet);
+ sr_session_send(ctx->session_dev_id, &packet);
return TRUE;
}
-static int hw_dev_acquisition_start(int dev_index, void *session_dev_id)
+static int hw_dev_acquisition_start(int dev_index, void *cb_data)
{
struct sr_dev_inst *sdi;
struct context *ctx;
if (ret != SR_OK)
return ret;
- ctx->session_id = session_dev_id;
+ ctx->session_dev_id = cb_data;
sr_source_add(sdi->serial->fd, G_IO_IN, -1, receive_data, sdi);
packet.type = SR_DF_HEADER;
header.samplerate = ctx->cur_rate;
// header.num_analog_probes = 1;
header.num_logic_probes = 8;
- sr_session_send(session_dev_id, &packet);
+ sr_session_send(ctx->session_dev_id, &packet);
return ret;
}
-/* FIXME */
-static int hw_dev_acquisition_stop(int dev_index, void *session_dev_id)
+/* TODO: This stops acquisition on ALL devices, ignoring dev_index. */
+static int hw_dev_acquisition_stop(int dev_index, void *cb_data)
{
struct sr_datafeed_packet packet;
- dev_index = dev_index;
+ /* Avoid compiler warnings. */
+ (void)dev_index;
packet.type = SR_DF_END;
- sr_session_send(session_dev_id, &packet);
+ sr_session_send(cb_data, &packet);
return SR_OK;
}
double dso_trigger_voltage;
uint16_t dso_trigger_width;
struct mso_prototrig protocol_trigger;
- gpointer session_id;
+ void *session_dev_id;
uint16_t buffer_n;
char buffer[4096];
};
return TRUE;
}
-static int hw_dev_acquisition_start(int dev_index, void *session_data)
+static int hw_dev_acquisition_start(int dev_index, void *cb_data)
{
struct sr_datafeed_packet *packet;
struct sr_datafeed_header *header;
return SR_ERR;
sr_source_add(ctx->serial->fd, G_IO_IN, -1, receive_data,
- session_data);
+ cb_data);
if (!(packet = g_try_malloc(sizeof(struct sr_datafeed_packet)))) {
sr_err("ols: %s: packet malloc failed", __func__);
gettimeofday(&header->starttime, NULL);
header->samplerate = ctx->cur_samplerate;
header->num_logic_probes = NUM_PROBES;
- sr_session_send(session_data, packet);
+ sr_session_send(cb_data, packet);
g_free(header);
g_free(packet);
return SR_OK;
}
-static int hw_dev_acquisition_stop(int dev_index, void *session_dev_id)
+/* TODO: This stops acquisition on ALL devices, ignoring dev_index. */
+static int hw_dev_acquisition_stop(int dev_index, void *cb_data)
{
struct sr_datafeed_packet packet;
(void)dev_index;
packet.type = SR_DF_END;
- sr_session_send(session_dev_id, &packet);
+ sr_session_send(cb_data, &packet);
return SR_OK;
}
static int new_saleae_logic_firmware = 0;
static int hw_dev_config_set(int dev_index, int hwcap, void *value);
-static int hw_dev_acquisition_stop(int dev_index, void *session_dev_id);
+static int hw_dev_acquisition_stop(int dev_index, void *cb_data);
/**
* Check the USB configuration to determine if this is a Saleae Logic.
* The FX2 gave up. End the acquisition, the frontend
* will work out that the samplecount is short.
*/
- hw_dev_acquisition_stop(-1, ctx->session_data);
+ hw_dev_acquisition_stop(-1, ctx->session_dev_id);
}
return;
} else {
*/
packet.type = SR_DF_TRIGGER;
packet.payload = NULL;
- sr_session_send(ctx->session_data, &packet);
+ sr_session_send(ctx->session_dev_id, &packet);
/*
* Send the samples that triggered it, since we're
logic.length = ctx->trigger_stage;
logic.unitsize = 1;
logic.data = ctx->trigger_buffer;
- sr_session_send(ctx->session_data, &packet);
+ sr_session_send(ctx->session_dev_id, &packet);
ctx->trigger_stage = TRIGGER_FIRED;
break;
logic.length = cur_buflen - trigger_offset;
logic.unitsize = 1;
logic.data = cur_buf + trigger_offset;
- sr_session_send(ctx->session_data, &packet);
+ sr_session_send(ctx->session_dev_id, &packet);
g_free(cur_buf);
num_samples += cur_buflen;
if (ctx->limit_samples && (unsigned int) num_samples > ctx->limit_samples) {
- hw_dev_acquisition_stop(-1, ctx->session_data);
+ hw_dev_acquisition_stop(-1, ctx->session_dev_id);
}
} else {
/*
}
}
-static int hw_dev_acquisition_start(int dev_index, void *session_data)
+static int hw_dev_acquisition_start(int dev_index, void *cb_data)
{
struct sr_dev_inst *sdi;
struct sr_datafeed_packet *packet;
if (!(sdi = sr_dev_inst_get(dev_insts, dev_index)))
return SR_ERR;
ctx = sdi->priv;
- ctx->session_data = session_data;
+ ctx->session_dev_id = cb_data;
if (!(packet = g_try_malloc(sizeof(struct sr_datafeed_packet)))) {
sr_err("logic: %s: packet malloc failed", __func__);
gettimeofday(&header->starttime, NULL);
header->samplerate = ctx->cur_samplerate;
header->num_logic_probes = ctx->profile->num_probes;
- sr_session_send(session_data, packet);
+ sr_session_send(ctx->session_dev_id, packet);
g_free(header);
g_free(packet);
return SR_OK;
}
-/* This stops acquisition on ALL devices, ignoring dev_index. */
-static int hw_dev_acquisition_stop(int dev_index, void *session_data)
+/* TODO: This stops acquisition on ALL devices, ignoring dev_index. */
+static int hw_dev_acquisition_stop(int dev_index, void *cb_data)
{
struct sr_datafeed_packet packet;
(void)dev_index;
packet.type = SR_DF_END;
- sr_session_send(session_data, &packet);
+ sr_session_send(cb_data, &packet);
receive_transfer(NULL);
* opaque session data passed in by the frontend, will be passed back
* on the session bus along with samples.
*/
- void *session_data;
+ void *session_dev_id;
struct sr_usb_dev_inst *usb;
};
}
}
-static int hw_dev_acquisition_start(int dev_index, void *session_data)
+static int hw_dev_acquisition_start(int dev_index, void *cb_data)
{
struct sr_dev_inst *sdi;
struct sr_datafeed_packet packet;
gettimeofday(&header.starttime, NULL);
header.samplerate = ctx->cur_samplerate;
header.num_logic_probes = ctx->num_channels;
- sr_session_send(session_data, &packet);
+ sr_session_send(cb_data, &packet);
if (!(buf = g_try_malloc(PACKET_SIZE))) {
sr_err("zp: %s: buf malloc failed", __func__);
logic.length = PACKET_SIZE;
logic.unitsize = 4;
logic.data = buf;
- sr_session_send(session_data, &packet);
+ sr_session_send(cb_data, &packet);
samples_read += res / 4;
}
analyzer_read_stop(ctx->usb->devhdl);
g_free(buf);
packet.type = SR_DF_END;
- sr_session_send(session_data, &packet);
+ sr_session_send(cb_data, &packet);
return SR_OK;
}
-/* This stops acquisition on ALL devices, ignoring dev_index. */
-static int hw_dev_acquisition_stop(int dev_index, void *session_dev_id)
+/* TODO: This stops acquisition on ALL devices, ignoring dev_index. */
+static int hw_dev_acquisition_stop(int dev_index, void *cb_data)
{
struct sr_datafeed_packet packet;
struct sr_dev_inst *sdi;
struct context *ctx;
packet.type = SR_DF_END;
- sr_session_send(session_dev_id, &packet);
+ sr_session_send(cb_data, &packet);
if (!(sdi = sr_dev_inst_get(dev_insts, dev_index))) {
sr_err("zp: %s: sdi was NULL", __func__);