sr: remove unused time/duration fields from datafeed packets
This commit is contained in:
parent
69890f7399
commit
0146970797
|
@ -919,9 +919,6 @@ static int decode_chunk_ts(uint8_t *buf, uint16_t *lastts,
|
||||||
tosend = MIN(2048, n - sent);
|
tosend = MIN(2048, n - sent);
|
||||||
|
|
||||||
packet.type = SR_DF_LOGIC;
|
packet.type = SR_DF_LOGIC;
|
||||||
/* TODO: fill in timeoffset and duration */
|
|
||||||
packet.timeoffset = 0;
|
|
||||||
packet.duration = 0;
|
|
||||||
packet.payload = &logic;
|
packet.payload = &logic;
|
||||||
logic.length = tosend * sizeof(uint16_t);
|
logic.length = tosend * sizeof(uint16_t);
|
||||||
logic.unitsize = 2;
|
logic.unitsize = 2;
|
||||||
|
@ -967,9 +964,6 @@ static int decode_chunk_ts(uint8_t *buf, uint16_t *lastts,
|
||||||
|
|
||||||
if (tosend > 0) {
|
if (tosend > 0) {
|
||||||
packet.type = SR_DF_LOGIC;
|
packet.type = SR_DF_LOGIC;
|
||||||
/* TODO: fill in timeoffset and duration */
|
|
||||||
packet.timeoffset = 0;
|
|
||||||
packet.duration = 0;
|
|
||||||
packet.payload = &logic;
|
packet.payload = &logic;
|
||||||
logic.length = tosend * sizeof(uint16_t);
|
logic.length = tosend * sizeof(uint16_t);
|
||||||
logic.unitsize = 2;
|
logic.unitsize = 2;
|
||||||
|
@ -982,9 +976,6 @@ static int decode_chunk_ts(uint8_t *buf, uint16_t *lastts,
|
||||||
/* Only send trigger if explicitly enabled. */
|
/* Only send trigger if explicitly enabled. */
|
||||||
if (sigma->use_triggers) {
|
if (sigma->use_triggers) {
|
||||||
packet.type = SR_DF_TRIGGER;
|
packet.type = SR_DF_TRIGGER;
|
||||||
/* TODO: fill in timeoffset only */
|
|
||||||
packet.timeoffset = 0;
|
|
||||||
packet.duration = 0;
|
|
||||||
sr_session_bus(sigma->session_id, &packet);
|
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) {
|
if (tosend > 0) {
|
||||||
packet.type = SR_DF_LOGIC;
|
packet.type = SR_DF_LOGIC;
|
||||||
/* TODO: fill in timeoffset and duration */
|
|
||||||
packet.timeoffset = 0;
|
|
||||||
packet.duration = 0;
|
|
||||||
packet.payload = &logic;
|
packet.payload = &logic;
|
||||||
logic.length = tosend * sizeof(uint16_t);
|
logic.length = tosend * sizeof(uint16_t);
|
||||||
logic.unitsize = 2;
|
logic.unitsize = 2;
|
||||||
|
|
|
@ -60,9 +60,6 @@ struct la8 {
|
||||||
/** The currently configured samplerate of the device. */
|
/** The currently configured samplerate of the device. */
|
||||||
uint64_t cur_samplerate;
|
uint64_t cur_samplerate;
|
||||||
|
|
||||||
/** period in picoseconds corresponding to the samplerate */
|
|
||||||
uint64_t period_ps;
|
|
||||||
|
|
||||||
/** The current sampling limit (in ms). */
|
/** The current sampling limit (in ms). */
|
||||||
uint64_t limit_msec;
|
uint64_t limit_msec;
|
||||||
|
|
||||||
|
@ -493,7 +490,6 @@ static int hw_init(const char *deviceinfo)
|
||||||
/* Set some sane defaults. */
|
/* Set some sane defaults. */
|
||||||
la8->ftdic = NULL;
|
la8->ftdic = NULL;
|
||||||
la8->cur_samplerate = SR_MHZ(100); /* 100MHz == max. samplerate */
|
la8->cur_samplerate = SR_MHZ(100); /* 100MHz == max. samplerate */
|
||||||
la8->period_ps = 10000;
|
|
||||||
la8->limit_msec = 0;
|
la8->limit_msec = 0;
|
||||||
la8->limit_samples = 0;
|
la8->limit_samples = 0;
|
||||||
la8->session_id = NULL;
|
la8->session_id = NULL;
|
||||||
|
@ -643,7 +639,6 @@ static int set_samplerate(struct sr_device_instance *sdi, uint64_t samplerate)
|
||||||
|
|
||||||
/* Set the new samplerate. */
|
/* Set the new samplerate. */
|
||||||
la8->cur_samplerate = samplerate;
|
la8->cur_samplerate = samplerate;
|
||||||
la8->period_ps = 1000000000000 / samplerate;
|
|
||||||
|
|
||||||
sr_dbg("la8: samplerate set to %" PRIu64 "Hz", la8->cur_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 "
|
sr_spew("la8: sending SR_DF_LOGIC packet (%d bytes) for "
|
||||||
"block %d", BS, block);
|
"block %d", BS, block);
|
||||||
packet.type = SR_DF_LOGIC;
|
packet.type = SR_DF_LOGIC;
|
||||||
packet.timeoffset = block * BS * la8->period_ps;
|
|
||||||
packet.duration = BS * la8->period_ps;
|
|
||||||
packet.payload = &logic;
|
packet.payload = &logic;
|
||||||
logic.length = BS;
|
logic.length = BS;
|
||||||
logic.unitsize = 1;
|
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, "
|
sr_spew("la8: sending pre-trigger SR_DF_LOGIC packet, "
|
||||||
"start = %d, length = %d", block * BS, trigger_point);
|
"start = %d, length = %d", block * BS, trigger_point);
|
||||||
packet.type = SR_DF_LOGIC;
|
packet.type = SR_DF_LOGIC;
|
||||||
packet.timeoffset = block * BS * la8->period_ps;
|
|
||||||
packet.duration = trigger_point * la8->period_ps;
|
|
||||||
packet.payload = &logic;
|
packet.payload = &logic;
|
||||||
logic.length = trigger_point;
|
logic.length = trigger_point;
|
||||||
logic.unitsize = 1;
|
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",
|
sr_spew("la8: sending SR_DF_TRIGGER packet, sample = %d",
|
||||||
(block * BS) + trigger_point);
|
(block * BS) + trigger_point);
|
||||||
packet.type = SR_DF_TRIGGER;
|
packet.type = SR_DF_TRIGGER;
|
||||||
packet.timeoffset = (block * BS + trigger_point) * la8->period_ps;
|
|
||||||
packet.duration = 0;
|
|
||||||
packet.payload = NULL;
|
packet.payload = NULL;
|
||||||
sr_session_bus(la8->session_id, &packet);
|
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",
|
"start = %d, length = %d",
|
||||||
(block * BS) + trigger_point, BS - trigger_point);
|
(block * BS) + trigger_point, BS - trigger_point);
|
||||||
packet.type = SR_DF_LOGIC;
|
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;
|
packet.payload = &logic;
|
||||||
logic.length = BS - trigger_point;
|
logic.length = BS - trigger_point;
|
||||||
logic.unitsize = 1;
|
logic.unitsize = 1;
|
||||||
|
|
|
@ -129,7 +129,6 @@ static uint8_t pattern_sigrok[] = {
|
||||||
/* List of struct sr_device_instance, maintained by opendev()/closedev(). */
|
/* List of struct sr_device_instance, maintained by opendev()/closedev(). */
|
||||||
static GSList *device_instances = NULL;
|
static GSList *device_instances = NULL;
|
||||||
static uint64_t cur_samplerate = SR_KHZ(200);
|
static uint64_t cur_samplerate = SR_KHZ(200);
|
||||||
static uint64_t period_ps = 5000000;
|
|
||||||
static uint64_t limit_samples = 0;
|
static uint64_t limit_samples = 0;
|
||||||
static uint64_t limit_msec = 0;
|
static uint64_t limit_msec = 0;
|
||||||
static int default_pattern = PATTERN_SIGROK;
|
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;
|
ret = SR_OK;
|
||||||
} else if (capability == SR_HWCAP_SAMPLERATE) {
|
} else if (capability == SR_HWCAP_SAMPLERATE) {
|
||||||
cur_samplerate = *(uint64_t *)value;
|
cur_samplerate = *(uint64_t *)value;
|
||||||
period_ps = 1000000000000 / cur_samplerate;
|
|
||||||
sr_dbg("demo: %s: setting samplerate to %" PRIu64, __func__,
|
sr_dbg("demo: %s: setting samplerate to %" PRIu64, __func__,
|
||||||
cur_samplerate);
|
cur_samplerate);
|
||||||
ret = SR_OK;
|
ret = SR_OK;
|
||||||
|
@ -385,8 +383,6 @@ static int receive_data(int fd, int revents, void *session_data)
|
||||||
if (z > 0) {
|
if (z > 0) {
|
||||||
packet.type = SR_DF_LOGIC;
|
packet.type = SR_DF_LOGIC;
|
||||||
packet.payload = &logic;
|
packet.payload = &logic;
|
||||||
packet.timeoffset = samples_received * period_ps;
|
|
||||||
packet.duration = z * period_ps;
|
|
||||||
logic.length = z;
|
logic.length = z;
|
||||||
logic.unitsize = 1;
|
logic.unitsize = 1;
|
||||||
logic.data = c;
|
logic.data = c;
|
||||||
|
@ -470,8 +466,6 @@ static int hw_start_acquisition(int device_index, gpointer session_data)
|
||||||
|
|
||||||
packet->type = SR_DF_HEADER;
|
packet->type = SR_DF_HEADER;
|
||||||
packet->payload = header;
|
packet->payload = header;
|
||||||
packet->timeoffset = 0;
|
|
||||||
packet->duration = 0;
|
|
||||||
header->feed_version = 1;
|
header->feed_version = 1;
|
||||||
gettimeofday(&header->starttime, NULL);
|
gettimeofday(&header->starttime, NULL);
|
||||||
header->samplerate = cur_samplerate;
|
header->samplerate = cur_samplerate;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* This file is part of the sigrok project.
|
* 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
|
* 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
|
* 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->trigger_at = -1;
|
||||||
ols->probe_mask = 0xffffffff;
|
ols->probe_mask = 0xffffffff;
|
||||||
ols->cur_samplerate = SR_KHZ(200);
|
ols->cur_samplerate = SR_KHZ(200);
|
||||||
ols->period_ps = 5000000;
|
|
||||||
ols->serial = NULL;
|
ols->serial = NULL;
|
||||||
|
|
||||||
return ols;
|
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);
|
ols->cur_samplerate = CLOCK_RATE / (ols->cur_samplerate_divider + 1);
|
||||||
if(ols->flag_reg & FLAG_DEMUX)
|
if(ols->flag_reg & FLAG_DEMUX)
|
||||||
ols->cur_samplerate *= 2;
|
ols->cur_samplerate *= 2;
|
||||||
ols->period_ps = 1000000000000 / ols->cur_samplerate;
|
|
||||||
if(ols->cur_samplerate != samplerate)
|
if(ols->cur_samplerate != samplerate)
|
||||||
sr_warn("ols: can't match samplerate %" PRIu64 ", using %" PRIu64,
|
sr_warn("ols: can't match samplerate %" PRIu64 ", using %" PRIu64,
|
||||||
samplerate, ols->cur_samplerate);
|
samplerate, ols->cur_samplerate);
|
||||||
|
@ -818,8 +816,6 @@ static int receive_data(int fd, int revents, void *session_data)
|
||||||
if (ols->trigger_at > 0) {
|
if (ols->trigger_at > 0) {
|
||||||
/* there are pre-trigger samples, send those first */
|
/* there are pre-trigger samples, send those first */
|
||||||
packet.type = SR_DF_LOGIC;
|
packet.type = SR_DF_LOGIC;
|
||||||
packet.timeoffset = 0;
|
|
||||||
packet.duration = ols->trigger_at * ols->period_ps;
|
|
||||||
packet.payload = &logic;
|
packet.payload = &logic;
|
||||||
logic.length = ols->trigger_at * 4;
|
logic.length = ols->trigger_at * 4;
|
||||||
logic.unitsize = 4;
|
logic.unitsize = 4;
|
||||||
|
@ -830,14 +826,10 @@ static int receive_data(int fd, int revents, void *session_data)
|
||||||
|
|
||||||
/* send the trigger */
|
/* send the trigger */
|
||||||
packet.type = SR_DF_TRIGGER;
|
packet.type = SR_DF_TRIGGER;
|
||||||
packet.timeoffset = ols->trigger_at * ols->period_ps;
|
|
||||||
packet.duration = 0;
|
|
||||||
sr_session_bus(session_data, &packet);
|
sr_session_bus(session_data, &packet);
|
||||||
|
|
||||||
/* send post-trigger samples */
|
/* send post-trigger samples */
|
||||||
packet.type = SR_DF_LOGIC;
|
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;
|
packet.payload = &logic;
|
||||||
logic.length = (ols->num_samples * 4) - (ols->trigger_at * 4);
|
logic.length = (ols->num_samples * 4) - (ols->trigger_at * 4);
|
||||||
logic.unitsize = 4;
|
logic.unitsize = 4;
|
||||||
|
@ -847,8 +839,6 @@ static int receive_data(int fd, int revents, void *session_data)
|
||||||
} else {
|
} else {
|
||||||
/* no trigger was used */
|
/* no trigger was used */
|
||||||
packet.type = SR_DF_LOGIC;
|
packet.type = SR_DF_LOGIC;
|
||||||
packet.timeoffset = 0;
|
|
||||||
packet.duration = ols->num_samples * ols->period_ps;
|
|
||||||
packet.payload = &logic;
|
packet.payload = &logic;
|
||||||
logic.length = ols->num_samples * 4;
|
logic.length = ols->num_samples * 4;
|
||||||
logic.unitsize = 4;
|
logic.unitsize = 4;
|
||||||
|
@ -861,8 +851,6 @@ static int receive_data(int fd, int revents, void *session_data)
|
||||||
serial_flush(fd);
|
serial_flush(fd);
|
||||||
serial_close(fd);
|
serial_close(fd);
|
||||||
packet.type = SR_DF_END;
|
packet.type = SR_DF_END;
|
||||||
packet.timeoffset = ols->num_samples * ols->period_ps;
|
|
||||||
packet.duration = 0;
|
|
||||||
sr_session_bus(session_data, &packet);
|
sr_session_bus(session_data, &packet);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* This file is part of the sigrok project.
|
* 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
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -67,7 +67,6 @@ struct ols_device {
|
||||||
|
|
||||||
uint64_t cur_samplerate;
|
uint64_t cur_samplerate;
|
||||||
uint32_t cur_samplerate_divider;
|
uint32_t cur_samplerate_divider;
|
||||||
uint64_t period_ps;
|
|
||||||
uint64_t limit_samples;
|
uint64_t limit_samples;
|
||||||
/* Current state of the flag register */
|
/* Current state of the flag register */
|
||||||
uint32_t flag_reg;
|
uint32_t flag_reg;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* This file is part of the sigrok project.
|
* 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
|
* 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
|
* 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;
|
return SR_ERR;
|
||||||
}
|
}
|
||||||
fx2->cur_samplerate = samplerate;
|
fx2->cur_samplerate = samplerate;
|
||||||
fx2->period_ps = 1000000000000 / samplerate;
|
|
||||||
|
|
||||||
return SR_OK;
|
return SR_OK;
|
||||||
}
|
}
|
||||||
|
@ -675,8 +674,6 @@ static void receive_transfer(struct libusb_transfer *transfer)
|
||||||
* Tell the frontend we hit the trigger here.
|
* Tell the frontend we hit the trigger here.
|
||||||
*/
|
*/
|
||||||
packet.type = SR_DF_TRIGGER;
|
packet.type = SR_DF_TRIGGER;
|
||||||
packet.timeoffset = (num_samples + i) * fx2->period_ps;
|
|
||||||
packet.duration = 0;
|
|
||||||
packet.payload = NULL;
|
packet.payload = NULL;
|
||||||
sr_session_bus(fx2->session_data, &packet);
|
sr_session_bus(fx2->session_data, &packet);
|
||||||
|
|
||||||
|
@ -685,8 +682,6 @@ static void receive_transfer(struct libusb_transfer *transfer)
|
||||||
* skipping past them.
|
* skipping past them.
|
||||||
*/
|
*/
|
||||||
packet.type = SR_DF_LOGIC;
|
packet.type = SR_DF_LOGIC;
|
||||||
packet.timeoffset = (num_samples + i) * fx2->period_ps;
|
|
||||||
packet.duration = fx2->trigger_stage * fx2->period_ps;
|
|
||||||
packet.payload = &logic;
|
packet.payload = &logic;
|
||||||
logic.length = fx2->trigger_stage;
|
logic.length = fx2->trigger_stage;
|
||||||
logic.unitsize = 1;
|
logic.unitsize = 1;
|
||||||
|
@ -719,8 +714,6 @@ static void receive_transfer(struct libusb_transfer *transfer)
|
||||||
if (fx2->trigger_stage == TRIGGER_FIRED) {
|
if (fx2->trigger_stage == TRIGGER_FIRED) {
|
||||||
/* Send the incoming transfer to the session bus. */
|
/* Send the incoming transfer to the session bus. */
|
||||||
packet.type = SR_DF_LOGIC;
|
packet.type = SR_DF_LOGIC;
|
||||||
packet.timeoffset = num_samples * fx2->period_ps;
|
|
||||||
packet.duration = cur_buflen * fx2->period_ps;
|
|
||||||
packet.payload = &logic;
|
packet.payload = &logic;
|
||||||
logic.length = cur_buflen - trigger_offset;
|
logic.length = cur_buflen - trigger_offset;
|
||||||
logic.unitsize = 1;
|
logic.unitsize = 1;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* This file is part of the sigrok project.
|
* 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
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -59,7 +59,6 @@ struct fx2_device {
|
||||||
GTimeVal fw_updated;
|
GTimeVal fw_updated;
|
||||||
/* device/capture settings */
|
/* device/capture settings */
|
||||||
uint64_t cur_samplerate;
|
uint64_t cur_samplerate;
|
||||||
uint64_t period_ps;
|
|
||||||
uint64_t limit_samples;
|
uint64_t limit_samples;
|
||||||
uint8_t probe_mask;
|
uint8_t probe_mask;
|
||||||
uint8_t trigger_mask[NUM_TRIGGER_STAGES];
|
uint8_t trigger_mask[NUM_TRIGGER_STAGES];
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* This file is part of the sigrok project.
|
* 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
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -155,7 +155,6 @@ static struct sr_samplerates samplerates = {
|
||||||
|
|
||||||
struct zp {
|
struct zp {
|
||||||
uint64_t cur_samplerate;
|
uint64_t cur_samplerate;
|
||||||
uint64_t period_ps;
|
|
||||||
uint64_t limit_samples;
|
uint64_t limit_samples;
|
||||||
int num_channels; /* TODO: This isn't initialized before it's needed :( */
|
int num_channels; /* TODO: This isn't initialized before it's needed :( */
|
||||||
uint64_t memory_size;
|
uint64_t memory_size;
|
||||||
|
@ -353,7 +352,6 @@ static int hw_init(const char *deviceinfo)
|
||||||
|
|
||||||
/* Set some sane defaults. */
|
/* Set some sane defaults. */
|
||||||
zp->cur_samplerate = 0;
|
zp->cur_samplerate = 0;
|
||||||
zp->period_ps = 0;
|
|
||||||
zp->limit_samples = 0;
|
zp->limit_samples = 0;
|
||||||
zp->num_channels = 32; /* TODO: This isn't initialized before it's needed :( */
|
zp->num_channels = 32; /* TODO: This isn't initialized before it's needed :( */
|
||||||
zp->memory_size = 0;
|
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);
|
analyzer_set_freq(samplerate, FREQ_SCALE_HZ);
|
||||||
|
|
||||||
zp->cur_samplerate = samplerate;
|
zp->cur_samplerate = samplerate;
|
||||||
zp->period_ps = 1000000000000 / samplerate;
|
|
||||||
|
|
||||||
return SR_OK;
|
return SR_OK;
|
||||||
}
|
}
|
||||||
|
@ -675,8 +672,6 @@ static int hw_start_acquisition(int device_index, gpointer session_data)
|
||||||
PACKET_SIZE, res);
|
PACKET_SIZE, res);
|
||||||
|
|
||||||
packet.type = SR_DF_LOGIC;
|
packet.type = SR_DF_LOGIC;
|
||||||
packet.timeoffset = samples_read * zp->period_ps;
|
|
||||||
packet.duration = res / 4 * zp->period_ps;
|
|
||||||
packet.payload = &logic;
|
packet.payload = &logic;
|
||||||
logic.length = PACKET_SIZE;
|
logic.length = PACKET_SIZE;
|
||||||
logic.unitsize = 4;
|
logic.unitsize = 4;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* This file is part of the sigrok project.
|
* 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
|
* 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
|
* 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");
|
sr_dbg("bus: received SR_DF_HEADER");
|
||||||
break;
|
break;
|
||||||
case SR_DF_TRIGGER:
|
case SR_DF_TRIGGER:
|
||||||
sr_dbg("bus: received SR_DF_TRIGGER at %lu ms",
|
sr_dbg("bus: received SR_DF_TRIGGER");
|
||||||
packet->timeoffset / 1000000);
|
|
||||||
break;
|
break;
|
||||||
case SR_DF_LOGIC:
|
case SR_DF_LOGIC:
|
||||||
logic = packet->payload;
|
logic = packet->payload;
|
||||||
/* TODO: Check for logic != NULL. */
|
/* TODO: Check for logic != NULL. */
|
||||||
sr_dbg("bus: received SR_DF_LOGIC at %f ms duration %f ms, "
|
sr_dbg("bus: received SR_DF_LOGIC %" PRIu64 " bytes", logic->length);
|
||||||
"%" PRIu64 " bytes", packet->timeoffset / 1000000.0,
|
|
||||||
packet->duration / 1000000.0, logic->length);
|
|
||||||
break;
|
break;
|
||||||
case SR_DF_END:
|
case SR_DF_END:
|
||||||
sr_dbg("bus: received SR_DF_END");
|
sr_dbg("bus: received SR_DF_END");
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* This file is part of the sigrok project.
|
* 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
|
* 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
|
* 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 session_vdevice *vdevice;
|
||||||
struct sr_datafeed_packet packet;
|
struct sr_datafeed_packet packet;
|
||||||
struct sr_datafeed_logic logic;
|
struct sr_datafeed_logic logic;
|
||||||
uint64_t sample_period_ps;
|
|
||||||
GSList *l;
|
GSList *l;
|
||||||
void *buf;
|
void *buf;
|
||||||
int ret, got_data;
|
int ret, got_data;
|
||||||
|
@ -116,9 +115,6 @@ static int feed_chunk(int fd, int revents, void *session_data)
|
||||||
if (ret > 0) {
|
if (ret > 0) {
|
||||||
got_data = TRUE;
|
got_data = TRUE;
|
||||||
packet.type = SR_DF_LOGIC;
|
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;
|
packet.payload = &logic;
|
||||||
logic.length = ret;
|
logic.length = ret;
|
||||||
logic.unitsize = vdevice->unitsize;
|
logic.unitsize = vdevice->unitsize;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* This file is part of the sigrok project.
|
* 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
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -94,10 +94,6 @@ enum {
|
||||||
|
|
||||||
struct sr_datafeed_packet {
|
struct sr_datafeed_packet {
|
||||||
uint16_t type;
|
uint16_t type;
|
||||||
/* timeoffset since start, in picoseconds */
|
|
||||||
uint64_t timeoffset;
|
|
||||||
/* duration of data in this packet, in picoseconds */
|
|
||||||
uint64_t duration;
|
|
||||||
void *payload;
|
void *payload;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue