From 0146970797e809555b2feea9fdbc3933f9e24e8b Mon Sep 17 00:00:00 2001 From: Bert Vermeulen Date: Wed, 1 Feb 2012 02:59:41 +0100 Subject: [PATCH] sr: remove unused time/duration fields from datafeed packets --- hardware/asix-sigma/asix-sigma.c | 12 ------------ hardware/chronovu-la8/chronovu-la8.c | 13 ------------- hardware/demo/demo.c | 6 ------ hardware/openbench-logic-sniffer/ols.c | 14 +------------- hardware/openbench-logic-sniffer/ols.h | 3 +-- hardware/saleae-logic/saleae-logic.c | 9 +-------- hardware/saleae-logic/saleae-logic.h | 3 +-- hardware/zeroplus-logic-cube/zeroplus.c | 7 +------ session.c | 9 +++------ session_driver.c | 6 +----- sigrok.h.in | 6 +----- 11 files changed, 10 insertions(+), 78 deletions(-) diff --git a/hardware/asix-sigma/asix-sigma.c b/hardware/asix-sigma/asix-sigma.c index 723b2445..4cb5e103 100644 --- a/hardware/asix-sigma/asix-sigma.c +++ b/hardware/asix-sigma/asix-sigma.c @@ -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; diff --git a/hardware/chronovu-la8/chronovu-la8.c b/hardware/chronovu-la8/chronovu-la8.c index cfca8e3d..040e23fb 100644 --- a/hardware/chronovu-la8/chronovu-la8.c +++ b/hardware/chronovu-la8/chronovu-la8.c @@ -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; diff --git a/hardware/demo/demo.c b/hardware/demo/demo.c index 0f55e6d5..9fe35ae8 100644 --- a/hardware/demo/demo.c +++ b/hardware/demo/demo.c @@ -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; diff --git a/hardware/openbench-logic-sniffer/ols.c b/hardware/openbench-logic-sniffer/ols.c index 112c48d0..1b7970e3 100644 --- a/hardware/openbench-logic-sniffer/ols.c +++ b/hardware/openbench-logic-sniffer/ols.c @@ -1,7 +1,7 @@ /* * This file is part of the sigrok project. * - * Copyright (C) 2010 Bert Vermeulen + * Copyright (C) 2012 Bert Vermeulen * * 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); } diff --git a/hardware/openbench-logic-sniffer/ols.h b/hardware/openbench-logic-sniffer/ols.h index d8b00b47..a554ae8c 100644 --- a/hardware/openbench-logic-sniffer/ols.h +++ b/hardware/openbench-logic-sniffer/ols.h @@ -1,7 +1,7 @@ /* * This file is part of the sigrok project. * - * Copyright (C) 2011 Bert Vermeulen + * Copyright (C) 2012 Bert Vermeulen * * 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; diff --git a/hardware/saleae-logic/saleae-logic.c b/hardware/saleae-logic/saleae-logic.c index 27938a51..25ef94dd 100644 --- a/hardware/saleae-logic/saleae-logic.c +++ b/hardware/saleae-logic/saleae-logic.c @@ -1,7 +1,7 @@ /* * This file is part of the sigrok project. * - * Copyright (C) 2010 Bert Vermeulen + * Copyright (C) 2012 Bert Vermeulen * * 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; diff --git a/hardware/saleae-logic/saleae-logic.h b/hardware/saleae-logic/saleae-logic.h index 50cca628..d07d033a 100644 --- a/hardware/saleae-logic/saleae-logic.h +++ b/hardware/saleae-logic/saleae-logic.h @@ -1,7 +1,7 @@ /* * This file is part of the sigrok project. * - * Copyright (C) 2011 Bert Vermeulen + * Copyright (C) 2012 Bert Vermeulen * * 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]; diff --git a/hardware/zeroplus-logic-cube/zeroplus.c b/hardware/zeroplus-logic-cube/zeroplus.c index 54f4d083..1632c877 100644 --- a/hardware/zeroplus-logic-cube/zeroplus.c +++ b/hardware/zeroplus-logic-cube/zeroplus.c @@ -1,7 +1,7 @@ /* * This file is part of the sigrok project. * - * Copyright (C) 2010 Bert Vermeulen + * Copyright (C) 2012 Bert Vermeulen * * 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; diff --git a/session.c b/session.c index ab28c72c..bd50bd9d 100644 --- a/session.c +++ b/session.c @@ -1,7 +1,7 @@ /* * This file is part of the sigrok project. * - * Copyright (C) 2010 Bert Vermeulen + * Copyright (C) 2012 Bert Vermeulen * * 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"); diff --git a/session_driver.c b/session_driver.c index 05055206..a994213d 100644 --- a/session_driver.c +++ b/session_driver.c @@ -1,7 +1,7 @@ /* * This file is part of the sigrok project. * - * Copyright (C) 2011 Bert Vermeulen + * Copyright (C) 2012 Bert Vermeulen * * 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; diff --git a/sigrok.h.in b/sigrok.h.in index 401e94fb..511f8afb 100644 --- a/sigrok.h.in +++ b/sigrok.h.in @@ -1,7 +1,7 @@ /* * This file is part of the sigrok project. * - * Copyright (C) 2010 Bert Vermeulen + * Copyright (C) 2012 Bert Vermeulen * * 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; };