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