Go to the documentation of this file.
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
55 #define ADF4368_SDO_ACTIVE_SPI_3W 0x0
56 #define ADF4368_SDO_ACTIVE_SPI_4W 0x1
58 #define ADF4368_ADDR_ASC_AUTO_DECR 0x0
59 #define ADF4368_ADDR_ASC_AUTO_INCR 0x1
61 #define ADF4368_LSB_FIRST_MSB 0x0
62 #define ADF4368_LSB_FIRST_LSB 0x1
64 #define ADF4368_SOFT_RESET_N_OP 0x0
65 #define ADF4368_SOFT_RESET_EN 0x1
68 #define ADF4368_SINGLE_INSTR_MSK NO_OS_BIT(7)
69 #define ADF4368_MASTER_RB_CTRL_MSK NO_OS_BIT(5)
71 #define ADF4368_SPI_STREAM_EN 0x0
72 #define ADF4368_SPI_STREAM_DIS 0x1
75 #define ADF4368_CHIP_TYPE 0x06
78 #define ADF4368_PRODUCT_ID_LSB 0x0005
81 #define ADF4368_PRODUCT_ID_MSB 0x0005
84 #define ADF4368_SCRATCHPAD_MSK NO_OS_GENMASK(7, 0)
87 #define ADF4368_N_INT_LSB_MSK NO_OS_GENMASK(7, 0)
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)
96 #define ADF4368_FRAC1WORD_LSB_MSK NO_OS_GENMASK(7, 0)
99 #define ADF4368_FRAC1WORD_MID_MSK NO_OS_GENMASK(7, 0)
102 #define ADF4368_FRAC1WORD_MSB_MSK NO_OS_GENMASK(7, 0)
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)
112 #define ADF4368_M_VCO_BAND_MSK NO_OS_GENMASK(7, 0)
115 #define ADF4368_FRAC2WORD_LSB_MSK NO_OS_GENMASK(7, 0)
118 #define ADF4368_FRAC2WORD_MID_MSK NO_OS_GENMASK(7, 0)
121 #define ADF4368_FRAC2WORD_MSB_MSK NO_OS_GENMASK(7, 0)
124 #define ADF4368_MOD2WORD_LSB_MSK NO_OS_GENMASK(7, 0)
127 #define ADF4368_MOD2WORD_MID_MSK NO_OS_GENMASK(7, 0)
130 #define ADF4368_MOD2WORD_MSB_MSK NO_OS_GENMASK(7, 0)
133 #define ADF4368_FINE_BLEED_LSB_MSK NO_OS_GENMASK(7, 0)
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)
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)
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)
155 #define ADF4368_PHASE_WORD_LSB_MSK NO_OS_GENMASK(7, 0)
158 #define ADF4368_PHASE_WORD_MID_MSK NO_OS_GENMASK(7, 0)
161 #define ADF4368_PHASE_WORD_MSB_MSK NO_OS_GENMASK(7, 0)
164 #define ADF4368_PHASE_ADJUSTMENT_MSK NO_OS_GENMASK(7, 0)
167 #define ADF4368_RESYNC_WAIT_LSB_MSK NO_OS_GENMASK(7, 0)
170 #define ADF4368_RESYNC_WAIT_MID_MSK NO_OS_GENMASK(7, 0)
173 #define ADF4368_RESYNC_WAIT_MSB_MSK NO_OS_GENMASK(7, 0)
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)
184 #define ADF4368_CLK2_OPWR_MSK NO_OS_GENMASK(7, 4)
185 #define ADF4368_CLK1_OPWR_MSK NO_OS_GENMASK(3, 0)
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)
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)
209 #define ADF4368_LDWIN_PW_MSK NO_OS_GENMASK(7, 5)
210 #define ADF4368_LD_COUNT_MSK NO_OS_GENMASK(4, 0)
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)
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)
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)
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)
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)
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)
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)
264 #define ADF4368_VCO_BAND_DIV NO_OS_GENMASK(7, 0)
267 #define ADF4368_SYNTH_LOCK_TIMEOUT_LSB_MSK NO_OS_GENMASK(7, 0)
270 #define ADF4368_O_VCO_DB_MSK NO_OS_BIT(7)
271 #define ADF4368_SYNTH_LOCK_TIMEOUT_MSB_MSK NO_OS_GENMASK(6, 0)
275 #define ADF4368_VCO_ALC_TIMEOUT_LSB_MSK NO_OS_GENMASK(7, 0)
278 #define ADF4368_DEL_CTRL_DB_MSK NO_OS_BIT(7)
279 #define ADF4368_VCO_ALC_TIMEOUT_MSB_MSK NO_OS_GENMASK(6, 0)
282 #define ADF4368_ADC_CLK_DIV_MSK NO_OS_GENMASK(7, 0)
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)
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)
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)
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)
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)
323 #define ADF4368_REG54_RSV1 NO_OS_GENMASK(7, 1)
324 #define ADF4368_ADC_ST_CNV_MSK NO_OS_BIT(1)
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)
337 #define ADF4368_REG5A_RSV1 NO_OS_GENMASK(7, 2)
338 #define ADF4368_VCO_CORE_MSK NO_OS_GENMASK(1, 0)
341 #define ADF4368_CHIP_TEMP_LSB_MSK NO_OS_GENMASK(7, 0)
344 #define ADF4368_REG5C_RSV1 NO_OS_GENMASK(7, 1)
345 #define ADF4368_CHIP_TEMP_MSB_MSK NO_OS_BIT(0)
348 #define ADF4368_VCO_BAND_MSK NO_OS_GENMASK(7, 0)
351 #define ADF4368_REG60_RSV1 NO_OS_GENMASK(7, 4)
352 #define ADF4368_VCO_BIAS_MSK NO_OS_GENMASK(3, 0)
355 #define ADF4368_VERSION_MSK NO_OS_GENMASK(7, 0)
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))
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))
365 #define ADF4368_BLEED_MSB_MSK (ADF4368_COARSE_BLEED_MSK | \
366 ADF4368_FINE_BLEED_MSB_MSK)
368 #define ADF4368_SPI_SCRATCHPAD_TEST 0x5A
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
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
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
405 #define ADF4368_SIGMA_DELTA_MOD_CNST 4096 // 250ua
407 #define ADF4368_POR_DELAY_US 200
408 #define ADF4368_LKD_DELAY_MS 9
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
472 uint8_t mask, uint8_t data);
#define KILO
Definition: no_os_units.h:43
#define ADF4368_REF_DIV_MAX
Definition: adf4368.h:391
uint64_t vco_min
Definition: adf4368.h:457
uint8_t ref_div
Definition: adf4368.h:449
int adf4368_get_ref_clk(struct adf4368_dev *dev, uint64_t *val)
Gets the user proposed reference frequency.
Definition: adf4368.c:716
#define ADF4368_NS_TO_PS
Definition: adf4368.h:412
@ false
Definition: ad5446.h:56
#define ADF4368_ADC_CLK_DIV_MSK
Definition: adf4368.h:282
#define ADF4368_MOD1WORD
Definition: adf4368.h:377
int adf4368_init(struct adf4368_dev **device, struct adf4368_init_param *init_param)
Initializes the adf4368.
Definition: adf4368.c:1893
#define ADF4368_DCLK_DIV1_1_MAX
Definition: adf4368.h:384
#define ADF4368_FRAC1WORD_MSB
Definition: adf4368.h:109
int adf4368_set_freq(struct adf4368_dev *dev)
Set the output frequency.
Definition: adf4368.c:1632
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
int adf4368_set_freq(struct adf4368_dev *dev)
Set the output frequency.
Definition: adf4368.c:1632
#define ADF4368_CPI_VAL_MAX
Definition: adf4368.h:393
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
#define ADF4368_EN_RDBLR_MSK
Definition: adf4368.h:151
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
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
#define ADF4368_INT_MODE_MSK
Definition: adf4368.h:91
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
#define ADF4368_N_INT_LSB_MSK
Definition: adf4368.h:87
#define ADF4368_LKD_DELAY_MS
Definition: adf4368.h:408
#define ADF4368_PHASE_ADJ_MSK
Definition: adf4368.h:144
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
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
uint8_t clkout_div_reg_val_max
Definition: adf4368.h:452
Header file of SPI Interface.
#define ADF4368_EN_ADC_CLK_MSK
Definition: adf4368.h:244
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
#define ADF4368_SPI_LSB_CFG(x)
Definition: adf4368.h:362
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
#define pr_err(fmt, args...)
Definition: no_os_print_log.h:88
#define ADF4368_EN_BLEED_MSK
Definition: adf4368.h:146
#define ADF4368_CLKOUT_DIV_MSK
Definition: adf4368.h:90
#define ADF4368_EN_PHASE_RESYNC_MSK
Definition: adf4368.h:136
#define ADF4368_N_INT_MSB_MSK
Definition: adf4368.h:93
#define ADF4368_US_TO_FS
Definition: adf4368.h:418
#define ADF4368_PS_TO_S
Definition: adf4368.h:417
Header file of Delay functions.
bool ref_doubler_en
Definition: adf4368.h:448
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
#define pr_info(fmt, args...)
Definition: no_os_print_log.h:115
#define ADF4368_CLK2_OPWR_MSK
Definition: adf4368.h:184
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
#define ADF4368_PHASE_RESYNC_MOD2WORD_MAX
Definition: adf4368.h:379
#define NO_OS_DIV_ROUND_CLOSEST_ULL(x, y)
Definition: no_os_util.h:56
int adf4368_get_rfout(struct adf4368_dev *dev, uint64_t *val)
Gets the user proposed output frequency.
Definition: adf4368.c:1017
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
#define ADF4368_CHIP_TEMP_MSB_MSK
Definition: adf4368.h:345
#define MICROAMPER_PER_AMPER
Definition: no_os_units.h:64
Definition: ad9361_util.h:69
bool cmos_3v3
Definition: adf4368.h:429
#define ADF4368_VCO_FREQ_MIN
Definition: adf4368.h:375
#define ADF4368_DNCLK_DEL_MSK
Definition: adf4368.h:239
uint64_t no_os_div64_u64_rem(uint64_t dividend, uint64_t divisor, uint64_t *remainder)
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
uint64_t freq
Definition: adf4368.h:461
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
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
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
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
#define NO_OS_ARRAY_SIZE(x)
Definition: no_os_util.h:49
#define ADF4368_REF_CLK_MAX
Definition: adf4368.h:389
uint8_t cp_i
Definition: adf4368.h:432
#define ADF4368_DCLK_DIV1_0_MAX
Definition: adf4368.h:383
#define ADF4368_FRAC_N_INT_MIN
Definition: adf4368.h:395
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
#define ADF4368_OUT_PWR_MAX
Definition: adf4368.h:392
int adf4368_get_sync_setup(struct adf4368_dev *dev, bool *en)
Gets the value of the SYNC features' powerdown bit.
Definition: adf4368.c:1188
#define ADF4368_EN_REF_RST_MSK
Definition: adf4368.h:137
#define ADF4368_PD_CLKOUT2_MSK
Definition: adf4368.h:206
uint64_t freq_min
Definition: adf4368.h:459
int adf4368_init(struct adf4368_dev **dev, struct adf4368_init_param *init_param)
Initializes the adf4368.
Definition: adf4368.c:1893
#define MICRO
Definition: no_os_units.h:49
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
void no_os_mdelay(uint32_t msecs)
Wait until msecs milliseconds passed.
Definition: aducm3029_delay.c:126
#define ADF4368_SPI_4W_CFG(x)
Definition: adf4368.h:359
uint32_t no_os_field_prep(uint32_t mask, uint32_t val)
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
#define ADF4368_MOD2WORD_MSB_MSK
Definition: adf4368.h:130
struct no_os_spi_init_param * spi_init
Definition: adf4368.h:427
ADF4368 Device Descriptor.
Definition: adf4368.h:442
uint8_t cp_i
Definition: adf4368.h:450
#define ADF4368_TIMED_SYNC_MSK
Definition: adf4368.h:138
#define ADF4368_PD_SYNC
Definition: adf4368.h:191
#define ADF4368_RFOUT_MAX
Definition: adf4368.h:387
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
#define ADF4368_SPI_READ_CMD
Definition: adf4368.h:372
#define NO_OS_DIV_ROUND_UP(x, y)
Definition: no_os_util.h:52
int adf4368_remove(struct adf4368_dev *dev)
Free resources allocated for ADF4368.
Definition: adf4368.c:1983
#define ADF4368_CMOS_OV_MSK
Definition: adf4368.h:108
int adf4368_get_temperature(struct adf4368_dev *dev, int32_t *temp)
Gets the value of the approximate die temperature.
Definition: adf4368.c:1293
#define ADF4368_PD_CLKOUT1_MSK
Definition: adf4368.h:205
#define ADF4368_SIGMA_DELTA_MOD_CNST
Definition: adf4368.h:405
int16_t bleed_word
Definition: adf4368.h:454
int adf4368_reg_dump(struct adf4368_dev *dev)
Will output on the terminal the values of all the ADF4368 registers.
Definition: adf4368.c:247
int adf4368_reg_dump(struct adf4368_dev *dev)
Will output on the terminal the values of all the ADF4368 registers.
Definition: adf4368.c:247
#define ADF4368_BUFF_SIZE_BYTES
Definition: adf4368.h:374
#define ADF4368_CLK1_OPWR_MSK
Definition: adf4368.h:185
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
#define NO_OS_DIV_U64(x, y)
Definition: no_os_util.h:115
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
#define ADF4368_SPI_SCRATCHPAD_TEST
Definition: adf4368.h:368
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
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
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
#define ADF4368_CLKOUT_DIV_REG_VAL_MAX
Definition: adf4368.h:385
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
#define ADF4368_MHZ
Definition: adf4368.h:410
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
#define ADF4368_MOD2WORD_LSB_MSK
Definition: adf4368.h:124
#define ADF4368_S_TO_NS
Definition: adf4368.h:411
#define ADF4368_MOD2WORD_MID_MSK
Definition: adf4368.h:127
int adf4368_get_temperature(struct adf4368_dev *dev, int32_t *temp)
Gets the value of the approximate die temperature.
Definition: adf4368.c:1293
#define ADF4368_SPI_DUMMY_DATA
Definition: adf4368.h:373
enum no_os_spi_bit_order bit_order
Definition: no_os_spi.h:204
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
Structure holding SPI descriptor.
Definition: no_os_spi.h:192
#define ADF4368_EN_DRCLK_MSK
Definition: adf4368.h:214
#define ADF4368_BLEED_N_INT_TH
Definition: adf4368.h:399
#define no_os_clamp(val, min_val, max_val)
Definition: no_os_util.h:69
#define ADF4368_RESET_CMD
Definition: adf4368.h:52
#define ADF4368_MOD2WORD_MAX
Definition: adf4368.h:378
#define ADF4368_FINE_BLEED_CNST3
Definition: adf4368.h:403
uint32_t no_os_greatest_common_divisor(uint32_t a, uint32_t b)
#define ADF4368_COARSE_BLEED_MSK
Definition: adf4368.h:139
#define ADF4368_DRCLK_DEL_MSK
Definition: adf4368.h:238
#define ADF4368_FINE_BLEED_CNST1
Definition: adf4368.h:401
uint8_t ld_count
Definition: adf4368.h:433
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
int adf4368_get_bleed_word(struct adf4368_dev *dev, int32_t *word)
Gets the value of the bleed word.
Definition: adf4368.c:962
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
#define ADF4368_R_DIV_MSK
Definition: adf4368.h:152
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
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
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
#define ADF4368_FRAC1WORD_MSB_MSK
Definition: adf4368.h:102
uint64_t ref_freq_hz
Definition: adf4368.h:434
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
uint8_t ld_count
Definition: adf4368.h:451
uint32_t no_os_field_get(uint32_t mask, uint32_t word)
int adf4368_get_sync_setup(struct adf4368_dev *dev, bool *en)
Gets the value of the SYNC features' powerdown bit.
Definition: adf4368.c:1188
Implementation of ADF4368 Driver.
#define ADF4368_COARSE_BLEED_CNST
Definition: adf4368.h:400
#define ADF4368_REF_CLK_MIN
Definition: adf4368.h:390
bool phase_pol
Definition: adf4368.h:447
#define ADF4368_VCO_FREQ_MAX
Definition: adf4368.h:376
#define ADF4368_LD_COUNT_MSK
Definition: adf4368.h:210
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 ADF4368_FINE_BLEED_LSB_MSK
Definition: adf4368.h:133
int adf4368_get_bleed_word(struct adf4368_dev *dev, int32_t *word)
Gets the value of the bleed word.
Definition: adf4368.c:962
#define ADF4368_RFOUT_MIN
Definition: adf4368.h:388
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
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
uint64_t vco_max
Definition: adf4368.h:456
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
uint64_t freq
Definition: adf4368.h:435
void no_os_udelay(uint32_t usecs)
Wait until usecs microseconds passed.
Definition: aducm3029_delay.c:114
uint32_t gcd(uint32_t x, uint32_t y)
Computes the greatest common divider of two numbers.
Definition: adf4156.c:208
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
int adf4368_get_ref_div(struct adf4368_dev *dev, int32_t *div)
Gets the value the reference divider.
Definition: adf4368.c:795
#define ADF4368_BLEED_WORD_MAX
Definition: adf4368.h:394
ADF4368 Initialization Parameters structure.
Definition: adf4368.h:425
struct ad7616_init_param init_param
Definition: ad7616_sdz.c:113
ADF4368 register initialization.
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
#define ADF4368_FRAC2WORD_MID_MSK
Definition: adf4368.h:118
uint64_t ref_freq_hz
Definition: adf4368.h:460
int adf4368_get_rfout(struct adf4368_dev *dev, uint64_t *val)
Gets the user proposed output frequency.
Definition: adf4368.c:1017
#define ADF4368_BLEED_MSB_MSK
Definition: adf4368.h:365
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
#define ADF4368_FINE_BLEED_MSB_MSK
Definition: adf4368.h:140
#define ADF4368_POR_DELAY_US
Definition: adf4368.h:407
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
#define ADF4368_ADC_ST_CNV_MSK
Definition: adf4368.h:324
#define ADF4368_INT_N_INT_MIN
Definition: adf4368.h:396
int adf4368_remove(struct adf4368_dev *dev)
Free resources allocated for ADF4368.
Definition: adf4368.c:1983
@ true
Definition: ad5446.h:57
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
#define ADF4368_SYNC_SEL_MSK
Definition: adf4368.h:318
#define ADF4368_NS_TO_S
Definition: adf4368.h:419
#define ADF4368_CP_I_MSK
Definition: adf4368.h:147
#define ADF4368_FRAC2WORD_MSB_MSK
Definition: adf4368.h:121
bool spi_4wire_en
Definition: adf4368.h:428
struct no_os_spi_desc * spi_desc
Definition: adf4368.h:444
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
#define ADF4368_SPI_WRITE_CMD
Definition: adf4368.h:371
#define ADF4368_DCLK_DIV1_MSK
Definition: adf4368.h:309
#define ADF4368_LDWIN_PW_MSK
Definition: adf4368.h:209
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
bool spi_4wire_en
Definition: adf4368.h:445
#define MEGA
Definition: no_os_units.h:42
Header file of utility functions.
#define ADF4368_FRAC1WORD_MID_MSK
Definition: adf4368.h:99
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
uint64_t freq_max
Definition: adf4368.h:458
#define ADF4368_FRAC1WORD_LSB_MSK
Definition: adf4368.h:96
uint16_t n_int
Definition: adf4368.h:453
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
#define ADF4368_BLEED_POL_MSK
Definition: adf4368.h:145
#define ADF4368_FINE_BLEED_CNST2
Definition: adf4368.h:402
#define ADF4368_SYNC_DEL_MSK
Definition: adf4368.h:242
uint32_t phase_adj
Definition: adf4368.h:455
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
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
#define ADF4368_VAR_MOD_EN_MSK
Definition: adf4368.h:178
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
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
#define ADF4368_CHANNEL_SPACING_MAX
Definition: adf4368.h:380
#define no_os_bit_swap_constant_8(x)
Definition: no_os_util.h:102
#define ADF4368_DCLK_MODE_MSK
Definition: adf4368.h:252
#define ADF4368_SW_SYNC_MSK
Definition: adf4368.h:143
uint8_t ref_div
Definition: adf4368.h:431
int adf4368_get_ref_clk(struct adf4368_dev *dev, uint64_t *val)
Gets the user proposed reference frequency.
Definition: adf4368.c:716
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
#define ADF4368_LOCKED_MSK
Definition: adf4368.h:334
#define ADF4368_FRAC2WORD_LSB_MSK
Definition: adf4368.h:115
#define NO_OS_DIV_ROUND_CLOSEST(x, y)
Definition: no_os_util.h:54
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
bool ref_doubler_en
Definition: adf4368.h:430
bool cmos_3v3
Definition: adf4368.h:446
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
Structure holding the parameters for SPI initialization.
Definition: no_os_spi.h:140
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
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
int adf4368_get_ref_div(struct adf4368_dev *dev, int32_t *div)
Gets the value the reference divider.
Definition: adf4368.c:795
uint64_t no_os_div_u64(uint64_t dividend, uint32_t divisor)