static GSList *dev_insts = NULL;
static libusb_context *usb_context = NULL;
-static int hw_dev_acquisition_stop(int dev_index, gpointer session_dev_id);
+static int hw_dev_acquisition_stop(int dev_index, void *session_dev_id);
/**
* Check the USB configuration to determine if this is an fx2lafw device.
if (!(sdi = sr_dev_inst_get(dev_insts, dev_index))) {
sr_err("fx2lafw: %s: sdi was NULL", __func__);
- return SR_ERR; /* TODO: SR_ERR_ARG? */
+ return SR_ERR_BUG;
}
/* TODO */
return ret;
}
-static int receive_data(int fd, int revents, void *user_data)
+static int receive_data(int fd, int revents, void *cb_data)
{
struct timeval tv;
/* Avoid compiler warnings. */
(void)fd;
(void)revents;
- (void)user_data;
+ (void)cb_data;
tv.tv_sec = tv.tv_usec = 0;
libusb_handle_events_timeout(usb_context, &tv);
* 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_bus(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, gpointer 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_bus(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, gpointer 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_bus(session_data, &packet);
+ sr_session_send(session_dev_id, &packet);
receive_transfer(NULL);