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