Skip to content

Commit 3b5b123

Browse files
committed
tektronix-tds: Initial driver skeleton.
1 parent 5ab4f63 commit 3b5b123

File tree

5 files changed

+239
-0
lines changed

5 files changed

+239
-0
lines changed

Makefile.am

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -650,6 +650,12 @@ src_libdrivers_la_SOURCES += \
650650
src/hardware/sysclk-sla5032/protocol.c \
651651
src/hardware/sysclk-sla5032/api.c
652652
endif
653+
if HW_TEKTRONIX_TDS
654+
src_libdrivers_la_SOURCES += \
655+
src/hardware/tektronix-tds/protocol.h \
656+
src/hardware/tektronix-tds/protocol.c \
657+
src/hardware/tektronix-tds/api.c
658+
endif
653659
if HW_TELEINFO
654660
src_libdrivers_la_SOURCES += \
655661
src/hardware/teleinfo/protocol.h \

configure.ac

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,7 @@ SR_DRIVER([serial LCR], [serial-lcr], [serial_comm])
359359
SR_DRIVER([Siglent SDS], [siglent-sds])
360360
SR_DRIVER([Sysclk LWLA], [sysclk-lwla], [libusb])
361361
SR_DRIVER([Sysclk SLA5032], [sysclk-sla5032], [libusb])
362+
SR_DRIVER([Tektronix TDS], [tektronix-tds])
362363
SR_DRIVER([Teleinfo], [teleinfo], [serial_comm])
363364
SR_DRIVER([Testo], [testo], [libusb])
364365
SR_DRIVER([Tondaj SL-814], [tondaj-sl-814], [serial_comm])

src/hardware/tektronix-tds/api.c

Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
/*
2+
* This file is part of the libsigrok project.
3+
*
4+
* Copyright (C) 2023 Patrick Plenefisch <[email protected]>
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 struct sr_dev_driver tektronix_tds_driver_info;
24+
25+
static GSList *scan(struct sr_dev_driver *di, GSList *options)
26+
{
27+
struct drv_context *drvc;
28+
GSList *devices;
29+
30+
(void)options;
31+
32+
devices = NULL;
33+
drvc = di->context;
34+
drvc->instances = NULL;
35+
36+
/* TODO: scan for devices, either based on a SR_CONF_CONN option
37+
* or on a USB scan. */
38+
39+
return devices;
40+
}
41+
42+
static int dev_open(struct sr_dev_inst *sdi)
43+
{
44+
(void)sdi;
45+
46+
/* TODO: get handle from sdi->conn and open it. */
47+
48+
return SR_OK;
49+
}
50+
51+
static int dev_close(struct sr_dev_inst *sdi)
52+
{
53+
(void)sdi;
54+
55+
/* TODO: get handle from sdi->conn and close it. */
56+
57+
return SR_OK;
58+
}
59+
60+
static int config_get(uint32_t key, GVariant **data,
61+
const struct sr_dev_inst *sdi, const struct sr_channel_group *cg)
62+
{
63+
int ret;
64+
65+
(void)sdi;
66+
(void)data;
67+
(void)cg;
68+
69+
ret = SR_OK;
70+
switch (key) {
71+
/* TODO */
72+
default:
73+
return SR_ERR_NA;
74+
}
75+
76+
return ret;
77+
}
78+
79+
static int config_set(uint32_t key, GVariant *data,
80+
const struct sr_dev_inst *sdi, const struct sr_channel_group *cg)
81+
{
82+
int ret;
83+
84+
(void)sdi;
85+
(void)data;
86+
(void)cg;
87+
88+
ret = SR_OK;
89+
switch (key) {
90+
/* TODO */
91+
default:
92+
ret = SR_ERR_NA;
93+
}
94+
95+
return ret;
96+
}
97+
98+
static int config_list(uint32_t key, GVariant **data,
99+
const struct sr_dev_inst *sdi, const struct sr_channel_group *cg)
100+
{
101+
int ret;
102+
103+
(void)sdi;
104+
(void)data;
105+
(void)cg;
106+
107+
ret = SR_OK;
108+
switch (key) {
109+
/* TODO */
110+
default:
111+
return SR_ERR_NA;
112+
}
113+
114+
return ret;
115+
}
116+
117+
static int dev_acquisition_start(const struct sr_dev_inst *sdi)
118+
{
119+
/* TODO: configure hardware, reset acquisition state, set up
120+
* callbacks and send header packet. */
121+
122+
(void)sdi;
123+
124+
return SR_OK;
125+
}
126+
127+
static int dev_acquisition_stop(struct sr_dev_inst *sdi)
128+
{
129+
/* TODO: stop acquisition. */
130+
131+
(void)sdi;
132+
133+
return SR_OK;
134+
}
135+
136+
static struct sr_dev_driver tektronix_tds_driver_info = {
137+
.name = "tektronix-tds",
138+
.longname = "Tektronix TDS",
139+
.api_version = 1,
140+
.init = std_init,
141+
.cleanup = std_cleanup,
142+
.scan = scan,
143+
.dev_list = std_dev_list,
144+
.dev_clear = std_dev_clear,
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,
152+
.context = NULL,
153+
};
154+
SR_REGISTER_DEV_DRIVER(tektronix_tds_driver_info);
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/*
2+
* This file is part of the libsigrok project.
3+
*
4+
* Copyright (C) 2023 Patrick Plenefisch <[email protected]>
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+
SR_PRIV int tektronix_tds_receive_data(int fd, int revents, void *cb_data)
24+
{
25+
const struct sr_dev_inst *sdi;
26+
struct dev_context *devc;
27+
28+
(void)fd;
29+
30+
sdi = cb_data;
31+
if (!sdi)
32+
return TRUE;
33+
34+
devc = sdi->priv;
35+
if (!devc)
36+
return TRUE;
37+
38+
if (revents == G_IO_IN) {
39+
/* TODO */
40+
}
41+
42+
return TRUE;
43+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*
2+
* This file is part of the libsigrok project.
3+
*
4+
* Copyright (C) 2023 Patrick Plenefisch <[email protected]>
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+
#ifndef LIBSIGROK_HARDWARE_TEKTRONIX_TDS_PROTOCOL_H
21+
#define LIBSIGROK_HARDWARE_TEKTRONIX_TDS_PROTOCOL_H
22+
23+
#include <stdint.h>
24+
#include <glib.h>
25+
#include <libsigrok/libsigrok.h>
26+
#include "libsigrok-internal.h"
27+
28+
#define LOG_PREFIX "tektronix-tds"
29+
30+
struct dev_context {
31+
};
32+
33+
SR_PRIV int tektronix_tds_receive_data(int fd, int revents, void *cb_data);
34+
35+
#endif

0 commit comments

Comments
 (0)