]> sigrok.org Git - libsigrok.git/blame - sigrok-proto.h
Add sr_device_get_info
[libsigrok.git] / sigrok-proto.h
CommitLineData
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 25int sr_init(void);
cd009d55 26int sr_exit(void);
10509bc2 27
1352eedd
UH
28/*--- log.c -----------------------------------------------------------------*/
29
30int sr_set_loglevel(int loglevel);
31int sr_get_loglevel(void);
32
aa0b6b20
UH
33/*--- datastore.c -----------------------------------------------------------*/
34
c4911129
UH
35int sr_datastore_new(int unitsize, struct sr_datastore **ds);
36int sr_datastore_destroy(struct sr_datastore *ds);
15278f3e
UH
37int sr_datastore_put(struct sr_datastore *ds, void *data, unsigned int length,
38 int in_unitsize, int *probelist);
aa0b6b20 39
aa0b6b20 40/*--- device.c --------------------------------------------------------------*/
10509bc2 41
0e3b1439 42int sr_device_scan(void);
2bf4aca6 43GSList *sr_device_list(void);
08d4cc1d 44struct sr_device *sr_device_new(const struct sr_device_plugin *plugin,
464d12c7 45 int plugin_index);
0e3b1439 46int sr_device_clear(struct sr_device *device);
0e3b1439
UH
47int sr_device_probe_clear(struct sr_device *device, int probenum);
48int sr_device_probe_add(struct sr_device *device, const char *name);
08d4cc1d
UH
49struct sr_probe *sr_device_probe_find(const struct sr_device *device,
50 int probenum);
0e3b1439
UH
51int sr_device_probe_name(struct sr_device *device, int probenum,
52 const char *name);
0e3b1439
UH
53int sr_device_trigger_clear(struct sr_device *device);
54int sr_device_trigger_set(struct sr_device *device, int probenum,
55 const char *trigger);
08d4cc1d 56gboolean sr_device_has_hwcap(const struct sr_device *device, int hwcap);
fd9836bf
AS
57int sr_device_get_info(const struct sr_device *device, int id,
58 const void **data);
10509bc2 59
aa0b6b20
UH
60/*--- filter.c --------------------------------------------------------------*/
61
488a13b1 62int sr_filter_probes(int in_unitsize, int out_unitsize, const int *probelist,
60eb1eb5
BV
63 const unsigned char *data_in, uint64_t length_in,
64 char **data_out, uint64_t *length_out);
aa0b6b20
UH
65
66/*--- hwplugin.c ------------------------------------------------------------*/
67
ee4b6342 68GSList *sr_list_hwplugins(void);
155d1012 69int sr_init_hwplugins(struct sr_device_plugin *plugin);
8722c31e 70void sr_cleanup_hwplugins(void);
10509bc2
BV
71
72/* Generic device instances */
a00ba012 73struct sr_device_instance *sr_device_instance_new(int index,
10509bc2 74 int status, const char *vendor, const char *model, const char *version);
d32d961d
UH
75struct sr_device_instance *sr_get_device_instance(GSList *device_instances,
76 int device_index);
a00ba012 77void sr_device_instance_free(struct sr_device_instance *sdi);
10509bc2
BV
78
79/* USB-specific instances */
22b02383 80#ifdef HAVE_LIBUSB_1_0
6c290072 81struct sr_usb_device_instance *sr_usb_device_instance_new(uint8_t bus,
10509bc2 82 uint8_t address, struct libusb_device_handle *hdl);
6c290072 83void sr_usb_device_instance_free(struct sr_usb_device_instance *usb);
22b02383 84#endif
10509bc2
BV
85
86/* Serial-specific instances */
6c290072 87struct sr_serial_device_instance *sr_serial_device_instance_new(
10509bc2 88 const char *port, int fd);
6c290072 89void sr_serial_device_instance_free(struct sr_serial_device_instance *serial);
10509bc2 90
a65de030
UH
91int sr_find_hwcap(int *capabilities, int hwcap);
92struct sr_hwcap_option *sr_find_hwcap_option(int hwcap);
6f1be0a2
UH
93void sr_source_remove(int fd);
94void sr_source_add(int fd, int events, int timeout,
a887e3da 95 sr_receive_data_callback rcv_cb, void *user_data);
10509bc2
BV
96
97/*--- session.c -------------------------------------------------------------*/
98
13b05733
UH
99typedef void (*sr_datafeed_callback) (struct sr_device *device,
100 struct sr_datafeed_packet *packet);
10509bc2
BV
101
102/* Session setup */
8a2efef2
UH
103int sr_session_load(const char *filename);
104struct sr_session *sr_session_new(void);
e0508e67
UH
105int sr_session_destroy(void);
106int sr_session_device_clear(void);
8a2efef2 107int sr_session_device_add(struct sr_device *device);
10509bc2 108
10509bc2 109/* Datafeed setup */
e0508e67
UH
110int sr_session_datafeed_callback_clear(void);
111int sr_session_datafeed_callback_add(sr_datafeed_callback callback);
10509bc2
BV
112
113/* Session control */
8a2efef2 114int sr_session_start(void);
e0508e67
UH
115int sr_session_run(void);
116int sr_session_halt(void);
117int sr_session_stop(void);
118int sr_session_bus(struct sr_device *device, struct sr_datafeed_packet *packet);
8225e921 119int sr_session_save(const char *filename);
e0508e67 120int sr_session_source_add(int fd, int events, int timeout,
a887e3da 121 sr_receive_data_callback callback, void *user_data);
e0508e67 122int sr_session_source_remove(int fd);
10509bc2 123
aa0b6b20 124/*--- input/input.c ---------------------------------------------------------*/
10509bc2 125
f50f3f40 126struct sr_input_format **sr_input_list(void);
aa0b6b20
UH
127
128/*--- output/output.c -------------------------------------------------------*/
129
f50f3f40 130struct sr_output_format **sr_output_list(void);
aa0b6b20
UH
131
132/*--- output/common.c -------------------------------------------------------*/
133
a00ba012
UH
134char *sr_samplerate_string(uint64_t samplerate);
135char *sr_period_string(uint64_t frequency);
c4911129
UH
136char **sr_parse_triggerstring(struct sr_device *device,
137 const char *triggerstring);
f64c1414 138int sr_parse_sizestring(const char *sizestring, uint64_t *size);
40f5ddac 139uint64_t sr_parse_timestring(const char *timestring);
4d436e71 140gboolean sr_parse_boolstring(const char *boolstring);
10509bc2 141
c2bd92ec 142#endif