]> sigrok.org Git - libsigrok.git/blame - src/hardware/deree-de5000/api.c
HACKING: Improve description of Doxygen conventions.
[libsigrok.git] / src / hardware / deree-de5000 / api.c
CommitLineData
b5089195
JH
1/*
2 * This file is part of the libsigrok project.
3 *
4 * Copyright (C) 2014 Janne Huttunen <jahuttun@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
6ec6c43b 20#include <config.h>
b5089195
JH
21#include <stdint.h>
22#include <string.h>
23#include <math.h>
24#include <glib.h>
c1aae900 25#include <libsigrok/libsigrok.h>
b5089195
JH
26#include "libsigrok-internal.h"
27
beedfa06
GS
28#define LOG_PREFIX "serial-lcr-es51919"
29
30struct lcr_es51919_info {
31 struct sr_dev_driver di;
32 const char *vendor;
33 const char *model;
34};
b5089195 35
696b79d2 36static int dev_clear(const struct sr_dev_driver *di)
b5089195 37{
4f840ce9 38 return std_dev_clear(di, es51919_serial_clean);
b5089195
JH
39}
40
4f840ce9 41static GSList *scan(struct sr_dev_driver *di, GSList *options)
b5089195 42{
beedfa06 43 struct lcr_es51919_info *lcr;
b5089195
JH
44 struct sr_dev_inst *sdi;
45
beedfa06
GS
46 lcr = (struct lcr_es51919_info *)di;
47
48 if (!(sdi = es51919_serial_scan(options, lcr->vendor, lcr->model)))
b5089195
JH
49 return NULL;
50
15a5bfe4 51 return std_scan_complete(di, g_slist_append(NULL, sdi));
b5089195
JH
52}
53
beedfa06
GS
54#define LCR_ES51919(id, vendor, model) \
55 &((struct lcr_es51919_info) { \
56 { \
57 .name = id, \
58 .longname = vendor " " model, \
59 .api_version = 1, \
60 .init = std_init, \
61 .cleanup = std_cleanup, \
62 .scan = scan, \
63 .dev_list = std_dev_list, \
64 .dev_clear = dev_clear, \
65 .config_get = es51919_serial_config_get, \
66 .config_set = es51919_serial_config_set, \
67 .config_list = es51919_serial_config_list, \
68 .dev_open = std_serial_dev_open, \
69 .dev_close = std_serial_dev_close, \
70 .dev_acquisition_start = es51919_serial_acquisition_start, \
71 .dev_acquisition_stop = std_serial_dev_acquisition_stop, \
72 .context = NULL, \
73 }, \
74 vendor, model, \
75 }).di
76
77SR_REGISTER_DEV_DRIVER_LIST(lcr_es51919_drivers,
78 LCR_ES51919("deree-de5000", "DER EE", "DE-5000"),
6c62c605 79 LCR_ES51919("peaktech-2170", "PeakTech", "2170"),
beedfa06 80);