]> sigrok.org Git - libsigrok.git/commitdiff
sr: remove unused time/duration fields from datafeed packets
authorBert Vermeulen <redacted>
Wed, 1 Feb 2012 01:59:41 +0000 (02:59 +0100)
committerBert Vermeulen <redacted>
Wed, 1 Feb 2012 01:59:41 +0000 (02:59 +0100)
hardware/asix-sigma/asix-sigma.c
hardware/chronovu-la8/chronovu-la8.c
hardware/demo/demo.c
hardware/openbench-logic-sniffer/ols.c
hardware/openbench-logic-sniffer/ols.h
hardware/saleae-logic/saleae-logic.c
hardware/saleae-logic/saleae-logic.h
hardware/zeroplus-logic-cube/zeroplus.c
session.c
session_driver.c
sigrok.h.in

index 723b2445f454a77cd7b1d4772d60b54a985996f8..4cb5e1030ebbdf1f2cd4d78341a4260db2b1fe87 100644 (file)
@@ -919,9 +919,6 @@ static int decode_chunk_ts(uint8_t *buf, uint16_t *lastts,
                        tosend = MIN(2048, n - sent);
 
                        packet.type = SR_DF_LOGIC;
-                       /* TODO: fill in timeoffset and duration */
-                       packet.timeoffset = 0;
-                       packet.duration = 0;
                        packet.payload = &logic;
                        logic.length = tosend * sizeof(uint16_t);
                        logic.unitsize = 2;
@@ -967,9 +964,6 @@ static int decode_chunk_ts(uint8_t *buf, uint16_t *lastts,
 
                        if (tosend > 0) {
                                packet.type = SR_DF_LOGIC;
-                               /* TODO: fill in timeoffset and duration */
-                               packet.timeoffset = 0;
-                               packet.duration = 0;
                                packet.payload = &logic;
                                logic.length = tosend * sizeof(uint16_t);
                                logic.unitsize = 2;
@@ -982,9 +976,6 @@ static int decode_chunk_ts(uint8_t *buf, uint16_t *lastts,
                        /* Only send trigger if explicitly enabled. */
                        if (sigma->use_triggers) {
                                packet.type = SR_DF_TRIGGER;
-                               /* TODO: fill in timeoffset only */
-                               packet.timeoffset = 0;
-                               packet.duration = 0;
                                sr_session_bus(sigma->session_id, &packet);
                        }
                }
@@ -994,9 +985,6 @@ static int decode_chunk_ts(uint8_t *buf, uint16_t *lastts,
 
                if (tosend > 0) {
                        packet.type = SR_DF_LOGIC;
-                       /* TODO: fill in timeoffset and duration */
-                       packet.timeoffset = 0;
-                       packet.duration = 0;
                        packet.payload = &logic;
                        logic.length = tosend * sizeof(uint16_t);
                        logic.unitsize = 2;
index cfca8e3dea36d467bfef1edadc7fbf5bf5a49aa7..040e23fbffe3d9c911a80c27c7e19eae15896772 100644 (file)
@@ -60,9 +60,6 @@ struct la8 {
        /** The currently configured samplerate of the device. */
        uint64_t cur_samplerate;
 
-       /** period in picoseconds corresponding to the samplerate */
-       uint64_t period_ps;
-
        /** The current sampling limit (in ms). */
        uint64_t limit_msec;
 
@@ -493,7 +490,6 @@ static int hw_init(const char *deviceinfo)
        /* Set some sane defaults. */
        la8->ftdic = NULL;
        la8->cur_samplerate = SR_MHZ(100); /* 100MHz == max. samplerate */
-       la8->period_ps = 10000;
        la8->limit_msec = 0;
        la8->limit_samples = 0;
        la8->session_id = NULL;
@@ -643,7 +639,6 @@ static int set_samplerate(struct sr_device_instance *sdi, uint64_t samplerate)
 
        /* Set the new samplerate. */
        la8->cur_samplerate = samplerate;
-       la8->period_ps = 1000000000000 / samplerate;
 
        sr_dbg("la8: samplerate set to %" PRIu64 "Hz", la8->cur_samplerate);
 
@@ -935,8 +930,6 @@ static void send_block_to_session_bus(struct la8 *la8, int block)
                sr_spew("la8: sending SR_DF_LOGIC packet (%d bytes) for "
                        "block %d", BS, block);
                packet.type = SR_DF_LOGIC;
-               packet.timeoffset = block * BS * la8->period_ps;
-               packet.duration = BS * la8->period_ps;
                packet.payload = &logic;
                logic.length = BS;
                logic.unitsize = 1;
@@ -960,8 +953,6 @@ static void send_block_to_session_bus(struct la8 *la8, int block)
                sr_spew("la8: sending pre-trigger SR_DF_LOGIC packet, "
                        "start = %d, length = %d", block * BS, trigger_point);
                packet.type = SR_DF_LOGIC;
-               packet.timeoffset = block * BS * la8->period_ps;
-               packet.duration = trigger_point * la8->period_ps;
                packet.payload = &logic;
                logic.length = trigger_point;
                logic.unitsize = 1;
@@ -973,8 +964,6 @@ static void send_block_to_session_bus(struct la8 *la8, int block)
        sr_spew("la8: sending SR_DF_TRIGGER packet, sample = %d",
                (block * BS) + trigger_point);
        packet.type = SR_DF_TRIGGER;
-       packet.timeoffset = (block * BS + trigger_point) * la8->period_ps;
-       packet.duration = 0;
        packet.payload = NULL;
        sr_session_bus(la8->session_id, &packet);
 
@@ -985,8 +974,6 @@ static void send_block_to_session_bus(struct la8 *la8, int block)
                        "start = %d, length = %d",
                        (block * BS) + trigger_point, BS - trigger_point);
                packet.type = SR_DF_LOGIC;
-               packet.timeoffset = (block * BS + trigger_point) * la8->period_ps;
-               packet.duration = (BS - trigger_point) * la8->period_ps;
                packet.payload = &logic;
                logic.length = BS - trigger_point;
                logic.unitsize = 1;
index 0f55e6d5741ff259ed97269291fd069e37c7b693..9fe35ae8689b755a9732559f1a92f8399dd5d0e8 100644 (file)
@@ -129,7 +129,6 @@ static uint8_t pattern_sigrok[] = {
 /* List of struct sr_device_instance, maintained by opendev()/closedev(). */
 static GSList *device_instances = NULL;
 static uint64_t cur_samplerate = SR_KHZ(200);
-static uint64_t period_ps = 5000000;
 static uint64_t limit_samples = 0;
 static uint64_t limit_msec = 0;
 static int default_pattern = PATTERN_SIGROK;
@@ -241,7 +240,6 @@ static int hw_set_configuration(int device_index, int capability, void *value)
                ret = SR_OK;
        } else if (capability == SR_HWCAP_SAMPLERATE) {
                cur_samplerate = *(uint64_t *)value;
-               period_ps = 1000000000000 / cur_samplerate;
                sr_dbg("demo: %s: setting samplerate to %" PRIu64, __func__,
                       cur_samplerate);
                ret = SR_OK;
@@ -385,8 +383,6 @@ static int receive_data(int fd, int revents, void *session_data)
                if (z > 0) {
                        packet.type = SR_DF_LOGIC;
                        packet.payload = &logic;
-                       packet.timeoffset =  samples_received * period_ps;
-                       packet.duration = z * period_ps;
                        logic.length = z;
                        logic.unitsize = 1;
                        logic.data = c;
@@ -470,8 +466,6 @@ static int hw_start_acquisition(int device_index, gpointer session_data)
 
        packet->type = SR_DF_HEADER;
        packet->payload = header;
-       packet->timeoffset = 0;
-       packet->duration = 0;
        header->feed_version = 1;
        gettimeofday(&header->starttime, NULL);
        header->samplerate = cur_samplerate;
index 112c48d0a5b7ee069edde7c3f0f32119ea4da934..1b7970e31ed18f3ec3eff9cfbefa89642dd2a0e5 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the sigrok project.
  *
- * Copyright (C) 2010 Bert Vermeulen <bert@biot.com>
+ * Copyright (C) 2012 Bert Vermeulen <bert@biot.com>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -217,7 +217,6 @@ static struct ols_device *ols_device_new(void)
        ols->trigger_at = -1;
        ols->probe_mask = 0xffffffff;
        ols->cur_samplerate = SR_KHZ(200);
-       ols->period_ps = 5000000;
        ols->serial = NULL;
 
        return ols;
@@ -617,7 +616,6 @@ static int set_configuration_samplerate(struct sr_device_instance *sdi,
        ols->cur_samplerate = CLOCK_RATE / (ols->cur_samplerate_divider + 1);
        if(ols->flag_reg & FLAG_DEMUX)
                ols->cur_samplerate *= 2;
-       ols->period_ps = 1000000000000 / ols->cur_samplerate;
        if(ols->cur_samplerate != samplerate)
                sr_warn("ols: can't match samplerate %" PRIu64 ", using %" PRIu64, 
                        samplerate, ols->cur_samplerate);
@@ -818,8 +816,6 @@ static int receive_data(int fd, int revents, void *session_data)
                        if (ols->trigger_at > 0) {
                                /* there are pre-trigger samples, send those first */
                                packet.type = SR_DF_LOGIC;
-                               packet.timeoffset = 0;
-                               packet.duration = ols->trigger_at * ols->period_ps;
                                packet.payload = &logic;
                                logic.length = ols->trigger_at * 4;
                                logic.unitsize = 4;
@@ -830,14 +826,10 @@ static int receive_data(int fd, int revents, void *session_data)
 
                        /* send the trigger */
                        packet.type = SR_DF_TRIGGER;
-                       packet.timeoffset = ols->trigger_at * ols->period_ps;
-                       packet.duration = 0;
                        sr_session_bus(session_data, &packet);
 
                        /* send post-trigger samples */
                        packet.type = SR_DF_LOGIC;
-                       packet.timeoffset = ols->trigger_at * ols->period_ps;
-                       packet.duration = (ols->num_samples - ols->trigger_at) * ols->period_ps;
                        packet.payload = &logic;
                        logic.length = (ols->num_samples * 4) - (ols->trigger_at * 4);
                        logic.unitsize = 4;
@@ -847,8 +839,6 @@ static int receive_data(int fd, int revents, void *session_data)
                } else {
                        /* no trigger was used */
                        packet.type = SR_DF_LOGIC;
-                       packet.timeoffset = 0;
-                       packet.duration = ols->num_samples * ols->period_ps;
                        packet.payload = &logic;
                        logic.length = ols->num_samples * 4;
                        logic.unitsize = 4;
@@ -861,8 +851,6 @@ static int receive_data(int fd, int revents, void *session_data)
                serial_flush(fd);
                serial_close(fd);
                packet.type = SR_DF_END;
-               packet.timeoffset = ols->num_samples * ols->period_ps;
-               packet.duration = 0;
                sr_session_bus(session_data, &packet);
        }
 
index d8b00b47c149f6c1bf317977e0cd7ebb9aafd7a6..a554ae8c0b42239a1f26e71436fae017293cd31d 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the sigrok project.
  *
- * Copyright (C) 2011 Bert Vermeulen <bert@biot.com>
+ * Copyright (C) 2012 Bert Vermeulen <bert@biot.com>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -67,7 +67,6 @@ struct ols_device {
 
        uint64_t cur_samplerate;
        uint32_t cur_samplerate_divider;
-       uint64_t period_ps;
        uint64_t limit_samples;
        /* Current state of the flag register */
        uint32_t flag_reg;
index 27938a51bc18623efa3caa25d1f8b0feb5771c58..25ef94dd12c448d89f414818600cb8c8412fb286 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the sigrok project.
  *
- * Copyright (C) 2010 Bert Vermeulen <bert@biot.com>
+ * Copyright (C) 2012 Bert Vermeulen <bert@biot.com>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -549,7 +549,6 @@ static int set_configuration_samplerate(struct sr_device_instance *sdi,
                return SR_ERR;
        }
        fx2->cur_samplerate = samplerate;
-       fx2->period_ps = 1000000000000 / samplerate;
 
        return SR_OK;
 }
@@ -675,8 +674,6 @@ static void receive_transfer(struct libusb_transfer *transfer)
                                         * Tell the frontend we hit the trigger here.
                                         */
                                        packet.type = SR_DF_TRIGGER;
-                                       packet.timeoffset = (num_samples + i) * fx2->period_ps;
-                                       packet.duration = 0;
                                        packet.payload = NULL;
                                        sr_session_bus(fx2->session_data, &packet);
 
@@ -685,8 +682,6 @@ static void receive_transfer(struct libusb_transfer *transfer)
                                         * skipping past them.
                                         */
                                        packet.type = SR_DF_LOGIC;
-                                       packet.timeoffset = (num_samples + i) * fx2->period_ps;
-                                       packet.duration = fx2->trigger_stage * fx2->period_ps;
                                        packet.payload = &logic;
                                        logic.length = fx2->trigger_stage;
                                        logic.unitsize = 1;
@@ -719,8 +714,6 @@ static void receive_transfer(struct libusb_transfer *transfer)
        if (fx2->trigger_stage == TRIGGER_FIRED) {
                /* Send the incoming transfer to the session bus. */
                packet.type = SR_DF_LOGIC;
-               packet.timeoffset = num_samples * fx2->period_ps;
-               packet.duration = cur_buflen * fx2->period_ps;
                packet.payload = &logic;
                logic.length = cur_buflen - trigger_offset;
                logic.unitsize = 1;
index 50cca6280bc47990644a4a0591f28ab2077f0689..d07d033af71c1b00ebde70ee408d79d4cf7464a3 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the sigrok project.
  *
- * Copyright (C) 2011 Bert Vermeulen <bert@biot.com>
+ * Copyright (C) 2012 Bert Vermeulen <bert@biot.com>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -59,7 +59,6 @@ struct fx2_device {
        GTimeVal fw_updated;
        /* device/capture settings */
        uint64_t cur_samplerate;
-       uint64_t period_ps;
        uint64_t limit_samples;
        uint8_t probe_mask;
        uint8_t trigger_mask[NUM_TRIGGER_STAGES];
index 54f4d08315e0fac1c6a85c1cda8ab817ba752630..1632c877d7cea18f6d85052f4a02588bfe246efe 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the sigrok project.
  *
- * Copyright (C) 2010 Bert Vermeulen <bert@biot.com>
+ * Copyright (C) 2012 Bert Vermeulen <bert@biot.com>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -155,7 +155,6 @@ static struct sr_samplerates samplerates = {
 
 struct zp {
        uint64_t cur_samplerate;
-       uint64_t period_ps;
        uint64_t limit_samples;
        int num_channels; /* TODO: This isn't initialized before it's needed :( */
        uint64_t memory_size;
@@ -353,7 +352,6 @@ static int hw_init(const char *deviceinfo)
 
        /* Set some sane defaults. */
        zp->cur_samplerate = 0;
-       zp->period_ps = 0;
        zp->limit_samples = 0;
        zp->num_channels = 32; /* TODO: This isn't initialized before it's needed :( */
        zp->memory_size = 0;
@@ -582,7 +580,6 @@ static int set_configuration_samplerate(struct sr_device_instance *sdi,
                analyzer_set_freq(samplerate, FREQ_SCALE_HZ);
 
        zp->cur_samplerate = samplerate;
-       zp->period_ps = 1000000000000 / samplerate;
 
        return SR_OK;
 }
@@ -675,8 +672,6 @@ static int hw_start_acquisition(int device_index, gpointer session_data)
                        PACKET_SIZE, res);
 
                packet.type = SR_DF_LOGIC;
-               packet.timeoffset = samples_read * zp->period_ps;
-               packet.duration = res / 4 * zp->period_ps;
                packet.payload = &logic;
                logic.length = PACKET_SIZE;
                logic.unitsize = 4;
index ab28c72c2d30d3a091a2887261bac65fba4d496e..bd50bd9dcaba23b7b51dbd2b10277592c105ed16 100644 (file)
--- a/session.c
+++ b/session.c
@@ -1,7 +1,7 @@
 /*
  * This file is part of the sigrok project.
  *
- * Copyright (C) 2010 Bert Vermeulen <bert@biot.com>
+ * Copyright (C) 2012 Bert Vermeulen <bert@biot.com>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -413,15 +413,12 @@ static int datafeed_dump(struct sr_datafeed_packet *packet)
                sr_dbg("bus: received SR_DF_HEADER");
                break;
        case SR_DF_TRIGGER:
-               sr_dbg("bus: received SR_DF_TRIGGER at %lu ms",
-                      packet->timeoffset / 1000000);
+               sr_dbg("bus: received SR_DF_TRIGGER");
                break;
        case SR_DF_LOGIC:
                logic = packet->payload;
                /* TODO: Check for logic != NULL. */
-               sr_dbg("bus: received SR_DF_LOGIC at %f ms duration %f ms, "
-                      "%" PRIu64 " bytes", packet->timeoffset / 1000000.0,
-                      packet->duration / 1000000.0, logic->length);
+               sr_dbg("bus: received SR_DF_LOGIC %" PRIu64 " bytes", logic->length);
                break;
        case SR_DF_END:
                sr_dbg("bus: received SR_DF_END");
index 05055206665562f7521835dd2026dedbb99b8bc2..a994213df18b04ba48466248f1d656d723a88c32 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the sigrok project.
  *
- * Copyright (C) 2011 Bert Vermeulen <bert@biot.com>
+ * Copyright (C) 2012 Bert Vermeulen <bert@biot.com>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -87,7 +87,6 @@ static int feed_chunk(int fd, int revents, void *session_data)
        struct session_vdevice *vdevice;
        struct sr_datafeed_packet packet;
        struct sr_datafeed_logic logic;
-       uint64_t sample_period_ps;
        GSList *l;
        void *buf;
        int ret, got_data;
@@ -116,9 +115,6 @@ static int feed_chunk(int fd, int revents, void *session_data)
                if (ret > 0) {
                        got_data = TRUE;
                        packet.type = SR_DF_LOGIC;
-                       sample_period_ps = 1000000000000 / vdevice->samplerate;
-                       packet.timeoffset = sample_period_ps * (vdevice->bytes_read / vdevice->unitsize);
-                       packet.duration = sample_period_ps * (ret / vdevice->unitsize);
                        packet.payload = &logic;
                        logic.length = ret;
                        logic.unitsize = vdevice->unitsize;
index 401e94fbeec2c7e0a4f2b428732f2fce069ac316..511f8afb3704bcec80aa7e317a3b600adbd7d628 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the sigrok project.
  *
- * Copyright (C) 2010 Bert Vermeulen <bert@biot.com>
+ * Copyright (C) 2012 Bert Vermeulen <bert@biot.com>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -94,10 +94,6 @@ enum {
 
 struct sr_datafeed_packet {
        uint16_t type;
-       /* timeoffset since start, in picoseconds */
-       uint64_t timeoffset;
-       /* duration of data in this packet, in picoseconds */
-       uint64_t duration;
        void *payload;
 };