]>
Commit | Line | Data |
---|---|---|
10509bc2 BV |
1 | /* |
2 | * This file is part of the sigrok project. | |
3 | * | |
4 | * Copyright (C) 2011 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 | ||
c2bd92ec UH |
20 | #ifndef SIGROK_SIGROK_PROTO_H |
21 | #define SIGROK_SIGROK_PROTO_H | |
10509bc2 | 22 | |
10509bc2 BV |
23 | /*--- backend.c -------------------------------------------------------------*/ |
24 | ||
1a081ca6 UH |
25 | SR_API int sr_init(void); |
26 | SR_API int sr_exit(void); | |
10509bc2 | 27 | |
1352eedd UH |
28 | /*--- log.c -----------------------------------------------------------------*/ |
29 | ||
1a081ca6 UH |
30 | SR_API int sr_set_loglevel(int loglevel); |
31 | SR_API int sr_get_loglevel(void); | |
1352eedd | 32 | |
aa0b6b20 UH |
33 | /*--- datastore.c -----------------------------------------------------------*/ |
34 | ||
1a081ca6 UH |
35 | SR_API int sr_datastore_new(int unitsize, struct sr_datastore **ds); |
36 | SR_API int sr_datastore_destroy(struct sr_datastore *ds); | |
37 | SR_API int sr_datastore_put(struct sr_datastore *ds, void *data, | |
38 | unsigned int length, int in_unitsize, | |
39 | int *probelist); | |
aa0b6b20 | 40 | |
aa0b6b20 | 41 | /*--- device.c --------------------------------------------------------------*/ |
10509bc2 | 42 | |
1a081ca6 UH |
43 | SR_API int sr_device_scan(void); |
44 | SR_API GSList *sr_device_list(void); | |
45 | SR_API struct sr_device *sr_device_new(const struct sr_device_plugin *plugin, | |
46 | int plugin_index); | |
47 | SR_API int sr_device_clear(struct sr_device *device); | |
48 | SR_API int sr_device_probe_clear(struct sr_device *device, int probenum); | |
49 | SR_API int sr_device_probe_add(struct sr_device *device, const char *name); | |
50 | SR_API struct sr_probe *sr_device_probe_find(const struct sr_device *device, | |
51 | int probenum); | |
52 | SR_API int sr_device_probe_name(struct sr_device *device, int probenum, | |
53 | const char *name); | |
54 | SR_API int sr_device_trigger_clear(struct sr_device *device); | |
55 | SR_API int sr_device_trigger_set(struct sr_device *device, int probenum, | |
56 | const char *trigger); | |
57 | SR_API gboolean sr_device_has_hwcap(const struct sr_device *device, int hwcap); | |
58 | SR_API int sr_device_get_info(const struct sr_device *device, int id, | |
59 | const void **data); | |
10509bc2 | 60 | |
aa0b6b20 UH |
61 | /*--- filter.c --------------------------------------------------------------*/ |
62 | ||
1a081ca6 UH |
63 | SR_API int sr_filter_probes(int in_unitsize, int out_unitsize, |
64 | const int *probelist, const unsigned char *data_in, | |
65 | uint64_t length_in, char **data_out, | |
66 | uint64_t *length_out); | |
aa0b6b20 UH |
67 | |
68 | /*--- hwplugin.c ------------------------------------------------------------*/ | |
69 | ||
1a081ca6 UH |
70 | SR_API GSList *sr_list_hwplugins(void); |
71 | SR_API int sr_init_hwplugins(struct sr_device_plugin *plugin); | |
72 | SR_API void sr_cleanup_hwplugins(void); | |
10509bc2 BV |
73 | |
74 | /* Generic device instances */ | |
1a081ca6 | 75 | SR_API struct sr_device_instance *sr_device_instance_new(int index, |
10509bc2 | 76 | int status, const char *vendor, const char *model, const char *version); |
1a081ca6 UH |
77 | SR_API struct sr_device_instance *sr_get_device_instance( |
78 | GSList *device_instances, int device_index); | |
79 | SR_API void sr_device_instance_free(struct sr_device_instance *sdi); | |
10509bc2 | 80 | |
1a081ca6 UH |
81 | SR_API int sr_find_hwcap(int *capabilities, int hwcap); |
82 | SR_API struct sr_hwcap_option *sr_find_hwcap_option(int hwcap); | |
83 | SR_API void sr_source_remove(int fd); | |
84 | SR_API void sr_source_add(int fd, int events, int timeout, | |
85 | sr_receive_data_callback rcv_cb, void *user_data); | |
10509bc2 BV |
86 | |
87 | /*--- session.c -------------------------------------------------------------*/ | |
88 | ||
13b05733 UH |
89 | typedef void (*sr_datafeed_callback) (struct sr_device *device, |
90 | struct sr_datafeed_packet *packet); | |
10509bc2 BV |
91 | |
92 | /* Session setup */ | |
1a081ca6 UH |
93 | SR_API int sr_session_load(const char *filename); |
94 | SR_API struct sr_session *sr_session_new(void); | |
95 | SR_API int sr_session_destroy(void); | |
96 | SR_API int sr_session_device_clear(void); | |
97 | SR_API int sr_session_device_add(struct sr_device *device); | |
10509bc2 | 98 | |
10509bc2 | 99 | /* Datafeed setup */ |
1a081ca6 UH |
100 | SR_API int sr_session_datafeed_callback_clear(void); |
101 | SR_API int sr_session_datafeed_callback_add(sr_datafeed_callback callback); | |
10509bc2 BV |
102 | |
103 | /* Session control */ | |
1a081ca6 UH |
104 | SR_API int sr_session_start(void); |
105 | SR_API int sr_session_run(void); | |
106 | SR_API int sr_session_halt(void); | |
107 | SR_API int sr_session_stop(void); | |
108 | SR_API int sr_session_bus(struct sr_device *device, | |
109 | struct sr_datafeed_packet *packet); | |
110 | SR_API int sr_session_save(const char *filename); | |
111 | SR_API int sr_session_source_add(int fd, int events, int timeout, | |
112 | sr_receive_data_callback callback, void *user_data); | |
113 | SR_API int sr_session_source_remove(int fd); | |
10509bc2 | 114 | |
aa0b6b20 | 115 | /*--- input/input.c ---------------------------------------------------------*/ |
10509bc2 | 116 | |
1a081ca6 | 117 | SR_API struct sr_input_format **sr_input_list(void); |
aa0b6b20 UH |
118 | |
119 | /*--- output/output.c -------------------------------------------------------*/ | |
120 | ||
1a081ca6 | 121 | SR_API struct sr_output_format **sr_output_list(void); |
aa0b6b20 UH |
122 | |
123 | /*--- output/common.c -------------------------------------------------------*/ | |
124 | ||
1a081ca6 UH |
125 | SR_API char *sr_samplerate_string(uint64_t samplerate); |
126 | SR_API char *sr_period_string(uint64_t frequency); | |
127 | SR_API char **sr_parse_triggerstring(struct sr_device *device, | |
128 | const char *triggerstring); | |
129 | SR_API int sr_parse_sizestring(const char *sizestring, uint64_t *size); | |
130 | SR_API uint64_t sr_parse_timestring(const char *timestring); | |
131 | SR_API gboolean sr_parse_boolstring(const char *boolstring); | |
10509bc2 | 132 | |
c2bd92ec | 133 | #endif |