42#define ADF4156_MUXOUT_Z (0x00 << 27)
43#define ADF4156_MUXOUT_DVdd (0x01 << 27)
44#define ADF4156_MUXOUT_DGND (0x02 << 27)
45#define ADF4156_MUXOUT_RDIV (0x03 << 27)
46#define ADF4156_MUXOUT_NDIV (0x04 << 27)
47#define ADF4156_MUXOUT_ALOCK (0x05 << 27)
48#define ADF4156_MUXOUT_DLOCK (0x06 << 27)
49#define ADF4156_MUXOUT_SDO (0x07 << 27)
50#define ADF4156_MUXOUT_CLKDIV (0x0A << 27)
51#define ADF4156_MUXOUT_FLS (0x0C << 27)
52#define ADF4156_MUXOUT_RDIV2 (0x0D << 27)
53#define ADF4156_MUXOUT_NDIV2 (0x0E << 27)
54#define ADF4156_MUXOUT_RESERVED (0x0F << 27)
56#define ADF4156_INT_VAL(x) ((x & 0xFFF) << 15)
58#define ADF4156_FRAC_VAL(x) ((x & 0xFFF) << 3)
60#define ADF4156_R0_CTRL 0x00
63#define ADF4156_PHASE_VAL(x) ((x & 0xFFF) << 3)
64#define ADF4156_R1_CTRL 0x01
68#define ADF4156_LOW_NOISE (0x00 << 29)
69#define ADF4156_LOW_SPUR (0x03 << 29)
71#define ADF4156_CSR_EN(x) ((x & 0x1) << 28)
73#define ADF4156_CURR_SET(x) ((x & 0xF) << 24)
75#define ADF4156_PRESCALER(x) ((x & 0x1) << 22)
77#define ADF4156_RDIV2(x) ((x & 0x1) << 21)
79#define ADF4156_REF_DBL(x) ((x & 0x1) << 20)
81#define ADF4156_R_CNT(x) ((x & 0x1F) << 15)
83#define ADF4156_MOD_WORD(x) ((x & 0xFFF) << 3)
85#define ADF4156_R2_CTRL 0x02
89#define ADF4156_SIG_DEL_RST(x) ((x & 0x1) << 14)
91#define ADF4156_LDP(x) ((x & 0x1) << 7)
93#define ADF4156_PD_POL(x) ((x & 0x1) << 6)
95#define ADF4156_PD ((x & 0x1) << 5)
97#define ADF4156_CP_Z(x) ((x & 0x1) << 4)
99#define ADF4156_CNT_RST(x) ((x & 0x1) << 3)
101#define ADF4156_R3_CTRL 0x03
105#define ADF4156_CLK_DIV_OFF (0x00 << 19)
106#define ADF4156_CLK_FAST_LOCK (0x01 << 19)
107#define ADF4156_CLK_RESYNC_EN (0x02 << 19)
109#define ADF4156_CLK_DIV_VAL(x) ((x & 0xFFF) << 7)
111#define ADF4156_R4_CTRL 0x04
114#define ADF4156_LE_OUT no_os_gpio_direction_output(dev->gpio_le, \
114#define ADF4156_LE_OUT no_os_gpio_direction_output(dev->gpio_le, \ …
116#define ADF4156_LE_LOW no_os_gpio_set_value(dev->gpio_le, \
116#define ADF4156_LE_LOW no_os_gpio_set_value(dev->gpio_le, \ …
118#define ADF4156_LE_HIGH no_os_gpio_set_value(dev->gpio_le, \
118#define ADF4156_LE_HIGH no_os_gpio_set_value(dev->gpio_le, \ …
121#define ADF4156_MUX_OUT no_os_gpio_direction_output(dev->gpio_mux, \
121#define ADF4156_MUX_OUT no_os_gpio_direction_output(dev->gpio_mux, \ …
123#define ADF4156_MUX_LOW no_os_gpio_set_value(dev->gpio_mux, \
123#define ADF4156_MUX_LOW no_os_gpio_set_value(dev->gpio_mux, \ …
125#define ADF4156_MUX_HIGH no_os_gpio_set_value(dev->gpio_mux, \
125#define ADF4156_MUX_HIGH no_os_gpio_set_value(dev->gpio_mux, \ …
128#define ADF4156_CE_OUT no_os_gpio_direction_output(dev->gpio_ce, \
128#define ADF4156_CE_OUT no_os_gpio_direction_output(dev->gpio_ce, \ …
130#define ADF4156_CE_LOW no_os_gpio_set_value(dev->gpio_ce, \
130#define ADF4156_CE_LOW no_os_gpio_set_value(dev->gpio_ce, \ …
132#define ADF4156_CE_HIGH no_os_gpio_set_value(dev->gpio_ce, \
132#define ADF4156_CE_HIGH no_os_gpio_set_value(dev->gpio_ce, \ …
135#define ADF4156_LE2_OUT no_os_gpio_direction_output(dev->gpio_le2, \
135#define ADF4156_LE2_OUT no_os_gpio_direction_output(dev->gpio_le2, \ …
137#define ADF4156_LE2_LOW no_os_gpio_set_value(dev->gpio_le2, \
137#define ADF4156_LE2_LOW no_os_gpio_set_value(dev->gpio_le2, \ …
139#define ADF4156_LE2_HIGH no_os_gpio_set_value(dev->gpio_le2, \
139#define ADF4156_LE2_HIGH no_os_gpio_set_value(dev->gpio_le2, \ …
142#define ADF4156_CE2_OUT no_os_gpio_direction_output(dev->gpio_ce2, \
142#define ADF4156_CE2_OUT no_os_gpio_direction_output(dev->gpio_ce2, \ …
144#define ADF4156_CE2_LOW no_os_gpio_set_value(dev->gpio_ce2, \
144#define ADF4156_CE2_LOW no_os_gpio_set_value(dev->gpio_ce2, \ …
146#define ADF4156_CE2_HIGH no_os_gpio_set_value(dev->gpio_ce2, \
146#define ADF4156_CE2_HIGH no_os_gpio_set_value(dev->gpio_ce2, \ …
150#define ADF4156_MAX_OUT_FREQ 6200
151#define ADF4156_MIN_OUT_FREQ 500
152#define ADF4156_MAX_FREQ_45_PRESC 3000
153#define ADF4156_MAX_FREQ_PFD 32000000
154#define ADF4156_MAX_FREQ_REFIN 250000000
155#define ADF4156_MIN_FREQ_REFIN 10000000
156#define ADF4156_MAX_MODULUS 4095
157#define ADF4156_MAX_R_CNT 32
158#define ADF4156_MAX_REG_VAL 0x1FFFFFFF
161#define ADF4156_REG0 0
162#define ADF4156_REG1 1
163#define ADF4156_REG2 2
164#define ADF4156_REG3 3
165#define ADF4156_REG4 4
229uint32_t
gcd(uint32_t x, uint32_t y);
struct ad7616_init_param init_param
Definition ad7616_sdz.c:107
int8_t adf4156_set(struct adf4156_dev *dev, uint32_t value)
Transmits 32 bits on SPI.
Definition adf4156.c:151
int8_t adf4156_init(struct adf4156_dev **device, struct adf4156_init_param init_param)
Initialize the SPI communication with the device.
Definition adf4156.c:50
double adf4156_set_freq(struct adf4156_dev *dev, double freq)
Sets the ADF4156 output frequency.
Definition adf4156.c:225
int32_t adf4156_tune_r_cnt(struct adf4156_dev *dev, int32_t r_cnt)
Increases the R counter value until the PFD frequency is smaller than ADF4351_MAX_FREQ_PFD.
Definition adf4156.c:184
uint32_t gcd(uint32_t x, uint32_t y)
Computes the greatest common divider of two numbers.
Definition adf4156.c:204
int32_t adf4156_remove(struct adf4156_dev *dev)
Free the resources allocated by adf4156_init().
Definition adf4156.c:130
Header file of GPIO Interface.
Header file of SPI Interface.
struct adf4156_state adf4156_st
Definition adf4156.h:201
struct no_os_spi_desc * spi_desc
Definition adf4156.h:196
struct no_os_gpio_desc * gpio_le
Definition adf4156.h:198
struct no_os_gpio_desc * gpio_ce
Definition adf4156.h:199
struct no_os_gpio_init_param gpio_ce
Definition adf4156.h:209
struct no_os_gpio_init_param gpio_le
Definition adf4156.h:208
struct no_os_spi_init_param spi_init
Definition adf4156.h:206
struct adf4156_platform_data * pdata
Definition adf4156.h:185
uint32_t reg_val[5]
Definition adf4156.h:191
uint32_t r0_fract
Definition adf4156.h:188
uint32_t r2_mod
Definition adf4156.h:190
uint32_t r0_int
Definition adf4156.h:189
uint16_t r_cnt
Definition adf4156.h:187
uint32_t fpfd
Definition adf4156.h:186
Definition ad9361_util.h:63
Structure holding the GPIO descriptor.
Definition no_os_gpio.h:84
Structure holding the parameters for GPIO initialization.
Definition no_os_gpio.h:67
Structure holding SPI descriptor.
Definition no_os_spi.h:180
Structure holding the parameters for SPI initialization.
Definition no_os_spi.h:128