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;
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;
/* 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);
}
}
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;
/** 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;
/* 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;
/* Set the new samplerate. */
la8->cur_samplerate = samplerate;
- la8->period_ps = 1000000000000 / samplerate;
sr_dbg("la8: samplerate set to %" PRIu64 "Hz", la8->cur_samplerate);
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;
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;
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);
"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;
/* 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;
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;
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;
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;
/*
* 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
ols->trigger_at = -1;
ols->probe_mask = 0xffffffff;
ols->cur_samplerate = SR_KHZ(200);
- ols->period_ps = 5000000;
ols->serial = NULL;
return ols;
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);
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;
/* 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;
} 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;
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);
}
/*
* 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
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;
/*
* 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
return SR_ERR;
}
fx2->cur_samplerate = samplerate;
- fx2->period_ps = 1000000000000 / samplerate;
return SR_OK;
}
* 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);
* 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;
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;
/*
* 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
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];
/*
* 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
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;
/* 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;
analyzer_set_freq(samplerate, FREQ_SCALE_HZ);
zp->cur_samplerate = samplerate;
- zp->period_ps = 1000000000000 / samplerate;
return SR_OK;
}
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;
/*
* 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
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");
/*
* 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
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;
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;
/*
* 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
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;
};