annotate ad9956.c @ 239:ec81395bf08d

Solve name collisions and other problems caused by including Windows headers
author Daniele Nicolodi <daniele.nicolodi@obspm.fr>
date Thu, 12 Feb 2015 19:13:55 +0100
parents fcc988c6f841
children 5296f3bcd160
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
206
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1 #ifdef _CVI_
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
2 #include <winsock2.h>
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
3 #include <ansi_c.h>
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
4 #include <toolbox.h>
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
5 #else
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
6 #include <stdio.h>
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
7 #include <stdlib.h>
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
8 #include <unistd.h>
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
9 #include <errno.h>
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
10 #include <string.h>
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
11 #include <sys/types.h>
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
12 #include <sys/socket.h>
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
13 #include <netinet/in.h>
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
14 #include <arpa/inet.h>
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
15 #include <netdb.h>
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
16 #include <ctype.h>
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
17 #include <stdarg.h>
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
18 #endif
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
19
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
20 #include "dds.h"
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
21 #include "ad9956.h"
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
22
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
23
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
24 int ad9956_init(struct ad9956 *d, const char *hostname, double clock)
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
25 {
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
26 int sock, n, r;
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
27 char buffer[256];
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
28 struct sockaddr_in addr;
213
fcc988c6f841 Fix ad9956 sweep rate setting. Disable clock divider on init. Simplify
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 206
diff changeset
29 struct hostent* host;
fcc988c6f841 Fix ad9956 sweep rate setting. Disable clock divider on init. Simplify
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 206
diff changeset
30 uint64 value;
206
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
31
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
32 #ifdef _CVI_
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
33 WSADATA wsdata;
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
34 WSAStartup(MAKEWORD(2,2), &wsdata);
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
35 #endif
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
36
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
37 d->hostname = strdup(hostname);
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
38 d->port = 1234;
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
39 d->profile = 0;
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
40 d->clock = clock;
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
41
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
42 host = gethostbyname(hostname);
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
43 if (host == NULL)
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
44 return -1;
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
45
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
46 sock = socket(AF_INET, SOCK_STREAM, 0);
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
47 if (sock < 0)
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
48 return -2;
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
49
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
50 addr.sin_family = host->h_addrtype;
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
51 memcpy(&addr.sin_addr.s_addr, host->h_addr_list[0], host->h_length);
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
52 addr.sin_port = htons(d->port);
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
53
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
54 r = connect(sock, (struct sockaddr*)&addr, sizeof(addr));
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
55 if (r < 0)
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
56 return -3;
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
57
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
58 d->fd = sock;
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
59
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
60 /* check compatibility */
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
61 n = snprintf(buffer, sizeof(buffer), "REVISION");
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
62 r = msend(d->fd, buffer, n);
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
63 if (r < 0)
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
64 return r;
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
65 r = mrecv(d->fd, buffer, sizeof(buffer));
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
66 if (r < 0)
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
67 return r;
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
68 if (atoi(buffer) != REVISION)
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
69 return -EINVAL;
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
70
213
fcc988c6f841 Fix ad9956 sweep rate setting. Disable clock divider on init. Simplify
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 206
diff changeset
71 /* disable clock divider */
fcc988c6f841 Fix ad9956 sweep rate setting. Disable clock divider on init. Simplify
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 206
diff changeset
72 n = snprintf(buffer, sizeof(buffer), "GET CFR2");
fcc988c6f841 Fix ad9956 sweep rate setting. Disable clock divider on init. Simplify
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 206
diff changeset
73 r = msend(d->fd, buffer, n);
fcc988c6f841 Fix ad9956 sweep rate setting. Disable clock divider on init. Simplify
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 206
diff changeset
74 if (r < 0)
fcc988c6f841 Fix ad9956 sweep rate setting. Disable clock divider on init. Simplify
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 206
diff changeset
75 return r;
fcc988c6f841 Fix ad9956 sweep rate setting. Disable clock divider on init. Simplify
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 206
diff changeset
76 r = mrecv(d->fd, buffer, sizeof(buffer));
fcc988c6f841 Fix ad9956 sweep rate setting. Disable clock divider on init. Simplify
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 206
diff changeset
77 if (r < 0)
fcc988c6f841 Fix ad9956 sweep rate setting. Disable clock divider on init. Simplify
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 206
diff changeset
78 return r;
fcc988c6f841 Fix ad9956 sweep rate setting. Disable clock divider on init. Simplify
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 206
diff changeset
79 r = strtouint64(buffer, &value);
fcc988c6f841 Fix ad9956 sweep rate setting. Disable clock divider on init. Simplify
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 206
diff changeset
80 if (r < 0)
fcc988c6f841 Fix ad9956 sweep rate setting. Disable clock divider on init. Simplify
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 206
diff changeset
81 return r;
fcc988c6f841 Fix ad9956 sweep rate setting. Disable clock divider on init. Simplify
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 206
diff changeset
82 value = value | (1ULL << 16);
fcc988c6f841 Fix ad9956 sweep rate setting. Disable clock divider on init. Simplify
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 206
diff changeset
83 r = command(d->fd, "SET CFR2 0x%X", value);
fcc988c6f841 Fix ad9956 sweep rate setting. Disable clock divider on init. Simplify
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 206
diff changeset
84 if (r < 0)
fcc988c6f841 Fix ad9956 sweep rate setting. Disable clock divider on init. Simplify
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 206
diff changeset
85 return r;
fcc988c6f841 Fix ad9956 sweep rate setting. Disable clock divider on init. Simplify
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 206
diff changeset
86
206
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
87 return 0;
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
88 }
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
89
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
90
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
91 int ad9956_set_frequency(struct ad9956 *d, double f)
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
92 {
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
93 int r;
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
94 uint64 value = ftw(d->clock, f);
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
95
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
96 r = command(d->fd, "SET PCR%d 0x%llX", d->profile, value);
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
97 if (r < 0)
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
98 return r;
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
99
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
100 d->frequency = freq(d->clock, value);
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
101
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
102 return 0;
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
103 }
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
104
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
105
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
106 int ad9956_get_frequency(struct ad9956 *d, double *f)
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
107 {
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
108 int r, n;
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
109 uint64 value;
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
110 char buffer[256];
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
111
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
112 n = snprintf(buffer, sizeof(buffer), "GET PCR%d", d->profile);
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
113
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
114 r = msend(d->fd, buffer, n);
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
115 if (r < 0)
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
116 return r;
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
117
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
118 r = mrecv(d->fd, buffer, sizeof(buffer));
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
119 if (r < 0)
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
120 return r;
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
121
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
122 r = strtouint64(buffer, &value);
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
123 if (r < 0)
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
124 return r;
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
125
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
126 d->frequency = freq(d->clock, value);
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
127 if (f)
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
128 *f = d->frequency;
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
129
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
130 return 0;
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
131 }
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
132
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
133
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
134 int ad9956_set_sweep_rate(struct ad9956 *d, double rate)
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
135 {
213
fcc988c6f841 Fix ad9956 sweep rate setting. Disable clock divider on init. Simplify
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 206
diff changeset
136 int64 value = (int64)ftw(d->clock, fabs(rate * 0.01));
fcc988c6f841 Fix ad9956 sweep rate setting. Disable clock divider on init. Simplify
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 206
diff changeset
137 if (rate < 0.0)
fcc988c6f841 Fix ad9956 sweep rate setting. Disable clock divider on init. Simplify
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 206
diff changeset
138 value = -value;
fcc988c6f841 Fix ad9956 sweep rate setting. Disable clock divider on init. Simplify
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 206
diff changeset
139 return command(d->fd, "SWEEP SET DFTW %lld", value);
206
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
140 }
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
141
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
142
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
143 int ad9956_sweep_start(struct ad9956 *d)
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
144 {
213
fcc988c6f841 Fix ad9956 sweep rate setting. Disable clock divider on init. Simplify
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 206
diff changeset
145 return command(d->fd, "SWEEP START");
206
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
146 }
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
147
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
148
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
149 int ad9956_sweep_stop(struct ad9956 *d)
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
150 {
213
fcc988c6f841 Fix ad9956 sweep rate setting. Disable clock divider on init. Simplify
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 206
diff changeset
151 return command(d->fd, "SWEEP STOP");
206
c700a2d38fb8 New AD9956 interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
152 }