no-OS
ad9467.h
Go to the documentation of this file.
1 /***************************************************************************/
39 #ifndef __AD9467_H__
40 #define __AD9467_H__
41 
42 /******************************************************************************/
43 /***************************** Include Files **********************************/
44 /******************************************************************************/
45 #include <stdint.h>
46 #include "no_os_spi.h"
47 
48 /******************************************************************************/
49 /*********************************** AD9467 ***********************************/
50 /******************************************************************************/
51 #define AD9467_READ (1 << 15)
52 #define AD9467_WRITE (0 << 15)
53 #define AD9467_CNT(x) (((x) - 1) << 13)
54 #define AD9467_ADDR(x) ((x) & 0X1FFF)
55 
56 /* Chip configuration registers */
57 #define AD9467_REG_CHIP_PORT_CFG 0x00
58 #define AD9467_REG_CHIP_ID 0x01
59 #define AD9467_REG_CHIP_GRADE 0x02
60 
61 /* Channel index and transfer registers */
62 #define AD9467_REG_DEVICE_UPDATE 0xFF
63 
64 /* ADC functions registers */
65 #define AD9467_REG_MODES 0x08
66 #define AD9467_REG_TEST_IO 0x0D
67 #define AD9467_REG_ADC_INPUT 0x0F
68 #define AD9467_REG_OFFSET 0x10
69 #define AD9467_REG_OUT_MODE 0x14
70 #define AD9467_REG_OUT_ADJ 0x15
71 #define AD9467_REG_OUT_PHASE 0x16
72 #define AD9467_REG_OUT_DELAY 0x17
73 #define AD9467_REG_V_REF 0x18
74 #define AD9467_REG_ANALOG_INPUT 0x2C
75 #define AD9467_REG_BUFF_CURRENT_1 0x36
76 #define AD9467_REG_BUFF_CURRENT_2 0x107
77 
78 /* AD9467_REG_CHIP_PORT_CFG */
79 #define AD9467_CHIP_PORT_CGF_LSB_FIRST (1 << 6)
80 #define AD9467_CHIP_PORT_CGF_SOFT_RST (1 << 5)
81 
82 /* AD9467_REG_CHIP_GRADE */
83 #define AD9467_CHIP_GRADE_BITS(x) (((x) & 0x3) << 4)
84 
85 /* AD9467_REG_DEVICE_UPDATE */
86 #define AD9467_DEVICE_UPDATE_SW (1 << 0)
87 
88 /* AD9467_REG_MODES */
89 #define AD9467_MODES_INT_PD_MODE(x) (((x) & 0x3) << 0)
90 
91 /* AD9467_REG_TEST_IO */
92 #define AD9467_TEST_IO_RST_PN_LONG (1 << 5)
93 #define AD9467_TEST_IO_RST_PN_SHORT (1 << 4)
94 #define AD9467_TEST_IO_OUT_TEST(x) (((x) & 0xF) << 0)
95 
96 /* AD9467_REG_ADC_INPUT */
97 #define AD9467_ADC_INPUT_XVREF (1 << 7)
98 #define AD9467_ADC_INPUT_ANALOG_DSCN (1 << 2)
99 
100 /* AD9467_REG_OUT_MODE */
101 #define AD9467_OUT_MODE_DOUT_DISBL (1 << 4)
102 #define AD9467_OUT_MODE_OUT_INV (1 << 2)
103 #define AD9467_OUT_MODE_DATA_FORMAT(x) (((x) & 0x3) << 0)
104 
105 /* AD9467_REG_OUT_ADJ */
106 #define AD9467_OUT_ADJ_LVDS (1 << 3)
107 #define AD9467_OUT_ADJ_OUT_CURRENT(x) (((x) & 0x7) << 0)
108 
109 /* AD9467_REG_OUT_PHASE */
110 #define AD9467_OUT_PHASE_DCO_INV (1 << 7)
111 
112 /* AD9467_REG_OUT_DELAY */
113 #define AD9467_OUT_DELAY_DCO_DLY_EN (1 << 7)
114 #define AD9467_OUT_DELAY_OUT_DLY(x) (((x) & 0x1F) << 0)
115 
116 /* AD9467_REG_V_REF */
117 #define AD9467_V_REF_IN_FS_RANGE(x) (((x) & 0xF) << 0)
118 
119 /* AD9467_REG_ANALOG_INPUT */
120 #define AD9467_ANALOG_INPUT_COUPLING (1 << 2)
121 
122 /* AD9467_REG_BUFF_CURRENT_1 */
123 #define AD9467_BUFF_CURRENT_1(x) (((x) & 0x3F) << 2)
124 
125 /* AD9467_REG_BUFF_CURRENT_2 */
126 #define AD9467_BUFF_CURRENT_2(x) (((x) & 0x3F) << 2)
127 
128 /******************************************************************************/
129 /************************ Types Definitions ***********************************/
130 /******************************************************************************/
131 struct ad9467_dev {
132  /* SPI */
134 };
135 
137  /* SPI */
139 };
140 
141 /******************************************************************************/
142 /************************ Functions Declarations ******************************/
143 /******************************************************************************/
145 int32_t ad9467_setup(struct ad9467_dev **device,
148 int32_t ad9467_remove(struct ad9467_dev *dev);
150 int32_t ad9467_write(struct ad9467_dev *dev,
151  uint16_t reg_addr,
152  uint8_t reg_val);
156 int32_t ad9467_read(struct ad9467_dev *dev,
157  uint16_t reg_addr,
158  uint8_t *reg_val);
159 uint32_t ad9467_set_bits_to_reg(struct ad9467_dev *dev,
160  uint16_t register_address,
161  uint8_t bits_value,
162  uint8_t mask);
164 int32_t ad9467_pwr_mode(struct ad9467_dev *dev,
165  int32_t mode,
166  int32_t *ret_mode);
168 int32_t ad9467_test_mode(struct ad9467_dev *dev,
169  int32_t mode,
170  int32_t *ret_mode);
172 int32_t ad9467_reset_pn9(struct ad9467_dev *dev,
173  int32_t rst,
174  int32_t *ret_stat);
176 int32_t ad9467_reset_pn23(struct ad9467_dev *dev,
177  int32_t rst,
178  int32_t *ret_stat);
180 int32_t ad9467_external_ref(struct ad9467_dev *dev,
181  int32_t en,
182  int32_t *ret_stat);
185 int32_t ad9467_analog_input_disconnect(struct ad9467_dev *dev,
186  int32_t en,
187  int32_t *ret_stat);
189 int32_t ad9467_offset_adj(struct ad9467_dev *dev,
190  int32_t adj,
191  int32_t *ret_stat);
193 int32_t ad9467_output_disable(struct ad9467_dev *dev,
194  int32_t en,
195  int32_t *ret_stat);
197 int32_t ad9467_output_invert(struct ad9467_dev *dev,
198  int32_t invert,
199  int32_t *ret_stat);
201 int32_t ad9467_output_format(struct ad9467_dev *dev,
202  int32_t format,
203  int32_t *ret_stat);
205 int32_t ad9467_coarse_lvds_adj(struct ad9467_dev *dev,
206  int32_t lvds_adj,
207  int32_t *ret_stat);
209 int32_t ad9467_output_current_adj(struct ad9467_dev *dev,
210  int32_t adj,
211  int32_t *ret_stat);
213 int32_t ad9467_dco_clock_invert(struct ad9467_dev *dev,
214  int32_t invert,
215  int32_t *ret_stat);
217 int32_t ad9467_dco_output_clock_delay(struct ad9467_dev *dev,
218  int32_t delay,
219  int32_t *ret_stat);
221 int32_t ad9467_full_scale_range(struct ad9467_dev *dev,
222  float v_fs,
223  float *ret_stat);
225 int32_t ad9467_analog_input_coupling(struct ad9467_dev *dev,
226  int32_t coupling_mode,
227  int32_t *ret_stat);
229 int32_t ad9467_buffer_current_1(struct ad9467_dev *dev,
230  int32_t percentage,
231  int32_t *ret_stat);
233 int32_t ad9467_buffer_current_2(struct ad9467_dev *dev,
234  int32_t percentage,
235  int32_t *ret_stat);
237 int32_t ad9467_transfer(struct ad9467_dev *dev);
238 
239 #endif /* __AD9467_H__ */
ad9467_dev::spi_desc
no_os_spi_desc * spi_desc
Definition: ad9467.h:133
ad9467_reset_pn23
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:324
ad9467_remove
int32_t ad9467_remove(struct ad9467_dev *dev)
Free the resources allocated by ad9467_setup().
Definition: ad9467.c:93
ad9467_dco_output_clock_delay
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:704
AD9467_TEST_IO_OUT_TEST
#define AD9467_TEST_IO_OUT_TEST(x)
Definition: ad9467.h:94
AD9467_OUT_MODE_OUT_INV
#define AD9467_OUT_MODE_OUT_INV
Definition: ad9467.h:102
ad9467_buffer_current_1
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:855
ad9467_pwr_mode
int32_t ad9467_pwr_mode(struct ad9467_dev *dev, int32_t mode, int32_t *ret_mode)
Configures the power mode.
Definition: ad9467.c:202
AD9467_REG_OUT_MODE
#define AD9467_REG_OUT_MODE
Definition: ad9467.h:69
ad9467_test_mode
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:246
ad9467_write
int32_t ad9467_write(struct ad9467_dev *dev, uint16_t reg_addr, uint8_t reg_val)
Writes data into a register.
Definition: ad9467.c:113
no_os_spi_write_and_read
int32_t no_os_spi_write_and_read(struct no_os_spi_desc *desc, uint8_t *data, uint16_t bytes_number)
Write and read data to/from SPI.
Definition: no_os_spi.c:82
ad9467_pwr_mode
int32_t ad9467_pwr_mode(struct ad9467_dev *dev, int32_t mode, int32_t *ret_mode)
Configures the power mode.
Definition: ad9467.c:202
ad9467_analog_input_disconnect
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:402
no_os_spi.h
Header file of SPI Interface.
AD9467_REG_TEST_IO
#define AD9467_REG_TEST_IO
Definition: ad9467.h:66
ad9467_reset_pn9
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:285
AD9467_DEVICE_UPDATE_SW
#define AD9467_DEVICE_UPDATE_SW
Definition: ad9467.h:86
ad9467_remove
int32_t ad9467_remove(struct ad9467_dev *dev)
Free the resources allocated by ad9467_setup().
Definition: ad9467.c:93
ad9467_analog_input_disconnect
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:402
ad9467_init_param
Definition: ad9467.h:136
AD9467_ADC_INPUT_XVREF
#define AD9467_ADC_INPUT_XVREF
Definition: ad9467.h:97
ad9467_coarse_lvds_adj
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:586
ad9467_coarse_lvds_adj
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:586
device
Definition: ad9361_util.h:75
AD9467_REG_OUT_DELAY
#define AD9467_REG_OUT_DELAY
Definition: ad9467.h:72
ad9467_set_bits_to_reg
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:171
AD9467_OUT_ADJ_OUT_CURRENT
#define AD9467_OUT_ADJ_OUT_CURRENT(x)
Definition: ad9467.h:107
AD9467_OUT_DELAY_OUT_DLY
#define AD9467_OUT_DELAY_OUT_DLY(x)
Definition: ad9467.h:114
ad9467_buffer_current_1
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:855
ad9467_dco_clock_invert
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:667
ad9467_transfer
int32_t ad9467_transfer(struct ad9467_dev *dev)
Initiates a transfer and waits for the operation to end.
Definition: ad9467.c:945
AD9467_REG_V_REF
#define AD9467_REG_V_REF
Definition: ad9467.h:73
ad9467_transfer
int32_t ad9467_transfer(struct ad9467_dev *dev)
Initiates a transfer and waits for the operation to end.
Definition: ad9467.c:945
AD9467_REG_OUT_ADJ
#define AD9467_REG_OUT_ADJ
Definition: ad9467.h:70
ad9467_output_current_adj
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:629
ad9467_dev
Definition: ad9467.h:131
AD9467_REG_MODES
#define AD9467_REG_MODES
Definition: ad9467.h:65
AD9467_MODES_INT_PD_MODE
#define AD9467_MODES_INT_PD_MODE(x)
Definition: ad9467.h:89
ad9467_external_ref
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:363
AD9467_REG_OUT_PHASE
#define AD9467_REG_OUT_PHASE
Definition: ad9467.h:71
AD9467_REG_OFFSET
#define AD9467_REG_OFFSET
Definition: ad9467.h:68
ad9467_set_bits_to_reg
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:171
ad9467_init_param::spi_init
no_os_spi_init_param spi_init
Definition: ad9467.h:138
ad9467_external_ref
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:363
AD9467_REG_DEVICE_UPDATE
#define AD9467_REG_DEVICE_UPDATE
Definition: ad9467.h:62
ad9467_output_invert
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:508
ad9467_read
int32_t ad9467_read(struct ad9467_dev *dev, uint16_t reg_addr, uint8_t *reg_val)
Reads data from a register.
Definition: ad9467.c:140
ad9467_reset_pn9
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:285
AD9467_REG_ADC_INPUT
#define AD9467_REG_ADC_INPUT
Definition: ad9467.h:67
no_os_spi_desc
Structure holding SPI descriptor.
Definition: no_os_spi.h:132
ad9467_output_disable
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:470
AD9467_BUFF_CURRENT_1
#define AD9467_BUFF_CURRENT_1(x)
Definition: ad9467.h:123
ad9467_read
int32_t ad9467_read(struct ad9467_dev *dev, uint16_t reg_addr, uint8_t *reg_val)
Reads data from a register.
Definition: ad9467.c:140
AD9467_BUFF_CURRENT_2
#define AD9467_BUFF_CURRENT_2(x)
Definition: ad9467.h:126
ad9467_dco_output_clock_delay
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:704
ad9467_output_invert
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:508
AD9467_REG_ANALOG_INPUT
#define AD9467_REG_ANALOG_INPUT
Definition: ad9467.h:74
ad9467_test_mode
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:246
AD9467_TEST_IO_RST_PN_SHORT
#define AD9467_TEST_IO_RST_PN_SHORT
Definition: ad9467.h:93
AD9467_OUT_MODE_DOUT_DISBL
#define AD9467_OUT_MODE_DOUT_DISBL
Definition: ad9467.h:101
ad9467_output_disable
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:470
ad9467_buffer_current_2
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:908
ad9467_dco_clock_invert
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:667
AD9467_ANALOG_INPUT_COUPLING
#define AD9467_ANALOG_INPUT_COUPLING
Definition: ad9467.h:120
ad9467_full_scale_range
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:757
ad9467_buffer_current_2
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:908
ad9467_output_format
int32_t ad9467_output_format(struct ad9467_dev *dev, int32_t format, int32_t *ret_stat)
Specifies the output format.
Definition: ad9467.c:548
init_param
struct ad7616_init_param init_param
Definition: ad7616_sdz.c:96
AD9467_OUT_ADJ_LVDS
#define AD9467_OUT_ADJ_LVDS
Definition: ad9467.h:106
ad9467_full_scale_range
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:757
AD9467_REG_BUFF_CURRENT_1
#define AD9467_REG_BUFF_CURRENT_1
Definition: ad9467.h:75
ad9467.h
Header file of AD9467 Driver.
AD9467_ADC_INPUT_ANALOG_DSCN
#define AD9467_ADC_INPUT_ANALOG_DSCN
Definition: ad9467.h:98
ad9467_offset_adj
int32_t ad9467_offset_adj(struct ad9467_dev *dev, int32_t adj, int32_t *ret_stat)
Sets the offset adjustment.
Definition: ad9467.c:438
ad9467_output_current_adj
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:629
AD9467_OUT_DELAY_DCO_DLY_EN
#define AD9467_OUT_DELAY_DCO_DLY_EN
Definition: ad9467.h:113
AD9467_REG_BUFF_CURRENT_2
#define AD9467_REG_BUFF_CURRENT_2
Definition: ad9467.h:76
no_os_spi_remove
int32_t no_os_spi_remove(struct no_os_spi_desc *desc)
Free the resources allocated by no_os_spi_init().
Definition: no_os_spi.c:70
AD9467_READ
#define AD9467_READ
Definition: ad9467.h:51
ad9467_setup
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:55
AD9467_OUT_PHASE_DCO_INV
#define AD9467_OUT_PHASE_DCO_INV
Definition: ad9467.h:110
ad9467_analog_input_coupling
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:805
ad9467_write
int32_t ad9467_write(struct ad9467_dev *dev, uint16_t reg_addr, uint8_t reg_val)
Writes data into a register.
Definition: ad9467.c:113
no_os_spi_init
int32_t no_os_spi_init(struct no_os_spi_desc **desc, const struct no_os_spi_init_param *param)
Initialize the SPI communication peripheral.
Definition: no_os_spi.c:51
ad9467_reset_pn23
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:324
ad9467_output_format
int32_t ad9467_output_format(struct ad9467_dev *dev, int32_t format, int32_t *ret_stat)
Specifies the output format.
Definition: ad9467.c:548
AD9467_TEST_IO_RST_PN_LONG
#define AD9467_TEST_IO_RST_PN_LONG
Definition: ad9467.h:92
ad9467_setup
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:55
ad9467_offset_adj
int32_t ad9467_offset_adj(struct ad9467_dev *dev, int32_t adj, int32_t *ret_stat)
Sets the offset adjustment.
Definition: ad9467.c:438
AD9467_OUT_MODE_DATA_FORMAT
#define AD9467_OUT_MODE_DATA_FORMAT(x)
Definition: ad9467.h:103
AD9467_WRITE
#define AD9467_WRITE
Definition: ad9467.h:52
AD9467_V_REF_IN_FS_RANGE
#define AD9467_V_REF_IN_FS_RANGE(x)
Definition: ad9467.h:117
no_os_spi_init_param
Structure holding the parameters for SPI initialization.
Definition: no_os_spi.h:112
ad9467_analog_input_coupling
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:805