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