]> sigrok.org Git - libsigrok.git/blobdiff - sigrok.h
Add sr_ prefix to input/output structs.
[libsigrok.git] / sigrok.h
index e3b6ac78c56dbd5de0e27d626671ad9e3ce28fa6..d7d8c2fab317e283ed9337d395383942236672a2 100644 (file)
--- a/sigrok.h
+++ b/sigrok.h
@@ -48,10 +48,10 @@ extern "C" {
  * or reused for different #defines later. You can only add new #defines and
  * return codes, but never remove or redefine existing ones.
  */
-#define SIGROK_OK                 0 /* No error */
-#define SIGROK_ERR               -1 /* Generic/unspecified error */
-#define SIGROK_ERR_MALLOC        -2 /* Malloc/calloc/realloc error */
-#define SIGROK_ERR_SAMPLERATE    -3 /* Incorrect samplerate */
+#define SR_OK                 0 /* No error */
+#define SR_ERR               -1 /* Generic/unspecified error */
+#define SR_ERR_MALLOC        -2 /* Malloc/calloc/realloc error */
+#define SR_ERR_SAMPLERATE    -3 /* Incorrect samplerate */
 
 /* limited by uint64_t */
 #define MAX_NUM_PROBES 64
@@ -78,6 +78,7 @@ typedef int (*receive_data_callback) (int fd, int revents, void *user_data);
 enum {
        T_UINT64,
        T_CHAR,
+       T_NULL,
 };
 
 enum {
@@ -128,35 +129,35 @@ struct analog_sample {
        struct analog_probe probes[];
 };
 
-struct input {
-       struct input_format *format;
+struct sr_input {
+       struct sr_input_format *format;
        char *param;
        struct device *vdevice;
 };
 
-struct input_format {
+struct sr_input_format {
        char *extension;
        char *description;
        int (*format_match) (const char *filename);
-       int (*init) (struct input *in);
-       int (*loadfile) (struct input *in, const char *filename);
+       int (*init) (struct sr_input *in);
+       int (*loadfile) (struct sr_input *in, const char *filename);
 };
 
-struct output {
-       struct output_format *format;
+struct sr_output {
+       struct sr_output_format *format;
        struct device *device;
        char *param;
        void *internal;
 };
 
-struct output_format {
+struct sr_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,
+       int (*init) (struct sr_output *o);
+       int (*data) (struct sr_output *o, char *data_in, uint64_t length_in,
                     char **data_out, uint64_t *length_out);
-       int (*event) (struct output *o, int event_type, char **data_out,
+       int (*event) (struct sr_output *o, int event_type, char **data_out,
                      uint64_t *length_out);
 };
 
@@ -341,9 +342,10 @@ struct session {
        GSList *devices;
        /* List of struct analyzer* */
        GSList *analyzers;
-       /* Datafeed callbacks */
+       /* list of receive_data_callback */
        GSList *datafeed_callbacks;
        GTimeVal starttime;
+       gboolean running;
 };
 
 #include "sigrok-proto.h"