view dds.h @ 268:ec4462c7f8b7

Extensive cleanup of beatnote specific variables Reorganize the beatnote specific variables in arrays indexed by the beatnote enum constants LO, HG, SR. Also reorganize DDS frequency related variables in arrays indexed by the DDS channel number.
author Daniele Nicolodi <daniele.nicolodi@obspm.fr>
date Thu, 09 Jul 2015 23:11:00 +0200
parents 5296f3bcd160
children
line wrap: on
line source

#ifndef __FXANALYSE_DDS_H__
#define __FXANALYSE_DDS_H__

typedef long long int64;
typedef unsigned long long uint64;

static inline uint64 ftw(double clock, double freq)
{
	uint64 ftw = freq * ((double)(1ULL << 48) / clock);
	return ftw;
}

static inline double freq(double clock, uint64 ftw)
{
	double freq = (double)ftw * (clock / (double)(1ULL << 48));
	return freq;
}

static inline int strtouint64(const char *str, uint64 *v)
{
	char *end;
	*v = strtoull(str, &end, 0);
	if (*end != '\0')
		return -1;
	return 0;
}

#endif