]>
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 | ||
25 | int sigrok_init(void); | |
26 | void sigrok_cleanup(void); | |
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); | |
38 | void device_close_all(void); | |
39 | GSList *device_list(void); | |
aa0b6b20 UH |
40 | struct device *device_new(struct device_plugin *plugin, int plugin_index, |
41 | int num_probes); | |
10509bc2 BV |
42 | void device_clear(struct device *device); |
43 | void device_destroy(struct device *dev); | |
44 | ||
45 | void device_probe_clear(struct device *device, int probenum); | |
46 | void device_probe_add(struct device *device, char *name); | |
47 | struct probe *probe_find(struct device *device, int probenum); | |
48 | void device_probe_name(struct device *device, int probenum, char *name); | |
49 | ||
50 | void device_trigger_clear(struct device *device); | |
51 | void device_trigger_set(struct device *device, int probenum, char *trigger); | |
52 | ||
aa0b6b20 UH |
53 | /*--- filter.c --------------------------------------------------------------*/ |
54 | ||
55 | int filter_probes(int in_unitsize, int out_unitsize, int *probelist, | |
56 | char *data_in, uint64_t length_in, char **data_out, | |
57 | uint64_t *length_out); | |
58 | ||
59 | /*--- hwplugin.c ------------------------------------------------------------*/ | |
60 | ||
10509bc2 BV |
61 | int load_hwplugins(void); |
62 | GSList *list_hwplugins(void); | |
63 | ||
64 | /* Generic device instances */ | |
65 | struct sigrok_device_instance *sigrok_device_instance_new(int index, | |
66 | int status, const char *vendor, const char *model, const char *version); | |
67 | struct sigrok_device_instance *get_sigrok_device_instance( | |
68 | GSList *device_instances, int device_index); | |
69 | void sigrok_device_instance_free(struct sigrok_device_instance *sdi); | |
70 | ||
71 | /* USB-specific instances */ | |
72 | struct usb_device_instance *usb_device_instance_new(uint8_t bus, | |
73 | uint8_t address, struct libusb_device_handle *hdl); | |
74 | void usb_device_instance_free(struct usb_device_instance *usb); | |
75 | ||
76 | /* Serial-specific instances */ | |
77 | struct serial_device_instance *serial_device_instance_new( | |
78 | const char *port, int fd); | |
79 | void serial_device_instance_free(struct serial_device_instance *serial); | |
80 | ||
81 | int find_hwcap(int *capabilities, int hwcap); | |
82 | struct hwcap_option *find_hwcap_option(int hwcap); | |
83 | void source_remove(int fd); | |
84 | void source_add(int fd, int events, int timeout, receive_data_callback rcv_cb, | |
85 | void *user_data); | |
86 | ||
87 | /*--- session.c -------------------------------------------------------------*/ | |
88 | ||
89 | typedef void (*source_callback_remove) (int fd); | |
90 | typedef void (*source_callback_add) (int fd, int events, int timeout, | |
91 | receive_data_callback callback, void *user_data); | |
92 | typedef void (*datafeed_callback) (struct device *device, | |
93 | struct datafeed_packet *packet); | |
94 | ||
95 | /* Session setup */ | |
96 | struct session *session_load(const char *filename); | |
97 | struct session *session_new(void); | |
98 | void session_destroy(void); | |
99 | void session_device_clear(void); | |
100 | int session_device_add(struct device *device); | |
101 | ||
102 | /* Protocol analyzers setup */ | |
103 | void session_pa_clear(void); | |
104 | void session_pa_add(struct analyzer *pa); | |
105 | ||
106 | /* Datafeed setup */ | |
107 | void session_datafeed_callback_clear(void); | |
108 | void session_datafeed_callback_add(datafeed_callback callback); | |
109 | ||
110 | /* Session control */ | |
111 | int session_start(void); | |
112 | void session_stop(void); | |
113 | void session_bus(struct device *device, struct datafeed_packet *packet); | |
114 | void make_metadata(char *filename); | |
115 | int session_save(char *filename); | |
116 | ||
aa0b6b20 | 117 | /*--- hardware/common/ezusb.c -----------------------------------------------*/ |
10509bc2 BV |
118 | |
119 | int ezusb_reset(struct libusb_device_handle *hdl, int set_clear); | |
120 | int ezusb_install_firmware(libusb_device_handle *hdl, char *filename); | |
121 | int ezusb_upload_firmware(libusb_device *dev, int configuration, | |
122 | const char *filename); | |
123 | ||
aa0b6b20 UH |
124 | /*--- hardware/common/misc.c ------------------------------------------------*/ |
125 | ||
10509bc2 BV |
126 | /* TODO: Should not be public. */ |
127 | int opendev2(int device_index, struct sigrok_device_instance **sdi, | |
128 | libusb_device *dev, struct libusb_device_descriptor *des, | |
129 | int *skip, uint16_t vid, uint16_t pid, int interface); | |
130 | int opendev3(struct sigrok_device_instance **sdi, libusb_device *dev, | |
131 | struct libusb_device_descriptor *des, | |
132 | uint16_t vid, uint16_t pid, int interface); | |
133 | ||
aa0b6b20 | 134 | /*--- input/input.c ---------------------------------------------------------*/ |
10509bc2 | 135 | |
aa0b6b20 UH |
136 | struct input_format **input_list(void); |
137 | ||
138 | /*--- output/output.c -------------------------------------------------------*/ | |
139 | ||
140 | struct output_format **output_list(void); | |
141 | ||
142 | /*--- output/common.c -------------------------------------------------------*/ | |
143 | ||
144 | char *sigrok_samplerate_string(uint64_t samplerate); | |
145 | char *sigrok_period_string(uint64_t frequency); | |
10509bc2 | 146 | |
c2bd92ec | 147 | #endif |