no-OS
Macros | Functions
ad9739a.c File Reference

Implementation of AD9739A Driver. More...

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

Macros

#define FDATA   2500
 

Functions

int32_t ad9739a_write (struct ad9739a_dev *dev, uint8_t register_address, uint8_t register_value)
 Writes a value to the selected register. More...
 
int32_t ad9739a_read (struct ad9739a_dev *dev, uint8_t register_address, uint8_t *register_value)
 Reads the value of the selected register. More...
 
int32_t ad9739a_reset (struct ad9739a_dev *dev)
 Resets the device. More...
 
int32_t ad9739a_power_down (struct ad9739a_dev *dev, uint8_t pwr_config)
 Powers down LVDS interface and TxDAC. More...
 
int32_t ad_serdes_clk (struct ad9739a_dev *dev, uint8_t mode)
 Sets the normal baseband mode or mix-mode. More...
 
float ad9739a_dac_fs_current (struct ad9739a_dev *dev, float fs_val)
 Sets the full-scale output current for the DAC. More...
 
int32_t delay_fdata_cycles (uint32_t cycles)
 Delay for a number of fdata clock cycles. More...
 
int32_t ad9739a_setup (struct ad9739a_dev **device, struct ad9739a_init_param init_param)
 Initializes the AD9739A. More...
 
int32_t ad9739a_remove (struct ad9739a_dev *dev)
 Free the resources allocated by ad9739a_setup(). More...
 

Detailed Description

Implementation of AD9739A Driver.

Author
1 Bancisor Mihai
2 Grozav Andrei

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

Macro Definition Documentation

◆ FDATA

#define FDATA   2500

Function Documentation

◆ ad9739a_dac_fs_current()

float ad9739a_dac_fs_current ( struct ad9739a_dev dev,
float  fs_val 
)

Sets the full-scale output current for the DAC.

Parameters
dev- The device structure.
fs_val- The desired full-scale output current. Accepted values: 8.7 to 32.7 (mA) and 0. When fs_val is set to 0 the DAC output is disabled(sleep).
Returns
Returns the actual set full-scale current or negative error code.
Here is the caller graph for this function:

◆ ad9739a_power_down()

int32_t ad9739a_power_down ( struct ad9739a_dev dev,
uint8_t  pwr_config 
)

Powers down LVDS interface and TxDAC.

Parameters
dev- The device structure.
pwr_config- Selects the modules to be powered-down. Example: AD9739A_POWER_DOWN_LVDS_DRVR_PD | AD9739A_POWER_DOWN_LVDS_RCVR_PD
Returns
Returns negative error code or 0 in case of success.

◆ ad9739a_read()

int32_t ad9739a_read ( struct ad9739a_dev dev,
uint8_t  register_address,
uint8_t *  register_value 
)

Reads the value of the selected register.

Parameters
dev- The device structure.
register_address- The address of the register to read.
register_value- The value read from the register.
Returns
registerValue - The register's value or negative error code.
Here is the caller graph for this function:

◆ ad9739a_remove()

int32_t ad9739a_remove ( struct ad9739a_dev dev)

Free the resources allocated by ad9739a_setup().

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

◆ ad9739a_reset()

int32_t ad9739a_reset ( struct ad9739a_dev dev)

Resets the device.

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

◆ ad9739a_setup()

int32_t ad9739a_setup ( struct ad9739a_dev **  device,
struct ad9739a_init_param  init_param 
)

Initializes the AD9739A.

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

◆ ad9739a_write()

int32_t ad9739a_write ( struct ad9739a_dev dev,
uint8_t  register_address,
uint8_t  register_value 
)

Writes a value to the selected register.

Parameters
dev- The device structure.
register_address- The address of the register to write to.
register_value- The value to write to the register.
Returns
Returns 0 in case of success or negative error code.
Here is the caller graph for this function:

◆ ad_serdes_clk()

int32_t ad_serdes_clk ( struct ad9739a_dev dev,
uint8_t  mode 
)

Sets the normal baseband mode or mix-mode.

Parameters
dev- The device structure.
mode- mode of operation. Example: AD9739A_DAC_DEC_NORMAL_BASEBAND - normal baseband mode; AD9739A_DAC_DEC_MIX_MODE - mix-mode.
Returns
Returns negative error code or 0 in case of success.

◆ delay_fdata_cycles()

int32_t delay_fdata_cycles ( uint32_t  cycles)

Delay for a number of fdata clock cycles.

Parameters
cycles- Number of cycles to wait for.
Returns
Returns negative error code or 0 in case of success.
Here is the caller graph for this function: