]>
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 UH |
25 | int sr_init(void); |
26 | void sr_cleanup(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); | |
e54bcdc5 | 38 | int device_plugin_init(struct device_plugin *plugin); |
10509bc2 BV |
39 | void device_close_all(void); |
40 | GSList *device_list(void); | |
aa0b6b20 | 41 | struct device *device_new(struct device_plugin *plugin, int plugin_index, |
6ea7e235 | 42 | int num_probes); |
10509bc2 BV |
43 | void device_clear(struct device *device); |
44 | void device_destroy(struct device *dev); | |
45 | ||
46 | void device_probe_clear(struct device *device, int probenum); | |
47 | void device_probe_add(struct device *device, char *name); | |
48 | struct probe *probe_find(struct device *device, int probenum); | |
49 | void device_probe_name(struct device *device, int probenum, char *name); | |
50 | ||
51 | void device_trigger_clear(struct device *device); | |
52 | void device_trigger_set(struct device *device, int probenum, char *trigger); | |
53 | ||
aa0b6b20 UH |
54 | /*--- filter.c --------------------------------------------------------------*/ |
55 | ||
56 | int filter_probes(int in_unitsize, int out_unitsize, int *probelist, | |
57 | char *data_in, uint64_t length_in, char **data_out, | |
58 | uint64_t *length_out); | |
59 | ||
60 | /*--- hwplugin.c ------------------------------------------------------------*/ | |
61 | ||
10509bc2 BV |
62 | int load_hwplugins(void); |
63 | GSList *list_hwplugins(void); | |
64 | ||
65 | /* Generic device instances */ | |
a00ba012 | 66 | struct sr_device_instance *sr_device_instance_new(int index, |
10509bc2 | 67 | int status, const char *vendor, const char *model, const char *version); |
a00ba012 | 68 | struct sr_device_instance *get_sr_device_instance( |
10509bc2 | 69 | GSList *device_instances, int device_index); |
a00ba012 | 70 | void sr_device_instance_free(struct sr_device_instance *sdi); |
10509bc2 BV |
71 | |
72 | /* USB-specific instances */ | |
73 | struct usb_device_instance *usb_device_instance_new(uint8_t bus, | |
74 | uint8_t address, struct libusb_device_handle *hdl); | |
75 | void usb_device_instance_free(struct usb_device_instance *usb); | |
76 | ||
77 | /* Serial-specific instances */ | |
78 | struct serial_device_instance *serial_device_instance_new( | |
79 | const char *port, int fd); | |
80 | void serial_device_instance_free(struct serial_device_instance *serial); | |
81 | ||
82 | int find_hwcap(int *capabilities, int hwcap); | |
83 | struct hwcap_option *find_hwcap_option(int hwcap); | |
84 | void source_remove(int fd); | |
85 | void source_add(int fd, int events, int timeout, receive_data_callback rcv_cb, | |
86 | void *user_data); | |
87 | ||
88 | /*--- session.c -------------------------------------------------------------*/ | |
89 | ||
90 | typedef void (*source_callback_remove) (int fd); | |
91 | typedef void (*source_callback_add) (int fd, int events, int timeout, | |
92 | receive_data_callback callback, void *user_data); | |
93 | typedef void (*datafeed_callback) (struct device *device, | |
94 | struct datafeed_packet *packet); | |
95 | ||
96 | /* Session setup */ | |
97 | struct session *session_load(const char *filename); | |
98 | struct session *session_new(void); | |
99 | void session_destroy(void); | |
100 | void session_device_clear(void); | |
101 | int session_device_add(struct device *device); | |
102 | ||
103 | /* Protocol analyzers setup */ | |
104 | void session_pa_clear(void); | |
105 | void session_pa_add(struct analyzer *pa); | |
106 | ||
107 | /* Datafeed setup */ | |
108 | void session_datafeed_callback_clear(void); | |
109 | void session_datafeed_callback_add(datafeed_callback callback); | |
110 | ||
111 | /* Session control */ | |
112 | int session_start(void); | |
544a4582 BV |
113 | void session_run(void); |
114 | void session_halt(void); | |
10509bc2 BV |
115 | void session_stop(void); |
116 | void session_bus(struct device *device, struct datafeed_packet *packet); | |
117 | void make_metadata(char *filename); | |
118 | int session_save(char *filename); | |
544a4582 BV |
119 | void session_source_add(int fd, int events, int timeout, |
120 | receive_data_callback callback, void *user_data); | |
121 | void session_source_remove(int fd); | |
10509bc2 | 122 | |
aa0b6b20 | 123 | /*--- input/input.c ---------------------------------------------------------*/ |
10509bc2 | 124 | |
f50f3f40 | 125 | struct sr_input_format **sr_input_list(void); |
aa0b6b20 UH |
126 | |
127 | /*--- output/output.c -------------------------------------------------------*/ | |
128 | ||
f50f3f40 | 129 | struct sr_output_format **sr_output_list(void); |
aa0b6b20 UH |
130 | |
131 | /*--- output/common.c -------------------------------------------------------*/ | |
132 | ||
a00ba012 UH |
133 | char *sr_samplerate_string(uint64_t samplerate); |
134 | char *sr_period_string(uint64_t frequency); | |
10509bc2 | 135 | |
c2bd92ec | 136 | #endif |