]> sigrok.org Git - libsigrok.git/blob - sigrok-proto.h
sr: adjust copyright year
[libsigrok.git] / sigrok-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_handler_t)(void *data, int loglevel, const char *format,
31                                  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_handler_set(sr_log_handler_t handler, void *data);
36 SR_API int sr_log_handler_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                             int *probelist);
47
48 /*--- device.c --------------------------------------------------------------*/
49
50 SR_API int sr_dev_scan(void);
51 SR_API GSList *sr_dev_list(void);
52 SR_API struct sr_device *sr_dev_new(const struct sr_device_plugin *plugin,
53                                        int plugin_index);
54 SR_API int sr_dev_probe_add(struct sr_device *device, const char *name);
55 SR_API struct sr_probe *sr_dev_probe_find(const struct sr_device *device,
56                                              int probenum);
57 SR_API int sr_dev_probe_name(struct sr_device *device, int probenum,
58                                 const char *name);
59 SR_API int sr_dev_trigger_clear(struct sr_device *device);
60 SR_API int sr_dev_trigger_set(struct sr_device *device, int probenum,
61                                  const char *trigger);
62 SR_API gboolean sr_dev_has_hwcap(const struct sr_device *device, int hwcap);
63 SR_API int sr_dev_get_info(const struct sr_device *device, int id,
64                               const void **data);
65
66 /*--- filter.c --------------------------------------------------------------*/
67
68 SR_API int sr_filter_probes(int in_unitsize, int out_unitsize,
69                             const int *probelist, const unsigned char *data_in,
70                             uint64_t length_in, char **data_out,
71                             uint64_t *length_out);
72
73 /*--- hwplugin.c ------------------------------------------------------------*/
74
75 SR_API GSList *sr_list_hwplugins(void);
76 SR_API int sr_init_hwplugin(struct sr_device_plugin *plugin);
77 SR_API gboolean sr_has_hwcap(int *capabilities, int hwcap);
78 SR_API struct sr_hwcap_option *sr_find_hwcap_option(int hwcap);
79
80 /*--- session.c -------------------------------------------------------------*/
81
82 typedef void (*sr_datafeed_callback) (struct sr_device *device,
83                                       struct sr_datafeed_packet *packet);
84
85 /* Session setup */
86 SR_API int sr_session_load(const char *filename);
87 SR_API struct sr_session *sr_session_new(void);
88 SR_API int sr_session_destroy(void);
89 SR_API int sr_session_device_clear(void);
90 SR_API int sr_session_device_add(struct sr_device *device);
91
92 /* Datafeed setup */
93 SR_API int sr_session_datafeed_callback_clear(void);
94 SR_API int sr_session_datafeed_callback_add(sr_datafeed_callback callback);
95
96 /* Session control */
97 SR_API int sr_session_start(void);
98 SR_API int sr_session_run(void);
99 SR_API int sr_session_halt(void);
100 SR_API int sr_session_stop(void);
101 SR_API int sr_session_save(const char *filename);
102 SR_API int sr_session_source_add(int fd, int events, int timeout,
103                 sr_receive_data_callback callback, void *user_data);
104 SR_API int sr_session_source_remove(int fd);
105
106 /*--- input/input.c ---------------------------------------------------------*/
107
108 SR_API struct sr_input_format **sr_input_list(void);
109
110 /*--- output/output.c -------------------------------------------------------*/
111
112 SR_API struct sr_output_format **sr_output_list(void);
113
114 /*--- strutil.c -------------------------------------------------------*/
115
116 SR_API char *sr_samplerate_string(uint64_t samplerate);
117 SR_API char *sr_period_string(uint64_t frequency);
118 SR_API char **sr_parse_triggerstring(struct sr_device *device,
119                                      const char *triggerstring);
120 SR_API int sr_parse_sizestring(const char *sizestring, uint64_t *size);
121 SR_API uint64_t sr_parse_timestring(const char *timestring);
122 SR_API gboolean sr_parse_boolstring(const char *boolstring);
123
124 #endif