no-OS
ad9172.h
Go to the documentation of this file.
1 /***************************************************************************/
39 #ifndef __AD9172_H__
40 #define __AD9172_H__
41 
42 #include "AD917x.h"
43 #include "no_os_delay.h"
44 #include "no_os_gpio.h"
45 #include "no_os_spi.h"
46 
47 typedef struct ad9172_dev {
48  /* SPI */
50  /* GPIO */
54  struct ad9172_state *st;
55 } ad9172_dev;
56 
57 enum chip_id {
58  CHIPID_AD9171 = 0x71,
59  CHIPID_AD9172 = 0x72,
60  CHIPID_AD9173 = 0x73,
61  CHIPID_AD9174 = 0x74,
62  CHIPID_AD9175 = 0x75,
63  CHIPID_AD9176 = 0x76,
64 };
65 
66 struct ad9172_state {
67  enum chip_id id;
70  uint32_t dac_rate_khz;
71  uint64_t dac_clkin_Hz;
74  uint32_t interpolation;
75  uint32_t jesd_link_mode;
77  uint32_t jesd_subclass;
81  uint8_t nco_main_enable;
83 };
84 
85 typedef struct ad9172_init_param {
86  /* SPI */
88  /* GPIO */
92  uint32_t dac_rate_khz;
93  uint32_t dac_clkin_Hz;
94  uint32_t jesd_link_mode;
95  uint32_t jesd_subclass;
102 
103 int32_t ad9172_init(ad9172_dev **device,
106 #endif // __AD9172_H__
SYNCOUTB_0
@ SYNCOUTB_0
Definition: api_def.h:216
ad9172_remove
int32_t ad9172_remove(ad9172_dev *device)
Definition: ad9172.c:382
SPI_SDO
@ SPI_SDO
Definition: api_def.h:183
ad9172_state
Definition: ad9172.h:66
no_os_gpio_init_param
Structure holding the parameters for GPIO initialization.
Definition: no_os_gpio.h:85
ad9172_state::jesd_dual_link_mode
uint32_t jesd_dual_link_mode
Definition: ad9172.h:76
CHIPID_AD9174
@ CHIPID_AD9174
Definition: ad9172.h:61
ad9172_remove
int32_t ad9172_remove(ad9172_dev *device)
Definition: ad9172.c:382
ad917x_jesd_set_sysref_enable
int32_t ad917x_jesd_set_sysref_enable(ad917x_handle_t *h, uint8_t en)
Enable SysRef Input.
Definition: ad917x_jesd_api.c:246
CHIPID_AD9175
@ CHIPID_AD9175
Definition: ad9172.h:62
ad9172_init_param
Definition: ad9172.h:85
ad917x_init
int32_t ad917x_init(ad917x_handle_t *h)
Initialize AD917X Device This API must be called first before any other API calls....
Definition: ad917x_api.c:168
NO_OS_GENMASK
#define NO_OS_GENMASK(h, l)
Definition: no_os_util.h:86
signal_type_t
signal_type_t
Definition: api_def.h:194
no_os_spi_write_and_read
int32_t no_os_spi_write_and_read(struct no_os_spi_desc *desc, uint8_t *data, uint16_t bytes_number)
Write and read data to/from SPI.
Definition: no_os_spi.c:82
ad9172_init_param::syncoutb_type
signal_type_t syncoutb_type
Definition: ad9172.h:99
no_os_spi.h
Header file of SPI Interface.
ad917x_reset
int32_t ad917x_reset(ad917x_handle_t *h, uint8_t hw_reset)
Reset the AD917X.
Definition: ad917x_api.c:246
jesd_param_t::jesd_L
uint8_t jesd_L
Definition: api_def.h:232
ad9172_state::nco_main_enable
uint8_t nco_main_enable
Definition: ad9172.h:81
ad917x_jesd_get_cfg_param
int32_t ad917x_jesd_get_cfg_param(ad917x_handle_t *h, jesd_param_t *jesd_param)
Read back all current JESD parameter settings.
Definition: ad917x_jesd_api.c:211
no_os_delay.h
Header file of Delay functions.
AD917x.h
AD917X API interface header file.
device
Definition: ad9361_util.h:75
NO_OS_GPIO_HIGH
@ NO_OS_GPIO_HIGH
Definition: no_os_gpio.h:123
JESD_LINK_0
@ JESD_LINK_0
Definition: api_def.h:209
ad917x_get_dac_clk_status
int32_t ad917x_get_dac_clk_status(ad917x_handle_t *h, uint8_t *pll_lock_stat, uint8_t *dll_lock_stat)
Get DAC CLK Status.
Definition: ad917x_api.c:473
ad9172_dev::gpio_txen1
struct no_os_gpio_desc * gpio_txen1
Definition: ad9172.h:53
ad9172_state::dac_interpolation
uint32_t dac_interpolation
Definition: ad9172.h:72
ad917x_jesd_set_scrambler_enable
int32_t ad917x_jesd_set_scrambler_enable(ad917x_handle_t *h, uint8_t en)
Enable the de-scrambler for the JESD Interface.
Definition: ad917x_jesd_api.c:307
ad917x_handle_t::delay_us
delay_us_t delay_us
Definition: AD917x.h:92
ad9172_dev
struct ad9172_dev ad9172_dev
signal_coupling_t
signal_coupling_t
Definition: api_def.h:201
no_os_do_div
uint64_t no_os_do_div(uint64_t *n, uint64_t base)
ad917x_handle_t::sysref
signal_coupling_t sysref
Definition: AD917x.h:89
no_os_mdelay
void no_os_mdelay(uint32_t msecs)
Wait until msecs milliseconds passed.
Definition: delay.c:130
ad9172_state::dac_clkin_Hz
uint64_t dac_clkin_Hz
Definition: ad9172.h:71
adi_chip_id_t::dev_revision
uint8_t dev_revision
Definition: api_def.h:172
CHIPID_AD9173
@ CHIPID_AD9173
Definition: ad9172.h:60
jesd_param_t
Definition: api_def.h:231
AD917X_DAC1
@ AD917X_DAC1
Definition: AD917x.h:43
ad9172_state::dac_h
ad917x_handle_t dac_h
Definition: ad9172.h:68
ad9172_dev
Definition: ad9172.h:47
ad9172_dev::gpio_reset
struct no_os_gpio_desc * gpio_reset
Definition: ad9172.h:51
ad9172_init_param::gpio_txen0
struct no_os_gpio_init_param gpio_txen0
Definition: ad9172.h:89
CHIPID_AD9172
@ CHIPID_AD9172
Definition: ad9172.h:59
ad917x_jesd_set_syncoutb_enable
int32_t ad917x_jesd_set_syncoutb_enable(ad917x_handle_t *h, jesd_syncoutb_t syncoutb, uint8_t en)
Enable the SYNCOUTB Output Signal.
Definition: ad917x_jesd_api.c:436
ad9172_state::nco_channel_enable
uint8_t nco_channel_enable
Definition: ad9172.h:82
ad917x_set_page_idx
int32_t ad917x_set_page_idx(ad917x_handle_t *h, const uint32_t dac, const uint32_t channel)
Select Page.
Definition: ad917x_api.c:611
ad917x_set_clkout_config
int32_t ad917x_set_clkout_config(ad917x_handle_t *h, uint8_t l_div)
Set CLKOUT configuration.
Definition: ad917x_api.c:498
ad9172_dev::gpio_txen0
struct no_os_gpio_desc * gpio_txen0
Definition: ad9172.h:52
ad9172_state::jesd_link_mode
uint32_t jesd_link_mode
Definition: ad9172.h:75
ad9172_dev::st
struct ad9172_state * st
Definition: ad9172.h:54
ad9172_state::interpolation
uint32_t interpolation
Definition: ad9172.h:74
no_os_gpio_remove
int32_t no_os_gpio_remove(struct no_os_gpio_desc *desc)
Free the resources allocated by no_os_gpio_get().
Definition: no_os_gpio.c:95
no_os_spi_desc
Structure holding SPI descriptor.
Definition: no_os_spi.h:132
ad917x_set_dac_clk
int32_t ad917x_set_dac_clk(ad917x_handle_t *h, uint64_t dac_clk_freq_hz, uint8_t dac_pll_en, uint64_t ref_clk_freq_hz)
Configure the DAC Clock Input path based on a the desired dac clock frequency, the applied reference ...
Definition: ad917x_api.c:519
ad9172_init_param::gpio_txen1
struct no_os_gpio_init_param gpio_txen1
Definition: ad9172.h:90
ad9172_init_param::dac_interpolation
uint32_t dac_interpolation
Definition: ad9172.h:96
ad9172_state::channel_interpolation
uint32_t channel_interpolation
Definition: ad9172.h:73
ad917x_get_revision
int32_t ad917x_get_revision(ad917x_handle_t *h, uint8_t *rev_major, uint8_t *rev_minor, uint8_t *rev_rc)
Get API Revision Data.
Definition: ad917x_api.c:304
no_os_gpio_desc
Structure holding the GPIO descriptor.
Definition: no_os_gpio.h:102
ad9172.h
Header file of ad9172 Driver.
ad917x_jesd_get_pll_status
int32_t ad917x_jesd_get_pll_status(ad917x_handle_t *h, uint8_t *pll_status)
Get SERDES PLL Status.
Definition: ad917x_jesd_api.c:472
ad9172_state::appJesdConfig
jesd_param_t appJesdConfig
Definition: ad9172.h:69
ad917x_jesd_enable_datapath
int32_t ad917x_jesd_enable_datapath(ad917x_handle_t *h, uint8_t lanes_msk, uint8_t run_cal, uint8_t en)
Enable the JESD Interface.
Definition: ad917x_jesd_api.c:341
ad9172_state::dac_rate_khz
uint32_t dac_rate_khz
Definition: ad9172.h:70
ad9172_init_param
struct ad9172_init_param ad9172_init_param
CHIPID_AD9176
@ CHIPID_AD9176
Definition: ad9172.h:63
ad9172_init_param::jesd_subclass
uint32_t jesd_subclass
Definition: ad9172.h:95
no_os_gpio_get
int32_t no_os_gpio_get(struct no_os_gpio_desc **desc, const struct no_os_gpio_init_param *param)
Obtain the GPIO decriptor.
Definition: no_os_gpio.c:55
ad917x_jesd_get_link_status
int32_t ad917x_jesd_get_link_status(ad917x_handle_t *h, jesd_link_t link, ad917x_jesd_link_stat_t *link_status)
Get JESD Link Status.
Definition: ad917x_jesd_api.c:598
ad917x_handle_t::tx_en_pin_ctrl
tx_en_pin_ctrl_t tx_en_pin_ctrl
Definition: AD917x.h:94
ad9172_init_param::sysref_coupling
signal_coupling_t sysref_coupling
Definition: ad9172.h:100
ad917x_handle_t::sdo
spi_sdo_config_t sdo
Definition: AD917x.h:87
ad917x_set_channel_gain
int32_t ad917x_set_channel_gain(ad917x_handle_t *h, const uint16_t gain)
Set Channel gain.
Definition: ad917x_nco_api.c:577
adi_chip_id_t::chip_type
uint8_t chip_type
Definition: api_def.h:166
ad9172_init_param::dac_rate_khz
uint32_t dac_rate_khz
Definition: ad9172.h:92
ad9172_state::sysref_coupling
signal_coupling_t sysref_coupling
Definition: ad9172.h:80
no_os_udelay
void no_os_udelay(uint32_t usecs)
Wait until usecs microseconds passed.
Definition: delay.c:118
ad9172_state::id
enum chip_id id
Definition: ad9172.h:67
ad917x_get_chip_id
int32_t ad917x_get_chip_id(ad917x_handle_t *h, adi_chip_id_t *chip_id)
Get Chip Identification Data.
Definition: ad917x_api.c:213
NULL
#define NULL
Definition: wrapper.h:64
JESD_LINK_ALL
@ JESD_LINK_ALL
Definition: api_def.h:211
no_os_gpio_set_value
int32_t no_os_gpio_set_value(struct no_os_gpio_desc *desc, uint8_t value)
Set the value of the specified GPIO.
Definition: no_os_gpio.c:160
init_param
struct ad7616_init_param init_param
Definition: ad7616_sdz.c:96
ad917x_handle_t::dev_xfer
spi_xfer_t dev_xfer
Definition: AD917x.h:91
AD917X_DAC0
@ AD917X_DAC0
Definition: AD917x.h:41
ad9172_init_param::gpio_reset
struct no_os_gpio_init_param gpio_reset
Definition: ad9172.h:91
adi_chip_id_t
Definition: api_def.h:164
ad917x_get_dac_clk_freq
int32_t ad917x_get_dac_clk_freq(ad917x_handle_t *h, uint64_t *dac_clk_freq_hz)
Get the DAC CLK Frequency.
Definition: ad917x_api.c:462
AD917X_CH_NONE
@ AD917X_CH_NONE
Definition: AD917x.h:49
no_os_spi_remove
int32_t no_os_spi_remove(struct no_os_spi_desc *desc)
Free the resources allocated by no_os_spi_init().
Definition: no_os_spi.c:70
ad9172_init_param::dac_clkin_Hz
uint32_t dac_clkin_Hz
Definition: ad9172.h:93
jesd_param_t::jesd_M
uint8_t jesd_M
Definition: api_def.h:234
no_os_gpio.h
Header file of GPIO Interface.
ad917x_handle_t::reset_pin_ctrl
reset_pin_ctrl_t reset_pin_ctrl
Definition: AD917x.h:96
ad917x_handle_t::user_data
void * user_data
Definition: AD917x.h:86
ad9172_init_param::jesd_link_mode
uint32_t jesd_link_mode
Definition: ad9172.h:94
ad9172_init_param::clock_output_config
uint32_t clock_output_config
Definition: ad9172.h:98
ad917x_handle_t::syncoutb
signal_type_t syncoutb
Definition: AD917x.h:88
no_os_spi_init
int32_t no_os_spi_init(struct no_os_spi_desc **desc, const struct no_os_spi_init_param *param)
Initialize the SPI communication peripheral.
Definition: no_os_spi.c:51
ad917x_nco_enable
int32_t ad917x_nco_enable(ad917x_handle_t *h, const ad917x_dac_select_t dacs, const ad917x_channel_select_t channels)
NCO Enable.
Definition: ad917x_nco_api.c:625
AD917X_DAC_NONE
@ AD917X_DAC_NONE
Definition: AD917x.h:39
adi_chip_id_t::prod_grade
uint8_t prod_grade
Definition: api_def.h:170
ad9172_state::clock_output_config
uint32_t clock_output_config
Definition: ad9172.h:78
ad9172_init_param::spi_init
no_os_spi_init_param * spi_init
Definition: ad9172.h:87
ad9172_init
int32_t ad9172_init(ad9172_dev **device, ad9172_init_param *init_param)
Definition: ad9172.c:298
ad9172_init_param::channel_interpolation
uint32_t channel_interpolation
Definition: ad9172.h:97
no_os_gpio_direction_output
int32_t no_os_gpio_direction_output(struct no_os_gpio_desc *desc, uint8_t value)
Enable the output direction of the specified GPIO.
Definition: no_os_gpio.c:124
ad917x_register_write
int32_t ad917x_register_write(ad917x_handle_t *h, const uint16_t address, const uint8_t data)
Perform SPI register write access to AD917X Device.
Definition: ad917x_reg.c:23
adi_chip_id_t::prod_id
uint16_t prod_id
Definition: api_def.h:168
ad917x_handle_t
Definition: AD917x.h:85
ad9172_state::jesd_subclass
uint32_t jesd_subclass
Definition: ad9172.h:77
errno.h
Error macro definition for ARM Compiler.
ad917x_jesd_enable_link
int32_t ad917x_jesd_enable_link(ad917x_handle_t *h, jesd_link_t link, uint8_t en)
Enable JESD Link.
Definition: ad917x_jesd_api.c:572
ad9172_init
int32_t ad9172_init(ad9172_dev **device, ad9172_init_param *init_param)
Definition: ad9172.c:298
CHIPID_AD9171
@ CHIPID_AD9171
Definition: ad9172.h:58
NO_OS_DIV_ROUND_CLOSEST
#define NO_OS_DIV_ROUND_CLOSEST(x, y)
Definition: no_os_util.h:58
ad917x_jesd_config_datapath
int32_t ad917x_jesd_config_datapath(ad917x_handle_t *h, uint8_t dual_en, uint8_t jesd_mode, uint8_t ch_intpl, uint8_t dp_intpl)
Configure the JESD Datapath for AD917X.
Definition: ad917x_jesd_api.c:135
ad9172_state::syncoutb_type
signal_type_t syncoutb_type
Definition: ad9172.h:79
chip_id
chip_id
Definition: ad9172.h:57
no_os_spi_init_param
Structure holding the parameters for SPI initialization.
Definition: no_os_spi.h:112
ad9172_dev::spi_desc
no_os_spi_desc * spi_desc
Definition: ad9172.h:49