]>
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 | ||
a00ba012 | 25 | int sr_init(void); |
01d9dc35 | 26 | void sr_exit(void); |
10509bc2 | 27 | |
aa0b6b20 UH |
28 | /*--- datastore.c -----------------------------------------------------------*/ |
29 | ||
c4911129 UH |
30 | int sr_datastore_new(int unitsize, struct sr_datastore **ds); |
31 | int sr_datastore_destroy(struct sr_datastore *ds); | |
32 | void sr_datastore_put(struct sr_datastore *ds, void *data, unsigned int length, | |
33 | int in_unitsize, int *probelist); | |
aa0b6b20 | 34 | |
aa0b6b20 | 35 | /*--- device.c --------------------------------------------------------------*/ |
10509bc2 | 36 | |
2bf4aca6 UH |
37 | void sr_device_scan(void); |
38 | int sr_device_plugin_init(struct sr_device_plugin *plugin); | |
39 | void sr_device_close_all(void); | |
40 | GSList *sr_device_list(void); | |
c4911129 UH |
41 | struct sr_device *sr_device_new(struct sr_device_plugin *plugin, |
42 | int plugin_index, int num_probes); | |
2bf4aca6 UH |
43 | void sr_device_clear(struct sr_device *device); |
44 | void sr_device_destroy(struct sr_device *dev); | |
10509bc2 | 45 | |
2bf4aca6 UH |
46 | void sr_device_probe_clear(struct sr_device *device, int probenum); |
47 | void sr_device_probe_add(struct sr_device *device, char *name); | |
03dbc020 | 48 | struct sr_probe *sr_device_probe_find(struct sr_device *device, int probenum); |
2bf4aca6 | 49 | void sr_device_probe_name(struct sr_device *device, int probenum, char *name); |
10509bc2 | 50 | |
2bf4aca6 | 51 | void sr_device_trigger_clear(struct sr_device *device); |
c4911129 UH |
52 | void sr_device_trigger_set(struct sr_device *device, int probenum, |
53 | char *trigger); | |
2bf4aca6 | 54 | gboolean sr_device_has_hwcap(struct sr_device *device, int hwcap); |
10509bc2 | 55 | |
aa0b6b20 UH |
56 | /*--- filter.c --------------------------------------------------------------*/ |
57 | ||
58 | int filter_probes(int in_unitsize, int out_unitsize, int *probelist, | |
59 | char *data_in, uint64_t length_in, char **data_out, | |
60 | uint64_t *length_out); | |
61 | ||
62 | /*--- hwplugin.c ------------------------------------------------------------*/ | |
63 | ||
10509bc2 BV |
64 | int load_hwplugins(void); |
65 | GSList *list_hwplugins(void); | |
66 | ||
67 | /* Generic device instances */ | |
a00ba012 | 68 | struct sr_device_instance *sr_device_instance_new(int index, |
10509bc2 | 69 | int status, const char *vendor, const char *model, const char *version); |
d32d961d UH |
70 | struct sr_device_instance *sr_get_device_instance(GSList *device_instances, |
71 | int device_index); | |
a00ba012 | 72 | void sr_device_instance_free(struct sr_device_instance *sdi); |
10509bc2 BV |
73 | |
74 | /* USB-specific instances */ | |
22b02383 | 75 | #ifdef HAVE_LIBUSB_1_0 |
6c290072 | 76 | struct sr_usb_device_instance *sr_usb_device_instance_new(uint8_t bus, |
10509bc2 | 77 | uint8_t address, struct libusb_device_handle *hdl); |
6c290072 | 78 | void sr_usb_device_instance_free(struct sr_usb_device_instance *usb); |
22b02383 | 79 | #endif |
10509bc2 BV |
80 | |
81 | /* Serial-specific instances */ | |
6c290072 | 82 | struct sr_serial_device_instance *sr_serial_device_instance_new( |
10509bc2 | 83 | const char *port, int fd); |
6c290072 | 84 | void sr_serial_device_instance_free(struct sr_serial_device_instance *serial); |
10509bc2 BV |
85 | |
86 | int find_hwcap(int *capabilities, int hwcap); | |
87 | struct hwcap_option *find_hwcap_option(int hwcap); | |
88 | void source_remove(int fd); | |
89 | void source_add(int fd, int events, int timeout, receive_data_callback rcv_cb, | |
90 | void *user_data); | |
91 | ||
92 | /*--- session.c -------------------------------------------------------------*/ | |
93 | ||
94 | typedef void (*source_callback_remove) (int fd); | |
95 | typedef void (*source_callback_add) (int fd, int events, int timeout, | |
96 | receive_data_callback callback, void *user_data); | |
5c2d46d1 | 97 | typedef void (*datafeed_callback) (struct sr_device *device, |
b9c735a2 | 98 | struct sr_datafeed_packet *packet); |
10509bc2 BV |
99 | |
100 | /* Session setup */ | |
8a2efef2 UH |
101 | int sr_session_load(const char *filename); |
102 | struct sr_session *sr_session_new(void); | |
103 | void sr_session_destroy(void); | |
104 | void sr_session_device_clear(void); | |
105 | int sr_session_device_add(struct sr_device *device); | |
10509bc2 BV |
106 | |
107 | /* Protocol analyzers setup */ | |
8a2efef2 UH |
108 | void sr_session_pa_clear(void); |
109 | void sr_session_pa_add(struct analyzer *pa); | |
10509bc2 BV |
110 | |
111 | /* Datafeed setup */ | |
8a2efef2 UH |
112 | void sr_session_datafeed_callback_clear(void); |
113 | void sr_session_datafeed_callback_add(datafeed_callback callback); | |
10509bc2 BV |
114 | |
115 | /* Session control */ | |
8a2efef2 UH |
116 | int sr_session_start(void); |
117 | void sr_session_run(void); | |
118 | void sr_session_halt(void); | |
119 | void sr_session_stop(void); | |
c4911129 UH |
120 | void sr_session_bus(struct sr_device *device, |
121 | struct sr_datafeed_packet *packet); | |
10509bc2 | 122 | void make_metadata(char *filename); |
8a2efef2 UH |
123 | int sr_session_save(char *filename); |
124 | void sr_session_source_add(int fd, int events, int timeout, | |
544a4582 | 125 | receive_data_callback callback, void *user_data); |
8a2efef2 | 126 | void sr_session_source_remove(int fd); |
10509bc2 | 127 | |
aa0b6b20 | 128 | /*--- input/input.c ---------------------------------------------------------*/ |
10509bc2 | 129 | |
f50f3f40 | 130 | struct sr_input_format **sr_input_list(void); |
aa0b6b20 UH |
131 | |
132 | /*--- output/output.c -------------------------------------------------------*/ | |
133 | ||
f50f3f40 | 134 | struct sr_output_format **sr_output_list(void); |
aa0b6b20 UH |
135 | |
136 | /*--- output/common.c -------------------------------------------------------*/ | |
137 | ||
a00ba012 UH |
138 | char *sr_samplerate_string(uint64_t samplerate); |
139 | char *sr_period_string(uint64_t frequency); | |
c4911129 UH |
140 | char **sr_parse_triggerstring(struct sr_device *device, |
141 | const char *triggerstring); | |
40f5ddac BV |
142 | uint64_t sr_parse_sizestring(const char *sizestring); |
143 | uint64_t sr_parse_timestring(const char *timestring); | |
10509bc2 | 144 | |
c2bd92ec | 145 | #endif |