]>
Commit | Line | Data |
---|---|---|
bf5c4d46 GS |
1 | /* |
2 | * This file is part of the libsigrok project. | |
3 | * | |
4 | * Copyright (C) 2014 Janne Huttunen <jahuttun@gmail.com> | |
5 | * Copyright (C) 2019 Gerhard Sittig <gerhard.sittig@gmx.net> | |
6 | * | |
7 | * This program is free software: you can redistribute it and/or modify | |
8 | * it under the terms of the GNU General Public License as published by | |
9 | * the Free Software Foundation, either version 3 of the License, or | |
10 | * (at your option) any later version. | |
11 | * | |
12 | * This program is distributed in the hope that it will be useful, | |
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | * GNU General Public License for more details. | |
16 | * | |
17 | * You should have received a copy of the GNU General Public License | |
18 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
19 | */ | |
20 | ||
21 | #ifndef LIBSIGROK_HARDWARE_SERIAL_LCR_PROTOCOL_H | |
22 | #define LIBSIGROK_HARDWARE_SERIAL_LCR_PROTOCOL_H | |
23 | ||
24 | #define LOG_PREFIX "serial-lcr" | |
25 | ||
26 | #include <libsigrok/libsigrok.h> | |
27 | #include <libsigrok-internal.h> | |
28 | #include <stdint.h> | |
29 | #include <stdlib.h> | |
30 | ||
31 | struct lcr_info { | |
32 | struct sr_dev_driver di; | |
33 | const char *vendor; | |
34 | const char *model; | |
35 | size_t channel_count; | |
3f5473dd | 36 | const char **channel_formats; |
bf5c4d46 GS |
37 | const char *comm; |
38 | size_t packet_size; | |
39 | gboolean (*packet_valid)(const uint8_t *pkt); | |
40 | int (*packet_parse)(const uint8_t *pkt, float *value, | |
41 | struct sr_datafeed_analog *analog, void *info); | |
42 | int (*config_get)(uint32_t key, GVariant **data, | |
43 | const struct sr_dev_inst *sdi, | |
44 | const struct sr_channel_group *cg); | |
45 | int (*config_set)(uint32_t key, GVariant *data, | |
46 | const struct sr_dev_inst *sdi, | |
47 | const struct sr_channel_group *cg); | |
48 | int (*config_list)(uint32_t key, GVariant **data, | |
49 | const struct sr_dev_inst *sdi, | |
50 | const struct sr_channel_group *cg); | |
51 | }; | |
52 | ||
53 | #define LCR_BUFSIZE 128 | |
54 | ||
55 | struct dev_context { | |
56 | const struct lcr_info *lcr_info; | |
57 | struct sr_sw_limits limits; | |
58 | uint8_t buf[LCR_BUFSIZE]; | |
59 | size_t buf_rxpos, buf_rdpos; | |
60 | struct lcr_parse_info parse_info; | |
61 | uint64_t output_freq; | |
62 | const char *circuit_model; | |
63 | }; | |
64 | ||
65 | SR_PRIV int lcr_receive_data(int fd, int revents, void *cb_data); | |
66 | ||
67 | #endif |