2014-08-28 16:56:48 +08:00
|
|
|
#ifndef __DDS_H
|
|
|
|
#define __DDS_H
|
|
|
|
|
2015-03-12 20:14:06 +08:00
|
|
|
#include <hw/common.h>
|
2015-07-08 23:22:43 +08:00
|
|
|
#include <generated/csr.h>
|
2015-04-11 21:32:01 +08:00
|
|
|
#include <generated/mem.h>
|
2015-03-12 20:14:06 +08:00
|
|
|
|
2015-05-08 16:51:54 +08:00
|
|
|
/* Maximum number of commands in a batch */
|
|
|
|
#define DDS_MAX_BATCH 16
|
|
|
|
|
2015-07-08 23:22:43 +08:00
|
|
|
#ifdef DDS_AD9858
|
|
|
|
#define DDS_CFR0 0x00
|
|
|
|
#define DDS_CFR1 0x01
|
|
|
|
#define DDS_CFR2 0x02
|
|
|
|
#define DDS_CFR3 0x03
|
2015-03-12 20:14:06 +08:00
|
|
|
#define DDS_FTW0 0x0a
|
|
|
|
#define DDS_FTW1 0x0b
|
|
|
|
#define DDS_FTW2 0x0c
|
|
|
|
#define DDS_FTW3 0x0d
|
|
|
|
#define DDS_POW0 0x0e
|
|
|
|
#define DDS_POW1 0x0f
|
2015-05-08 14:44:39 +08:00
|
|
|
#define DDS_FUD 0x40
|
2015-03-12 20:14:06 +08:00
|
|
|
#define DDS_GPIO 0x41
|
2015-07-08 23:22:43 +08:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef DDS_AD9914
|
|
|
|
#define DDS_CFR1L 0x01
|
|
|
|
#define DDS_CFR1H 0x03
|
|
|
|
#define DDS_CFR2L 0x05
|
|
|
|
#define DDS_CFR2H 0x07
|
|
|
|
#define DDS_CFR3L 0x09
|
|
|
|
#define DDS_CFR3H 0x0b
|
|
|
|
#define DDS_CFR4L 0x0d
|
|
|
|
#define DDS_CFR4H 0x0f
|
|
|
|
#define DDS_FTWL 0x2d
|
|
|
|
#define DDS_FTWH 0x2f
|
|
|
|
#define DDS_POW 0x31
|
2015-08-27 10:47:44 +08:00
|
|
|
#define DDS_ASF 0x33
|
2015-07-08 23:22:43 +08:00
|
|
|
#define DDS_FUD 0x80
|
|
|
|
#define DDS_GPIO 0x81
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef DDS_AD9858
|
|
|
|
#define DDS_POW_WIDTH 14
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef DDS_AD9914
|
|
|
|
#define DDS_POW_WIDTH 16
|
|
|
|
#endif
|
2015-03-12 20:14:06 +08:00
|
|
|
|
2015-05-08 14:44:39 +08:00
|
|
|
enum {
|
|
|
|
PHASE_MODE_CONTINUOUS = 0,
|
|
|
|
PHASE_MODE_ABSOLUTE = 1,
|
|
|
|
PHASE_MODE_TRACKING = 2
|
|
|
|
};
|
|
|
|
|
|
|
|
void dds_init(long long int timestamp, int channel);
|
2015-05-08 16:51:54 +08:00
|
|
|
void dds_batch_enter(long long int timestamp);
|
|
|
|
void dds_batch_exit(void);
|
2015-05-08 14:44:39 +08:00
|
|
|
void dds_set(long long int timestamp, int channel,
|
2015-09-06 03:14:01 +08:00
|
|
|
unsigned int ftw, unsigned int pow, int phase_mode, unsigned int amplitude);
|
2014-08-28 16:56:48 +08:00
|
|
|
|
|
|
|
#endif /* __DDS_H */
|