no-OS
ad9081.h
Go to the documentation of this file.
1 /***************************************************************************/
39 #ifndef AD9081_H_
40 #define AD9081_H_
41 
42 /******************************************************************************/
43 /***************************** Include Files **********************************/
44 /******************************************************************************/
45 #include <stdbool.h>
46 #include <stdint.h>
47 #include "no_os_clk.h"
48 #include "no_os_spi.h"
49 #include "no_os_gpio.h"
50 #include "adi_ad9081.h"
51 
52 /******************************************************************************/
53 /********************** Macros and Types Declarations *************************/
54 /******************************************************************************/
55 #define MAX_NUM_MAIN_DATAPATHS 4
56 #define MAX_NUM_CHANNELIZER 8
57 
59  bool is_jrx;
60  adi_cms_jesd_param_t jesd_param;
62  uint8_t logiclane_mapping[8];
63  uint8_t link_converter_select[16];
64  uint64_t lane_rate;
65 };
66 
69 };
70 
71 struct ad9081_phy {
76  struct no_os_clk *dev_clk;
78  adi_ad9081_device_t ad9081;
83  uint32_t lmfc_delay;
85  /* TX */
86  uint64_t dac_frequency_hz;
87  /* The 4 DAC Main Datapaths */
88  uint32_t tx_main_interp;
91  /* The 8 DAC Channelizers */
92  uint32_t tx_chan_interp;
95  /* RX */
96  uint64_t adc_frequency_hz;
98  /* The 4 ADC Main Datapaths */
103  uint8_t rx_cddc_select;
104  /* The 8 ADC Channelizers */
109  uint8_t rx_fddc_select;
110 };
111 
113  uint32_t device_id;
117  uint32_t high_density;
119  uint32_t bits_per_sample;
123  uint32_t subclass;
124  uint32_t link_mode;
125  uint32_t dual_link;
126  uint32_t version;
128  /* JTX */
130  /* JRX */
132 };
133 
145  /* TX */
147  /* The 4 DAC Main Datapaths */
151  /* The 8 DAC Channelizers */
156  /* RX */
159  /* The 4 ADC Main Datapaths */
164  /* The 8 ADC Channelizers */
170 };
171 
172 /******************************************************************************/
173 /************************ Functions Declarations ******************************/
174 /******************************************************************************/
175 /* Initialize the device. */
176 int32_t ad9081_init(struct ad9081_phy **device,
177  const struct ad9081_init_param *init_param);
178 /* Remove the device. */
179 int32_t ad9081_remove(struct ad9081_phy *device);
180 /* Work function. */
181 void ad9081_work_func(struct ad9081_phy *phy);
182 #endif
ad9081_init_param::nyquist_zone
uint32_t nyquist_zone[MAX_NUM_MAIN_DATAPATHS]
Definition: ad9081.h:158
ad9081_init_param::rx_main_complex_to_real_enable
uint8_t rx_main_complex_to_real_enable[MAX_NUM_MAIN_DATAPATHS]
Definition: ad9081.h:162
SPI_SDO
@ SPI_SDO
Definition: api_def.h:183
no_os_gpio_init_param
Structure holding the parameters for GPIO initialization.
Definition: no_os_gpio.h:85
ad9081_parse_init_param
int32_t ad9081_parse_init_param(struct ad9081_phy *phy, const struct ad9081_init_param *init_param)
Definition: ad9081.c:983
ad9081_init_param::rx_main_nco_frequency_shift_hz
int64_t rx_main_nco_frequency_shift_hz[MAX_NUM_MAIN_DATAPATHS]
Definition: ad9081.h:160
ad9081_init_param::dac_frequency_hz
uint64_t dac_frequency_hz
Definition: ad9081.h:146
ad9081_phy::jrx_link_tx
struct ad9081_jesd_link jrx_link_tx
Definition: ad9081.h:79
ad9081_init_param::rx_channel_enable
uint8_t rx_channel_enable[MAX_NUM_CHANNELIZER]
Definition: ad9081.h:168
ad9081_init_param::rx_channel_decimation
uint32_t rx_channel_decimation[MAX_NUM_CHANNELIZER]
Definition: ad9081.h:166
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
ad9081_phy::jtx_link_rx
struct ad9081_jesd_link jtx_link_rx[2]
Definition: ad9081.h:80
no_os_clk_recalc_rate
int32_t no_os_clk_recalc_rate(struct no_os_clk *clk, uint64_t *rate)
no_os_spi.h
Header file of SPI Interface.
JESD_SUBCLASS_0
@ JESD_SUBCLASS_0
Definition: api_def.h:252
ad9081_phy::tx_dac_chan_xbar
uint8_t tx_dac_chan_xbar[MAX_NUM_MAIN_DATAPATHS]
Definition: ad9081.h:89
no_os_clk_disable
int32_t no_os_clk_disable(struct no_os_clk *clk)
COUPLING_DC
@ COUPLING_DC
Definition: api_def.h:203
ad9081_work_func
void ad9081_work_func(struct ad9081_phy *phy)
Definition: ad9081.c:442
dac_settings_cache::chan_gain
uint16_t chan_gain[MAX_NUM_CHANNELIZER]
Definition: ad9081.h:68
no_os_delay.h
Header file of Delay functions.
ad9081_init_param::rx_main_enable
uint8_t rx_main_enable[MAX_NUM_MAIN_DATAPATHS]
Definition: ad9081.h:163
no_os_clk
Definition: no_os_clk.h:59
ad9081_parse_jesd_link_init_param
int32_t ad9081_parse_jesd_link_init_param(struct ad9081_jesd_link *link, const struct link_init_param *init_param, bool jtx)
Definition: ad9081.c:950
ad9081_phy::adc_chan_decimation
uint32_t adc_chan_decimation[MAX_NUM_CHANNELIZER]
Definition: ad9081.h:106
device
Definition: ad9361_util.h:75
ad9081_phy::gpio_reset
no_os_gpio_desc * gpio_reset
Definition: ad9081.h:73
ad9081_phy::rx_cddc_c2r
uint8_t rx_cddc_c2r[MAX_NUM_MAIN_DATAPATHS]
Definition: ad9081.h:102
ad9081_init_param::tx_channel_gain
uint16_t tx_channel_gain[MAX_NUM_CHANNELIZER]
Definition: ad9081.h:154
ad9081_init_param::nco_sync_ms_extra_lmfc_num
uint32_t nco_sync_ms_extra_lmfc_num
Definition: ad9081.h:144
NO_OS_ARRAY_SIZE
#define NO_OS_ARRAY_SIZE(x)
Definition: no_os_util.h:53
ad9081_init_param::rx_main_decimation
uint32_t rx_main_decimation[MAX_NUM_MAIN_DATAPATHS]
Definition: ad9081.h:161
ad9081_init_param::rx_channel_nco_frequency_shift_hz
int64_t rx_channel_nco_frequency_shift_hz[MAX_NUM_CHANNELIZER]
Definition: ad9081.h:165
ad9081_work_func
void ad9081_work_func(struct ad9081_phy *phy)
Definition: ad9081.c:442
ad9081_init_param::jrx_link_tx
struct link_init_param * jrx_link_tx
Definition: ad9081.h:155
ad9081_phy::sysref_coupling_ac_en
bool sysref_coupling_ac_en
Definition: ad9081.h:77
no_os_clk.h
Header file of Clock Driver.
ad9081_init_param::tx_main_interpolation
uint32_t tx_main_interpolation
Definition: ad9081.h:148
ad9081_init_param::gpio_reset
no_os_gpio_init_param * gpio_reset
Definition: ad9081.h:136
no_os_do_div
uint64_t no_os_do_div(uint64_t *n, uint64_t base)
no_os_mdelay
void no_os_mdelay(uint32_t msecs)
Wait until msecs milliseconds passed.
Definition: delay.c:130
ad9081_phy::adc_main_decimation
uint32_t adc_main_decimation[MAX_NUM_MAIN_DATAPATHS]
Definition: ad9081.h:100
no_os_clk_enable
int32_t no_os_clk_enable(struct no_os_clk *clk)
ad9081_phy::rx_fddc_dcm
uint8_t rx_fddc_dcm[MAX_NUM_CHANNELIZER]
Definition: ad9081.h:107
no_os_error.h
Error codes definition.
ad9081_remove
int32_t ad9081_remove(struct ad9081_phy *dev)
Definition: ad9081.c:1144
ad9081_init_param::jtx_link_rx
struct link_init_param * jtx_link_rx[2]
Definition: ad9081.h:169
ad9081_phy::tx_main_shift
int64_t tx_main_shift[MAX_NUM_MAIN_DATAPATHS]
Definition: ad9081.h:90
ad9081_log_write
int32_t ad9081_log_write(void *user_data, int32_t log_type, const char *message, va_list argp)
Definition: ad9081.c:920
ad9081_phy::rx_cddc_shift
int64_t rx_cddc_shift[MAX_NUM_MAIN_DATAPATHS]
Definition: ad9081.h:99
ad9081_phy::nco_sync_ms_extra_lmfc_num
uint32_t nco_sync_ms_extra_lmfc_num
Definition: ad9081.h:84
ad9081_init_param::dev_clk
struct no_os_clk * dev_clk
Definition: ad9081.h:137
ad9081_phy::rx_cddc_dcm
uint8_t rx_cddc_dcm[MAX_NUM_MAIN_DATAPATHS]
Definition: ad9081.h:101
ad9081_init_param::jesd_rx_clk
struct no_os_clk * jesd_rx_clk
Definition: ad9081.h:138
ad9081_phy::rx_nyquist_zone
uint32_t rx_nyquist_zone[MAX_NUM_MAIN_DATAPATHS]
Definition: ad9081.h:97
CHIPID_MASK
#define CHIPID_MASK
Definition: ad9081.c:55
ad9081_phy::dac_cache
struct dac_settings_cache dac_cache
Definition: ad9081.h:94
ad9081_phy::rx_fddc_c2r
uint8_t rx_fddc_c2r[MAX_NUM_CHANNELIZER]
Definition: ad9081.h:108
ad9081_init_param::tx_channel_interpolation
uint32_t tx_channel_interpolation
Definition: ad9081.h:152
CHIPID_AD9081
#define CHIPID_AD9081
Definition: ad9081.c:54
no_os_spi_desc::bit_order
enum no_os_spi_bit_order bit_order
Definition: no_os_spi.h:142
ad9081_phy::tx_chan_interp
uint32_t tx_chan_interp
Definition: ad9081.h:92
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
ad9081_init_param::spi_init
no_os_spi_init_param * spi_init
Definition: ad9081.h:135
ad9081_phy::adc_frequency_hz
uint64_t adc_frequency_hz
Definition: ad9081.h:96
no_os_gpio_desc
Structure holding the GPIO descriptor.
Definition: no_os_gpio.h:102
ad9081_phy::jesd_tx_clk
struct no_os_clk * jesd_tx_clk
Definition: ad9081.h:75
ad9081_init_param::rx_channel_complex_to_real_enable
uint8_t rx_channel_complex_to_real_enable[MAX_NUM_CHANNELIZER]
Definition: ad9081.h:167
ad9081_init_param::multidevice_instance_count
uint32_t multidevice_instance_count
Definition: ad9081.h:141
ad9081_phy::dev_clk
struct no_os_clk * dev_clk
Definition: ad9081.h:76
ad9081_init_param::tx_channel_nco_frequency_shift_hz
int64_t tx_channel_nco_frequency_shift_hz[MAX_NUM_CHANNELIZER]
Definition: ad9081.h:153
ad9081_init_param::tx_main_nco_frequency_shift_hz
int64_t tx_main_nco_frequency_shift_hz[MAX_NUM_MAIN_DATAPATHS]
Definition: ad9081.h:149
ad9081_phy::config_sync_01_swapped
bool config_sync_01_swapped
Definition: ad9081.h:82
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
ad9081_init_param::tx_dac_channel_crossbar_select
uint8_t tx_dac_channel_crossbar_select[MAX_NUM_MAIN_DATAPATHS]
Definition: ad9081.h:150
for_each_cddc
#define for_each_cddc(bit, mask)
Definition: ad9081.c:57
ad9081_init
int32_t ad9081_init(struct ad9081_phy **device, const struct ad9081_init_param *init_param)
Definition: ad9081.c:1053
ad9081_phy::tx_main_interp
uint32_t tx_main_interp
Definition: ad9081.h:88
ad9081_phy::rx_fddc_select
uint8_t rx_fddc_select
Definition: ad9081.h:109
NO_OS_BIT
#define NO_OS_BIT(x)
Definition: no_os_util.h:51
ad9081_phy::rx_fddc_shift
int64_t rx_fddc_shift[MAX_NUM_CHANNELIZER]
Definition: ad9081.h:105
NO_OS_SPI_BIT_ORDER_MSB_FIRST
@ NO_OS_SPI_BIT_ORDER_MSB_FIRST
Definition: no_os_spi.h:81
ad9081_phy::tx_chan_shift
int64_t tx_chan_shift[MAX_NUM_CHANNELIZER]
Definition: ad9081.h:93
ad9081_phy::jesd_rx_clk
struct no_os_clk * jesd_rx_clk
Definition: ad9081.h:74
ad9081_init
int32_t ad9081_init(struct ad9081_phy **dev, const struct ad9081_init_param *init_param)
Definition: ad9081.c:1053
no_os_udelay
void no_os_udelay(uint32_t usecs)
Wait until usecs microseconds passed.
Definition: delay.c:118
ad9081_phy::multidevice_instance_count
uint32_t multidevice_instance_count
Definition: ad9081.h:81
COUPLING_AC
@ COUPLING_AC
Definition: api_def.h:202
ad9081_init_param
Definition: ad9081.h:134
ad9081_phy
Definition: ad9081.h:71
MAX_NUM_MAIN_DATAPATHS
#define MAX_NUM_MAIN_DATAPATHS
Definition: ad9081.h:55
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
ad9081_phy::rx_cddc_select
uint8_t rx_cddc_select
Definition: ad9081.h:103
ad9081_phy::ad9081
adi_ad9081_device_t ad9081
Definition: ad9081.h:78
ad9081_init_param::sysref_coupling_ac_en
bool sysref_coupling_ac_en
Definition: ad9081.h:140
ad9081_remove
int32_t ad9081_remove(struct ad9081_phy *device)
Definition: ad9081.c:1144
no_os_clk_set_rate
int32_t no_os_clk_set_rate(struct no_os_clk *clk, uint64_t rate)
ad9081_init_param::jesd_tx_clk
struct no_os_clk * jesd_tx_clk
Definition: ad9081.h:139
ad9081_phy::spi_desc
no_os_spi_desc * spi_desc
Definition: ad9081.h:72
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
JESD_SUBCLASS_1
@ JESD_SUBCLASS_1
Definition: api_def.h:253
no_os_gpio.h
Header file of GPIO Interface.
ad9081_init_param::lmfc_delay_dac_clk_cycles
uint32_t lmfc_delay_dac_clk_cycles
Definition: ad9081.h:143
MAX_NUM_CHANNELIZER
#define MAX_NUM_CHANNELIZER
Definition: ad9081.h:56
ad9081.h
Header file of AD9081 Driver.
dac_settings_cache
Definition: ad9081.h:67
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
ad9081_reset_pin_ctrl
int32_t ad9081_reset_pin_ctrl(void *user_data, uint8_t enable)
Definition: ad9081.c:877
no_os_util.h
Implementation of utility functions.
ad9081_init_param::jesd_sync_pins_01_swap_enable
bool jesd_sync_pins_01_swap_enable
Definition: ad9081.h:142
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
ad9081_phy::dac_frequency_hz
uint64_t dac_frequency_hz
Definition: ad9081.h:86
ad9081_phy::lmfc_delay
uint32_t lmfc_delay
Definition: ad9081.h:83
ad9081_init_param::adc_frequency_hz
uint64_t adc_frequency_hz
Definition: ad9081.h:157
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