]> sigrok.org Git - libsigrok.git/commitdiff
chronovu-la: Fix byte order for LA16 samples sent to the bus.
authorUwe Hermann <redacted>
Tue, 1 Apr 2014 21:23:23 +0000 (23:23 +0200)
committerUwe Hermann <redacted>
Wed, 2 Apr 2014 15:20:10 +0000 (17:20 +0200)
hardware/chronovu-la/protocol.c

index 28ac15bee0853f2e3f581ff4caf89b374914f324..5b4723c2db87ad40eaf267cd5ae27334380f6bdb 100644 (file)
@@ -417,8 +417,8 @@ SR_PRIV int cv_read_block(struct dev_context *devc)
 
 SR_PRIV void cv_send_block_to_session_bus(struct dev_context *devc, int block)
 {
-       int i;
-       uint8_t sample, expected_sample;
+       int i, idx;
+       uint8_t sample, expected_sample, tmp8;
        struct sr_datafeed_packet packet;
        struct sr_datafeed_logic logic;
        int trigger_point; /* Relative trigger point (in this block). */
@@ -452,6 +452,16 @@ SR_PRIV void cv_send_block_to_session_bus(struct dev_context *devc, int block)
                }
        }
 
+       /* Swap low and high bytes of the 16-bit LA16 samples. */
+       if (devc->prof->model == CHRONOVU_LA16) {
+               for (i = 0; i < BS; i += 2) {
+                       idx = (block * BS) + i;
+                       tmp8 = devc->final_buf[idx];
+                       devc->final_buf[idx] = devc->final_buf[idx + 1];
+                       devc->final_buf[idx + 1] = tmp8;
+               }
+       }
+
        /* If no trigger was found, send one SR_DF_LOGIC packet. */
        if (trigger_point == -1) {
                /* Send an SR_DF_LOGIC packet to the session bus. */