]> sigrok.org Git - libsigrok.git/blobdiff - sigrok.h
Add ARRAY_AND_SIZE macro
[libsigrok.git] / sigrok.h
index 4d942fb15c6405f1c131371579d20686398b96a0..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;
-       uint16_t length;
+       uint64_t length;
+       uint16_t unitsize;
        void *payload;
 };
 
@@ -118,8 +125,8 @@ struct input {
 struct input_format {
        char *extension;
        char *description;
-       int (*format_match) (char *filename);
-       int (*in_loadfile) (char *filename);
+       int (*format_match) (const char *filename);
+       int (*in_loadfile) (const char *filename);
 };
 
 struct input_format **input_list(void);
@@ -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 ------------------------------------------------------------*/
 
@@ -429,6 +437,7 @@ int ezusb_upload_firmware(libusb_device *dev, int configuration,
 GSList *list_serial_ports(void);
 int serial_open(const char *pathname, int flags);
 int serial_close(int fd);
+int serial_flush(int fd);
 void *serial_backup_params(int fd);
 void serial_restore_params(int fd, void *backup);
 int serial_set_params(int fd, int speed, int bits, int parity, int stopbits,