Mercurial > hg > fxanalyse
comparison dds.h @ 206:c700a2d38fb8
New AD9956 interface
author | Daniele Nicolodi <daniele.nicolodi@obspm.fr> |
---|---|
date | Mon, 31 Mar 2014 17:03:38 +0200 |
parents | |
children | fcc988c6f841 |
comparison
equal
deleted
inserted
replaced
205:31093786d41d | 206:c700a2d38fb8 |
---|---|
1 #ifndef __FXANALYSE_DDS_H__ | |
2 #define __FXANALYSE_DDS_H__ | |
3 | |
4 #define usleep(t) Delay((t) / 1000000.0) | |
5 #define strdup(s) StrDup(s) | |
6 #define streq(x, y) (strcmp((x), (y)) == 0) | |
7 | |
8 typedef unsigned long long uint64; | |
9 | |
10 static inline uint64 ftw(double clock, double freq) | |
11 { | |
12 uint64 ftw = freq * ((double)(1ULL << 48) / clock); | |
13 return ftw; | |
14 } | |
15 | |
16 static inline double freq(double clock, uint64 ftw) | |
17 { | |
18 double freq = (double)ftw * (clock / (double)(1ULL << 48)); | |
19 return freq; | |
20 } | |
21 | |
22 static inline int strtouint64(const char *str, uint64 *v) | |
23 { | |
24 char *end; | |
25 *v = strtoull(str, &end, 0); | |
26 if (*end != '\0') | |
27 return -1; | |
28 return 0; | |
29 } | |
30 | |
31 int msend(int fd, char *buffer, int n); | |
32 int mrecv(int fd, char *buffer, int len); | |
33 int command(int fd, char *frmt, ...); | |
34 | |
35 #endif | |
36 |