Go to the documentation of this file.
48 #define ADF4157_MUXOUT_Z (0x00 << 27)
49 #define ADF4157_MUXOUT_DVdd (0x01 << 27)
50 #define ADF4157_MUXOUT_DGND (0x02 << 27)
51 #define ADF4157_MUXOUT_RDIV (0x03 << 27)
52 #define ADF4157_MUXOUT_NDIV (0x04 << 27)
53 #define ADF4157_MUXOUT_ALOCK (0x05 << 27)
54 #define ADF4157_MUXOUT_DLOCK (0x06 << 27)
55 #define ADF4157_MUXOUT_SDO (0x07 << 27)
56 #define ADF4157_MUXOUT_CLKDIV (0x0A << 27)
57 #define ADF4157_MUXOUT_FLS (0x0C << 27)
58 #define ADF4157_MUXOUT_RDIV2 (0x0D << 27)
59 #define ADF4157_MUXOUT_NDIV2 (0x0E << 27)
60 #define ADF4157_MUXOUT_RESERVED (0x0F << 27)
62 #define ADF4157_INT_VAL(x) ((x & 0xFFF) << 15)
64 #define ADF4157_FRAC_VAL_MSB(x) ((x & 0x1FFE000) >> 10)
66 #define ADF4157_R0_CTRL 0x00
69 #define ADF4157_FRAC_VAL_LSB(x) ((x & 0x1FFF) << 15)
70 #define ADF4157_R1_CTRL 0x01
74 #define ADF4157_LOW_NOISE (0x00 << 29)
75 #define ADF4157_LOW_SPUR (0x03 << 29)
77 #define ADF4157_CSR_EN(x) ((x & 0x1) << 28)
79 #define ADF4157_CURR_SET(x) ((x & 0xF) << 24)
81 #define ADF4157_PRESCALER(x) ((x & 0x1) << 22)
83 #define ADF4157_RDIV2(x) ((x & 0x1) << 21)
85 #define ADF4157_REF_DBL(x) ((x & 0x1) << 20)
87 #define ADF4157_R_CNT(x) ((x & 0x1F) << 15)
89 #define ADF4157_R2_CTRL 0x02
93 #define ADF4157_SIG_DEL_RST(x) ((x & 0x1) << 14)
95 #define ADF4157_LDP(x) ((x & 0x1) << 7)
97 #define ADF4157_PD_POL(x) ((x & 0x1) << 6)
99 #define ADF4157_PD ((x & 0x1) << 5)
101 #define ADF4157_CP_Z(x) ((x & 0x1) << 4)
103 #define ADF4157_CNT_RST(x) ((x & 0x1) << 3)
105 #define ADF4157_R3_CTRL 0x03
109 #define ADF4157_NEG_BLEED_CUR(x) ((x && 0x3) << 23)
111 #define ADF4157_CLK_DIV_OFF (0x00 << 19)
112 #define ADF4157_CLK_FAST_LOCK (0x01 << 19)
113 #define ADF4157_CLK_RESYNC_EN (0x02 << 19)
115 #define ADF4157_CLK_DIV_VAL(x) ((x & 0xFFF) << 7)
117 #define ADF4157_R4_CTRL 0x04
120 #define ADF4157_LE_OUT no_os_gpio_direction_output(dev->gpio_le, \
122 #define ADF4157_LE_LOW no_os_gpio_set_value(dev->gpio_le, \
124 #define ADF4157_LE_HIGH no_os_gpio_set_value(dev->gpio_le, \
127 #define ADF4157_MUX_OUT no_os_gpio_direction_output(dev->gpio_mux, \
129 #define ADF4157_MUX_LOW no_os_gpio_set_value(dev->gpio_mux, \
131 #define ADF4157_MUX_HIGH no_os_gpio_set_value(dev->gpio_mux, \
134 #define ADF4157_CE_OUT no_os_gpio_direction_output(dev->gpio_ce, \
136 #define ADF4157_CE_LOW no_os_gpio_set_value(dev->gpio_ce, \
138 #define ADF4157_CE_HIGH no_os_gpio_set_value(dev->gpio_ce, \
141 #define ADF4157_LE2_OUT no_os_gpio_direction_output(dev->gpio_le2, \
143 #define ADF4157_LE2_LOW no_os_gpio_set_value(dev->gpio_le2, \
145 #define ADF4157_LE2_HIGH no_os_gpio_set_value(dev->gpio_le2, \
148 #define ADF4157_CE2_OUT no_os_gpio_direction_output(dev->gpio_ce2, \
150 #define ADF4157_CE2_LOW no_os_gpio_set_value(dev->gpio_ce2, \
152 #define ADF4157_CE2_HIGH no_os_gpio_set_value(dev->gpio_ce2, \
156 #define ADF4157_MAX_OUT_FREQ 6000
157 #define ADF4157_MIN_OUT_FREQ 500
158 #define ADF4157_MAX_FREQ_45_PRESC 3000
159 #define ADF4157_MAX_FREQ_PFD 32000000
160 #define ADF4157_MAX_FREQ_REFIN 300000000
161 #define ADF4157_MIN_FREQ_REFIN 10000000
162 #define ADF4157_FIXED_MODULUS 33554432
163 #define ADF4157_MAX_R_CNT 32
164 #define ADF4157_MAX_REG_VAL 0x1FFFFFFF
167 #define ADF4157_REG0 0
168 #define ADF4157_REG1 1
169 #define ADF4157_REG2 2
170 #define ADF4157_REG3 3
171 #define ADF4157_REG4 4
235 uint32_t
gcd(uint32_t x, uint32_t y);
#define ADF4157_INT_VAL(x)
Definition: adf4157.h:62
struct no_os_spi_init_param spi_init
Definition: adf4157.h:209
Structure holding the parameters for GPIO initialization.
Definition: no_os_gpio.h:79
struct no_os_gpio_init_param gpio_ce
Definition: adf4157.h:212
struct no_os_gpio_desc * gpio_le
Definition: adf4157.h:201
#define ADF4157_R_CNT(x)
Definition: adf4157.h:87
float channel_spacing
Definition: adf4157.h:193
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:186
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
uint32_t gcd(uint32_t x, uint32_t y)
Computes the greatest common divider of two numbers.
Definition: adf4156.c:208
#define ADF4157_LE_OUT
Definition: adf4157.h:120
Header file of SPI Interface.
Definition: adf4157.h:186
Definition: adf4157.h:207
#define ADF4157_REG3
Definition: adf4157.h:170
#define ADF4157_REG1
Definition: adf4157.h:168
uint32_t r0_fract
Definition: adf4157.h:190
#define ADF4157_R0_CTRL
Definition: adf4157.h:66
int32_t adf4157_remove(struct adf4157_dev *dev)
Free the resources allocated by adf4157_init().
Definition: adf4157.c:131
Definition: ad9361_util.h:69
uint16_t r_cnt
Definition: adf4157.h:189
uint32_t r2_mod
Definition: adf4157.h:192
#define ADF4157_R2_CTRL
Definition: adf4157.h:89
#define ADF4157_CE_HIGH
Definition: adf4157.h:138
#define ADF4157_LE_LOW
Definition: adf4157.h:122
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:186
#define ADF4157_FRAC_VAL_LSB(x)
Definition: adf4157.h:69
int8_t adf4157_init(struct adf4157_dev **device, struct adf4157_init_param init_param)
Initialize the SPI communication with the device.
Definition: adf4157.c:52
struct no_os_gpio_desc * gpio_ce
Definition: adf4157.h:202
#define ADF4157_R1_CTRL
Definition: adf4157.h:70
double adf4157_set_freq(struct adf4157_dev *dev, double freq)
Sets the ADF4157 output frequency.
Definition: adf4157.c:226
#define ADF4157_REF_DBL(x)
Definition: adf4157.h:85
#define ADF4157_FIXED_MODULUS
Definition: adf4157.h:162
int8_t adf4157_init(struct adf4157_dev **device, struct adf4157_init_param init_param)
Initialize the SPI communication with the device.
Definition: adf4157.c:52
int32_t adf4157_remove(struct adf4157_dev *dev)
Free the resources allocated by adf4157_init().
Definition: adf4157.c:131
struct no_os_gpio_init_param gpio_le
Definition: adf4157.h:211
Header file of ADF4157 Driver for Microblaze processor.
#define ADF4157_MAX_FREQ_REFIN
Definition: adf4157.h:160
struct no_os_spi_desc * spi_desc
Definition: adf4157.h:199
int32_t no_os_gpio_remove(struct no_os_gpio_desc *desc)
Free the resources allocated by no_os_gpio_get().
Definition: no_os_gpio.c:104
Structure holding SPI descriptor.
Definition: no_os_spi.h:192
uint32_t r0_int
Definition: adf4157.h:191
int8_t adf4157_set(struct adf4157_dev *dev, uint32_t value)
Transmits 32 bits on SPI.
Definition: adf4157.c:153
#define ADF4157_MAX_FREQ_PFD
Definition: adf4157.h:159
Structure holding the GPIO descriptor.
Definition: no_os_gpio.h:96
#define ADF4157_R4_CTRL
Definition: adf4157.h:117
#define ADF4157_CE_OUT
Definition: adf4157.h:134
#define ADF4157_REG2
Definition: adf4157.h:169
#define ADF4157_MIN_FREQ_REFIN
Definition: adf4157.h:161
int32_t no_os_gpio_get(struct no_os_gpio_desc **desc, const struct no_os_gpio_init_param *param)
Obtain the GPIO decriptor.
Definition: no_os_gpio.c:49
void * no_os_malloc(size_t size)
Allocate memory and return a pointer to it.
Definition: chibios_alloc.c:43
#define ADF4157_FRAC_VAL_MSB(x)
Definition: adf4157.h:64
uint32_t gcd(uint32_t x, uint32_t y)
Computes the greatest common divider of two numbers.
Definition: adf4157.c:205
int8_t adf4157_set(struct adf4157_dev *dev, uint32_t value)
Transmits 32 bits on SPI.
Definition: adf4157.c:153
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
uint32_t fpfd
Definition: adf4157.h:188
Definition: adf4157.h:197
#define ADF4157_REG0
Definition: adf4157.h:167
#define ADF4157_RDIV2(x)
Definition: adf4157.h:83
double adf4157_set_freq(struct adf4157_dev *dev, double freq)
Sets the ADF4157 output frequency.
Definition: adf4157.c:226
struct ad7616_init_param init_param
Definition: ad7616_sdz.c:113
#define ADF4157_PRESCALER(x)
Definition: adf4157.h:81
#define ADF4157_REG4
Definition: adf4157.h:171
uint32_t reg_val[5]
Definition: adf4157.h:194
#define ADF4157_CNT_RST(x)
Definition: adf4157.h:103
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
Header file of GPIO Interface.
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 ADF4157_MAX_OUT_FREQ
Definition: adf4157.h:156
struct adf4157_state adf4157_st
Definition: adf4157.h:204
struct adf4157_platform_data * pdata
Definition: adf4157.h:187
#define ADF4157_MIN_OUT_FREQ
Definition: adf4157.h:157
#define ADF4157_LE_HIGH
Definition: adf4157.h:124
Header file of ADF4157 Driver Configuration.
#define ADF4157_R3_CTRL
Definition: adf4157.h:105
#define ADF4157_MAX_FREQ_45_PRESC
Definition: adf4157.h:158
Structure holding the parameters for SPI initialization.
Definition: no_os_spi.h:140