Implementation of AD9528 Driver. More...
#include <stdlib.h>
#include <limits.h>
#include <stdio.h>
#include "no_os_print_log.h"
#include "no_os_alloc.h"
#include "no_os_error.h"
#include "no_os_util.h"
#include "no_os_clk.h"
#include "ad9528.h"
#include "jesd204.h"
Classes | |
struct | ad9528_jesd204_priv |
Functions | |
int32_t | ad9528_spi_read (struct ad9528_dev *dev, uint32_t reg_addr, uint32_t *reg_data) |
Reads the value of the selected register. | |
int32_t | ad9528_spi_write (struct ad9528_dev *dev, uint32_t reg_addr, uint32_t reg_data) |
Writes a value to the selected register. | |
int32_t | ad9528_spi_read_n (struct ad9528_dev *dev, uint32_t reg_addr, uint32_t *reg_data) |
Reads the value of the selected register. | |
int32_t | ad9528_spi_write_n (struct ad9528_dev *dev, uint32_t reg_addr, uint32_t reg_data) |
Writes a value to the selected register. | |
int32_t | ad9528_poll (struct ad9528_dev *dev, uint32_t reg_addr, uint32_t mask, uint32_t data) |
Poll register. | |
int32_t | ad9528_io_update (struct ad9528_dev *dev) |
Updates the AD9528 configuration. | |
int32_t | ad9528_sync (struct ad9528_dev *dev) |
Updates the AD9528 configuration. | |
int32_t | ad9528_init (struct ad9528_init_param *init_param) |
Initializes the AD9528. | |
int32_t | ad9528_clk_recalc_rate (struct no_os_clk_desc *desc, uint64_t *rate) |
Get the current frequency of the clock. | |
int32_t | ad9528_setup (struct ad9528_dev **device, struct ad9528_init_param init_param) |
Initializes the AD9528. | |
int32_t | ad9528_remove (struct ad9528_dev *dev) |
Free the resources allocated by ad9528_setup(). | |
uint32_t | ad9528_calc_out_div (uint32_t rate, uint32_t parent_rate) |
Calculate the output channel divider. | |
uint32_t | ad9528_clk_round_rate (struct ad9528_dev *dev, uint32_t chan, uint32_t rate) |
Calculate closest possible rate. | |
int32_t | ad9528_clk_set_rate (struct ad9528_dev *dev, uint32_t chan, uint32_t rate) |
Set channel rate. | |
int32_t | ad9528_reset (struct ad9528_dev *dev) |
Performs a hard reset on the AD9528. | |
Implementation of AD9528 Driver.
Copyright 2015-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:
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.
uint32_t ad9528_calc_out_div | ( | uint32_t | rate, |
uint32_t | parent_rate ) |
Calculate the output channel divider.
rate | - The desired rate. |
parent_rate | - The parent rate. |
int32_t ad9528_clk_recalc_rate | ( | struct no_os_clk_desc * | desc, |
uint64_t * | rate ) |
Get the current frequency of the clock.
desc | - The CLK descriptor. |
rate | - The CLK rate. |
uint32_t ad9528_clk_round_rate | ( | struct ad9528_dev * | dev, |
uint32_t | chan, | ||
uint32_t | rate ) |
Calculate closest possible rate.
dev | - is a pointer to the ad9528_dev data structure. |
chan | - The output channel. |
rate | - The desired rate. |
int32_t ad9528_clk_set_rate | ( | struct ad9528_dev * | dev, |
uint32_t | chan, | ||
uint32_t | rate ) |
Set channel rate.
dev | - is a pointer to the ad9528_dev data structure. |
chan | - Channel number. |
rate | - Channel rate in Hz. |
int32_t ad9528_init | ( | struct ad9528_init_param * | init_param | ) |
Initializes the AD9528.
init_param | - The structure containing the device initial parameters. |
int32_t ad9528_io_update | ( | struct ad9528_dev * | dev | ) |
Updates the AD9528 configuration.
dev | - The device structure. |
int32_t ad9528_poll | ( | struct ad9528_dev * | dev, |
uint32_t | reg_addr, | ||
uint32_t | mask, | ||
uint32_t | data ) |
Poll register.
dev | - The device structure. |
reg_addr | - The address of the register. |
mask | - The mask that is applied. |
data | - The expected data. |
int32_t ad9528_remove | ( | struct ad9528_dev * | dev | ) |
Free the resources allocated by ad9528_setup().
dev | - The device structure. |
int32_t ad9528_reset | ( | struct ad9528_dev * | dev | ) |
Performs a hard reset on the AD9528.
dev | is a pointer to the ad9528_dev data structure. |
int32_t ad9528_setup | ( | struct ad9528_dev ** | device, |
struct ad9528_init_param | init_param ) |
Initializes the AD9528.
device | - The device structure. |
init_param | - The structure containing the device initial parameters. |
int32_t ad9528_spi_read | ( | struct ad9528_dev * | dev, |
uint32_t | reg_addr, | ||
uint32_t * | reg_data ) |
Reads the value of the selected register.
dev | - The device structure. |
reg_addr | - The address of the register to read |
reg_data | - The register's value. |
int32_t ad9528_spi_read_n | ( | struct ad9528_dev * | dev, |
uint32_t | reg_addr, | ||
uint32_t * | reg_data ) |
Reads the value of the selected register.
dev | - The device structure. |
reg_addr | - The address of the register to read - address[31:16] holds the number of bytes to read (a round about method)– it is also limited to 4 bytes max (to fill in a 32 bit integer type). |
reg_data | - The register's value. |
int32_t ad9528_spi_write | ( | struct ad9528_dev * | dev, |
uint32_t | reg_addr, | ||
uint32_t | reg_data ) |
Writes a value to the selected register.
dev | - The device structure. |
reg_addr | - The address of the register to write |
reg_data | - The value to write to the register. |
int32_t ad9528_spi_write_n | ( | struct ad9528_dev * | dev, |
uint32_t | reg_addr, | ||
uint32_t | reg_data ) |
Writes a value to the selected register.
dev | - The device structure. |
reg_addr | - The address of the register to write - address[31:16] holds the number of bytes to write (a round about method)– it is also limited to 4 bytes max (to fill in a 32 bit integer type). |
reg_data | - The value to write to the register. |
int32_t ad9528_sync | ( | struct ad9528_dev * | dev | ) |
Updates the AD9528 configuration.
dev | - The device structure. |