]> sigrok.org Git - libsigrok.git/blobdiff - hardware/demo/demo.c
sr: Mark API functions with SR_API/SR_PRIV.
[libsigrok.git] / hardware / demo / demo.c
index 6605d1e6c321f6fe5be8998d65a4799a5594cce3..05f19e1d2a81390c50c7afb272d826058c568cba 100644 (file)
@@ -27,7 +27,6 @@
 #include <fcntl.h>
 #define pipe(fds) _pipe(fds, 4096, _O_BINARY)
 #endif
-#include "config.h"
 #include "sigrok.h"
 #include "sigrok-internal.h"
 
@@ -79,6 +78,7 @@ struct databag {
 
 static int capabilities[] = {
        SR_HWCAP_LOGIC_ANALYZER,
+       SR_HWCAP_DEMO_DEVICE,
        SR_HWCAP_SAMPLERATE,
        SR_HWCAP_PATTERN_MODE,
        SR_HWCAP_LIMIT_SAMPLES,
@@ -128,7 +128,6 @@ static uint8_t pattern_sigrok[] = {
 /* List of struct sr_device_instance, maintained by opendev()/closedev(). */
 static GSList *device_instances = NULL;
 static uint64_t cur_samplerate = SR_KHZ(200);
-static uint64_t period_ps = 5000000;
 static uint64_t limit_samples = 0;
 static uint64_t limit_msec = 0;
 static int default_pattern = PATTERN_SIGROK;
@@ -240,7 +239,6 @@ static int hw_set_configuration(int device_index, int capability, void *value)
                ret = SR_OK;
        } else if (capability == SR_HWCAP_SAMPLERATE) {
                cur_samplerate = *(uint64_t *)value;
-               period_ps = 1000000000000 / cur_samplerate;
                sr_dbg("demo: %s: setting samplerate to %" PRIu64, __func__,
                       cur_samplerate);
                ret = SR_OK;
@@ -384,8 +382,6 @@ static int receive_data(int fd, int revents, void *session_data)
                if (z > 0) {
                        packet.type = SR_DF_LOGIC;
                        packet.payload = &logic;
-                       packet.timeoffset =  samples_received * period_ps;
-                       packet.duration = z * period_ps;
                        logic.length = z;
                        logic.unitsize = 1;
                        logic.data = c;
@@ -469,8 +465,6 @@ static int hw_start_acquisition(int device_index, gpointer session_data)
 
        packet->type = SR_DF_HEADER;
        packet->payload = header;
-       packet->timeoffset = 0;
-       packet->duration = 0;
        header->feed_version = 1;
        gettimeofday(&header->starttime, NULL);
        header->samplerate = cur_samplerate;