X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=include%2Flibsigrok%2Fproto.h;h=7f3129379415576cbe0e35c46078619472c8ad87;hb=6ad2fbaad2722f0aa18c3600cdbdddf812784b2d;hp=3a8e346f087c6c8f86b290c9d30139cbefa9d462;hpb=0c697a4b339451514d4814974708816ce7858b8e;p=libsigrok.git diff --git a/include/libsigrok/proto.h b/include/libsigrok/proto.h index 3a8e346f..7f312937 100644 --- a/include/libsigrok/proto.h +++ b/include/libsigrok/proto.h @@ -30,15 +30,34 @@ SR_API int sr_analog_to_float(const struct sr_datafeed_analog *analog, float *buf); +SR_API const char *sr_analog_si_prefix(float *value, int *digits); +SR_API gboolean sr_analog_si_prefix_friendly(enum sr_unit unit); SR_API int sr_analog_unit_to_string(const struct sr_datafeed_analog *analog, char **result); SR_API void sr_rational_set(struct sr_rational *r, int64_t p, uint64_t q); +SR_API int sr_rational_eq(const struct sr_rational *a, const struct sr_rational *b); +SR_API int sr_rational_mult(struct sr_rational *res, const struct sr_rational *a, + const struct sr_rational *b); +SR_API int sr_rational_div(struct sr_rational *res, const struct sr_rational *num, + const struct sr_rational *div); /*--- backend.c -------------------------------------------------------------*/ SR_API int sr_init(struct sr_context **ctx); SR_API int sr_exit(struct sr_context *ctx); +SR_API GSList *sr_buildinfo_libs_get(void); +SR_API char *sr_buildinfo_host_get(void); +SR_API char *sr_buildinfo_scpi_backends_get(void); + +/*--- conversion.c ----------------------------------------------------------*/ + +SR_API int sr_a2l_threshold(const struct sr_datafeed_analog *analog, + float threshold, uint8_t *output, uint64_t count); +SR_API int sr_a2l_schmitt_trigger(const struct sr_datafeed_analog *analog, + float lo_thr, float hi_thr, uint8_t *state, uint8_t *output, + uint64_t count); + /*--- log.c -----------------------------------------------------------------*/ typedef int (*sr_log_callback)(void *cb_data, int loglevel, @@ -83,7 +102,7 @@ SR_API int sr_dev_inst_channel_add(struct sr_dev_inst *sdi, int index, int type, SR_API struct sr_dev_driver **sr_driver_list(const struct sr_context *ctx); SR_API int sr_driver_init(struct sr_context *ctx, struct sr_dev_driver *driver); -SR_API GArray *sr_driver_scan_options(const struct sr_dev_driver *driver); +SR_API GArray *sr_driver_scan_options_list(const struct sr_dev_driver *driver); SR_API GSList *sr_driver_scan(struct sr_dev_driver *driver, GSList *options); SR_API int sr_config_get(const struct sr_dev_driver *driver, const struct sr_dev_inst *sdi, @@ -154,6 +173,7 @@ SR_API int sr_input_scan_file(const char *filename, const struct sr_input **in); SR_API struct sr_dev_inst *sr_input_dev_inst_get(const struct sr_input *in); SR_API int sr_input_send(const struct sr_input *in, GString *buf); SR_API int sr_input_end(const struct sr_input *in); +SR_API int sr_input_reset(const struct sr_input *in); SR_API void sr_input_free(const struct sr_input *in); /*--- output/output.c -------------------------------------------------------*/ @@ -206,7 +226,7 @@ typedef int (*sr_resource_open_callback)(struct sr_resource *res, const char *name, void *cb_data); typedef int (*sr_resource_close_callback)(struct sr_resource *res, void *cb_data); -typedef ssize_t (*sr_resource_read_callback)(const struct sr_resource *res, +typedef gssize (*sr_resource_read_callback)(const struct sr_resource *res, void *buf, size_t count, void *cb_data); SR_API int sr_resource_set_hooks(struct sr_context *ctx, @@ -218,13 +238,14 @@ SR_API int sr_resource_set_hooks(struct sr_context *ctx, SR_API char *sr_si_string_u64(uint64_t x, const char *unit); SR_API char *sr_samplerate_string(uint64_t samplerate); -SR_API char *sr_period_string(uint64_t frequency); +SR_API char *sr_period_string(uint64_t v_p, uint64_t v_q); SR_API char *sr_voltage_string(uint64_t v_p, uint64_t v_q); SR_API int sr_parse_sizestring(const char *sizestring, uint64_t *size); SR_API uint64_t sr_parse_timestring(const char *timestring); SR_API gboolean sr_parse_boolstring(const char *boolstring); SR_API int sr_parse_period(const char *periodstr, uint64_t *p, uint64_t *q); SR_API int sr_parse_voltage(const char *voltstr, uint64_t *p, uint64_t *q); +SR_API int sr_parse_rational(const char *str, struct sr_rational *ret); /*--- version.c -------------------------------------------------------------*/