]> sigrok.org Git - libsigrok.git/blob - proto.h
sr: remove dead/obsolete code
[libsigrok.git] / proto.h
1 /*
2  * This file is part of the sigrok project.
3  *
4  * Copyright (C) 2010-2012 Bert Vermeulen <bert@biot.com>
5  *
6  * This program is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
18  */
19
20 #ifndef LIBSIGROK_SIGROK_PROTO_H
21 #define LIBSIGROK_SIGROK_PROTO_H
22
23 /*--- backend.c -------------------------------------------------------------*/
24
25 SR_API int sr_init(void);
26 SR_API int sr_exit(void);
27
28 /*--- log.c -----------------------------------------------------------------*/
29
30 typedef int (*sr_log_callback_t)(void *cb_data, int loglevel,
31                                  const char *format, va_list args);
32
33 SR_API int sr_log_loglevel_set(int loglevel);
34 SR_API int sr_log_loglevel_get(void);
35 SR_API int sr_log_callback_set(sr_log_callback_t cb, void *cb_data);
36 SR_API int sr_log_callback_set_default(void);
37 SR_API int sr_log_logdomain_set(const char *logdomain);
38 SR_API char *sr_log_logdomain_get(void);
39
40 /*--- datastore.c -----------------------------------------------------------*/
41
42 SR_API int sr_datastore_new(int unitsize, struct sr_datastore **ds);
43 SR_API int sr_datastore_destroy(struct sr_datastore *ds);
44 SR_API int sr_datastore_put(struct sr_datastore *ds, void *data,
45                             unsigned int length, int in_unitsize,
46                             const int *probelist);
47
48 /*--- device.c --------------------------------------------------------------*/
49
50 SR_API int sr_dev_probe_name_set(struct sr_dev *dev, int probenum,
51                                  const char *name);
52 SR_API int sr_dev_probe_enable(const struct sr_dev_inst *sdi, int probenum,
53                 gboolean state);
54 SR_API int sr_dev_trigger_set(const struct sr_dev_inst *sdi, int probenum,
55                 const char *trigger);
56 SR_API gboolean sr_dev_has_hwcap(const struct sr_dev_inst *sdi, int hwcap);
57
58 /*--- filter.c --------------------------------------------------------------*/
59
60 SR_API int sr_filter_probes(int in_unitsize, int out_unitsize,
61                             const int *probelist, const uint8_t *data_in,
62                             uint64_t length_in, uint8_t **data_out,
63                             uint64_t *length_out);
64
65 /*--- hwdriver.c ------------------------------------------------------------*/
66
67 SR_API struct sr_dev_driver **sr_driver_list(void);
68 SR_API int sr_driver_init(struct sr_dev_driver *driver);
69 SR_API GSList *sr_driver_scan(struct sr_dev_driver *driver, GSList *options);
70 SR_API gboolean sr_driver_hwcap_exists(struct sr_dev_driver *driver, int hwcap);
71 SR_API const struct sr_hwcap_option *sr_drvopt_get(int hwopt);
72 SR_API const struct sr_hwcap_option *sr_hw_hwcap_get(int hwcap);
73 SR_API int sr_info_get(struct sr_dev_driver *driver, int id,
74                 const void **data, const struct sr_dev_inst *sdi);
75
76 /*--- session.c -------------------------------------------------------------*/
77
78 typedef void (*sr_datafeed_callback_t)(const struct sr_dev_inst *sdi,
79                 struct sr_datafeed_packet *packet);
80
81 /* Session setup */
82 SR_API int sr_session_load(const char *filename);
83 SR_API struct sr_session *sr_session_new(void);
84 SR_API int sr_session_destroy(void);
85 SR_API int sr_session_dev_remove_all(void);
86 SR_API int sr_session_dev_add(const struct sr_dev_inst *sdi);
87
88 /* Datafeed setup */
89 SR_API int sr_session_datafeed_callback_remove_all(void);
90 SR_API int sr_session_datafeed_callback_add(sr_datafeed_callback_t cb);
91
92 /* Session control */
93 SR_API int sr_session_start(void);
94 SR_API int sr_session_run(void);
95 SR_API int sr_session_halt(void);
96 SR_API int sr_session_stop(void);
97 SR_API int sr_session_save(const char *filename);
98 SR_API int sr_session_source_add(int fd, int events, int timeout,
99                 sr_receive_data_callback_t cb, void *cb_data);
100 SR_API int sr_session_source_add_pollfd(GPollFD *pollfd, int timeout,
101                 sr_receive_data_callback_t cb, void *cb_data);
102 SR_API int sr_session_source_add_channel(GIOChannel *channel, int events,
103                 int timeout, sr_receive_data_callback_t cb, void *cb_data);
104 SR_API int sr_session_source_remove(int fd);
105 SR_API int sr_session_source_remove_pollfd(GPollFD *pollfd);
106 SR_API int sr_session_source_remove_channel(GIOChannel *channel);
107
108 /*--- input/input.c ---------------------------------------------------------*/
109
110 SR_API struct sr_input_format **sr_input_list(void);
111
112 /*--- output/output.c -------------------------------------------------------*/
113
114 SR_API struct sr_output_format **sr_output_list(void);
115
116 /*--- strutil.c -------------------------------------------------------------*/
117
118 SR_API char *sr_samplerate_string(uint64_t samplerate);
119 SR_API char *sr_period_string(uint64_t frequency);
120 SR_API char *sr_voltage_string(struct sr_rational *voltage);
121 SR_API char **sr_parse_triggerstring(const struct sr_dev_inst *sdi,
122                 const char *triggerstring);
123 SR_API int sr_parse_sizestring(const char *sizestring, uint64_t *size);
124 SR_API uint64_t sr_parse_timestring(const char *timestring);
125 SR_API gboolean sr_parse_boolstring(const char *boolstring);
126 SR_API int sr_parse_period(const char *periodstr, struct sr_rational *r);
127 SR_API int sr_parse_voltage(const char *voltstr, struct sr_rational *r);
128
129 /*--- version.c -------------------------------------------------------------*/
130
131 SR_API int sr_package_version_major_get(void);
132 SR_API int sr_package_version_minor_get(void);
133 SR_API int sr_package_version_micro_get(void);
134 SR_API const char *sr_package_version_string_get(void);
135
136 SR_API int sr_lib_version_current_get(void);
137 SR_API int sr_lib_version_revision_get(void);
138 SR_API int sr_lib_version_age_get(void);
139 SR_API const char *sr_lib_version_string_get(void);
140
141 /*--- error.c ---------------------------------------------------------------*/
142
143 SR_API const char *sr_strerror(int error_code);
144 SR_API const char *sr_strerror_name(int error_code);
145
146 #endif