]>
Commit | Line | Data |
---|---|---|
1 | /* | |
2 | * This file is part of the libsigrok project. | |
3 | * | |
4 | * Copyright (C) 2013 Uwe Hermann <uwe@hermann-uwe.de> | |
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 2 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, write to the Free Software | |
18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | |
19 | */ | |
20 | ||
21 | #include "protocol.h" | |
22 | ||
23 | SR_PRIV struct sr_dev_driver ikalogic_scanaplus_driver_info; | |
24 | static struct sr_dev_driver *di = &ikalogic_scanaplus_driver_info; | |
25 | ||
26 | static int init(struct sr_context *sr_ctx) | |
27 | { | |
28 | return std_hw_init(sr_ctx, di, LOG_PREFIX); | |
29 | } | |
30 | ||
31 | static GSList *scan(GSList *options) | |
32 | { | |
33 | struct drv_context *drvc; | |
34 | GSList *devices; | |
35 | ||
36 | (void)options; | |
37 | ||
38 | devices = NULL; | |
39 | drvc = di->priv; | |
40 | drvc->instances = NULL; | |
41 | ||
42 | return devices; | |
43 | } | |
44 | ||
45 | static GSList *dev_list(void) | |
46 | { | |
47 | return ((struct drv_context *)(di->priv))->instances; | |
48 | } | |
49 | ||
50 | static int dev_clear(void) | |
51 | { | |
52 | return std_dev_clear(di, NULL); | |
53 | } | |
54 | ||
55 | static int dev_open(struct sr_dev_inst *sdi) | |
56 | { | |
57 | (void)sdi; | |
58 | ||
59 | sdi->status = SR_ST_ACTIVE; | |
60 | ||
61 | return SR_OK; | |
62 | } | |
63 | ||
64 | static int dev_close(struct sr_dev_inst *sdi) | |
65 | { | |
66 | (void)sdi; | |
67 | ||
68 | sdi->status = SR_ST_INACTIVE; | |
69 | ||
70 | return SR_OK; | |
71 | } | |
72 | ||
73 | static int cleanup(void) | |
74 | { | |
75 | return dev_clear(); | |
76 | } | |
77 | ||
78 | static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi) | |
79 | { | |
80 | int ret; | |
81 | ||
82 | (void)sdi; | |
83 | (void)data; | |
84 | ||
85 | ret = SR_OK; | |
86 | switch (key) { | |
87 | default: | |
88 | return SR_ERR_NA; | |
89 | } | |
90 | ||
91 | return ret; | |
92 | } | |
93 | ||
94 | static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi) | |
95 | { | |
96 | int ret; | |
97 | ||
98 | (void)data; | |
99 | ||
100 | if (sdi->status != SR_ST_ACTIVE) | |
101 | return SR_ERR_DEV_CLOSED; | |
102 | ||
103 | ret = SR_OK; | |
104 | switch (key) { | |
105 | default: | |
106 | ret = SR_ERR_NA; | |
107 | } | |
108 | ||
109 | return ret; | |
110 | } | |
111 | ||
112 | static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi) | |
113 | { | |
114 | int ret; | |
115 | ||
116 | (void)sdi; | |
117 | (void)data; | |
118 | ||
119 | ret = SR_OK; | |
120 | switch (key) { | |
121 | default: | |
122 | return SR_ERR_NA; | |
123 | } | |
124 | ||
125 | return ret; | |
126 | } | |
127 | ||
128 | static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data) | |
129 | { | |
130 | (void)sdi; | |
131 | (void)cb_data; | |
132 | ||
133 | if (sdi->status != SR_ST_ACTIVE) | |
134 | return SR_ERR_DEV_CLOSED; | |
135 | ||
136 | return SR_OK; | |
137 | } | |
138 | ||
139 | static int dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data) | |
140 | { | |
141 | (void)cb_data; | |
142 | ||
143 | if (sdi->status != SR_ST_ACTIVE) | |
144 | return SR_ERR_DEV_CLOSED; | |
145 | ||
146 | return SR_OK; | |
147 | } | |
148 | ||
149 | SR_PRIV struct sr_dev_driver ikalogic_scanaplus_driver_info = { | |
150 | .name = "ikalogic-scanaplus", | |
151 | .longname = "Ikalogic ScanaPLUS", | |
152 | .api_version = 1, | |
153 | .init = init, | |
154 | .cleanup = cleanup, | |
155 | .scan = scan, | |
156 | .dev_list = dev_list, | |
157 | .dev_clear = dev_clear, | |
158 | .config_get = config_get, | |
159 | .config_set = config_set, | |
160 | .config_list = config_list, | |
161 | .dev_open = dev_open, | |
162 | .dev_close = dev_close, | |
163 | .dev_acquisition_start = dev_acquisition_start, | |
164 | .dev_acquisition_stop = dev_acquisition_stop, | |
165 | .priv = NULL, | |
166 | }; |