42#define ADF4157_MUXOUT_Z (0x00 << 27)
43#define ADF4157_MUXOUT_DVdd (0x01 << 27)
44#define ADF4157_MUXOUT_DGND (0x02 << 27)
45#define ADF4157_MUXOUT_RDIV (0x03 << 27)
46#define ADF4157_MUXOUT_NDIV (0x04 << 27)
47#define ADF4157_MUXOUT_ALOCK (0x05 << 27)
48#define ADF4157_MUXOUT_DLOCK (0x06 << 27)
49#define ADF4157_MUXOUT_SDO (0x07 << 27)
50#define ADF4157_MUXOUT_CLKDIV (0x0A << 27)
51#define ADF4157_MUXOUT_FLS (0x0C << 27)
52#define ADF4157_MUXOUT_RDIV2 (0x0D << 27)
53#define ADF4157_MUXOUT_NDIV2 (0x0E << 27)
54#define ADF4157_MUXOUT_RESERVED (0x0F << 27)
56#define ADF4157_INT_VAL(x) ((x & 0xFFF) << 15)
58#define ADF4157_FRAC_VAL_MSB(x) ((x & 0x1FFE000) >> 10)
60#define ADF4157_R0_CTRL 0x00
63#define ADF4157_FRAC_VAL_LSB(x) ((x & 0x1FFF) << 15)
64#define ADF4157_R1_CTRL 0x01
68#define ADF4157_LOW_NOISE (0x00 << 29)
69#define ADF4157_LOW_SPUR (0x03 << 29)
71#define ADF4157_CSR_EN(x) ((x & 0x1) << 28)
73#define ADF4157_CURR_SET(x) ((x & 0xF) << 24)
75#define ADF4157_PRESCALER(x) ((x & 0x1) << 22)
77#define ADF4157_RDIV2(x) ((x & 0x1) << 21)
79#define ADF4157_REF_DBL(x) ((x & 0x1) << 20)
81#define ADF4157_R_CNT(x) ((x & 0x1F) << 15)
83#define ADF4157_R2_CTRL 0x02
87#define ADF4157_SIG_DEL_RST(x) ((x & 0x1) << 14)
89#define ADF4157_LDP(x) ((x & 0x1) << 7)
91#define ADF4157_PD_POL(x) ((x & 0x1) << 6)
93#define ADF4157_PD ((x & 0x1) << 5)
95#define ADF4157_CP_Z(x) ((x & 0x1) << 4)
97#define ADF4157_CNT_RST(x) ((x & 0x1) << 3)
99#define ADF4157_R3_CTRL 0x03
103#define ADF4157_NEG_BLEED_CUR(x) ((x && 0x3) << 23)
105#define ADF4157_CLK_DIV_OFF (0x00 << 19)
106#define ADF4157_CLK_FAST_LOCK (0x01 << 19)
107#define ADF4157_CLK_RESYNC_EN (0x02 << 19)
109#define ADF4157_CLK_DIV_VAL(x) ((x & 0xFFF) << 7)
111#define ADF4157_R4_CTRL 0x04
114#define ADF4157_LE_OUT no_os_gpio_direction_output(dev->gpio_le, \
114#define ADF4157_LE_OUT no_os_gpio_direction_output(dev->gpio_le, \ …
116#define ADF4157_LE_LOW no_os_gpio_set_value(dev->gpio_le, \
116#define ADF4157_LE_LOW no_os_gpio_set_value(dev->gpio_le, \ …
118#define ADF4157_LE_HIGH no_os_gpio_set_value(dev->gpio_le, \
118#define ADF4157_LE_HIGH no_os_gpio_set_value(dev->gpio_le, \ …
121#define ADF4157_MUX_OUT no_os_gpio_direction_output(dev->gpio_mux, \
121#define ADF4157_MUX_OUT no_os_gpio_direction_output(dev->gpio_mux, \ …
123#define ADF4157_MUX_LOW no_os_gpio_set_value(dev->gpio_mux, \
123#define ADF4157_MUX_LOW no_os_gpio_set_value(dev->gpio_mux, \ …
125#define ADF4157_MUX_HIGH no_os_gpio_set_value(dev->gpio_mux, \
125#define ADF4157_MUX_HIGH no_os_gpio_set_value(dev->gpio_mux, \ …
128#define ADF4157_CE_OUT no_os_gpio_direction_output(dev->gpio_ce, \
128#define ADF4157_CE_OUT no_os_gpio_direction_output(dev->gpio_ce, \ …
130#define ADF4157_CE_LOW no_os_gpio_set_value(dev->gpio_ce, \
130#define ADF4157_CE_LOW no_os_gpio_set_value(dev->gpio_ce, \ …
132#define ADF4157_CE_HIGH no_os_gpio_set_value(dev->gpio_ce, \
132#define ADF4157_CE_HIGH no_os_gpio_set_value(dev->gpio_ce, \ …
135#define ADF4157_LE2_OUT no_os_gpio_direction_output(dev->gpio_le2, \
135#define ADF4157_LE2_OUT no_os_gpio_direction_output(dev->gpio_le2, \ …
137#define ADF4157_LE2_LOW no_os_gpio_set_value(dev->gpio_le2, \
137#define ADF4157_LE2_LOW no_os_gpio_set_value(dev->gpio_le2, \ …
139#define ADF4157_LE2_HIGH no_os_gpio_set_value(dev->gpio_le2, \
139#define ADF4157_LE2_HIGH no_os_gpio_set_value(dev->gpio_le2, \ …
142#define ADF4157_CE2_OUT no_os_gpio_direction_output(dev->gpio_ce2, \
142#define ADF4157_CE2_OUT no_os_gpio_direction_output(dev->gpio_ce2, \ …
144#define ADF4157_CE2_LOW no_os_gpio_set_value(dev->gpio_ce2, \
144#define ADF4157_CE2_LOW no_os_gpio_set_value(dev->gpio_ce2, \ …
146#define ADF4157_CE2_HIGH no_os_gpio_set_value(dev->gpio_ce2, \
146#define ADF4157_CE2_HIGH no_os_gpio_set_value(dev->gpio_ce2, \ …
150#define ADF4157_MAX_OUT_FREQ 6000
151#define ADF4157_MIN_OUT_FREQ 500
152#define ADF4157_MAX_FREQ_45_PRESC 3000
153#define ADF4157_MAX_FREQ_PFD 32000000
154#define ADF4157_MAX_FREQ_REFIN 300000000
155#define ADF4157_MIN_FREQ_REFIN 10000000
156#define ADF4157_FIXED_MODULUS 33554432
157#define ADF4157_MAX_R_CNT 32
158#define ADF4157_MAX_REG_VAL 0x1FFFFFFF
161#define ADF4157_REG0 0
162#define ADF4157_REG1 1
163#define ADF4157_REG2 2
164#define ADF4157_REG3 3
165#define ADF4157_REG4 4
223uint32_t
gcd(uint32_t x, uint32_t y);
struct ad7616_init_param init_param
Definition ad7616_sdz.c:107
int32_t adf4157_remove(struct adf4157_dev *dev)
Free the resources allocated by adf4157_init().
Definition adf4157.c:128
int32_t adf4157_tune_r_cnt(struct adf4157_dev *dev, int32_t r_cnt)
Increases the R counter value until the PFD frequency is smaller than ADF4351_MAX_FREQ_PFD.
Definition adf4157.c:182
int8_t adf4157_set(struct adf4157_dev *dev, uint32_t value)
Transmits 32 bits on SPI.
Definition adf4157.c:149
uint32_t gcd(uint32_t x, uint32_t y)
Computes the greatest common divider of two numbers.
Definition adf4156.c:204
int8_t adf4157_init(struct adf4157_dev **device, struct adf4157_init_param init_param)
Initialize the SPI communication with the device.
Definition adf4157.c:49
double adf4157_set_freq(struct adf4157_dev *dev, double freq)
Sets the ADF4157 output frequency.
Definition adf4157.c:222
Header file of GPIO Interface.
Header file of SPI Interface.
struct no_os_gpio_desc * gpio_ce
Definition adf4157.h:193
struct no_os_gpio_desc * gpio_le
Definition adf4157.h:192
struct no_os_spi_desc * spi_desc
Definition adf4157.h:190
struct adf4157_state adf4157_st
Definition adf4157.h:195
struct no_os_spi_init_param spi_init
Definition adf4157.h:200
struct no_os_gpio_init_param gpio_ce
Definition adf4157.h:203
struct no_os_gpio_init_param gpio_le
Definition adf4157.h:202
uint16_t r_cnt
Definition adf4157.h:180
float channel_spacing
Definition adf4157.h:184
uint32_t r2_mod
Definition adf4157.h:183
uint32_t reg_val[5]
Definition adf4157.h:185
struct adf4157_platform_data * pdata
Definition adf4157.h:178
uint32_t r0_fract
Definition adf4157.h:181
uint32_t fpfd
Definition adf4157.h:179
uint32_t r0_int
Definition adf4157.h:182
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