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