no-OS
All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
ad9467.h
Go to the documentation of this file.
1/***************************************************************************/
33#ifndef __AD9467_H__
34#define __AD9467_H__
35
36#include <stdint.h>
37#include "no_os_spi.h"
38
39#define AD9467_READ (1 << 15)
40#define AD9467_WRITE (0 << 15)
41#define AD9467_CNT(x) (((x) - 1) << 13)
42#define AD9467_ADDR(x) ((x) & 0X1FFF)
43
44/* Chip configuration registers */
45#define AD9467_REG_CHIP_PORT_CFG 0x00
46#define AD9467_REG_CHIP_ID 0x01
47#define AD9467_REG_CHIP_GRADE 0x02
48
49/* Channel index and transfer registers */
50#define AD9467_REG_DEVICE_UPDATE 0xFF
51
52/* ADC functions registers */
53#define AD9467_REG_MODES 0x08
54#define AD9467_REG_TEST_IO 0x0D
55#define AD9467_REG_ADC_INPUT 0x0F
56#define AD9467_REG_OFFSET 0x10
57#define AD9467_REG_OUT_MODE 0x14
58#define AD9467_REG_OUT_ADJ 0x15
59#define AD9467_REG_OUT_PHASE 0x16
60#define AD9467_REG_OUT_DELAY 0x17
61#define AD9467_REG_V_REF 0x18
62#define AD9467_REG_ANALOG_INPUT 0x2C
63#define AD9467_REG_BUFF_CURRENT_1 0x36
64#define AD9467_REG_BUFF_CURRENT_2 0x107
65
66/* AD9467_REG_CHIP_PORT_CFG */
67#define AD9467_CHIP_PORT_CGF_LSB_FIRST (1 << 6)
68#define AD9467_CHIP_PORT_CGF_SOFT_RST (1 << 5)
69
70/* AD9467_REG_CHIP_GRADE */
71#define AD9467_CHIP_GRADE_BITS(x) (((x) & 0x3) << 4)
72
73/* AD9467_REG_DEVICE_UPDATE */
74#define AD9467_DEVICE_UPDATE_SW (1 << 0)
75
76/* AD9467_REG_MODES */
77#define AD9467_MODES_INT_PD_MODE(x) (((x) & 0x3) << 0)
78
79/* AD9467_REG_TEST_IO */
80#define AD9467_TEST_IO_RST_PN_LONG (1 << 5)
81#define AD9467_TEST_IO_RST_PN_SHORT (1 << 4)
82#define AD9467_TEST_IO_OUT_TEST(x) (((x) & 0xF) << 0)
83
84/* AD9467_REG_ADC_INPUT */
85#define AD9467_ADC_INPUT_XVREF (1 << 7)
86#define AD9467_ADC_INPUT_ANALOG_DSCN (1 << 2)
87
88/* AD9467_REG_OUT_MODE */
89#define AD9467_OUT_MODE_DOUT_DISBL (1 << 4)
90#define AD9467_OUT_MODE_OUT_INV (1 << 2)
91#define AD9467_OUT_MODE_DATA_FORMAT(x) (((x) & 0x3) << 0)
92
93/* AD9467_REG_OUT_ADJ */
94#define AD9467_OUT_ADJ_LVDS (1 << 3)
95#define AD9467_OUT_ADJ_OUT_CURRENT(x) (((x) & 0x7) << 0)
96
97/* AD9467_REG_OUT_PHASE */
98#define AD9467_OUT_PHASE_DCO_INV (1 << 7)
99
100/* AD9467_REG_OUT_DELAY */
101#define AD9467_OUT_DELAY_DCO_DLY_EN (1 << 7)
102#define AD9467_OUT_DELAY_OUT_DLY(x) (((x) & 0x1F) << 0)
103
104/* AD9467_REG_V_REF */
105#define AD9467_V_REF_IN_FS_RANGE(x) (((x) & 0xF) << 0)
106
107/* AD9467_REG_ANALOG_INPUT */
108#define AD9467_ANALOG_INPUT_COUPLING (1 << 2)
109
110/* AD9467_REG_BUFF_CURRENT_1 */
111#define AD9467_BUFF_CURRENT_1(x) (((x) & 0x3F) << 2)
112
113/* AD9467_REG_BUFF_CURRENT_2 */
114#define AD9467_BUFF_CURRENT_2(x) (((x) & 0x3F) << 2)
115
117 /* SPI */
119};
120
122 /* SPI */
124};
125
127int32_t ad9467_setup(struct ad9467_dev **device,
130int32_t ad9467_remove(struct ad9467_dev *dev);
132int32_t ad9467_write(struct ad9467_dev *dev,
133 uint16_t reg_addr,
134 uint8_t reg_val);
136int32_t ad9467_read(struct ad9467_dev *dev,
137 uint16_t reg_addr,
138 uint8_t *reg_val);
141uint32_t ad9467_set_bits_to_reg(struct ad9467_dev *dev,
142 uint16_t register_address,
143 uint8_t bits_value,
144 uint8_t mask);
146int32_t ad9467_pwr_mode(struct ad9467_dev *dev,
147 int32_t mode,
148 int32_t *ret_mode);
150int32_t ad9467_test_mode(struct ad9467_dev *dev,
151 int32_t mode,
152 int32_t *ret_mode);
154int32_t ad9467_reset_pn9(struct ad9467_dev *dev,
155 int32_t rst,
156 int32_t *ret_stat);
158int32_t ad9467_reset_pn23(struct ad9467_dev *dev,
159 int32_t rst,
160 int32_t *ret_stat);
162int32_t ad9467_external_ref(struct ad9467_dev *dev,
163 int32_t en,
164 int32_t *ret_stat);
168 int32_t en,
169 int32_t *ret_stat);
171int32_t ad9467_offset_adj(struct ad9467_dev *dev,
172 int32_t adj,
173 int32_t *ret_stat);
175int32_t ad9467_output_disable(struct ad9467_dev *dev,
176 int32_t en,
177 int32_t *ret_stat);
179int32_t ad9467_output_invert(struct ad9467_dev *dev,
180 int32_t invert,
181 int32_t *ret_stat);
183int32_t ad9467_output_format(struct ad9467_dev *dev,
184 int32_t format,
185 int32_t *ret_stat);
187int32_t ad9467_coarse_lvds_adj(struct ad9467_dev *dev,
188 int32_t lvds_adj,
189 int32_t *ret_stat);
191int32_t ad9467_output_current_adj(struct ad9467_dev *dev,
192 int32_t adj,
193 int32_t *ret_stat);
195int32_t ad9467_dco_clock_invert(struct ad9467_dev *dev,
196 int32_t invert,
197 int32_t *ret_stat);
199int32_t ad9467_dco_output_clock_delay(struct ad9467_dev *dev,
200 int32_t delay,
201 int32_t *ret_stat);
203int32_t ad9467_full_scale_range(struct ad9467_dev *dev,
204 float v_fs,
205 float *ret_stat);
207int32_t ad9467_analog_input_coupling(struct ad9467_dev *dev,
208 int32_t coupling_mode,
209 int32_t *ret_stat);
211int32_t ad9467_buffer_current_1(struct ad9467_dev *dev,
212 int32_t percentage,
213 int32_t *ret_stat);
215int32_t ad9467_buffer_current_2(struct ad9467_dev *dev,
216 int32_t percentage,
217 int32_t *ret_stat);
219int32_t ad9467_transfer(struct ad9467_dev *dev);
220
221#endif /* __AD9467_H__ */
struct ad7616_init_param init_param
Definition ad7616_sdz.c:107
int32_t ad9467_analog_input_disconnect(struct ad9467_dev *dev, int32_t en, int32_t *ret_stat)
Disconnects (1) or connects (0) the analog input from or to the the ADC channel.
Definition ad9467.c:394
int32_t ad9467_remove(struct ad9467_dev *dev)
Free the resources allocated by ad9467_setup().
Definition ad9467.c:85
int32_t ad9467_read(struct ad9467_dev *dev, uint16_t reg_addr, uint8_t *reg_val)
Reads data from a register.
Definition ad9467.c:132
int32_t ad9467_test_mode(struct ad9467_dev *dev, int32_t mode, int32_t *ret_mode)
Sets the ADC's test mode.
Definition ad9467.c:238
int32_t ad9467_external_ref(struct ad9467_dev *dev, int32_t en, int32_t *ret_stat)
Enables (1) or disables (0) the external voltage reference.
Definition ad9467.c:355
int32_t ad9467_full_scale_range(struct ad9467_dev *dev, float v_fs, float *ret_stat)
Configures the full-scale input voltage selection.
Definition ad9467.c:749
int32_t ad9467_output_disable(struct ad9467_dev *dev, int32_t en, int32_t *ret_stat)
Disables (1) or enables (0) the data output.
Definition ad9467.c:462
int32_t ad9467_coarse_lvds_adj(struct ad9467_dev *dev, int32_t lvds_adj, int32_t *ret_stat)
Determines LVDS output properties.
Definition ad9467.c:578
int32_t ad9467_buffer_current_1(struct ad9467_dev *dev, int32_t percentage, int32_t *ret_stat)
Changes the input buffer current(1).
Definition ad9467.c:847
int32_t ad9467_dco_output_clock_delay(struct ad9467_dev *dev, int32_t delay, int32_t *ret_stat)
Configures the clock delay setting.
Definition ad9467.c:696
int32_t ad9467_output_invert(struct ad9467_dev *dev, int32_t invert, int32_t *ret_stat)
Activates the inverted (1) or normal (0) output mode.
Definition ad9467.c:500
int32_t ad9467_pwr_mode(struct ad9467_dev *dev, int32_t mode, int32_t *ret_mode)
Configures the power mode.
Definition ad9467.c:194
int32_t ad9467_output_current_adj(struct ad9467_dev *dev, int32_t adj, int32_t *ret_stat)
Sets the output current adjustment.
Definition ad9467.c:621
int32_t ad9467_analog_input_coupling(struct ad9467_dev *dev, int32_t coupling_mode, int32_t *ret_stat)
Sets the AC coupling(0) or DC coupling(1) mode.
Definition ad9467.c:797
int32_t ad9467_output_format(struct ad9467_dev *dev, int32_t format, int32_t *ret_stat)
Specifies the output format.
Definition ad9467.c:540
int32_t ad9467_write(struct ad9467_dev *dev, uint16_t reg_addr, uint8_t reg_val)
Writes data into a register.
Definition ad9467.c:105
int32_t ad9467_reset_pn23(struct ad9467_dev *dev, int32_t rst, int32_t *ret_stat)
Sets (1) or clears (0) the reset long PN sequence bit(PN23).
Definition ad9467.c:316
uint32_t ad9467_set_bits_to_reg(struct ad9467_dev *dev, uint16_t register_address, uint8_t bits_value, uint8_t mask)
Sets a bit or a group of bits inside a register without modifying the other bits.
Definition ad9467.c:163
int32_t ad9467_buffer_current_2(struct ad9467_dev *dev, int32_t percentage, int32_t *ret_stat)
Changes the input buffer current(2).
Definition ad9467.c:900
int32_t ad9467_dco_clock_invert(struct ad9467_dev *dev, int32_t invert, int32_t *ret_stat)
Activates the normal (0) or inverted (1) DCO clock.
Definition ad9467.c:659
int32_t ad9467_reset_pn9(struct ad9467_dev *dev, int32_t rst, int32_t *ret_stat)
Sets (1) or clears (0) the reset short PN sequence bit(PN9).
Definition ad9467.c:277
int32_t ad9467_setup(struct ad9467_dev **device, struct ad9467_init_param init_param)
Configures the test mode and the output mode to a default state.
Definition ad9467.c:47
int32_t ad9467_offset_adj(struct ad9467_dev *dev, int32_t adj, int32_t *ret_stat)
Sets the offset adjustment.
Definition ad9467.c:430
int32_t ad9467_transfer(struct ad9467_dev *dev)
Initiates a transfer and waits for the operation to end.
Definition ad9467.c:937
Header file of SPI Interface.
Definition ad9467.h:116
struct no_os_spi_desc * spi_desc
Definition ad9467.h:118
Definition ad9467.h:121
struct no_os_spi_init_param spi_init
Definition ad9467.h:123
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