no-OS
Loading...
Searching...
No Matches
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.
 
int32_t ad9739a_read (struct ad9739a_dev *dev, uint8_t register_address, uint8_t *register_value)
 Reads the value of the selected register.
 
int32_t ad9739a_reset (struct ad9739a_dev *dev)
 Resets the device.
 
int32_t ad9739a_power_down (struct ad9739a_dev *dev, uint8_t pwr_config)
 Powers down LVDS interface and TxDAC.
 
int32_t ad_serdes_clk (struct ad9739a_dev *dev, uint8_t mode)
 Sets the normal baseband mode or mix-mode.
 
float ad9739a_dac_fs_current (struct ad9739a_dev *dev, float fs_val)
 Sets the full-scale output current for the DAC.
 
int32_t delay_fdata_cycles (uint32_t cycles)
 Delay for a number of fdata clock cycles.
 
int32_t ad9739a_setup (struct ad9739a_dev **device, struct ad9739a_init_param init_param)
 Initializes the AD9739A.
 
int32_t ad9739a_remove (struct ad9739a_dev *dev)
 Free the resources allocated by ad9739a_setup().
 

Detailed Description

Implementation of AD9739A Driver.

Author
1 Bancisor Mihai
2 Grozav Andrei

Copyright 2012-2015(c) Analog Devices, Inc.

SPDX-License-Identifier: BSD-3-Clause

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.

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

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

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

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

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