Debian Codegraph @

thirdparty/analogdevicesinc/no-OS/ad9361/sw/ad9361_api.h

raw symbols SCIP
1 /***************************************************************************//**
2 * @file ad9361_api.h
3 * @brief Header file of AD9361 API Driver.
4 * @author DBogdan ([email protected])
5 ********************************************************************************
6 * Copyright 2013(c) Analog Devices, Inc.
7 *
8 * All rights reserved.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions are met:
12 * - Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * - Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in
16 * the documentation and/or other materials provided with the
17 * distribution.
18 * - Neither the name of Analog Devices, Inc. nor the names of its
19 * contributors may be used to endorse or promote products derived
20 * from this software without specific prior written permission.
21 * - The use of this software may or may not infringe the patent rights
22 * of one or more patent holders. This license does not release you
23 * from the requirement that you obtain separate licenses from these
24 * patent holders to use this software.
25 * - Use of the software either in source or binary form, must be run
26 * on or directly connected to an Analog Devices Inc. component.
27 *
28 * THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR
29 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT,
30 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
31 * IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT,
32 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
33 * LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR
34 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
35 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
36 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
37 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38 *******************************************************************************/
39 #ifndef AD9361_API_H_
40 #define AD9361_API_H_
41
42 /******************************************************************************/
43 /***************************** Include Files **********************************/
44 /******************************************************************************/
45 #include "util.h"
46
47 /******************************************************************************/
48 /*************************** Types Declarations *******************************/
49 /******************************************************************************/
50 typedef struct
51 {
52 /* Device selection */
53 enum dev_id dev_sel;
54 /* Identification number */
55 uint8_t id_no;
56 /* Reference Clock */
57 uint32_t reference_clk_rate;
58 /* Base Configuration */
59 uint8_t two_rx_two_tx_mode_enable; /* adi,2rx-2tx-mode-enable */
60 uint8_t one_rx_one_tx_mode_use_rx_num; /* adi,1rx-1tx-mode-use-rx-num */
61 uint8_t one_rx_one_tx_mode_use_tx_num; /* adi,1rx-1tx-mode-use-tx-num */
62 uint8_t frequency_division_duplex_mode_enable; /* adi,frequency-division-duplex-mode-enable */
63 uint8_t frequency_division_duplex_independent_mode_enable; /* adi,frequency-division-duplex-independent-mode-enable */
64 uint8_t tdd_use_dual_synth_mode_enable; /* adi,tdd-use-dual-synth-mode-enable */
65 uint8_t tdd_skip_vco_cal_enable; /* adi,tdd-skip-vco-cal-enable */
66 uint32_t tx_fastlock_delay_ns; /* adi,tx-fastlock-delay-ns */
67 uint32_t rx_fastlock_delay_ns; /* adi,rx-fastlock-delay-ns */
68 uint8_t rx_fastlock_pincontrol_enable; /* adi,rx-fastlock-pincontrol-enable */
69 uint8_t tx_fastlock_pincontrol_enable; /* adi,tx-fastlock-pincontrol-enable */
70 uint8_t external_rx_lo_enable; /* adi,external-rx-lo-enable */
71 uint8_t external_tx_lo_enable; /* adi,external-tx-lo-enable */
72 uint8_t dc_offset_tracking_update_event_mask; /* adi,dc-offset-tracking-update-event-mask */
73 uint8_t dc_offset_attenuation_high_range; /* adi,dc-offset-attenuation-high-range */
74 uint8_t dc_offset_attenuation_low_range; /* adi,dc-offset-attenuation-low-range */
75 uint8_t dc_offset_count_high_range; /* adi,dc-offset-count-high-range */
76 uint8_t dc_offset_count_low_range; /* adi,dc-offset-count-low-range */
77 uint8_t split_gain_table_mode_enable; /* adi,split-gain-table-mode-enable */
78 uint32_t trx_synthesizer_target_fref_overwrite_hz; /* adi,trx-synthesizer-target-fref-overwrite-hz */
79 uint8_t qec_tracking_slow_mode_enable; /* adi,qec-tracking-slow-mode-enable */
80 /* ENSM Control */
81 uint8_t ensm_enable_pin_pulse_mode_enable; /* adi,ensm-enable-pin-pulse-mode-enable */
82 uint8_t ensm_enable_txnrx_control_enable; /* adi,ensm-enable-txnrx-control-enable */
83 /* LO Control */
84 uint64_t rx_synthesizer_frequency_hz; /* adi,rx-synthesizer-frequency-hz */
85 uint64_t tx_synthesizer_frequency_hz; /* adi,tx-synthesizer-frequency-hz */
86 /* Rate & BW Control */
87 uint32_t rx_path_clock_frequencies[6]; /* adi,rx-path-clock-frequencies */
88 uint32_t tx_path_clock_frequencies[6]; /* adi,tx-path-clock-frequencies */
89 uint32_t rf_rx_bandwidth_hz; /* adi,rf-rx-bandwidth-hz */
90 uint32_t rf_tx_bandwidth_hz; /* adi,rf-tx-bandwidth-hz */
91 /* RF Port Control */
92 uint32_t rx_rf_port_input_select; /* adi,rx-rf-port-input-select */
93 uint32_t tx_rf_port_input_select; /* adi,tx-rf-port-input-select */
94 /* TX Attenuation Control */
95 int32_t tx_attenuation_mdB; /* adi,tx-attenuation-mdB */
96 uint8_t update_tx_gain_in_alert_enable; /* adi,update-tx-gain-in-alert-enable */
97 /* Reference Clock Control */
98 uint8_t xo_disable_use_ext_refclk_enable; /* adi,xo-disable-use-ext-refclk-enable */
99 uint32_t dcxo_coarse_and_fine_tune[2]; /* adi,dcxo-coarse-and-fine-tune */
100 uint32_t clk_output_mode_select; /* adi,clk-output-mode-select */
101 /* Gain Control */
102 uint8_t gc_rx1_mode; /* adi,gc-rx1-mode */
103 uint8_t gc_rx2_mode; /* adi,gc-rx2-mode */
104 uint8_t gc_adc_large_overload_thresh; /* adi,gc-adc-large-overload-thresh */
105 uint8_t gc_adc_ovr_sample_size; /* adi,gc-adc-ovr-sample-size */
106 uint8_t gc_adc_small_overload_thresh; /* adi,gc-adc-small-overload-thresh */
107 uint16_t gc_dec_pow_measurement_duration; /* adi,gc-dec-pow-measurement-duration */
108 uint8_t gc_dig_gain_enable; /* adi,gc-dig-gain-enable */
109 uint16_t gc_lmt_overload_high_thresh; /* adi,gc-lmt-overload-high-thresh */
110 uint16_t gc_lmt_overload_low_thresh; /* adi,gc-lmt-overload-low-thresh */
111 uint8_t gc_low_power_thresh; /* adi,gc-low-power-thresh */
112 uint8_t gc_max_dig_gain; /* adi,gc-max-dig-gain */
113 /* Gain MGC Control */
114 uint8_t mgc_dec_gain_step; /* adi,mgc-dec-gain-step */
115 uint8_t mgc_inc_gain_step; /* adi,mgc-inc-gain-step */
116 uint8_t mgc_rx1_ctrl_inp_enable; /* adi,mgc-rx1-ctrl-inp-enable */
117 uint8_t mgc_rx2_ctrl_inp_enable; /* adi,mgc-rx2-ctrl-inp-enable */
118 uint8_t mgc_split_table_ctrl_inp_gain_mode; /* adi,mgc-split-table-ctrl-inp-gain-mode */
119 /* Gain AGC Control */
120 uint8_t agc_adc_large_overload_exceed_counter; /* adi,agc-adc-large-overload-exceed-counter */
121 uint8_t agc_adc_large_overload_inc_steps; /* adi,agc-adc-large-overload-inc-steps */
122 uint8_t agc_adc_lmt_small_overload_prevent_gain_inc_enable; /* adi,agc-adc-lmt-small-overload-prevent-gain-inc-enable */
123 uint8_t agc_adc_small_overload_exceed_counter; /* adi,agc-adc-small-overload-exceed-counter */
124 uint8_t agc_dig_gain_step_size; /* adi,agc-dig-gain-step-size */
125 uint8_t agc_dig_saturation_exceed_counter; /* adi,agc-dig-saturation-exceed-counter */
126 uint32_t agc_gain_update_interval_us; /* adi,agc-gain-update-interval-us */
127 uint8_t agc_immed_gain_change_if_large_adc_overload_enable; /* adi,agc-immed-gain-change-if-large-adc-overload-enable */
128 uint8_t agc_immed_gain_change_if_large_lmt_overload_enable; /* adi,agc-immed-gain-change-if-large-lmt-overload-enable */
129 uint8_t agc_inner_thresh_high; /* adi,agc-inner-thresh-high */
130 uint8_t agc_inner_thresh_high_dec_steps; /* adi,agc-inner-thresh-high-dec-steps */
131 uint8_t agc_inner_thresh_low; /* adi,agc-inner-thresh-low */
132 uint8_t agc_inner_thresh_low_inc_steps; /* adi,agc-inner-thresh-low-inc-steps */
133 uint8_t agc_lmt_overload_large_exceed_counter; /* adi,agc-lmt-overload-large-exceed-counter */
134 uint8_t agc_lmt_overload_large_inc_steps; /* adi,agc-lmt-overload-large-inc-steps */
135 uint8_t agc_lmt_overload_small_exceed_counter; /* adi,agc-lmt-overload-small-exceed-counter */
136 uint8_t agc_outer_thresh_high; /* adi,agc-outer-thresh-high */
137 uint8_t agc_outer_thresh_high_dec_steps; /* adi,agc-outer-thresh-high-dec-steps */
138 uint8_t agc_outer_thresh_low; /* adi,agc-outer-thresh-low */
139 uint8_t agc_outer_thresh_low_inc_steps; /* adi,agc-outer-thresh-low-inc-steps */
140 uint32_t agc_attack_delay_extra_margin_us; /* adi,agc-attack-delay-extra-margin-us */
141 uint8_t agc_sync_for_gain_counter_enable; /* adi,agc-sync-for-gain-counter-enable */
142 /* Fast AGC */
143 uint32_t fagc_dec_pow_measuremnt_duration; /* adi,fagc-dec-pow-measurement-duration */
144 uint32_t fagc_state_wait_time_ns; /* adi,fagc-state-wait-time-ns */
145 /* Fast AGC - Low Power */
146 uint8_t fagc_allow_agc_gain_increase; /* adi,fagc-allow-agc-gain-increase-enable */
147 uint32_t fagc_lp_thresh_increment_time; /* adi,fagc-lp-thresh-increment-time */
148 uint32_t fagc_lp_thresh_increment_steps; /* adi,fagc-lp-thresh-increment-steps */
149 /* Fast AGC - Lock Level */
150 uint32_t fagc_lock_level; /* adi,fagc-lock-level */
151 uint8_t fagc_lock_level_lmt_gain_increase_en; /* adi,fagc-lock-level-lmt-gain-increase-enable */
152 uint32_t fagc_lock_level_gain_increase_upper_limit; /* adi,fagc-lock-level-gain-increase-upper-limit */
153 /* Fast AGC - Peak Detectors and Final Settling */
154 uint32_t fagc_lpf_final_settling_steps; /* adi,fagc-lpf-final-settling-steps */
155 uint32_t fagc_lmt_final_settling_steps; /* adi,fagc-lmt-final-settling-steps */
156 uint32_t fagc_final_overrange_count; /* adi,fagc-final-overrange-count */
157 /* Fast AGC - Final Power Test */
158 uint8_t fagc_gain_increase_after_gain_lock_en; /* adi,fagc-gain-increase-after-gain-lock-enable */
159 /* Fast AGC - Unlocking the Gain */
160 uint32_t fagc_gain_index_type_after_exit_rx_mode; /* adi,fagc-gain-index-type-after-exit-rx-mode */
161 uint8_t fagc_use_last_lock_level_for_set_gain_en; /* adi,fagc-use-last-lock-level-for-set-gain-enable */
162 uint8_t fagc_rst_gla_stronger_sig_thresh_exceeded_en; /* adi,fagc-rst-gla-stronger-sig-thresh-exceeded-enable */
163 uint32_t fagc_optimized_gain_offset; /* adi,fagc-optimized-gain-offset */
164 uint32_t fagc_rst_gla_stronger_sig_thresh_above_ll; /* adi,fagc-rst-gla-stronger-sig-thresh-above-ll */
165 uint8_t fagc_rst_gla_engergy_lost_sig_thresh_exceeded_en; /* adi,fagc-rst-gla-engergy-lost-sig-thresh-exceeded-enable */
166 uint8_t fagc_rst_gla_engergy_lost_goto_optim_gain_en; /* adi,fagc-rst-gla-engergy-lost-goto-optim-gain-enable */
167 uint32_t fagc_rst_gla_engergy_lost_sig_thresh_below_ll; /* adi,fagc-rst-gla-engergy-lost-sig-thresh-below-ll */
168 uint32_t fagc_energy_lost_stronger_sig_gain_lock_exit_cnt; /* adi,fagc-energy-lost-stronger-sig-gain-lock-exit-cnt */
169 uint8_t fagc_rst_gla_large_adc_overload_en; /* adi,fagc-rst-gla-large-adc-overload-enable */
170 uint8_t fagc_rst_gla_large_lmt_overload_en; /* adi,fagc-rst-gla-large-lmt-overload-enable */
171 uint8_t fagc_rst_gla_en_agc_pulled_high_en; /* adi,fagc-rst-gla-en-agc-pulled-high-enable */
172 uint32_t fagc_rst_gla_if_en_agc_pulled_high_mode; /* adi,fagc-rst-gla-if-en-agc-pulled-high-mode */
173 uint32_t fagc_power_measurement_duration_in_state5; /* adi,fagc-power-measurement-duration-in-state5 */
174 /* RSSI Control */
175 uint32_t rssi_delay; /* adi,rssi-delay */
176 uint32_t rssi_duration; /* adi,rssi-duration */
177 uint8_t rssi_restart_mode; /* adi,rssi-restart-mode */
178 uint8_t rssi_unit_is_rx_samples_enable; /* adi,rssi-unit-is-rx-samples-enable */
179 uint32_t rssi_wait; /* adi,rssi-wait */
180 /* Aux ADC Control */
181 uint32_t aux_adc_decimation; /* adi,aux-adc-decimation */
182 uint32_t aux_adc_rate; /* adi,aux-adc-rate */
183 /* AuxDAC Control */
184 uint8_t aux_dac_manual_mode_enable; /* adi,aux-dac-manual-mode-enable */
185 uint32_t aux_dac1_default_value_mV; /* adi,aux-dac1-default-value-mV */
186 uint8_t aux_dac1_active_in_rx_enable; /* adi,aux-dac1-active-in-rx-enable */
187 uint8_t aux_dac1_active_in_tx_enable; /* adi,aux-dac1-active-in-tx-enable */
188 uint8_t aux_dac1_active_in_alert_enable; /* adi,aux-dac1-active-in-alert-enable */
189 uint32_t aux_dac1_rx_delay_us; /* adi,aux-dac1-rx-delay-us */
190 uint32_t aux_dac1_tx_delay_us; /* adi,aux-dac1-tx-delay-us */
191 uint32_t aux_dac2_default_value_mV; /* adi,aux-dac2-default-value-mV */
192 uint8_t aux_dac2_active_in_rx_enable; /* adi,aux-dac2-active-in-rx-enable */
193 uint8_t aux_dac2_active_in_tx_enable; /* adi,aux-dac2-active-in-tx-enable */
194 uint8_t aux_dac2_active_in_alert_enable; /* adi,aux-dac2-active-in-alert-enable */
195 uint32_t aux_dac2_rx_delay_us; /* adi,aux-dac2-rx-delay-us */
196 uint32_t aux_dac2_tx_delay_us; /* adi,aux-dac2-tx-delay-us */
197 /* Temperature Sensor Control */
198 uint32_t temp_sense_decimation; /* adi,temp-sense-decimation */
199 uint16_t temp_sense_measurement_interval_ms; /* adi,temp-sense-measurement-interval-ms */
200 int8_t temp_sense_offset_signed; /* adi,temp-sense-offset-signed */
201 uint8_t temp_sense_periodic_measurement_enable; /* adi,temp-sense-periodic-measurement-enable */
202 /* Control Out Setup */
203 uint8_t ctrl_outs_enable_mask; /* adi,ctrl-outs-enable-mask */
204 uint8_t ctrl_outs_index; /* adi,ctrl-outs-index */
205 /* External LNA Control */
206 uint32_t elna_settling_delay_ns; /* adi,elna-settling-delay-ns */
207 uint32_t elna_gain_mdB; /* adi,elna-gain-mdB */
208 uint32_t elna_bypass_loss_mdB; /* adi,elna-bypass-loss-mdB */
209 uint8_t elna_rx1_gpo0_control_enable; /* adi,elna-rx1-gpo0-control-enable */
210 uint8_t elna_rx2_gpo1_control_enable; /* adi,elna-rx2-gpo1-control-enable */
211 uint8_t elna_gaintable_all_index_enable; /* adi,elna-gaintable-all-index-enable */
212 /* Digital Interface Control */
213 uint8_t digital_interface_tune_skip_mode; /* adi,digital-interface-tune-skip-mode */
214 uint8_t digital_interface_tune_fir_disable; /* adi,digital-interface-tune-fir-disable */
215 uint8_t pp_tx_swap_enable; /* adi,pp-tx-swap-enable */
216 uint8_t pp_rx_swap_enable; /* adi,pp-rx-swap-enable */
217 uint8_t tx_channel_swap_enable; /* adi,tx-channel-swap-enable */
218 uint8_t rx_channel_swap_enable; /* adi,rx-channel-swap-enable */
219 uint8_t rx_frame_pulse_mode_enable; /* adi,rx-frame-pulse-mode-enable */
220 uint8_t two_t_two_r_timing_enable; /* adi,2t2r-timing-enable */
221 uint8_t invert_data_bus_enable; /* adi,invert-data-bus-enable */
222 uint8_t invert_data_clk_enable; /* adi,invert-data-clk-enable */
223 uint8_t fdd_alt_word_order_enable; /* adi,fdd-alt-word-order-enable */
224 uint8_t invert_rx_frame_enable; /* adi,invert-rx-frame-enable */
225 uint8_t fdd_rx_rate_2tx_enable; /* adi,fdd-rx-rate-2tx-enable */
226 uint8_t swap_ports_enable; /* adi,swap-ports-enable */
227 uint8_t single_data_rate_enable; /* adi,single-data-rate-enable */
228 uint8_t lvds_mode_enable; /* adi,lvds-mode-enable */
229 uint8_t half_duplex_mode_enable; /* adi,half-duplex-mode-enable */
230 uint8_t single_port_mode_enable; /* adi,single-port-mode-enable */
231 uint8_t full_port_enable; /* adi,full-port-enable */
232 uint8_t full_duplex_swap_bits_enable; /* adi,full-duplex-swap-bits-enable */
233 uint32_t delay_rx_data; /* adi,delay-rx-data */
234 uint32_t rx_data_clock_delay; /* adi,rx-data-clock-delay */
235 uint32_t rx_data_delay; /* adi,rx-data-delay */
236 uint32_t tx_fb_clock_delay; /* adi,tx-fb-clock-delay */
237 uint32_t tx_data_delay; /* adi,tx-data-delay */
238 uint32_t lvds_bias_mV; /* adi,lvds-bias-mV */
239 uint8_t lvds_rx_onchip_termination_enable; /* adi,lvds-rx-onchip-termination-enable */
240 uint8_t rx1rx2_phase_inversion_en; /* adi,rx1-rx2-phase-inversion-enable */
241 uint8_t lvds_invert1_control; /* adi,lvds-invert1-control */
242 uint8_t lvds_invert2_control; /* adi,lvds-invert2-control */
243 /* GPO Control */
244 uint8_t gpo0_inactive_state_high_enable; /* adi,gpo0-inactive-state-high-enable */
245 uint8_t gpo1_inactive_state_high_enable; /* adi,gpo1-inactive-state-high-enable */
246 uint8_t gpo2_inactive_state_high_enable; /* adi,gpo2-inactive-state-high-enable */
247 uint8_t gpo3_inactive_state_high_enable; /* adi,gpo3-inactive-state-high-enable */
248 uint8_t gpo0_slave_rx_enable; /* adi,gpo0-slave-rx-enable */
249 uint8_t gpo0_slave_tx_enable; /* adi,gpo0-slave-tx-enable */
250 uint8_t gpo1_slave_rx_enable; /* adi,gpo1-slave-rx-enable */
251 uint8_t gpo1_slave_tx_enable; /* adi,gpo1-slave-tx-enable */
252 uint8_t gpo2_slave_rx_enable; /* adi,gpo2-slave-rx-enable */
253 uint8_t gpo2_slave_tx_enable; /* adi,gpo2-slave-tx-enable */
254 uint8_t gpo3_slave_rx_enable; /* adi,gpo3-slave-rx-enable */
255 uint8_t gpo3_slave_tx_enable; /* adi,gpo3-slave-tx-enable */
256 uint8_t gpo0_rx_delay_us; /* adi,gpo0-rx-delay-us */
257 uint8_t gpo0_tx_delay_us; /* adi,gpo0-tx-delay-us */
258 uint8_t gpo1_rx_delay_us; /* adi,gpo1-rx-delay-us */
259 uint8_t gpo1_tx_delay_us; /* adi,gpo1-tx-delay-us */
260 uint8_t gpo2_rx_delay_us; /* adi,gpo2-rx-delay-us */
261 uint8_t gpo2_tx_delay_us; /* adi,gpo2-tx-delay-us */
262 uint8_t gpo3_rx_delay_us; /* adi,gpo3-rx-delay-us */
263 uint8_t gpo3_tx_delay_us; /* adi,gpo3-tx-delay-us */
264 /* Tx Monitor Control */
265 uint32_t low_high_gain_threshold_mdB; /* adi,txmon-low-high-thresh */
266 uint32_t low_gain_dB; /* adi,txmon-low-gain */
267 uint32_t high_gain_dB; /* adi,txmon-high-gain */
268 uint8_t tx_mon_track_en; /* adi,txmon-dc-tracking-enable */
269 uint8_t one_shot_mode_en; /* adi,txmon-one-shot-mode-enable */
270 uint32_t tx_mon_delay; /* adi,txmon-delay */
271 uint32_t tx_mon_duration; /* adi,txmon-duration */
272 uint32_t tx1_mon_front_end_gain; /* adi,txmon-1-front-end-gain */
273 uint32_t tx2_mon_front_end_gain; /* adi,txmon-2-front-end-gain */
274 uint32_t tx1_mon_lo_cm; /* adi,txmon-1-lo-cm */
275 uint32_t tx2_mon_lo_cm; /* adi,txmon-2-lo-cm */
276 /* GPIO definitions */
277 int32_t gpio_resetb; /* reset-gpios */
278 /* MCS Sync */
279 int32_t gpio_sync; /* sync-gpios */
280 int32_t gpio_cal_sw1; /* cal-sw1-gpios */
281 int32_t gpio_cal_sw2; /* cal-sw2-gpios */
282 /* External LO clocks */
283 uint32_t (*ad9361_rfpll_ext_recalc_rate)(struct refclk_scale *clk_priv);
284 int32_t (*ad9361_rfpll_ext_round_rate)(struct refclk_scale *clk_priv, uint32_t rate);
285 int32_t (*ad9361_rfpll_ext_set_rate)(struct refclk_scale *clk_priv, uint32_t rate);
286 }AD9361_InitParam;
287
288 typedef struct
289 {
290 uint32_t rx; /* 1, 2, 3(both) */
291 int32_t rx_gain; /* -12, -6, 0, 6 */
292 uint32_t rx_dec; /* 1, 2, 4 */
293 int16_t rx_coef[128];
294 uint8_t rx_coef_size;
295 uint32_t rx_path_clks[6];
296 uint32_t rx_bandwidth;
297 }AD9361_RXFIRConfig;
298
299 typedef struct
300 {
301 uint32_t tx; /* 1, 2, 3(both) */
302 int32_t tx_gain; /* -6, 0 */
303 uint32_t tx_int; /* 1, 2, 4 */
304 int16_t tx_coef[128];
305 uint8_t tx_coef_size;
306 uint32_t tx_path_clks[6];
307 uint32_t tx_bandwidth;
308 }AD9361_TXFIRConfig;
309
310 enum ad9361_ensm_mode {
311 ENSM_MODE_TX,
312 ENSM_MODE_RX,
313 ENSM_MODE_ALERT,
314 ENSM_MODE_FDD,
315 ENSM_MODE_WAIT,
316 ENSM_MODE_SLEEP,
317 ENSM_MODE_PINCTRL,
318 ENSM_MODE_PINCTRL_FDD_INDEP,
319 };
320
321 #define ENABLE 1
322 #define DISABLE 0
323
324 #define RX1 0
325 #define RX2 1
326
327 #define TX1 0
328 #define TX2 1
329
330 #define A_BALANCED 0
331 #define B_BALANCED 1
332 #define C_BALANCED 2
333 #define A_N 3
334 #define A_P 4
335 #define B_N 5
336 #define B_P 6
337 #define C_N 7
338 #define C_P 8
339 #define TX_MON1 9
340 #define TX_MON2 10
341 #define TX_MON1_2 11
342
343 #define TXA 0
344 #define TXB 1
345
346 #define MODE_1x1 1
347 #define MODE_2x2 2
348
349 #define HIGHEST_OSR 0
350 #define NOMINAL_OSR 1
351
352 #define INT_LO 0
353 #define EXT_LO 1
354
355 /******************************************************************************/
356 /************************ Functions Declarations ******************************/
357 /******************************************************************************/
358 /* Initialize the AD9361 part. */
359 int32_t ad9361_init (struct ad9361_rf_phy **ad9361_phy, AD9361_InitParam *init_param);
360 /* Set the Enable State Machine (ENSM) mode. */
361 int32_t ad9361_set_en_state_machine_mode (struct ad9361_rf_phy *phy, uint32_t mode);
362 /* Get the Enable State Machine (ENSM) mode. */
363 int32_t ad9361_get_en_state_machine_mode (struct ad9361_rf_phy *phy, uint32_t *mode);
364 /* Set the receive RF gain for the selected channel. */
365 int32_t ad9361_set_rx_rf_gain (struct ad9361_rf_phy *phy, uint8_t ch, int32_t gain_db);
366 /* Get current receive RF gain for the selected channel. */
367 int32_t ad9361_get_rx_rf_gain (struct ad9361_rf_phy *phy, uint8_t ch, int32_t *gain_db);
368 /* Set the RX RF bandwidth. */
369 int32_t ad9361_set_rx_rf_bandwidth (struct ad9361_rf_phy *phy, uint32_t bandwidth_hz);
370 /* Get the RX RF bandwidth. */
371 int32_t ad9361_get_rx_rf_bandwidth (struct ad9361_rf_phy *phy, uint32_t *bandwidth_hz);
372 /* Set the RX sampling frequency. */
373 int32_t ad9361_set_rx_sampling_freq (struct ad9361_rf_phy *phy, uint32_t sampling_freq_hz);
374 /* Get current RX sampling frequency. */
375 int32_t ad9361_get_rx_sampling_freq (struct ad9361_rf_phy *phy, uint32_t *sampling_freq_hz);
376 /* Set the RX LO frequency. */
377 int32_t ad9361_set_rx_lo_freq (struct ad9361_rf_phy *phy, uint64_t lo_freq_hz);
378 /* Get current RX LO frequency. */
379 int32_t ad9361_get_rx_lo_freq (struct ad9361_rf_phy *phy, uint64_t *lo_freq_hz);
380 /* Switch between internal and external LO. */
381 int32_t ad9361_set_rx_lo_int_ext(struct ad9361_rf_phy *phy, uint8_t int_ext);
382 /* Get the RSSI for the selected channel. */
383 int32_t ad9361_get_rx_rssi (struct ad9361_rf_phy *phy, uint8_t ch, struct rf_rssi *rssi);
384 /* Set the gain control mode for the selected channel. */
385 int32_t ad9361_set_rx_gain_control_mode (struct ad9361_rf_phy *phy, uint8_t ch, uint8_t gc_mode);
386 /* Get the gain control mode for the selected channel. */
387 int32_t ad9361_get_rx_gain_control_mode (struct ad9361_rf_phy *phy, uint8_t ch, uint8_t *gc_mode);
388 /* Set the RX FIR filter configuration. */
389 int32_t ad9361_set_rx_fir_config (struct ad9361_rf_phy *phy, AD9361_RXFIRConfig fir_cfg);
390 /* Get the RX FIR filter configuration. */
391 int32_t ad9361_get_rx_fir_config(struct ad9361_rf_phy *phy, uint8_t rx_ch, AD9361_RXFIRConfig *fir_cfg);
392 /* Enable/disable the RX FIR filter. */
393 int32_t ad9361_set_rx_fir_en_dis (struct ad9361_rf_phy *phy, uint8_t en_dis);
394 /* Get the status of the RX FIR filter. */
395 int32_t ad9361_get_rx_fir_en_dis (struct ad9361_rf_phy *phy, uint8_t *en_dis);
396 /* Enable/disable the RX RFDC Tracking. */
397 int32_t ad9361_set_rx_rfdc_track_en_dis (struct ad9361_rf_phy *phy, uint8_t en_dis);
398 /* Get the status of the RX RFDC Tracking. */
399 int32_t ad9361_get_rx_rfdc_track_en_dis (struct ad9361_rf_phy *phy, uint8_t *en_dis);
400 /* Enable/disable the RX BasebandDC Tracking. */
401 int32_t ad9361_set_rx_bbdc_track_en_dis (struct ad9361_rf_phy *phy, uint8_t en_dis);
402 /* Get the status of the RX BasebandDC Tracking. */
403 int32_t ad9361_get_rx_bbdc_track_en_dis (struct ad9361_rf_phy *phy, uint8_t *en_dis);
404 /* Enable/disable the RX Quadrature Tracking. */
405 int32_t ad9361_set_rx_quad_track_en_dis (struct ad9361_rf_phy *phy, uint8_t en_dis);
406 /* Get the status of the RX Quadrature Tracking. */
407 int32_t ad9361_get_rx_quad_track_en_dis (struct ad9361_rf_phy *phy, uint8_t *en_dis);
408 /* Set the RX RF input port. */
409 int32_t ad9361_set_rx_rf_port_input (struct ad9361_rf_phy *phy, uint32_t mode);
410 /* Get the selected RX RF input port. */
411 int32_t ad9361_get_rx_rf_port_input (struct ad9361_rf_phy *phy, uint32_t *mode);
412 /* Store RX fastlock profile. */
413 int32_t ad9361_rx_fastlock_store(struct ad9361_rf_phy *phy, uint32_t profile);
414 /* Recall RX fastlock profile. */
415 int32_t ad9361_rx_fastlock_recall(struct ad9361_rf_phy *phy, uint32_t profile);
416 /* Load RX fastlock profile. */
417 int32_t ad9361_rx_fastlock_load(struct ad9361_rf_phy *phy, uint32_t profile, uint8_t *values);
418 /* Save RX fastlock profile. */
419 int32_t ad9361_rx_fastlock_save(struct ad9361_rf_phy *phy, uint32_t profile, uint8_t *values);
420 /* Set the transmit attenuation for the selected channel. */
421 int32_t ad9361_set_tx_attenuation (struct ad9361_rf_phy *phy, uint8_t ch, uint32_t attenuation_mdb);
422 /* Get current transmit attenuation for the selected channel. */
423 int32_t ad9361_get_tx_attenuation (struct ad9361_rf_phy *phy, uint8_t ch, uint32_t *attenuation_mdb);
424 /* Set the TX RF bandwidth. */
425 int32_t ad9361_set_tx_rf_bandwidth (struct ad9361_rf_phy *phy, uint32_t bandwidth_hz);
426 /* Get the TX RF bandwidth. */
427 int32_t ad9361_get_tx_rf_bandwidth (struct ad9361_rf_phy *phy, uint32_t *bandwidth_hz);
428 /* Set the TX sampling frequency. */
429 int32_t ad9361_set_tx_sampling_freq (struct ad9361_rf_phy *phy, uint32_t sampling_freq_hz);
430 /* Get current TX sampling frequency. */
431 int32_t ad9361_get_tx_sampling_freq (struct ad9361_rf_phy *phy, uint32_t *sampling_freq_hz);
432 /* Set the TX LO frequency. */
433 int32_t ad9361_set_tx_lo_freq (struct ad9361_rf_phy *phy, uint64_t lo_freq_hz);
434 /* Get current TX LO frequency. */
435 int32_t ad9361_get_tx_lo_freq (struct ad9361_rf_phy *phy, uint64_t *lo_freq_hz);
436 /* Switch between internal and external LO. */
437 int32_t ad9361_set_tx_lo_int_ext(struct ad9361_rf_phy *phy, uint8_t int_ext);
438 /* Set the TX FIR filter configuration. */
439 int32_t ad9361_set_tx_fir_config (struct ad9361_rf_phy *phy, AD9361_TXFIRConfig fir_cfg);
440 /* Get the TX FIR filter configuration. */
441 int32_t ad9361_get_tx_fir_config(struct ad9361_rf_phy *phy, uint8_t tx_ch, AD9361_TXFIRConfig *fir_cfg);
442 /* Enable/disable the TX FIR filter. */
443 int32_t ad9361_set_tx_fir_en_dis (struct ad9361_rf_phy *phy, uint8_t en_dis);
444 /* Get the status of the TX FIR filter. */
445 int32_t ad9361_get_tx_fir_en_dis (struct ad9361_rf_phy *phy, uint8_t *en_dis);
446 /* Get the TX RSSI for the selected channel. */
447 int32_t ad9361_get_tx_rssi (struct ad9361_rf_phy *phy, uint8_t ch, uint32_t *rssi_db_x_1000);
448 /* Set the TX RF output port. */
449 int32_t ad9361_set_tx_rf_port_output (struct ad9361_rf_phy *phy, uint32_t mode);
450 /* Get the selected TX RF output port. */
451 int32_t ad9361_get_tx_rf_port_output (struct ad9361_rf_phy *phy, uint32_t *mode);
452 /* Enable/disable the auto calibration. */
453 int32_t ad9361_set_tx_auto_cal_en_dis (struct ad9361_rf_phy *phy, uint8_t en_dis);
454 /* Get the status of the auto calibration flag. */
455 int32_t ad9361_get_tx_auto_cal_en_dis (struct ad9361_rf_phy *phy, uint8_t *en_dis);
456 /* Store TX fastlock profile. */
457 int32_t ad9361_tx_fastlock_store(struct ad9361_rf_phy *phy, uint32_t profile);
458 /* Recall TX fastlock profile. */
459 int32_t ad9361_tx_fastlock_recall(struct ad9361_rf_phy *phy, uint32_t profile);
460 /* Load TX fastlock profile. */
461 int32_t ad9361_tx_fastlock_load(struct ad9361_rf_phy *phy, uint32_t profile, uint8_t *values);
462 /* Save TX fastlock profile. */
463 int32_t ad9361_tx_fastlock_save(struct ad9361_rf_phy *phy, uint32_t profile, uint8_t *values);
464 /* Set the RX and TX path rates. */
465 int32_t ad9361_set_trx_path_clks(struct ad9361_rf_phy *phy, uint32_t *rx_path_clks, uint32_t *tx_path_clks);
466 /* Get the RX and TX path rates. */
467 int32_t ad9361_get_trx_path_clks(struct ad9361_rf_phy *phy, uint32_t *rx_path_clks, uint32_t *tx_path_clks);
468 /* Set the number of channels mode. */
469 int32_t ad9361_set_no_ch_mode(struct ad9361_rf_phy *phy, uint8_t no_ch_mode);
470 /* Do multi chip synchronization. */
471 int32_t ad9361_do_mcs(struct ad9361_rf_phy *phy_master, struct ad9361_rf_phy *phy_slave);
472 /* Enable/disable the TRX FIR filters. */
473 int32_t ad9361_set_trx_fir_en_dis (struct ad9361_rf_phy *phy, uint8_t en_dis);
474 /* Set the OSR rate governor. */
475 int32_t ad9361_set_trx_rate_gov (struct ad9361_rf_phy *phy, uint32_t rate_gov);
476 /* Get the OSR rate governor. */
477 int32_t ad9361_get_trx_rate_gov (struct ad9361_rf_phy *phy, uint32_t *rate_gov);
478 /* Perform the selected calibration. */
479 int32_t ad9361_do_calib(struct ad9361_rf_phy *phy, uint32_t cal, int32_t arg);
480 /* Load and enable TRX FIR filters configurations. */
481 int32_t ad9361_trx_load_enable_fir(struct ad9361_rf_phy *phy,
482 AD9361_RXFIRConfig rx_fir_cfg,
483 AD9361_TXFIRConfig tx_fir_cfg);
484 /* Do DCXO coarse tuning. */
485 int32_t ad9361_do_dcxo_tune_coarse(struct ad9361_rf_phy *phy,
486 uint32_t coarse);
487 /* Do DCXO fine tuning. */
488 int32_t ad9361_do_dcxo_tune_fine(struct ad9361_rf_phy *phy,
489 uint32_t fine);
490 #endif