]> sigrok.org Git - libsigrok.git/commitdiff
sr: s/sr_session_bus/sr_session_send/.
authorUwe Hermann <redacted>
Wed, 29 Feb 2012 21:08:45 +0000 (22:08 +0100)
committerUwe Hermann <redacted>
Thu, 1 Mar 2012 22:49:25 +0000 (23:49 +0100)
14 files changed:
hardware/alsa/alsa.c
hardware/asix-sigma/asix-sigma.c
hardware/chronovu-la8/chronovu-la8.c
hardware/demo/demo.c
hardware/fx2lafw/fx2lafw.c
hardware/link-mso19/link-mso19.c
hardware/openbench-logic-sniffer/ols.c
hardware/saleae-logic/saleae-logic.c
hardware/zeroplus-logic-cube/zeroplus.c
input/binary.c
input/chronovu_la8.c
session.c
session_driver.c
sigrok-internal.h

index ba918b93c0e2440995d430b49abd11c5d231fad6..c1a1ea316e70440408177e87b7762ee0227624a2 100644 (file)
@@ -281,14 +281,14 @@ static int receive_data(int fd, int revents, void *user_data)
                packet.length = count * sample_size;
                packet.unitsize = sample_size;
                packet.payload = outb;
-               sr_session_bus(user_data, &packet);
+               sr_session_send(user_data, &packet);
                g_free(outb);
                ctx->limit_samples -= count;
 
        } while (ctx->limit_samples > 0);
 
        packet.type = SR_DF_END;
-       sr_session_bus(user_data, &packet);
+       sr_session_send(user_data, &packet);
 
        return TRUE;
 }
@@ -380,7 +380,7 @@ static int hw_dev_acquisition_start(int dev_index, gpointer session_dev_id)
        header.num_analog_probes = NUM_PROBES;
        header.num_logic_probes = 0;
        header.protocol_id = SR_PROTO_RAW;
-       sr_session_bus(session_dev_id, &packet);
+       sr_session_send(session_dev_id, &packet);
        g_free(ufds);
 
        return SR_OK;
index a1f0a8ce91b8c063bcbc92a3a4c766521a0a8217..0f99a352d86ea377919848a0ae2481b4deee63dc 100644 (file)
@@ -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_bus(ctx->session_id, &packet);
+                       sr_session_send(ctx->session_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_bus(ctx->session_id, &packet);
+                               sr_session_send(ctx->session_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_bus(ctx->session_id, &packet);
+                               sr_session_send(ctx->session_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_bus(ctx->session_id, &packet);
+                       sr_session_send(ctx->session_id, &packet);
                }
 
                *lastsample = samples[n - 1];
@@ -1044,7 +1044,7 @@ static int receive_data(int fd, int revents, void *session_data)
                if (ctx->state.chunks_downloaded >= numchunks) {
                        /* End of samples. */
                        packet.type = SR_DF_END;
-                       sr_session_bus(ctx->session_id, &packet);
+                       sr_session_send(ctx->session_id, &packet);
 
                        ctx->state.state = SIGMA_IDLE;
 
@@ -1361,7 +1361,7 @@ static int hw_dev_acquisition_start(int dev_index, gpointer session_data)
        gettimeofday(&header.starttime, NULL);
        header.samplerate = ctx->cur_samplerate;
        header.num_logic_probes = ctx->num_probes;
-       sr_session_bus(session_data, &packet);
+       sr_session_send(session_data, &packet);
 
        /* Add capture source. */
        sr_source_add(0, G_IO_IN, 10, receive_data, sdi);
index ab206e9339fcca39b278616e8f25fba6517a11d5..32fcf5cfd840e601b900e4dd1d5061a75279e19f 100644 (file)
@@ -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_bus(ctx->session_id, &packet);
+               sr_session_send(ctx->session_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_bus(ctx->session_id, &packet);
+               sr_session_send(ctx->session_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_bus(ctx->session_id, &packet);
+       sr_session_send(ctx->session_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_bus(ctx->session_id, &packet);
+               sr_session_send(ctx->session_id, &packet);
        }
 }
 
@@ -1071,7 +1071,7 @@ static int hw_dev_acquisition_start(int dev_index, gpointer session_data)
        gettimeofday(&header.starttime, NULL);
        header.samplerate = ctx->cur_samplerate;
        header.num_logic_probes = NUM_PROBES;
-       sr_session_bus(session_data, &packet);
+       sr_session_send(session_data, &packet);
 
        /* Time when we should be done (for detecting trigger timeouts). */
        ctx->done = (ctx->divcount + 1) * 0.08388608 + time(NULL)
@@ -1106,7 +1106,7 @@ static int hw_dev_acquisition_stop(int dev_index, gpointer session_data)
        /* Send end packet to the session bus. */
        sr_dbg("la8: Sending SR_DF_END.");
        packet.type = SR_DF_END;
-       sr_session_bus(session_data, &packet);
+       sr_session_send(session_data, &packet);
 
        return SR_OK;
 }
index 710c1fcc2b231aafcf275c0172f1b58a3b259d03..41932a6cf5497d51031d6709ef1e7bb102928d59 100644 (file)
@@ -390,7 +390,7 @@ static int receive_data(int fd, int revents, void *session_data)
                        logic.length = z;
                        logic.unitsize = 1;
                        logic.data = c;
-                       sr_session_bus(session_data, &packet);
+                       sr_session_send(session_data, &packet);
                        samples_received += z;
                }
        } while (z > 0);
@@ -401,7 +401,7 @@ static int receive_data(int fd, int revents, void *session_data)
 
                /* Send last packet. */
                packet.type = SR_DF_END;
-               sr_session_bus(session_data, &packet);
+               sr_session_send(session_data, &packet);
 
                return FALSE;
        }
@@ -474,7 +474,7 @@ static int hw_dev_acquisition_start(int dev_index, gpointer session_data)
        gettimeofday(&header->starttime, NULL);
        header->samplerate = cur_samplerate;
        header->num_logic_probes = NUM_PROBES;
-       sr_session_bus(session_data, packet);
+       sr_session_send(session_data, packet);
        g_free(header);
        g_free(packet);
 
index 720e99f7bbfd07e869f46336c4455739d313c746..af7b2f06c7a2b2a9689ceac25470bb1808f2471f 100644 (file)
@@ -565,7 +565,7 @@ 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_data, &packet);
        g_free(cur_buf);
 
        num_samples += cur_buflen;
@@ -633,7 +633,7 @@ 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_data, packet);
        g_free(header);
        g_free(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_data, &packet);
 
        receive_transfer(NULL);
 
index 8c972d06a2d9346e898429dd3185adb88d1c05ec..38647b8fbc59d2c7a8f6a6452bd4fe877da9e1eb 100644 (file)
@@ -731,7 +731,7 @@ static int receive_data(int fd, int revents, void *user_data)
        logic.length = 1024;
        logic.unitsize = 1;
        logic.data = logic_out;
-       sr_session_bus(ctx->session_id, &packet);
+       sr_session_send(ctx->session_id, &packet);
 
        // Dont bother fixing this yet, keep it "old style"
        /*
@@ -739,11 +739,11 @@ static int receive_data(int fd, int revents, void *user_data)
        packet.length = 1024;
        packet.unitsize = sizeof(double);
        packet.payload = analog_out;
-       sr_session_bus(ctx->session_id, &packet);
+       sr_session_send(ctx->session_id, &packet);
        */
 
        packet.type = SR_DF_END;
-       sr_session_bus(ctx->session_id, &packet);
+       sr_session_send(ctx->session_id, &packet);
 
        return TRUE;
 }
@@ -816,7 +816,7 @@ static int hw_dev_acquisition_start(int dev_index, gpointer session_dev_id)
        header.samplerate = ctx->cur_rate;
        // header.num_analog_probes = 1;
        header.num_logic_probes = 8;
-       sr_session_bus(session_dev_id, &packet);
+       sr_session_send(session_dev_id, &packet);
 
        return ret;
 }
@@ -829,7 +829,7 @@ static int hw_dev_acquisition_stop(int dev_index, gpointer session_dev_id)
        dev_index = dev_index;
 
        packet.type = SR_DF_END;
-       sr_session_bus(session_dev_id, &packet);
+       sr_session_send(session_dev_id, &packet);
 
        return SR_OK;
 }
index 9579222b60453d61b869859437ac212aa3b89c7d..91bfc40d82ab0a6b18b896fd323f3679f631edfa 100644 (file)
@@ -834,12 +834,12 @@ static int receive_data(int fd, int revents, void *session_data)
                                logic.unitsize = 4;
                                logic.data = ctx->raw_sample_buf +
                                        (ctx->limit_samples - ctx->num_samples) * 4;
-                               sr_session_bus(session_data, &packet);
+                               sr_session_send(session_data, &packet);
                        }
 
                        /* send the trigger */
                        packet.type = SR_DF_TRIGGER;
-                       sr_session_bus(session_data, &packet);
+                       sr_session_send(session_data, &packet);
 
                        /* send post-trigger samples */
                        packet.type = SR_DF_LOGIC;
@@ -848,7 +848,7 @@ static int receive_data(int fd, int revents, void *session_data)
                        logic.unitsize = 4;
                        logic.data = ctx->raw_sample_buf + ctx->trigger_at * 4 +
                                (ctx->limit_samples - ctx->num_samples) * 4;
-                       sr_session_bus(session_data, &packet);
+                       sr_session_send(session_data, &packet);
                } else {
                        /* no trigger was used */
                        packet.type = SR_DF_LOGIC;
@@ -857,14 +857,14 @@ static int receive_data(int fd, int revents, void *session_data)
                        logic.unitsize = 4;
                        logic.data = ctx->raw_sample_buf +
                                (ctx->limit_samples - ctx->num_samples) * 4;
-                       sr_session_bus(session_data, &packet);
+                       sr_session_send(session_data, &packet);
                }
                g_free(ctx->raw_sample_buf);
 
                serial_flush(fd);
                serial_close(fd);
                packet.type = SR_DF_END;
-               sr_session_bus(session_data, &packet);
+               sr_session_send(session_data, &packet);
        }
 
        return TRUE;
@@ -1015,7 +1015,7 @@ static int hw_dev_acquisition_start(int dev_index, gpointer session_data)
        gettimeofday(&header->starttime, NULL);
        header->samplerate = ctx->cur_samplerate;
        header->num_logic_probes = NUM_PROBES;
-       sr_session_bus(session_data, packet);
+       sr_session_send(session_data, packet);
 
        g_free(header);
        g_free(packet);
@@ -1031,7 +1031,7 @@ static int hw_dev_acquisition_stop(int dev_index, gpointer session_dev_id)
        (void)dev_index;
 
        packet.type = SR_DF_END;
-       sr_session_bus(session_dev_id, &packet);
+       sr_session_send(session_dev_id, &packet);
 
        return SR_OK;
 }
index 5e584e46b3b941332a3c2b6aef57669f74a07736..12d28d0a8db5ad3d7e6bb2f90b3f12640bf16123 100644 (file)
@@ -752,7 +752,7 @@ static void receive_transfer(struct libusb_transfer *transfer)
                                         */
                                        packet.type = SR_DF_TRIGGER;
                                        packet.payload = NULL;
-                                       sr_session_bus(ctx->session_data, &packet);
+                                       sr_session_send(ctx->session_data, &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_bus(ctx->session_data, &packet);
+                                       sr_session_send(ctx->session_data, &packet);
 
                                        ctx->trigger_stage = TRIGGER_FIRED;
                                        break;
@@ -795,7 +795,7 @@ 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_bus(ctx->session_data, &packet);
+               sr_session_send(ctx->session_data, &packet);
                g_free(cur_buf);
 
                num_samples += cur_buflen;
@@ -868,7 +868,7 @@ static int hw_dev_acquisition_start(int dev_index, gpointer session_data)
        gettimeofday(&header->starttime, NULL);
        header->samplerate = ctx->cur_samplerate;
        header->num_logic_probes = ctx->profile->num_probes;
-       sr_session_bus(session_data, packet);
+       sr_session_send(session_data, packet);
        g_free(header);
        g_free(packet);
 
@@ -884,7 +884,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_data, &packet);
 
        receive_transfer(NULL);
 
index db717f65e0a8175da79110d083790b978bfdc60c..68acaaa5e3a105deec1fe30a5b8353052f6cda8d 100644 (file)
@@ -655,7 +655,7 @@ static int hw_dev_acquisition_start(int dev_index, gpointer session_data)
        gettimeofday(&header.starttime, NULL);
        header.samplerate = ctx->cur_samplerate;
        header.num_logic_probes = ctx->num_channels;
-       sr_session_bus(session_data, &packet);
+       sr_session_send(session_data, &packet);
 
        if (!(buf = g_try_malloc(PACKET_SIZE))) {
                sr_err("zp: %s: buf malloc failed", __func__);
@@ -676,14 +676,14 @@ static int hw_dev_acquisition_start(int dev_index, gpointer session_data)
                logic.length = PACKET_SIZE;
                logic.unitsize = 4;
                logic.data = buf;
-               sr_session_bus(session_data, &packet);
+               sr_session_send(session_data, &packet);
                samples_read += res / 4;
        }
        analyzer_read_stop(ctx->usb->devhdl);
        g_free(buf);
 
        packet.type = SR_DF_END;
-       sr_session_bus(session_data, &packet);
+       sr_session_send(session_data, &packet);
 
        return SR_OK;
 }
@@ -696,7 +696,7 @@ static int hw_dev_acquisition_stop(int dev_index, gpointer session_dev_id)
        struct context *ctx;
 
        packet.type = SR_DF_END;
-       sr_session_bus(session_dev_id, &packet);
+       sr_session_send(session_dev_id, &packet);
 
        if (!(sdi = sr_dev_inst_get(dev_insts, dev_index))) {
                sr_err("zp: %s: sdi was NULL", __func__);
index 9a87d3e2cf929dd0e340543fd04cfe232e2dabc5..89a6b25bb9cbfb73289df0e53c6b385a2976a007 100644 (file)
@@ -83,7 +83,7 @@ static int loadfile(struct sr_input *in, const char *filename)
        gettimeofday(&header.starttime, NULL);
        packet.type = SR_DF_HEADER;
        packet.payload = &header;
-       sr_session_bus(in->vdev, &packet);
+       sr_session_send(in->vdev, &packet);
 
        /* chop up the input file into chunks and feed it into the session bus */
        packet.type = SR_DF_LOGIC;
@@ -92,13 +92,13 @@ static int loadfile(struct sr_input *in, const char *filename)
        logic.data = buffer;
        while ((size = read(fd, buffer, CHUNKSIZE)) > 0) {
                logic.length = size;
-               sr_session_bus(in->vdev, &packet);
+               sr_session_send(in->vdev, &packet);
        }
        close(fd);
 
        /* end of stream */
        packet.type = SR_DF_END;
-       sr_session_bus(in->vdev, &packet);
+       sr_session_send(in->vdev, &packet);
 
        return SR_OK;
 }
index af6a80c7860223c7aa938a9333c322c230081846..23a8dc09c890e0bdb3d30cc164931c07a7bc14ef 100644 (file)
@@ -139,7 +139,7 @@ static int loadfile(struct sr_input *in, const char *filename)
        gettimeofday(&header.starttime, NULL);
        header.num_logic_probes = num_probes;
        header.samplerate = samplerate;
-       sr_session_bus(in->vdev, &packet);
+       sr_session_send(in->vdev, &packet);
 
        /* TODO: Handle trigger point. */
 
@@ -155,7 +155,7 @@ static int loadfile(struct sr_input *in, const char *filename)
                /* TODO: Handle errors, handle incomplete reads. */
                size = read(fd, buf, PACKET_SIZE);
                logic.length = size;
-               sr_session_bus(in->vdev, &packet);
+               sr_session_send(in->vdev, &packet);
        }
        close(fd); /* FIXME */
 
@@ -163,7 +163,7 @@ static int loadfile(struct sr_input *in, const char *filename)
        sr_dbg("la8 in: %s: sending SR_DF_END", __func__);
        packet.type = SR_DF_END;
        packet.payload = NULL;
-       sr_session_bus(in->vdev, &packet);
+       sr_session_send(in->vdev, &packet);
 
        return SR_OK;
 }
index f7af9f882923d2d9a910377ac84b2346e0f7382c..06d4a3b4f68bdfec6d10616632f663bb0f597f2e 100644 (file)
--- a/session.c
+++ b/session.c
@@ -419,12 +419,12 @@ static void datafeed_dump(struct sr_datafeed_packet *packet)
  * Hardware drivers use this to send a data packet to the frontend.
  *
  * @param dev TODO.
- * @param packet TODO.
+ * @param packet The datafeed packet to send to the session bus.
  *
  * @return SR_OK upon success, SR_ERR_ARG upon invalid arguments.
  */
-SR_PRIV int sr_session_bus(struct sr_dev *dev,
-                          struct sr_datafeed_packet *packet)
+SR_PRIV int sr_session_send(struct sr_dev *dev,
+                           struct sr_datafeed_packet *packet)
 {
        GSList *l;
        sr_datafeed_callback_t cb;
index d5f9d5549b7577772f5e286bd092cfea9d25f965..34b79ba8090a4bbbd93b4733b7140062e9dac22d 100644 (file)
@@ -120,7 +120,7 @@ static int feed_chunk(int fd, int revents, void *session_data)
                        logic.unitsize = vdev->unitsize;
                        logic.data = buf;
                        vdev->bytes_read += ret;
-                       sr_session_bus(session_data, &packet);
+                       sr_session_send(session_data, &packet);
                } else {
                        /* done with this capture file */
                        zip_fclose(vdev->capfile);
@@ -132,7 +132,7 @@ static int feed_chunk(int fd, int revents, void *session_data)
 
        if (!got_data) {
                packet.type = SR_DF_END;
-               sr_session_bus(session_data, &packet);
+               sr_session_send(session_data, &packet);
        }
 
        return TRUE;
@@ -324,7 +324,7 @@ static int hw_dev_acquisition_start(int dev_index, gpointer session_dev_id)
        gettimeofday(&header->starttime, NULL);
        header->samplerate = vdev->samplerate;
        header->num_logic_probes = vdev->num_probes;
-       sr_session_bus(session_dev_id, packet);
+       sr_session_send(session_dev_id, packet);
        g_free(header);
        g_free(packet);
 
index 07501266dabdcc3e853a2348e67e653a1081a806..62b7bac9bceae4aed10b1368f42e34f6b749c6e8 100644 (file)
@@ -82,8 +82,8 @@ SR_PRIV void sr_hw_cleanup_all(void);
 
 /*--- session.c -------------------------------------------------------------*/
 
-SR_PRIV int sr_session_bus(struct sr_dev *dev,
-                          struct sr_datafeed_packet *packet);
+SR_PRIV int sr_session_send(struct sr_dev *dev,
+                           struct sr_datafeed_packet *packet);
 
 /* Generic device instances */
 SR_PRIV struct sr_dev_inst *sr_dev_inst_new(int index, int status,