no-OS
Functions
adf4156.c File Reference

Implementation of ADF4156 Driver for Microblaze processor. More...

#include <stdio.h>
#include <stdlib.h>
#include "adf4156.h"
#include "adf4156_cfg.h"
#include "no_os_alloc.h"
Include dependency graph for adf4156.c:

Functions

int8_t adf4156_init (struct adf4156_dev **device, struct adf4156_init_param init_param)
 Initialize the SPI communication with the device. More...
 
int32_t adf4156_remove (struct adf4156_dev *dev)
 Free the resources allocated by adf4156_init(). More...
 
int8_t adf4156_set (struct adf4156_dev *dev, uint32_t value)
 Transmits 32 bits on SPI. More...
 
int32_t adf4156_tune_r_cnt (struct adf4156_dev *dev, int32_t r_cnt)
 Increases the R counter value until the PFD frequency is smaller than ADF4351_MAX_FREQ_PFD. More...
 
uint32_t gcd (uint32_t x, uint32_t y)
 Computes the greatest common divider of two numbers. More...
 
double adf4156_set_freq (struct adf4156_dev *dev, double freq)
 Sets the ADF4156 output frequency. More...
 

Detailed Description

Implementation of ADF4156 Driver for Microblaze processor.

Author
Lucian Sin (Lucia.nosp@m.n.Si.nosp@m.n@ana.nosp@m.log..nosp@m.com)

Copyright 2013(c) Analog Devices, Inc.

All rights reserved.

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 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, 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

◆ adf4156_init()

int8_t adf4156_init ( struct adf4156_dev **  device,
struct adf4156_init_param  init_param 
)

Initialize the SPI communication with the device.

Parameters
device- The device structure.
init_param- The structure that contains the device initial parameters.
Returns
status - Result of the initialization procedure. Example: 0 - if initialization was successful; -1 - if initialization was unsuccessful.

◆ adf4156_remove()

int32_t adf4156_remove ( struct adf4156_dev dev)

Free the resources allocated by adf4156_init().

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ adf4156_set()

int8_t adf4156_set ( struct adf4156_dev dev,
uint32_t  value 
)

Transmits 32 bits on SPI.

Parameters
dev- The device structure.
value- Data which will be transmitted.
Returns
none.
Here is the caller graph for this function:

◆ adf4156_set_freq()

double adf4156_set_freq ( struct adf4156_dev dev,
double  freq 
)

Sets the ADF4156 output frequency.

Parameters
dev- The device structure.
freq- The desired frequency value.
Returns
calculatedFrequency - The actual frequency value that was set.

◆ adf4156_tune_r_cnt()

int32_t adf4156_tune_r_cnt ( struct adf4156_dev dev,
int32_t  r_cnt 
)

Increases the R counter value until the PFD frequency is smaller than ADF4351_MAX_FREQ_PFD.

Parameters
dev- The device structure.
r_cnt- Initial r_cnt value.
Returns
Final r_cnt value.
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: