X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=sigrok.h;h=5e6f2314c86874538feb79cd64c0c87016bc99dd;hb=1437e8934bd01167f2126616c7e8b44ca342cd27;hp=4d942fb15c6405f1c131371579d20686398b96a0;hpb=a803c0db4d5887c29b8c79626bfcc452845cfed2;p=libsigrok.git diff --git a/sigrok.h b/sigrok.h index 4d942fb1..5e6f2314 100644 --- a/sigrok.h +++ b/sigrok.h @@ -49,6 +49,11 @@ #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) @@ -58,6 +63,10 @@ #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_ANALOG, + DF_PD, }; 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); @@ -138,6 +145,7 @@ struct output { struct output_format { char *extension; char *description; + int df_type; int (*init) (struct output *o); int (*data) (struct output *o, char *data_in, uint64_t length_in, char **data_out, uint64_t *length_out); @@ -153,6 +161,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 ------------------------------------------------------------*/ @@ -261,6 +270,7 @@ struct sigrok_device_instance { char *vendor; char *model; char *version; + void *priv; union { struct usb_device_instance *usb; struct serial_device_instance *serial; @@ -429,6 +439,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,