Implementation of ADF4368 Driver. More...
#include <stdint.h>
#include <string.h>
#include "no_os_units.h"
#include "no_os_util.h"
#include "no_os_spi.h"
Go to the source code of this file.
Classes | |
struct | adf4368_init_param |
ADF4368 Initialization Parameters structure. More... | |
struct | adf4368_dev |
ADF4368 Device Descriptor. More... | |
Functions | |
int | adf4368_spi_write (struct adf4368_dev *dev, uint16_t reg_addr, uint8_t data) |
Writes data to ADF4368 over SPI. | |
int | adf4368_spi_read (struct adf4368_dev *dev, uint16_t reg_addr, uint8_t *data) |
Reads data from ADF4368 over SPI. | |
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. | |
int | adf4368_reg_dump (struct adf4368_dev *dev) |
Will output on the terminal the values of all the ADF4368 registers. | |
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 of 15 to the max. value. | |
int | adf4368_get_out_power (struct adf4368_dev *dev, uint8_t ch, int32_t *pwr) |
Gets the output power register value. | |
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 different then 0 it will set the doubler to enable. | |
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. | |
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 the max. value and everything under the minimum supported value of 10MHz to the min. value. | |
int | adf4368_get_ref_clk (struct adf4368_dev *dev, uint64_t *val) |
Gets the user proposed reference frequency. | |
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 different then 0 it will set the doubler to enable. | |
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. | |
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. value. | |
int | adf4368_get_ref_div (struct adf4368_dev *dev, int32_t *div) |
Gets the value the reference divider. | |
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 on 8 bits. For more information please consult the Datasheet. | |
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. For more information please consult the Datasheet. | |
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. | |
int | adf4368_get_bleed_word (struct adf4368_dev *dev, int32_t *word) |
Gets the value of the bleed word. | |
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.8GHz to the max. value and everything under the minimum supported value of 800MHz to the min. value. | |
int | adf4368_get_rfout (struct adf4368_dev *dev, uint64_t *val) |
Gets the user proposed output frequency. | |
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. | |
int | adf4368_get_sync_setup (struct adf4368_dev *dev, bool *en) |
Gets the value of the SYNC features' powerdown bit. | |
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 new reference clock. | |
int | adf4368_get_sw_sync (struct adf4368_dev *dev, uint8_t *sw_sync) |
Gets the value of the SW_SYNC bit. | |
int | adf4368_set_temperature (struct adf4368_dev *dev, bool en) |
Set Temperature Readback feature's initial state. This feature should be disabled after reading temperature. | |
int | adf4368_get_temperature (struct adf4368_dev *dev, int32_t *temp) |
Gets the value of the approximate die temperature. | |
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 %22 in degree phase. Recommend to use in fractional mode. | |
int | adf4368_get_phase_sdm (struct adf4368_dev *dev, uint32_t *phase_fs) |
Get the phase adjustment in femto-seconds with Sigma Delta Modulation. | |
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. Recommend to use in integer mode. | |
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 Integer mode. | |
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 Integer mode. | |
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. | |
int | adf4368_get_default_regs (struct adf4368_dev *dev, bool *spi_4wire) |
Reads and Checks the registers values equal to default values. | |
int | adf4368_set_freq (struct adf4368_dev *dev) |
Set the output frequency. | |
int | adf4368_init (struct adf4368_dev **device, struct adf4368_init_param *init_param) |
Initializes the adf4368. | |
int | adf4368_remove (struct adf4368_dev *dev) |
Free resources allocated for ADF4368. | |
Implementation of ADF4368 Driver.
Copyright 2024(c) Analog Devices, Inc.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES, INC. “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ANALOG DEVICES, INC. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define ADF4368_ADC_A_CONV_MSK NO_OS_BIT(0) |
#define ADF4368_ADC_BUSY_MSK NO_OS_BIT(2) |
#define ADF4368_ADC_CLK_DIV_MSK NO_OS_GENMASK(7, 0) |
#define ADF4368_ADC_CLK_SEL_MSK NO_OS_BIT(6) |
#define ADF4368_ADC_ST_CNV_MSK NO_OS_BIT(1) |
#define ADF4368_ADDR_ASC_AUTO_DECR 0x0 |
#define ADF4368_ADDR_ASC_AUTO_INCR 0x1 |
#define ADF4368_ADDRESS_ASC_MSK NO_OS_BIT(2) |
#define ADF4368_ADDRESS_ASC_R_MSK NO_OS_BIT(5) |
#define ADF4368_ADJ_POL_MSK NO_OS_BIT(6) |
#define ADF4368_BLEED_MSB_MSK |
#define ADF4368_BLEED_N_INT_TH 35 |
#define ADF4368_BLEED_POL_MSK NO_OS_BIT(5) |
#define ADF4368_BLEED_WORD_MAX 8191 |
#define ADF4368_BST_REF_MSK NO_OS_BIT(7) |
#define ADF4368_BUFF_SIZE_BYTES 3 |
#define ADF4368_CHANNEL_SPACING_MAX 78125U |
#define ADF4368_CHIP_TEMP_LSB_MSK NO_OS_GENMASK(7, 0) |
#define ADF4368_CHIP_TEMP_MSB_MSK NO_OS_BIT(0) |
#define ADF4368_CHIP_TYPE 0x06 |
#define ADF4368_CLK1_OPWR_MSK NO_OS_GENMASK(3, 0) |
#define ADF4368_CLK2_OPWR_MSK NO_OS_GENMASK(7, 4) |
#define ADF4368_CLKODIV_DB_MSK NO_OS_BIT(7) |
#define ADF4368_CLKOUT_DIV_MSK NO_OS_GENMASK(7, 6) |
#define ADF4368_CLKOUT_DIV_REG_VAL_MAX 3 |
#define ADF4368_CMOS_OV_MSK NO_OS_BIT(1) |
#define ADF4368_COARSE_BLEED_CNST 202 |
#define ADF4368_COARSE_BLEED_MSK NO_OS_GENMASK(4, 1) |
#define ADF4368_CP_DOWN_MSK NO_OS_BIT(1) |
#define ADF4368_CP_I_MSK NO_OS_GENMASK(3, 0) |
#define ADF4368_CP_UP_MSK NO_OS_BIT(0) |
#define ADF4368_CPI_VAL_MAX 15 |
#define ADF4368_DCLK_DIV1_0_MAX 160000000U |
#define ADF4368_DCLK_DIV1_1_MAX 320000000U |
#define ADF4368_DCLK_DIV1_MSK NO_OS_GENMASK(5, 4) |
#define ADF4368_DCLK_DIV_DB_MSK NO_OS_BIT(6) |
#define ADF4368_DCLK_MODE_MSK NO_OS_BIT(2) |
#define ADF4368_DEL_CTRL_DB_MSK NO_OS_BIT(7) |
#define ADF4368_DNCLK_DEL_MSK NO_OS_GENMASK(2, 0) |
#define ADF4368_DRCLK_DEL_MSK NO_OS_GENMASK(5, 3) |
#define ADF4368_EN_ADC_CLK_MSK NO_OS_BIT(3) |
#define ADF4368_EN_ADC_CNV_MSK NO_OS_BIT(7) |
#define ADF4368_EN_ADC_MSK NO_OS_BIT(1) |
#define ADF4368_EN_AUTOCAL_MSK NO_OS_BIT(7) |
#define ADF4368_EN_BLEED_MSK NO_OS_BIT(4) |
#define ADF4368_EN_CLK1_MSK NO_OS_BIT(6) |
#define ADF4368_EN_CLK2_MSK NO_OS_BIT(7) |
#define ADF4368_EN_CPTEST_MSK NO_OS_BIT(2) |
#define ADF4368_EN_DNCLK_MSK NO_OS_BIT(7) |
#define ADF4368_EN_DRCLK_MSK NO_OS_BIT(6) |
#define ADF4368_EN_LDWIN_MSK NO_OS_BIT(4) |
#define ADF4368_EN_LOL_MSK NO_OS_BIT(5) |
#define ADF4368_EN_PHASE_RESYNC_MSK NO_OS_BIT(7) |
#define ADF4368_EN_RDBLR_MSK NO_OS_BIT(6) |
#define ADF4368_EN_REF_RST_MSK NO_OS_BIT(6) |
#define ADF4368_FILT_REF_MSK NO_OS_BIT(6) |
#define ADF4368_FINE_BLEED_CNST1 250 |
#define ADF4368_FINE_BLEED_CNST2 512 |
#define ADF4368_FINE_BLEED_CNST3 567 |
#define ADF4368_FINE_BLEED_LSB_MSK NO_OS_GENMASK(7, 0) |
#define ADF4368_FINE_BLEED_MSB_MSK NO_OS_BIT(0) |
#define ADF4368_FRAC1WORD_LSB_MSK NO_OS_GENMASK(7, 0) |
#define ADF4368_FRAC1WORD_MID_MSK NO_OS_GENMASK(7, 0) |
#define ADF4368_FRAC1WORD_MSB NO_OS_BIT(0) |
#define ADF4368_FRAC1WORD_MSB_MSK NO_OS_GENMASK(7, 0) |
#define ADF4368_FRAC2WORD_LSB_MSK NO_OS_GENMASK(7, 0) |
#define ADF4368_FRAC2WORD_MID_MSK NO_OS_GENMASK(7, 0) |
#define ADF4368_FRAC2WORD_MSB_MSK NO_OS_GENMASK(7, 0) |
#define ADF4368_FRAC_N_INT_MIN 19 |
#define ADF4368_FSM_BUSY_MSK NO_OS_BIT(1) |
#define ADF4368_INT_MODE_MSK NO_OS_BIT(5) |
#define ADF4368_INT_N_INT_MIN 4 |
#define ADF4368_INV_CLK_OUT_MSK NO_OS_BIT(4) |
#define ADF4368_LD_COUNT_MSK NO_OS_GENMASK(4, 0) |
#define ADF4368_LDWIN_PW_MSK NO_OS_GENMASK(7, 5) |
#define ADF4368_LKD_DELAY_MS 9 |
#define ADF4368_LOCKED_MSK NO_OS_BIT(0) |
#define ADF4368_LSB_FIRST_LSB 0x1 |
#define ADF4368_LSB_FIRST_MSB 0x0 |
#define ADF4368_LSB_FIRST_MSK NO_OS_BIT(1) |
#define ADF4368_LSB_FIRST_R_MSK NO_OS_BIT(6) |
#define ADF4368_LSB_P1 NO_OS_BIT(6) |
#define ADF4368_M_VCO_BAND_MSK NO_OS_GENMASK(7, 0) |
#define ADF4368_M_VCO_BIAS_MSK NO_OS_GENMASK(5, 2) |
#define ADF4368_M_VCO_CORE_MSK NO_OS_GENMASK(7, 6) |
#define ADF4368_MASTER_RB_CTRL_MSK NO_OS_BIT(5) |
#define ADF4368_MHZ MEGA |
#define ADF4368_MOD1WORD 0x2000000U |
#define ADF4368_MOD2WORD_LSB_MSK NO_OS_GENMASK(7, 0) |
#define ADF4368_MOD2WORD_MAX 0xFFFFFFU |
#define ADF4368_MOD2WORD_MID_MSK NO_OS_GENMASK(7, 0) |
#define ADF4368_MOD2WORD_MSB_MSK NO_OS_GENMASK(7, 0) |
#define ADF4368_MS_TO_S MILLI |
#define ADF4368_MUTE_CLKOUT1_MSK NO_OS_GENMASK(2, 0) |
#define ADF4368_MUTE_CLKOUT2_MSK NO_OS_GENMASK(5, 3) |
#define ADF4368_MUTE_NCLK_MSK NO_OS_BIT(7) |
#define ADF4368_MUXOUT_MSK NO_OS_GENMASK(7, 4) |
#define ADF4368_N_INT_LSB_MSK NO_OS_GENMASK(7, 0) |
#define ADF4368_N_INT_MSB_MSK NO_OS_GENMASK(3, 0) |
#define ADF4368_NS_TO_PS KHZ_PER_MHZ |
#define ADF4368_NS_TO_S NANO |
#define ADF4368_O_VCO_BAND_MSK NO_OS_BIT(3) |
#define ADF4368_O_VCO_BIAS_MSK NO_OS_BIT(1) |
#define ADF4368_O_VCO_CORE_MSK NO_OS_BIT(2) |
#define ADF4368_O_VCO_DB_MSK NO_OS_BIT(7) |
#define ADF4368_OUT_PWR_MAX 15 |
#define ADF4368_PD_ALL NO_OS_BIT(7) |
#define ADF4368_PD_CLKOUT1_MSK NO_OS_BIT(1) |
#define ADF4368_PD_CLKOUT2_MSK NO_OS_BIT(0) |
#define ADF4368_PD_LD NO_OS_BIT(3) |
#define ADF4368_PD_RDET NO_OS_BIT(2) |
#define ADF4368_PD_SYNC NO_OS_BIT(4) |
#define ADF4368_PD_SYNC_MON_MSK NO_OS_BIT(6) |
#define ADF4368_PFD_FREQ_FRAC_MAX 250000000U |
#define ADF4368_PFD_FREQ_MAX 625000000U |
#define ADF4368_PHASE_ADJ_MSK NO_OS_BIT(6) |
#define ADF4368_PHASE_ADJUSTMENT_MSK NO_OS_GENMASK(7, 0) |
#define ADF4368_PHASE_BLEED_CNST 2044000 |
#define ADF4368_PHASE_RESYNC_MOD2WORD_MAX 0x1FFFFU |
#define ADF4368_PHASE_WORD_LSB_MSK NO_OS_GENMASK(7, 0) |
#define ADF4368_PHASE_WORD_MID_MSK NO_OS_GENMASK(7, 0) |
#define ADF4368_PHASE_WORD_MSB_MSK NO_OS_GENMASK(7, 0) |
#define ADF4368_POR_DELAY_US 200 |
#define ADF4368_PRODUCT_ID_LSB 0x0005 |
#define ADF4368_PRODUCT_ID_MSB 0x0005 |
#define ADF4368_PS_TO_NS KHZ_PER_MHZ |
#define ADF4368_PS_TO_S PICO |
#define ADF4368_PS_TO_US MICRO |
#define ADF4368_R_DIV_MSK NO_OS_GENMASK(5, 0) |
#define ADF4368_REF_CLK_MAX 4000000000U |
#define ADF4368_REF_CLK_MIN 10000000 |
#define ADF4368_REF_DIV_MAX 63 |
#define ADF4368_REF_OK_MSK NO_OS_BIT(3) |
#define ADF4368_REF_SEL_MSK NO_OS_BIT(5) |
#define ADF4368_REG28_RSV1 NO_OS_BIT(7) |
#define ADF4368_REG28_RSV2 NO_OS_GENMASK(4, 2) |
#define ADF4368_REG28_RSV3 NO_OS_BIT(1) |
#define ADF4368_REG28_RSV4 NO_OS_BIT(0) |
#define ADF4368_REG2A_RSV1 NO_OS_BIT(0) |
#define ADF4368_REG2A_RSV2 NO_OS_BIT(1) |
#define ADF4368_REG2A_RSV3 NO_OS_BIT(3) |
#define ADF4368_REG2A_RSV4 NO_OS_BIT(5) |
#define ADF4368_REG2A_RSV5 NO_OS_BIT(7) |
#define ADF4368_REG2B_RSV1 NO_OS_BIT(2) |
#define ADF4368_REG2B_RSV2 NO_OS_BIT(4) |
#define ADF4368_REG2B_RSV3 NO_OS_BIT(5) |
#define ADF4368_REG2B_RSV4 NO_OS_BIT(6) |
#define ADF4368_REG2D_RSV1 NO_OS_GENMASK(1, 0) |
#define ADF4368_REG2D_RSV2 NO_OS_BIT(3) |
#define ADF4368_REG2E_RSV1 NO_OS_BIT(3) |
#define ADF4368_REG2F_RSV1 NO_OS_GENMASK(3, 0) |
#define ADF4368_REG2F_RSV2 NO_OS_BIT(5) |
#define ADF4368_REG30_RSV3 NO_OS_BIT(6) |
#define ADF4368_REG31_RSV1 NO_OS_BIT(0) |
#define ADF4368_REG31_RSV2 NO_OS_BIT(1) |
#define ADF4368_REG31_RSV3 NO_OS_BIT(2) |
#define ADF4368_REG35_RSV1 NO_OS_BIT(0) |
#define ADF4368_REG35_RSV2 NO_OS_BIT(1) |
#define ADF4368_REG35_RSV3 NO_OS_GENMASK(6, 3) |
#define ADF4368_REG35_RSV4 NO_OS_BIT(7) |
#define ADF4368_REG36_RSV1 NO_OS_GENMASK(3, 0) |
#define ADF4368_REG36_RSV2 NO_OS_BIT(4) |
#define ADF4368_REG36_RSV3 NO_OS_BIT(5) |
#define ADF4368_REG3F_RSV1 NO_OS_BIT(2) |
#define ADF4368_REG3F_RSV2 NO_OS_BIT(3) |
#define ADF4368_REG3F_RSV3 NO_OS_BIT(4) |
#define ADF4368_REG3F_RSV4 NO_OS_BIT(5) |
#define ADF4368_REG3F_RSV5 NO_OS_BIT(6) |
#define ADF4368_REG40_RSV1 NO_OS_GENMASK(5, 3) |
#define ADF4368_REG43_RSV1 NO_OS_GENMASK(2, 0) |
#define ADF4368_REG43_RSV2 NO_OS_BIT(3) |
#define ADF4368_REG43_RSV3 NO_OS_BIT(4) |
#define ADF4368_REG43_RSV4 NO_OS_BIT(5) |
#define ADF4368_REG43_RSV5 NO_OS_BIT(7) |
#define ADF4368_REG4E_RSV1 NO_OS_BIT(0) |
#define ADF4368_REG4E_RSV2 NO_OS_GENMASK(7, 6) |
#define ADF4368_REG53_RSV1 NO_OS_GENMASK(3, 0) |
#define ADF4368_REG53_RSV2 NO_OS_BIT(7) |
#define ADF4368_REG54_RSV1 NO_OS_GENMASK(7, 1) |
#define ADF4368_REG58_RSV1 NO_OS_BIT(4) |
#define ADF4368_REG5A_RSV1 NO_OS_GENMASK(7, 2) |
#define ADF4368_REG5C_RSV1 NO_OS_GENMASK(7, 1) |
#define ADF4368_REG60_RSV1 NO_OS_GENMASK(7, 4) |
#define ADF4368_RESET_CMD 0x81 |
#define ADF4368_RESYNC_WAIT_LSB_MSK NO_OS_GENMASK(7, 0) |
#define ADF4368_RESYNC_WAIT_MID_MSK NO_OS_GENMASK(7, 0) |
#define ADF4368_RESYNC_WAIT_MSB_MSK NO_OS_GENMASK(7, 0) |
#define ADF4368_RFOUT_MAX 12800000000U |
#define ADF4368_RFOUT_MIN 800000000U |
#define ADF4368_RST_LD_MSK NO_OS_BIT(2) |
#define ADF4368_RST_SYNC_MON_MSK NO_OS_BIT(4) |
#define ADF4368_RST_SYS_MSK NO_OS_BIT(4) |
#define ADF4368_S_TO_NS NANO |
#define ADF4368_SCRATCHPAD_MSK NO_OS_GENMASK(7, 0) |
#define ADF4368_SDO_ACTIVE_MSK NO_OS_BIT(3) |
#define ADF4368_SDO_ACTIVE_R_MSK NO_OS_BIT(4) |
#define ADF4368_SDO_ACTIVE_SPI_3W 0x0 |
#define ADF4368_SDO_ACTIVE_SPI_4W 0x1 |
#define ADF4368_SIGMA_DELTA_MOD_CNST 4096 |
#define ADF4368_SINGLE_INSTR_MSK NO_OS_BIT(7) |
#define ADF4368_SOFT_RESET_EN 0x1 |
#define ADF4368_SOFT_RESET_MSK NO_OS_BIT(0) |
#define ADF4368_SOFT_RESET_N_OP 0x0 |
#define ADF4368_SOFT_RESET_R_MSK NO_OS_BIT(7) |
#define ADF4368_SPI_4W_CFG | ( | x | ) |
#define ADF4368_SPI_DUMMY_DATA 0x00 |
#define ADF4368_SPI_LSB_CFG | ( | x | ) |
#define ADF4368_SPI_READ_CMD 0x8000 |
#define ADF4368_SPI_SCRATCHPAD_TEST 0x5A |
#define ADF4368_SPI_STREAM_DIS 0x1 |
#define ADF4368_SPI_STREAM_EN 0x0 |
#define ADF4368_SPI_WRITE_CMD 0x0 |
#define ADF4368_SW_SYNC_MSK NO_OS_BIT(7) |
#define ADF4368_SYNC_DEL_MSK NO_OS_GENMASK(7, 5) |
#define ADF4368_SYNC_OK_MSK NO_OS_BIT(5) |
#define ADF4368_SYNC_SEL_MSK NO_OS_BIT(5) |
#define ADF4368_SYNTH_LOCK_TIMEOUT_LSB_MSK NO_OS_GENMASK(7, 0) |
#define ADF4368_SYNTH_LOCK_TIMEOUT_MSB_MSK NO_OS_GENMASK(6, 0) |
#define ADF4368_TIMED_SYNC_MSK NO_OS_BIT(5) |
#define ADF4368_US_TO_FS NANO |
#define ADF4368_US_TO_MS MILLI |
#define ADF4368_VAR_MOD_EN_MSK NO_OS_BIT(5) |
#define ADF4368_VCO_ALC_TIMEOUT_LSB_MSK NO_OS_GENMASK(7, 0) |
#define ADF4368_VCO_ALC_TIMEOUT_MSB_MSK NO_OS_GENMASK(6, 0) |
#define ADF4368_VCO_BAND_DIV NO_OS_GENMASK(7, 0) |
#define ADF4368_VCO_BAND_MSK NO_OS_GENMASK(7, 0) |
#define ADF4368_VCO_BIAS_MSK NO_OS_GENMASK(3, 0) |
#define ADF4368_VCO_CORE_MSK NO_OS_GENMASK(1, 0) |
#define ADF4368_VCO_FREQ_MAX 12800000000U |
#define ADF4368_VCO_FREQ_MIN 6400000000U |
#define ADF4368_VERSION_MSK NO_OS_GENMASK(7, 0) |
int adf4368_get_bleed_word | ( | struct adf4368_dev * | dev, |
int32_t * | word ) |
Gets the value of the bleed word.
ADF4368 Get bleed current attribute
dev | - The device structure. |
word | - The read bleed current register value. |
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. For more information please consult the Datasheet.
ADF4368 Get charge pump current attribute
dev | - The device structure. |
reg_val | - The read charge pump register value. |
int adf4368_get_default_regs | ( | struct adf4368_dev * | dev, |
bool * | check ) |
Reads and Checks the registers values equal to default values.
ADF4368 Get default registers and check
dev | - The device structure |
check | - default state value |
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.
ADF4368 Get channel enable attributes
dev | - The device structure. |
ch | - The channel to get state. |
en | - The status of the output channel. |
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.
ADF4368 Get reference doubler attribute
dev | - The device structure. |
en | - The read value of the reference doubler. |
int adf4368_get_out_power | ( | struct adf4368_dev * | dev, |
uint8_t | ch, | ||
int32_t * | pwr ) |
Gets the output power register value.
ADF4368 Get output power attributes
dev | - The device structure. |
ch | - The channel to get the power off. |
pwr | - The output power register value. |
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 Integer mode.
ADF4368 Get phase adjustment value
dev | - The device structure. |
phase_fs | - The phase adjustment in femto-seconds. |
phase_pol | - The phase adjustment value's sign. |
int adf4368_get_phase_sdm | ( | struct adf4368_dev * | dev, |
uint32_t * | phase_fs ) |
Get the phase adjustment in femto-seconds with Sigma Delta Modulation.
ADF4368 Get phase adjust in frac mode attribute
dev | - The device structure. |
phase_fs | - The Read value of the phase adjustment in femto-seconds. |
int adf4368_get_ref_clk | ( | struct adf4368_dev * | dev, |
uint64_t * | val ) |
Gets the user proposed reference frequency.
ADF4368 Get reference frequency attribute
dev | - The device structure. |
val | - The set value of the reference frequency in Hz. |
int adf4368_get_ref_div | ( | struct adf4368_dev * | dev, |
int32_t * | div ) |
Gets the value the reference divider.
ADF4368 Get reference divider attribute
dev | - The device structure. |
div | - The read reference divider value. |
int adf4368_get_rfout | ( | struct adf4368_dev * | dev, |
uint64_t * | val ) |
Gets the user proposed output frequency.
ADF4368 Get output frequency attribute
dev | - The device structure. |
val | - The value of the output frequency in Hz. |
int adf4368_get_sw_sync | ( | struct adf4368_dev * | dev, |
uint8_t * | sw_sync ) |
Gets the value of the SW_SYNC bit.
ADF4368 Get sw_sync attribute
dev | - The device structure. |
sw_sync | - The read value of the SW_SYNC. |
int adf4368_get_sync_setup | ( | struct adf4368_dev * | dev, |
bool * | en ) |
Gets the value of the SYNC features' powerdown bit.
ADF4368 Get sync_setup attribute
dev | - The device structure. |
en | - The read value of the SYNC features' powerdown. |
int adf4368_get_temperature | ( | struct adf4368_dev * | dev, |
int32_t * | temp ) |
Gets the value of the approximate die temperature.
ADF4368 Get temperature readback attribute
dev | - The device structure. |
temp | - The read value of the Temperature Readback. |
int adf4368_init | ( | struct adf4368_dev ** | dev, |
struct adf4368_init_param * | init_param ) |
Initializes the adf4368.
ADF4368 Initialization
dev | - The device structure. |
init_param | - The structure containing the device initial parameters. |
int adf4368_reg_dump | ( | struct adf4368_dev * | dev | ) |
Will output on the terminal the values of all the ADF4368 registers.
ADF4368 Register dump
dev | - The device structure. |
int adf4368_remove | ( | struct adf4368_dev * | dev | ) |
Free resources allocated for ADF4368.
ADF4368 Remove
dev | - The device structure. |
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.
ADF4368 Set bleed current attribute
dev | - The device structure. |
word | - The bleed current register value. |
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 on 8 bits. For more information please consult the Datasheet.
ADF4368 Set charge pump current attribute
dev | - The device structure. |
reg_val | - The desired charge pump register value. |
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.
ADF4368 Set default registers and SPI 4 Wire mode
dev | - The device structure |
spi_4wire | - SPI 4 wire feature enable input |
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 different then 0 it will set the doubler to enable.
ADF4368 Set channel enable attributes
dev | - The device structure. |
ch | - The channel to set state. |
en | - The enable or disable value of the output channel. |
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 different then 0 it will set the doubler to enable.
ADF4368 Set reference doubler attribute
dev | - The device structure. |
en | - The enable or disable value of the reference doubler. |
int adf4368_set_freq | ( | struct adf4368_dev * | dev | ) |
Set the output frequency.
ADF4368 Sets frequency
dev | - The device structure. |
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 of 15 to the max. value.
ADF4368 Set output power attributes
dev | - The device structure. |
ch | - The channel to set the power off. |
pwr | - The output power register value. |
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 Integer mode.
ADF4368 Set phase adjustment value
dev | - The device structure. |
phase_fs | - The phase adjustment in femto-seconds. |
phase_pol | - The phase adjustment value's sign. |
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. Recommend to use in integer mode.
ADF4368 Set phase adjust in int mode attribute
dev | - The device structure. |
phase_fs | - The phase adjustment in femto-seconds. |
phase_pol | - The phase adjustment value's sign. |
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 %22 in degree phase. Recommend to use in fractional mode.
ADF4368 Set phase adjust in frac mode attribute
dev | - The device structure. |
phase_fs | - The phase adjustment in femto-seconds. |
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 the max. value and everything under the minimum supported value of 10MHz to the min. value.
ADF4368 Set reference frequency attribute
dev | - The device structure. |
val | - The desired reference frequency in Hz. |
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. value.
ADF4368 Set reference divider attribute
dev | - The device structure. |
div | - The reference divider value. |
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.8GHz to the max. value and everything under the minimum supported value of 800MHz to the min. value.
ADF4368 Set output frequency attribute
dev | - The device structure. |
val | - The desired output frequency in Hz. |
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 new reference clock.
ADF4368 Set sw_sync attribute
dev | - The device structure. |
sw_sync | - Set send SW_SYNC request |
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.
ADF4368 Set sync_setup attribute
dev | - The device structure. |
en | - The enable or disable SYNC feature. |
int adf4368_set_temperature | ( | struct adf4368_dev * | dev, |
bool | en ) |
Set Temperature Readback feature's initial state. This feature should be disabled after reading temperature.
ADF4368 Set temperature readback setup attribute
dev | - The device structure. |
en | - The enable or disable Temperature readback feature. |
int adf4368_spi_read | ( | struct adf4368_dev * | dev, |
uint16_t | reg_addr, | ||
uint8_t * | data ) |
Reads data from ADF4368 over SPI.
ADF4368 SPI Read
dev | - The device structure. |
reg_addr | - The register address. |
data | - Data read from the device. |
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.
ADF4368 updates a bit in the register space over SPI
dev | - The device structure. |
reg_addr | - The register address. |
mask | - Bits to be updated. |
data | - Update value for the mask. |
int adf4368_spi_write | ( | struct adf4368_dev * | dev, |
uint16_t | reg_addr, | ||
uint8_t | data ) |
Writes data to ADF4368 over SPI.
ADF4368 SPI write
dev | - The device structure. |
reg_addr | - The register address. |
data | - Data value to write. |