no-OS
ad9172.h
Go to the documentation of this file.
1 /***************************************************************************/
33 #ifndef __AD9172_H__
34 #define __AD9172_H__
35 
36 #include "AD917x.h"
37 #include "no_os_delay.h"
38 #include "no_os_gpio.h"
39 #include "no_os_spi.h"
40 
41 typedef struct ad9172_dev {
42  /* SPI */
44  /* GPIO */
48  struct ad9172_state *st;
49 } ad9172_dev;
50 
51 enum chip_id {
52  CHIPID_AD9171 = 0x71,
53  CHIPID_AD9172 = 0x72,
54  CHIPID_AD9173 = 0x73,
55  CHIPID_AD9174 = 0x74,
56  CHIPID_AD9175 = 0x75,
57  CHIPID_AD9176 = 0x76,
58 };
59 
60 struct ad9172_state {
61  enum chip_id id;
64  uint32_t dac_rate_khz;
65  uint64_t dac_clkin_Hz;
68  uint32_t interpolation;
69  uint32_t jesd_link_mode;
71  uint32_t jesd_subclass;
75  uint8_t nco_main_enable;
77 };
78 
79 typedef struct ad9172_init_param {
80  /* SPI */
82  /* GPIO */
86  uint32_t dac_rate_khz;
87  uint32_t dac_clkin_Hz;
88  uint32_t jesd_link_mode;
89  uint32_t jesd_subclass;
96 
97 int32_t ad9172_init(ad9172_dev **device,
100 #endif // __AD9172_H__
SYNCOUTB_0
@ SYNCOUTB_0
Definition: api_def.h:215
ad9172_remove
int32_t ad9172_remove(ad9172_dev *device)
Definition: ad9172.c:377
SPI_SDO
@ SPI_SDO
Definition: api_def.h:182
ad9172_state
Definition: ad9172.h:60
no_os_alloc.h
no_os_gpio_init_param
Structure holding the parameters for GPIO initialization.
Definition: no_os_gpio.h:79
ad9172_state::jesd_dual_link_mode
uint32_t jesd_dual_link_mode
Definition: ad9172.h:70
CHIPID_AD9174
@ CHIPID_AD9174
Definition: ad9172.h:55
ad9172_remove
int32_t ad9172_remove(ad9172_dev *device)
Definition: ad9172.c:377
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:245
CHIPID_AD9175
@ CHIPID_AD9175
Definition: ad9172.h:56
ad9172_init_param
Definition: ad9172.h:79
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:167
NO_OS_GENMASK
#define NO_OS_GENMASK(h, l)
Definition: no_os_util.h:82
signal_type_t
signal_type_t
Definition: api_def.h:193
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:159
ad9172_init_param::syncoutb_type
signal_type_t syncoutb_type
Definition: ad9172.h:93
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:245
jesd_param_t::jesd_L
uint8_t jesd_L
Definition: api_def.h:231
ad9172_state::nco_main_enable
uint8_t nco_main_enable
Definition: ad9172.h:75
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:210
no_os_delay.h
Header file of Delay functions.
AD917x.h
AD917X API interface header file.
device
Definition: ad9361_util.h:69
NO_OS_GPIO_HIGH
@ NO_OS_GPIO_HIGH
Definition: no_os_gpio.h:117
JESD_LINK_0
@ JESD_LINK_0
Definition: api_def.h:208
ad9172_dev::spi_desc
struct no_os_spi_desc * spi_desc
Definition: ad9172.h:43
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:472
no_os_calloc
void * no_os_calloc(size_t nitems, size_t size)
Allocate memory and return a pointer to it, set memory to 0.
Definition: chibios_alloc.c:54
ad9172_dev::gpio_txen1
struct no_os_gpio_desc * gpio_txen1
Definition: ad9172.h:47
ad9172_state::dac_interpolation
uint32_t dac_interpolation
Definition: ad9172.h:66
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:306
ad917x_handle_t::delay_us
delay_us_t delay_us
Definition: AD917x.h:91
ad9172_dev
struct ad9172_dev ad9172_dev
ad9172_init_param::spi_init
struct no_os_spi_init_param * spi_init
Definition: ad9172.h:81
signal_coupling_t
signal_coupling_t
Definition: api_def.h:200
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:88
no_os_mdelay
void no_os_mdelay(uint32_t msecs)
Wait until msecs milliseconds passed.
Definition: aducm3029_delay.c:126
ad9172_state::dac_clkin_Hz
uint64_t dac_clkin_Hz
Definition: ad9172.h:65
adi_chip_id_t::dev_revision
uint8_t dev_revision
Definition: api_def.h:171
CHIPID_AD9173
@ CHIPID_AD9173
Definition: ad9172.h:54
jesd_param_t
Definition: api_def.h:230
AD917X_DAC1
@ AD917X_DAC1
Definition: AD917x.h:42
ad9172_state::dac_h
ad917x_handle_t dac_h
Definition: ad9172.h:62
ad9172_dev
Definition: ad9172.h:41
ad9172_dev::gpio_reset
struct no_os_gpio_desc * gpio_reset
Definition: ad9172.h:45
ad9172_init_param::gpio_txen0
struct no_os_gpio_init_param gpio_txen0
Definition: ad9172.h:83
CHIPID_AD9172
@ CHIPID_AD9172
Definition: ad9172.h:53
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:435
ad9172_state::nco_channel_enable
uint8_t nco_channel_enable
Definition: ad9172.h:76
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:610
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:497
ad9172_dev::gpio_txen0
struct no_os_gpio_desc * gpio_txen0
Definition: ad9172.h:46
ad9172_state::jesd_link_mode
uint32_t jesd_link_mode
Definition: ad9172.h:69
ad9172_dev::st
struct ad9172_state * st
Definition: ad9172.h:48
ad9172_state::interpolation
uint32_t interpolation
Definition: ad9172.h:68
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:104
no_os_spi_desc
Structure holding SPI descriptor.
Definition: no_os_spi.h:192
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:518
ad9172_init_param::gpio_txen1
struct no_os_gpio_init_param gpio_txen1
Definition: ad9172.h:84
ad9172_init_param::dac_interpolation
uint32_t dac_interpolation
Definition: ad9172.h:90
ad9172_state::channel_interpolation
uint32_t channel_interpolation
Definition: ad9172.h:67
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:303
no_os_gpio_desc
Structure holding the GPIO descriptor.
Definition: no_os_gpio.h:96
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:471
ad9172_state::appJesdConfig
jesd_param_t appJesdConfig
Definition: ad9172.h:63
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:340
ad9172_state::dac_rate_khz
uint32_t dac_rate_khz
Definition: ad9172.h:64
ad9172_init_param
struct ad9172_init_param ad9172_init_param
CHIPID_AD9176
@ CHIPID_AD9176
Definition: ad9172.h:57
ad9172_init_param::jesd_subclass
uint32_t jesd_subclass
Definition: ad9172.h:89
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:49
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:597
no_os_malloc
void * no_os_malloc(size_t size)
Allocate memory and return a pointer to it.
Definition: chibios_alloc.c:43
ad917x_handle_t::tx_en_pin_ctrl
tx_en_pin_ctrl_t tx_en_pin_ctrl
Definition: AD917x.h:93
ad9172_init_param::sysref_coupling
signal_coupling_t sysref_coupling
Definition: ad9172.h:94
ad917x_handle_t::sdo
spi_sdo_config_t sdo
Definition: AD917x.h:86
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:576
no_os_free
void no_os_free(void *ptr)
Deallocate memory previously allocated by a call to no_os_calloc or no_os_malloc.
Definition: chibios_alloc.c:69
adi_chip_id_t::chip_type
uint8_t chip_type
Definition: api_def.h:165
ad9172_init_param::dac_rate_khz
uint32_t dac_rate_khz
Definition: ad9172.h:86
ad9172_state::sysref_coupling
signal_coupling_t sysref_coupling
Definition: ad9172.h:74
no_os_udelay
void no_os_udelay(uint32_t usecs)
Wait until usecs microseconds passed.
Definition: aducm3029_delay.c:114
ad9172_state::id
enum chip_id id
Definition: ad9172.h:61
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:212
NULL
#define NULL
Definition: wrapper.h:64
JESD_LINK_ALL
@ JESD_LINK_ALL
Definition: api_def.h:210
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:197
init_param
struct ad7616_init_param init_param
Definition: ad7616_sdz.c:113
ad917x_handle_t::dev_xfer
spi_xfer_t dev_xfer
Definition: AD917x.h:90
AD917X_DAC0
@ AD917X_DAC0
Definition: AD917x.h:40
ad9172_init_param::gpio_reset
struct no_os_gpio_init_param gpio_reset
Definition: ad9172.h:85
adi_chip_id_t
Definition: api_def.h:163
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:461
AD917X_CH_NONE
@ AD917X_CH_NONE
Definition: AD917x.h:48
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:116
ad9172_init_param::dac_clkin_Hz
uint32_t dac_clkin_Hz
Definition: ad9172.h:87
jesd_param_t::jesd_M
uint8_t jesd_M
Definition: api_def.h:233
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:95
ad917x_handle_t::user_data
void * user_data
Definition: AD917x.h:85
ad9172_init_param::jesd_link_mode
uint32_t jesd_link_mode
Definition: ad9172.h:88
ad9172_init_param::clock_output_config
uint32_t clock_output_config
Definition: ad9172.h:92
ad917x_handle_t::syncoutb
signal_type_t syncoutb
Definition: AD917x.h:87
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:52
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:624
AD917X_DAC_NONE
@ AD917X_DAC_NONE
Definition: AD917x.h:38
spi
struct no_os_spi_desc * spi
Definition: main.c:72
adi_chip_id_t::prod_grade
uint8_t prod_grade
Definition: api_def.h:169
ad9172_state::clock_output_config
uint32_t clock_output_config
Definition: ad9172.h:72
ad9172_init
int32_t ad9172_init(ad9172_dev **device, ad9172_init_param *init_param)
Definition: ad9172.c:293
ad9172_init_param::channel_interpolation
uint32_t channel_interpolation
Definition: ad9172.h:91
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:147
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:22
adi_chip_id_t::prod_id
uint16_t prod_id
Definition: api_def.h:167
ad917x_handle_t
Definition: AD917x.h:84
ad9172_state::jesd_subclass
uint32_t jesd_subclass
Definition: ad9172.h:71
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:571
ad9172_init
int32_t ad9172_init(ad9172_dev **device, ad9172_init_param *init_param)
Definition: ad9172.c:293
CHIPID_AD9171
@ CHIPID_AD9171
Definition: ad9172.h:52
NO_OS_DIV_ROUND_CLOSEST
#define NO_OS_DIV_ROUND_CLOSEST(x, y)
Definition: no_os_util.h:54
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:134
ad9172_state::syncoutb_type
signal_type_t syncoutb_type
Definition: ad9172.h:73
chip_id
chip_id
Definition: ad9172.h:51
no_os_spi_init_param
Structure holding the parameters for SPI initialization.
Definition: no_os_spi.h:140