+/**
+ * Structure which contains information about one protocol decoder probe.
+ * For example, I2C has two probes, SDA and SCL.
+ */
+struct srd_probe {
+ /** The ID of the probe. Must be non-NULL. */
+ char *id;
+ /** The name of the probe. Must not be NULL. */
+ char *name;
+ /** The description of the probe. Must not be NULL. */
+ char *desc;
+ /** The index of the probe, i.e. its order in the list of probes. */
+ int order;
+};
+
+struct srd_decoder_inst {
+ struct srd_decoder *decoder;
+ PyObject *py_inst;
+ char *inst_id;
+ GSList *pd_output;
+ int dec_num_probes;
+ int *dec_probemap;
+ int data_num_probes;
+ int data_unitsize;
+ uint64_t data_samplerate;
+ GSList *next_di;
+};
+
+struct srd_pd_output {
+ int pdo_id;
+ int output_type;
+ struct srd_decoder_inst *di;
+ char *proto_id;
+};
+
+struct srd_proto_data {
+ uint64_t start_sample;
+ uint64_t end_sample;
+ struct srd_pd_output *pdo;
+ int ann_format;
+ void *data;
+};
+
+typedef void (*srd_pd_output_callback_t)(struct srd_proto_data *pdata,
+ void *cb_data);
+
+struct srd_pd_callback {
+ int output_type;
+ srd_pd_output_callback_t cb;
+ void *cb_data;
+};
+
+/* Custom Python types: */
+
+typedef struct {
+ PyObject_HEAD
+} srd_Decoder;
+
+typedef struct {
+ PyObject_HEAD
+ struct srd_decoder_inst *di;
+ uint64_t start_samplenum;
+ unsigned int itercnt;
+ uint8_t *inbuf;
+ uint64_t inbuflen;
+ PyObject *sample;
+} srd_logic;
+
+/*--- controller.c ----------------------------------------------------------*/
+
+SRD_API int srd_init(const char *path);
+SRD_API int srd_exit(void);
+SRD_API int srd_inst_options_set(struct srd_decoder_inst *di,
+ GHashTable *options);
+SRD_API int srd_inst_probes_set(struct srd_decoder_inst *di,
+ GHashTable *probes);
+SRD_API struct srd_decoder_inst *srd_inst_new(const char *id,
+ GHashTable *options);
+SRD_API int srd_inst_stack(struct srd_decoder_inst *di_from,
+ struct srd_decoder_inst *di_to);
+SRD_API struct srd_decoder_inst *srd_inst_find_by_id(const char *inst_id);
+SRD_API int srd_session_start(int num_probes, int unitsize,
+ uint64_t samplerate);
+SRD_API int srd_session_feed(uint64_t start_samplenum, const uint8_t *inbuf,
+ uint64_t inbuflen);
+SRD_API int srd_register_callback(int output_type,
+ srd_pd_output_callback_t cb, void *cb_data);
+
+/*--- decoder.c -------------------------------------------------------------*/
+
+SRD_API GSList *srd_decoder_list(void);
+SRD_API struct srd_decoder *srd_decoder_get_by_id(const char *id);
+SRD_API int srd_decoder_load(const char *name);
+SRD_API int srd_decoder_unload(struct srd_decoder *dec);
+SRD_API int srd_decoder_load_all(void);
+SRD_API int srd_decoder_unload_all(void);
+SRD_API char *srd_decoder_doc(const struct srd_decoder *dec);
+
+/*--- log.c -----------------------------------------------------------------*/
+
+typedef int (*srd_log_callback_t)(void *cb_data, int loglevel,
+ const char *format, va_list args);
+
+SRD_API int srd_log_loglevel_set(int loglevel);
+SRD_API int srd_log_loglevel_get(void);
+SRD_API int srd_log_callback_set(srd_log_callback_t cb, void *cb_data);
+SRD_API int srd_log_callback_set_default(void);
+SRD_API int srd_log_logdomain_set(const char *logdomain);
+SRD_API char *srd_log_logdomain_get(void);