no-OS
Loading...
Searching...
No Matches
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.
 
int32_t ad9517_remove (struct ad9517_dev *dev)
 Free the resources allocated by ad9517_setup().
 
int32_t ad9517_write (struct ad9517_dev *dev, uint32_t reg_addr, uint16_t reg_val)
 Writes data into a register.
 
int32_t ad9517_read (struct ad9517_dev *dev, uint32_t reg_addr, uint32_t *reg_value)
 Reads data from a register.
 
int32_t ad9517_update (struct ad9517_dev *dev)
 Transfers the contents of the buffer registers into the active registers.
 
int64_t ad9517_vco_frequency (struct ad9517_dev *dev, int64_t frequency)
 Sets the VCO frequency.
 
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.
 
int64_t ad9517_frequency (struct ad9517_dev *dev, int32_t channel, int64_t frequency)
 Sets the frequency on the specified channel.
 
int32_t ad9517_phase (struct ad9517_dev *dev, int32_t channel, int32_t phase)
 Sets the phase on the specified channel.
 
int32_t ad9517_power_mode (struct ad9517_dev *dev, int32_t channel, int32_t mode)
 Sets the power mode of the specified channel.
 

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.

SPDX-License-Identifier: BSD-3-Clause

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.

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

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

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

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

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

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

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