no-OS
adf4368.h
Go to the documentation of this file.
1 /***************************************************************************/
34 #ifndef ADF4368_H_
35 #define ADF4368_H_
36 
37 #include <stdint.h>
38 #include <string.h>
39 #include "no_os_units.h"
40 #include "no_os_util.h"
41 #include "no_os_spi.h"
42 
43 /* ADF4368 REG0000 Map */
44 #define ADF4368_SOFT_RESET_R_MSK NO_OS_BIT(7)
45 #define ADF4368_LSB_FIRST_R_MSK NO_OS_BIT(6)
46 #define ADF4368_ADDRESS_ASC_R_MSK NO_OS_BIT(5)
47 #define ADF4368_SDO_ACTIVE_R_MSK NO_OS_BIT(4)
48 #define ADF4368_SDO_ACTIVE_MSK NO_OS_BIT(3)
49 #define ADF4368_ADDRESS_ASC_MSK NO_OS_BIT(2)
50 #define ADF4368_LSB_FIRST_MSK NO_OS_BIT(1)
51 #define ADF4368_SOFT_RESET_MSK NO_OS_BIT(0)
52 #define ADF4368_RESET_CMD 0x81
53 
54 /* ADF4368 REG0000 NO_OS_BIT Definition */
55 #define ADF4368_SDO_ACTIVE_SPI_3W 0x0
56 #define ADF4368_SDO_ACTIVE_SPI_4W 0x1
57 
58 #define ADF4368_ADDR_ASC_AUTO_DECR 0x0
59 #define ADF4368_ADDR_ASC_AUTO_INCR 0x1
60 
61 #define ADF4368_LSB_FIRST_MSB 0x0
62 #define ADF4368_LSB_FIRST_LSB 0x1
63 
64 #define ADF4368_SOFT_RESET_N_OP 0x0
65 #define ADF4368_SOFT_RESET_EN 0x1
66 
67 /* ADF4368 REG0001 NO_OS_BIT Definition */
68 #define ADF4368_SINGLE_INSTR_MSK NO_OS_BIT(7)
69 #define ADF4368_MASTER_RB_CTRL_MSK NO_OS_BIT(5)
70 
71 #define ADF4368_SPI_STREAM_EN 0x0
72 #define ADF4368_SPI_STREAM_DIS 0x1
73 
74 /* ADF4368 REG0003 NO_OS_BIT Definition */
75 #define ADF4368_CHIP_TYPE 0x06
76 
77 /* ADF4368 REG0004 NO_OS_BIT Definition */
78 #define ADF4368_PRODUCT_ID_LSB 0x0005
79 
80 /* ADF4368 REG0005 NO_OS_BIT Definition */
81 #define ADF4368_PRODUCT_ID_MSB 0x0005
82 
83 /* ADF4368 REG000A Map */
84 #define ADF4368_SCRATCHPAD_MSK NO_OS_GENMASK(7, 0)
85 
86 /* ADF4368 REG0010 Map*/
87 #define ADF4368_N_INT_LSB_MSK NO_OS_GENMASK(7, 0)
88 
89 /* ADF4368 REG0011 Map*/
90 #define ADF4368_CLKOUT_DIV_MSK NO_OS_GENMASK(7, 6)
91 #define ADF4368_INT_MODE_MSK NO_OS_BIT(5)
92 #define ADF4368_INV_CLK_OUT_MSK NO_OS_BIT(4)
93 #define ADF4368_N_INT_MSB_MSK NO_OS_GENMASK(3, 0)
94 
95 /* ADF4368 REG0012 Map */
96 #define ADF4368_FRAC1WORD_LSB_MSK NO_OS_GENMASK(7, 0)
97 
98 /* ADF4368 REG0013 Map */
99 #define ADF4368_FRAC1WORD_MID_MSK NO_OS_GENMASK(7, 0)
100 
101 /* ADF4368 REG0014 Map */
102 #define ADF4368_FRAC1WORD_MSB_MSK NO_OS_GENMASK(7, 0)
103 
104 
105 /* ADF4368 REG0015 Map */
106 #define ADF4368_M_VCO_CORE_MSK NO_OS_GENMASK(7, 6)
107 #define ADF4368_M_VCO_BIAS_MSK NO_OS_GENMASK(5, 2)
108 #define ADF4368_CMOS_OV_MSK NO_OS_BIT(1)
109 #define ADF4368_FRAC1WORD_MSB NO_OS_BIT(0)
110 
111 /* ADF4368 REG0016 Map */
112 #define ADF4368_M_VCO_BAND_MSK NO_OS_GENMASK(7, 0)
113 
114 /* ADF4368 REG0017 Map */
115 #define ADF4368_FRAC2WORD_LSB_MSK NO_OS_GENMASK(7, 0)
116 
117 /* ADF4368 REG0018 Map */
118 #define ADF4368_FRAC2WORD_MID_MSK NO_OS_GENMASK(7, 0)
119 
120 /* ADF4368 REG0019 Map */
121 #define ADF4368_FRAC2WORD_MSB_MSK NO_OS_GENMASK(7, 0)
122 
123 /* ADF4368 REG001A Map */
124 #define ADF4368_MOD2WORD_LSB_MSK NO_OS_GENMASK(7, 0)
125 
126 /* ADF4368 REG001B Map */
127 #define ADF4368_MOD2WORD_MID_MSK NO_OS_GENMASK(7, 0)
128 
129 /* ADF4368 REG001C Map */
130 #define ADF4368_MOD2WORD_MSB_MSK NO_OS_GENMASK(7, 0)
131 
132 /* ADF4368 REG001D Map */
133 #define ADF4368_FINE_BLEED_LSB_MSK NO_OS_GENMASK(7, 0)
134 
135 /* ADF4368 REG001E Map */
136 #define ADF4368_EN_PHASE_RESYNC_MSK NO_OS_BIT(7)
137 #define ADF4368_EN_REF_RST_MSK NO_OS_BIT(6)
138 #define ADF4368_TIMED_SYNC_MSK NO_OS_BIT(5)
139 #define ADF4368_COARSE_BLEED_MSK NO_OS_GENMASK(4, 1)
140 #define ADF4368_FINE_BLEED_MSB_MSK NO_OS_BIT(0)
141 
142 /* ADF4368 REG001F Map */
143 #define ADF4368_SW_SYNC_MSK NO_OS_BIT(7)
144 #define ADF4368_PHASE_ADJ_MSK NO_OS_BIT(6)
145 #define ADF4368_BLEED_POL_MSK NO_OS_BIT(5)
146 #define ADF4368_EN_BLEED_MSK NO_OS_BIT(4)
147 #define ADF4368_CP_I_MSK NO_OS_GENMASK(3, 0)
148 
149 /* ADF4368 REG0020 Map */
150 #define ADF4368_EN_AUTOCAL_MSK NO_OS_BIT(7)
151 #define ADF4368_EN_RDBLR_MSK NO_OS_BIT(6)
152 #define ADF4368_R_DIV_MSK NO_OS_GENMASK(5, 0)
153 
154 /* ADF4368 REG0021 Map */
155 #define ADF4368_PHASE_WORD_LSB_MSK NO_OS_GENMASK(7, 0)
156 
157 /* ADF4368 REG0022 Map */
158 #define ADF4368_PHASE_WORD_MID_MSK NO_OS_GENMASK(7, 0)
159 
160 /* ADF4368 REG0023 Map */
161 #define ADF4368_PHASE_WORD_MSB_MSK NO_OS_GENMASK(7, 0)
162 
163 /* ADF4368 REG0024 Map */
164 #define ADF4368_PHASE_ADJUSTMENT_MSK NO_OS_GENMASK(7, 0)
165 
166 /* ADF4368 REG0025 Map */
167 #define ADF4368_RESYNC_WAIT_LSB_MSK NO_OS_GENMASK(7, 0)
168 
169 /* ADF4368 REG0026 Map */
170 #define ADF4368_RESYNC_WAIT_MID_MSK NO_OS_GENMASK(7, 0)
171 
172 /* ADF4368 REG0027 Map */
173 #define ADF4368_RESYNC_WAIT_MSB_MSK NO_OS_GENMASK(7, 0)
174 
175 /* ADF4368 REG0028 Map */
176 #define ADF4368_REG28_RSV1 NO_OS_BIT(7)
177 #define ADF4368_LSB_P1 NO_OS_BIT(6)
178 #define ADF4368_VAR_MOD_EN_MSK NO_OS_BIT(5)
179 #define ADF4368_REG28_RSV2 NO_OS_GENMASK(4, 2)
180 #define ADF4368_REG28_RSV3 NO_OS_BIT(1)
181 #define ADF4368_REG28_RSV4 NO_OS_BIT(0)
182 
183 /* ADF4368 REG0029 Map */
184 #define ADF4368_CLK2_OPWR_MSK NO_OS_GENMASK(7, 4)
185 #define ADF4368_CLK1_OPWR_MSK NO_OS_GENMASK(3, 0)
186 
187 /* ADF4368 REG002A Map */
188 #define ADF4368_REG2A_RSV5 NO_OS_BIT(7)
189 #define ADF4368_ADJ_POL_MSK NO_OS_BIT(6)
190 #define ADF4368_REG2A_RSV4 NO_OS_BIT(5)
191 #define ADF4368_PD_SYNC NO_OS_BIT(4)
192 #define ADF4368_REG2A_RSV3 NO_OS_BIT(3)
193 #define ADF4368_PD_RDET NO_OS_BIT(2)
194 #define ADF4368_REG2A_RSV2 NO_OS_BIT(1)
195 #define ADF4368_REG2A_RSV1 NO_OS_BIT(0)
196 
197 
198 /* ADF4368 REG002B Map */
199 #define ADF4368_PD_ALL NO_OS_BIT(7)
200 #define ADF4368_REG2B_RSV4 NO_OS_BIT(6)
201 #define ADF4368_REG2B_RSV3 NO_OS_BIT(5)
202 #define ADF4368_REG2B_RSV2 NO_OS_BIT(4)
203 #define ADF4368_PD_LD NO_OS_BIT(3)
204 #define ADF4368_REG2B_RSV1 NO_OS_BIT(2)
205 #define ADF4368_PD_CLKOUT1_MSK NO_OS_BIT(1)
206 #define ADF4368_PD_CLKOUT2_MSK NO_OS_BIT(0)
207 
208 /* ADF4368 REG002C Map */
209 #define ADF4368_LDWIN_PW_MSK NO_OS_GENMASK(7, 5)
210 #define ADF4368_LD_COUNT_MSK NO_OS_GENMASK(4, 0)
211 
212 /* ADF4368 REG002D Map */
213 #define ADF4368_EN_DNCLK_MSK NO_OS_BIT(7)
214 #define ADF4368_EN_DRCLK_MSK NO_OS_BIT(6)
215 #define ADF4368_EN_LOL_MSK NO_OS_BIT(5)
216 #define ADF4368_EN_LDWIN_MSK NO_OS_BIT(4)
217 #define ADF4368_REG2D_RSV2 NO_OS_BIT(3)
218 #define ADF4368_RST_LD_MSK NO_OS_BIT(2)
219 #define ADF4368_REG2D_RSV1 NO_OS_GENMASK(1, 0)
220 
221 /* ADF4368 REG002E Map */
222 #define ADF4368_MUXOUT_MSK NO_OS_GENMASK(7, 4)
223 #define ADF4368_REG2E_RSV1 NO_OS_BIT(3)
224 #define ADF4368_EN_CPTEST_MSK NO_OS_BIT(2)
225 #define ADF4368_CP_DOWN_MSK NO_OS_BIT(1)
226 #define ADF4368_CP_UP_MSK NO_OS_BIT(0)
227 
228 /* ADF4368 REG002F Map*/
229 #define ADF4368_BST_REF_MSK NO_OS_BIT(7)
230 #define ADF4368_FILT_REF_MSK NO_OS_BIT(6)
231 #define ADF4368_REF_SEL_MSK NO_OS_BIT(5)
232 #define ADF4368_REG2F_RSV2 NO_OS_BIT(5)
233 #define ADF4368_REG2F_RSV1 NO_OS_GENMASK(3, 0)
234 
235 /* ADF4368 REG0030 Map */
236 #define ADF4368_MUTE_NCLK_MSK NO_OS_BIT(7)
237 #define ADF4368_REG30_RSV3 NO_OS_BIT(6)
238 #define ADF4368_DRCLK_DEL_MSK NO_OS_GENMASK(5, 3)
239 #define ADF4368_DNCLK_DEL_MSK NO_OS_GENMASK(2, 0)
240 
241 /* ADF4368 REG0031 Map */
242 #define ADF4368_SYNC_DEL_MSK NO_OS_GENMASK(7, 5)
243 #define ADF4368_RST_SYS_MSK NO_OS_BIT(4)
244 #define ADF4368_EN_ADC_CLK_MSK NO_OS_BIT(3)
245 #define ADF4368_REG31_RSV3 NO_OS_BIT(2)
246 #define ADF4368_REG31_RSV2 NO_OS_BIT(1)
247 #define ADF4368_REG31_RSV1 NO_OS_BIT(0)
248 
249 /* ADF4368 REG0035 Map */
250 #define ADF4368_REG35_RSV4 NO_OS_BIT(7)
251 #define ADF4368_REG35_RSV3 NO_OS_GENMASK(6, 3)
252 #define ADF4368_DCLK_MODE_MSK NO_OS_BIT(2)
253 #define ADF4368_REG35_RSV2 NO_OS_BIT(1)
254 #define ADF4368_REG35_RSV1 NO_OS_BIT(0)
255 
256 /* ADF4368 REG0036 Map */
257 #define ADF4368_CLKODIV_DB_MSK NO_OS_BIT(7)
258 #define ADF4368_DCLK_DIV_DB_MSK NO_OS_BIT(6)
259 #define ADF4368_REG36_RSV3 NO_OS_BIT(5)
260 #define ADF4368_REG36_RSV2 NO_OS_BIT(4)
261 #define ADF4368_REG36_RSV1 NO_OS_GENMASK(3, 0)
262 
263 /* ADF4368 REG0037 Map */
264 #define ADF4368_VCO_BAND_DIV NO_OS_GENMASK(7, 0)
265 
266 /* ADF4368 REG0038 Map */
267 #define ADF4368_SYNTH_LOCK_TIMEOUT_LSB_MSK NO_OS_GENMASK(7, 0)
268 
269 /* ADF4368 REG0039 Map */
270 #define ADF4368_O_VCO_DB_MSK NO_OS_BIT(7)
271 #define ADF4368_SYNTH_LOCK_TIMEOUT_MSB_MSK NO_OS_GENMASK(6, 0)
272 
273 
274 /* ADF4368 REG003A Map */
275 #define ADF4368_VCO_ALC_TIMEOUT_LSB_MSK NO_OS_GENMASK(7, 0)
276 
277 /* ADF4368 REG003B Map */
278 #define ADF4368_DEL_CTRL_DB_MSK NO_OS_BIT(7)
279 #define ADF4368_VCO_ALC_TIMEOUT_MSB_MSK NO_OS_GENMASK(6, 0)
280 
281 /* ADF4368 REG003E Map */
282 #define ADF4368_ADC_CLK_DIV_MSK NO_OS_GENMASK(7, 0)
283 
284 /* ADF4368 REG003F Map */
285 #define ADF4368_EN_ADC_CNV_MSK NO_OS_BIT(7)
286 #define ADF4368_REG3F_RSV5 NO_OS_BIT(6)
287 #define ADF4368_REG3F_RSV4 NO_OS_BIT(5)
288 #define ADF4368_REG3F_RSV3 NO_OS_BIT(4)
289 #define ADF4368_REG3F_RSV2 NO_OS_BIT(3)
290 #define ADF4368_REG3F_RSV1 NO_OS_BIT(2)
291 #define ADF4368_EN_ADC_MSK NO_OS_BIT(1)
292 #define ADF4368_ADC_A_CONV_MSK NO_OS_BIT(0)
293 
294 /* ADF4368 REG0040 Map */
295 #define ADF4368_REG40_RSV1 NO_OS_GENMASK(5, 3)
296 #define ADF4368_MUTE_CLKOUT2_MSK NO_OS_GENMASK(5, 3)
297 #define ADF4368_MUTE_CLKOUT1_MSK NO_OS_GENMASK(2, 0)
298 
299 /* ADF4368 REG0043 Map */
300 #define ADF4368_REG43_RSV5 NO_OS_BIT(7)
301 #define ADF4368_ADC_CLK_SEL_MSK NO_OS_BIT(6)
302 #define ADF4368_REG43_RSV4 NO_OS_BIT(5)
303 #define ADF4368_REG43_RSV3 NO_OS_BIT(4)
304 #define ADF4368_REG43_RSV2 NO_OS_BIT(3)
305 #define ADF4368_REG43_RSV1 NO_OS_GENMASK(2, 0)
306 
307 /* ADF4368 REG004E Map */
308 #define ADF4368_REG4E_RSV2 NO_OS_GENMASK(7, 6)
309 #define ADF4368_DCLK_DIV1_MSK NO_OS_GENMASK(5, 4)
310 #define ADF4368_O_VCO_BAND_MSK NO_OS_BIT(3)
311 #define ADF4368_O_VCO_CORE_MSK NO_OS_BIT(2)
312 #define ADF4368_O_VCO_BIAS_MSK NO_OS_BIT(1)
313 #define ADF4368_REG4E_RSV1 NO_OS_BIT(0)
314 
315 /* ADF4368 REG0053 Map */
316 #define ADF4368_REG53_RSV2 NO_OS_BIT(7)
317 #define ADF4368_PD_SYNC_MON_MSK NO_OS_BIT(6)
318 #define ADF4368_SYNC_SEL_MSK NO_OS_BIT(5)
319 #define ADF4368_RST_SYNC_MON_MSK NO_OS_BIT(4)
320 #define ADF4368_REG53_RSV1 NO_OS_GENMASK(3, 0)
321 
322 /* ADF4368 REG0054 Map */
323 #define ADF4368_REG54_RSV1 NO_OS_GENMASK(7, 1)
324 #define ADF4368_ADC_ST_CNV_MSK NO_OS_BIT(1)
325 
326 /* ADF4368 REG0058 Map */
327 #define ADF4368_EN_CLK2_MSK NO_OS_BIT(7)
328 #define ADF4368_EN_CLK1_MSK NO_OS_BIT(6)
329 #define ADF4368_SYNC_OK_MSK NO_OS_BIT(5)
330 #define ADF4368_REG58_RSV1 NO_OS_BIT(4)
331 #define ADF4368_REF_OK_MSK NO_OS_BIT(3)
332 #define ADF4368_ADC_BUSY_MSK NO_OS_BIT(2)
333 #define ADF4368_FSM_BUSY_MSK NO_OS_BIT(1)
334 #define ADF4368_LOCKED_MSK NO_OS_BIT(0)
335 
336 /* ADF4368 REG005A Map */
337 #define ADF4368_REG5A_RSV1 NO_OS_GENMASK(7, 2)
338 #define ADF4368_VCO_CORE_MSK NO_OS_GENMASK(1, 0)
339 
340 /* ADF4368 REG005B Map */
341 #define ADF4368_CHIP_TEMP_LSB_MSK NO_OS_GENMASK(7, 0)
342 
343 /* ADF4368 REG005C Map */
344 #define ADF4368_REG5C_RSV1 NO_OS_GENMASK(7, 1)
345 #define ADF4368_CHIP_TEMP_MSB_MSK NO_OS_BIT(0)
346 
347 /* ADF4368 REG005E Map */
348 #define ADF4368_VCO_BAND_MSK NO_OS_GENMASK(7, 0)
349 
350 /* ADF4368 REG0060 Map */
351 #define ADF4368_REG60_RSV1 NO_OS_GENMASK(7, 4)
352 #define ADF4368_VCO_BIAS_MSK NO_OS_GENMASK(3, 0)
353 
354 /* ADF4368 REG0063 Map */
355 #define ADF4368_VERSION_MSK NO_OS_GENMASK(7, 0)
356 
357 
358 
359 #define ADF4368_SPI_4W_CFG(x) (no_os_field_prep(ADF4368_SDO_ACTIVE_MSK, x) | \
360  no_os_field_prep(ADF4368_SDO_ACTIVE_R_MSK, x))
361 
362 #define ADF4368_SPI_LSB_CFG(x) (no_os_field_prep(ADF4368_LSB_FIRST_MSK, x) | \
363  no_os_field_prep(ADF4368_LSB_FIRST_R_MSK, x))
364 
365 #define ADF4368_BLEED_MSB_MSK (ADF4368_COARSE_BLEED_MSK | \
366  ADF4368_FINE_BLEED_MSB_MSK)
367 
368 #define ADF4368_SPI_SCRATCHPAD_TEST 0x5A
369 
370 /* Specifications */
371 #define ADF4368_SPI_WRITE_CMD 0x0
372 #define ADF4368_SPI_READ_CMD 0x8000
373 #define ADF4368_SPI_DUMMY_DATA 0x00
374 #define ADF4368_BUFF_SIZE_BYTES 3
375 #define ADF4368_VCO_FREQ_MIN 6400000000U // 6.4GHz
376 #define ADF4368_VCO_FREQ_MAX 12800000000U // 12.8GHz
377 #define ADF4368_MOD1WORD 0x2000000U // 2^25
378 #define ADF4368_MOD2WORD_MAX 0xFFFFFFU // 2^24 - 1
379 #define ADF4368_PHASE_RESYNC_MOD2WORD_MAX 0x1FFFFU // 2^17 - 1
380 #define ADF4368_CHANNEL_SPACING_MAX 78125U
381 #define ADF4368_PFD_FREQ_MAX 625000000U // 625MHz
382 #define ADF4368_PFD_FREQ_FRAC_MAX 250000000U // 250MHz
383 #define ADF4368_DCLK_DIV1_0_MAX 160000000U // 160MHz
384 #define ADF4368_DCLK_DIV1_1_MAX 320000000U // 320MHz
385 #define ADF4368_CLKOUT_DIV_REG_VAL_MAX 3
386 
387 #define ADF4368_RFOUT_MAX 12800000000U // 12.8GHz
388 #define ADF4368_RFOUT_MIN 800000000U // 0.8GHz
389 #define ADF4368_REF_CLK_MAX 4000000000U // 4GHz
390 #define ADF4368_REF_CLK_MIN 10000000 // 10MHz
391 #define ADF4368_REF_DIV_MAX 63
392 #define ADF4368_OUT_PWR_MAX 15
393 #define ADF4368_CPI_VAL_MAX 15
394 #define ADF4368_BLEED_WORD_MAX 8191
395 #define ADF4368_FRAC_N_INT_MIN 19
396 #define ADF4368_INT_N_INT_MIN 4
397 
398 #define ADF4368_PHASE_BLEED_CNST 2044000
399 #define ADF4368_BLEED_N_INT_TH 35
400 #define ADF4368_COARSE_BLEED_CNST 202 // 202ua
401 #define ADF4368_FINE_BLEED_CNST1 250 // 250ua
402 #define ADF4368_FINE_BLEED_CNST2 512 // 250ua
403 #define ADF4368_FINE_BLEED_CNST3 567 // 567na
404 
405 #define ADF4368_SIGMA_DELTA_MOD_CNST 4096 // 250ua
406 
407 #define ADF4368_POR_DELAY_US 200
408 #define ADF4368_LKD_DELAY_MS 9
409 
410 #define ADF4368_MHZ MEGA
411 #define ADF4368_S_TO_NS NANO
412 #define ADF4368_NS_TO_PS KHZ_PER_MHZ
413 #define ADF4368_PS_TO_NS KHZ_PER_MHZ
414 #define ADF4368_PS_TO_US MICRO
415 #define ADF4368_US_TO_MS MILLI
416 #define ADF4368_MS_TO_S MILLI
417 #define ADF4368_PS_TO_S PICO
418 #define ADF4368_US_TO_FS NANO
419 #define ADF4368_NS_TO_S NANO
420 
429  bool cmos_3v3;
431  uint8_t ref_div;
432  uint8_t cp_i;
433  uint8_t ld_count;
434  uint64_t ref_freq_hz;
435  uint64_t freq;
436 };
437 
442 struct adf4368_dev {
446  bool cmos_3v3;
447  bool phase_pol;
449  uint8_t ref_div;
450  uint8_t cp_i;
451  uint8_t ld_count;
453  uint16_t n_int;
454  int16_t bleed_word;
455  uint32_t phase_adj;
456  uint64_t vco_max;
457  uint64_t vco_min;
458  uint64_t freq_max;
459  uint64_t freq_min;
460  uint64_t ref_freq_hz;
461  uint64_t freq;
462 };
463 
465 int adf4368_spi_write(struct adf4368_dev *dev, uint16_t reg_addr, uint8_t data);
466 
468 int adf4368_spi_read(struct adf4368_dev *dev, uint16_t reg_addr, uint8_t *data);
469 
471 int adf4368_spi_update_bits(struct adf4368_dev *dev, uint16_t reg_addr,
472  uint8_t mask, uint8_t data);
473 
475 int adf4368_reg_dump(struct adf4368_dev *dev);
476 
478 int adf4368_set_out_power(struct adf4368_dev *dev, uint8_t ch, int32_t pwr);
479 
481 int adf4368_get_out_power(struct adf4368_dev *dev, uint8_t ch, int32_t *pwr);
482 
484 int adf4368_set_en_chan(struct adf4368_dev *dev, uint8_t ch, bool en);
485 
487 int adf4368_get_en_chan(struct adf4368_dev *dev, uint8_t ch, bool *en);
488 
490 int adf4368_set_ref_clk(struct adf4368_dev *dev, uint64_t val);
491 
493 int adf4368_get_ref_clk(struct adf4368_dev *dev, uint64_t *val);
494 
496 int adf4368_set_en_ref_doubler(struct adf4368_dev *dev, bool en);
497 
499 int adf4368_get_en_ref_doubler(struct adf4368_dev *dev, bool *en);
500 
502 int adf4368_set_ref_div(struct adf4368_dev *dev, int32_t div);
503 
505 int adf4368_get_ref_div(struct adf4368_dev *dev, int32_t *div);
506 
508 int adf4368_set_cp_i(struct adf4368_dev *dev, int32_t reg_val);
509 
511 int adf4368_get_cp_i(struct adf4368_dev *dev, int32_t *reg_val);
512 
514 int adf4368_set_bleed_word(struct adf4368_dev *dev, int32_t word);
515 
517 int adf4368_get_bleed_word(struct adf4368_dev *dev, int32_t *word);
518 
520 int adf4368_set_rfout(struct adf4368_dev *dev, uint64_t val);
521 
523 int adf4368_get_rfout(struct adf4368_dev *dev, uint64_t *val);
524 
526 int adf4368_set_sync_setup(struct adf4368_dev *dev, bool en);
527 
529 int adf4368_get_sync_setup(struct adf4368_dev *dev, bool *en);
530 
532 int adf4368_set_sw_sync(struct adf4368_dev *dev, uint8_t sw_sync);
533 
535 int adf4368_get_sw_sync(struct adf4368_dev *dev, uint8_t *sw_sync);
536 
538 int adf4368_set_temperature(struct adf4368_dev *dev, bool en);
539 
541 int adf4368_get_temperature(struct adf4368_dev *dev, int32_t *temp);
542 
544 int adf4368_set_phase_sdm(struct adf4368_dev *dev, uint32_t phase_fs);
545 
547 int adf4368_get_phase_sdm(struct adf4368_dev *dev, uint32_t *phase_fs);
548 
550 int adf4368_set_phase_bleedi(struct adf4368_dev *dev, uint32_t phase_fs,
551  bool phase_pol);
552 
554 int adf4368_set_phase(struct adf4368_dev *dev, uint32_t phase_fs,
555  bool phase_pol);
556 
558 int adf4368_get_phase(struct adf4368_dev *dev, uint32_t *phase_fs,
559  bool *phase_pol);
560 
562 int adf4368_set_default_regs(struct adf4368_dev *dev, bool spi_4wire);
563 
565 int adf4368_get_default_regs(struct adf4368_dev *dev, bool *spi_4wire);
566 
568 int adf4368_set_freq(struct adf4368_dev *dev);
569 
571 int adf4368_init(struct adf4368_dev **device,
573 
575 int adf4368_remove(struct adf4368_dev *dev);
576 
577 
578 
579 #endif /* ADF4368_H_ */
KILO
#define KILO
Definition: no_os_units.h:43
ADF4368_REF_DIV_MAX
#define ADF4368_REF_DIV_MAX
Definition: adf4368.h:391
adf4368_dev::vco_min
uint64_t vco_min
Definition: adf4368.h:457
adf4368_dev::ref_div
uint8_t ref_div
Definition: adf4368.h:449
adf4368_get_ref_clk
int adf4368_get_ref_clk(struct adf4368_dev *dev, uint64_t *val)
Gets the user proposed reference frequency.
Definition: adf4368.c:716
ADF4368_NS_TO_PS
#define ADF4368_NS_TO_PS
Definition: adf4368.h:412
no_os_alloc.h
false
@ false
Definition: ad5446.h:56
ADF4368_ADC_CLK_DIV_MSK
#define ADF4368_ADC_CLK_DIV_MSK
Definition: adf4368.h:282
ADF4368_MOD1WORD
#define ADF4368_MOD1WORD
Definition: adf4368.h:377
adf4368_init
int adf4368_init(struct adf4368_dev **device, struct adf4368_init_param *init_param)
Initializes the adf4368.
Definition: adf4368.c:1893
ADF4368_DCLK_DIV1_1_MAX
#define ADF4368_DCLK_DIV1_1_MAX
Definition: adf4368.h:384
ADF4368_FRAC1WORD_MSB
#define ADF4368_FRAC1WORD_MSB
Definition: adf4368.h:109
adf4368_set_freq
int adf4368_set_freq(struct adf4368_dev *dev)
Set the output frequency.
Definition: adf4368.c:1632
adf4368_get_cp_i
int adf4368_get_cp_i(struct adf4368_dev *dev, int32_t *reg_val)
Gets the charge pump value from the register. The value will be between 0 and 15 on 8 bits....
Definition: adf4368.c:880
adf4368_set_freq
int adf4368_set_freq(struct adf4368_dev *dev)
Set the output frequency.
Definition: adf4368.c:1632
ADF4368_CPI_VAL_MAX
#define ADF4368_CPI_VAL_MAX
Definition: adf4368.h:393
adf4368_set_en_chan
int adf4368_set_en_chan(struct adf4368_dev *dev, uint8_t ch, bool en)
Set the output channel to enable or disable based on the passed parameter. If the parameter is differ...
Definition: adf4368.c:637
ADF4368_EN_RDBLR_MSK
#define ADF4368_EN_RDBLR_MSK
Definition: adf4368.h:151
adf4368_set_sw_sync
int adf4368_set_sw_sync(struct adf4368_dev *dev, uint8_t sw_sync)
Set Software SYNC Request. Setting SW_SYNC resets the RF block. Clearing SW_SYNC makes ready for a ne...
Definition: adf4368.c:1214
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
ADF4368_INT_MODE_MSK
#define ADF4368_INT_MODE_MSK
Definition: adf4368.h:91
adf4368_set_out_power
int adf4368_set_out_power(struct adf4368_dev *dev, uint8_t ch, int32_t pwr)
Set the output power register value of a channel and reset everything over to maximum supported value...
Definition: adf4368.c:580
ADF4368_N_INT_LSB_MSK
#define ADF4368_N_INT_LSB_MSK
Definition: adf4368.h:87
ADF4368_LKD_DELAY_MS
#define ADF4368_LKD_DELAY_MS
Definition: adf4368.h:408
ADF4368_PHASE_ADJ_MSK
#define ADF4368_PHASE_ADJ_MSK
Definition: adf4368.h:144
adf4368_set_temperature
int adf4368_set_temperature(struct adf4368_dev *dev, bool en)
Set Temperature Readback feature's initial state. This feature should be disabled after reading tempe...
Definition: adf4368.c:1254
adf4368_set_sync_setup
int adf4368_set_sync_setup(struct adf4368_dev *dev, bool en)
Set EZSYNC and Timed SYNC features' initial state. Waits for SW_SYNC toggle or SYNC pin.
Definition: adf4368.c:1118
adf4368_dev::clkout_div_reg_val_max
uint8_t clkout_div_reg_val_max
Definition: adf4368.h:452
no_os_spi.h
Header file of SPI Interface.
ADF4368_EN_ADC_CLK_MSK
#define ADF4368_EN_ADC_CLK_MSK
Definition: adf4368.h:244
adf4368_get_cp_i
int adf4368_get_cp_i(struct adf4368_dev *dev, int32_t *reg_val)
Gets the charge pump value from the register. The value will be between 0 and 15 on 8 bits....
Definition: adf4368.c:880
ADF4368_SPI_LSB_CFG
#define ADF4368_SPI_LSB_CFG(x)
Definition: adf4368.h:362
adf4368_set_default_regs
int adf4368_set_default_regs(struct adf4368_dev *dev, bool spi_4wire)
Applys a softreset, sets the SPI 4 wire mode and writes the default registers.
Definition: adf4368.c:1563
no_os_units.h
Header file of Units.
pr_err
#define pr_err(fmt, args...)
Definition: no_os_print_log.h:88
ADF4368_EN_BLEED_MSK
#define ADF4368_EN_BLEED_MSK
Definition: adf4368.h:146
ADF4368_CLKOUT_DIV_MSK
#define ADF4368_CLKOUT_DIV_MSK
Definition: adf4368.h:90
ADF4368_EN_PHASE_RESYNC_MSK
#define ADF4368_EN_PHASE_RESYNC_MSK
Definition: adf4368.h:136
ADF4368_N_INT_MSB_MSK
#define ADF4368_N_INT_MSB_MSK
Definition: adf4368.h:93
ADF4368_US_TO_FS
#define ADF4368_US_TO_FS
Definition: adf4368.h:418
ADF4368_PS_TO_S
#define ADF4368_PS_TO_S
Definition: adf4368.h:417
no_os_delay.h
Header file of Delay functions.
adf4368_dev::ref_doubler_en
bool ref_doubler_en
Definition: adf4368.h:448
adf4368_set_out_power
int adf4368_set_out_power(struct adf4368_dev *dev, uint8_t ch, int32_t pwr)
Set the output power register value of a channel and reset everything over to maximum supported value...
Definition: adf4368.c:580
pr_info
#define pr_info(fmt, args...)
Definition: no_os_print_log.h:115
ADF4368_CLK2_OPWR_MSK
#define ADF4368_CLK2_OPWR_MSK
Definition: adf4368.h:184
adf4368_get_sw_sync
int adf4368_get_sw_sync(struct adf4368_dev *dev, uint8_t *sw_sync)
Gets the value of the SW_SYNC bit.
Definition: adf4368.c:1231
ADF4368_PHASE_RESYNC_MOD2WORD_MAX
#define ADF4368_PHASE_RESYNC_MOD2WORD_MAX
Definition: adf4368.h:379
NO_OS_DIV_ROUND_CLOSEST_ULL
#define NO_OS_DIV_ROUND_CLOSEST_ULL(x, y)
Definition: no_os_util.h:56
adf4368_get_rfout
int adf4368_get_rfout(struct adf4368_dev *dev, uint64_t *val)
Gets the user proposed output frequency.
Definition: adf4368.c:1017
adf4368_spi_update_bits
int adf4368_spi_update_bits(struct adf4368_dev *dev, uint16_t reg_addr, uint8_t mask, uint8_t data)
Updates the values of the ADF4368 register.
Definition: adf4368.c:223
ADF4368_CHIP_TEMP_MSB_MSK
#define ADF4368_CHIP_TEMP_MSB_MSK
Definition: adf4368.h:345
MICROAMPER_PER_AMPER
#define MICROAMPER_PER_AMPER
Definition: no_os_units.h:64
device
Definition: ad9361_util.h:69
adf4368_init_param::cmos_3v3
bool cmos_3v3
Definition: adf4368.h:429
no_os_print_log.h
Print messages helpers.
ADF4368_VCO_FREQ_MIN
#define ADF4368_VCO_FREQ_MIN
Definition: adf4368.h:375
ADF4368_DNCLK_DEL_MSK
#define ADF4368_DNCLK_DEL_MSK
Definition: adf4368.h:239
no_os_div64_u64_rem
uint64_t no_os_div64_u64_rem(uint64_t dividend, uint64_t divisor, uint64_t *remainder)
adf4368_set_sw_sync
int adf4368_set_sw_sync(struct adf4368_dev *dev, uint8_t sw_sync)
Set Software SYNC Request. Setting SW_SYNC resets the RF block. Clearing SW_SYNC makes ready for a ne...
Definition: adf4368.c:1214
adf4368_dev::freq
uint64_t freq
Definition: adf4368.h:461
adf4368_set_phase_sdm
int adf4368_set_phase_sdm(struct adf4368_dev *dev, uint32_t phase_fs)
Set the phase adjustment in femto-seconds with Sigma Delta Modulation. This approach only support MAX...
Definition: adf4368.c:1327
adf4368_spi_write
int adf4368_spi_write(struct adf4368_dev *dev, uint16_t reg_addr, uint8_t data)
Writes data to ADF4368 over SPI.
Definition: adf4368.c:152
adf4368_set_phase_sdm
int adf4368_set_phase_sdm(struct adf4368_dev *dev, uint32_t phase_fs)
Set the phase adjustment in femto-seconds with Sigma Delta Modulation. This approach only support MAX...
Definition: adf4368.c:1327
no_os_calloc
void * no_os_calloc(size_t nitems, size_t size)
Allocate memory and return a pointer to it, set memory to 0.
Definition: chibios_alloc.c:54
NO_OS_ARRAY_SIZE
#define NO_OS_ARRAY_SIZE(x)
Definition: no_os_util.h:49
ADF4368_REF_CLK_MAX
#define ADF4368_REF_CLK_MAX
Definition: adf4368.h:389
adf4368_init_param::cp_i
uint8_t cp_i
Definition: adf4368.h:432
ADF4368_DCLK_DIV1_0_MAX
#define ADF4368_DCLK_DIV1_0_MAX
Definition: adf4368.h:383
ADF4368_FRAC_N_INT_MIN
#define ADF4368_FRAC_N_INT_MIN
Definition: adf4368.h:395
adf4368_get_default_regs
int adf4368_get_default_regs(struct adf4368_dev *dev, bool *spi_4wire)
Reads and Checks the registers values equal to default values.
Definition: adf4368.c:1600
ADF4368_OUT_PWR_MAX
#define ADF4368_OUT_PWR_MAX
Definition: adf4368.h:392
adf4368_get_sync_setup
int adf4368_get_sync_setup(struct adf4368_dev *dev, bool *en)
Gets the value of the SYNC features' powerdown bit.
Definition: adf4368.c:1188
ADF4368_EN_REF_RST_MSK
#define ADF4368_EN_REF_RST_MSK
Definition: adf4368.h:137
ADF4368_PD_CLKOUT2_MSK
#define ADF4368_PD_CLKOUT2_MSK
Definition: adf4368.h:206
adf4368_dev::freq_min
uint64_t freq_min
Definition: adf4368.h:459
adf4368_init
int adf4368_init(struct adf4368_dev **dev, struct adf4368_init_param *init_param)
Initializes the adf4368.
Definition: adf4368.c:1893
MICRO
#define MICRO
Definition: no_os_units.h:49
adf4368_set_temperature
int adf4368_set_temperature(struct adf4368_dev *dev, bool en)
Set Temperature Readback feature's initial state. This feature should be disabled after reading tempe...
Definition: adf4368.c:1254
no_os_mdelay
void no_os_mdelay(uint32_t msecs)
Wait until msecs milliseconds passed.
Definition: aducm3029_delay.c:126
ADF4368_SPI_4W_CFG
#define ADF4368_SPI_4W_CFG(x)
Definition: adf4368.h:359
no_os_field_prep
uint32_t no_os_field_prep(uint32_t mask, uint32_t val)
adf4368_spi_update_bits
int adf4368_spi_update_bits(struct adf4368_dev *dev, uint16_t reg_addr, uint8_t mask, uint8_t data)
Updates the values of the ADF4368 register.
Definition: adf4368.c:223
ADF4368_MOD2WORD_MSB_MSK
#define ADF4368_MOD2WORD_MSB_MSK
Definition: adf4368.h:130
adf4368_init_param::spi_init
struct no_os_spi_init_param * spi_init
Definition: adf4368.h:427
adf4368_dev
ADF4368 Device Descriptor.
Definition: adf4368.h:442
adf4368_dev::cp_i
uint8_t cp_i
Definition: adf4368.h:450
ADF4368_TIMED_SYNC_MSK
#define ADF4368_TIMED_SYNC_MSK
Definition: adf4368.h:138
ADF4368_PD_SYNC
#define ADF4368_PD_SYNC
Definition: adf4368.h:191
ADF4368_RFOUT_MAX
#define ADF4368_RFOUT_MAX
Definition: adf4368.h:387
adf4368_get_phase_sdm
int adf4368_get_phase_sdm(struct adf4368_dev *dev, uint32_t *phase_fs)
Get the phase adjustment in femto-seconds with Sigma Delta Modulation.
Definition: adf4368.c:1371
ADF4368_SPI_READ_CMD
#define ADF4368_SPI_READ_CMD
Definition: adf4368.h:372
no_os_error.h
Error codes definition.
NO_OS_DIV_ROUND_UP
#define NO_OS_DIV_ROUND_UP(x, y)
Definition: no_os_util.h:52
adf4368_remove
int adf4368_remove(struct adf4368_dev *dev)
Free resources allocated for ADF4368.
Definition: adf4368.c:1983
ADF4368_CMOS_OV_MSK
#define ADF4368_CMOS_OV_MSK
Definition: adf4368.h:108
adf4368_get_temperature
int adf4368_get_temperature(struct adf4368_dev *dev, int32_t *temp)
Gets the value of the approximate die temperature.
Definition: adf4368.c:1293
ADF4368_PD_CLKOUT1_MSK
#define ADF4368_PD_CLKOUT1_MSK
Definition: adf4368.h:205
ADF4368_SIGMA_DELTA_MOD_CNST
#define ADF4368_SIGMA_DELTA_MOD_CNST
Definition: adf4368.h:405
adf4368_dev::bleed_word
int16_t bleed_word
Definition: adf4368.h:454
adf4368_reg_dump
int adf4368_reg_dump(struct adf4368_dev *dev)
Will output on the terminal the values of all the ADF4368 registers.
Definition: adf4368.c:247
adf4368_reg_dump
int adf4368_reg_dump(struct adf4368_dev *dev)
Will output on the terminal the values of all the ADF4368 registers.
Definition: adf4368.c:247
ADF4368_BUFF_SIZE_BYTES
#define ADF4368_BUFF_SIZE_BYTES
Definition: adf4368.h:374
ADF4368_CLK1_OPWR_MSK
#define ADF4368_CLK1_OPWR_MSK
Definition: adf4368.h:185
adf4368_set_rfout
int adf4368_set_rfout(struct adf4368_dev *dev, uint64_t val)
Set the desired output frequency and reset everything over to maximum supported value of 12....
Definition: adf4368.c:995
NO_OS_DIV_U64
#define NO_OS_DIV_U64(x, y)
Definition: no_os_util.h:115
adf4368_get_en_ref_doubler
int adf4368_get_en_ref_doubler(struct adf4368_dev *dev, bool *en)
Gets the value the doubler if it is enabled or disable and stores it it the dev structure.
Definition: adf4368.c:751
ADF4368_SPI_SCRATCHPAD_TEST
#define ADF4368_SPI_SCRATCHPAD_TEST
Definition: adf4368.h:368
adf4368_set_bleed_word
int adf4368_set_bleed_word(struct adf4368_dev *dev, int32_t word)
Set the bleed word, which represents the value of the bleed current written to the register space.
Definition: adf4368.c:905
adf4368_set_en_ref_doubler
int adf4368_set_en_ref_doubler(struct adf4368_dev *dev, bool en)
Set the reference doubler to enable or disable based on the passed parameter. If the parameter is dif...
Definition: adf4368.c:734
adf4368_set_cp_i
int adf4368_set_cp_i(struct adf4368_dev *dev, int32_t reg_val)
Set the charge pump value which will be written to the register. The value will be between 0 and 15 o...
Definition: adf4368.c:821
ADF4368_CLKOUT_DIV_REG_VAL_MAX
#define ADF4368_CLKOUT_DIV_REG_VAL_MAX
Definition: adf4368.h:385
adf4368_spi_read
int adf4368_spi_read(struct adf4368_dev *dev, uint16_t reg_addr, uint8_t *data)
Reads data from ADF4368 over SPI.
Definition: adf4368.c:182
ADF4368_MHZ
#define ADF4368_MHZ
Definition: adf4368.h:410
adf4368_set_rfout
int adf4368_set_rfout(struct adf4368_dev *dev, uint64_t val)
Set the desired output frequency and reset everything over to maximum supported value of 12....
Definition: adf4368.c:995
ADF4368_MOD2WORD_LSB_MSK
#define ADF4368_MOD2WORD_LSB_MSK
Definition: adf4368.h:124
ADF4368_S_TO_NS
#define ADF4368_S_TO_NS
Definition: adf4368.h:411
ADF4368_MOD2WORD_MID_MSK
#define ADF4368_MOD2WORD_MID_MSK
Definition: adf4368.h:127
adf4368_get_temperature
int adf4368_get_temperature(struct adf4368_dev *dev, int32_t *temp)
Gets the value of the approximate die temperature.
Definition: adf4368.c:1293
ADF4368_SPI_DUMMY_DATA
#define ADF4368_SPI_DUMMY_DATA
Definition: adf4368.h:373
no_os_spi_desc::bit_order
enum no_os_spi_bit_order bit_order
Definition: no_os_spi.h:204
adf4368_set_en_ref_doubler
int adf4368_set_en_ref_doubler(struct adf4368_dev *dev, bool en)
Set the reference doubler to enable or disable based on the passed parameter. If the parameter is dif...
Definition: adf4368.c:734
no_os_spi_desc
Structure holding SPI descriptor.
Definition: no_os_spi.h:192
ADF4368_EN_DRCLK_MSK
#define ADF4368_EN_DRCLK_MSK
Definition: adf4368.h:214
ADF4368_BLEED_N_INT_TH
#define ADF4368_BLEED_N_INT_TH
Definition: adf4368.h:399
no_os_clamp
#define no_os_clamp(val, min_val, max_val)
Definition: no_os_util.h:69
ADF4368_RESET_CMD
#define ADF4368_RESET_CMD
Definition: adf4368.h:52
ADF4368_MOD2WORD_MAX
#define ADF4368_MOD2WORD_MAX
Definition: adf4368.h:378
ADF4368_FINE_BLEED_CNST3
#define ADF4368_FINE_BLEED_CNST3
Definition: adf4368.h:403
no_os_greatest_common_divisor
uint32_t no_os_greatest_common_divisor(uint32_t a, uint32_t b)
ADF4368_COARSE_BLEED_MSK
#define ADF4368_COARSE_BLEED_MSK
Definition: adf4368.h:139
ADF4368_DRCLK_DEL_MSK
#define ADF4368_DRCLK_DEL_MSK
Definition: adf4368.h:238
ADF4368_FINE_BLEED_CNST1
#define ADF4368_FINE_BLEED_CNST1
Definition: adf4368.h:401
adf4368_init_param::ld_count
uint8_t ld_count
Definition: adf4368.h:433
adf4368_get_en_chan
int adf4368_get_en_chan(struct adf4368_dev *dev, uint8_t ch, bool *en)
Gets the value the output channel if it is enabled or disable.
Definition: adf4368.c:663
adf4368_get_bleed_word
int adf4368_get_bleed_word(struct adf4368_dev *dev, int32_t *word)
Gets the value of the bleed word.
Definition: adf4368.c:962
adf4368_set_ref_div
int adf4368_set_ref_div(struct adf4368_dev *dev, int32_t div)
Set the reference divider value and reset everything over to maximum supported value of 63 to the max...
Definition: adf4368.c:776
ADF4368_R_DIV_MSK
#define ADF4368_R_DIV_MSK
Definition: adf4368.h:152
adf4368_spi_read
int adf4368_spi_read(struct adf4368_dev *dev, uint16_t reg_addr, uint8_t *data)
Reads data from ADF4368 over SPI.
Definition: adf4368.c:182
adf4368_get_out_power
int adf4368_get_out_power(struct adf4368_dev *dev, uint8_t ch, int32_t *pwr)
Gets the output power register value.
Definition: adf4368.c:607
adf4368_set_phase_bleedi
int adf4368_set_phase_bleedi(struct adf4368_dev *dev, uint32_t phase_fs, bool phase_pol)
Set the phase adjustment in femto-seconds. The phase adjust will enable the Bleed current....
Definition: adf4368.c:1404
ADF4368_FRAC1WORD_MSB_MSK
#define ADF4368_FRAC1WORD_MSB_MSK
Definition: adf4368.h:102
adf4368_init_param::ref_freq_hz
uint64_t ref_freq_hz
Definition: adf4368.h:434
adf4368_get_sw_sync
int adf4368_get_sw_sync(struct adf4368_dev *dev, uint8_t *sw_sync)
Gets the value of the SW_SYNC bit.
Definition: adf4368.c:1231
adf4368_dev::ld_count
uint8_t ld_count
Definition: adf4368.h:451
no_os_field_get
uint32_t no_os_field_get(uint32_t mask, uint32_t word)
adf4368_get_sync_setup
int adf4368_get_sync_setup(struct adf4368_dev *dev, bool *en)
Gets the value of the SYNC features' powerdown bit.
Definition: adf4368.c:1188
adf4368.h
Implementation of ADF4368 Driver.
ADF4368_COARSE_BLEED_CNST
#define ADF4368_COARSE_BLEED_CNST
Definition: adf4368.h:400
ADF4368_REF_CLK_MIN
#define ADF4368_REF_CLK_MIN
Definition: adf4368.h:390
adf4368_dev::phase_pol
bool phase_pol
Definition: adf4368.h:447
ADF4368_VCO_FREQ_MAX
#define ADF4368_VCO_FREQ_MAX
Definition: adf4368.h:376
ADF4368_LD_COUNT_MSK
#define ADF4368_LD_COUNT_MSK
Definition: adf4368.h:210
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
ADF4368_FINE_BLEED_LSB_MSK
#define ADF4368_FINE_BLEED_LSB_MSK
Definition: adf4368.h:133
adf4368_get_bleed_word
int adf4368_get_bleed_word(struct adf4368_dev *dev, int32_t *word)
Gets the value of the bleed word.
Definition: adf4368.c:962
ADF4368_RFOUT_MIN
#define ADF4368_RFOUT_MIN
Definition: adf4368.h:388
adf4368_spi_write
int adf4368_spi_write(struct adf4368_dev *dev, uint16_t reg_addr, uint8_t data)
Writes data to ADF4368 over SPI.
Definition: adf4368.c:152
adf4368_set_bleed_word
int adf4368_set_bleed_word(struct adf4368_dev *dev, int32_t word)
Set the bleed word, which represents the value of the bleed current written to the register space.
Definition: adf4368.c:905
adf4368_dev::vco_max
uint64_t vco_max
Definition: adf4368.h:456
adf4368_set_phase_bleedi
int adf4368_set_phase_bleedi(struct adf4368_dev *dev, uint32_t phase_fs, bool phase_pol)
Set the phase adjustment in femto-seconds. The phase adjust will enable the Bleed current....
Definition: adf4368.c:1404
adf4368_init_param::freq
uint64_t freq
Definition: adf4368.h:435
no_os_udelay
void no_os_udelay(uint32_t usecs)
Wait until usecs microseconds passed.
Definition: aducm3029_delay.c:114
gcd
uint32_t gcd(uint32_t x, uint32_t y)
Computes the greatest common divider of two numbers.
Definition: adf4156.c:208
adf4368_get_phase_sdm
int adf4368_get_phase_sdm(struct adf4368_dev *dev, uint32_t *phase_fs)
Get the phase adjustment in femto-seconds with Sigma Delta Modulation.
Definition: adf4368.c:1371
adf4368_get_ref_div
int adf4368_get_ref_div(struct adf4368_dev *dev, int32_t *div)
Gets the value the reference divider.
Definition: adf4368.c:795
ADF4368_BLEED_WORD_MAX
#define ADF4368_BLEED_WORD_MAX
Definition: adf4368.h:394
adf4368_init_param
ADF4368 Initialization Parameters structure.
Definition: adf4368.h:425
init_param
struct ad7616_init_param init_param
Definition: ad7616_sdz.c:113
adf4368_reg_defaults
ADF4368 register initialization.
adf4368_set_ref_div
int adf4368_set_ref_div(struct adf4368_dev *dev, int32_t div)
Set the reference divider value and reset everything over to maximum supported value of 63 to the max...
Definition: adf4368.c:776
ADF4368_FRAC2WORD_MID_MSK
#define ADF4368_FRAC2WORD_MID_MSK
Definition: adf4368.h:118
adf4368_dev::ref_freq_hz
uint64_t ref_freq_hz
Definition: adf4368.h:460
adf4368_get_rfout
int adf4368_get_rfout(struct adf4368_dev *dev, uint64_t *val)
Gets the user proposed output frequency.
Definition: adf4368.c:1017
ADF4368_BLEED_MSB_MSK
#define ADF4368_BLEED_MSB_MSK
Definition: adf4368.h:365
adf4368_set_ref_clk
int adf4368_set_ref_clk(struct adf4368_dev *dev, uint64_t val)
Set the desired reference frequency and reset everything over to maximum supported value of 4GHz to t...
Definition: adf4368.c:694
ADF4368_FINE_BLEED_MSB_MSK
#define ADF4368_FINE_BLEED_MSB_MSK
Definition: adf4368.h:140
ADF4368_POR_DELAY_US
#define ADF4368_POR_DELAY_US
Definition: adf4368.h:407
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
ADF4368_ADC_ST_CNV_MSK
#define ADF4368_ADC_ST_CNV_MSK
Definition: adf4368.h:324
ADF4368_INT_N_INT_MIN
#define ADF4368_INT_N_INT_MIN
Definition: adf4368.h:396
adf4368_remove
int adf4368_remove(struct adf4368_dev *dev)
Free resources allocated for ADF4368.
Definition: adf4368.c:1983
true
@ true
Definition: ad5446.h:57
adf4368_get_default_regs
int adf4368_get_default_regs(struct adf4368_dev *dev, bool *check)
Reads and Checks the registers values equal to default values.
Definition: adf4368.c:1600
ADF4368_SYNC_SEL_MSK
#define ADF4368_SYNC_SEL_MSK
Definition: adf4368.h:318
ADF4368_NS_TO_S
#define ADF4368_NS_TO_S
Definition: adf4368.h:419
ADF4368_CP_I_MSK
#define ADF4368_CP_I_MSK
Definition: adf4368.h:147
ADF4368_FRAC2WORD_MSB_MSK
#define ADF4368_FRAC2WORD_MSB_MSK
Definition: adf4368.h:121
adf4368_init_param::spi_4wire_en
bool spi_4wire_en
Definition: adf4368.h:428
adf4368_dev::spi_desc
struct no_os_spi_desc * spi_desc
Definition: adf4368.h:444
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
ADF4368_SPI_WRITE_CMD
#define ADF4368_SPI_WRITE_CMD
Definition: adf4368.h:371
ADF4368_DCLK_DIV1_MSK
#define ADF4368_DCLK_DIV1_MSK
Definition: adf4368.h:309
ADF4368_LDWIN_PW_MSK
#define ADF4368_LDWIN_PW_MSK
Definition: adf4368.h:209
adf4368_set_phase
int adf4368_set_phase(struct adf4368_dev *dev, uint32_t phase_fs, bool phase_pol)
Set the phase adjustment in femto-seconds. Function choose the phase adjustment method according to I...
Definition: adf4368.c:1488
adf4368_dev::spi_4wire_en
bool spi_4wire_en
Definition: adf4368.h:445
MEGA
#define MEGA
Definition: no_os_units.h:42
no_os_util.h
Header file of utility functions.
ADF4368_FRAC1WORD_MID_MSK
#define ADF4368_FRAC1WORD_MID_MSK
Definition: adf4368.h:99
adf4368_get_phase
int adf4368_get_phase(struct adf4368_dev *dev, uint32_t *phase_fs, bool *phase_pol)
Get the phase adjustment in femto-seconds. Function choose the phase adjustment method according to I...
Definition: adf4368.c:1526
adf4368_dev::freq_max
uint64_t freq_max
Definition: adf4368.h:458
ADF4368_FRAC1WORD_LSB_MSK
#define ADF4368_FRAC1WORD_LSB_MSK
Definition: adf4368.h:96
adf4368_dev::n_int
uint16_t n_int
Definition: adf4368.h:453
adf4368_set_ref_clk
int adf4368_set_ref_clk(struct adf4368_dev *dev, uint64_t val)
Set the desired reference frequency and reset everything over to maximum supported value of 4GHz to t...
Definition: adf4368.c:694
ADF4368_BLEED_POL_MSK
#define ADF4368_BLEED_POL_MSK
Definition: adf4368.h:145
ADF4368_FINE_BLEED_CNST2
#define ADF4368_FINE_BLEED_CNST2
Definition: adf4368.h:402
ADF4368_SYNC_DEL_MSK
#define ADF4368_SYNC_DEL_MSK
Definition: adf4368.h:242
adf4368_dev::phase_adj
uint32_t phase_adj
Definition: adf4368.h:455
adf4368_set_en_chan
int adf4368_set_en_chan(struct adf4368_dev *dev, uint8_t ch, bool en)
Set the output channel to enable or disable based on the passed parameter. If the parameter is differ...
Definition: adf4368.c:637
adf4368_get_en_ref_doubler
int adf4368_get_en_ref_doubler(struct adf4368_dev *dev, bool *en)
Gets the value the doubler if it is enabled or disable and stores it it the dev structure.
Definition: adf4368.c:751
ADF4368_VAR_MOD_EN_MSK
#define ADF4368_VAR_MOD_EN_MSK
Definition: adf4368.h:178
adf4368_set_cp_i
int adf4368_set_cp_i(struct adf4368_dev *dev, int32_t reg_val)
Set the charge pump value which will be written to the register. The value will be between 0 and 15 o...
Definition: adf4368.c:821
adf4368_get_out_power
int adf4368_get_out_power(struct adf4368_dev *dev, uint8_t ch, int32_t *pwr)
Gets the output power register value.
Definition: adf4368.c:607
ADF4368_CHANNEL_SPACING_MAX
#define ADF4368_CHANNEL_SPACING_MAX
Definition: adf4368.h:380
no_os_bit_swap_constant_8
#define no_os_bit_swap_constant_8(x)
Definition: no_os_util.h:102
ADF4368_DCLK_MODE_MSK
#define ADF4368_DCLK_MODE_MSK
Definition: adf4368.h:252
ADF4368_SW_SYNC_MSK
#define ADF4368_SW_SYNC_MSK
Definition: adf4368.h:143
adf4368_init_param::ref_div
uint8_t ref_div
Definition: adf4368.h:431
adf4368_get_ref_clk
int adf4368_get_ref_clk(struct adf4368_dev *dev, uint64_t *val)
Gets the user proposed reference frequency.
Definition: adf4368.c:716
adf4368_set_phase
int adf4368_set_phase(struct adf4368_dev *dev, uint32_t phase_fs, bool phase_pol)
Set the phase adjustment in femto-seconds. Function choose the phase adjustment method according to I...
Definition: adf4368.c:1488
ADF4368_LOCKED_MSK
#define ADF4368_LOCKED_MSK
Definition: adf4368.h:334
ADF4368_FRAC2WORD_LSB_MSK
#define ADF4368_FRAC2WORD_LSB_MSK
Definition: adf4368.h:115
NO_OS_DIV_ROUND_CLOSEST
#define NO_OS_DIV_ROUND_CLOSEST(x, y)
Definition: no_os_util.h:54
adf4368_set_default_regs
int adf4368_set_default_regs(struct adf4368_dev *dev, bool spi_4wire)
Applys a softreset, sets the SPI 4 wire mode and writes the default registers.
Definition: adf4368.c:1563
adf4368_init_param::ref_doubler_en
bool ref_doubler_en
Definition: adf4368.h:430
adf4368_dev::cmos_3v3
bool cmos_3v3
Definition: adf4368.h:446
adf4368_get_en_chan
int adf4368_get_en_chan(struct adf4368_dev *dev, uint8_t ch, bool *en)
Gets the value the output channel if it is enabled or disable.
Definition: adf4368.c:663
no_os_spi_init_param
Structure holding the parameters for SPI initialization.
Definition: no_os_spi.h:140
adf4368_get_phase
int adf4368_get_phase(struct adf4368_dev *dev, uint32_t *phase_fs, bool *phase_pol)
Get the phase adjustment in femto-seconds. Function choose the phase adjustment method according to I...
Definition: adf4368.c:1526
adf4368_set_sync_setup
int adf4368_set_sync_setup(struct adf4368_dev *dev, bool en)
Set EZSYNC and Timed SYNC features' initial state. Waits for SW_SYNC toggle or SYNC pin.
Definition: adf4368.c:1118
adf4368_get_ref_div
int adf4368_get_ref_div(struct adf4368_dev *dev, int32_t *div)
Gets the value the reference divider.
Definition: adf4368.c:795
no_os_div_u64
uint64_t no_os_div_u64(uint64_t dividend, uint32_t divisor)