no-OS
Macros | Functions
ad9523.c File Reference

Implementation of AD9523 Driver. More...

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

Macros

#define AD_IFE(_pde, _a, _b)   ((dev->pdata->_pde) ? _a : _b)
 
#define AD_IF(_pde, _a)   AD_IFE(_pde, _a, 0)
 

Functions

int32_t ad9523_spi_read (struct ad9523_dev *dev, uint32_t reg_addr, uint32_t *reg_data)
 Reads the value of the selected register. More...
 
int32_t ad9523_spi_write (struct ad9523_dev *dev, uint32_t reg_addr, uint32_t reg_data)
 Writes a value to the selected register. More...
 
int32_t ad9523_io_update (struct ad9523_dev *dev)
 Updates the AD9523 configuration. More...
 
int32_t ad9523_vco_out_map (struct ad9523_dev *dev, uint32_t ch, uint32_t out)
 Sets the clock provider for selected channel. More...
 
int32_t ad9523_calibrate (struct ad9523_dev *dev)
 Updates the AD9523 configuration. More...
 
int32_t ad9523_status (struct ad9523_dev *dev)
 Updates the AD9523 configuration. More...
 
int32_t ad9523_sync (struct ad9523_dev *dev)
 Updates the AD9523 configuration. More...
 
int32_t ad9523_init (struct ad9523_init_param *init_param)
 Initialize the AD9523 data structure with the default register values. More...
 
int32_t ad9523_setup (struct ad9523_dev **device, const struct ad9523_init_param *init_param)
 Setup the AD9523 device. More...
 
int32_t ad9523_remove (struct ad9523_dev *dev)
 Free the resources allocated by ad9523_setup(). More...
 

Detailed Description

Implementation of AD9523 Driver.

Author
ACozma(andre.nosp@m.i.co.nosp@m.zma@a.nosp@m.nalo.nosp@m.g.com)

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

◆ AD_IF

#define AD_IF (   _pde,
  _a 
)    AD_IFE(_pde, _a, 0)

◆ AD_IFE

#define AD_IFE (   _pde,
  _a,
  _b 
)    ((dev->pdata->_pde) ? _a : _b)

Function Documentation

◆ ad9523_calibrate()

int32_t ad9523_calibrate ( struct ad9523_dev dev)

Updates the AD9523 configuration.

Returns
Returns 0 in case of success or negative error code.
Here is the caller graph for this function:

◆ ad9523_init()

int32_t ad9523_init ( struct ad9523_init_param init_param)

Initialize the AD9523 data structure with the default register values.

Parameters
init_param- The device initial parameters.
Returns
Always return 0.

◆ ad9523_io_update()

int32_t ad9523_io_update ( struct ad9523_dev dev)

Updates the AD9523 configuration.

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

◆ ad9523_remove()

int32_t ad9523_remove ( struct ad9523_dev dev)

Free the resources allocated by ad9523_setup().

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

◆ ad9523_setup()

int32_t ad9523_setup ( struct ad9523_dev **  device,
const struct ad9523_init_param init_param 
)

Setup the AD9523 device.

Parameters
device- The device structure.
init_param- The structure holding the device initial parameters.
Returns
Returns 0 in case of success or negative error code.

◆ ad9523_spi_read()

int32_t ad9523_spi_read ( struct ad9523_dev dev,
uint32_t  reg_addr,
uint32_t *  reg_data 
)

Reads the value of the selected register.

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

◆ ad9523_spi_write()

int32_t ad9523_spi_write ( struct ad9523_dev dev,
uint32_t  reg_addr,
uint32_t  reg_data 
)

Writes a value to the selected register.

Parameters
dev- The device structure.
reg_addr- The address of the register to write to.
reg_data- 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:

◆ ad9523_status()

int32_t ad9523_status ( struct ad9523_dev dev)

Updates the AD9523 configuration.

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

◆ ad9523_sync()

int32_t ad9523_sync ( struct ad9523_dev dev)

Updates the AD9523 configuration.

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

◆ ad9523_vco_out_map()

int32_t ad9523_vco_out_map ( struct ad9523_dev dev,
uint32_t  ch,
uint32_t  out 
)

Sets the clock provider for selected channel.

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