]> sigrok.org Git - libsigrok.git/blobdiff - hardware/zeroplus-logic-cube/zeroplus.c
update plugins and cli to use new DF_HEADER
[libsigrok.git] / hardware / zeroplus-logic-cube / zeroplus.c
index 5f6ededb1c0192f89b138d2261f4ac94b90baa38..e034dfcc24f588f0b4bcd0441287a93c2b22928a 100644 (file)
@@ -340,7 +340,6 @@ static int hw_opendev(int device_index)
        }
        analyzer_reset(sdi->usb->devhdl);
        analyzer_initialize(sdi->usb->devhdl);
-       analyzer_configure(sdi->usb->devhdl);
 
        analyzer_set_memory_size(MEMORY_SIZE_512K);
        // analyzer_set_freq(g_freq, g_freq_scale);
@@ -444,7 +443,7 @@ static int *hw_get_capabilities(void)
 /* TODO: This will set the same samplerate for all devices. */
 static int set_configuration_samplerate(uint64_t samplerate)
 {
-       g_message("%s(%llu)", __FUNCTION__, samplerate);
+       g_message("%s(%" PRIu64 ")", __FUNCTION__, samplerate);
        if (samplerate > MHZ(1))
                analyzer_set_freq(samplerate / MHZ(1), FREQ_SCALE_MHZ);
        else if (samplerate > KHZ(1))
@@ -492,6 +491,9 @@ static int hw_start_acquisition(int device_index, gpointer session_device_id)
        if (!(sdi = get_sigrok_device_instance(device_instances, device_index)))
                return SIGROK_ERR;
 
+       /* push configured settings to device */
+       analyzer_configure(sdi->usb->devhdl);
+
        analyzer_start(sdi->usb->devhdl);
        g_message("Waiting for data");
        analyzer_wait_data(sdi->usb->devhdl);
@@ -510,7 +512,8 @@ static int hw_start_acquisition(int device_index, gpointer session_device_id)
        gettimeofday(&header.starttime, NULL);
        header.samplerate = cur_samplerate;
        header.protocol_id = PROTO_RAW;
-       header.num_probes = num_channels;
+       header.num_logic_probes = num_channels;
+       header.num_analog_probes = 0;
        session_bus(session_device_id, &packet);
 
        buf = g_malloc(PACKET_SIZE);
@@ -526,8 +529,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);
        }