X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=hardware%2Ffx2lafw%2Ffx2lafw.c;h=d0834dedb870dcfb169456c4dce30c0a6cd7a79e;hb=0abee5076fd7751bd77d0fee940d617a1a40ea34;hp=720e99f7bbfd07e869f46336c4455739d313c746;hpb=c09f0b578c0e9c03590cb814f66004bb3f6815ff;p=libsigrok.git diff --git a/hardware/fx2lafw/fx2lafw.c b/hardware/fx2lafw/fx2lafw.c index 720e99f7..d0834ded 100644 --- a/hardware/fx2lafw/fx2lafw.c +++ b/hardware/fx2lafw/fx2lafw.c @@ -77,7 +77,7 @@ static struct sr_samplerates fx2lafw_samplerates = { 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. @@ -377,7 +377,7 @@ static int hw_dev_close(int dev_index) 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 */ @@ -483,14 +483,14 @@ static int hw_dev_config_set(int dev_index, int hwcap, void *value) 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); @@ -552,7 +552,7 @@ static void receive_transfer(struct libusb_transfer *transfer) * 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 { @@ -565,17 +565,17 @@ static void receive_transfer(struct libusb_transfer *transfer) 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; @@ -589,7 +589,7 @@ static int hw_dev_acquisition_start(int dev_index, gpointer session_data) 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__); @@ -633,15 +633,15 @@ static int hw_dev_acquisition_start(int dev_index, gpointer session_data) 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; @@ -649,7 +649,7 @@ static int hw_dev_acquisition_stop(int dev_index, gpointer session_data) (void)dev_index; packet.type = SR_DF_END; - sr_session_bus(session_data, &packet); + sr_session_send(session_dev_id, &packet); receive_transfer(NULL);