]> sigrok.org Git - libsigrok.git/commitdiff
sr: More callback param renames.
authorUwe Hermann <redacted>
Sat, 3 Mar 2012 08:56:49 +0000 (09:56 +0100)
committerUwe Hermann <redacted>
Sun, 4 Mar 2012 14:10:09 +0000 (15:10 +0100)
Start/stop acquisition callbacks: Consistently name the 'void *' parameter
cb_data for now. The per-device-instance device pointer is called
'session_dev_id' everywhere for now, but this should be renamed to
something more clear.

13 files changed:
hardware/alsa/alsa.c
hardware/asix-sigma/asix-sigma.c
hardware/asix-sigma/asix-sigma.h
hardware/chronovu-la8/chronovu-la8.c
hardware/demo/demo.c
hardware/fx2lafw/fx2lafw.c
hardware/fx2lafw/fx2lafw.h
hardware/link-mso19/link-mso19.c
hardware/link-mso19/link-mso19.h
hardware/openbench-logic-sniffer/ols.c
hardware/saleae-logic/saleae-logic.c
hardware/saleae-logic/saleae-logic.h
hardware/zeroplus-logic-cube/zeroplus.c

index d915f05830493a53ab9f7f9b56dcafd748b7b937..940dce993eb9fa0c25beefaa04f82c5309128420 100644 (file)
@@ -63,7 +63,7 @@ struct context {
        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)
@@ -293,7 +293,7 @@ static int receive_data(int fd, int revents, void *cb_data)
        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;
@@ -368,7 +368,7 @@ static int hw_dev_acquisition_start(int dev_index, void *session_dev_id)
                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;
@@ -380,17 +380,18 @@ static int hw_dev_acquisition_start(int dev_index, void *session_dev_id)
        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;
 }
index bffe106c5bcb669e6811f97d9df330176f16991a..6527b00369cf54f0d1c70f97ebaaa820b57b3a44 100644 (file)
@@ -123,7 +123,7 @@ static const char *firmware_files[] = {
        "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)
 {
@@ -879,9 +879,9 @@ static int get_trigger_offset(uint16_t *samples, uint16_t last_sample,
  */
 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];
@@ -935,7 +935,7 @@ static int decode_chunk_ts(uint8_t *buf, uint16_t *lastts,
                        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;
                }
@@ -978,7 +978,7 @@ static int decode_chunk_ts(uint8_t *buf, uint16_t *lastts,
                                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;
                        }
@@ -986,7 +986,7 @@ static int decode_chunk_ts(uint8_t *buf, uint16_t *lastts,
                        /* 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);
                        }
                }
 
@@ -999,7 +999,7 @@ static int decode_chunk_ts(uint8_t *buf, uint16_t *lastts,
                        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];
@@ -1044,7 +1044,7 @@ static int receive_data(int fd, int revents, void *cb_data)
                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;
 
@@ -1254,7 +1254,7 @@ static int build_basic_trigger(struct triggerlut *lut, struct context *ctx)
        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;
@@ -1349,7 +1349,7 @@ static int hw_dev_acquisition_start(int dev_index, void *session_data)
        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;
@@ -1358,7 +1358,7 @@ static int hw_dev_acquisition_start(int dev_index, void *session_data)
        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);
@@ -1368,14 +1368,14 @@ static int hw_dev_acquisition_start(int dev_index, void *session_data)
        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__);
index c65a8eb0469558e3bc269f10bbd15ee1dd87e27a..dd601bd48a088d507337345299de1771291626b6 100644 (file)
@@ -187,7 +187,7 @@ struct context {
        struct sigma_trigger trigger;
        int use_triggers;
        struct sigma_state state;
-       gpointer session_id;
+       void *session_dev_id;
 };
 
 #endif
index 717e723feaa01ec1a1b34fb35d8e6a09deafdb75..da91858f7908f32ef4ac6ff2b704b5af4b0323ef 100644 (file)
@@ -70,7 +70,7 @@ struct context {
        uint64_t limit_samples;
 
        /** TODO */
-       gpointer session_id;
+       void *session_dev_id;
 
        /**
         * A buffer containing some (mangled) samples from the device.
@@ -138,7 +138,7 @@ static int hwcaps[] = {
 
 /* 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)
@@ -479,7 +479,7 @@ static int hw_init(const char *devinfo)
        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. */
@@ -912,7 +912,7 @@ static void send_block_to_session_bus(struct context *ctx, int block)
                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;
        }
 
@@ -935,7 +935,7 @@ static void send_block_to_session_bus(struct context *ctx, int block)
                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. */
@@ -943,7 +943,7 @@ static void send_block_to_session_bus(struct context *ctx, int block)
                (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)) {
@@ -956,7 +956,7 @@ static void send_block_to_session_bus(struct context *ctx, int block)
                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);
        }
 }
 
@@ -1010,7 +1010,7 @@ static int receive_data(int fd, int revents, void *cb_data)
        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;
@@ -1061,7 +1061,7 @@ static int hw_dev_acquisition_start(int dev_index, void *session_data)
 
        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.");
@@ -1071,7 +1071,7 @@ static int hw_dev_acquisition_start(int dev_index, void *session_data)
        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)
@@ -1085,7 +1085,7 @@ static int hw_dev_acquisition_start(int dev_index, void *session_data)
        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;
@@ -1106,7 +1106,7 @@ static int hw_dev_acquisition_stop(int dev_index, void *session_data)
        /* 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;
 }
index 583dc0ee2b0962e25feafd54d4df5a3349f09878..e43613843a077970e00220d99e1e25508e97c058 100644 (file)
@@ -72,7 +72,7 @@ struct databag {
        uint8_t thread_running;
        uint64_t samples_counter;
        int dev_index;
-       gpointer session_data;
+       void *session_dev_id;
        GTimer *timer;
 };
 
@@ -138,7 +138,7 @@ static int default_pattern = PATTERN_SIGROK;
 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)
 {
@@ -409,7 +409,7 @@ static int receive_data(int fd, int revents, void *cb_data)
        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;
@@ -422,7 +422,7 @@ static int hw_dev_acquisition_start(int dev_index, void *session_data)
        }
 
        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;
 
@@ -444,7 +444,7 @@ static int hw_dev_acquisition_start(int dev_index, void *session_data)
        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);
@@ -474,18 +474,19 @@ static int hw_dev_acquisition_start(int dev_index, void *session_data)
        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;
index cc2ce0d450acc11fd0421e1ab415a6d1499ba3bb..c40285aba4a95c2a4af8a2eced69bf603d471573 100644 (file)
@@ -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_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;
@@ -589,7 +589,7 @@ static int hw_dev_acquisition_start(int dev_index, void *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, void *session_data)
        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;
 
@@ -649,7 +649,7 @@ static int hw_dev_acquisition_stop(int dev_index, void *session_data)
        (void)dev_index;
 
        packet.type = SR_DF_END;
-       sr_session_send(session_data, &packet);
+       sr_session_send(session_dev_id, &packet);
 
        receive_transfer(NULL);
 
index 76196205cc0d700b947bec85c3ddec02a8f06b89..4b830cd00f265d0162f9bf07fa7b4f2acd5d3b0b 100644 (file)
@@ -57,7 +57,7 @@ struct context {
        /* Device/Capture Settings */
        uint64_t limit_samples;
 
-       void *session_data;
+       void *session_dev_id;
 
        struct sr_usb_dev_inst *usb;
 };
index 0e44338f04f84bd87d5d51817f1c174600a5c0c2..1993e073732f12647087129402fceb6c2a1dab6e 100644 (file)
@@ -731,7 +731,7 @@ static int receive_data(int fd, int revents, void *cb_data)
        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"
        /*
@@ -739,16 +739,16 @@ static int receive_data(int fd, int revents, void *cb_data)
        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;
@@ -806,7 +806,7 @@ static int hw_dev_acquisition_start(int dev_index, void *session_dev_id)
        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;
@@ -816,20 +816,21 @@ static int hw_dev_acquisition_start(int dev_index, void *session_dev_id)
        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;
 }
index 13215f66eb13fb18fd1472f04556c455d66fc65c..53112bef320081aa43ea3794c81b875c8d1bdca6 100644 (file)
@@ -78,7 +78,7 @@ struct mso {
        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];
 };
index 074958cf2fa8defc52cc34f3adfe2cd592212d69..a3c65b7c28a4dc585c83c201bcebda2e3a5e33fc 100644 (file)
@@ -870,7 +870,7 @@ static int receive_data(int fd, int revents, void *cb_data)
        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;
@@ -995,7 +995,7 @@ static int hw_dev_acquisition_start(int dev_index, void *session_data)
                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__);
@@ -1015,7 +1015,7 @@ static int hw_dev_acquisition_start(int dev_index, void *session_data)
        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);
@@ -1023,7 +1023,8 @@ static int hw_dev_acquisition_start(int dev_index, void *session_data)
        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;
 
@@ -1031,7 +1032,7 @@ static int hw_dev_acquisition_stop(int dev_index, void *session_dev_id)
        (void)dev_index;
 
        packet.type = SR_DF_END;
-       sr_session_send(session_dev_id, &packet);
+       sr_session_send(cb_data, &packet);
 
        return SR_OK;
 }
index 7ab68e0219f30a589853594e53cf893c424ed67f..ebe02b062d41e115c0953f938acd3e8ecb42f15c 100644 (file)
@@ -100,7 +100,7 @@ static libusb_context *usb_context = NULL;
 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.
@@ -726,7 +726,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 {
@@ -752,7 +752,7 @@ static void receive_transfer(struct libusb_transfer *transfer)
                                         */
                                        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
@@ -763,7 +763,7 @@ static void receive_transfer(struct libusb_transfer *transfer)
                                        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;
@@ -795,12 +795,12 @@ static void receive_transfer(struct libusb_transfer *transfer)
                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 {
                /*
@@ -810,7 +810,7 @@ static void receive_transfer(struct libusb_transfer *transfer)
        }
 }
 
-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;
@@ -824,7 +824,7 @@ static int hw_dev_acquisition_start(int dev_index, void *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("logic: %s: packet malloc failed", __func__);
@@ -868,15 +868,15 @@ static int hw_dev_acquisition_start(int dev_index, void *session_data)
        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;
 
@@ -884,7 +884,7 @@ static int hw_dev_acquisition_stop(int dev_index, void *session_data)
        (void)dev_index;
 
        packet.type = SR_DF_END;
-       sr_session_send(session_data, &packet);
+       sr_session_send(cb_data, &packet);
 
        receive_transfer(NULL);
 
index e4876d3beb1e206e0979d7db0cb788f381a89b66..5c0b34a28d72947444b39a768dc8a27c2a320095 100644 (file)
@@ -69,7 +69,7 @@ struct context {
         * 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;
 };
index 3382c907792674076974c1b572f79bb73b2722f7..f51f918311d445f32c8036af9fb2178f3bf7d1e4 100644 (file)
@@ -613,7 +613,7 @@ static int hw_dev_config_set(int dev_index, int hwcap, void *value)
        }
 }
 
-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;
@@ -655,7 +655,7 @@ static int hw_dev_acquisition_start(int dev_index, void *session_data)
        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__);
@@ -676,27 +676,27 @@ static int hw_dev_acquisition_start(int dev_index, void *session_data)
                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__);