no-OS
Functions
ad9517.c File Reference

Implementation of AD9517 Driver. More...

#include <stdlib.h>
#include <errno.h>
#include "no_os_delay.h"
#include "no_os_alloc.h"
#include "ad9517.h"
Include dependency graph for ad9517.c:

Functions

int32_t ad9517_setup (struct ad9517_dev **device, struct ad9517_init_param init_param)
 Initializes the AD9517. More...
 
int32_t ad9517_remove (struct ad9517_dev *dev)
 Free the resources allocated by ad9517_setup(). More...
 
int32_t ad9517_write (struct ad9517_dev *dev, uint32_t reg_addr, uint16_t reg_val)
 Writes data into a register. More...
 
int32_t ad9517_read (struct ad9517_dev *dev, uint32_t reg_addr, uint32_t *reg_value)
 Reads data from a register. More...
 
int32_t ad9517_update (struct ad9517_dev *dev)
 Transfers the contents of the buffer registers into the active registers. More...
 
int64_t ad9517_vco_frequency (struct ad9517_dev *dev, int64_t frequency)
 Sets the VCO frequency. More...
 
int8_t dividers_checker (int32_t number)
 Checks if the number can be decomposed into a product of two numbers smaller or equal to 32 each one. More...
 
int64_t ad9517_frequency (struct ad9517_dev *dev, int32_t channel, int64_t frequency)
 Sets the frequency on the specified channel. More...
 
int32_t ad9517_phase (struct ad9517_dev *dev, int32_t channel, int32_t phase)
 Sets the phase on the specified channel. More...
 
int32_t ad9517_power_mode (struct ad9517_dev *dev, int32_t channel, int32_t mode)
 Sets the power mode of the specified channel. More...
 

Detailed Description

Implementation of AD9517 Driver.

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

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

◆ ad9517_frequency()

int64_t ad9517_frequency ( struct ad9517_dev dev,
int32_t  channel,
int64_t  frequency 
)

Sets the frequency on the specified channel.

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

◆ ad9517_phase()

int32_t ad9517_phase ( struct ad9517_dev dev,
int32_t  channel,
int32_t  phase 
)

Sets the phase on the specified channel.

Parameters
dev- The device structure.
channel- The channel.
phase- The desired phase value.
Returns
Returns the phase or negative error code.

◆ ad9517_power_mode()

int32_t ad9517_power_mode ( struct ad9517_dev dev,
int32_t  channel,
int32_t  mode 
)

Sets the power mode of the specified channel.

Parameters
dev- The device structure.
channel- The channel.
mode- Power mode.
Returns
Returns the mode or negative error code.
Here is the caller graph for this function:

◆ ad9517_read()

int32_t ad9517_read ( struct ad9517_dev dev,
uint32_t  reg_addr,
uint32_t *  reg_value 
)

Reads data from a register.

Parameters
dev- The device structure.
reg_addr- The address of the register to be read.
reg_value- Pointer to the value to be read from the register.
Returns
Returns the read data or negative error code.
Here is the caller graph for this function:

◆ ad9517_remove()

int32_t ad9517_remove ( struct ad9517_dev dev)

Free the resources allocated by ad9517_setup().

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

◆ ad9517_setup()

int32_t ad9517_setup ( struct ad9517_dev **  device,
struct ad9517_init_param  init_param 
)

Initializes the AD9517.

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

◆ ad9517_update()

int32_t ad9517_update ( struct ad9517_dev dev)

Transfers the contents of the buffer registers into the active registers.

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

◆ ad9517_vco_frequency()

int64_t ad9517_vco_frequency ( struct ad9517_dev dev,
int64_t  frequency 
)

Sets the VCO frequency.

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

◆ ad9517_write()

int32_t ad9517_write ( struct ad9517_dev dev,
uint32_t  reg_addr,
uint16_t  reg_val 
)

Writes data into a register.

Parameters
dev- The device structure.
reg_addr- The address of the register to be written.
reg_val- The value to be written into the register.
Returns
Returns 0 in case of success or negative error code.
Here is the caller graph for this function:

◆ dividers_checker()

int8_t dividers_checker ( int32_t  number)

Checks if the number can be decomposed into a product of two numbers smaller or equal to 32 each one.

Parameters
number- The number.
Returns
Returns 1 if the number can't be decomposed or 0 otherwise.
Here is the caller graph for this function: