Go to the documentation of this file.
49 #define ADF4106_LE_OUT no_os_gpio_direction_output(dev->gpio_le, \
51 #define ADF4106_LE_LOW no_os_gpio_set_value(dev->gpio_le, \
53 #define ADF4106_LE_HIGH no_os_gpio_set_value(dev->gpio_le, \
56 #define ADF4106_CE_OUT no_os_gpio_direction_output(dev->gpio_ce, \
58 #define ADF4106_CE_LOW no_os_gpio_set_value(dev->gpio_ce, \
60 #define ADF4106_CE_HIGH no_os_gpio_set_value(dev->gpio_ce, \
63 #define ADF4106_LE2_OUT no_os_gpio_direction_output(dev->gpio_le2, \
65 #define ADF4106_LE2_LOW no_os_gpio_set_value(dev->gpio_le2, \
67 #define ADF4106_LE2_HIGH no_os_gpio_set_value(dev->gpio_le2, \
70 #define ADF4106_CE2_OUT no_os_gpio_direction_output(dev->gpio_ce2, \
72 #define ADF4106_CE2_LOW no_os_gpio_set_value(dev->gpio_ce2, \
74 #define ADF4106_CE2_HIGH no_os_gpio_set_value(dev->gpio_ce2, \
78 #define ADF4106_CTRL_MASK 0x3
80 #define ADF4106_CTRL_R_COUNTER 0
81 #define ADF4106_CTRL_N_COUNTER 1
82 #define ADF4106_CTRL_FUNCTION_LATCH 2
83 #define ADF4106_CTRL_INIT_LATCH 3
87 #define ADF4106_R_COUNTER_OFFSET 2
88 #define ADF4106_R_COUNTER_MASK 0x3FFFul
89 #define ADF4106_R_COUNTER(x) ((x) & ADF4106_R_COUNTER_MASK) \
90 << ADF4106_R_COUNTER_OFFSET
92 #define ADF4106_R_ABP_OFFSET 16
93 #define ADF4106_R_ABP_MASK 0x3
94 #define ADF4106_R_ABP(x) ((x) & ADF4106_R_ABP_MASK) \
95 << ADF4106_R_ABP_OFFSET
96 #define ADF4106_R_ABP_2_9NS 0
97 #define ADF4106_R_ABP_1_3NS 1
98 #define ADF4106_R_ABP_6_0NS 2
101 #define ADF4106_R_TMB_OFFSET 18
102 #define ADF4106_R_TMB_MASK 0x1
103 #define ADF4106_R_TMB(x) ((x) & ADF4106_R_TMB_MASK) \
104 << ADF4106_R_TMB_OFFSET
105 #define ADF4106_R_TMB_NORMAL 0
107 #define ADF4106_R_LDP_OFFSET 20
108 #define ADF4106_R_LDP_MASK 0x1
109 #define ADF4106_R_LDP(x) ((x) & ADF4106_R_LDP_MASK) \
110 << ADF4106_R_LDP_OFFSET
111 #define ADF4106_R_LDP_3 0
112 #define ADF4106_R_LDP_5 1
115 #define ADF4106_N_COUNTER_A_OFFSET 2
116 #define ADF4106_N_COUNTER_A_MASK 0x3F
117 #define ADF4106_N_COUNTER_A(x) ((x) & ADF4106_N_COUNTER_A_MASK) \
118 << ADF4106_N_COUNTER_A_OFFSET
119 #define ADF4106_N_COUNTER_B_OFFSET 8
120 #define ADF4106_N_COUNTER_B_MASK 0x1FFF
121 #define ADF4106_N_COUNTER_B(x) ((x) & ADF4106_N_COUNTER_B_MASK) \
122 << ADF4106_N_COUNTER_B_OFFSET
124 #define ADF4106_N_CP_OFFSET 21
125 #define ADF4106_N_CP_MASK 0x1
126 #define ADF4106_N_CP(x) ((x) & ADF4106_N_CP_MASK) \
127 << ADF4106_N_CP_OFFSET
128 #define ADF4106_N_CP_GAIN_1 0
129 #define ADF4106_N_CP_GAIN_2 1
133 #define ADF4106_CR_OFFSET 2
134 #define ADF4106_CR_MASK 0x1ul
135 #define ADF4106_CR(x) ((x) & ADF4106_CR_MASK) \
138 #define ADF4106_PD1_OFFSET 3
139 #define ADF4106_PD1_MASK 0x1
140 #define ADF4106_PD1(x) ((x) & ADF4106_PD1_MASK) \
141 << ADF4106_PD1_OFFSET
143 #define ADF4106_MUXOUT_OFFSET 4
144 #define ADF4106_MUXOUT_MASK 0x7
145 #define ADF4106_MUXOUT(x) ((x) & ADF4106_MUXOUT_MASK) \
146 << ADF4106_MUXOUT_OFFSET
148 #define ADF4106_PDPOL_OFFSET 7
149 #define ADF4106_PDPOL_MASK 0x1
150 #define ADF4106_PDPOL(x) ((x) & ADF4106_PDPOL_MASK) \
151 << ADF4106_PDPOL_OFFSET
153 #define ADF4106_CP_OFFSET 8
154 #define ADF4106_CP_MASK 0x1
155 #define ADF4106_CP(x) ((x) & ADF4106_CP_MASK) \
158 #define ADF4106_FASTLOCK_OFFSET 9
159 #define ADF4106_FASTLOCK_MASK 0x3
160 #define ADF4106_FASTLOCK(x) ((x) & ADF4106_FASTLOCK_MASK) \
161 << ADF4106_FASTLOCK_OFFSET
163 #define ADF4106_TCC_OFFSET 11
164 #define ADF4106_TCC_MASK 0xF
165 #define ADF4106_TCC(x) ((x) & ADF4106_TCC_MASK) \
166 << ADF4106_TCC_OFFSET
168 #define ADF4106_CS1_OFFSET 15
169 #define ADF4106_CS1_MASK 0x7
170 #define ADF4106_CS1(x) ((x) << ADF4106_CS1_OFFSET)
171 #define ADF4106_CS2_OFFSET 18
172 #define ADF4106_CS2_MASK 0x7
173 #define ADF4106_CS2(x) ((x) << ADF4106_CS2_OFFSET)
176 #define ADF4106_PD2_OFFSET 21
177 #define ADF4106_PD2_MASK 0x1
178 #define ADF4106_PD2(x) ((x) & ADF4106_PD2_MASK) \
179 << ADF4106_PD2_OFFSET
181 #define ADF4106_PS_OFFSET 22
182 #define ADF4106_PS_MASK 0x3
183 #define ADF4106_PS(x) ((x) & ADF4106_PS_MASK) \
187 #define ADF4106_CR_NORMAL 0
188 #define ADF4106_CR_RESET 1
190 #define ADF4106_PD1_NORMAL 0
191 #define ADF4106_PD1_POWER_DOWN 1
193 #define ADF4106_MUXOUT_3STATE 0
194 #define ADF4106_MUXOUT_DLOCK_DETECT 1
195 #define ADF4106_MUXOUT_NDIV_OUTPUT 2
196 #define ADF4106_MUXOUT_AVDD 3
197 #define ADF4106_MUXOUT_RDIV_OUTPUT 4
198 #define ADF4106_MUXOUT_NCH_OPENDRAIN 5
199 #define ADF4106_MUXOUT_SERIAL_OUTPUT 6
200 #define ADF4106_MUXOUT_DGND 7
202 #define ADF4106_PDPOL_NEGATIVE 0
203 #define ADF4106_PDPOL_POSITIVE 1
205 #define ADF4106_CP_NORMAL 0
206 #define ADF4106_CP_THREE_STATE 1
208 #define ADF4106_FASTLOCK_DISABLE 0
209 #define ADF4106_FASTLOCK_MODE1 1
210 #define ADF4106_FASTLOCK_MODE2 3
212 #define ADF4106_TCC_3 0
213 #define ADF4106_TCC_7 1
214 #define ADF4106_TCC_11 2
215 #define ADF4106_TCC_15 3
216 #define ADF4106_TCC_19 4
217 #define ADF4106_TCC_23 5
218 #define ADF4106_TCC_27 6
219 #define ADF4106_TCC_31 7
220 #define ADF4106_TCC_35 8
221 #define ADF4106_TCC_39 9
222 #define ADF4106_TCC_43 10
223 #define ADF4106_TCC_47 11
224 #define ADF4106_TCC_51 12
225 #define ADF4106_TCC_55 13
226 #define ADF4106_TCC_59 14
227 #define ADF4106_TCC_63 15
229 #define ADF4106_CS_0_62 0
230 #define ADF4106_CS_1_25 1
231 #define ADF4106_CS_1_87 2
232 #define ADF4106_CS_2_5 3
233 #define ADF4106_CS_3_12 4
234 #define ADF4106_CS_3_75 5
235 #define ADF4106_CS_4_37 6
236 #define ADF4106_CS_5_0 7
238 #define ADF4106_ASYNC_PWD 0
239 #define ADF4106_SYNC_PWD 1
241 #define ADF4106_PS_8_9 0
242 #define ADF4106_PS_16_17 1
243 #define ADF4106_PS_32_33 2
244 #define ADF4106_PS_64_65 3
247 #define ADF4106_PRESCALE(x) (8 << (x))
387 uint32_t latch_data);
402 #endif // __ADF4106_H__
#define ADF4106_N_CP(x)
Definition: adf4106.h:126
uint8_t test_mode_bits
Definition: adf4106.h:275
#define ADF4106_CE_HIGH
Definition: adf4106.h:60
Definition: adf4106.h:342
#define ADF4106_PS_OFFSET
Definition: adf4106.h:181
struct no_os_gpio_init_param gpio_le
Definition: adf4106.h:365
Header file of ADF4106 driver. This driver supporting the following devices : ADF4001,...
Structure holding the parameters for GPIO initialization.
Definition: no_os_gpio.h:79
struct no_os_gpio_init_param gpio_le2
Definition: adf4106.h:367
uint8_t timer_counter_control
Definition: adf4106.h:305
#define ADF4106_CS1(x)
Definition: adf4106.h:170
#define ADF4106_R_TMB(x)
Definition: adf4106.h:103
uint32_t pfd_max
Definition: adf4106.h:265
struct no_os_spi_desc * spi_desc
Definition: adf4106.h:344
#define ADF4106_CS2(x)
Definition: adf4106.h:173
struct no_os_gpio_init_param gpio_ce2
Definition: adf4106.h:368
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
@ ID_ADF4106
Definition: adf4106.h:325
#define ADF4106_CTRL_N_COUNTER
Definition: adf4106.h:81
#define ADF4106_CR(x)
Definition: adf4106.h:135
Header file of SPI Interface.
uint32_t ref_in
Definition: adf4106.h:262
uint64_t adf4106_set_frequency(struct adf4106_dev *dev, uint64_t frequency)
Sets the output frequency.
Definition: adf4106.c:413
struct no_os_gpio_desc * gpio_ce2
Definition: adf4106.h:349
#define ADF4106_CTRL_INIT_LATCH
Definition: adf4106.h:83
int32_t adf4106_remove(struct adf4106_dev *dev)
Free the resources allocated by adf4106_init().
Definition: adf4106.c:156
struct adf4106_settings_t adf4106_st
Definition: adf4106.h:352
int8_t adf4106_init(struct adf4106_dev **device, struct adf4106_init_param init_param)
Initialize SPI and Initial Values for ADF4106 Board.
Definition: adf4106.c:90
uint32_t r_latch
Definition: adf4106.h:355
const struct adf4106_chip_info chip_info[]
Definition: adf4106.c:56
#define FREQ_5_2_GHZ
Definition: adf4106.c:50
#define ADF4106_LE_LOW
Definition: adf4106.h:51
@ INIT_LATCH
Definition: adf4106.h:330
Header file of Delay functions.
uint32_t f_latch
Definition: adf4106.h:357
uint16_t adf4106_tune_rcounter(struct adf4106_dev *dev, uint16_t r_counter)
Increases the R counter value until the ADF4106_PDF_MAX_FREQ is greater than PFD frequency.
Definition: adf4106.c:392
#define ADF4106_PDPOL(x)
Definition: adf4106.h:150
struct no_os_gpio_desc * gpio_ce
Definition: adf4106.h:347
Definition: ad9361_util.h:69
int8_t adf4106_init(struct adf4106_dev **device, struct adf4106_init_param init_param)
Initialize SPI and Initial Values for ADF4106 Board.
Definition: adf4106.c:90
uint8_t fast_lock_mode
Definition: adf4106.h:301
uint8_t phase_detector_pol
Definition: adf4106.h:297
#define ADF4106_R_ABP(x)
Definition: adf4106.h:94
#define DATA_MASK_MID8
Definition: adf4106.c:43
#define ADF4106_CTRL_MASK
Definition: adf4106.h:78
uint64_t adf4106_set_frequency(struct adf4106_dev *dev, uint64_t frequency)
Sets the output frequency.
Definition: adf4106.c:413
#define ADF4106_R_COUNTER_MASK
Definition: adf4106.h:88
#define ADF4106_CTRL_FUNCTION_LATCH
Definition: adf4106.h:82
struct adf4106_settings_t adf4106_st
Definition: adf4106.h:372
#define ADF4106_TCC(x)
Definition: adf4106.h:165
struct no_os_spi_init_param spi_init
Definition: adf4106.h:363
#define ADF4106_N_COUNTER_A(x)
Definition: adf4106.h:117
#define ADF4106_R_COUNTER(x)
Definition: adf4106.h:89
uint8_t lock_detect_precision
Definition: adf4106.h:279
void adf4106_init_counte_reset_method(struct adf4106_dev *dev)
Counter reset method.
Definition: adf4106.c:308
uint8_t a_n_counter
Definition: adf4106.h:283
#define ADF4106_CE_OUT
Definition: adf4106.h:56
void no_os_mdelay(uint32_t msecs)
Wait until msecs milliseconds passed.
Definition: aducm3029_delay.c:126
#define ADF4106_MUXOUT(x)
Definition: adf4106.h:145
uint8_t current_setting2
Definition: adf4106.h:313
#define ADF4106_R_LDP(x)
Definition: adf4106.h:109
uint32_t i_latch
Definition: adf4106.h:358
uint8_t anti_backlash_width
Definition: adf4106.h:273
@ ID_ADF4002
Definition: adf4106.h:324
#define ADF4106_PS(x)
Definition: adf4106.h:183
uint8_t power_down2
Definition: adf4106.h:315
void adf4106_init_cepin_method(struct adf4106_dev *dev)
CE Pin method.
Definition: adf4106.c:266
void adf4106_init_cepin_method(struct adf4106_dev *dev)
CE Pin method.
Definition: adf4106.c:266
uint64_t vco_max_frequency
Definition: adf4106.h:336
#define ADF4106_CR_RESET
Definition: adf4106.h:188
Definition: adf4106.h:335
adf4106_init_t
Definition: adf4106.h:329
#define ADF4106_PRESCALE(x)
Definition: adf4106.h:247
#define ADF4106_PS_32_33
Definition: adf4106.h:243
#define ADF4106_PS_16_17
Definition: adf4106.h:242
enum adf4106_type_t this_device
Definition: adf4106.h:370
#define DATA_OFFSET_LSB8
Definition: adf4106.c:46
@ INIT_COUNTER_RESET
Definition: adf4106.h:332
void adf4106_update_latch(struct adf4106_dev *dev, uint32_t latch_data)
Update one of the latch via the SPI interface.
Definition: adf4106.c:180
#define ADF4106_CTRL_R_COUNTER
Definition: adf4106.h:80
#define ADF4106_CE_LOW
Definition: adf4106.h:58
#define ADF4106_N_COUNTER_B_MASK
Definition: adf4106.h:120
enum adf4106_type_t this_device
Definition: adf4106.h:353
Definition: adf4106.h:361
int32_t no_os_gpio_remove(struct no_os_gpio_desc *desc)
Free the resources allocated by no_os_gpio_get().
Definition: no_os_gpio.c:104
Structure holding SPI descriptor.
Definition: no_os_spi.h:192
void adf4106_update_latch(struct adf4106_dev *dev, uint32_t latch_data)
Update one of the latch via the SPI interface.
Definition: adf4106.c:180
uint8_t power_down1
Definition: adf4106.h:293
struct adf4106_chip_info chip_info
Definition: adf4106.h:351
Structure holding the GPIO descriptor.
Definition: no_os_gpio.h:96
#define DATA_OFFSET_MSB8
Definition: adf4106.c:42
uint8_t cp_gain
Definition: adf4106.h:287
uint8_t counter_reset
Definition: adf4106.h:291
uint16_t ref_counter
Definition: adf4106.h:268
#define ADF4106_CR_NORMAL
Definition: adf4106.h:187
struct no_os_gpio_desc * gpio_le
Definition: adf4106.h:346
int32_t no_os_gpio_get(struct no_os_gpio_desc **desc, const struct no_os_gpio_init_param *param)
Obtain the GPIO decriptor.
Definition: no_os_gpio.c:49
void * no_os_malloc(size_t size)
Allocate memory and return a pointer to it.
Definition: chibios_alloc.c:43
#define ADF4106_FASTLOCK(x)
Definition: adf4106.h:160
@ ID_ADF4001
Definition: adf4106.h:323
#define ADF4106_CP(x)
Definition: adf4106.h:155
#define ADF4106_PD2(x)
Definition: adf4106.h:178
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
#define ADF4106_LE_OUT
Definition: adf4106.h:49
void adf4106_init_counte_reset_method(struct adf4106_dev *dev)
Counter reset method.
Definition: adf4106.c:308
uint32_t pfd_min_frequency
Definition: adf4106.h:339
#define DATA_MASK_LSB8
Definition: adf4106.c:45
#define ADF4106_N_COUNTER_B(x)
Definition: adf4106.h:121
#define ADF4106_PS_8_9
Definition: adf4106.h:241
struct ad7616_init_param init_param
Definition: ad7616_sdz.c:113
#define ADF4106_PD1(x)
Definition: adf4106.h:140
enum adf4106_init_t init_method
Definition: adf4106.h:371
uint16_t b_n_counter
Definition: adf4106.h:285
uint8_t cp_type
Definition: adf4106.h:299
uint32_t n_latch
Definition: adf4106.h:356
uint8_t prescaler_value
Definition: adf4106.h:317
#define ADF4106_N_COUNTER_A_MASK
Definition: adf4106.h:116
uint32_t adf4106_read_latch(struct adf4106_dev *dev, uint8_t latch_type)
Return the value of a desired latch.
Definition: adf4106.c:362
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
void adf4106_init_latch_method(struct adf4106_dev *dev)
Initialization latch method.
Definition: adf4106.c:224
Header file of GPIO Interface.
uint32_t adf4106_read_latch(struct adf4106_dev *dev, uint8_t latch_type)
Return the value of a desired latch.
Definition: adf4106.c:362
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
store the value of all the latch and the input reference frequency
Definition: adf4106.h:259
#define ADF4106_CR_MASK
Definition: adf4106.h:134
@ INIT_CEPIN
Definition: adf4106.h:331
struct no_os_gpio_desc * gpio_le2
Definition: adf4106.h:348
#define FREQ_2_4_GHZ
Definition: adf4106.c:49
struct no_os_gpio_init_param gpio_ce
Definition: adf4106.h:366
#define DATA_MASK_MSB8
Definition: adf4106.c:41
#define DATA_OFFSET_MID8
Definition: adf4106.c:44
uint32_t vco_min_frequency
Definition: adf4106.h:338
adf4106_type_t
Definition: adf4106.h:322
uint32_t pfd_max_frequency
Definition: adf4106.h:337
int32_t adf4106_remove(struct adf4106_dev *dev)
Free the resources allocated by adf4106_init().
Definition: adf4106.c:156
uint8_t muxout_control
Definition: adf4106.h:295
#define ADF4106_LE_HIGH
Definition: adf4106.h:53
void adf4106_init_latch_method(struct adf4106_dev *dev)
Initialization latch method.
Definition: adf4106.c:224
Structure holding the parameters for SPI initialization.
Definition: no_os_spi.h:140
uint8_t current_setting1
Definition: adf4106.h:309