]>
Commit | Line | Data |
---|---|---|
0549416e JC |
1 | /* |
2 | * This file is part of the libsigrok project. | |
3 | * | |
4 | * Copyright (C) 2018 James Churchill <pelrun@gmail.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 | #include <config.h> | |
21 | #include "protocol.h" | |
22 | ||
23 | static GSList *scan(struct sr_dev_driver *di, GSList *options) | |
24 | { | |
25 | struct drv_context *drvc; | |
26 | GSList *devices; | |
27 | ||
28 | (void)options; | |
29 | ||
30 | devices = NULL; | |
31 | drvc = di->context; | |
32 | drvc->instances = NULL; | |
33 | ||
34 | /* TODO: scan for devices, either based on a SR_CONF_CONN option | |
35 | * or on a USB scan. */ | |
36 | ||
37 | return devices; | |
38 | } | |
39 | ||
40 | static int dev_open(struct sr_dev_inst *sdi) | |
41 | { | |
42 | (void)sdi; | |
43 | ||
44 | /* TODO: get handle from sdi->conn and open it. */ | |
45 | ||
46 | return SR_OK; | |
47 | } | |
48 | ||
49 | static int dev_close(struct sr_dev_inst *sdi) | |
50 | { | |
51 | (void)sdi; | |
52 | ||
53 | /* TODO: get handle from sdi->conn and close it. */ | |
54 | ||
55 | return SR_OK; | |
56 | } | |
57 | ||
58 | static int config_get(uint32_t key, GVariant **data, | |
59 | const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) | |
60 | { | |
61 | int ret; | |
62 | ||
63 | (void)sdi; | |
64 | (void)data; | |
65 | (void)cg; | |
66 | ||
67 | ret = SR_OK; | |
68 | switch (key) { | |
69 | /* TODO */ | |
70 | default: | |
71 | return SR_ERR_NA; | |
72 | } | |
73 | ||
74 | return ret; | |
75 | } | |
76 | ||
77 | static int config_set(uint32_t key, GVariant *data, | |
78 | const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) | |
79 | { | |
80 | int ret; | |
81 | ||
82 | (void)sdi; | |
83 | (void)data; | |
84 | (void)cg; | |
85 | ||
86 | ret = SR_OK; | |
87 | switch (key) { | |
88 | /* TODO */ | |
89 | default: | |
90 | ret = SR_ERR_NA; | |
91 | } | |
92 | ||
93 | return ret; | |
94 | } | |
95 | ||
96 | static int config_list(uint32_t key, GVariant **data, | |
97 | const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) | |
98 | { | |
99 | int ret; | |
100 | ||
101 | (void)sdi; | |
102 | (void)data; | |
103 | (void)cg; | |
104 | ||
105 | ret = SR_OK; | |
106 | switch (key) { | |
107 | /* TODO */ | |
108 | default: | |
109 | return SR_ERR_NA; | |
110 | } | |
111 | ||
112 | return ret; | |
113 | } | |
114 | ||
115 | static int dev_acquisition_start(const struct sr_dev_inst *sdi) | |
116 | { | |
117 | /* TODO: configure hardware, reset acquisition state, set up | |
118 | * callbacks and send header packet. */ | |
119 | ||
120 | (void)sdi; | |
121 | ||
122 | return SR_OK; | |
123 | } | |
124 | ||
125 | static int dev_acquisition_stop(struct sr_dev_inst *sdi) | |
126 | { | |
127 | /* TODO: stop acquisition. */ | |
128 | ||
129 | (void)sdi; | |
130 | ||
131 | return SR_OK; | |
132 | } | |
133 | ||
134 | SR_PRIV struct sr_dev_driver rdtech_dps_driver_info = { | |
135 | .name = "rdtech-dps", | |
136 | .longname = "RDTech DPS", | |
137 | .api_version = 1, | |
138 | .init = std_init, | |
139 | .cleanup = std_cleanup, | |
140 | .scan = scan, | |
141 | .dev_list = std_dev_list, | |
142 | .dev_clear = std_dev_clear, | |
143 | .config_get = config_get, | |
144 | .config_set = config_set, | |
145 | .config_list = config_list, | |
146 | .dev_open = dev_open, | |
147 | .dev_close = dev_close, | |
148 | .dev_acquisition_start = dev_acquisition_start, | |
149 | .dev_acquisition_stop = dev_acquisition_stop, | |
150 | .context = NULL, | |
151 | }; | |
152 | ||
153 | SR_REGISTER_DEV_DRIVER(rdtech_dps_driver_info); |