no-OS
Functions
adf4157.c File Reference

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

#include <stdlib.h>
#include "adf4157.h"
#include "adf4157_cfg.h"
Include dependency graph for adf4157.c:

Functions

int8_t adf4157_init (struct adf4157_dev **device, struct adf4157_init_param init_param)
 Initialize the SPI communication with the device. More...
 
int32_t adf4157_remove (struct adf4157_dev *dev)
 Free the resources allocated by adf4157_init(). More...
 
int8_t adf4157_set (struct adf4157_dev *dev, uint32_t value)
 Transmits 32 bits on SPI. More...
 
int32_t adf4157_tune_r_cnt (struct adf4157_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 adf4157_set_freq (struct adf4157_dev *dev, double freq)
 Sets the ADF4157 output frequency. More...
 

Detailed Description

Implementation of ADF4157 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

◆ adf4157_init()

int8_t adf4157_init ( struct adf4157_dev **  device,
struct adf4157_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.

◆ adf4157_remove()

int32_t adf4157_remove ( struct adf4157_dev dev)

Free the resources allocated by adf4157_init().

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

◆ adf4157_set()

int8_t adf4157_set ( struct adf4157_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:

◆ adf4157_set_freq()

double adf4157_set_freq ( struct adf4157_dev dev,
double  freq 
)

Sets the ADF4157 output frequency.

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

◆ adf4157_tune_r_cnt()

int32_t adf4157_tune_r_cnt ( struct adf4157_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.