no-OS
All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
adf5611.c File Reference

Implementation of adf5611 Driver. More...

#include "adf5611.h"
#include "no_os_alloc.h"
#include "no_os_error.h"
#include "no_os_print_log.h"
#include "no_os_delay.h"
Include dependency graph for adf5611.c:

Functions

int adf5611_spi_write (struct adf5611_dev *dev, uint16_t reg_addr, uint8_t data)
 Writes data to ADF5611 over SPI.
 
int adf5611_spi_read (struct adf5611_dev *dev, uint16_t reg_addr, uint8_t *data)
 Reads data from ADF5611 over SPI.
 
int adf5611_spi_update_bits (struct adf5611_dev *dev, uint16_t reg_addr, uint8_t mask, uint8_t data)
 Updates the values of the ADF5611 register.
 
int adf5611_set_ref_clk (struct adf5611_dev *dev, uint64_t val)
 Set the desired reference frequency and reset everything over to maximum supported value of 300MHz to the max. value and everything under the minimum supported value of 50MHz to the min. value.
 
int adf5611_get_ref_clk (struct adf5611_dev *dev, uint64_t *val)
 Gets the user proposed reference frequency.
 
int adf5611_set_ref_div (struct adf5611_dev *dev, int32_t div)
 Set the reference divider value and reset everything over to maximum supported value of 60 to the max value.
 
int adf5611_get_ref_div (struct adf5611_dev *dev, int32_t *div)
 Gets the value the reference divider.
 
int adf5611_set_cp_i (struct adf5611_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 adf5611_get_cp_i (struct adf5611_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 adf5611_set_output_power (struct adf5611_dev *dev, int8_t pwr)
 Set the rfoutput power register value and reset everything over to maximum supported value of 3 to the max. value.
 
int adf5611_get_output_power (struct adf5611_dev *dev, int8_t *pwr)
 Gets the rfoutput power register value.
 
int adf5611_set_rfoutdiv_power (struct adf5611_dev *dev, int32_t pwr)
 Set the rfoutdiv power register value and reset everything over to maximum supported value of 3 to the max. value.
 
int adf5611_get_rfoutdiv_power (struct adf5611_dev *dev, int32_t *pwr)
 Gets the rfoutdiv power register value.
 
int adf5611_set_rfoutdiv_divider (struct adf5611_dev *dev, uint8_t div_val)
 Set the rfoutdiv frequency divider register value and reset everything over to maximum supported value of 128 to the max. value.
 
int adf5611_get_rfoutdiv_divider (struct adf5611_dev *dev, int8_t *div)
 Gets the rfoutdiv divider register value.
 
int adf5611_set_en_rfoutdiv (struct adf5611_dev *dev, bool en)
 Sets the rfoutdiv output block to enable or disable. 1 means the block is powered down else block is powered up.
 
int adf5611_get_en_rfoutdiv (struct adf5611_dev *dev, bool *en)
 Gets the value of rfoutdiv output block if enable or disable.
 
int adf5611_set_rfout (struct adf5611_dev *dev, uint64_t val)
 Set the desired output frequency and reset everything over to maximum supported value of 14.6GHz to the max. value and everything under the minimum supported value of 7.3GHz to the min. value.
 
int adf5611_get_rfout (struct adf5611_dev *dev, uint64_t *val)
 Gets the user proposed output frequency.
 
int adf5611_set_freq (struct adf5611_dev *dev)
 Set the output frequency.
 
int adf5611_init (struct adf5611_dev **dev, struct adf5611_init_param *init_param)
 Initialize the ADF5611.
 
int adf5611_remove (struct adf5611_dev *dev)
 Free resources allocated for ADF5611.
 

Detailed Description

Implementation of adf5611 Driver.

Author
Jude Osemene (jude..nosp@m.osem.nosp@m.ene@a.nosp@m.nalo.nosp@m.g.com)

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:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  3. Neither the name of Analog Devices, Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

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.

Function Documentation

◆ adf5611_get_cp_i()

int adf5611_get_cp_i ( struct adf5611_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.

Parameters
dev- The device structure.
reg_val- The charge pump register value.
Returns
0 in case of success or negative error code.

◆ adf5611_get_en_rfoutdiv()

int adf5611_get_en_rfoutdiv ( struct adf5611_dev * dev,
bool * en )

Gets the value of rfoutdiv output block if enable or disable.

Parameters
dev- The device structure.
en- The status of rfoutdiv output block.
Returns
0 in case of success, negative error code otherwise.

◆ adf5611_get_output_power()

int adf5611_get_output_power ( struct adf5611_dev * dev,
int8_t * pwr )

Gets the rfoutput power register value.

Parameters
dev- The device structure.
pwr- The output power register value.
Returns
0 in case of success or negative error code.

◆ adf5611_get_ref_clk()

int adf5611_get_ref_clk ( struct adf5611_dev * dev,
uint64_t * val )

Gets the user proposed reference frequency.

Parameters
dev- The device structure.
val- The reference frequency in Hz.
Returns
0 in case of success or negative error code.

◆ adf5611_get_ref_div()

int adf5611_get_ref_div ( struct adf5611_dev * dev,
int32_t * div )

Gets the value the reference divider.

Parameters
dev- The device structure.
div- The reference divider value.
Returns
0 in case of success or negative error code.

◆ adf5611_get_rfout()

int adf5611_get_rfout ( struct adf5611_dev * dev,
uint64_t * val )

Gets the user proposed output frequency.

Parameters
dev- The device structure.
val- The output frequency in Hz.
Returns
0 in case of success or negative error code.

◆ adf5611_get_rfoutdiv_divider()

int adf5611_get_rfoutdiv_divider ( struct adf5611_dev * dev,
int8_t * div )

Gets the rfoutdiv divider register value.

Parameters
dev- The device structure.
div- The rfoutdiv divider register value.
Returns
0 in case of success or negative error code.

◆ adf5611_get_rfoutdiv_power()

int adf5611_get_rfoutdiv_power ( struct adf5611_dev * dev,
int32_t * pwr )

Gets the rfoutdiv power register value.

Parameters
dev- The device structure.
pwr- The rfoutdiv power register value.
Returns
0 in case of success or negative error code.

◆ adf5611_init()

int adf5611_init ( struct adf5611_dev ** dev,
struct adf5611_init_param * init_param )

Initialize the ADF5611.

Parameters
dev- The device structure.
init_param- The structure containing the device initial parameters.
Returns
0 in case of success or negative error code
Here is the caller graph for this function:

◆ adf5611_remove()

int adf5611_remove ( struct adf5611_dev * dev)

Free resources allocated for ADF5611.

Parameters
dev- The device structure.
Returns
0 in case of success or negative error code.
Here is the caller graph for this function:

◆ adf5611_set_cp_i()

int adf5611_set_cp_i ( struct adf5611_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.

Parameters
dev- The device structure.
reg_val- The desired charge pump register value.
Returns
set frequency function in case of success or negative error code.

◆ adf5611_set_en_rfoutdiv()

int adf5611_set_en_rfoutdiv ( struct adf5611_dev * dev,
bool en )

Sets the rfoutdiv output block to enable or disable. 1 means the block is powered down else block is powered up.

Parameters
dev- The device structure.
en- Enable/Disable rfoutdiv output.
Returns
Result of the writing procedure, error code otherwise.

◆ adf5611_set_freq()

int adf5611_set_freq ( struct adf5611_dev * dev)

Set the output frequency.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ adf5611_set_output_power()

int adf5611_set_output_power ( struct adf5611_dev * dev,
int8_t pwr )

Set the rfoutput power register value and reset everything over to maximum supported value of 3 to the max. value.

Parameters
dev- The device structure.
pwr- The output power register value.
Returns
Result of the writing procedure, error code otherwise.

◆ adf5611_set_ref_clk()

int adf5611_set_ref_clk ( struct adf5611_dev * dev,
uint64_t val )

Set the desired reference frequency and reset everything over to maximum supported value of 300MHz to the max. value and everything under the minimum supported value of 50MHz to the min. value.

Parameters
dev- The device structure.
val- The desired reference frequency in Hz.
Returns
0 in case of success or negative error code.

◆ adf5611_set_ref_div()

int adf5611_set_ref_div ( struct adf5611_dev * dev,
int32_t div )

Set the reference divider value and reset everything over to maximum supported value of 60 to the max value.

Parameters
dev- The device structure.
div- The reference divider value.
Returns
set frequency function in case of success or negative error code.

◆ adf5611_set_rfout()

int adf5611_set_rfout ( struct adf5611_dev * dev,
uint64_t val )

Set the desired output frequency and reset everything over to maximum supported value of 14.6GHz to the max. value and everything under the minimum supported value of 7.3GHz to the min. value.

Parameters
dev- The device structure.
val- The desired output frequency in Hz.
Returns
set frequency function in case of success or negative error code.
Here is the caller graph for this function:

◆ adf5611_set_rfoutdiv_divider()

int adf5611_set_rfoutdiv_divider ( struct adf5611_dev * dev,
uint8_t div_val )

Set the rfoutdiv frequency divider register value and reset everything over to maximum supported value of 128 to the max. value.

Parameters
dev- The device structure.
div_val- The rfoutdiv divider register value.
Returns
Result of the writing procedure, error code otherwise.

◆ adf5611_set_rfoutdiv_power()

int adf5611_set_rfoutdiv_power ( struct adf5611_dev * dev,
int32_t pwr )

Set the rfoutdiv power register value and reset everything over to maximum supported value of 3 to the max. value.

Parameters
dev- The device structure.
pwr- The rfoutdiv power register value.
Returns
Result of the writing procedure, error code otherwise.

◆ adf5611_spi_read()

int adf5611_spi_read ( struct adf5611_dev * dev,
uint16_t reg_addr,
uint8_t * data )

Reads data from ADF5611 over SPI.

Parameters
dev- The device structure.
reg_addr- The register address.
data- Data read from the device.
Returns
0 in case of success or negative error code otherwise.
Here is the caller graph for this function:

◆ adf5611_spi_update_bits()

int adf5611_spi_update_bits ( struct adf5611_dev * dev,
uint16_t reg_addr,
uint8_t mask,
uint8_t data )

Updates the values of the ADF5611 register.

Parameters
dev- The device structure.
reg_addr- The register address.
mask- Bits to be updated.
data- Update value for the mask.
Returns
0 in case of success or negative error code otherwise.
Here is the caller graph for this function:

◆ adf5611_spi_write()

int adf5611_spi_write ( struct adf5611_dev * dev,
uint16_t reg_addr,
uint8_t data )

Writes data to ADF5611 over SPI.

Parameters
dev- The device structure.
reg_addr- The register address.
data- Data value to write.
Returns
0 in case of success or negative error code otherwise.
Here is the caller graph for this function: