no-OS
adf4371.h
Go to the documentation of this file.
1 /***************************************************************************/
39 #ifndef ADF4371_H_
40 #define ADF4371_H_
41 
42 /******************************************************************************/
43 /***************************** Include Files **********************************/
44 /******************************************************************************/
45 #include <stdint.h>
46 #include "no_os_spi.h"
47 
48 /******************************************************************************/
49 /********************** Macros and Types Declarations *************************/
50 /******************************************************************************/
52  bool enable;
53  uint64_t freq;
54 };
55 
57  uint32_t icp;
58  uint32_t regval;
59 };
60 
62  uint32_t num;
64 };
65 
66 struct adf4371_dev {
69  uint32_t num_channels;
73  uint32_t pd_pol;
76  bool muxout_en;
78  uint32_t ref_div_factor;
79  uint32_t clkin_freq;
80  uint32_t fpfd;
81  uint32_t integer;
82  uint32_t fract1;
83  uint32_t fract2;
84  uint32_t mod2;
85  uint32_t rf_div_sel;
86  uint8_t buf[10];
87 };
88 
92  uint32_t clkin_frequency;
97  uint32_t muxout_select;
99  uint32_t num_channels;
101 };
102 
103 /******************************************************************************/
104 /************************ Functions Declarations ******************************/
105 /******************************************************************************/
106 /* Initialize the device. */
107 int32_t adf4371_init(struct adf4371_dev **device,
108  const struct adf4371_init_param *init_param);
109 
110 /* Remove the device. */
111 int32_t adf4371_remove(struct adf4371_dev *device);
112 
113 /* Recalculate rate corresponding to a channel. */
114 int32_t adf4371_clk_recalc_rate(struct adf4371_dev *dev, uint32_t chan,
115  uint64_t *rate);
116 
117 /* Calculate closest possible rate */
118 int32_t adf4371_clk_round_rate(struct adf4371_dev *dev, uint64_t rate,
119  uint64_t *rounded_rate);
120 
121 /* Set channel rate. */
122 int32_t adf4371_clk_set_rate(struct adf4371_dev *dev, uint32_t chan,
123  uint64_t rate);
124 
125 #endif
adf4371_clk_recalc_rate
int32_t adf4371_clk_recalc_rate(struct adf4371_dev *dev, uint32_t chan, uint64_t *rate)
Definition: adf4371.c:697
timeout
uint32_t timeout
Definition: ad413x.c:54
ADF4371_RDIV2
@ ADF4371_RDIV2
Definition: adf4371.c:165
ADF4371_CH_RFAUX8
@ ADF4371_CH_RFAUX8
Definition: adf4371.c:150
adf4371_clk_round_rate
int32_t adf4371_clk_round_rate(struct adf4371_dev *dev, uint64_t rate, uint64_t *rounded_rate)
Definition: adf4371.c:715
ADF4371_MUXOUT_ENABLE
@ ADF4371_MUXOUT_ENABLE
Definition: adf4371.c:145
adf4371_dev::clkin_freq
uint32_t clkin_freq
Definition: adf4371.h:79
adf4371_channel_config
Definition: adf4371.h:51
adf4371_variant
adf4371_variant
Definition: adf4371.c:155
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:83
ADF4371_CH_RF32
@ ADF4371_CH_RF32
Definition: adf4371.c:152
ADF4371_ADDR_ASC_R
#define ADF4371_ADDR_ASC_R(x)
Definition: adf4371.c:65
ADF4371_TRISTATE
@ ADF4371_TRISTATE
Definition: adf4371.c:161
adf4371_dev::fract1
uint32_t fract1
Definition: adf4371.h:82
no_os_spi.h
Header file of SPI Interface.
reg_sequence
Definition: adf4371.c:190
adf4371_muxout
adf4371_muxout
Definition: adf4371.c:160
ADF4371_CHANNEL_NAME
@ ADF4371_CHANNEL_NAME
Definition: adf4371.c:144
ADF4371_MIN_VCO_FREQ
#define ADF4371_MIN_VCO_FREQ
Definition: adf4371.c:121
ADF4371_ADDR
#define ADF4371_ADDR(x)
Definition: adf4371.c:56
adf4371_dev::fract2
uint32_t fract2
Definition: adf4371.h:83
adf4371_init_param::mute_till_lock_enable
bool mute_till_lock_enable
Definition: adf4371.h:96
adf4371_dev::muxout_1v8_en
bool muxout_1v8_en
Definition: adf4371.h:77
adf4371_dev::differential_ref_clk
bool differential_ref_clk
Definition: adf4371.h:72
ADF4371_CP_CURRENT
#define ADF4371_CP_CURRENT(x)
Definition: adf4371.c:88
ADF4371_REFIN_MODE_MASK
#define ADF4371_REFIN_MODE_MASK
Definition: adf4371.c:101
ADF4371_MUXOUT_LVL
#define ADF4371_MUXOUT_LVL(x)
Definition: adf4371.c:96
adf4371_init_param::loop_filter_inverting
bool loop_filter_inverting
Definition: adf4371.h:94
ADF4372
@ ADF4372
Definition: adf4371.c:157
adf4371_clk_set_rate
int32_t adf4371_clk_set_rate(struct adf4371_dev *dev, uint32_t chan, uint64_t rate)
Definition: adf4371.c:730
device
Definition: ad9361_util.h:75
ADF4371_MODULUS1
#define ADF4371_MODULUS1
Definition: adf4371.c:134
adf4371_remove
int32_t adf4371_remove(struct adf4371_dev *device)
Definition: adf4371.c:824
ADF4371_MUXOUT
#define ADF4371_MUXOUT(x)
Definition: adf4371.c:94
adf4371_dev::pd_pol
uint32_t pd_pol
Definition: adf4371.h:73
no_os_find_closest
uint32_t no_os_find_closest(int32_t val, const int32_t *array, uint32_t size)
adf4371.h
Header file of ADF4371 Driver.
NO_OS_ARRAY_SIZE
#define NO_OS_ARRAY_SIZE(x)
Definition: no_os_util.h:53
adf4371_channel_config::freq
uint64_t freq
Definition: adf4371.h:53
adf4371_dev::cp_settings
struct adf4371_cp_settings cp_settings
Definition: adf4371.h:71
ADF4371_ADDR_ASC
#define ADF4371_ADDR_ASC(x)
Definition: adf4371.c:63
ADF4371_MOD2WORD
#define ADF4371_MOD2WORD(x)
Definition: adf4371.c:84
ADF4371_REG
#define ADF4371_REG(x)
Definition: adf4371.c:59
adf4371_dev::muxout_default_mode
uint32_t muxout_default_mode
Definition: adf4371.h:75
no_os_do_div
uint64_t no_os_do_div(uint64_t *n, uint64_t base)
adf4371_dev::rf_div_sel
uint32_t rf_div_sel
Definition: adf4371.h:85
adf4371_cp_settings
Definition: adf4371.h:56
no_os_error.h
Error codes definition.
adf4371_init_param::spi_init
struct no_os_spi_init_param * spi_init
Definition: adf4371.h:90
NO_OS_DIV_ROUND_UP
#define NO_OS_DIV_ROUND_UP(x, y)
Definition: no_os_util.h:56
adf4371_pwrdown::reg
uint32_t reg
Definition: adf4371.c:174
ADF4371_FREQ
@ ADF4371_FREQ
Definition: adf4371.c:142
adf4371_dev::fpfd
uint32_t fpfd
Definition: adf4371.h:80
adf4371_pwrdown::bit
uint32_t bit
Definition: adf4371.c:175
ADF4371_PD_POL_MSK
#define ADF4371_PD_POL_MSK
Definition: adf4371.c:89
adf4371_dev
Definition: adf4371.h:66
adf4371_cp_settings::regval
uint32_t regval
Definition: adf4371.h:58
reg_sequence::val
uint8_t val
Definition: adf4371.c:192
ADF4371_READ
#define ADF4371_READ
Definition: adf4371.c:55
ADF4371_PD_POL
#define ADF4371_PD_POL(x)
Definition: adf4371.c:90
ADF4371_HIGH
@ ADF4371_HIGH
Definition: adf4371.c:168
adf4371_dev::mute_till_lock_en
bool mute_till_lock_en
Definition: adf4371.h:74
adf4371_init_param::clkin_frequency
uint32_t clkin_frequency
Definition: adf4371.h:92
ADF4371
@ ADF4371
Definition: adf4371.c:156
ADF4371_MUTE_LD_MSK
#define ADF4371_MUTE_LD_MSK
Definition: adf4371.c:109
ADF4371_VCO_TEST
@ ADF4371_VCO_TEST
Definition: adf4371.c:167
adf4371_dev::mod2
uint32_t mod2
Definition: adf4371.h:84
ADF4371_VCO_ALC_TOUT
#define ADF4371_VCO_ALC_TOUT(x)
Definition: adf4371.c:118
no_os_spi_desc
Structure holding SPI descriptor.
Definition: no_os_spi.h:134
adf4371_chan_spec::power_up_frequency
uint64_t power_up_frequency
Definition: adf4371.h:63
no_os_clamp
#define no_os_clamp(val, min_val, max_val)
Definition: no_os_util.h:73
ADF4371_REFIN_MODE
#define ADF4371_REFIN_MODE(x)
Definition: adf4371.c:102
adf4371_dev::spi_desc
struct no_os_spi_desc * spi_desc
Definition: adf4371.h:67
ADF4371_N_DIV_OUT
@ ADF4371_N_DIV_OUT
Definition: adf4371.c:166
no_os_greatest_common_divisor
uint32_t no_os_greatest_common_divisor(uint32_t a, uint32_t b)
adf4371_init_param::muxout_level_1v8_enable
bool muxout_level_1v8_enable
Definition: adf4371.h:98
ADF4371_ADDR_ASC_MSK
#define ADF4371_ADDR_ASC_MSK
Definition: adf4371.c:62
adf4371_clk_recalc_rate
int32_t adf4371_clk_recalc_rate(struct adf4371_dev *dev, uint32_t chan, uint64_t *rate)
Definition: adf4371.c:697
ADF4371_SDO_ACT_R
#define ADF4371_SDO_ACT_R(x)
Definition: adf4371.c:69
adf4371_init_param
Definition: adf4371.h:89
adf4371_init_param::num_channels
uint32_t num_channels
Definition: adf4371.h:99
adf4371_dev::num_channels
uint32_t num_channels
Definition: adf4371.h:69
adf4371_init
int32_t adf4371_init(struct adf4371_dev **device, const struct adf4371_init_param *init_param)
Definition: adf4371.c:746
ADF4371_CH_RF16
@ ADF4371_CH_RF16
Definition: adf4371.c:151
ADF4371_CH_RF8
@ ADF4371_CH_RF8
Definition: adf4371.c:149
adf4371_pwrdown
Definition: adf4371.c:173
ADF4371_SDO_ACT_MSK
#define ADF4371_SDO_ACT_MSK
Definition: adf4371.c:66
NO_OS_BIT
#define NO_OS_BIT(x)
Definition: no_os_util.h:51
adf4371_channel_config::enable
bool enable
Definition: adf4371.h:52
ADF4371_FRAC2WORD_H
#define ADF4371_FRAC2WORD_H(x)
Definition: adf4371.c:80
ADF4371_MAX_MODULUS2
#define ADF4371_MAX_MODULUS2
Definition: adf4371.c:136
adf4371_chan_spec::num
uint32_t num
Definition: adf4371.h:62
ADF4371_SDO_ACT_R_MSK
#define ADF4371_SDO_ACT_R_MSK
Definition: adf4371.c:68
ADF4371_CH_PUMP_DOWN
@ ADF4371_CH_PUMP_DOWN
Definition: adf4371.c:164
ADF4371_WRITE
#define ADF4371_WRITE
Definition: adf4371.c:54
adf4371_init_param::channels
struct adf4371_chan_spec * channels
Definition: adf4371.h:100
adf4371_init_param::charge_pump_microamp
uint32_t charge_pump_microamp
Definition: adf4371.h:95
adf4371_init_param::spi_3wire_enable
bool spi_3wire_enable
Definition: adf4371.h:91
adf4371_clk_set_rate
int32_t adf4371_clk_set_rate(struct adf4371_dev *dev, uint32_t chan, uint64_t rate)
Definition: adf4371.c:730
adf4371_dev::channel_cfg
struct adf4371_channel_config channel_cfg[4]
Definition: adf4371.h:70
ADF4371_CHECK_RANGE
#define ADF4371_CHECK_RANGE(freq, range)
Definition: adf4371.c:138
init_param
struct ad7616_init_param init_param
Definition: ad7616_sdz.c:96
adf4371_dev::buf
uint8_t buf[10]
Definition: adf4371.h:86
adf4371_dev::ref_div_factor
uint32_t ref_div_factor
Definition: adf4371.h:78
ADF4371_ADDR_ASC_R_MSK
#define ADF4371_ADDR_ASC_R_MSK
Definition: adf4371.c:64
ADF4371_RESET_CMD
#define ADF4371_RESET_CMD
Definition: adf4371.c:70
ADF4371_FRAC2WORD_L
#define ADF4371_FRAC2WORD_L(x)
Definition: adf4371.c:74
ADF4371_POWER_DOWN
@ ADF4371_POWER_DOWN
Definition: adf4371.c:143
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:71
ADF4371_CH_PUMP_UP
@ ADF4371_CH_PUMP_UP
Definition: adf4371.c:163
adf4371_dev::muxout_en
bool muxout_en
Definition: adf4371.h:76
ADF4371_FRAC1WORD
#define ADF4371_FRAC1WORD(x)
Definition: adf4371.c:76
ADF4371_CP_CURRENT_MSK
#define ADF4371_CP_CURRENT_MSK
Definition: adf4371.c:87
adf4371_init
int32_t adf4371_init(struct adf4371_dev **device, const struct adf4371_init_param *init_param)
Definition: adf4371.c:746
ADF4371_MUXOUT_MSK
#define ADF4371_MUXOUT_MSK
Definition: adf4371.c:93
ADF4371_RF_DIV_SEL_MSK
#define ADF4371_RF_DIV_SEL_MSK
Definition: adf4371.c:105
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:51
adf4371_cp_settings::icp
uint32_t icp
Definition: adf4371.h:57
no_os_util.h
Header file of utility functions.
ADF4371_VCO_CALIB_R_BAND
@ ADF4371_VCO_CALIB_R_BAND
Definition: adf4371.c:169
adf4371_dev::integer
uint32_t integer
Definition: adf4371.h:81
ADF4371_MUTE_LD
#define ADF4371_MUTE_LD(x)
Definition: adf4371.c:110
adf4371_chan_spec
Definition: adf4371.h:61
ADF4371_VCO_CALIB_N_BAND
@ ADF4371_VCO_CALIB_N_BAND
Definition: adf4371.c:170
ADF4371_MUXOUT_LVL_MSK
#define ADF4371_MUXOUT_LVL_MSK
Definition: adf4371.c:95
ADF4371_DIG_LOCK
@ ADF4371_DIG_LOCK
Definition: adf4371.c:162
ADF4371_MUXOUT_EN
#define ADF4371_MUXOUT_EN(x)
Definition: adf4371.c:98
ADF4371_RF_DIV_SEL
#define ADF4371_RF_DIV_SEL(x)
Definition: adf4371.c:106
adf4371_dev::spi_3wire_en
bool spi_3wire_en
Definition: adf4371.h:68
reg_sequence::reg
uint16_t reg
Definition: adf4371.c:191
ADF4371_SDO_ACT
#define ADF4371_SDO_ACT(x)
Definition: adf4371.c:67
adf4371_init_param::muxout_select
uint32_t muxout_select
Definition: adf4371.h:97
adf4371_init_param::differential_ref_clock
bool differential_ref_clock
Definition: adf4371.h:93
ADF4371_MUXOUT_EN_MSK
#define ADF4371_MUXOUT_EN_MSK
Definition: adf4371.c:97
NO_OS_DIV_ROUND_CLOSEST
#define NO_OS_DIV_ROUND_CLOSEST(x, y)
Definition: no_os_util.h:58
adf4371_remove
int32_t adf4371_remove(struct adf4371_dev *device)
Definition: adf4371.c:824
ADF4371_TIMEOUT
#define ADF4371_TIMEOUT(x)
Definition: adf4371.c:114
no_os_spi_init_param
Structure holding the parameters for SPI initialization.
Definition: no_os_spi.h:112
adf4371_clk_round_rate
int32_t adf4371_clk_round_rate(struct adf4371_dev *dev, uint64_t rate, uint64_t *rounded_rate)
Definition: adf4371.c:715
ADF4371_MAX_FREQ_PFD
#define ADF4371_MAX_FREQ_PFD
Definition: adf4371.c:130