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

Header file of AD9361 API Driver. More...

#include "ad9361_util.h"
#include "no_os_gpio.h"
#include "no_os_spi.h"
Include dependency graph for ad9361_api.h:

Classes

struct  AD9361_InitParam
 
struct  AD9361_RXFIRConfig
 
struct  AD9361_TXFIRConfig
 

Macros

#define ENABLE   1
 
#define DISABLE   0
 
#define RX1   0
 
#define RX2   1
 
#define TX1   0
 
#define TX2   1
 
#define A_BALANCED   0
 
#define B_BALANCED   1
 
#define C_BALANCED   2
 
#define A_N   3
 
#define A_P   4
 
#define B_N   5
 
#define B_P   6
 
#define C_N   7
 
#define C_P   8
 
#define TX_MON1   9
 
#define TX_MON2   10
 
#define TX_MON1_2   11
 
#define TXA   0
 
#define TXB   1
 
#define MODE_1x1   1
 
#define MODE_2x2   2
 
#define HIGHEST_OSR   0
 
#define NOMINAL_OSR   1
 
#define INT_LO   0
 
#define EXT_LO   1
 
#define ON   0
 
#define OFF   1
 

Enumerations

enum  ad9361_ensm_mode {
  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
}
 

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)
 
int32_t ad9361_tx_mute (struct ad9361_rf_phy *phy, uint32_t state)
 
int32_t ad9361_ensm_mode_disable_pinctrl (struct ad9361_rf_phy *phy)
 
int32_t ad9361_ensm_mode_restore_pinctrl (struct ad9361_rf_phy *phy)
 
int32_t ad9361_write_clock_data_delays (struct ad9361_rf_phy *phy)
 
int32_t ad9361_read_clock_data_delays (struct ad9361_rf_phy *phy)
 
int32_t ad9361_set_cal_sw (struct ad9361_rf_phy *phy, uint32_t val)
 
int32_t ad9361_write_bist_reg (struct ad9361_rf_phy *phy, uint32_t val)
 
int32_t ad9361_get_dig_tune_data (struct ad9361_rf_phy *phy, struct ad9361_dig_tune_data *data)
 
int32_t ad9361_rssi_program_lna_gain (struct ad9361_rf_phy *phy)
 
int32_t ad9361_rssi_write_err_tbl (struct ad9361_rf_phy *phy)
 

Detailed Description

Header file 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

◆ A_BALANCED

#define A_BALANCED   0

◆ A_N

#define A_N   3

◆ A_P

#define A_P   4

◆ B_BALANCED

#define B_BALANCED   1

◆ B_N

#define B_N   5

◆ B_P

#define B_P   6

◆ C_BALANCED

#define C_BALANCED   2

◆ C_N

#define C_N   7

◆ C_P

#define C_P   8

◆ DISABLE

#define DISABLE   0

◆ ENABLE

#define ENABLE   1

◆ EXT_LO

#define EXT_LO   1

◆ HIGHEST_OSR

#define HIGHEST_OSR   0

◆ INT_LO

#define INT_LO   0

◆ MODE_1x1

#define MODE_1x1   1

◆ MODE_2x2

#define MODE_2x2   2

◆ NOMINAL_OSR

#define NOMINAL_OSR   1

◆ OFF

#define OFF   1

◆ ON

#define ON   0

◆ RX1

#define RX1   0

◆ RX2

#define RX2   1

◆ TX1

#define TX1   0

◆ TX2

#define TX2   1

◆ TX_MON1

#define TX_MON1   9

◆ TX_MON1_2

#define TX_MON1_2   11

◆ TX_MON2

#define TX_MON2   10

◆ TXA

#define TXA   0

◆ TXB

#define TXB   1

Enumeration Type Documentation

◆ ad9361_ensm_mode

Enumerator
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 

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_ensm_mode_disable_pinctrl()

int32_t ad9361_ensm_mode_disable_pinctrl ( struct ad9361_rf_phy * phy)

Temporarily disable ENSM pin control by forcing TDD SPI mode. Useful before calibration sequences that must use SPI-driven state.

Parameters
phyThe AD9361 state structure.
Returns
0 on success, negative error code otherwise.

◆ ad9361_ensm_mode_restore_pinctrl()

int32_t ad9361_ensm_mode_restore_pinctrl ( struct ad9361_rf_phy * phy)

Restore ENSM pin control to the state configured in pdata.

Parameters
phyThe AD9361 state structure.
Returns
0 on success, negative error code otherwise.

◆ ad9361_get_dig_tune_data()

int32_t ad9361_get_dig_tune_data ( struct ad9361_rf_phy * phy,
struct ad9361_dig_tune_data * data )

Return the current digital interface tuning state.

Parameters
phyThe AD9361 state structure.
dataOutput: populated with skip_mode and current delay register values.
Returns
0 on success, negative error code otherwise.

◆ 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_read_clock_data_delays()

int32_t ad9361_read_clock_data_delays ( struct ad9361_rf_phy * phy)

Read the current RX and TX clock/data delay register values back into pdata. Call this after ad9361_dig_tune() to persist the tuned values.

Parameters
phyThe AD9361 state structure.
Returns
0 on success, negative error code otherwise.

◆ 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_rssi_program_lna_gain()

int32_t ad9361_rssi_program_lna_gain ( struct ad9361_rf_phy * phy)

Program the LNA gain step values from pdata->rssi_gain_step_calib_reg_val into the AD9361 gain-step calibration table.

Parameters
phyThe AD9361 state structure.
Returns
0 on success, negative error code otherwise.

◆ ad9361_rssi_write_err_tbl()

int32_t ad9361_rssi_write_err_tbl ( struct ad9361_rf_phy * phy)

Write the pre-loaded LNA and mixer error tables from pdata into hardware.

Parameters
phyThe AD9361 state structure.
Returns
0 on 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_cal_sw()

int32_t ad9361_set_cal_sw ( struct ad9361_rf_phy * phy,
uint32_t val )

Drive the external calibration switch GPIOs (cal-sw1, cal-sw2). Bit 0 of val controls cal-sw1, bit 1 controls cal-sw2. These GPIOs route signals for TX quad / LO calibration on boards that have external calibration switch hardware.

Parameters
phyThe AD9361 state structure.
val2-bit value: bit0 = cal_sw1, bit1 = cal_sw2.
Returns
0 on success, -ENODEV if GPIOs are not configured.

◆ 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.

◆ ad9361_tx_mute()

int32_t ad9361_tx_mute ( struct ad9361_rf_phy * phy,
uint32_t state )

Mute TX.

Parameters
phyThe AD9361 state structure.
stateThe state - 0 mute; 1 - unmute.
Returns
0 in case of success

◆ ad9361_write_bist_reg()

int32_t ad9361_write_bist_reg ( struct ad9361_rf_phy * phy,
uint32_t val )

Write directly to the AD9361 BIST configuration register.

Parameters
phyThe AD9361 state structure.
valValue to write.
Returns
0 on success, negative error code otherwise.

◆ ad9361_write_clock_data_delays()

int32_t ad9361_write_clock_data_delays ( struct ad9361_rf_phy * phy)

Write the saved RX and TX clock/data delay values from pdata to hardware. Call this at startup to restore previously tuned values and skip dig_tune.

Parameters
phyThe AD9361 state structure.
Returns
0 on success, negative error code otherwise.