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"
|
| 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.
|
| |
| int | 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.
- Author
- DBogdan (drago.nosp@m.s.bo.nosp@m.gdan@.nosp@m.anal.nosp@m.og.co.nosp@m.m)
Copyright 2015-2016(c) Analog Devices, Inc.
SPDX-License-Identifier: BSD-3-Clause
◆ ad9528_calc_out_div()
| uint32_t ad9528_calc_out_div |
( |
uint32_t | rate, |
|
|
uint32_t | parent_rate ) |
Calculate the output channel divider.
- Parameters
-
| rate | - The desired rate. |
| parent_rate | - The parent rate. |
- Returns
- The output divider.
◆ ad9528_clk_recalc_rate()
| int ad9528_clk_recalc_rate |
( |
struct no_os_clk_desc * | desc, |
|
|
uint64_t * | rate ) |
Get the current frequency of the clock.
- Parameters
-
| desc | - The CLK descriptor. |
| rate | - The CLK rate. |
- Returns
- 0 in case of success, negative error code otherwise.
◆ ad9528_clk_round_rate()
| uint32_t ad9528_clk_round_rate |
( |
struct ad9528_dev * | dev, |
|
|
uint32_t | chan, |
|
|
uint32_t | rate ) |
Calculate closest possible rate.
- Parameters
-
| dev | - is a pointer to the ad9528_dev data structure. |
| chan | - The output channel. |
| rate | - The desired rate. |
- Returns
- The closest possible rate of desired rate.
◆ ad9528_clk_set_rate()
| int32_t ad9528_clk_set_rate |
( |
struct ad9528_dev * | dev, |
|
|
uint32_t | chan, |
|
|
uint32_t | rate ) |
Set channel rate.
- Parameters
-
| dev | - is a pointer to the ad9528_dev data structure. |
| chan | - Channel number. |
| rate | - Channel rate in Hz. |
- Returns
- 0 in case of success, negative error code otherwise.
◆ ad9528_init()
Initializes the AD9528.
- Parameters
-
| init_param | - The structure containing the device initial parameters. |
- Returns
- Returns 0 in case of success or negative error code.
◆ ad9528_io_update()
| int32_t ad9528_io_update |
( |
struct ad9528_dev * | dev | ) |
|
Updates the AD9528 configuration.
- Parameters
-
| dev | - The device structure. |
- Returns
- Returns 0 in case of success or negative error code.
◆ ad9528_poll()
| int32_t ad9528_poll |
( |
struct ad9528_dev * | dev, |
|
|
uint32_t | reg_addr, |
|
|
uint32_t | mask, |
|
|
uint32_t | data ) |
Poll register.
- Parameters
-
| dev | - The device structure. |
| reg_addr | - The address of the register. |
| mask | - The mask that is applied. |
| data | - The expected data. |
- Returns
- Returns 0 in case of success or negative error code.
◆ ad9528_remove()
Free the resources allocated by ad9528_setup().
- Parameters
-
| dev | - The device structure. |
- Returns
- 0 in case of success, negative error code otherwise.
◆ ad9528_reset()
Performs a hard reset on the AD9528.
- Parameters
-
- Returns
- Returns 0 for success, negative value for failure.
◆ ad9528_setup()
Initializes the AD9528.
- Parameters
-
| device | - The device structure. |
| init_param | - The structure containing the device initial parameters. |
- Returns
- Returns 0 in case of success or negative error code.
◆ ad9528_spi_read()
| int32_t ad9528_spi_read |
( |
struct ad9528_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 | - The register's value. |
- Returns
- Returns 0 in case of success or negative error code.
◆ ad9528_spi_read_n()
| 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.
- Parameters
-
| 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. |
- Returns
- Returns 0 in case of success or negative error code.
◆ ad9528_spi_write()
| int32_t ad9528_spi_write |
( |
struct ad9528_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 |
| reg_data | - The value to write to the register. |
- Returns
- Returns 0 in case of success or negative error code.
◆ ad9528_spi_write_n()
| 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.
- Parameters
-
| 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. |
- Returns
- Returns 0 in case of success or negative error code.
◆ ad9528_sync()
Updates the AD9528 configuration.
- Parameters
-
| dev | - The device structure. |
- Returns
- Returns 0 in case of success or negative error code.