no-OS
adf4382.h
Go to the documentation of this file.
1 /***************************************************************************/
40 #include <stdint.h>
41 #include <string.h>
42 #include "no_os_units.h"
43 #include "no_os_util.h"
44 #include "no_os_spi.h"
45 
46 /* ADF4382 REG0000 Map */
47 #define ADF4382_SOFT_RESET_R_MSK NO_OS_BIT(7)
48 #define ADF4382_LSB_FIRST_R_MSK NO_OS_BIT(6)
49 #define ADF4382_ADDRESS_ASC_R_MSK NO_OS_BIT(5)
50 #define ADF4382_SDO_ACTIVE_R_MSK NO_OS_BIT(4)
51 #define ADF4382_SDO_ACTIVE_MSK NO_OS_BIT(3)
52 #define ADF4382_ADDRESS_ASC_MSK NO_OS_BIT(2)
53 #define ADF4382_LSB_FIRST_MSK NO_OS_BIT(1)
54 #define ADF4382_SOFT_RESET_MSK NO_OS_BIT(0)
55 #define ADF4382_RESET_CMD 0x81
56 
57 /* ADF4382 REG0000 NO_OS_BIT Definition */
58 #define ADF4382_SDO_ACTIVE_SPI_3W 0x0
59 #define ADF4382_SDO_ACTIVE_SPI_4W 0x1
60 
61 #define ADF4382_ADDR_ASC_AUTO_DECR 0x0
62 #define ADF4382_ADDR_ASC_AUTO_INCR 0x1
63 
64 #define ADF4382_LSB_FIRST_MSB 0x0
65 #define ADF4382_LSB_FIRST_LSB 0x1
66 
67 #define ADF4382_SOFT_RESET_N_OP 0x0
68 #define ADF4382_SOFT_RESET_EN 0x1
69 
70 /* ADF4382 REG0001 Map */
71 #define ADF4382_SINGLE_INSTR_MSK NO_OS_BIT(7)
72 #define ADF4382_MASTER_RB_CTRL_MSK NO_OS_BIT(5)
73 
74 /* ADF4382 REG0001 NO_OS_BIT Definition */
75 #define ADF4382_SPI_STREAM_EN 0x0
76 #define ADF4382_SPI_STREAM_DIS 0x1
77 
78 #define ADF4382_RB_SLAVE_REG 0x0
79 #define ADF4382_RB_MASTER_REG 0x1
80 
81 /* ADF4382 REG0003 NO_OS_BIT Definition */
82 #define ADF4382_CHIP_TYPE 0x06
83 
84 /* ADF4382 REG0004 NO_OS_BIT Definition */
85 #define ADF4382_PRODUCT_ID_LSB 0x0005
86 
87 /* ADF4382 REG0005 NO_OS_BIT Definition */
88 #define ADF4382_PRODUCT_ID_MSB 0x0005
89 
90 /* ADF4382 REG000A Map */
91 #define ADF4382_SCRATCHPAD_MSK NO_OS_GENMASK(7, 0)
92 
93 /* ADF4382 REG000C NO_OS_BIT Definition */
94 #define ADF4382_VENDOR_ID_LSB 0x56
95 
96 /* ADF4382 REG000D NO_OS_BIT Definition */
97 #define ADF4382_VENDOR_ID_MSB 0x04
98 
99 /* ADF4382 REG000F NO_OS_BIT Definition */
100 #define ADF4382_M_S_TRANSF_NO_OS_BIT_MSK NO_OS_BIT(0)
101 
102 /* ADF4382 REG0010 Map*/
103 #define ADF4382_N_INT_LSB_MSK NO_OS_GENMASK(7, 0)
104 
105 /* ADF4382 REG0011 Map*/
106 #define ADF4382_CLKOUT_DIV_MSK NO_OS_GENMASK(7, 5)
107 #define ADF4382_INV_CLK_OUT_MSK NO_OS_BIT(4)
108 #define ADF4382_N_INT_MSB_MSK NO_OS_GENMASK(3, 0)
109 
110 /* ADF4382 REG0012 Map */
111 #define ADF4382_FRAC1WORD_LSB_MSK NO_OS_GENMASK(7, 0)
112 
113 /* ADF4382 REG0013 Map */
114 #define ADF4382_FRAC1WORD_MID_MSK NO_OS_GENMASK(7, 0)
115 
116 /* ADF4382 REG0014 Map */
117 #define ADF4382_FRAC1WORD_MSB_MSK NO_OS_GENMASK(7, 0)
118 
119 /* ADF4382 REG0015 Map */
120 #define ADF4382_M_VCO_BAND_LSB_MSK NO_OS_BIT(7)
121 #define ADF4382_M_VCO_CORE_MSK NO_OS_BIT(6)
122 #define ADF4382_BIAS_DEC_MODE_MSK NO_OS_GENMASK(5, 3)
123 #define ADF4382_INT_MODE_MSK NO_OS_BIT(2)
124 #define ADF4382_PFD_POL_MSK NO_OS_BIT(1)
125 #define ADF4382_FRAC1WORD_MSB NO_OS_BIT(0)
126 
127 /* ADF4382 REG0016 Map */
128 #define ADF4382_M_VCO_BAND_MSB_MSK NO_OS_GENMASK(7, 0)
129 
130 /* ADF4382 REG0017 Map */
131 #define ADF4382_FRAC2WORD_LSB_MSK NO_OS_GENMASK(7, 0)
132 
133 /* ADF4382 REG0018 Map */
134 #define ADF4382_FRAC2WORD_MID_MSK NO_OS_GENMASK(7, 0)
135 
136 /* ADF4382 REG0019 Map */
137 #define ADF4382_FRAC2WORD_MSB_MSK NO_OS_GENMASK(7, 0)
138 
139 /* ADF4382 REG001A Map */
140 #define ADF4382_MOD2WORD_LSB_MSK NO_OS_GENMASK(7, 0)
141 
142 /* ADF4382 REG001B Map */
143 #define ADF4382_MOD2WORD_MID_MSK NO_OS_GENMASK(7, 0)
144 
145 /* ADF4382 REG001C Map */
146 #define ADF4382_MOD2WORD_MSB_MSK NO_OS_GENMASK(7, 0)
147 
148 /* ADF4382 REG001D Map */
149 #define ADF4382_FINE_BLEED_LSB_MSK NO_OS_GENMASK(7, 0)
150 
151 /* ADF4382 REG001E Map */
152 #define ADF4382_EN_PHASE_RESYNC_MSK NO_OS_BIT(7)
153 #define ADF4382_EN_REF_RST_MSK NO_OS_BIT(6)
154 #define ADF4382_TIMED_SYNC_MSK NO_OS_BIT(5)
155 #define ADF4382_COARSE_BLEED_MSK NO_OS_GENMASK(4, 1)
156 #define ADF4382_FINE_BLEED_MSB_MSK NO_OS_BIT(0)
157 
158 /* ADF4382 REG001F Map */
159 #define ADF4382_SW_SYNC_MSK NO_OS_BIT(7)
160 #define ADF4382_SPARE_1F_MSK NO_OS_BIT(6)
161 #define ADF4382_BLEED_POL_MSK NO_OS_BIT(5)
162 #define ADF4382_EN_BLEED_MSK NO_OS_BIT(4)
163 #define ADF4382_CP_I_MSK NO_OS_GENMASK(3, 0)
164 
165 /* ADF4382 REG0020 Map */
166 #define ADF4382_EN_AUTOCAL_MSK NO_OS_BIT(7)
167 #define ADF4382_EN_RDBLR_MSK NO_OS_BIT(6)
168 #define ADF4382_R_DIV_MSK NO_OS_GENMASK(5, 0)
169 
170 /* ADF4382 REG0021 Map */
171 #define ADF4382_PHASE_WORD_LSB_MSK NO_OS_GENMASK(7, 0)
172 
173 /* ADF4382 REG0022 Map */
174 #define ADF4382_PHASE_WORD_MID_MSK NO_OS_GENMASK(7, 0)
175 
176 /* ADF4382 REG0023 Map */
177 #define ADF4382_PHASE_WORD_MSB_MSK NO_OS_GENMASK(7, 0)
178 
179 /* ADF4382 REG0024 Map */
180 #define ADF4382_SPARE_24_MSK NO_OS_GENMASK(7, 5)
181 #define ADF4382_DCLK_DIV_SEL_MSK NO_OS_BIT(4)
182 #define ADF4382_DNCLK_DIV1_MSK NO_OS_GENMASK(3, 2)
183 #define ADF4382_DCLK_DIV1_MSK NO_OS_GENMASK(1, 0)
184 
185 /* ADF4382 REG0025 Map */
186 #define ADF4382_RESYNC_WAIT_LSB_MSK NO_OS_GENMASK(7, 0)
187 
188 /* ADF4382 REG0026 Map */
189 #define ADF4382_RESYNC_WAIT_MSB_MSK NO_OS_GENMASK(7, 0)
190 
191 /* ADF4382 REG0027 Map */
192 #define ADF4382_CAL_BLEED_FINE_MIN_MSK NO_OS_GENMASK(7, 4)
193 #define ADF4382_BLEED_ADJ_SCALE_MSK NO_OS_GENMASK(3, 0)
194 
195 /* ADF4382 REG0028 Map */
196 #define ADF4382_PH_RESYNC_RB_SEL_MSK NO_OS_BIT(7)
197 #define ADF4382_LSB_P1_MSK NO_OS_BIT(6)
198 #define ADF4382_VAR_MOD_EN_MSK NO_OS_BIT(5)
199 #define ADF4382_DITHER1_SCALE_MSK NO_OS_GENMASK(4, 2)
200 #define ADF4382_EN_DITHER2_MSK NO_OS_BIT(1)
201 #define ADF4382_EN_DITHER1_MSK NO_OS_BIT(0)
202 
203 /* ADF4382 REG0029 Map */
204 #define ADF4382_CLK2_OPWR_MSK NO_OS_GENMASK(7, 4)
205 #define ADF4382_CLK1_OPWR_MSK NO_OS_GENMASK(3, 0)
206 
207 /* ADF4382 REG002A Map */
208 #define ADF4382_FN_DBL_MSK NO_OS_BIT(7)
209 #define ADF4382_PD_NDIV_TL_MSK NO_OS_BIT(6)
210 #define ADF4382_CLKOUT_BST_MSK NO_OS_BIT(5)
211 #define ADF4382_PD_SYNC_MSK NO_OS_BIT(4)
212 #define ADF4382_PD_CLK_MSK NO_OS_BIT(3)
213 #define ADF4382_PD_RDET_MSK NO_OS_BIT(2)
214 #define ADF4382_PD_ADC_MSK NO_OS_BIT(1)
215 #define ADF4382_PD_CALGEN_MSK NO_OS_BIT(0)
216 
217 /* ADF4382 REG002B Map */
218 #define ADF4382_PD_ALL_MSK NO_OS_BIT(7)
219 #define ADF4382_PD_RDIV_TL_MSK NO_OS_BIT(6)
220 #define ADF4382_PD_NDIV_MSK NO_OS_BIT(5)
221 #define ADF4382_PD_VCO_MSK NO_OS_BIT(4)
222 #define ADF4382_PD_LD_MSK NO_OS_BIT(3)
223 #define ADF4382_PD_PFDCP_MSK NO_OS_BIT(2)
224 #define ADF4382_PD_CLKOUT1_MSK NO_OS_BIT(1)
225 #define ADF4382_PD_CLKOUT2_MSK NO_OS_BIT(0)
226 
227 /* ADF4382 REG002C Map */
228 #define ADF4382_LDWIN_PW_MSK NO_OS_GENMASK(7, 5)
229 #define ADF4382_LD_COUNT_OPWR_MSK NO_OS_GENMASK(4, 0)
230 
231 /* ADF4382 REG002D Map */
232 #define ADF4382_EN_DNCLK_MSK NO_OS_BIT(7)
233 #define ADF4382_EN_DRCLK_MSK NO_OS_BIT(6)
234 #define ADF4382_EN_LOL_MSK NO_OS_BIT(5)
235 #define ADF4382_EN_LDWIN_MSK NO_OS_BIT(4)
236 #define ADF4382_PDET_POL_MSK NO_OS_BIT(3)
237 #define ADF4382_RST_LD_MSK NO_OS_BIT(2)
238 #define ADF4382_LD_O_CTRL_MSK NO_OS_GENMASK(1, 0)
239 
240 /* ADF4382 REG002E Map */
241 #define ADF4382_MUXOUT_MSK NO_OS_GENMASK(7, 4)
242 #define ADF4382_ABPW_WD_MSK NO_OS_BIT(3)
243 #define ADF4382_EN_CPTEST_MSK NO_OS_BIT(2)
244 #define ADF4382_CP_DOWN_MSK NO_OS_BIT(1)
245 #define ADF4382_CP_UP_MSK NO_OS_BIT(0)
246 
247 /* ADF4382 REG002F Map*/
248 #define ADF4382_BST_REF_MSK NO_OS_BIT(7)
249 #define ADF4382_FILT_REF_MSK NO_OS_BIT(6)
250 #define ADF4382_RDBLR_DC_MSK NO_OS_GENMASK(5, 0)
251 
252 /* ADF4382 REG0030 Map */
253 #define ADF4382_MUTE_NCLK_MSK NO_OS_BIT(7)
254 #define ADF4382_MUTE_RCLK_MSK NO_OS_BIT(6)
255 #define ADF4382_REF_SEL_MSK NO_OS_BIT(5)
256 #define ADF4382_INV_RDBLR_MSK NO_OS_BIT(4)
257 #define ADF4382_RDBLR_DEL_SEL_MSK NO_OS_GENMASK(3, 0)
258 
259 /* ADF4382 REG0031 Map */
260 #define ADF4382_SYNC_DEL_MSK NO_OS_GENMASK(7, 5)
261 #define ADF4382_RST_SYS_MSK NO_OS_BIT(4)
262 #define ADF4382_EN_ADC_CLK_MSK NO_OS_BIT(3)
263 #define ADF4382_EN_VCAL_MSK NO_OS_BIT(2)
264 #define ADF4382_CAL_CT_SEL_MSK NO_OS_BIT(1)
265 #define ADF4382_DCLK_MODE_MSK NO_OS_BIT(0)
266 
267 /* ADF4382 REG0032 Map */
268 #define ADF4382_SPARE_32_MSK NO_OS_BIT(7)
269 #define ADF4382_BLEED_ADJ_CAL_MSK NO_OS_BIT(6)
270 #define ADF4382_DEL_MODE_MSK NO_OS_BIT(5)
271 #define ADF4382_EN_AUTO_ALIGN_MSK NO_OS_BIT(4)
272 #define ADF4382_PHASE_ADJ_POL_MSK NO_OS_BIT(3)
273 #define ADF4382_EFM3_MODE_MSK NO_OS_GENMASK(2, 0)
274 
275 /* ADF4382 REG0033 Map */
276 #define ADF4382_PHASE_ADJUST_MSK NO_OS_GENMASK(7, 0)
277 
278 /* ADF4382 REG0034 Map */
279 #define ADF4382_PHASE_ADJ_MSK NO_OS_BIT(7)
280 #define ADF4382_DRCLK_DEL_MSK NO_OS_GENMASK(6, 4)
281 #define ADF4382_DNCLK_DEL_MSK NO_OS_GENMASK(3, 1)
282 #define ADF4382_RST_CNTR_MSK NO_OS_BIT(0)
283 
284 /* ADF4382 REG0035 Map */
285 #define ADF4382_SPARE_35_MSK NO_OS_GENMASK(7, 6)
286 #define ADF4382_M_VCO_BIAS_MSK NO_OS_GENMASK(5, 0)
287 
288 /* ADF4382 REG0036 Map */
289 #define ADF4382_CLKODIV_DB_MSK NO_OS_BIT(7)
290 #define ADF4382_DCLK_DIV_DB_MSK NO_OS_BIT(6)
291 #define ADF4382_SPARE_36_MSK NO_OS_GENMASK(5, 2)
292 #define ADF4382_EN_LUT_GEN_MSK NO_OS_BIT(1)
293 #define ADF4382_EN_LUT_CAL_MSK NO_OS_BIT(0)
294 
295 /* ADF4382 REG0037 Map */
296 #define ADF4382_CAL_COUNT_TO_MSK NO_OS_GENMASK(7, 0)
297 
298 /* ADF4382 REG0038 Map */
299 #define ADF4382_CAL_VTUNE_TO_LSB_MSK NO_OS_GENMASK(7, 0)
300 
301 /* ADF4382 REG0039 Map */
302 #define ADF4382_O_VCO_DB_MSK NO_OS_BIT(7)
303 #define ADF4382_CAL_VTUNE_TO_MSB_MSK NO_OS_GENMASK(6, 0)
304 
305 /* ADF4382 REG003A Map */
306 #define ADF4382_CAL_VCO_TO_LSB_MSK NO_OS_GENMASK(7, 0)
307 
308 /* ADF4382 REG003B Map */
309 #define ADF4382_DEL_CTRL_DB_MSK NO_OS_BIT(7)
310 #define ADF4382_CAL_VCO_TO_MSB_MSK NO_OS_GENMASK(6, 0)
311 
312 /* ADF4382 REG003C Map */
313 #define ADF4382_CNTR_DIV_WORD_MSK NO_OS_GENMASK(7, 0)
314 
315 /* ADF4382 REG003D Map */
316 #define ADF4382_SPARE_3D_MSK NO_OS_BIT(7)
317 #define ADF4382_SYNC_SP_DB_MSK NO_OS_BIT(6)
318 #define ADF4382_CMOS_OV_MSK NO_OS_BIT(5)
319 #define ADF4382_READ_MODE_MSK NO_OS_BIT(4)
320 #define ADF4382_CNTR_DIV_WORD_MSB_MSK NO_OS_GENMASK(3, 0)
321 
322 /* ADF4382 REG003E Map */
323 #define ADF4382_ADC_CLK_DIV_MSK NO_OS_GENMASK(7, 0)
324 
325 /* ADF4382 REG003F Map */
326 #define ADF4382_EN_ADC_CNV_MSK NO_OS_BIT(7)
327 #define ADF4382_EN_ADC_VTEST_MSK NO_OS_BIT(6)
328 #define ADF4382_ADC_VTEST_SEL_MSK NO_OS_BIT(5)
329 #define ADF4382_ADC_MUX_SEL_MSK NO_OS_BIT(4)
330 #define ADF4382_ADC_F_CONV_MSK NO_OS_BIT(3)
331 #define ADF4382_ADC_C_CONV_MSK NO_OS_BIT(2)
332 #define ADF4382_EN_ADC_MSK NO_OS_BIT(1)
333 #define ADF4382_SPARE_3F_MSK NO_OS_BIT(0)
334 
335 /* ADF4382 REG0040 Map */
336 #define ADF4382_EXT_DIV_DEC_SEL_MSK NO_OS_BIT(7)
337 #define ADF4382_ADC_CLK_TEST_SEL_MSK NO_OS_BIT(6)
338 #define ADF4382_MUTE_CLKOUT2_MSK NO_OS_GENMASK(5, 3)
339 #define ADF4382_MUTE_CLKOUT1_MSK NO_OS_GENMASK(2, 0)
340 
341 /* ADF4382 REG0041 Map */
342 #define ADF4382_EXT_DIV_MSK NO_OS_GENMASK(7, 5)
343 #define ADF4382_EN_VCO_CAP_TEST_MSK NO_OS_BIT(4)
344 #define ADF4382_EN_CALGEN_CAP_TEST_MSK NO_OS_BIT(3)
345 #define ADF4382_EN_CP_CAP_TEST_MSK NO_OS_BIT(2)
346 #define ADF4382_CAP_TEST_STATE_MSK NO_OS_BIT(1)
347 #define ADF4382_TRANS_LOOP_SEL_MSK NO_OS_BIT(0)
348 
349 /* ADF4382 REG0042 Map */
350 #define ADF4382_NDIV_PWRUP_TIMEOUT_MSK NO_OS_GENMASK(7, 0)
351 
352 /* ADF4382 REG0043 Map */
353 #define ADF4382_CAL_BLEED_FINE_MAX_MSK NO_OS_GENMASK(7, 0)
354 
355 /* ADF4382 REG0044 Map */
356 #define ADF4382_VCAL_ZERO_MSK NO_OS_BIT(7)
357 #define ADF4382_VPTAT_CALGEN_MSK NO_OS_GENMASK(6, 0)
358 
359 /* ADF4382 REG0045 Map */
360 #define ADF4382_SPARE_45_MSK NO_OS_BIT(7)
361 #define ADF4382_VCTAT_CALGEN_MSK NO_OS_GENMASK(6, 0)
362 
363 /* ADF4382 REG0046 Map */
364 #define ADF4382_NVMDIN_MSK NO_OS_GENMASK(7, 0)
365 
366 /* ADF4382 REG0047 Map */
367 #define ADF4382_SPARE_47_MSK NO_OS_BIT(7)
368 #define ADF4382_NVMADDR_MSK NO_OS_GENMASK(6, 3)
369 #define ADF4382_NVMNO_OS_BIT_SEL NO_OS_GENMASK(2, 0)
370 
371 /* ADF4382 REG0048 Map */
372 #define ADF4382_TRIM_LATCH_MSK NO_OS_BIT(7)
373 #define ADF4382_NVMTEST_MSK NO_OS_BIT(6)
374 #define ADF4382_NVMPROG_MSK NO_OS_BIT(5)
375 #define ADF4382_NVMRD_MSK NO_OS_BIT(4)
376 #define ADF4382_NVMSTART_MSK NO_OS_BIT(3)
377 #define ADF4382_NVMON_MSK NO_OS_BIT(2)
378 #define ADF4382_MARGIN_MSK NO_OS_GENMASK(1, 0)
379 
380 /* ADF4382 REG0049 Map */
381 #define ADF4382_NVMDOUT_MSK NO_OS_GENMASK(7, 0)
382 
383 /* ADF4382 REG004A Map */
384 #define ADF4382_SCAN_MODE_CODE_MSK NO_OS_GENMASK(7, 0)
385 
386 /* ADF4382 REG004B Map */
387 #define ADF4382_TEMP_OFFSET_MSK NO_OS_GENMASK(7, 0)
388 
389 /* ADF4382 REG004C Map */
390 #define ADF4382_SPARE_4C_MSK NO_OS_GENMASK(7, 6)
391 #define ADF4382_TEMP_SLOPE_MSK NO_OS_GENMASK(5, 0)
392 
393 /* ADF4382 REG004D Map */
394 #define ADF4382_VCO_FSM_TEST_MUX_MSK NO_OS_GENMASK(7, 5)
395 #define ADF4382_SPARE_4D_MSK NO_OS_GENMASK(4, 3)
396 #define ADF4382_O_VCO_BIAS_MSK NO_OS_BIT(2)
397 #define ADF4382_O_VCO_BAND_MSK NO_OS_BIT(1)
398 #define ADF4382_O_VCO_CORE_MSK NO_OS_BIT(0)
399 
400 /* ADF4382 REG004E Map */
401 #define ADF4382_SPARE_4E_MSK NO_OS_GENMASK(7, 5)
402 #define ADF4382_EN_TWO_PASS_CAL_MSK NO_OS_BIT(4)
403 #define ADF4382_TWO_PASS_BAND_START_MSK NO_OS_GENMASK(3, 0)
404 
405 /* ADF4382 REG004F Map */
406 #define ADF4382_LUT_SCALE_MSK NO_OS_GENMASK(7, 0)
407 
408 /* ADF4382 REG0050 Map */
409 #define ADF4382_SPARE0_MSK NO_OS_GENMASK(7, 0)
410 
411 /* ADF4382 REG0051 Map */
412 #define ADF4382_SPARE1_MSK NO_OS_GENMASK(7, 0)
413 
414 /* ADF4382 REG0052 Map */
415 #define ADF4382_SYNC_REF_SPARE_MSK NO_OS_GENMASK(7, 4)
416 #define ADF4382_SYNC_MON_DEL_MSK NO_OS_GENMASK(3, 0)
417 
418 /* ADF4382 REG0053 Map */
419 #define ADF4382_SPARE_53_MSK NO_OS_BIT(7)
420 #define ADF4382_PD_SYNC_MON_MSK NO_OS_BIT(6)
421 #define ADF4382_SYNC_SEL_MSK NO_OS_BIT(5)
422 #define ADF4382_RST_SYNC_MON_MSK NO_OS_BIT(4)
423 #define ADF4382_SYNC_SH_DEL_MSK NO_OS_GENMASK(3, 0)
424 
425 /* ADF4382 REG0054 Map */
426 #define ADF4382_ADC_ST_CNV_MSK NO_OS_BIT(0)
427 
428 /* ADF4382 REG0058 Map */
429 #define ADF4382_LOCKED_MSK NO_OS_BIT(0)
430 
431 #define ADF4382_SPI_3W_CFG(x) (no_os_field_prep(ADF4382_SDO_ACTIVE_MSK, x) | \
432  no_os_field_prep(ADF4382_SDO_ACTIVE_R_MSK, x))
433 #define ADF4382_BLEED_MSB_MSK (ADF4382_COARSE_BLEED_MSK | \
434  ADF4382_FINE_BLEED_MSB_MSK)
435 
436 #define ADF4382_SPI_SCRATCHPAD_TEST 0x5A
437 
438 /* Specifications */
439 #define ADF4382_SPI_WRITE_CMD 0x0
440 #define ADF4382_SPI_READ_CMD 0x8000
441 #define ADF4382_SPI_DUMMY_DATA 0x00
442 #define ADF4382_BUFF_SIZE_BYTES 3
443 #define ADF4382_VCO_FREQ_MIN 11000000000U // 11GHz
444 #define ADF4382_VCO_FREQ_MAX 22000000000U // 22GHz
445 #define ADF4382A_VCO_FREQ_MIN 11500000000U // 11.5GHz
446 #define ADF4382A_VCO_FREQ_MAX 21000000000U // 21GHz
447 #define ADF4382_MOD1WORD 0x2000000U // 2^25
448 #define ADF4382_MOD2WORD_MAX 0xFFFFFFU // 2^24 - 1
449 #define ADF4382_PHASE_RESYNC_MOD2WORD_MAX 0x1FFFFU // 2^17 - 1
450 #define ADF4382_CHANNEL_SPACING_MAX 78125U
451 #define ADF4382_PFD_FREQ_MAX 625000000U // 625MHz
452 #define ADF4382_PFD_FREQ_FRAC_MAX 250000000U // 250MHz
453 #define ADF4382_PFD_FREQ_MIN 5400000U // 5.4MHz
454 #define ADF4382_DCLK_DIV1_0_MAX 160000000U // 160MHz
455 #define ADF4382_DCLK_DIV1_1_MAX 320000000U // 320MHz
456 #define ADF4382_CLKOUT_DIV_REG_VAL_MAX 4
457 #define ADF4382A_CLKOUT_DIV_REG_VAL_MAX 2
458 
459 #define ADF4382_RFOUT_MAX 22000000000U
460 #define ADF4382_RFOUT_MIN 687500000U
461 #define ADF4382A_RFOUT_MAX 21000000000U
462 #define ADF4382A_RFOUT_MIN 2875000000U
463 #define ADF4382_REF_CLK_MAX 5000000000U
464 #define ADF4382_REF_CLK_MIN 10000000
465 #define ADF4382_REF_DIV_MAX 63
466 #define ADF4382_OUT_PWR_MAX 15
467 #define ADF4382_CPI_VAL_MAX 15
468 #define ADF4382_BLEED_WORD_MAX 8191
469 
470 #define ADF4382_PHASE_BLEED_CNST 2044000
471 #define ADF4382_VCO_CAL_CNT 202
472 #define ADF4382_VCO_CAL_VTUNE 124
473 #define ADF4382_VCO_CAL_ALC 250
474 #define ADF4382_POR_DELAY_US 200
475 #define ADF4382_LKD_DELAY_US 500
476 
477 #define MHZ MEGA
478 #define S_TO_NS NANO
479 #define NS_TO_PS KHZ_PER_MHZ
480 
487 };
488 
497  bool cmos_3v3;
498  uint64_t ref_freq_hz;
499  uint64_t freq;
501  uint8_t ref_div;
502  uint8_t cp_i;
503  uint16_t bleed_word;
504  uint8_t ld_count;
506 };
507 
512 struct adf4382_dev {
516  bool cmos_3v3;
517  uint64_t ref_freq_hz;
518  uint64_t freq;
520  uint8_t ref_div;
521  uint8_t cp_i;
522  uint16_t bleed_word;
523  uint8_t ld_count;
524  uint32_t phase_adj;
525  uint64_t vco_max;
526  uint64_t vco_min;
527  uint64_t freq_max;
528  uint64_t freq_min;
530 };
531 
536 struct reg_sequence {
537  uint16_t reg;
538  uint8_t val;
539 };
540 
545 static const struct reg_sequence adf4382_reg_defaults[] = {
546  { 0x000, 0x18 },
547  { 0x00a, 0xA5 },
548  { 0x200, 0x00 },
549  { 0x201, 0x00 },
550  { 0x202, 0x00 },
551  { 0x203, 0x00 },
552  { 0x203, 0x00 },
553  { 0x203, 0x00 },
554  { 0x100, 0x25 },
555  { 0x101, 0x3F },
556  { 0x102, 0x3F },
557  { 0x103, 0x3F },
558  { 0x104, 0x3F },
559  { 0x105, 0x3F },
560  { 0x106, 0x3F },
561  { 0x107, 0x3F },
562  { 0x108, 0x3F },
563  { 0x109, 0x25 },
564  { 0x10A, 0x25 },
565  { 0x10B, 0x3F },
566  { 0x10C, 0x3F },
567  { 0x10D, 0x3F },
568  { 0x10E, 0x3F },
569  { 0x10F, 0x3F },
570  { 0x110, 0x3F },
571  { 0x111, 0x3F },
572  { 0x054, 0x00 },
573  { 0x053, 0x45 },
574  { 0x052, 0x00 },
575  { 0x051, 0x00 },
576  { 0x050, 0x00 },
577  { 0x04f, 0x08 },
578  { 0x04e, 0x06 },
579  { 0x04d, 0x00 },
580  { 0x04c, 0x2B },
581  { 0x04b, 0x5D },
582  { 0x04a, 0x00 },
583  { 0x048, 0x00 },
584  { 0x047, 0x00 },
585  { 0x046, 0x00 },
586  { 0x045, 0x62 },
587  { 0x044, 0x3F },
588  { 0x043, 0xB8 },
589  { 0x042, 0x01 },
590  { 0x041, 0x00 },
591  { 0x040, 0x00 },
592  { 0x03f, 0x82 },
593  { 0x03e, 0x4E },
594  { 0x03c, 0x00 },
595  { 0x03b, 0x00 },
596  { 0x03a, 0xFA },
597  { 0x039, 0x00 },
598  { 0x038, 0x71 },
599  { 0x037, 0x82 },
600  { 0x036, 0xC0 },
601  { 0x035, 0x00 },
602  { 0x034, 0x36 },
603  { 0x033, 0x00 },
604  { 0x032, 0x40 },
605  { 0x031, 0x63 },
606  { 0x030, 0x0F },
607  { 0x02f, 0x3F },
608  { 0x02e, 0x00 },
609  { 0x02d, 0xF1 },
610  { 0x02c, 0x0E },
611  { 0x02b, 0x01 },
612  { 0x02a, 0x30 },
613  { 0x029, 0x09 },
614  { 0x028, 0x00 },
615  { 0x027, 0xF0 },
616  { 0x026, 0x00 },
617  { 0x025, 0x01 },
618  { 0x024, 0x01 },
619  { 0x023, 0x00 },
620  { 0x022, 0x00 },
621  { 0x021, 0x00 },
622  { 0x020, 0xC1 },
623  { 0x01f, 0x0F },
624  { 0x01e, 0x20 },
625  { 0x01d, 0x00 },
626  { 0x01c, 0x00 },
627  { 0x01b, 0x00 },
628  { 0x01a, 0x00 },
629  { 0x019, 0x00 },
630  { 0x018, 0x00 },
631  { 0x017, 0x00 },
632  { 0x016, 0x00 },
633  { 0x015, 0x06 },
634  { 0x014, 0x00 },
635  { 0x013, 0x00 },
636  { 0x012, 0x00 },
637  { 0x011, 0x00 },
638  { 0x010, 0x50 },
639 };
640 
642 int adf4382_spi_write(struct adf4382_dev *dev, uint16_t reg_addr, uint8_t data);
643 
645 int adf4382_spi_read(struct adf4382_dev *dev, uint16_t reg_addr, uint8_t *data);
646 
648 int adf4382_spi_update_bits(struct adf4382_dev *dev, uint16_t reg_addr,
649  uint8_t mask, uint8_t data);
650 
652 int adf4382_reg_dump(struct adf4382_dev *dev);
653 
655 int adf4382_set_ref_clk(struct adf4382_dev *dev, uint64_t val);
656 
658 int adf4382_get_ref_clk(struct adf4382_dev *dev, uint64_t *val);
659 
661 int adf4382_set_en_ref_doubler(struct adf4382_dev *dev, bool en);
662 
664 int adf4382_get_en_ref_doubler(struct adf4382_dev *dev, bool *en);
665 
667 int adf4382_set_ref_div(struct adf4382_dev *dev, int32_t div);
668 
670 int adf4382_get_ref_div(struct adf4382_dev *dev, int32_t *div);
671 
673 int adf4382_set_cp_i(struct adf4382_dev *dev, int32_t reg_val);
674 
676 int adf4382_get_cp_i(struct adf4382_dev *dev, int32_t *reg_val);
677 
679 int adf4382_set_bleed_word(struct adf4382_dev *dev, int32_t word);
680 
682 int adf4382_get_bleed_word(struct adf4382_dev *dev, int32_t *word);
683 
685 int adf4382_set_rfout(struct adf4382_dev *dev, uint64_t val);
686 
688 int adf4382_get_rfout(struct adf4382_dev *dev, uint64_t *val);
689 
691 int adf4382_set_out_power(struct adf4382_dev *dev, uint8_t ch, int32_t pwr);
692 
694 int adf4382_get_out_power(struct adf4382_dev *dev, uint8_t ch, int32_t *pwr);
695 
697 int adf4382_set_en_chan(struct adf4382_dev *dev, uint8_t ch, bool en);
698 
700 int adf4382_get_en_chan(struct adf4382_dev *dev, uint8_t ch, bool *en);
701 
703 int adf4382_set_en_sync(struct adf4382_dev *dev, bool en);
704 
706 int adf4382_get_en_sync(struct adf4382_dev *dev, bool *en);
707 
709 int adf4382_set_freq(struct adf4382_dev *dev);
710 
712 int adf4382_set_phase_adjust(struct adf4382_dev *dev, uint32_t phase_ps);
713 
715 int adf4382_set_phase_pol(struct adf4382_dev *dev, bool polarity);
716 
718 int adf4382_get_phase_pol(struct adf4382_dev *dev, bool *polarity);
719 
721 int adf4382_init(struct adf4382_dev **device,
723 
725 int adf4382_remove(struct adf4382_dev *dev);
adf4382_dev::clkout_div_reg_val_max
uint8_t clkout_div_reg_val_max
Definition: adf4382.h:529
ADF4382_FRAC1WORD_MSB_MSK
#define ADF4382_FRAC1WORD_MSB_MSK
Definition: adf4382.h:117
no_os_alloc.h
adf4382_dev_id
adf4382_dev_id
Supported device ids.
Definition: adf4382.h:484
ADF4382_EN_ADC_CLK_MSK
#define ADF4382_EN_ADC_CLK_MSK
Definition: adf4382.h:262
adf4382_set_en_sync
int adf4382_set_en_sync(struct adf4382_dev *dev, bool en)
Set the sync to enable or disable based on the passed parameter. If the parameter is different then 0...
Definition: adf4382.c:521
ADF4382_COARSE_BLEED_MSK
#define ADF4382_COARSE_BLEED_MSK
Definition: adf4382.h:155
ADF4382_RFOUT_MIN
#define ADF4382_RFOUT_MIN
Definition: adf4382.h:460
ADF4382_REF_CLK_MAX
#define ADF4382_REF_CLK_MAX
Definition: adf4382.h:463
ADF4382A_RFOUT_MIN
#define ADF4382A_RFOUT_MIN
Definition: adf4382.h:462
ADF4382_PHASE_RESYNC_MOD2WORD_MAX
#define ADF4382_PHASE_RESYNC_MOD2WORD_MAX
Definition: adf4382.h:449
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:165
adf4382_dev::cp_i
uint8_t cp_i
Definition: adf4382.h:521
adf4382_init_param::id
enum adf4382_dev_id id
Definition: adf4382.h:505
ADF4382_INT_MODE_MSK
#define ADF4382_INT_MODE_MSK
Definition: adf4382.h:123
adf4382_reg_dump
int adf4382_reg_dump(struct adf4382_dev *dev)
Will output on the terminal the values of all the ADF4382 registers.
Definition: adf4382.c:166
no_os_spi.h
Header file of SPI Interface.
NS_TO_PS
#define NS_TO_PS
Definition: adf4382.h:479
ADF4382_FRAC2WORD_LSB_MSK
#define ADF4382_FRAC2WORD_LSB_MSK
Definition: adf4382.h:131
reg_sequence
ADF4382 register format structure for default values.
Definition: adf4371.c:191
adf4382_init_param::ref_div
uint8_t ref_div
Definition: adf4382.h:501
ADF4382_EN_RDBLR_MSK
#define ADF4382_EN_RDBLR_MSK
Definition: adf4382.h:167
ADF4382_VCO_CAL_ALC
#define ADF4382_VCO_CAL_ALC
Definition: adf4382.h:473
adf4382_get_rfout
int adf4382_get_rfout(struct adf4382_dev *dev, uint64_t *val)
Gets the user proposed output frequency.
Definition: adf4382.c:596
adf4382_init_param::ref_freq_hz
uint64_t ref_freq_hz
Definition: adf4382.h:498
ADF4382_CPI_VAL_MAX
#define ADF4382_CPI_VAL_MAX
Definition: adf4382.h:467
adf4382_get_en_sync
int adf4382_get_en_sync(struct adf4382_dev *dev, bool *en)
Gets the value the sync if it is enabled or disable.
Definition: adf4382.c:535
no_os_units.h
Header file of Units.
adf4382_get_en_sync
int adf4382_get_en_sync(struct adf4382_dev *dev, bool *en)
Gets the value the sync if it is enabled or disable.
Definition: adf4382.c:535
adf4382_set_out_power
int adf4382_set_out_power(struct adf4382_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: adf4382.c:420
ADF4382_PHASE_ADJ_POL_MSK
#define ADF4382_PHASE_ADJ_POL_MSK
Definition: adf4382.h:272
pr_err
#define pr_err(fmt, args...)
Definition: no_os_print_log.h:94
adf4382_dev::freq
uint64_t freq
Definition: adf4382.h:518
adf4382_set_rfout
int adf4382_set_rfout(struct adf4382_dev *dev, uint64_t val)
Set the desired output frequency and reset everything over to maximum supported value of 22GHz (21GHz...
Definition: adf4382.c:558
no_os_delay.h
Header file of Delay functions.
adf4382_get_bleed_word
int adf4382_get_bleed_word(struct adf4382_dev *dev, int32_t *word)
Gets the value of the set bleed word.
Definition: adf4382.c:390
adf4382_dev::ref_div
uint8_t ref_div
Definition: adf4382.h:520
ADF4382_DEL_MODE_MSK
#define ADF4382_DEL_MODE_MSK
Definition: adf4382.h:270
adf4382_set_en_chan
int adf4382_set_en_chan(struct adf4382_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: adf4382.c:471
ADF4382_RFOUT_MAX
#define ADF4382_RFOUT_MAX
Definition: adf4382.h:459
adf4382_remove
int adf4382_remove(struct adf4382_dev *dev)
Free resources allocated for ADF4382.
Definition: adf4382.c:1289
pr_info
#define pr_info(fmt, args...)
Definition: no_os_print_log.h:121
ADF4382_FINE_BLEED_LSB_MSK
#define ADF4382_FINE_BLEED_LSB_MSK
Definition: adf4382.h:149
NO_OS_DIV_ROUND_CLOSEST_ULL
#define NO_OS_DIV_ROUND_CLOSEST_ULL(x, y)
Definition: no_os_util.h:60
adf4382_get_cp_i
int adf4382_get_cp_i(struct adf4382_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: adf4382.c:349
ADF4382_FRAC1WORD_LSB_MSK
#define ADF4382_FRAC1WORD_LSB_MSK
Definition: adf4382.h:111
adf4382_dev::vco_min
uint64_t vco_min
Definition: adf4382.h:526
adf4382_set_freq
int adf4382_set_freq(struct adf4382_dev *dev)
Set the output frequency.
Definition: adf4382.c:794
adf4382_init_param::spi_3wire_en
bool spi_3wire_en
Definition: adf4382.h:496
MICROAMPER_PER_AMPER
#define MICROAMPER_PER_AMPER
Definition: no_os_units.h:70
ADF4382_VCO_CAL_VTUNE
#define ADF4382_VCO_CAL_VTUNE
Definition: adf4382.h:472
device
Definition: ad9361_util.h:75
ADF4382_CAL_CT_SEL_MSK
#define ADF4382_CAL_CT_SEL_MSK
Definition: adf4382.h:264
no_os_print_log.h
Print messages helpers.
adf4382_dev::vco_max
uint64_t vco_max
Definition: adf4382.h:525
no_os_div64_u64_rem
uint64_t no_os_div64_u64_rem(uint64_t dividend, uint64_t divisor, uint64_t *remainder)
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:60
NO_OS_ARRAY_SIZE
#define NO_OS_ARRAY_SIZE(x)
Definition: no_os_util.h:53
ADF4382_SPI_SCRATCHPAD_TEST
#define ADF4382_SPI_SCRATCHPAD_TEST
Definition: adf4382.h:436
ID_ADF4382A
@ ID_ADF4382A
Definition: adf4382.h:486
adf4382_init_param
ADF4382 Initialization Parameters structure.
Definition: adf4382.h:493
adf4382_set_bleed_word
int adf4382_set_bleed_word(struct adf4382_dev *dev, int32_t word)
Set the bleed word, which represents the value of the bleed current written to the register space.
Definition: adf4382.c:371
ADF4382_EN_BLEED_MSK
#define ADF4382_EN_BLEED_MSK
Definition: adf4382.h:162
ADF4382_CLK1_OPWR_MSK
#define ADF4382_CLK1_OPWR_MSK
Definition: adf4382.h:205
ADF4382_MOD2WORD_MAX
#define ADF4382_MOD2WORD_MAX
Definition: adf4382.h:448
MHZ
#define MHZ
Definition: adf4382.h:477
ADF4382_VAR_MOD_EN_MSK
#define ADF4382_VAR_MOD_EN_MSK
Definition: adf4382.h:198
adf4382_set_en_sync
int adf4382_set_en_sync(struct adf4382_dev *dev, bool en)
Set the sync to enable or disable based on the passed parameter. If the parameter is different then 0...
Definition: adf4382.c:521
adf4382_get_out_power
int adf4382_get_out_power(struct adf4382_dev *dev, uint8_t ch, int32_t *pwr)
Gets the output power register value.
Definition: adf4382.c:444
ADF4382_REF_CLK_MIN
#define ADF4382_REF_CLK_MIN
Definition: adf4382.h:464
ADF4382_VCO_FREQ_MAX
#define ADF4382_VCO_FREQ_MAX
Definition: adf4382.h:444
ADF4382_FRAC1WORD_MID_MSK
#define ADF4382_FRAC1WORD_MID_MSK
Definition: adf4382.h:114
ADF4382_EN_PHASE_RESYNC_MSK
#define ADF4382_EN_PHASE_RESYNC_MSK
Definition: adf4382.h:152
adf4382_spi_write
int adf4382_spi_write(struct adf4382_dev *dev, uint16_t reg_addr, uint8_t data)
Writes data to ADF4382 over SPI.
Definition: adf4382.c:74
adf4382_dev::spi_3wire_en
bool spi_3wire_en
Definition: adf4382.h:515
no_os_field_prep
uint32_t no_os_field_prep(uint32_t mask, uint32_t val)
adf4382_set_ref_clk
int adf4382_set_ref_clk(struct adf4382_dev *dev, uint64_t val)
Set the desired reference frequency and reset everything over to maximum supported value of 5GHz to t...
Definition: adf4382.c:207
adf4382_get_ref_div
int adf4382_get_ref_div(struct adf4382_dev *dev, int32_t *div)
Gets the value the reference divider.
Definition: adf4382.c:305
adf4382_set_ref_clk
int adf4382_set_ref_clk(struct adf4382_dev *dev, uint64_t val)
Set the desired reference frequency and reset everything over to maximum supported value of 5GHz to t...
Definition: adf4382.c:207
no_os_error.h
Error codes definition.
ADF4382_FRAC1WORD_MSB
#define ADF4382_FRAC1WORD_MSB
Definition: adf4382.h:125
NO_OS_DIV_ROUND_UP
#define NO_OS_DIV_ROUND_UP(x, y)
Definition: no_os_util.h:56
ADF4382_DCLK_MODE_MSK
#define ADF4382_DCLK_MODE_MSK
Definition: adf4382.h:265
ADF4382_N_INT_LSB_MSK
#define ADF4382_N_INT_LSB_MSK
Definition: adf4382.h:103
ADF4382_OUT_PWR_MAX
#define ADF4382_OUT_PWR_MAX
Definition: adf4382.h:466
adf4382_init_param::cmos_3v3
bool cmos_3v3
Definition: adf4382.h:497
adf4382_dev::phase_adj
uint32_t phase_adj
Definition: adf4382.h:524
adf4382_get_phase_pol
int adf4382_get_phase_pol(struct adf4382_dev *dev, bool *polarity)
Gets the polarity of the phase adjust.
Definition: adf4382.c:1144
ADF4382_LOCKED_MSK
#define ADF4382_LOCKED_MSK
Definition: adf4382.h:429
adf4382_init_param::freq
uint64_t freq
Definition: adf4382.h:499
ADF4382_VCO_CAL_CNT
#define ADF4382_VCO_CAL_CNT
Definition: adf4382.h:471
adf4382_dev
ADF4382 Device Descriptor.
Definition: adf4382.h:512
adf4382_spi_read
int adf4382_spi_read(struct adf4382_dev *dev, uint16_t reg_addr, uint8_t *data)
Reads data from ADF4382 over SPI.
Definition: adf4382.c:104
ADF4382_FRAC2WORD_MID_MSK
#define ADF4382_FRAC2WORD_MID_MSK
Definition: adf4382.h:134
adf4382_get_ref_div
int adf4382_get_ref_div(struct adf4382_dev *dev, int32_t *div)
Gets the value the reference divider.
Definition: adf4382.c:305
adf4382_get_phase_pol
int adf4382_get_phase_pol(struct adf4382_dev *dev, bool *polarity)
Gets the polarity of the phase adjust.
Definition: adf4382.c:1144
NO_OS_DIV_U64
#define NO_OS_DIV_U64(x, y)
Definition: no_os_util.h:113
ADF4382_PD_SYNC_MSK
#define ADF4382_PD_SYNC_MSK
Definition: adf4382.h:211
adf4382_set_en_chan
int adf4382_set_en_chan(struct adf4382_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: adf4382.c:471
reg_sequence::val
uint8_t val
Definition: adf4371.c:193
ADF4382_MOD2WORD_LSB_MSK
#define ADF4382_MOD2WORD_LSB_MSK
Definition: adf4382.h:140
adf4382_set_bleed_word
int adf4382_set_bleed_word(struct adf4382_dev *dev, int32_t word)
Set the bleed word, which represents the value of the bleed current written to the register space.
Definition: adf4382.c:371
ADF4382_CLKOUT_DIV_MSK
#define ADF4382_CLKOUT_DIV_MSK
Definition: adf4382.h:106
ADF4382_SPI_READ_CMD
#define ADF4382_SPI_READ_CMD
Definition: adf4382.h:440
adf4382_remove
int adf4382_remove(struct adf4382_dev *dev)
Free resources allocated for ADF4382.
Definition: adf4382.c:1289
ADF4382_REF_DIV_MAX
#define ADF4382_REF_DIV_MAX
Definition: adf4382.h:465
adf4382_set_cp_i
int adf4382_set_cp_i(struct adf4382_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: adf4382.c:328
no_os_spi_desc::bit_order
enum no_os_spi_bit_order bit_order
Definition: no_os_spi.h:189
ADF4382_DCLK_DIV1_0_MAX
#define ADF4382_DCLK_DIV1_0_MAX
Definition: adf4382.h:454
no_os_spi_desc
Structure holding SPI descriptor.
Definition: no_os_spi.h:177
ADF4382_CP_I_MSK
#define ADF4382_CP_I_MSK
Definition: adf4382.h:163
no_os_clamp
#define no_os_clamp(val, min_val, max_val)
Definition: no_os_util.h:73
adf4382_init_param::ld_count
uint8_t ld_count
Definition: adf4382.h:504
adf4382_dev::ref_doubler_en
bool ref_doubler_en
Definition: adf4382.h:519
ADF4382_VCO_FREQ_MIN
#define ADF4382_VCO_FREQ_MIN
Definition: adf4382.h:443
ADF4382_N_INT_MSB_MSK
#define ADF4382_N_INT_MSB_MSK
Definition: adf4382.h:108
ADF4382A_RFOUT_MAX
#define ADF4382A_RFOUT_MAX
Definition: adf4382.h:461
adf4382_get_en_ref_doubler
int adf4382_get_en_ref_doubler(struct adf4382_dev *dev, bool *en)
Gets the value the doubler if it is enabled or disable and stores it it the dev structure.
Definition: adf4382.c:264
no_os_greatest_common_divisor
uint32_t no_os_greatest_common_divisor(uint32_t a, uint32_t b)
ADF4382_CMOS_OV_MSK
#define ADF4382_CMOS_OV_MSK
Definition: adf4382.h:318
adf4382_set_ref_div
int adf4382_set_ref_div(struct adf4382_dev *dev, int32_t div)
Set the reference divider value and reset everything over to maximum supported value of 63 to the max...
Definition: adf4382.c:286
adf4382_get_en_chan
int adf4382_get_en_chan(struct adf4382_dev *dev, uint8_t ch, bool *en)
Gets the value the output channel if it is enabled or disable.
Definition: adf4382.c:494
ADF4382_POR_DELAY_US
#define ADF4382_POR_DELAY_US
Definition: adf4382.h:474
adf4382_init_param::ref_doubler_en
bool ref_doubler_en
Definition: adf4382.h:500
ADF4382_MOD1WORD
#define ADF4382_MOD1WORD
Definition: adf4382.h:447
adf4382_get_out_power
int adf4382_get_out_power(struct adf4382_dev *dev, uint8_t ch, int32_t *pwr)
Gets the output power register value.
Definition: adf4382.c:444
ADF4382_PHASE_ADJ_MSK
#define ADF4382_PHASE_ADJ_MSK
Definition: adf4382.h:279
ADF4382_FINE_BLEED_MSB_MSK
#define ADF4382_FINE_BLEED_MSB_MSK
Definition: adf4382.h:156
adf4382_init
int adf4382_init(struct adf4382_dev **device, struct adf4382_init_param *init_param)
Initializes the ADF4382.
Definition: adf4382.c:1187
ADF4382A_CLKOUT_DIV_REG_VAL_MAX
#define ADF4382A_CLKOUT_DIV_REG_VAL_MAX
Definition: adf4382.h:457
adf4382_dev::ld_count
uint8_t ld_count
Definition: adf4382.h:523
adf4382_spi_update_bits
int adf4382_spi_update_bits(struct adf4382_dev *dev, uint16_t reg_addr, uint8_t mask, uint8_t data)
Updates the values of the ADF4382 register.
Definition: adf4382.c:142
ADF4382_LKD_DELAY_US
#define ADF4382_LKD_DELAY_US
Definition: adf4382.h:475
adf4382_init_param::cp_i
uint8_t cp_i
Definition: adf4382.h:502
ADF4382A_VCO_FREQ_MAX
#define ADF4382A_VCO_FREQ_MAX
Definition: adf4382.h:446
adf4382_reg_dump
int adf4382_reg_dump(struct adf4382_dev *dev)
Will output on the terminal the values of all the ADF4382 registers.
Definition: adf4382.c:166
ADF4382_DCLK_DIV1_MSK
#define ADF4382_DCLK_DIV1_MSK
Definition: adf4382.h:183
no_os_field_get
uint32_t no_os_field_get(uint32_t mask, uint32_t word)
ADF4382_BUFF_SIZE_BYTES
#define ADF4382_BUFF_SIZE_BYTES
Definition: adf4382.h:442
adf4382_reg_defaults
ADF4382 register initialization.
adf4382_set_phase_adjust
int adf4382_set_phase_adjust(struct adf4382_dev *dev, uint32_t phase_ps)
Set the phase adjustment in pico-seconds. The phase adjust will enable the Bleed current option as we...
Definition: adf4382.c:1060
adf4382_dev::cmos_3v3
bool cmos_3v3
Definition: adf4382.h:516
adf4382_get_rfout
int adf4382_get_rfout(struct adf4382_dev *dev, uint64_t *val)
Gets the user proposed output frequency.
Definition: adf4382.c:596
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:75
ADF4382_LDWIN_PW_MSK
#define ADF4382_LDWIN_PW_MSK
Definition: adf4382.h:228
adf4382_get_ref_clk
int adf4382_get_ref_clk(struct adf4382_dev *dev, uint64_t *val)
Gets the user proposed reference frequency.
Definition: adf4382.c:229
adf4382_get_bleed_word
int adf4382_get_bleed_word(struct adf4382_dev *dev, int32_t *word)
Gets the value of the set bleed word.
Definition: adf4382.c:390
ADF4382_SPI_DUMMY_DATA
#define ADF4382_SPI_DUMMY_DATA
Definition: adf4382.h:441
no_os_udelay
void no_os_udelay(uint32_t usecs)
Wait until usecs microseconds passed.
Definition: aducm3029_delay.c:120
gcd
uint32_t gcd(uint32_t x, uint32_t y)
Computes the greatest common divider of two numbers.
Definition: adf4156.c:215
adf4382_set_freq
int adf4382_set_freq(struct adf4382_dev *dev)
Set the output frequency.
Definition: adf4382.c:794
ADF4382_CLKOUT_DIV_REG_VAL_MAX
#define ADF4382_CLKOUT_DIV_REG_VAL_MAX
Definition: adf4382.h:456
ADF4382_BLEED_WORD_MAX
#define ADF4382_BLEED_WORD_MAX
Definition: adf4382.h:468
adf4382_spi_update_bits
int adf4382_spi_update_bits(struct adf4382_dev *dev, uint16_t reg_addr, uint8_t mask, uint8_t data)
Updates the values of the ADF4382 register.
Definition: adf4382.c:142
ADF4382_CLK2_OPWR_MSK
#define ADF4382_CLK2_OPWR_MSK
Definition: adf4382.h:204
ADF4382_DCLK_DIV1_1_MAX
#define ADF4382_DCLK_DIV1_1_MAX
Definition: adf4382.h:455
adf4382_init_param::bleed_word
uint16_t bleed_word
Definition: adf4382.h:503
ADF4382_PD_CLKOUT2_MSK
#define ADF4382_PD_CLKOUT2_MSK
Definition: adf4382.h:225
adf4382.h
Implementation of adf4382 Driver.
init_param
struct ad7616_init_param init_param
Definition: ad7616_sdz.c:119
ADF4382_R_DIV_MSK
#define ADF4382_R_DIV_MSK
Definition: adf4382.h:168
adf4382_get_en_chan
int adf4382_get_en_chan(struct adf4382_dev *dev, uint8_t ch, bool *en)
Gets the value the output channel if it is enabled or disable.
Definition: adf4382.c:494
ADF4382_SPI_WRITE_CMD
#define ADF4382_SPI_WRITE_CMD
Definition: adf4382.h:439
adf4382_get_en_ref_doubler
int adf4382_get_en_ref_doubler(struct adf4382_dev *dev, bool *en)
Gets the value the doubler if it is enabled or disable and stores it it the dev structure.
Definition: adf4382.c:264
adf4382_spi_read
int adf4382_spi_read(struct adf4382_dev *dev, uint16_t reg_addr, uint8_t *data)
Reads data from ADF4382 over SPI.
Definition: adf4382.c:104
adf4382_init_param::spi_init
struct no_os_spi_init_param * spi_init
Definition: adf4382.h:495
adf4382_spi_write
int adf4382_spi_write(struct adf4382_dev *dev, uint16_t reg_addr, uint8_t data)
Writes data to ADF4382 over SPI.
Definition: adf4382.c:74
adf4382_dev::spi_desc
struct no_os_spi_desc * spi_desc
Definition: adf4382.h:514
ADF4382_SPI_3W_CFG
#define ADF4382_SPI_3W_CFG(x)
Definition: adf4382.h:431
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:122
adf4382_get_ref_clk
int adf4382_get_ref_clk(struct adf4382_dev *dev, uint64_t *val)
Gets the user proposed reference frequency.
Definition: adf4382.c:229
adf4382_set_en_ref_doubler
int adf4382_set_en_ref_doubler(struct adf4382_dev *dev, bool en)
Set the reference doubler to enable or disable based on the passed parameter. If the parameter is dif...
Definition: adf4382.c:247
adf4382_set_phase_pol
int adf4382_set_phase_pol(struct adf4382_dev *dev, bool polarity)
Set the phase polarity. If pol = 0 then it will add the phase value otherwise it will subtract the ph...
Definition: adf4382.c:1128
adf4382_dev::freq_min
uint64_t freq_min
Definition: adf4382.h:528
adf4382_set_phase_pol
int adf4382_set_phase_pol(struct adf4382_dev *dev, bool polarity)
Set the phase polarity. If pol = 0 then it will add the phase value otherwise it will subtract the ph...
Definition: adf4382.c:1128
adf4382_init
int adf4382_init(struct adf4382_dev **dev, struct adf4382_init_param *init_param)
Initializes the ADF4382.
Definition: adf4382.c:1187
ADF4382_FRAC2WORD_MSB_MSK
#define ADF4382_FRAC2WORD_MSB_MSK
Definition: adf4382.h:137
ADF4382_PHASE_BLEED_CNST
#define ADF4382_PHASE_BLEED_CNST
Definition: adf4382.h:470
adf4382_set_out_power
int adf4382_set_out_power(struct adf4382_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: adf4382.c:420
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:58
ADF4382_BLEED_MSB_MSK
#define ADF4382_BLEED_MSB_MSK
Definition: adf4382.h:433
no_os_util.h
Header file of utility functions.
ADF4382_CHANNEL_SPACING_MAX
#define ADF4382_CHANNEL_SPACING_MAX
Definition: adf4382.h:450
ADF4382A_VCO_FREQ_MIN
#define ADF4382A_VCO_FREQ_MIN
Definition: adf4382.h:445
adf4382_set_cp_i
int adf4382_set_cp_i(struct adf4382_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: adf4382.c:328
adf4382_dev::bleed_word
uint16_t bleed_word
Definition: adf4382.h:522
adf4382_set_en_ref_doubler
int adf4382_set_en_ref_doubler(struct adf4382_dev *dev, bool en)
Set the reference doubler to enable or disable based on the passed parameter. If the parameter is dif...
Definition: adf4382.c:247
ID_ADF4382
@ ID_ADF4382
Definition: adf4382.h:485
ADF4382_RESET_CMD
#define ADF4382_RESET_CMD
Definition: adf4382.h:55
reg_sequence::reg
uint16_t reg
Definition: adf4371.c:192
ADF4382_MOD2WORD_MID_MSK
#define ADF4382_MOD2WORD_MID_MSK
Definition: adf4382.h:143
S_TO_NS
#define S_TO_NS
Definition: adf4382.h:478
ADF4382_PD_CLKOUT1_MSK
#define ADF4382_PD_CLKOUT1_MSK
Definition: adf4382.h:224
ADF4382_LD_COUNT_OPWR_MSK
#define ADF4382_LD_COUNT_OPWR_MSK
Definition: adf4382.h:229
no_os_bit_swap_constant_8
#define no_os_bit_swap_constant_8(x)
Definition: no_os_util.h:100
adf4382_set_rfout
int adf4382_set_rfout(struct adf4382_dev *dev, uint64_t val)
Set the desired output frequency and reset everything over to maximum supported value of 22GHz (21GHz...
Definition: adf4382.c:558
adf4382_dev::ref_freq_hz
uint64_t ref_freq_hz
Definition: adf4382.h:517
adf4382_dev::freq_max
uint64_t freq_max
Definition: adf4382.h:527
adf4382_set_phase_adjust
int adf4382_set_phase_adjust(struct adf4382_dev *dev, uint32_t phase_ps)
Set the phase adjustment in pico-seconds. The phase adjust will enable the Bleed current option as we...
Definition: adf4382.c:1060
adf4382_get_cp_i
int adf4382_get_cp_i(struct adf4382_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: adf4382.c:349
NO_OS_DIV_ROUND_CLOSEST
#define NO_OS_DIV_ROUND_CLOSEST(x, y)
Definition: no_os_util.h:58
ADF4382_MOD2WORD_MSB_MSK
#define ADF4382_MOD2WORD_MSB_MSK
Definition: adf4382.h:146
no_os_spi_init_param
Structure holding the parameters for SPI initialization.
Definition: no_os_spi.h:131
adf4382_set_ref_div
int adf4382_set_ref_div(struct adf4382_dev *dev, int32_t div)
Set the reference divider value and reset everything over to maximum supported value of 63 to the max...
Definition: adf4382.c:286
no_os_div_u64
uint64_t no_os_div_u64(uint64_t dividend, uint32_t divisor)