42#define AD9739A_READ (1 << 7)
43#define AD9739A_WRITE (0 << 7)
46#define AD9739A_REG_MODE 0x00
47#define AD9739A_REG_POWER_DOWN 0x01
48#define AD9739A_REG_CNT_CLK_DIS 0x02
49#define AD9739A_REG_IRQ_EN 0x03
50#define AD9739A_REG_IRQ_REQ 0x04
51#define AD9739A_REG_FSC_1 0x06
52#define AD9739A_REG_FSC_2 0x07
53#define AD9739A_REG_DEC_CNT 0x08
54#define AD9739A_REG_LVDS_STAT1 0x0C
55#define AD9739A_REG_LVDS_REC_CNT1 0x10
56#define AD9739A_REG_LVDS_REC_CNT2 0x11
57#define AD9739A_REG_LVDS_REC_CNT3 0x12
58#define AD9739A_REG_LVDS_REC_CNT4 0x13
59#define AD9739A_REG_LVDS_REC_CNT5 0x14
60#define AD9739A_REG_LVDS_REC_STAT1 0x19
61#define AD9739A_REG_LVDS_REC_STAT2 0x1A
62#define AD9739A_REG_LVDS_REC_STAT3 0x1B
63#define AD9739A_REG_LVDS_REC_STAT4 0x1C
64#define AD9739A_REG_LVDS_REC_STAT9 0x21
65#define AD9739A_REG_CROSS_CNT1 0x22
66#define AD9739A_REG_CROSS_CNT2 0x23
67#define AD9739A_REG_PHS_DET 0x24
68#define AD9739A_REG_MU_DUTY 0x25
69#define AD9739A_REG_MU_CNT1 0x26
70#define AD9739A_REG_MU_CNT2 0x27
71#define AD9739A_REG_MU_CNT3 0x28
72#define AD9739A_REG_MU_CNT4 0x29
73#define AD9739A_REG_MU_STAT1 0x2A
74#define AD9739A_REG_PART_ID 0x35
75#define AD9739A_CHIP_ID 0x24
78#define AD9739A_MODE_SDIO_DIR ((1 << 7) | (1 << 0))
79#define AD9739A_MODE_LSB ((1 << 6) | (1 << 1))
80#define AD9739A_MODE_RESET ((1 << 5) | (1 << 2))
83#define AD9739A_POWER_DOWN_LVDS_DRVR_PD (1 << 5)
84#define AD9739A_POWER_DOWN_LVDS_RCVR_PD (1 << 4)
85#define AD9739A_POWER_DOWN_CLK_RCVR_PD (1 << 1)
86#define AD9739A_POWER_DOWN_DAC_BIAS_PD (1 << 0)
89#define AD9739A_CNT_CLK_DIS_CLKGEN_PD (1 << 3)
90#define AD9739A_CNT_CLK_DIS_REC_CNT_CLK (1 << 1)
91#define AD9739A_CNT_CLK_DIS_MU_CNT_CLK (1 << 0)
94#define AD9739A_IRQ_EN_MU_LST_EN (1 << 3)
95#define AD9739A_IRQ_EN_MU_LCK_EN (1 << 2)
96#define AD9739A_IRQ_EN_RCV_LST_EN (1 << 1)
97#define AD9739A_IRQ_EN_RCV_LCK_EN (1 << 0)
100#define AD9739A_IRQ_REQ_MU_LST_IRQ (1 << 3)
101#define AD9739A_IRQ_REQ_MU_LCK_IRQ (1 << 2)
102#define AD9739A_IRQ_REQ_RCV_LST_IRQ (1 << 1)
103#define AD9739A_IRQ_REQ_RCV_LCK_IRQ (1 << 0)
106#define AD9739A_FSC_1_FSC_1(x) (((x) & 0xFF) << 0)
109#define AD9739A_FSC_2_FSC_2(x) (((x) & 0x3) << 0)
110#define AD9739A_FSC_2_Sleep (1 << 7)
113#define AD9739A_DEC_CNT_DAC_DEC(x) (((x) & 0x3) << 0)
115#define AD9739A_DAC_DEC_NORMAL_BASEBAND 0
117#define AD9739A_DAC_DEC_MIX_MODE 2
120#define AD9739A_LVDS_STAT1_DCI_PRE_PH0 (1 << 2)
121#define AD9739A_LVDS_STAT1_DCI_PST_PH0 (1 << 0)
124#define AD9739A_LVDS_REC_CNT1_RCVR_FLG_RST (1 << 2)
125#define AD9739A_LVDS_REC_CNT1_RCVR_LOOP_ON (1 << 1)
126#define AD9739A_LVDS_REC_CNT1_RCVR_CNT_ENA (1 << 0)
129#define AD9739A_LVDS_REC_CNT2_SMP_DEL(x) (((x) & 0x3) << 6)
132#define AD9739A_LVDS_REC_CNT3_SMP_DEL(x) (((x) & 0xFF) << 0)
135#define AD9739A_LVDS_REC_CNT4_DCI_DEL(x) (((x) & 0xF) << 4)
136#define AD9739A_LVDS_REC_CNT4_FINE_DEL_SKEW(x) (((x) & 0xF) << 0)
139#define AD9739A_LVDS_REC_CNT5_DCI_DEL(x) (((x) & 0x3F) << 0)
142#define AD9739A_LVDS_REC_STAT1_SMP_DEL(x) (((x) & 0x3) << 6)
145#define AD9739A_LVDS_REC_STAT2_SMP_DEL(x) (((x) & 0xFF) << 0)
148#define AD9739A_LVDS_REC_STAT3_DCI_DEL(x) (((x) & 0x3) << 6)
151#define AD9739A_LVDS_REC_STAT4_DCI_DEL(x) (((x) & 0xFF) << 0)
154#define AD9739A_LVDS_REC_STAT9_RCVR_TRK_ON (1 << 3)
155#define AD9739A_LVDS_REC_STAT9_RCVR_FE_ON (1 << 2)
156#define AD9739A_LVDS_REC_STAT9_RCVR_LST (1 << 1)
157#define AD9739A_LVDS_REC_STAT9_RCVR_LCK (1 << 0)
160#define AD9739A_CROSS_CNT1_DIR_P (1 << 4)
161#define AD9739A_CROSS_CNT1_CLKP_OFFSET(x) (((x) & 0xF) << 0)
164#define AD9739A_CROSS_CNT2_DIR_N (1 << 4)
165#define AD9739A_CROSS_CNT2_CLKN_OFFSET(x) (((x) & 0xF) << 0)
168#define AD9739A_PHS_DET_CMP_BST (1 << 5)
169#define AD9739A_PHS_DET_PHS_DET_AUTO_EN (1 << 4)
172#define AD9739A_MU_DUTY_MU_DUTY_AUTO_EN (1 << 7)
175#define AD9739A_MU_CNT1_SLOPE (1 << 6)
176#define AD9739A_MU_CNT1_MODE(x) (((x) & 0x3) << 4)
177#define AD9739A_MU_CNT1_READ (1 << 3)
178#define AD9739A_MU_CNT1_GAIN(x) (((x) & 0x3) << 1)
179#define AD9739A_MU_CNT1_ENABLE (1 << 0)
182#define AD9739A_MU_CNT2_MUDEL (1 << 7)
183#define AD9739A_MU_CNT2_SRCH_MODE(x) ((((x) & 0x3) << 5))
184#define AD9739A_MU_CNT2_SET_PHS(x) ((((x) & 0x1F) << 0))
187#define AD9739A_MU_CNT3_MUDEL(x) ((((x) & 0xFF) << 0))
190#define AD9739A_MU_CNT4_SEARCH_TOL (1 << 7)
191#define AD9739A_MU_CNT4_RETRY (1 << 6)
192#define AD9739A_MU_CNT4_CONTRST (1 << 5)
193#define AD9739A_MU_CNT4_GUARD(x) ((((x) & 0x1F) << 0))
196#define AD9739A_MU_STAT1_MU_LST (1 << 1)
197#define AD9739A_MU_STAT1_MU_LKD (1 << 0)
200#define AD9739A_PART_ID_PART_ID(x) ((((x) & 0xFF) << 0))
224 uint8_t register_address,
225 uint8_t register_value);
228 uint8_t register_address,
229 uint8_t *register_value);
struct ad7616_init_param init_param
Definition ad7616_sdz.c:107
int32_t ad9739a_read(struct ad9739a_dev *dev, uint8_t register_address, uint8_t *register_value)
Reads the value of the selected register.
Definition ad9739a.c:76
float ad9739a_dac_fs_current(struct ad9739a_dev *dev, float fs_val)
Sets the full-scale output current for the DAC.
Definition ad9739a.c:184
int32_t ad9739a_operation_mode(struct ad9739a_dev *dev, uint8_t mode)
int32_t ad9739a_setup(struct ad9739a_dev **device, struct ad9739a_init_param init_param)
Initializes the AD9739A.
Definition ad9739a.c:263
int32_t ad9739a_power_down(struct ad9739a_dev *dev, uint8_t pwr_config)
Powers down LVDS interface and TxDAC.
Definition ad9739a.c:126
int32_t ad9739a_remove(struct ad9739a_dev *dev)
Free the resources allocated by ad9739a_setup().
Definition ad9739a.c:448
int32_t ad9739a_write(struct ad9739a_dev *dev, uint8_t register_address, uint8_t register_value)
Writes a value to the selected register.
Definition ad9739a.c:52
int32_t ad9739a_reset(struct ad9739a_dev *dev)
Resets the device.
Definition ad9739a.c:98
int32_t delay_fdata_cycles(uint32_t cycles)
Delay for a number of fdata clock cycles.
Definition ad9739a.c:233
Header file of SPI Interface.
struct no_os_spi_desc * spi_desc
Definition ad9739a.h:204
Driver Initialization parameters.
Definition ad9739a.h:211
struct no_os_spi_init_param spi_init
Definition ad9739a.h:213
float full_scale_current
Definition ad9739a.h:219
uint8_t common_mode_voltage_dacclk_n
Definition ad9739a.h:217
uint8_t common_mode_voltage_dacclk_p
Definition ad9739a.h:215
Definition ad9361_util.h:63
Structure holding SPI descriptor.
Definition no_os_spi.h:180
Structure holding the parameters for SPI initialization.
Definition no_os_spi.h:128
enum no_os_spi_mode mode
Definition no_os_spi.h:136