]> sigrok.org Git - libsigrok.git/commitdiff
sr: change all drivers to use SR_DF_META_LOGIC
authorBert Vermeulen <redacted>
Sun, 22 Apr 2012 18:06:19 +0000 (20:06 +0200)
committerBert Vermeulen <redacted>
Wed, 30 May 2012 21:55:36 +0000 (23:55 +0200)
hardware/asix-sigma/asix-sigma.c
hardware/chronovu-la8/chronovu-la8.c
hardware/demo/demo.c
hardware/fx2lafw/fx2lafw.c
hardware/openbench-logic-sniffer/ols.c
hardware/zeroplus-logic-cube/zeroplus.c
input/binary.c
input/chronovu_la8.c
session_driver.c

index 3c2f269a0938cf56546d9b30ddd3a27b5d2afb52..39e2dbed79cb8ef364557173c0a6b7a96abb436b 100644 (file)
@@ -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);
 
index 06de6340090be57b57b17ba5adbc80d9e10c8329..ee112ed05fbb7527616f2532b6f489fb04c9793a 100644 (file)
@@ -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). */
index 48f7cf52791d1c74538c879c3bf8417d1cb42824..51644fc418794efd7a9ae38f361ed4a3386ff971 100644 (file)
@@ -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);
 
index 0ea4030d7b1fcffb2f81f191275f43fa3a17fab8..0f839b57ca6f228d2a550a93c013da6656514914 100644 (file)
@@ -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);
 
index 1a9b5555eb463ca7d2912f1a7689fb80fab2f165..8862db242f8c1d610621986e66fcc087fb07a16b 100644 (file)
@@ -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);
index ec0e6a2b1db49c92a8c066a7130584ace75fe347..d27fb39bda4a6c797ad4e2e8d0ce0e05523653f6 100644 (file)
@@ -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))) {
index 89a6b25bb9cbfb73289df0e53c6b385a2976a007..4d6c42461e64051af849fddf86ecef1a4f513e98 100644 (file)
@@ -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;
index b9f14dd308b9143be55b6ca6b08837299141a404..79f83cc916345ac7be7d9e1bb16d171902f355bb 100644 (file)
@@ -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. */
index b64ce3a35a555c7b0ec2ed257f33f4d592ab2d8b..32b8e905fc26a0253fb540e8a5d8550434701014 100644 (file)
@@ -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);