From: Uwe Hermann Date: Wed, 29 Feb 2012 21:08:45 +0000 (+0100) Subject: sr: s/sr_session_bus/sr_session_send/. X-Git-Tag: libsigrok-0.1.0~71 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=31ccebc4925d245fed02545415ce3ee14055d897;p=libsigrok.git sr: s/sr_session_bus/sr_session_send/. --- diff --git a/hardware/alsa/alsa.c b/hardware/alsa/alsa.c index ba918b93..c1a1ea31 100644 --- a/hardware/alsa/alsa.c +++ b/hardware/alsa/alsa.c @@ -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; diff --git a/hardware/asix-sigma/asix-sigma.c b/hardware/asix-sigma/asix-sigma.c index a1f0a8ce..0f99a352 100644 --- a/hardware/asix-sigma/asix-sigma.c +++ b/hardware/asix-sigma/asix-sigma.c @@ -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); diff --git a/hardware/chronovu-la8/chronovu-la8.c b/hardware/chronovu-la8/chronovu-la8.c index ab206e93..32fcf5cf 100644 --- a/hardware/chronovu-la8/chronovu-la8.c +++ b/hardware/chronovu-la8/chronovu-la8.c @@ -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; } diff --git a/hardware/demo/demo.c b/hardware/demo/demo.c index 710c1fcc..41932a6c 100644 --- a/hardware/demo/demo.c +++ b/hardware/demo/demo.c @@ -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); diff --git a/hardware/fx2lafw/fx2lafw.c b/hardware/fx2lafw/fx2lafw.c index 720e99f7..af7b2f06 100644 --- a/hardware/fx2lafw/fx2lafw.c +++ b/hardware/fx2lafw/fx2lafw.c @@ -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); diff --git a/hardware/link-mso19/link-mso19.c b/hardware/link-mso19/link-mso19.c index 8c972d06..38647b8f 100644 --- a/hardware/link-mso19/link-mso19.c +++ b/hardware/link-mso19/link-mso19.c @@ -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; } diff --git a/hardware/openbench-logic-sniffer/ols.c b/hardware/openbench-logic-sniffer/ols.c index 9579222b..91bfc40d 100644 --- a/hardware/openbench-logic-sniffer/ols.c +++ b/hardware/openbench-logic-sniffer/ols.c @@ -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; } diff --git a/hardware/saleae-logic/saleae-logic.c b/hardware/saleae-logic/saleae-logic.c index 5e584e46..12d28d0a 100644 --- a/hardware/saleae-logic/saleae-logic.c +++ b/hardware/saleae-logic/saleae-logic.c @@ -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); diff --git a/hardware/zeroplus-logic-cube/zeroplus.c b/hardware/zeroplus-logic-cube/zeroplus.c index db717f65..68acaaa5 100644 --- a/hardware/zeroplus-logic-cube/zeroplus.c +++ b/hardware/zeroplus-logic-cube/zeroplus.c @@ -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__); diff --git a/input/binary.c b/input/binary.c index 9a87d3e2..89a6b25b 100644 --- a/input/binary.c +++ b/input/binary.c @@ -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; } diff --git a/input/chronovu_la8.c b/input/chronovu_la8.c index af6a80c7..23a8dc09 100644 --- a/input/chronovu_la8.c +++ b/input/chronovu_la8.c @@ -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; } diff --git a/session.c b/session.c index f7af9f88..06d4a3b4 100644 --- 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; diff --git a/session_driver.c b/session_driver.c index d5f9d554..34b79ba8 100644 --- a/session_driver.c +++ b/session_driver.c @@ -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); diff --git a/sigrok-internal.h b/sigrok-internal.h index 07501266..62b7bac9 100644 --- a/sigrok-internal.h +++ b/sigrok-internal.h @@ -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,