]> sigrok.org Git - libsigrok.git/blobdiff - sigrok.h
Add ARRAY_AND_SIZE macro
[libsigrok.git] / sigrok.h
index dd9881a79b58d814e821461968c316cca65b29a5..16a415704b51aa453854c2544c64cd4ee96c13c2 100644 (file)
--- a/sigrok.h
+++ b/sigrok.h
 #define SIGROK_ERR_MALLOC              -2 /* Malloc/calloc/realloc error */
 #define SIGROK_ERR_SAMPLERATE          -3 /* Incorrect samplerate */
 
+/* limited by uint64_t */
+#define MAX_NUM_PROBES 64
+#define MAX_PROBENAME_LEN 32
+
+
 /* Handy little macros */
 #define KHZ(n) ((n) * 1000)
 #define MHZ(n) ((n) * 1000000)
 #define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
 #endif
 
+#ifndef ARRAY_AND_SIZE
+#define ARRAY_AND_SIZE(a) (a), ARRAY_SIZE(a)
+#endif
+
 /* Data types, used by hardware plugins for set_configuration() */
 enum {
        T_UINT64,
@@ -84,17 +93,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;
 };
 
@@ -153,6 +160,7 @@ int filter_probes(int in_unitsize, int out_unitsize, int *probelist,
                  uint64_t *length_out);
 
 char *sigrok_samplerate_string(uint64_t samplerate);
+char *sigrok_period_string(uint64_t frequency);
 
 /*--- analyzer.c ------------------------------------------------------------*/
 
@@ -210,7 +218,6 @@ struct device {
        struct datastore *datastore;
 };
 
-#define MAX_PROBENAME_LEN 32
 struct probe {
        int index;
        gboolean enabled;