no-OS
Loading...
Searching...
No Matches
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.
 
int32_t adf4156_remove (struct adf4156_dev *dev)
 Free the resources allocated by adf4156_init().
 
int8_t adf4156_set (struct adf4156_dev *dev, uint32_t value)
 Transmits 32 bits on SPI.
 
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.
 
uint32_t gcd (uint32_t x, uint32_t y)
 Computes the greatest common divider of two numbers.
 
double adf4156_set_freq (struct adf4156_dev *dev, double freq)
 Sets the ADF4156 output frequency.
 

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.

SPDX-License-Identifier: BSD-3-Clause

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.

◆ 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.

◆ gcd()

uint32_t gcd ( uint32_t x,
uint32_t y )

Computes the greatest common divider of two numbers.

Returns
Returns the gcd.