]>
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 | ||
30 | int datastore_new(int unitsize, struct datastore **ds); | |
31 | int datastore_destroy(struct datastore *ds); | |
32 | void datastore_put(struct datastore *ds, void *data, unsigned int length, | |
33 | int in_unitsize, int *probelist); | |
34 | ||
aa0b6b20 | 35 | /*--- device.c --------------------------------------------------------------*/ |
10509bc2 BV |
36 | |
37 | void device_scan(void); | |
5c2d46d1 | 38 | int device_plugin_init(struct sr_device_plugin *plugin); |
10509bc2 BV |
39 | void device_close_all(void); |
40 | GSList *device_list(void); | |
5c2d46d1 UH |
41 | struct sr_device *device_new(struct sr_device_plugin *plugin, int plugin_index, |
42 | int num_probes); | |
43 | void device_clear(struct sr_device *device); | |
44 | void device_destroy(struct sr_device *dev); | |
10509bc2 | 45 | |
5c2d46d1 UH |
46 | void device_probe_clear(struct sr_device *device, int probenum); |
47 | void device_probe_add(struct sr_device *device, char *name); | |
48 | struct probe *probe_find(struct sr_device *device, int probenum); | |
49 | void device_probe_name(struct sr_device *device, int probenum, char *name); | |
10509bc2 | 50 | |
5c2d46d1 UH |
51 | void device_trigger_clear(struct sr_device *device); |
52 | void device_trigger_set(struct sr_device *device, int probenum, char *trigger); | |
7d658874 | 53 | gboolean device_has_hwcap(struct sr_device *device, int hwcap); |
10509bc2 | 54 | |
aa0b6b20 UH |
55 | /*--- filter.c --------------------------------------------------------------*/ |
56 | ||
57 | int filter_probes(int in_unitsize, int out_unitsize, int *probelist, | |
58 | char *data_in, uint64_t length_in, char **data_out, | |
59 | uint64_t *length_out); | |
60 | ||
61 | /*--- hwplugin.c ------------------------------------------------------------*/ | |
62 | ||
10509bc2 BV |
63 | int load_hwplugins(void); |
64 | GSList *list_hwplugins(void); | |
65 | ||
66 | /* Generic device instances */ | |
a00ba012 | 67 | struct sr_device_instance *sr_device_instance_new(int index, |
10509bc2 | 68 | int status, const char *vendor, const char *model, const char *version); |
d32d961d UH |
69 | struct sr_device_instance *sr_get_device_instance(GSList *device_instances, |
70 | int device_index); | |
a00ba012 | 71 | void sr_device_instance_free(struct sr_device_instance *sdi); |
10509bc2 BV |
72 | |
73 | /* USB-specific instances */ | |
22b02383 | 74 | #ifdef HAVE_LIBUSB_1_0 |
6c290072 | 75 | struct sr_usb_device_instance *sr_usb_device_instance_new(uint8_t bus, |
10509bc2 | 76 | uint8_t address, struct libusb_device_handle *hdl); |
6c290072 | 77 | void sr_usb_device_instance_free(struct sr_usb_device_instance *usb); |
22b02383 | 78 | #endif |
10509bc2 BV |
79 | |
80 | /* Serial-specific instances */ | |
6c290072 | 81 | struct sr_serial_device_instance *sr_serial_device_instance_new( |
10509bc2 | 82 | const char *port, int fd); |
6c290072 | 83 | void sr_serial_device_instance_free(struct sr_serial_device_instance *serial); |
10509bc2 BV |
84 | |
85 | int find_hwcap(int *capabilities, int hwcap); | |
86 | struct hwcap_option *find_hwcap_option(int hwcap); | |
87 | void source_remove(int fd); | |
88 | void source_add(int fd, int events, int timeout, receive_data_callback rcv_cb, | |
89 | void *user_data); | |
90 | ||
91 | /*--- session.c -------------------------------------------------------------*/ | |
92 | ||
93 | typedef void (*source_callback_remove) (int fd); | |
94 | typedef void (*source_callback_add) (int fd, int events, int timeout, | |
95 | receive_data_callback callback, void *user_data); | |
5c2d46d1 | 96 | typedef void (*datafeed_callback) (struct sr_device *device, |
b9c735a2 | 97 | struct sr_datafeed_packet *packet); |
10509bc2 BV |
98 | |
99 | /* Session setup */ | |
7d658874 | 100 | int session_load(const char *filename); |
10509bc2 BV |
101 | struct session *session_new(void); |
102 | void session_destroy(void); | |
103 | void session_device_clear(void); | |
5c2d46d1 | 104 | int session_device_add(struct sr_device *device); |
10509bc2 BV |
105 | |
106 | /* Protocol analyzers setup */ | |
107 | void session_pa_clear(void); | |
108 | void session_pa_add(struct analyzer *pa); | |
109 | ||
110 | /* Datafeed setup */ | |
111 | void session_datafeed_callback_clear(void); | |
112 | void session_datafeed_callback_add(datafeed_callback callback); | |
113 | ||
114 | /* Session control */ | |
115 | int session_start(void); | |
544a4582 BV |
116 | void session_run(void); |
117 | void session_halt(void); | |
10509bc2 | 118 | void session_stop(void); |
5c2d46d1 | 119 | void session_bus(struct sr_device *device, struct sr_datafeed_packet *packet); |
10509bc2 BV |
120 | void make_metadata(char *filename); |
121 | int session_save(char *filename); | |
544a4582 BV |
122 | void session_source_add(int fd, int events, int timeout, |
123 | receive_data_callback callback, void *user_data); | |
124 | void session_source_remove(int fd); | |
10509bc2 | 125 | |
aa0b6b20 | 126 | /*--- input/input.c ---------------------------------------------------------*/ |
10509bc2 | 127 | |
f50f3f40 | 128 | struct sr_input_format **sr_input_list(void); |
aa0b6b20 UH |
129 | |
130 | /*--- output/output.c -------------------------------------------------------*/ | |
131 | ||
f50f3f40 | 132 | struct sr_output_format **sr_output_list(void); |
aa0b6b20 UH |
133 | |
134 | /*--- output/common.c -------------------------------------------------------*/ | |
135 | ||
a00ba012 UH |
136 | char *sr_samplerate_string(uint64_t samplerate); |
137 | char *sr_period_string(uint64_t frequency); | |
40f5ddac BV |
138 | char **sr_parse_triggerstring(struct sr_device *device, const char *triggerstring); |
139 | uint64_t sr_parse_sizestring(const char *sizestring); | |
140 | uint64_t sr_parse_timestring(const char *timestring); | |
10509bc2 | 141 | |
c2bd92ec | 142 | #endif |