![]() |
no-OS
|
Header file of AD9528 Driver. More...
#include <stdint.h>#include <stdbool.h>#include "no_os_delay.h"#include "no_os_spi.h"#include "no_os_gpio.h"Classes | |
| struct | ad9528_channel_spec |
| Output channel configuration. More... | |
| struct | ad9528_platform_data |
| platform specific information More... | |
| struct | ad9528_state |
| struct | ad9528_dev |
| struct | ad9528_init_param |
Enumerations | |
| enum | { AD9528_STAT_PLL1_LD , AD9528_STAT_PLL2_LD , AD9528_STAT_REFA , AD9528_STAT_REFB , AD9528_STAT_REFAB_MISSING , AD9528_STAT_VCXO , AD9528_STAT_PLL1_FB_CLK , AD9528_STAT_PLL2_FB_CLK , AD9528_SYNC } |
| enum | { AD9528_VCO , AD9528_VCXO , AD9528_SYSREF , AD9528_NUM_CLK_SRC } |
Functions | |
| int32_t | ad9528_init (struct ad9528_init_param *init_param) |
| Initializes the AD9528. | |
| int32_t | ad9528_setup (struct ad9528_dev **device, struct ad9528_init_param init_param) |
| Initializes the AD9528. | |
| 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. | |
| 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. | |
| int32_t | ad9528_remove (struct ad9528_dev *dev) |
| Free the resources allocated by ad9528_setup(). | |
Header file of AD9528 Driver.
Copyright 2015-2016(c) Analog Devices, Inc.
SPDX-License-Identifier: BSD-3-Clause
| #define AD9528_1B | ( | x | ) |
| #define AD9528_2B | ( | x | ) |
| #define AD9528_3B | ( | x | ) |
| #define AD9528_4B | ( | x | ) |
| #define AD9528_ADDR | ( | x | ) |
| #define AD9528_CHANNEL_IGNORE_MASK | ( | x | ) |
| #define AD9528_CHANNEL_IGNORE_MASK_REV | ( | x | ) |
| #define AD9528_CHANNEL_OUTPUT | ( | ch | ) |
| #define AD9528_CHANNEL_PD_EN AD9528_2B(0x501) |
| #define AD9528_CHANNEL_PD_MASK | ( | x | ) |
| #define AD9528_CHANNEL_PD_MASK_REV | ( | x | ) |
| #define AD9528_CHANNEL_SYNC AD9528_1B(0x32A) |
| #define AD9528_CHANNEL_SYNC_IGNORE AD9528_2B(0x32B) |
| #define AD9528_CHANNEL_SYNC_SET (1 << 0) |
| #define AD9528_CHIP_ID AD9528_4B(0x3) |
| #define AD9528_CLK_DIST_CTRL | ( | x | ) |
| #define AD9528_CLK_DIST_CTRL_MASK (0x7 << 5) |
| #define AD9528_CLK_DIST_CTRL_REV | ( | x | ) |
| #define AD9528_CLK_DIST_DIV | ( | x | ) |
| #define AD9528_CLK_DIST_DIV_MASK (0xFF << 16) |
| #define AD9528_CLK_DIST_DIV_MAX 256 |
| #define AD9528_CLK_DIST_DIV_MIN 1 |
| #define AD9528_CLK_DIST_DIV_PHASE | ( | x | ) |
| #define AD9528_CLK_DIST_DIV_PHASE_REV | ( | x | ) |
| #define AD9528_CLK_DIST_DIV_REV | ( | x | ) |
| #define AD9528_CLK_DIST_DRIVER_MODE | ( | x | ) |
| #define AD9528_CLK_DIST_DRIVER_MODE_REV | ( | x | ) |
| #define AD9528_CNT | ( | x | ) |
| #define AD9528_IO_UPDATE AD9528_1B(0xF) |
| #define AD9528_IO_UPDATE_EN (1 << 0) |
| #define AD9528_IS_CALIBRATING (1 << 8) |
| #define AD9528_NUM_CHAN 14 |
| #define AD9528_PD_BIAS NO_OS_BIT(4) |
| #define AD9528_PD_CHIP NO_OS_BIT(0) |
| #define AD9528_PD_EN AD9528_1B(0x500) |
| #define AD9528_PD_OUT_CLOCKS NO_OS_BIT(1) |
| #define AD9528_PD_PLL1 NO_OS_BIT(2) |
| #define AD9528_PD_PLL2 NO_OS_BIT(3) |
| #define AD9528_PLL1_CHARGE_PUMP_AUTO_TRISTATE_DIS (1 << 12) |
| #define AD9528_PLL1_CHARGE_PUMP_CTRL AD9528_2B(0x106) |
| #define AD9528_PLL1_CHARGE_PUMP_CURRENT_nA | ( | x | ) |
| #define AD9528_PLL1_CHARGE_PUMP_MODE_NORMAL (3 << 8) |
| #define AD9528_PLL1_CHARGE_PUMP_MODE_PUMP_DOWN (2 << 8) |
| #define AD9528_PLL1_CHARGE_PUMP_MODE_PUMP_UP (1 << 8) |
| #define AD9528_PLL1_CHARGE_PUMP_MODE_TRISTATE (0 << 8) |
| #define AD9528_PLL1_CHARGE_PUMP_TRISTATE (1 << 7) |
| #define AD9528_PLL1_CTRL AD9528_3B(0x108) |
| #define AD9528_PLL1_FEEDBACK_BYPASS_EN (1 << 13) |
| #define AD9528_PLL1_FEEDBACK_DIVIDER AD9528_2B(0x104) |
| #define AD9528_PLL1_FREQ_DETECTOR_PD_EN (1 << 7) |
| #define AD9528_PLL1_LOCKED (1 << 0) |
| #define AD9528_PLL1_OK (1 << 6) |
| #define AD9528_PLL1_OSC_CTRL_FAIL_VCC_BY2_EN (1 << 19) |
| #define AD9528_PLL1_OSC_IN_CMOS_NEG_INP_EN (1 << 1) |
| #define AD9528_PLL1_OSC_IN_DIFF_EN (1 << 0) |
| #define AD9528_PLL1_REF_A_DIVIDER AD9528_2B(0x100) |
| #define AD9528_PLL1_REF_B_DIVIDER AD9528_2B(0x102) |
| #define AD9528_PLL1_REF_MODE | ( | x | ) |
| #define AD9528_PLL1_REFA_BYPASS_EN (1 << 11) |
| #define AD9528_PLL1_REFA_CMOS_NEG_INP_EN (1 << 8) |
| #define AD9528_PLL1_REFA_DIFF_RCV_EN (1 << 5) |
| #define AD9528_PLL1_REFA_RCV_EN (1 << 3) |
| #define AD9528_PLL1_REFB_BYPASS_EN (1 << 12) |
| #define AD9528_PLL1_REFB_CMOS_NEG_INP_EN (1 << 9) |
| #define AD9528_PLL1_REFB_DIFF_RCV_EN (1 << 6) |
| #define AD9528_PLL1_REFB_RCV_EN (1 << 4) |
| #define AD9528_PLL1_SOURCE_VCXO (1 << 10) |
| #define AD9528_PLL1_VCXO_RCV_PD_EN (1 << 2) |
| #define AD9528_PLL2_CHARGE_PUMP AD9528_1B(0x200) |
| #define AD9528_PLL2_CHARGE_PUMP_CURRENT_nA | ( | x | ) |
| #define AD9528_PLL2_CHARGE_PUMP_MODE_NORMAL (3 << 0) |
| #define AD9528_PLL2_CHARGE_PUMP_MODE_PUMP_DOWN (2 << 0) |
| #define AD9528_PLL2_CHARGE_PUMP_MODE_PUMP_UP (1 << 0) |
| #define AD9528_PLL2_CHARGE_PUMP_MODE_TRISTATE (0 << 0) |
| #define AD9528_PLL2_CTRL AD9528_1B(0x202) |
| #define AD9528_PLL2_DOUBLER_R1_EN (1 << 4) |
| #define AD9528_PLL2_FB_NDIV | ( | a, | |
| b ) |
| #define AD9528_PLL2_FB_NDIV_A_CNT | ( | x | ) |
| #define AD9528_PLL2_FB_NDIV_B_CNT | ( | x | ) |
| #define AD9528_PLL2_FEEDBACK_DIVIDER_AB AD9528_1B(0x201) |
| #define AD9528_PLL2_FORCE_REFERENCE_VALID (1 << 2) |
| #define AD9528_PLL2_FORCE_VCO_MIDSCALE (1 << 1) |
| #define AD9528_PLL2_FREQ_DOUBLER_EN (1 << 5) |
| #define AD9528_PLL2_LOCK_DETECT_PWR_DOWN_EN (1 << 7) |
| #define AD9528_PLL2_LOCKED (1 << 1) |
| #define AD9528_PLL2_LOOP_FILTER_CPOLE1 | ( | x | ) |
| #define AD9528_PLL2_LOOP_FILTER_CTRL AD9528_2B(0x205) |
| #define AD9528_PLL2_LOOP_FILTER_RPOLE2 | ( | x | ) |
| #define AD9528_PLL2_LOOP_FILTER_RZERO | ( | x | ) |
| #define AD9528_PLL2_LOOP_FILTER_RZERO_BYPASS_EN (1 << 8) |
| #define AD9528_PLL2_N2_DIV | ( | x | ) |
| #define AD9528_PLL2_N2_DIVIDER AD9528_1B(0x208) |
| #define AD9528_PLL2_OK (1 << 7) |
| #define AD9528_PLL2_R1_DIV | ( | x | ) |
| #define AD9528_PLL2_R1_DIVIDER AD9528_1B(0x207) |
| #define AD9528_PLL2_VCO_CALIBRATE (1 << 0) |
| #define AD9528_PLL2_VCO_CTRL AD9528_1B(0x203) |
| #define AD9528_PLL2_VCO_DIV_M1 | ( | x | ) |
| #define AD9528_PLL2_VCO_DIV_M1_PWR_DOWN_EN (1 << 3) |
| #define AD9528_PLL2_VCO_DIVIDER AD9528_1B(0x204) |
| #define AD9528_READ (1 << 15) |
| #define AD9528_READBACK AD9528_2B(0x508) |
| #define AD9528_REFA_OK (1 << 2) |
| #define AD9528_REFA_REFB_NOK (1 << 4) |
| #define AD9528_REFB_OK (1 << 3) |
| #define AD9528_SER_CONF_ADDR_INCREMENT ((1 << 2) | (1 << 5)) |
| #define AD9528_SER_CONF_LSB_FIRST ((1 << 1) | (1 << 6)) |
| #define AD9528_SER_CONF_READ_BUFFERED (1 << 5) |
| #define AD9528_SER_CONF_RESET_SANS_REGMAP (1 << 2) |
| #define AD9528_SER_CONF_SDO_ACTIVE ((1 << 3) | (1 << 4)) |
| #define AD9528_SER_CONF_SOFT_RESET ((1 << 0) | (1 << 7)) |
| #define AD9528_SERIAL_PORT_CONFIG AD9528_1B(0x0) |
| #define AD9528_SERIAL_PORT_CONFIG_B AD9528_1B(0x1) |
| #define AD9528_SPI_MAGIC 0x00FF05 |
| #define AD9528_STAT0_DIV_EN (1 << 1) |
| #define AD9528_STAT0_PIN_EN (1 << 2) |
| #define AD9528_STAT1_DIV_EN (1 << 0) |
| #define AD9528_STAT1_PIN_EN (1 << 3) |
| #define AD9528_STAT_MON0 AD9528_1B(0x505) |
| #define AD9528_STAT_MON1 AD9528_1B(0x506) |
| #define AD9528_STAT_PIN_EN AD9528_1B(0x507) |
| #define AD9528_SYSREF_CTRL AD9528_2B(0x402) |
| #define AD9528_SYSREF_K_DIV | ( | x | ) |
| #define AD9528_SYSREF_K_DIV_MAX (65535u) |
| #define AD9528_SYSREF_K_DIV_MIN (1u) |
| #define AD9528_SYSREF_K_DIVIDER AD9528_2B(0x400) |
| #define AD9528_SYSREF_NSHOT_MODE | ( | x | ) |
| #define AD9528_SYSREF_PATTERN_CLK_SRC_PLL1 (1 << 3) |
| #define AD9528_SYSREF_PATTERN_MODE | ( | x | ) |
| #define AD9528_SYSREF_PATTERN_REQ (1 << 8) |
| #define AD9528_SYSREF_PATTERN_TRIGGER_CTRL | ( | x | ) |
| #define AD9528_SYSREF_REQUEST_BY_PIN (1 << 7) |
| #define AD9528_SYSREF_RESAMPLE_CTRL AD9528_2B(0x32D) |
| #define AD9528_SYSREF_RESAMPLER_CLK_SRC_PLL1 (1 << 4) |
| #define AD9528_SYSREF_RESET (1 << 0) |
| #define AD9528_SYSREF_SOURCE | ( | x | ) |
| #define AD9528_SYSREF_TEST_MODE | ( | x | ) |
| #define AD9528_TRANSF_LEN | ( | x | ) |
| #define AD9528_VCXO_OK (1 << 5) |
| #define AD9528_WRITE (0 << 15) |
| #define AD_IF | ( | _pde, | |
| _a ) |
| #define AD_IFE | ( | _pde, | |
| _a, | |||
| _b ) |
| #define CPOLE1_0_PF 0 |
| #define CPOLE1_16_PF 2 |
| #define CPOLE1_24_PF 3 |
| #define CPOLE1_32_PF 5 |
| #define CPOLE1_40_PF 6 |
| #define CPOLE1_48_PF 7 |
| #define CPOLE1_8_PF 1 |
| #define DRIVER_MODE_HSTL 2 |
| #define DRIVER_MODE_LVDS 0 |
| #define DRIVER_MODE_LVDS_BOOST 1 |
| #define REF_MODE_EXT_REF 4 |
| #define REF_MODE_REVERT_TO_REFA 1 |
| #define REF_MODE_SELECT_REFA 2 |
| #define REF_MODE_SELECT_REFB 3 |
| #define REF_MODE_STAY_ON_REFB 0 |
| #define RPOLE2_225_OHM 3 |
| #define RPOLE2_300_OHM 2 |
| #define RPOLE2_450_OHM 1 |
| #define RPOLE2_900_OHM 0 |
| #define RZERO_1850_OHM 7 |
| #define RZERO_2000_OHM 6 |
| #define RZERO_2100_OHM 3 |
| #define RZERO_2250_OHM 2 |
| #define RZERO_2500_OHM 5 |
| #define RZERO_2750_OHM 1 |
| #define RZERO_3000_OHM 4 |
| #define RZERO_3250_OHM 0 |
| #define SOURCE_SYSREF_VCO 2 |
| #define SOURCE_SYSREF_VCXO 3 |
| #define SOURCE_SYSREF_VCXO_INV 7 |
| #define SOURCE_VCO 0 |
| #define SOURCE_VCXO 1 |
| #define SOURCE_VCXO_INV 5 |
| #define SYSREF_EDGE_FALLING 3 |
| #define SYSREF_EDGE_RISING 2 |
| #define SYSREF_LEVEL_HIGH 0 |
| #define SYSREF_NSHOT_1_PULSE 1 |
| #define SYSREF_NSHOT_2_PULSES 2 |
| #define SYSREF_NSHOT_4_PULSES 3 |
| #define SYSREF_NSHOT_6_PULSES 4 |
| #define SYSREF_NSHOT_8_PULSES 5 |
| #define SYSREF_PATTERN_CONTINUOUS 1 |
| #define SYSREF_PATTERN_NSHOT 0 |
| #define SYSREF_PATTERN_PRBS 2 |
| #define SYSREF_PATTERN_STOP 3 |
| #define SYSREF_SRC_EXTERNAL 0 |
| #define SYSREF_SRC_EXTERNAL_RESAMPLED 1 |
| #define SYSREF_SRC_INTERNAL 2 |
| anonymous enum |
| 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. |