]> sigrok.org Git - libsigrok.git/commitdiff
change all DF_LOGIC* to a single DF_LOGIC type
authorBert Vermeulen <redacted>
Sun, 9 Jan 2011 05:32:38 +0000 (06:32 +0100)
committerBert Vermeulen <redacted>
Sun, 9 Jan 2011 05:32:38 +0000 (06:32 +0100)
The datafeed packet has a new field 'unitsize' to denote the number of
bytes per sample in the payload.

hardware/asix-sigma/asix-sigma.c
hardware/demo/demo.c
hardware/openbench-logic-sniffer/ols.c
hardware/saleae-logic/saleae-logic.c
hardware/zeroplus-logic-cube/zeroplus.c
input/input_binary.c
sigrok.h

index 05467824cd4f60fcdfd1b70ede9e3c66e17fea85..09c8799301f8a9c58cd013993b46271c2b8dd808 100644 (file)
@@ -812,8 +812,9 @@ static int decode_chunk_ts(uint8_t *buf, uint16_t *lastts,
                while (sent < n) {
                        tosend = MIN(2048, n - sent);
 
-                       packet.type = DF_LOGIC16;
+                       packet.type = DF_LOGIC;
                        packet.length = tosend * sizeof(uint16_t);
+                       packet.unitsize = 2;
                        packet.payload = samples + sent;
                        session_bus(user_data, &packet);
 
@@ -854,8 +855,9 @@ static int decode_chunk_ts(uint8_t *buf, uint16_t *lastts,
                                                    &trigger);
 
                        if (tosend > 0) {
-                               packet.type = DF_LOGIC16;
+                               packet.type = DF_LOGIC;
                                packet.length = tosend * sizeof(uint16_t);
+                               packet.unitsize = 2;
                                packet.payload = samples;
                                session_bus(user_data, &packet);
 
@@ -871,8 +873,9 @@ static int decode_chunk_ts(uint8_t *buf, uint16_t *lastts,
                /* Send rest of the chunk to sigrok. */
                tosend = n - sent;
 
-               packet.type = DF_LOGIC16;
+               packet.type = DF_LOGIC;
                packet.length = tosend * sizeof(uint16_t);
+               packet.unitsize = 2;
                packet.payload = samples + sent;
                session_bus(user_data, &packet);
 
index b5598a52ff4ebc2e3930c4cf1f723a3faeaba913..cb627ef56a8947f3ca12cde7445e38922334db64 100644 (file)
@@ -258,8 +258,9 @@ static int receive_data(int fd, int revents, void *user_data)
 
        z = read(fd, &c, BUFSIZE);
        if (z > 0) {
-               packet.type = DF_LOGIC8;
+               packet.type = DF_LOGIC;
                packet.length = z;
+               packet.unitsize = 1;
                packet.payload = c;
                session_bus(user_data, &packet);
        }
index cbe145d88a9901b8fab68232c11f532ce24e7670..0e7914570527d8056f17338617e77cb8a4ba620b 100644 (file)
@@ -604,8 +604,9 @@ static int receive_data(int fd, int revents, void *user_data)
                         */
                        if (trigger_at > 0) {
                                /* there are pre-trigger samples, send those first */
-                               packet.type = DF_LOGIC32;
+                               packet.type = DF_LOGIC;
                                packet.length = trigger_at * 4;
+                               packet.unitsize = 4;
                                packet.payload = raw_sample_buf;
                                session_bus(user_data, &packet);
                        }
@@ -614,13 +615,15 @@ static int receive_data(int fd, int revents, void *user_data)
                        packet.length = 0;
                        session_bus(user_data, &packet);
 
-                       packet.type = DF_LOGIC32;
+                       packet.type = DF_LOGIC;
                        packet.length = (limit_samples * 4) - (trigger_at * 4);
+                       packet.unitsize = 4;
                        packet.payload = raw_sample_buf + trigger_at * 4;
                        session_bus(user_data, &packet);
                } else {
-                       packet.type = DF_LOGIC32;
+                       packet.type = DF_LOGIC;
                        packet.length = limit_samples * 4;
+                       packet.unitsize = 4;
                        packet.payload = raw_sample_buf;
                        session_bus(user_data, &packet);
                }
index 58f31acfaef37c191b8d4d7d4ecba436cff1a3b1..b80808db35dc49045cb52a74195fb1afa84b632b 100644 (file)
@@ -613,8 +613,9 @@ void receive_transfer(struct libusb_transfer *transfer)
                                         * Send the samples that triggered it, since we're
                                         * skipping past them.
                                         */
-                                       packet.type = DF_LOGIC8;
+                                       packet.type = DF_LOGIC;
                                        packet.length = trigger_stage;
+                                       packet.unitsize = 1;
                                        packet.payload = trigger_buffer;
                                        session_bus(user_data, &packet);
 
@@ -645,8 +646,9 @@ void receive_transfer(struct libusb_transfer *transfer)
 
        if (trigger_stage == TRIGGER_FIRED) {
                /* Send the incoming transfer to the session bus. */
-               packet.type = DF_LOGIC8;
+               packet.type = DF_LOGIC;
                packet.length = cur_buflen - trigger_offset;
+               packet.unitsize = 1;
                packet.payload = cur_buf + trigger_offset;
                session_bus(user_data, &packet);
                g_free(cur_buf);
index 316acfeb77a9b2020ba266887fad00610b5b2db7..eef93cbfe265e592f187c578105484886f5873c9 100644 (file)
@@ -528,8 +528,9 @@ static int hw_start_acquisition(int device_index, gpointer session_device_id)
                          PACKET_SIZE, res);
 #endif
 
-               packet.type = DF_LOGIC32;
+               packet.type = DF_LOGIC;
                packet.length = PACKET_SIZE;
+               packet.unitsize = 4;
                packet.payload = buf;
                session_bus(session_device_id, &packet);
        }
index 113b34f6effeaedbdc7dbe3f411246f5d6191e81..7c9f96ba9f3d9a99bfa4b42a8344260f879b4b7e 100644 (file)
@@ -57,7 +57,8 @@ static int in_loadfile(const char *filename)
        packet.payload = &header;
        session_bus(device, &packet);
 
-       packet.type = DF_LOGIC8;
+       packet.type = DF_LOGIC;
+       packet.unitsize = 1;
        packet.payload = buffer;
        while ((size = read(fd, buffer, CHUNKSIZE)) > 0) {
                packet.length = size;
index 9551b8874a8ad01fb0095c57f334a8809ea21cfa..a9183a39074415919b38da68614ed76e557b70b5 100644 (file)
--- a/sigrok.h
+++ b/sigrok.h
@@ -89,17 +89,15 @@ enum {
        DF_HEADER,
        DF_END,
        DF_TRIGGER,
-       DF_LOGIC8,
-       DF_LOGIC16,
-       DF_LOGIC24,
-       DF_LOGIC32,
-       DF_LOGIC48,
-       DF_LOGIC64,
+       DF_LOGIC,
+       DF_PD,
+       DF_PA,
 };
 
 struct datafeed_packet {
        uint16_t type;
        uint64_t length;
+       uint16_t unitsize;
        void *payload;
 };