sr: change all drivers to use SR_DF_META_LOGIC
This commit is contained in:
parent
ee7489d234
commit
f366e86c68
|
@ -1265,6 +1265,7 @@ static int hw_dev_acquisition_start(int dev_index, void *cb_data)
|
|||
struct context *ctx;
|
||||
struct sr_datafeed_packet *packet;
|
||||
struct sr_datafeed_header *header;
|
||||
struct sr_datafeed_meta_logic meta;
|
||||
struct clockselect_50 clockselect;
|
||||
int frac, triggerpin, ret;
|
||||
uint8_t triggerselect;
|
||||
|
@ -1366,17 +1367,23 @@ static int hw_dev_acquisition_start(int dev_index, void *cb_data)
|
|||
return SR_ERR_MALLOC;
|
||||
}
|
||||
|
||||
/* Add capture source. */
|
||||
sr_source_add(0, G_IO_IN, 10, receive_data, sdi);
|
||||
|
||||
/* Send header packet to the session bus. */
|
||||
packet->type = SR_DF_HEADER;
|
||||
packet->payload = header;
|
||||
header->feed_version = 1;
|
||||
gettimeofday(&header->starttime, NULL);
|
||||
header->samplerate = ctx->cur_samplerate;
|
||||
header->num_logic_probes = ctx->num_probes;
|
||||
sr_session_send(ctx->session_dev_id, packet);
|
||||
|
||||
/* Send metadata about the SR_DF_LOGIC packets to come. */
|
||||
packet->type = SR_DF_META_LOGIC;
|
||||
packet->payload = &meta;
|
||||
meta.samplerate = ctx->cur_samplerate;
|
||||
meta.num_probes = ctx->num_probes;
|
||||
sr_session_send(ctx->session_dev_id, packet);
|
||||
|
||||
/* Add capture source. */
|
||||
sr_source_add(0, G_IO_IN, 10, receive_data, sdi);
|
||||
|
||||
g_free(header);
|
||||
g_free(packet);
|
||||
|
||||
|
|
|
@ -1016,6 +1016,7 @@ static int hw_dev_acquisition_start(int dev_index, void *cb_data)
|
|||
struct context *ctx;
|
||||
struct sr_datafeed_packet packet;
|
||||
struct sr_datafeed_header header;
|
||||
struct sr_datafeed_meta_logic meta;
|
||||
uint8_t buf[4];
|
||||
int bytes_written;
|
||||
|
||||
|
@ -1069,8 +1070,13 @@ static int hw_dev_acquisition_start(int dev_index, void *cb_data)
|
|||
packet.payload = &header;
|
||||
header.feed_version = 1;
|
||||
gettimeofday(&header.starttime, NULL);
|
||||
header.samplerate = ctx->cur_samplerate;
|
||||
header.num_logic_probes = NUM_PROBES;
|
||||
sr_session_send(ctx->session_dev_id, &packet);
|
||||
|
||||
/* Send metadata about the SR_DF_LOGIC packets to come. */
|
||||
packet.type = SR_DF_META_LOGIC;
|
||||
packet.payload = &meta;
|
||||
meta.samplerate = ctx->cur_samplerate;
|
||||
meta.num_probes = NUM_PROBES;
|
||||
sr_session_send(ctx->session_dev_id, &packet);
|
||||
|
||||
/* Time when we should be done (for detecting trigger timeouts). */
|
||||
|
|
|
@ -414,6 +414,7 @@ static int hw_dev_acquisition_start(int dev_index, void *cb_data)
|
|||
{
|
||||
struct sr_datafeed_packet *packet;
|
||||
struct sr_datafeed_header *header;
|
||||
struct sr_datafeed_meta_logic meta;
|
||||
struct context *ctx;
|
||||
|
||||
/* TODO: 'ctx' is never g_free()'d? */
|
||||
|
@ -473,9 +474,15 @@ static int hw_dev_acquisition_start(int dev_index, void *cb_data)
|
|||
packet->payload = header;
|
||||
header->feed_version = 1;
|
||||
gettimeofday(&header->starttime, NULL);
|
||||
header->samplerate = cur_samplerate;
|
||||
header->num_logic_probes = NUM_PROBES;
|
||||
sr_session_send(ctx->session_dev_id, packet);
|
||||
|
||||
/* Send metadata about the SR_DF_LOGIC packets to come. */
|
||||
packet->type = SR_DF_META_LOGIC;
|
||||
packet->payload = &meta;
|
||||
meta.samplerate = cur_samplerate;
|
||||
meta.num_probes = NUM_PROBES;
|
||||
sr_session_send(ctx->session_dev_id, packet);
|
||||
|
||||
g_free(header);
|
||||
g_free(packet);
|
||||
|
||||
|
|
|
@ -794,6 +794,7 @@ static int hw_dev_acquisition_start(int dev_index, void *cb_data)
|
|||
struct sr_dev_inst *sdi;
|
||||
struct sr_datafeed_packet *packet;
|
||||
struct sr_datafeed_header *header;
|
||||
struct sr_datafeed_meta_logic meta;
|
||||
struct context *ctx;
|
||||
struct libusb_transfer *transfer;
|
||||
const struct libusb_pollfd **lupfd;
|
||||
|
@ -848,9 +849,15 @@ static int hw_dev_acquisition_start(int dev_index, void *cb_data)
|
|||
packet->payload = header;
|
||||
header->feed_version = 1;
|
||||
gettimeofday(&header->starttime, NULL);
|
||||
header->samplerate = ctx->cur_samplerate;
|
||||
header->num_logic_probes = ctx->profile->num_probes;
|
||||
sr_session_send(cb_data, packet);
|
||||
|
||||
/* Send metadata about the SR_DF_LOGIC packets to come. */
|
||||
packet->type = SR_DF_META_LOGIC;
|
||||
packet->payload = &meta;
|
||||
meta.samplerate = ctx->cur_samplerate;
|
||||
meta.num_probes = ctx->profile->num_probes;
|
||||
sr_session_send(cb_data, packet);
|
||||
|
||||
g_free(header);
|
||||
g_free(packet);
|
||||
|
||||
|
|
|
@ -876,6 +876,7 @@ static int hw_dev_acquisition_start(int dev_index, void *cb_data)
|
|||
{
|
||||
struct sr_datafeed_packet *packet;
|
||||
struct sr_datafeed_header *header;
|
||||
struct sr_datafeed_meta_logic meta;
|
||||
struct sr_dev_inst *sdi;
|
||||
struct context *ctx;
|
||||
uint32_t trigger_config[4];
|
||||
|
@ -1015,8 +1016,13 @@ static int hw_dev_acquisition_start(int dev_index, void *cb_data)
|
|||
packet->payload = (unsigned char *)header;
|
||||
header->feed_version = 1;
|
||||
gettimeofday(&header->starttime, NULL);
|
||||
header->samplerate = ctx->cur_samplerate;
|
||||
header->num_logic_probes = NUM_PROBES;
|
||||
sr_session_send(cb_data, packet);
|
||||
|
||||
/* Send metadata about the SR_DF_LOGIC packets to come. */
|
||||
packet->type = SR_DF_META_LOGIC;
|
||||
packet->payload = &meta;
|
||||
meta.samplerate = ctx->cur_samplerate;
|
||||
meta.num_probes = NUM_PROBES;
|
||||
sr_session_send(cb_data, packet);
|
||||
|
||||
g_free(header);
|
||||
|
|
|
@ -633,6 +633,7 @@ static int hw_dev_acquisition_start(int dev_index, void *cb_data)
|
|||
struct sr_datafeed_packet packet;
|
||||
struct sr_datafeed_logic logic;
|
||||
struct sr_datafeed_header header;
|
||||
struct sr_datafeed_meta_logic meta;
|
||||
uint64_t samples_read;
|
||||
int res;
|
||||
unsigned int packet_num;
|
||||
|
@ -667,8 +668,13 @@ static int hw_dev_acquisition_start(int dev_index, void *cb_data)
|
|||
packet.payload = &header;
|
||||
header.feed_version = 1;
|
||||
gettimeofday(&header.starttime, NULL);
|
||||
header.samplerate = ctx->cur_samplerate;
|
||||
header.num_logic_probes = ctx->num_channels;
|
||||
sr_session_send(cb_data, &packet);
|
||||
|
||||
/* Send metadata about the SR_DF_LOGIC packets to come. */
|
||||
packet.type = SR_DF_META_LOGIC;
|
||||
packet.payload = &meta;
|
||||
meta.samplerate = ctx->cur_samplerate;
|
||||
meta.num_probes = ctx->num_channels;
|
||||
sr_session_send(cb_data, &packet);
|
||||
|
||||
if (!(buf = g_try_malloc(PACKET_SIZE))) {
|
||||
|
|
|
@ -67,6 +67,7 @@ static int loadfile(struct sr_input *in, const char *filename)
|
|||
{
|
||||
struct sr_datafeed_header header;
|
||||
struct sr_datafeed_packet packet;
|
||||
struct sr_datafeed_meta_logic meta;
|
||||
struct sr_datafeed_logic logic;
|
||||
unsigned char buffer[CHUNKSIZE];
|
||||
int fd, size, num_probes;
|
||||
|
@ -78,13 +79,18 @@ static int loadfile(struct sr_input *in, const char *filename)
|
|||
|
||||
/* send header */
|
||||
header.feed_version = 1;
|
||||
header.num_logic_probes = num_probes;
|
||||
header.samplerate = 0;
|
||||
gettimeofday(&header.starttime, NULL);
|
||||
packet.type = SR_DF_HEADER;
|
||||
packet.payload = &header;
|
||||
sr_session_send(in->vdev, &packet);
|
||||
|
||||
/* Send metadata about the SR_DF_LOGIC packets to come. */
|
||||
packet.type = SR_DF_META_LOGIC;
|
||||
packet.payload = &meta;
|
||||
meta.samplerate = 0;
|
||||
meta.num_probes = num_probes;
|
||||
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;
|
||||
packet.payload = &logic;
|
||||
|
|
|
@ -123,6 +123,7 @@ static int loadfile(struct sr_input *in, const char *filename)
|
|||
{
|
||||
struct sr_datafeed_header header;
|
||||
struct sr_datafeed_packet packet;
|
||||
struct sr_datafeed_meta_logic meta;
|
||||
struct sr_datafeed_logic logic;
|
||||
uint8_t buf[PACKET_SIZE], divcount;
|
||||
int i, fd, size, num_probes;
|
||||
|
@ -153,8 +154,13 @@ static int loadfile(struct sr_input *in, const char *filename)
|
|||
packet.payload = &header;
|
||||
header.feed_version = 1;
|
||||
gettimeofday(&header.starttime, NULL);
|
||||
header.num_logic_probes = num_probes;
|
||||
header.samplerate = samplerate;
|
||||
sr_session_send(in->vdev, &packet);
|
||||
|
||||
/* Send metadata about the SR_DF_LOGIC packets to come. */
|
||||
packet.type = SR_DF_META_LOGIC;
|
||||
packet.payload = &meta;
|
||||
meta.samplerate = samplerate;
|
||||
meta.num_probes = num_probes;
|
||||
sr_session_send(in->vdev, &packet);
|
||||
|
||||
/* TODO: Handle trigger point. */
|
||||
|
|
|
@ -274,6 +274,7 @@ static int hw_dev_acquisition_start(int dev_index, void *cb_data)
|
|||
struct session_vdev *vdev;
|
||||
struct sr_datafeed_header *header;
|
||||
struct sr_datafeed_packet *packet;
|
||||
struct sr_datafeed_meta_logic meta;
|
||||
int ret;
|
||||
|
||||
if (!(vdev = get_vdev_by_index(dev_index)))
|
||||
|
@ -318,9 +319,15 @@ static int hw_dev_acquisition_start(int dev_index, void *cb_data)
|
|||
packet->payload = (unsigned char *)header;
|
||||
header->feed_version = 1;
|
||||
gettimeofday(&header->starttime, NULL);
|
||||
header->samplerate = vdev->samplerate;
|
||||
header->num_logic_probes = vdev->num_probes;
|
||||
sr_session_send(cb_data, packet);
|
||||
|
||||
/* Send metadata about the SR_DF_LOGIC packets to come. */
|
||||
packet->type = SR_DF_META_LOGIC;
|
||||
packet->payload = &meta;
|
||||
meta.samplerate = vdev->samplerate;
|
||||
meta.num_probes = vdev->num_probes;
|
||||
sr_session_send(cb_data, packet);
|
||||
|
||||
g_free(header);
|
||||
g_free(packet);
|
||||
|
||||
|
|
Loading…
Reference in New Issue