]> sigrok.org Git - libsigrok.git/blobdiff - sigrok.h
Sigma: Update set_configuration to reflect API.
[libsigrok.git] / sigrok.h
index 4373fcb497266c6663e64e059923fef8373daae7..2f31a34b252421555525f752529b247da4e96da5 100644 (file)
--- a/sigrok.h
+++ b/sigrok.h
@@ -27,7 +27,6 @@
 #include <glib.h>
 #include <libusb.h>
 
-
 /*
  * Status/error codes returned by libsigrok functions.
  *
 #define MAX_NUM_PROBES 64
 #define MAX_PROBENAME_LEN 32
 
-
 /* Handy little macros */
 #define KHZ(n) ((n) * 1000)
 #define MHZ(n) ((n) * 1000000)
 #define GHZ(n) ((n) * 1000000000)
 
+#define HZ_TO_NS(n) (1000000000 / (n))
+
 #ifndef ARRAY_SIZE
 #define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
 #endif
 #define ARRAY_AND_SIZE(a) (a), ARRAY_SIZE(a)
 #endif
 
-
 typedef int (*receive_data_callback) (int fd, int revents, void *user_data);
 
-
 /* Data types used by hardware plugins for set_configuration() */
 enum {
        T_UINT64,
@@ -89,8 +87,6 @@ struct protocol {
        int stackindex;
 };
 
-
-
 /* datafeed_packet.type values */
 enum {
        DF_HEADER,
@@ -113,26 +109,24 @@ struct datafeed_header {
        struct timeval starttime;
        uint64_t samplerate;
        int protocol_id;
-       int num_probes;
+       int num_analog_probes;
+       int num_logic_probes;
 };
 
-
-
 struct input {
        struct input_format *format;
-       void *param;
-       void *internal;
+       char *param;
+       struct device *vdevice;
 };
 
 struct input_format {
        char *extension;
        char *description;
        int (*format_match) (const char *filename);
-       int (*in_loadfile) (const char *filename);
+       int (*init) (struct input *in);
+       int (*loadfile) (struct input *in, const char *filename);
 };
 
-
-
 struct output {
        struct output_format *format;
        struct device *device;
@@ -151,7 +145,6 @@ struct output_format {
                      uint64_t *length_out);
 };
 
-
 struct analyzer {
        char *name;
        char *filename;
@@ -161,7 +154,6 @@ struct analyzer {
         */
 };
 
-
 /* Size of a chunk in units */
 #define DATASTORE_CHUNKSIZE 512000
 
@@ -172,7 +164,6 @@ struct datastore {
        GSList *chunklist;
 };
 
-
 /*
  * This represents a generic device connected to the system.
  * For device-specific information, ask the plugin. The plugin_index refers
@@ -190,8 +181,14 @@ struct device {
        struct datastore *datastore;
 };
 
+enum {
+       PROBE_TYPE_LOGIC,
+       PROBE_TYPE_ANALOG,
+};
+
 struct probe {
        int index;
+       int type;
        gboolean enabled;
        char *name;
        char *trigger;
@@ -199,16 +196,22 @@ struct probe {
 
 extern GSList *devices;
 
-
 /* Hardware plugin capabilities */
 enum {
-       HWCAP_DUMMY,            /* Used to terminate lists */
+       HWCAP_DUMMY,             /* Used to terminate lists */
+       /* device classes */
        HWCAP_LOGIC_ANALYZER,
-       HWCAP_SAMPLERATE,       /* Change samplerate */
-       HWCAP_PROBECONFIG,      /* Configure probe mask */
-       HWCAP_CAPTURE_RATIO,    /* Set pre/post-trigger capture ratio */
-       HWCAP_LIMIT_MSEC,       /* Set a time limit for sample acquisition */
-       HWCAP_LIMIT_SAMPLES,    /* Set a limit on number of samples */
+
+       /* device options */
+       HWCAP_SAMPLERATE,        /* Change samplerate */
+       HWCAP_PROBECONFIG,       /* Configure probe mask */
+       HWCAP_CAPTURE_RATIO,     /* Set pre/post-trigger capture ratio */
+       HWCAP_PATTERN_MODE,      /* Pattern generator mode */
+
+       /* acquisition modes */
+       HWCAP_LIMIT_MSEC,        /* Set a time limit for sample acquisition */
+       HWCAP_LIMIT_SAMPLES,     /* Set a limit on number of samples */
+       HWCAP_CONTINUOUS,
 };
 
 struct hwcap_option {
@@ -218,7 +221,6 @@ struct hwcap_option {
        char *shortname;
 };
 
-
 struct sigrok_device_instance {
        int index;
        int status;
@@ -278,6 +280,8 @@ enum {
        DI_TRIGGER_TYPES,
        /* The currently set samplerate in Hz (uint64_t) */
        DI_CUR_SAMPLERATE,
+       /* Supported pattern generator modes */
+       DI_PATTERNMODES,
 };
 
 /*
@@ -328,4 +332,5 @@ struct session {
 };
 
 #include "sigrok-proto.h"
+
 #endif