no-OS
Functions
adf4350.c File Reference

Implementation of ADF4350 Driver. More...

#include <malloc.h>
#include <stdio.h>
#include "adf4350.h"
#include "no_os_alloc.h"
Include dependency graph for adf4350.c:

Functions

int32_t adf4350_write (adf4350_dev *dev, uint32_t data)
 Writes 4 bytes of data to ADF4350. More...
 
int32_t adf4350_sync_config (adf4350_dev *dev)
 Updates the registers values. More...
 
int32_t adf4350_tune_r_cnt (adf4350_dev *dev, uint16_t r_cnt)
 Increases the R counter value until the ADF4350_MAX_FREQ_PFD is greater than PFD frequency. More...
 
uint32_t gcd (uint32_t x, uint32_t y)
 Computes the greatest common divider of two numbers. More...
 
int64_t adf4350_set_freq (adf4350_dev *dev, uint64_t freq)
 Sets the ADF4350 frequency. More...
 
int32_t adf4350_setup (adf4350_dev **device, adf4350_init_param init_param)
 Initializes the ADF4350. More...
 
int64_t adf4350_out_altvoltage0_frequency (adf4350_dev *dev, int64_t Hz)
 Stores PLL 0 frequency in Hz. More...
 
int32_t adf4350_out_altvoltage0_frequency_resolution (adf4350_dev *dev, int32_t Hz)
 Stores PLL 0 frequency resolution/channel spacing in Hz. More...
 
int64_t adf4350_out_altvoltage0_refin_frequency (adf4350_dev *dev, int64_t Hz)
 Sets PLL 0 REFin frequency in Hz. More...
 
int32_t adf4350_out_altvoltage0_powerdown (adf4350_dev *dev, int32_t pwd)
 Powers down the PLL. More...
 

Detailed Description

Implementation of ADF4350 Driver.

Author
DBogdan (drago.nosp@m.s.bo.nosp@m.gdan@.nosp@m.anal.nosp@m.og.co.nosp@m.m)

Copyright 2012-2015(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

◆ adf4350_out_altvoltage0_frequency()

int64_t adf4350_out_altvoltage0_frequency ( adf4350_dev dev,
int64_t  Hz 
)

Stores PLL 0 frequency in Hz.

Parameters
dev- The device structure.
Hz- The selected frequency.
Returns
Returns the selected frequency.
Here is the caller graph for this function:

◆ adf4350_out_altvoltage0_frequency_resolution()

int32_t adf4350_out_altvoltage0_frequency_resolution ( adf4350_dev dev,
int32_t  Hz 
)

Stores PLL 0 frequency resolution/channel spacing in Hz.

Parameters
dev- The device structure.
Hz- The selected frequency.
Returns
Returns the selected frequency.
Here is the caller graph for this function:

◆ adf4350_out_altvoltage0_powerdown()

int32_t adf4350_out_altvoltage0_powerdown ( adf4350_dev dev,
int32_t  pwd 
)

Powers down the PLL.

Parameters
dev- The device structure.
pwd- Power option. Example: 0 - Power up the PLL. 1 - Power down the PLL.
Returns
Returns the PLL's power status.

◆ adf4350_out_altvoltage0_refin_frequency()

int64_t adf4350_out_altvoltage0_refin_frequency ( adf4350_dev dev,
int64_t  Hz 
)

Sets PLL 0 REFin frequency in Hz.

Parameters
dev- The device structure.
Hz- The selected frequency.
Returns
Returns the selected frequency.
Here is the caller graph for this function:

◆ adf4350_set_freq()

int64_t adf4350_set_freq ( adf4350_dev dev,
uint64_t  freq 
)

Sets the ADF4350 frequency.

Parameters
dev- The device structure.
freq- The desired frequency value.
Returns
calculatedFrequency - The actual frequency value that was set.
Here is the caller graph for this function:

◆ adf4350_setup()

int32_t adf4350_setup ( adf4350_dev **  device,
adf4350_init_param  init_param 
)

Initializes the ADF4350.

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

◆ adf4350_sync_config()

int32_t adf4350_sync_config ( adf4350_dev dev)

Updates the registers values.

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

◆ adf4350_tune_r_cnt()

int32_t adf4350_tune_r_cnt ( adf4350_dev dev,
uint16_t  r_cnt 
)

Increases the R counter value until the ADF4350_MAX_FREQ_PFD is greater than PFD frequency.

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

◆ adf4350_write()

int32_t adf4350_write ( adf4350_dev dev,
uint32_t  data 
)

Writes 4 bytes of data to ADF4350.

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

◆ gcd()

uint32_t gcd ( uint32_t  x,
uint32_t  y 
)

Computes the greatest common divider of two numbers.

Returns
Returns the gcd.
Here is the caller graph for this function: