no-OS
ad9467.h
Go to the documentation of this file.
1 /***************************************************************************/
33 #ifndef __AD9467_H__
34 #define __AD9467_H__
35 
36 /******************************************************************************/
37 /***************************** Include Files **********************************/
38 /******************************************************************************/
39 #include <stdint.h>
40 #include "no_os_spi.h"
41 
42 /******************************************************************************/
43 /*********************************** AD9467 ***********************************/
44 /******************************************************************************/
45 #define AD9467_READ (1 << 15)
46 #define AD9467_WRITE (0 << 15)
47 #define AD9467_CNT(x) (((x) - 1) << 13)
48 #define AD9467_ADDR(x) ((x) & 0X1FFF)
49 
50 /* Chip configuration registers */
51 #define AD9467_REG_CHIP_PORT_CFG 0x00
52 #define AD9467_REG_CHIP_ID 0x01
53 #define AD9467_REG_CHIP_GRADE 0x02
54 
55 /* Channel index and transfer registers */
56 #define AD9467_REG_DEVICE_UPDATE 0xFF
57 
58 /* ADC functions registers */
59 #define AD9467_REG_MODES 0x08
60 #define AD9467_REG_TEST_IO 0x0D
61 #define AD9467_REG_ADC_INPUT 0x0F
62 #define AD9467_REG_OFFSET 0x10
63 #define AD9467_REG_OUT_MODE 0x14
64 #define AD9467_REG_OUT_ADJ 0x15
65 #define AD9467_REG_OUT_PHASE 0x16
66 #define AD9467_REG_OUT_DELAY 0x17
67 #define AD9467_REG_V_REF 0x18
68 #define AD9467_REG_ANALOG_INPUT 0x2C
69 #define AD9467_REG_BUFF_CURRENT_1 0x36
70 #define AD9467_REG_BUFF_CURRENT_2 0x107
71 
72 /* AD9467_REG_CHIP_PORT_CFG */
73 #define AD9467_CHIP_PORT_CGF_LSB_FIRST (1 << 6)
74 #define AD9467_CHIP_PORT_CGF_SOFT_RST (1 << 5)
75 
76 /* AD9467_REG_CHIP_GRADE */
77 #define AD9467_CHIP_GRADE_BITS(x) (((x) & 0x3) << 4)
78 
79 /* AD9467_REG_DEVICE_UPDATE */
80 #define AD9467_DEVICE_UPDATE_SW (1 << 0)
81 
82 /* AD9467_REG_MODES */
83 #define AD9467_MODES_INT_PD_MODE(x) (((x) & 0x3) << 0)
84 
85 /* AD9467_REG_TEST_IO */
86 #define AD9467_TEST_IO_RST_PN_LONG (1 << 5)
87 #define AD9467_TEST_IO_RST_PN_SHORT (1 << 4)
88 #define AD9467_TEST_IO_OUT_TEST(x) (((x) & 0xF) << 0)
89 
90 /* AD9467_REG_ADC_INPUT */
91 #define AD9467_ADC_INPUT_XVREF (1 << 7)
92 #define AD9467_ADC_INPUT_ANALOG_DSCN (1 << 2)
93 
94 /* AD9467_REG_OUT_MODE */
95 #define AD9467_OUT_MODE_DOUT_DISBL (1 << 4)
96 #define AD9467_OUT_MODE_OUT_INV (1 << 2)
97 #define AD9467_OUT_MODE_DATA_FORMAT(x) (((x) & 0x3) << 0)
98 
99 /* AD9467_REG_OUT_ADJ */
100 #define AD9467_OUT_ADJ_LVDS (1 << 3)
101 #define AD9467_OUT_ADJ_OUT_CURRENT(x) (((x) & 0x7) << 0)
102 
103 /* AD9467_REG_OUT_PHASE */
104 #define AD9467_OUT_PHASE_DCO_INV (1 << 7)
105 
106 /* AD9467_REG_OUT_DELAY */
107 #define AD9467_OUT_DELAY_DCO_DLY_EN (1 << 7)
108 #define AD9467_OUT_DELAY_OUT_DLY(x) (((x) & 0x1F) << 0)
109 
110 /* AD9467_REG_V_REF */
111 #define AD9467_V_REF_IN_FS_RANGE(x) (((x) & 0xF) << 0)
112 
113 /* AD9467_REG_ANALOG_INPUT */
114 #define AD9467_ANALOG_INPUT_COUPLING (1 << 2)
115 
116 /* AD9467_REG_BUFF_CURRENT_1 */
117 #define AD9467_BUFF_CURRENT_1(x) (((x) & 0x3F) << 2)
118 
119 /* AD9467_REG_BUFF_CURRENT_2 */
120 #define AD9467_BUFF_CURRENT_2(x) (((x) & 0x3F) << 2)
121 
122 /******************************************************************************/
123 /************************ Types Definitions ***********************************/
124 /******************************************************************************/
125 struct ad9467_dev {
126  /* SPI */
128 };
129 
131  /* SPI */
133 };
134 
135 /******************************************************************************/
136 /************************ Functions Declarations ******************************/
137 /******************************************************************************/
139 int32_t ad9467_setup(struct ad9467_dev **device,
142 int32_t ad9467_remove(struct ad9467_dev *dev);
144 int32_t ad9467_write(struct ad9467_dev *dev,
145  uint16_t reg_addr,
146  uint8_t reg_val);
148 int32_t ad9467_read(struct ad9467_dev *dev,
149  uint16_t reg_addr,
150  uint8_t *reg_val);
153 uint32_t ad9467_set_bits_to_reg(struct ad9467_dev *dev,
154  uint16_t register_address,
155  uint8_t bits_value,
156  uint8_t mask);
158 int32_t ad9467_pwr_mode(struct ad9467_dev *dev,
159  int32_t mode,
160  int32_t *ret_mode);
162 int32_t ad9467_test_mode(struct ad9467_dev *dev,
163  int32_t mode,
164  int32_t *ret_mode);
166 int32_t ad9467_reset_pn9(struct ad9467_dev *dev,
167  int32_t rst,
168  int32_t *ret_stat);
170 int32_t ad9467_reset_pn23(struct ad9467_dev *dev,
171  int32_t rst,
172  int32_t *ret_stat);
174 int32_t ad9467_external_ref(struct ad9467_dev *dev,
175  int32_t en,
176  int32_t *ret_stat);
179 int32_t ad9467_analog_input_disconnect(struct ad9467_dev *dev,
180  int32_t en,
181  int32_t *ret_stat);
183 int32_t ad9467_offset_adj(struct ad9467_dev *dev,
184  int32_t adj,
185  int32_t *ret_stat);
187 int32_t ad9467_output_disable(struct ad9467_dev *dev,
188  int32_t en,
189  int32_t *ret_stat);
191 int32_t ad9467_output_invert(struct ad9467_dev *dev,
192  int32_t invert,
193  int32_t *ret_stat);
195 int32_t ad9467_output_format(struct ad9467_dev *dev,
196  int32_t format,
197  int32_t *ret_stat);
199 int32_t ad9467_coarse_lvds_adj(struct ad9467_dev *dev,
200  int32_t lvds_adj,
201  int32_t *ret_stat);
203 int32_t ad9467_output_current_adj(struct ad9467_dev *dev,
204  int32_t adj,
205  int32_t *ret_stat);
207 int32_t ad9467_dco_clock_invert(struct ad9467_dev *dev,
208  int32_t invert,
209  int32_t *ret_stat);
211 int32_t ad9467_dco_output_clock_delay(struct ad9467_dev *dev,
212  int32_t delay,
213  int32_t *ret_stat);
215 int32_t ad9467_full_scale_range(struct ad9467_dev *dev,
216  float v_fs,
217  float *ret_stat);
219 int32_t ad9467_analog_input_coupling(struct ad9467_dev *dev,
220  int32_t coupling_mode,
221  int32_t *ret_stat);
223 int32_t ad9467_buffer_current_1(struct ad9467_dev *dev,
224  int32_t percentage,
225  int32_t *ret_stat);
227 int32_t ad9467_buffer_current_2(struct ad9467_dev *dev,
228  int32_t percentage,
229  int32_t *ret_stat);
231 int32_t ad9467_transfer(struct ad9467_dev *dev);
232 
233 #endif /* __AD9467_H__ */
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:319
ad9467_remove
int32_t ad9467_remove(struct ad9467_dev *dev)
Free the resources allocated by ad9467_setup().
Definition: ad9467.c:88
no_os_alloc.h
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:699
AD9467_TEST_IO_OUT_TEST
#define AD9467_TEST_IO_OUT_TEST(x)
Definition: ad9467.h:88
AD9467_OUT_MODE_OUT_INV
#define AD9467_OUT_MODE_OUT_INV
Definition: ad9467.h:96
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:850
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:197
AD9467_REG_OUT_MODE
#define AD9467_REG_OUT_MODE
Definition: ad9467.h:63
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:241
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:108
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:159
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:197
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:397
no_os_spi.h
Header file of SPI Interface.
AD9467_REG_TEST_IO
#define AD9467_REG_TEST_IO
Definition: ad9467.h:60
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:280
AD9467_DEVICE_UPDATE_SW
#define AD9467_DEVICE_UPDATE_SW
Definition: ad9467.h:80
ad9467_remove
int32_t ad9467_remove(struct ad9467_dev *dev)
Free the resources allocated by ad9467_setup().
Definition: ad9467.c:88
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:397
ad9467_init_param
Definition: ad9467.h:130
AD9467_ADC_INPUT_XVREF
#define AD9467_ADC_INPUT_XVREF
Definition: ad9467.h:91
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:581
no_os_spi_init_param::mode
enum no_os_spi_mode mode
Definition: no_os_spi.h:148
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:581
device
Definition: ad9361_util.h:69
AD9467_REG_OUT_DELAY
#define AD9467_REG_OUT_DELAY
Definition: ad9467.h:66
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:166
AD9467_OUT_ADJ_OUT_CURRENT
#define AD9467_OUT_ADJ_OUT_CURRENT(x)
Definition: ad9467.h:101
AD9467_OUT_DELAY_OUT_DLY
#define AD9467_OUT_DELAY_OUT_DLY(x)
Definition: ad9467.h:108
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:850
ad9467_dev::spi_desc
struct no_os_spi_desc * spi_desc
Definition: ad9467.h:127
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:662
ad9467_transfer
int32_t ad9467_transfer(struct ad9467_dev *dev)
Initiates a transfer and waits for the operation to end.
Definition: ad9467.c:940
AD9467_REG_V_REF
#define AD9467_REG_V_REF
Definition: ad9467.h:67
ad9467_transfer
int32_t ad9467_transfer(struct ad9467_dev *dev)
Initiates a transfer and waits for the operation to end.
Definition: ad9467.c:940
AD9467_REG_OUT_ADJ
#define AD9467_REG_OUT_ADJ
Definition: ad9467.h:64
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:624
ad9467_dev
Definition: ad9467.h:125
AD9467_REG_MODES
#define AD9467_REG_MODES
Definition: ad9467.h:59
AD9467_MODES_INT_PD_MODE
#define AD9467_MODES_INT_PD_MODE(x)
Definition: ad9467.h:83
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:358
AD9467_REG_OUT_PHASE
#define AD9467_REG_OUT_PHASE
Definition: ad9467.h:65
AD9467_REG_OFFSET
#define AD9467_REG_OFFSET
Definition: ad9467.h:62
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:166
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:358
AD9467_REG_DEVICE_UPDATE
#define AD9467_REG_DEVICE_UPDATE
Definition: ad9467.h:56
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:503
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:135
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:280
AD9467_REG_ADC_INPUT
#define AD9467_REG_ADC_INPUT
Definition: ad9467.h:61
no_os_spi_desc
Structure holding SPI descriptor.
Definition: no_os_spi.h:192
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:465
AD9467_BUFF_CURRENT_1
#define AD9467_BUFF_CURRENT_1(x)
Definition: ad9467.h:117
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:135
AD9467_BUFF_CURRENT_2
#define AD9467_BUFF_CURRENT_2(x)
Definition: ad9467.h:120
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:699
no_os_malloc
void * no_os_malloc(size_t size)
Allocate memory and return a pointer to it.
Definition: chibios_alloc.c:43
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:503
AD9467_REG_ANALOG_INPUT
#define AD9467_REG_ANALOG_INPUT
Definition: ad9467.h:68
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:241
AD9467_TEST_IO_RST_PN_SHORT
#define AD9467_TEST_IO_RST_PN_SHORT
Definition: ad9467.h:87
AD9467_OUT_MODE_DOUT_DISBL
#define AD9467_OUT_MODE_DOUT_DISBL
Definition: ad9467.h:95
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:465
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:903
no_os_free
void no_os_free(void *ptr)
Deallocate memory previously allocated by a call to no_os_calloc or no_os_malloc.
Definition: chibios_alloc.c:69
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:662
AD9467_ANALOG_INPUT_COUPLING
#define AD9467_ANALOG_INPUT_COUPLING
Definition: ad9467.h:114
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:752
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:903
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:543
init_param
struct ad7616_init_param init_param
Definition: ad7616_sdz.c:113
AD9467_OUT_ADJ_LVDS
#define AD9467_OUT_ADJ_LVDS
Definition: ad9467.h:100
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:752
AD9467_REG_BUFF_CURRENT_1
#define AD9467_REG_BUFF_CURRENT_1
Definition: ad9467.h:69
ad9467.h
Header file of AD9467 Driver.
AD9467_ADC_INPUT_ANALOG_DSCN
#define AD9467_ADC_INPUT_ANALOG_DSCN
Definition: ad9467.h:92
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:433
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:624
AD9467_OUT_DELAY_DCO_DLY_EN
#define AD9467_OUT_DELAY_DCO_DLY_EN
Definition: ad9467.h:107
AD9467_REG_BUFF_CURRENT_2
#define AD9467_REG_BUFF_CURRENT_2
Definition: ad9467.h:70
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:116
AD9467_READ
#define AD9467_READ
Definition: ad9467.h:45
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:50
AD9467_OUT_PHASE_DCO_INV
#define AD9467_OUT_PHASE_DCO_INV
Definition: ad9467.h:104
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:800
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:108
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:52
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:319
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:543
AD9467_TEST_IO_RST_PN_LONG
#define AD9467_TEST_IO_RST_PN_LONG
Definition: ad9467.h:86
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:50
ad9467_init_param::spi_init
struct no_os_spi_init_param spi_init
Definition: ad9467.h:132
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:433
AD9467_OUT_MODE_DATA_FORMAT
#define AD9467_OUT_MODE_DATA_FORMAT(x)
Definition: ad9467.h:97
AD9467_WRITE
#define AD9467_WRITE
Definition: ad9467.h:46
AD9467_V_REF_IN_FS_RANGE
#define AD9467_V_REF_IN_FS_RANGE(x)
Definition: ad9467.h:111
no_os_spi_init_param
Structure holding the parameters for SPI initialization.
Definition: no_os_spi.h:140
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:800