no-OS
Loading...
Searching...
No Matches
ad9361_api.c File Reference

Implementation of AD9361 API Driver. More...

#include "ad9361.h"
#include "ad9361_api.h"
#include "no_os_delay.h"
#include "no_os_spi.h"
#include "no_os_util.h"
#include "no_os_alloc.h"
#include "app_config.h"
#include <string.h>
#include "axi_adc_core.h"
#include "axi_dac_core.h"
Include dependency graph for ad9361_api.c:

Macros

#define ADI_REG_VERSION   0x0000
 

Functions

int32_t ad9361_init (struct ad9361_rf_phy **ad9361_phy, AD9361_InitParam *init_param)
 
int32_t ad9361_remove (struct ad9361_rf_phy *phy)
 
int32_t ad9361_set_en_state_machine_mode (struct ad9361_rf_phy *phy, uint32_t mode)
 
int32_t ad9361_get_en_state_machine_mode (struct ad9361_rf_phy *phy, uint32_t *mode)
 
int32_t ad9361_set_rx_rf_gain (struct ad9361_rf_phy *phy, uint8_t ch, int32_t gain_db)
 
int32_t ad9361_get_rx_rf_gain (struct ad9361_rf_phy *phy, uint8_t ch, int32_t *gain_db)
 
int32_t ad9361_set_rx_rf_bandwidth (struct ad9361_rf_phy *phy, uint32_t bandwidth_hz)
 
int32_t ad9361_get_rx_rf_bandwidth (struct ad9361_rf_phy *phy, uint32_t *bandwidth_hz)
 
int32_t ad9361_set_rx_sampling_freq (struct ad9361_rf_phy *phy, uint32_t sampling_freq_hz)
 
int32_t ad9361_get_rx_sampling_freq (struct ad9361_rf_phy *phy, uint32_t *sampling_freq_hz)
 
int32_t ad9361_set_rx_lo_freq (struct ad9361_rf_phy *phy, uint64_t lo_freq_hz)
 
int32_t ad9361_get_rx_lo_freq (struct ad9361_rf_phy *phy, uint64_t *lo_freq_hz)
 
int32_t ad9361_set_rx_lo_int_ext (struct ad9361_rf_phy *phy, uint8_t int_ext)
 
int32_t ad9361_get_rx_rssi (struct ad9361_rf_phy *phy, uint8_t ch, struct rf_rssi *rssi)
 
int32_t ad9361_set_rx_gain_control_mode (struct ad9361_rf_phy *phy, uint8_t ch, uint8_t gc_mode)
 
int32_t ad9361_get_rx_gain_control_mode (struct ad9361_rf_phy *phy, uint8_t ch, uint8_t *gc_mode)
 
int32_t ad9361_set_rx_fir_config (struct ad9361_rf_phy *phy, AD9361_RXFIRConfig fir_cfg)
 
int32_t ad9361_get_rx_fir_config (struct ad9361_rf_phy *phy, uint8_t rx_ch, AD9361_RXFIRConfig *fir_cfg)
 
int32_t ad9361_set_rx_fir_en_dis (struct ad9361_rf_phy *phy, uint8_t en_dis)
 
int32_t ad9361_get_rx_fir_en_dis (struct ad9361_rf_phy *phy, uint8_t *en_dis)
 
int32_t ad9361_set_rx_rfdc_track_en_dis (struct ad9361_rf_phy *phy, uint8_t en_dis)
 
int32_t ad9361_get_rx_rfdc_track_en_dis (struct ad9361_rf_phy *phy, uint8_t *en_dis)
 
int32_t ad9361_set_rx_bbdc_track_en_dis (struct ad9361_rf_phy *phy, uint8_t en_dis)
 
int32_t ad9361_get_rx_bbdc_track_en_dis (struct ad9361_rf_phy *phy, uint8_t *en_dis)
 
int32_t ad9361_set_rx_quad_track_en_dis (struct ad9361_rf_phy *phy, uint8_t en_dis)
 
int32_t ad9361_get_rx_quad_track_en_dis (struct ad9361_rf_phy *phy, uint8_t *en_dis)
 
int32_t ad9361_set_rx_rf_port_input (struct ad9361_rf_phy *phy, uint32_t mode)
 
int32_t ad9361_get_rx_rf_port_input (struct ad9361_rf_phy *phy, uint32_t *mode)
 
int32_t ad9361_rx_fastlock_store (struct ad9361_rf_phy *phy, uint32_t profile)
 
int32_t ad9361_rx_fastlock_recall (struct ad9361_rf_phy *phy, uint32_t profile)
 
int32_t ad9361_rx_fastlock_load (struct ad9361_rf_phy *phy, uint32_t profile, uint8_t *values)
 
int32_t ad9361_rx_fastlock_save (struct ad9361_rf_phy *phy, uint32_t profile, uint8_t *values)
 
int32_t ad9361_rx_lo_powerdown (struct ad9361_rf_phy *phy, uint8_t option)
 
int32_t ad9361_get_rx_lo_power (struct ad9361_rf_phy *phy, uint8_t *option)
 
int32_t ad9361_set_tx_attenuation (struct ad9361_rf_phy *phy, uint8_t ch, uint32_t attenuation_mdb)
 
int32_t ad9361_get_tx_attenuation (struct ad9361_rf_phy *phy, uint8_t ch, uint32_t *attenuation_mdb)
 
int32_t ad9361_set_tx_rf_bandwidth (struct ad9361_rf_phy *phy, uint32_t bandwidth_hz)
 
int32_t ad9361_get_tx_rf_bandwidth (struct ad9361_rf_phy *phy, uint32_t *bandwidth_hz)
 
int32_t ad9361_set_tx_sampling_freq (struct ad9361_rf_phy *phy, uint32_t sampling_freq_hz)
 
int32_t ad9361_get_tx_sampling_freq (struct ad9361_rf_phy *phy, uint32_t *sampling_freq_hz)
 
int32_t ad9361_set_tx_lo_freq (struct ad9361_rf_phy *phy, uint64_t lo_freq_hz)
 
int32_t ad9361_get_tx_lo_freq (struct ad9361_rf_phy *phy, uint64_t *lo_freq_hz)
 
int32_t ad9361_set_tx_lo_int_ext (struct ad9361_rf_phy *phy, uint8_t int_ext)
 
int32_t ad9361_set_tx_fir_config (struct ad9361_rf_phy *phy, AD9361_TXFIRConfig fir_cfg)
 
int32_t ad9361_get_tx_fir_config (struct ad9361_rf_phy *phy, uint8_t tx_ch, AD9361_TXFIRConfig *fir_cfg)
 
int32_t ad9361_set_tx_fir_en_dis (struct ad9361_rf_phy *phy, uint8_t en_dis)
 
int32_t ad9361_get_tx_fir_en_dis (struct ad9361_rf_phy *phy, uint8_t *en_dis)
 
int32_t ad9361_get_tx_rssi (struct ad9361_rf_phy *phy, uint8_t ch, uint32_t *rssi_db_x_1000)
 
int32_t ad9361_set_tx_rf_port_output (struct ad9361_rf_phy *phy, uint32_t mode)
 
int32_t ad9361_get_tx_rf_port_output (struct ad9361_rf_phy *phy, uint32_t *mode)
 
int32_t ad9361_set_tx_auto_cal_en_dis (struct ad9361_rf_phy *phy, uint8_t en_dis)
 
int32_t ad9361_get_tx_auto_cal_en_dis (struct ad9361_rf_phy *phy, uint8_t *en_dis)
 
int32_t ad9361_tx_fastlock_store (struct ad9361_rf_phy *phy, uint32_t profile)
 
int32_t ad9361_tx_fastlock_recall (struct ad9361_rf_phy *phy, uint32_t profile)
 
int32_t ad9361_tx_fastlock_load (struct ad9361_rf_phy *phy, uint32_t profile, uint8_t *values)
 
int32_t ad9361_tx_fastlock_save (struct ad9361_rf_phy *phy, uint32_t profile, uint8_t *values)
 
int32_t ad9361_tx_lo_powerdown (struct ad9361_rf_phy *phy, uint8_t option)
 
int32_t ad9361_get_tx_lo_power (struct ad9361_rf_phy *phy, uint8_t *option)
 
int32_t ad9361_set_trx_path_clks (struct ad9361_rf_phy *phy, uint32_t *rx_path_clks, uint32_t *tx_path_clks)
 
int32_t ad9361_get_trx_path_clks (struct ad9361_rf_phy *phy, uint32_t *rx_path_clks, uint32_t *tx_path_clks)
 
int32_t ad9361_set_no_ch_mode (struct ad9361_rf_phy *phy, uint8_t no_ch_mode)
 
int32_t ad9361_do_mcs (struct ad9361_rf_phy *phy_master, struct ad9361_rf_phy *phy_slave)
 
int32_t ad9361_set_trx_fir_en_dis (struct ad9361_rf_phy *phy, uint8_t en_dis)
 
int32_t ad9361_set_trx_rate_gov (struct ad9361_rf_phy *phy, uint32_t rate_gov)
 
int32_t ad9361_get_trx_rate_gov (struct ad9361_rf_phy *phy, uint32_t *rate_gov)
 
int32_t ad9361_do_calib (struct ad9361_rf_phy *phy, uint32_t cal, int32_t arg)
 
int32_t ad9361_trx_load_enable_fir (struct ad9361_rf_phy *phy, AD9361_RXFIRConfig rx_fir_cfg, AD9361_TXFIRConfig tx_fir_cfg)
 
int32_t ad9361_do_dcxo_tune_coarse (struct ad9361_rf_phy *phy, uint32_t coarse)
 
int32_t ad9361_do_dcxo_tune_fine (struct ad9361_rf_phy *phy, uint32_t fine)
 
int32_t ad9361_get_temperature (struct ad9361_rf_phy *phy, int32_t *temp)
 

Variables

struct gain_table_info ad9361_adi_gt_info []
 

Detailed Description

Implementation of AD9361 API Driver.

Author
DBogdan (drago.nosp@m.s.bo.nosp@m.gdan@.nosp@m.anal.nosp@m.og.co.nosp@m.m)

Copyright 2013(c) Analog Devices, Inc.

SPDX-License-Identifier: BSD-3-Clause

Macro Definition Documentation

◆ ADI_REG_VERSION

#define ADI_REG_VERSION   0x0000

Function Documentation

◆ ad9361_do_calib()

int32_t ad9361_do_calib ( struct ad9361_rf_phy * phy,
uint32_t cal,
int32_t arg )

Perform the selected calibration.

Parameters
phyThe AD9361 state structure.
calThe selected calibration (TX_QUAD_CAL, RFDC_CAL). Accepted values: TX_QUAD_CAL RFDC_CAL
argFor TX_QUAD_CAL - the optional RX phase value overwrite (set to zero).
Returns
0 in case of success, negative error code otherwise.

Note: This function will/may affect the data path.

◆ ad9361_do_dcxo_tune_coarse()

int32_t ad9361_do_dcxo_tune_coarse ( struct ad9361_rf_phy * phy,
uint32_t coarse )

Do DCXO coarse tuning.

Parameters
phyThe AD9361 current state structure.
coarseThe DCXO coarse tuning value.
Returns
0 in case of success, negative error code otherwise.

◆ ad9361_do_dcxo_tune_fine()

int32_t ad9361_do_dcxo_tune_fine ( struct ad9361_rf_phy * phy,
uint32_t fine )

Do DCXO fine tuning.

Parameters
phyThe AD9361 current state structure.
fineThe DCXO fine tuning value.
Returns
0 in case of success, negative error code otherwise.

◆ ad9361_do_mcs()

int32_t ad9361_do_mcs ( struct ad9361_rf_phy * phy_master,
struct ad9361_rf_phy * phy_slave )

Do multi chip synchronization.

Parameters
phy_masterThe AD9361 Master state structure.
phy_slaveThe AD9361 Slave state structure.
Returns
0 in case of success, negative error code otherwise.

Note: This function will/may affect the data path.

◆ ad9361_get_en_state_machine_mode()

int32_t ad9361_get_en_state_machine_mode ( struct ad9361_rf_phy * phy,
uint32_t * mode )

Get the Enable State Machine (ENSM) mode.

Parameters
phyThe AD9361 current state structure.
modeA variable to store the selected ENSM mode.
Returns
0 in case of success, negative error code otherwise.

◆ ad9361_get_rx_bbdc_track_en_dis()

int32_t ad9361_get_rx_bbdc_track_en_dis ( struct ad9361_rf_phy * phy,
uint8_t * en_dis )

Get the status of the RX BasebandDC Tracking.

Parameters
phyThe AD9361 current state structure.
en_disThe enable/disable status buffer.
Returns
0 in case of success, negative error code otherwise.

◆ ad9361_get_rx_fir_config()

int32_t ad9361_get_rx_fir_config ( struct ad9361_rf_phy * phy,
uint8_t rx_ch,
AD9361_RXFIRConfig * fir_cfg )

Get the RX FIR filter configuration.

Parameters
phyThe AD9361 current state structure.
rx_chThe selected RX channel (RX1, RX2). Accepted values: RX1 (0) RX2 (1)
fir_cfgFIR filter configuration output file.
Returns
0 in case of success, negative error code otherwise.

◆ ad9361_get_rx_fir_en_dis()

int32_t ad9361_get_rx_fir_en_dis ( struct ad9361_rf_phy * phy,
uint8_t * en_dis )

Get the status of the RX FIR filter.

Parameters
phyThe AD9361 current state structure.
en_disThe enable/disable status buffer.
Returns
0 in case of success, negative error code otherwise.

◆ ad9361_get_rx_gain_control_mode()

int32_t ad9361_get_rx_gain_control_mode ( struct ad9361_rf_phy * phy,
uint8_t ch,
uint8_t * gc_mode )

Get the gain control mode for the selected channel.

Parameters
phyThe AD9361 current state structure.
chThe desired channel (RX1, RX2). Accepted values: RX1 (0) RX2 (1)
gc_modeA variable to store the gain control mode.
Returns
0 in case of success, negative error code otherwise.

◆ ad9361_get_rx_lo_freq()

int32_t ad9361_get_rx_lo_freq ( struct ad9361_rf_phy * phy,
uint64_t * lo_freq_hz )

Get current RX LO frequency.

Parameters
phyThe AD9361 current state structure.
lo_freq_hzA variable to store the frequency value (Hz).
Returns
0 in case of success, negative error code otherwise.

◆ ad9361_get_rx_lo_power()

int32_t ad9361_get_rx_lo_power ( struct ad9361_rf_phy * phy,
uint8_t * option )

Get the RX Local Oscillator power status.

Parameters
phyThe AD9361 state structure.
optionStore the option (ON, OFF).
Returns
0 in case of success, negative error code otherwise.

◆ ad9361_get_rx_quad_track_en_dis()

int32_t ad9361_get_rx_quad_track_en_dis ( struct ad9361_rf_phy * phy,
uint8_t * en_dis )

Get the status of the RX Quadrature Tracking.

Parameters
phyThe AD9361 current state structure.
en_disThe enable/disable status buffer.
Returns
0 in case of success, negative error code otherwise.

◆ ad9361_get_rx_rf_bandwidth()

int32_t ad9361_get_rx_rf_bandwidth ( struct ad9361_rf_phy * phy,
uint32_t * bandwidth_hz )

Get the RX RF bandwidth.

Parameters
phyThe AD9361 current state structure.
bandwidth_hzA variable to store the bandwidth value (Hz).
Returns
0 in case of success, negative error code otherwise.

◆ ad9361_get_rx_rf_gain()

int32_t ad9361_get_rx_rf_gain ( struct ad9361_rf_phy * phy,
uint8_t ch,
int32_t * gain_db )

Get current receive RF gain for the selected channel.

Parameters
phyThe AD9361 current state structure.
chThe desired channel number (RX1, RX2). Accepted values in 2x2 mode: RX1 (0) RX2 (1) Accepted values in 1x1 mode: RX1 (0)
gain_dbA variable to store the RF gain (dB).
Returns
0 in case of success, negative error code otherwise.

◆ ad9361_get_rx_rf_port_input()

int32_t ad9361_get_rx_rf_port_input ( struct ad9361_rf_phy * phy,
uint32_t * mode )

Get the selected RX RF input port.

Parameters
phyThe AD9361 current state structure.
modeThe RF port.
Returns
0 in case of success, negative error code otherwise.

◆ ad9361_get_rx_rfdc_track_en_dis()

int32_t ad9361_get_rx_rfdc_track_en_dis ( struct ad9361_rf_phy * phy,
uint8_t * en_dis )

Get the status of the RX RFDC Tracking.

Parameters
phyThe AD9361 current state structure.
en_disThe enable/disable status buffer.
Returns
0 in case of success, negative error code otherwise.

◆ ad9361_get_rx_rssi()

int32_t ad9361_get_rx_rssi ( struct ad9361_rf_phy * phy,
uint8_t ch,
struct rf_rssi * rssi )

Get the RSSI for the selected channel.

Parameters
phyThe AD9361 current state structure.
chThe desired channel (RX1, RX2). Accepted values in 2x2 mode: RX1 (0) RX2 (1) Accepted values in 1x1 mode: RX1 (0)
rssiA variable to store the RSSI.
Returns
0 in case of success, negative error code otherwise.

◆ ad9361_get_rx_sampling_freq()

int32_t ad9361_get_rx_sampling_freq ( struct ad9361_rf_phy * phy,
uint32_t * sampling_freq_hz )

Get current RX sampling frequency.

Parameters
phyThe AD9361 current state structure.
sampling_freq_hzA variable to store the frequency value (Hz).
Returns
0 in case of success, negative error code otherwise.

◆ ad9361_get_temperature()

int32_t ad9361_get_temperature ( struct ad9361_rf_phy * phy,
int32_t * temp )

Get the temperature.

Parameters
phyThe AD9361 current state structure.
tempThe temperature (degrees C * 1000).
Returns
0 in case of success, negative error code otherwise.

◆ ad9361_get_trx_path_clks()

int32_t ad9361_get_trx_path_clks ( struct ad9361_rf_phy * phy,
uint32_t * rx_path_clks,
uint32_t * tx_path_clks )

Get the RX and TX path rates.

Parameters
phyThe AD9361 state structure.
rx_path_clksRX path rates buffer.
tx_path_clksTX path rates buffer.
Returns
0 in case of success, negative error code otherwise.

◆ ad9361_get_trx_rate_gov()

int32_t ad9361_get_trx_rate_gov ( struct ad9361_rf_phy * phy,
uint32_t * rate_gov )

Get the OSR rate governor.

Parameters
phyThe AD9361 current state structure.
rate_govOption buffer.
Returns
0 in case of success, negative error code otherwise.

◆ ad9361_get_tx_attenuation()

int32_t ad9361_get_tx_attenuation ( struct ad9361_rf_phy * phy,
uint8_t ch,
uint32_t * attenuation_mdb )

Get current transmit attenuation for the selected channel.

Parameters
phyThe AD9361 current state structure.
chThe desired channel number (TX1, TX2). Accepted values in 2x2 mode: TX1 (0) TX2 (1) Accepted values in 1x1 mode: TX1 (0)
attenuation_mdbA variable to store the attenuation value (mdB).
Returns
0 in case of success, negative error code otherwise.

◆ ad9361_get_tx_auto_cal_en_dis()

int32_t ad9361_get_tx_auto_cal_en_dis ( struct ad9361_rf_phy * phy,
uint8_t * en_dis )

Get the status of the auto calibration flag.

Parameters
phyThe AD9361 current state structure.
en_disThe enable/disable status buffer.
Returns
0 in case of success, negative error code otherwise.

◆ ad9361_get_tx_fir_config()

int32_t ad9361_get_tx_fir_config ( struct ad9361_rf_phy * phy,
uint8_t tx_ch,
AD9361_TXFIRConfig * fir_cfg )

Get the TX FIR filter configuration.

Parameters
phyThe AD9361 current state structure.
tx_chThe selected TX channel (TX1, TX2). Accepted values: TX1 (0) TX2 (1)
fir_cfgFIR filter configuration output file.
Returns
0 in case of success, negative error code otherwise.

◆ ad9361_get_tx_fir_en_dis()

int32_t ad9361_get_tx_fir_en_dis ( struct ad9361_rf_phy * phy,
uint8_t * en_dis )

Get the status of the TX FIR filter.

Parameters
phyThe AD9361 current state structure.
en_disThe enable/disable status buffer.
Returns
0 in case of success, negative error code otherwise.

◆ ad9361_get_tx_lo_freq()

int32_t ad9361_get_tx_lo_freq ( struct ad9361_rf_phy * phy,
uint64_t * lo_freq_hz )

Get current TX LO frequency.

Parameters
phyThe AD9361 current state structure.
lo_freq_hzA variable to store the frequency value (Hz).
Returns
0 in case of success, negative error code otherwise.

◆ ad9361_get_tx_lo_power()

int32_t ad9361_get_tx_lo_power ( struct ad9361_rf_phy * phy,
uint8_t * option )

Get the TX Local Oscillator power status.

Parameters
phyThe AD9361 state structure.
optionStore the option (ON, OFF).
Returns
0 in case of success, negative error code otherwise.

◆ ad9361_get_tx_rf_bandwidth()

int32_t ad9361_get_tx_rf_bandwidth ( struct ad9361_rf_phy * phy,
uint32_t * bandwidth_hz )

Get the TX RF bandwidth.

Parameters
phyThe AD9361 current state structure.
bandwidth_hzA variable to store the bandwidth value (Hz).
Returns
0 in case of success, negative error code otherwise.

◆ ad9361_get_tx_rf_port_output()

int32_t ad9361_get_tx_rf_port_output ( struct ad9361_rf_phy * phy,
uint32_t * mode )

Get the selected TX RF output port.

Parameters
phyThe AD9361 current state structure.
modeThe RF port.
Returns
0 in case of success, negative error code otherwise.

◆ ad9361_get_tx_rssi()

int32_t ad9361_get_tx_rssi ( struct ad9361_rf_phy * phy,
uint8_t ch,
uint32_t * rssi_db_x_1000 )

Get the TX RSSI for the selected channel (TX_MON should be enabled).

Parameters
phyThe AD9361 current state structure.
chThe desired channel (TX1, TX2). Accepted values: TX1 (0) TX2 (1)
rssi_db_x_1000A variable to store the RSSI.
Returns
0 in case of success, negative error code otherwise.

◆ ad9361_get_tx_sampling_freq()

int32_t ad9361_get_tx_sampling_freq ( struct ad9361_rf_phy * phy,
uint32_t * sampling_freq_hz )

Get current TX sampling frequency.

Parameters
phyThe AD9361 current state structure.
sampling_freq_hzA variable to store the frequency value (Hz).
Returns
0 in case of success, negative error code otherwise.

◆ ad9361_init()

int32_t ad9361_init ( struct ad9361_rf_phy ** ad9361_phy,
AD9361_InitParam * init_param )

Initialize the AD9361 part.

Parameters
ad9361_phyThe AD9361 device structure.
init_paramThe structure that contains the AD9361 initial parameters.
Returns
0 in case of success, negative error code otherwise.

Note: This function will/may affect the data path.

◆ ad9361_remove()

int32_t ad9361_remove ( struct ad9361_rf_phy * phy)

Free the allocated resources.

Parameters
phyThe AD9361 current state structure.
Returns
0 in case of success, negative error code otherwise.

◆ ad9361_rx_fastlock_load()

int32_t ad9361_rx_fastlock_load ( struct ad9361_rf_phy * phy,
uint32_t profile,
uint8_t * values )

Load RX fastlock profile. A previously saved profile can be loaded in any of the 8 available slots.

Parameters
phyThe AD9361 state structure.
profileThe profile number (0 - 7). Accepted values: 0 - 7
valuesFastlock profile program data. Example: val0,val1,val2,…,val15
Returns
0 in case of success, negative error code otherwise.

◆ ad9361_rx_fastlock_recall()

int32_t ad9361_rx_fastlock_recall ( struct ad9361_rf_phy * phy,
uint32_t profile )

Recall specified RX fastlock profile. When in fastlock pin select mode (init_param->rx_fastlock_pincontrol_enable), the function needs to be called before then the pin-control can be used.

Parameters
phyThe AD9361 state structure.
profileThe profile number (0 - 7). Accepted values: 0 - 7
Returns
0 in case of success, negative error code otherwise.

◆ ad9361_rx_fastlock_save()

int32_t ad9361_rx_fastlock_save ( struct ad9361_rf_phy * phy,
uint32_t profile,
uint8_t * values )

Save RX fastlock profile. In order to use more than 8 Profiles, an existing profile can be read back and stored by the user application.

Parameters
phyThe AD9361 state structure.
profileThe profile number (0 - 7). Accepted values: 0 - 7
valuesFastlock profile program data.
Returns
0 in case of success, negative error code otherwise.

◆ ad9361_rx_fastlock_store()

int32_t ad9361_rx_fastlock_store ( struct ad9361_rf_phy * phy,
uint32_t profile )

Store RX fastlock profile. To create a profile tune the synthesizer (ad9361_set_rx_lo_freq()) and then call this function specifying the target profile number.

Parameters
phyThe AD9361 state structure.
profileThe profile number (0 - 7). Accepted values: 0 - 7
Returns
0 in case of success, negative error code otherwise.

◆ ad9361_rx_lo_powerdown()

int32_t ad9361_rx_lo_powerdown ( struct ad9361_rf_phy * phy,
uint8_t option )

Power down the RX Local Oscillator.

Parameters
phyThe AD9361 state structure.
optionThe option (ON, OFF). Accepted values: ON (0) OFF (1)
Returns
0 in case of success, negative error code otherwise.

◆ ad9361_set_en_state_machine_mode()

int32_t ad9361_set_en_state_machine_mode ( struct ad9361_rf_phy * phy,
uint32_t mode )

Set the Enable State Machine (ENSM) mode.

Parameters
phyThe AD9361 current state structure.
modeThe ENSM mode. Accepted values: ENSM_MODE_TX ENSM_MODE_RX ENSM_MODE_ALERT ENSM_MODE_FDD ENSM_MODE_WAIT ENSM_MODE_SLEEP ENSM_MODE_PINCTRL ENSM_MODE_PINCTRL_FDD_INDEP
Returns
0 in case of success, negative error code otherwise.

Note: This function will/may affect the data path.

◆ ad9361_set_no_ch_mode()

int32_t ad9361_set_no_ch_mode ( struct ad9361_rf_phy * phy,
uint8_t no_ch_mode )

Set the number of channels mode.

Parameters
phyThe AD9361 state structure. Note: This function also resets the device, some additional configurations might be necessary
no_ch_modeNumber of channels mode (MODE_1x1, MODE_2x2). Accepted values: MODE_1x1 (1) MODE_2x2 (2)
Returns
0 in case of success, negative error code otherwise.

◆ ad9361_set_rx_bbdc_track_en_dis()

int32_t ad9361_set_rx_bbdc_track_en_dis ( struct ad9361_rf_phy * phy,
uint8_t en_dis )

Enable/disable the RX BasebandDC Tracking.

Parameters
phyThe AD9361 current state structure.
en_disThe option (ENABLE, DISABLE). Accepted values: ENABLE (1) DISABLE (0)
Returns
0 in case of success, negative error code otherwise.

◆ ad9361_set_rx_fir_config()

int32_t ad9361_set_rx_fir_config ( struct ad9361_rf_phy * phy,
AD9361_RXFIRConfig fir_cfg )

Set the RX FIR filter configuration.

Parameters
phyThe AD9361 current state structure.
fir_cfgFIR filter configuration.
Returns
0 in case of success, negative error code otherwise.

Note: This function will/may affect the data path.

◆ ad9361_set_rx_fir_en_dis()

int32_t ad9361_set_rx_fir_en_dis ( struct ad9361_rf_phy * phy,
uint8_t en_dis )

Enable/disable the RX FIR filter.

Parameters
phyThe AD9361 current state structure.
en_disThe option (ENABLE, DISABLE). Accepted values: ENABLE (1) DISABLE (0)
Returns
0 in case of success, negative error code otherwise.

Note: This function will/may affect the data path.

◆ ad9361_set_rx_gain_control_mode()

int32_t ad9361_set_rx_gain_control_mode ( struct ad9361_rf_phy * phy,
uint8_t ch,
uint8_t gc_mode )

Set the gain control mode for the selected channel.

Parameters
phyThe AD9361 current state structure.
chThe desired channel (RX1, RX2). Accepted values in 2x2 mode: RX1 (0) RX2 (1) Accepted values in 1x1 mode: RX1 (0)
gc_modeThe gain control mode (manual, fast_attack, slow_attack, hybrid). Accepted values: RF_GAIN_MGC (manual) RF_GAIN_FASTATTACK_AGC (fast_attack) RF_GAIN_SLOWATTACK_AGC (slow_attack) RF_GAIN_HYBRID_AGC (hybrid)
Returns
0 in case of success, negative error code otherwise.

◆ ad9361_set_rx_lo_freq()

int32_t ad9361_set_rx_lo_freq ( struct ad9361_rf_phy * phy,
uint64_t lo_freq_hz )

Set the RX LO frequency.

Parameters
phyThe AD9361 current state structure.
lo_freq_hzThe desired frequency (Hz). Example: 2400000000 (2.4 GHz)
Returns
0 in case of success, negative error code otherwise.

Note: This function will/may affect the data path.

◆ ad9361_set_rx_lo_int_ext()

int32_t ad9361_set_rx_lo_int_ext ( struct ad9361_rf_phy * phy,
uint8_t int_ext )

Switch between internal and external LO.

Parameters
phyThe AD9361 state structure.
int_extThe selected lo (INT_LO, EXT_LO). Accepted values: INT_LO EXT_LO
Returns
0 in case of success, negative error code otherwise.

◆ ad9361_set_rx_quad_track_en_dis()

int32_t ad9361_set_rx_quad_track_en_dis ( struct ad9361_rf_phy * phy,
uint8_t en_dis )

Enable/disable the RX Quadrature Tracking.

Parameters
phyThe AD9361 current state structure.
en_disThe option (ENABLE, DISABLE). Accepted values: ENABLE (1) DISABLE (0)
Returns
0 in case of success, negative error code otherwise.

◆ ad9361_set_rx_rf_bandwidth()

int32_t ad9361_set_rx_rf_bandwidth ( struct ad9361_rf_phy * phy,
uint32_t bandwidth_hz )

Set the RX RF bandwidth.

Parameters
phyThe AD9361 current state structure.
bandwidth_hzThe desired bandwidth (Hz). Example: 18000000 (18 MHz)
Returns
0 in case of success, negative error code otherwise.

Note: This function will/may affect the data path.

◆ ad9361_set_rx_rf_gain()

int32_t ad9361_set_rx_rf_gain ( struct ad9361_rf_phy * phy,
uint8_t ch,
int32_t gain_db )

Set the receive RF gain for the selected channel.

Parameters
phyThe AD9361 current state structure.
chThe desired channel number (RX1, RX2). Accepted values in 2x2 mode: RX1 (0) RX2 (1) Accepted values in 1x1 mode: RX1 (0)
gain_dbThe RF gain (dB). Example: 10 (10 dB)
Returns
0 in case of success, negative error code otherwise.

◆ ad9361_set_rx_rf_port_input()

int32_t ad9361_set_rx_rf_port_input ( struct ad9361_rf_phy * phy,
uint32_t mode )

Set the RX RF input port.

Parameters
phyThe AD9361 current state structure.
modeThe RF port. Accepted values: A_BALANCED (0 - (RX1A_N & RX1A_P) and (RX2A_N & RX2A_P) enabled; balanced) B_BALANCED (1 - (RX1B_N & RX1B_P) and (RX2B_N & RX2B_P) enabled; balanced) C_BALANCED (2 - (RX1C_N & RX1C_P) and (RX2C_N & RX2C_P) enabled; balanced) A_N (3 - RX1A_N and RX2A_N enabled; unbalanced) A_P (4 - RX1A_P and RX2A_P enabled; unbalanced) B_N (5 - RX1B_N and RX2B_N enabled; unbalanced) B_P (6 - RX1B_P and RX2B_P enabled; unbalanced) C_N (7 - RX1C_N and RX2C_N enabled; unbalanced) C_P (8 - RX1C_P and RX2C_P enabled; unbalanced) TX_MON1 (9 - TX_MONITOR1) TX_MON2 (10 - TX_MONITOR2) TX_MON1_2 (11 - TX_MONITOR1 & TX_MONITOR2)
Returns
0 in case of success, negative error code otherwise.

◆ ad9361_set_rx_rfdc_track_en_dis()

int32_t ad9361_set_rx_rfdc_track_en_dis ( struct ad9361_rf_phy * phy,
uint8_t en_dis )

Enable/disable the RX RFDC Tracking.

Parameters
phyThe AD9361 current state structure.
en_disThe option (ENABLE, DISABLE). Accepted values: ENABLE (1) DISABLE (0)
Returns
0 in case of success, negative error code otherwise.

◆ ad9361_set_rx_sampling_freq()

int32_t ad9361_set_rx_sampling_freq ( struct ad9361_rf_phy * phy,
uint32_t sampling_freq_hz )

Set the RX sampling frequency.

Parameters
phyThe AD9361 current state structure.
sampling_freq_hzThe desired frequency (Hz). Example: 30720000 (30.72 MHz)
Returns
0 in case of success, negative error code otherwise.

Note: This function will/may affect the data path.

◆ ad9361_set_trx_fir_en_dis()

int32_t ad9361_set_trx_fir_en_dis ( struct ad9361_rf_phy * phy,
uint8_t en_dis )

Enable/disable the TRX FIR filters.

Parameters
phyThe AD9361 current state structure.
en_disThe option (ENABLE, DISABLE). Accepted values: ENABLE (1) DISABLE (0)
Returns
0 in case of success, negative error code otherwise.

Note: This function will/may affect the data path.

◆ ad9361_set_trx_path_clks()

int32_t ad9361_set_trx_path_clks ( struct ad9361_rf_phy * phy,
uint32_t * rx_path_clks,
uint32_t * tx_path_clks )

Set the RX and TX path rates.

Parameters
phyThe AD9361 state structure.
rx_path_clksRX path rates buffer.
tx_path_clksTX path rates buffer.
Returns
0 in case of success, negative error code otherwise.

Note: This function will/may affect the data path.

◆ ad9361_set_trx_rate_gov()

int32_t ad9361_set_trx_rate_gov ( struct ad9361_rf_phy * phy,
uint32_t rate_gov )

Set the OSR rate governor.

Parameters
phyThe AD9361 current state structure.
rate_govOSR rate governor (highest, nominal). Accepted values: HIGHEST_OSR (0 - highest OSR) NOMINAL_OSR (1 - nominal)
Returns
0 in case of success, negative error code otherwise.

◆ ad9361_set_tx_attenuation()

int32_t ad9361_set_tx_attenuation ( struct ad9361_rf_phy * phy,
uint8_t ch,
uint32_t attenuation_mdb )

Set the transmit attenuation for the selected channel.

Parameters
phyThe AD9361 current state structure.
chThe desired channel number (TX1, TX2). Accepted values in 2x2 mode: TX1 (0) TX2 (1) Accepted values in 1x1 mode: TX1 (0)
attenuation_mdbThe attenuation (mdB). Example: 10000 (10 dB)
Returns
0 in case of success, negative error code otherwise.

◆ ad9361_set_tx_auto_cal_en_dis()

int32_t ad9361_set_tx_auto_cal_en_dis ( struct ad9361_rf_phy * phy,
uint8_t en_dis )

Enable/disable the auto calibration.

Parameters
phyThe AD9361 current state structure.
en_disThe option (ENABLE, DISABLE). Accepted values: ENABLE (1) DISABLE (0)
Returns
0 in case of success, negative error code otherwise.

◆ ad9361_set_tx_fir_config()

int32_t ad9361_set_tx_fir_config ( struct ad9361_rf_phy * phy,
AD9361_TXFIRConfig fir_cfg )

Set the TX FIR filter configuration.

Parameters
phyThe AD9361 current state structure.
fir_cfgFIR filter configuration.
Returns
0 in case of success, negative error code otherwise.

Note: This function will/may affect the data path.

◆ ad9361_set_tx_fir_en_dis()

int32_t ad9361_set_tx_fir_en_dis ( struct ad9361_rf_phy * phy,
uint8_t en_dis )

Enable/disable the TX FIR filter.

Parameters
phyThe AD9361 current state structure.
en_disThe option (ENABLE, DISABLE). Accepted values: ENABLE (1) DISABLE (0)
Returns
0 in case of success, negative error code otherwise.

Note: This function will/may affect the data path.

◆ ad9361_set_tx_lo_freq()

int32_t ad9361_set_tx_lo_freq ( struct ad9361_rf_phy * phy,
uint64_t lo_freq_hz )

Set the TX LO frequency.

Parameters
phyThe AD9361 current state structure.
lo_freq_hzThe desired frequency (Hz). Example: 2400000000 (2.4 GHz)
Returns
0 in case of success, negative error code otherwise.

Note: This function will/may affect the data path.

◆ ad9361_set_tx_lo_int_ext()

int32_t ad9361_set_tx_lo_int_ext ( struct ad9361_rf_phy * phy,
uint8_t int_ext )

Switch between internal and external LO.

Parameters
phyThe AD9361 state structure.
int_extThe selected lo (INT_LO, EXT_LO). Accepted values: INT_LO EXT_LO
Returns
0 in case of success, negative error code otherwise.

◆ ad9361_set_tx_rf_bandwidth()

int32_t ad9361_set_tx_rf_bandwidth ( struct ad9361_rf_phy * phy,
uint32_t bandwidth_hz )

Set the TX RF bandwidth.

Parameters
phyThe AD9361 current state structure.
bandwidth_hzThe desired bandwidth (Hz). Example: 18000000 (18 MHz)
Returns
0 in case of success, negative error code otherwise.

Note: This function will/may affect the data path.

◆ ad9361_set_tx_rf_port_output()

int32_t ad9361_set_tx_rf_port_output ( struct ad9361_rf_phy * phy,
uint32_t mode )

Set the TX RF output port.

Parameters
phyThe AD9361 current state structure.
modeThe RF port. Accepted values: TXA (0) TXB (1)
Returns
0 in case of success, negative error code otherwise.

◆ ad9361_set_tx_sampling_freq()

int32_t ad9361_set_tx_sampling_freq ( struct ad9361_rf_phy * phy,
uint32_t sampling_freq_hz )

Set the TX sampling frequency.

Parameters
phyThe AD9361 current state structure.
sampling_freq_hzThe desired frequency (Hz). Example: 30720000 (30.72 MHz)
Returns
0 in case of success, negative error code otherwise.

Note: This function will/may affect the data path.

◆ ad9361_trx_load_enable_fir()

int32_t ad9361_trx_load_enable_fir ( struct ad9361_rf_phy * phy,
AD9361_RXFIRConfig rx_fir_cfg,
AD9361_TXFIRConfig tx_fir_cfg )

Load and enable TRX FIR filters configurations.

Parameters
phyThe AD9361 current state structure.
rx_fir_cfgRX FIR filter configuration.
tx_fir_cfgTX FIR filter configuration.
Returns
0 in case of success, negative error code otherwise.

Note: This function will/may affect the data path.

◆ ad9361_tx_fastlock_load()

int32_t ad9361_tx_fastlock_load ( struct ad9361_rf_phy * phy,
uint32_t profile,
uint8_t * values )

Load TX fastlock profile. A previously saved profile can be loaded in any of the 8 available slots.

Parameters
phyThe AD9361 state structure.
profileThe profile number (0 - 7). Accepted values: 0 - 7
valuesFastlock profile program data. Example: val0,val1,val2,…,val15
Returns
0 in case of success, negative error code otherwise.

◆ ad9361_tx_fastlock_recall()

int32_t ad9361_tx_fastlock_recall ( struct ad9361_rf_phy * phy,
uint32_t profile )

Recall specified TX fastlock profile. When in fastlock pin select mode (init_param->tx_fastlock_pincontrol_enable), the function needs to be called before then the pin-control can be used.

Parameters
phyThe AD9361 state structure.
profileThe profile number (0 - 7). Accepted values: 0 - 7
Returns
0 in case of success, negative error code otherwise.

◆ ad9361_tx_fastlock_save()

int32_t ad9361_tx_fastlock_save ( struct ad9361_rf_phy * phy,
uint32_t profile,
uint8_t * values )

Save TX fastlock profile. In order to use more than 8 Profiles, an existing profile can be read back and stored by the user application.

Parameters
phyThe AD9361 state structure.
profileThe profile number (0 - 7). Accepted values: 0 - 7
valuesFastlock profile program data.
Returns
0 in case of success, negative error code otherwise.

◆ ad9361_tx_fastlock_store()

int32_t ad9361_tx_fastlock_store ( struct ad9361_rf_phy * phy,
uint32_t profile )

Store TX fastlock profile. To create a profile tune the synthesizer (ad9361_set_tx_lo_freq()) and then call this function specifying the target profile number.

Parameters
phyThe AD9361 state structure.
profileThe profile number (0 - 7). Accepted values: 0 - 7
Returns
0 in case of success, negative error code otherwise.

◆ ad9361_tx_lo_powerdown()

int32_t ad9361_tx_lo_powerdown ( struct ad9361_rf_phy * phy,
uint8_t option )

Power down the TX Local Oscillator.

Parameters
phyThe AD9361 state structure.
optionThe option (ON, OFF). Accepted values: ON (0) OFF (1)
Returns
0 in case of success, negative error code otherwise.

Variable Documentation

◆ ad9361_adi_gt_info

struct gain_table_info ad9361_adi_gt_info[]
extern