![]() |
no-OS
|
Header file of the AD9088/AD9084 (Apollo) MxFE driver. More...
#include "no_os_error.h"#include "no_os_gpio.h"#include "no_os_print_log.h"#include "no_os_spi.h"#include "jesd204.h"#include "adi_apollo_bf_serdes_txdig_phy_core1p2.h"#include "adi_apollo_bf_serdes_rxdig_phy_core1p3.h"#include "adi_apollo.h"#include "adi_apollo_bf_custom.h"#include "adi_apollo_adc.h"#include "adi_apollo_cfg.h"#include "adi_apollo_sysclk_cond.h"#include "adi_apollo_hal.h"#include "adi_apollo_mailbox.h"#include "adi_apollo_loopback.h"#include "adi_apollo_utils.h"#include "adi_apollo_bf_mcs_sync.h"#include "adi_apollo_bf_txrx_prefsrc_reconf.h"#include "adi_apollo_bf_master_bias_ctrl.h"#include "adi_apollo_sniffer.h"#include "adi_apollo_cnco.h"#include "adi_apollo_fnco.h"#include "adi_apollo_cddc.h"#include "adi_apollo_cduc.h"#include "adi_utils.h"Classes | |
| struct | ad9088_jesd204_priv |
| struct | ad9088_bsync_ops |
| Accessors for the board's BSYNC (SYSREF) provider, used by MCS calibration. More... | |
| struct | ad9088_clk_ops |
| Accessors for the board's device-clock PLL, used by MCS tracking calibration to correct clock drift. More... | |
| struct | ad9088_init_param |
| struct | ad9088_phy |
Macros | |
| #define | DEFRAMER_LINK_A0_TX 0 |
| #define | DEFRAMER_LINK_A1_TX 1 |
| #define | DEFRAMER_LINK_B0_TX 2 |
| #define | DEFRAMER_LINK_B1_TX 3 |
| #define | FRAMER_LINK_A0_RX 4 |
| #define | FRAMER_LINK_A1_RX 5 |
| #define | FRAMER_LINK_B0_RX 6 |
| #define | FRAMER_LINK_B1_RX 7 |
| #define | MAX_NUM_MAIN_DATAPATHS ADI_APOLLO_CNCO_NUM |
| #define | MAX_NUM_CHANNELIZER ADI_APOLLO_FNCO_NUM |
| #define | NUM_RXTX 2 |
| #define | AD9088_MCS_TRACK_DECIMATION_DEFAULT 1023 |
| #define | AD9088_MCS_CLK_PHASE_FS 125 |
| #define | AD9088_FW_SYM(sym) |
| #define | AD9088_FW_DECL(sym) |
| #define | AD9088_FW_ENTRY(sym) |
Enumerations | |
| enum | { ADI_APOLLO_LOOPBACK_NONE , ADI_APOLLO_LOOPBACK_0 , ADI_APOLLO_LOOPBACK_1 , ADI_APOLLO_LOOPBACK_2 , ADI_APOLLO_LOOPBACK_3 } |
Functions | |
| AD9088_FW_DECL (usecase_bin) | |
| AD9088_FW_DECL (app_signed_encrypted_B_flash_image_0x01030000_bin) | |
| AD9088_FW_DECL (app_signed_encrypted_B_flash_image_0x20000000_bin) | |
| AD9088_FW_DECL (app_signed_encrypted_B_flash_image_0x02000000_bin) | |
| AD9088_FW_DECL (app_signed_encrypted_B_flash_image_0x21000000_bin) | |
| AD9088_FW_DECL (app_signed_encrypted_prod_B_flash_image_0x01030000_bin) | |
| AD9088_FW_DECL (app_signed_encrypted_prod_B_flash_image_0x20000000_bin) | |
| AD9088_FW_DECL (app_signed_encrypted_prod_B_flash_image_0x02000000_bin) | |
| AD9088_FW_DECL (app_signed_encrypted_prod_B_flash_image_0x21000000_bin) | |
| int | ad9088_check_apollo_error (int ret, const char *api_name) |
| Translate a vendor API return code into an errno value. | |
| uint8_t | ad9088_to_link (uint8_t linkid) |
| Map a state-machine link identifier onto a device link identifier. | |
| int | ad9088_inspect_jrx_link_all (struct ad9088_phy *phy) |
| Print the negotiated link parameters of every deframer link. | |
| int | ad9088_inspect_jtx_link_all (struct ad9088_phy *phy) |
| Print the negotiated link parameters of every framer link. | |
| void | ad9088_print_link_phase (struct ad9088_phy *phy, struct jesd204_link *lnk) |
| Print the deframer phase difference for one link. | |
| void | ad9088_print_sysref_phase (struct ad9088_phy *phy) |
| Print the captured SYSREF phase several times over. | |
| int | ad9088_jesd_tx_link_status_print (struct ad9088_phy *phy, struct jesd204_link *lnk, int retry) |
| Poll a framer link until it reports good, then print its status. | |
| int | ad9088_jesd_rx_link_status_print (struct ad9088_phy *phy, struct jesd204_link *lnk, int retry) |
| Poll a deframer link until it reports good, then print its status. | |
| int | ad9088_mcs_init_cal_setup (struct ad9088_phy *phy) |
| Zero the desired internal-to-external SYSREF offsets before init cal. | |
| int | ad9088_delta_t_measurement_set (struct ad9088_phy *phy, uint32_t mode) |
| Start a BSYNC delta-t measurement. | |
| int | ad9088_delta_t_measurement_get (struct ad9088_phy *phy, uint32_t mode, int64_t *apollo_delta_t) |
| Read back the result of a BSYNC delta-t measurement. | |
| int | ad9088_mcs_init_cal_validate (struct ad9088_phy *phy, adi_apollo_mcs_cal_init_status_t *cal_status) |
| Check that MCS init cal aligned the internal SYSREF and locked. | |
| void | ad9088_mcs_init_cal_status_print (struct ad9088_phy *phy, adi_apollo_mcs_cal_init_status_t *cal_status) |
| Print the MCS init cal status and measurements. | |
| int | ad9088_mcs_tracking_cal_setup (struct ad9088_phy *phy, uint32_t mcs_track_decimation, uint16_t initialize_track_cal) |
| Arm MCS tracking calibration. | |
| int | adi_ad9088_calc_nco_ftw (struct ad9088_phy *phy, uint64_t freq, int64_t nco_shift, uint32_t div, uint32_t bits, uint64_t *ftw, uint64_t *frac_a, uint64_t *frac_b) |
| Convert an NCO frequency shift into a frequency tuning word. | |
| int | adi_ad9088_calc_nco_freq (struct ad9088_phy *phy, uint64_t freq, uint64_t ftw, uint32_t a, uint32_t b, uint32_t bits, int64_t *nco_shift) |
| Convert a frequency tuning word back into a frequency shift. | |
| int | ad9088_set_cnco_freq (struct ad9088_phy *phy, adi_apollo_terminal_e terminal, uint8_t side, uint8_t cddc_num, int64_t freq_hz) |
| Set the coarse NCO frequency shift. | |
| int | ad9088_get_cnco_freq (struct ad9088_phy *phy, adi_apollo_terminal_e terminal, uint8_t side, uint8_t cddc_num, int64_t *freq_hz) |
| Read back the coarse NCO frequency shift. | |
| int | ad9088_set_fnco_freq (struct ad9088_phy *phy, adi_apollo_terminal_e terminal, uint8_t side, uint8_t fddc_num, int64_t freq_hz) |
| Set the fine NCO frequency shift. | |
| int | ad9088_get_fnco_freq (struct ad9088_phy *phy, adi_apollo_terminal_e terminal, uint8_t side, uint8_t fddc_num, int64_t *freq_hz) |
| Read back the fine NCO frequency shift. | |
| int | ad9088_set_cnco_test_tone (struct ad9088_phy *phy, adi_apollo_terminal_e terminal, uint8_t side, uint8_t cddc_num, bool enable, uint16_t offset) |
| Enable or disable the coarse NCO DC test tone. | |
| int | ad9088_set_fnco_test_tone (struct ad9088_phy *phy, adi_apollo_terminal_e terminal, uint8_t side, uint8_t fddc_num, bool enable, uint16_t offset) |
| Enable or disable the fine NCO DC test tone. | |
| int | ad9088_set_loopback_mode (struct ad9088_phy *phy, uint8_t side, uint8_t mode) |
| Select the datapath loopback mode for one side. | |
| int | ad9088_parse_struct (struct ad9088_phy **device, const struct ad9088_init_param *init_param) |
| Allocate the device structure and apply the initialisation parameters. | |
| int | ad9088_init (struct ad9088_phy **device, const struct ad9088_init_param *init_param) |
| Initialize the device. | |
| int | ad9088_remove (struct ad9088_phy *phy) |
| Free the resources allocated by ad9088_init(). | |
Variables | |
| const struct jesd204_dev_data | jesd204_ad9088_init |
| const char *const | ad9088_fsm_links_to_str [] |
Header file of the AD9088/AD9084 (Apollo) MxFE driver.
Copyright 2022-2026(c) Analog Devices, Inc.
SPDX-License-Identifier: BSD-3-Clause
| #define AD9088_FW_DECL | ( | sym | ) |
| #define AD9088_FW_ENTRY | ( | sym | ) |
| #define AD9088_FW_SYM | ( | sym | ) |
| #define AD9088_MCS_CLK_PHASE_FS 125 |
| #define AD9088_MCS_TRACK_DECIMATION_DEFAULT 1023 |
| #define DEFRAMER_LINK_A0_TX 0 |
| #define DEFRAMER_LINK_A1_TX 1 |
| #define DEFRAMER_LINK_B0_TX 2 |
| #define DEFRAMER_LINK_B1_TX 3 |
| #define FRAMER_LINK_A0_RX 4 |
| #define FRAMER_LINK_A1_RX 5 |
| #define FRAMER_LINK_B0_RX 6 |
| #define FRAMER_LINK_B1_RX 7 |
| #define MAX_NUM_CHANNELIZER ADI_APOLLO_FNCO_NUM |
| #define MAX_NUM_MAIN_DATAPATHS ADI_APOLLO_CNCO_NUM |
| #define NUM_RXTX 2 |
| anonymous enum |
| int ad9088_check_apollo_error | ( | int | ret, |
| const char * | api_name ) |
Translate a vendor API return code into an errno value.
The vendor API has its own error space and does not log, so every call site funnels through here to get the failure reported once, with the name of the call that produced it.
| ret | - Value returned by the vendor API call. |
| api_name | - Name of that call, used in the error message. |
| int ad9088_delta_t_measurement_get | ( | struct ad9088_phy * | phy, |
| uint32_t | mode, | ||
| int64_t * | apollo_delta_t ) |
Read back the result of a BSYNC delta-t measurement.
| phy | - The device structure. |
| mode | - 0 for the post-alignment difference, 1 for the delay that needs compensating. |
| apollo_delta_t | - Read value, in femtoseconds. |
| int ad9088_delta_t_measurement_set | ( | struct ad9088_phy * | phy, |
| uint32_t | mode ) |
Start a BSYNC delta-t measurement.
Mode 0 aligns against the incoming BSYNC. Mode 1 makes the device drive BSYNC back out so the provider can measure the return path; mode 2 stops it driving. Running 0 then 1 yields the two halves of the round-trip delay.
| phy | - The device structure. |
| mode | - 0 align, 1 output enable and loopback measure, 2 output disable. |
| AD9088_FW_DECL | ( | app_signed_encrypted_B_flash_image_0x01030000_bin | ) |
| AD9088_FW_DECL | ( | app_signed_encrypted_B_flash_image_0x02000000_bin | ) |
| AD9088_FW_DECL | ( | app_signed_encrypted_B_flash_image_0x20000000_bin | ) |
| AD9088_FW_DECL | ( | app_signed_encrypted_B_flash_image_0x21000000_bin | ) |
| AD9088_FW_DECL | ( | app_signed_encrypted_prod_B_flash_image_0x01030000_bin | ) |
| AD9088_FW_DECL | ( | app_signed_encrypted_prod_B_flash_image_0x02000000_bin | ) |
| AD9088_FW_DECL | ( | app_signed_encrypted_prod_B_flash_image_0x20000000_bin | ) |
| AD9088_FW_DECL | ( | app_signed_encrypted_prod_B_flash_image_0x21000000_bin | ) |
| AD9088_FW_DECL | ( | usecase_bin | ) |
| int ad9088_get_cnco_freq | ( | struct ad9088_phy * | phy, |
| adi_apollo_terminal_e | terminal, | ||
| uint8_t | side, | ||
| uint8_t | cddc_num, | ||
| int64_t * | freq_hz ) |
Read back the coarse NCO frequency shift.
| phy | - The device structure. |
| terminal | - Selects the transmit or receive datapath. |
| side | - Datapath side index. |
| cddc_num | - Coarse datapath index within the side. |
| freq_hz | - Signed frequency shift, in Hz. |
| int ad9088_get_fnco_freq | ( | struct ad9088_phy * | phy, |
| adi_apollo_terminal_e | terminal, | ||
| uint8_t | side, | ||
| uint8_t | fddc_num, | ||
| int64_t * | freq_hz ) |
Read back the fine NCO frequency shift.
| phy | - The device structure. |
| terminal | - Selects the transmit or receive datapath. |
| side | - Datapath side index. |
| fddc_num | - Fine datapath index within the side. |
| freq_hz | - Signed frequency shift, in Hz. |
| int ad9088_init | ( | struct ad9088_phy ** | device, |
| const struct ad9088_init_param * | init_param ) |
Initialize the device.
Allocates the device structure, wires up the vendor API to the SPI and GPIO descriptors, verifies the buses, loads the firmware and device profile, and registers the device with the JESD204 state machine. The links themselves are brought up by that state machine, not here.
| device | - The device structure. |
| init_param | - The structure that contains the device initialisation parameters. |
| int ad9088_inspect_jrx_link_all | ( | struct ad9088_phy * | phy | ) |
Print the negotiated link parameters of every deframer link.
Reports what the device ended up with rather than what was requested, so it can be compared against the peer side.
| phy | - The device structure. |
| int ad9088_inspect_jtx_link_all | ( | struct ad9088_phy * | phy | ) |
Print the negotiated link parameters of every framer link.
Reports what the device ended up with rather than what was requested, so it can be compared against the peer side.
| phy | - The device structure. |
| int ad9088_jesd_rx_link_status_print | ( | struct ad9088_phy * | phy, |
| struct jesd204_link * | lnk, | ||
| int | retry ) |
Poll a deframer link until it reports good, then print its status.
Which status bits have to be set depends on the JESD204 version and, for subclass 1, additionally on the SYSREF phase having locked. Per-lane state is printed alongside the link state so a single bad lane is visible.
| phy | - The device structure. |
| lnk | - The JESD204 link. |
| retry | - Number of extra attempts before giving up. |
| int ad9088_jesd_tx_link_status_print | ( | struct ad9088_phy * | phy, |
| struct jesd204_link * | lnk, | ||
| int | retry ) |
Poll a framer link until it reports good, then print its status.
Which status bits have to be set depends on the JESD204 version in use. The status is only printed once settled, or on the final attempt, so a link that comes up normally logs a single line.
| phy | - The device structure. |
| lnk | - The JESD204 link. |
| retry | - Number of extra attempts before giving up. |
| int ad9088_mcs_init_cal_setup | ( | struct ad9088_phy * | phy | ) |
Zero the desired internal-to-external SYSREF offsets before init cal.
The offsets are what the calibration aims for; zero asks for the internal SYSREF to land on the external edge. Which offsets exist depends on whether the device runs one clock or two.
| phy | - The device structure. |
| void ad9088_mcs_init_cal_status_print | ( | struct ad9088_phy * | phy, |
| adi_apollo_mcs_cal_init_status_t * | cal_status ) |
Print the MCS init cal status and measurements.
| phy | - The device structure. |
| cal_status | - Init cal status read back from the device. |
| int ad9088_mcs_init_cal_validate | ( | struct ad9088_phy * | phy, |
| adi_apollo_mcs_cal_init_status_t * | cal_status ) |
Check that MCS init cal aligned the internal SYSREF and locked.
The external and internal SYSREF must end up within +/- 0.4 device clock cycles of the offset the calibration recommended, and the relevant SYSREF must report locked. In dual clock mode both sides are checked and at least one must lock; in single clock mode only the center matters.
| phy | - The device structure. |
| cal_status | - Init cal status read back from the device. |
| int ad9088_mcs_tracking_cal_setup | ( | struct ad9088_phy * | phy, |
| uint32_t | mcs_track_decimation, | ||
| uint16_t | initialize_track_cal ) |
Arm MCS tracking calibration.
Tracking cal keeps the internal SYSREF on the external edge as the device clock drifts, by trimming the clock PLL. Only supported in single clock mode.
| phy | - The device structure. |
| mcs_track_decimation | - TDC decimation; higher is more precise. |
| initialize_track_cal | - Initialize the tracking cal, needed unless the device profile already did it. |
| int ad9088_parse_struct | ( | struct ad9088_phy ** | device, |
| const struct ad9088_init_param * | init_param ) |
Allocate the device structure and apply the initialisation parameters.
Acquires the SPI and GPIO descriptors, loads and version-checks the device profile, then applies the caller's overrides to it: lane mapping, JESD204 subclass, Nyquist zone and multi-chip synchronisation settings. The profile checksum is recomputed last so the on-chip firmware still accepts the modified profile.
On failure everything acquired so far is released.
| device | - The device structure to allocate. |
| init_param | - The structure that contains the device initialisation parameters. |
| void ad9088_print_link_phase | ( | struct ad9088_phy * | phy, |
| struct jesd204_link * | lnk ) |
Print the deframer phase difference for one link.
| phy | - The device structure. |
| lnk | - The JESD204 link. |
| void ad9088_print_sysref_phase | ( | struct ad9088_phy * | phy | ) |
Print the captured SYSREF phase several times over.
The value is a signed count of device clock periods between the external and internal SYSREF edges. It is sampled repeatedly because a phase that moves between reads means the capture is not deterministic, which a single read would hide.
| phy | - The device structure. |
| int ad9088_remove | ( | struct ad9088_phy * | phy | ) |
Free the resources allocated by ad9088_init().
| phy | - The device structure. |
| int ad9088_set_cnco_freq | ( | struct ad9088_phy * | phy, |
| adi_apollo_terminal_e | terminal, | ||
| uint8_t | side, | ||
| uint8_t | cddc_num, | ||
| int64_t | freq_hz ) |
Set the coarse NCO frequency shift.
| phy | - The device structure. |
| terminal | - Selects the transmit or receive datapath. |
| side | - Datapath side index. |
| cddc_num | - Coarse datapath index within the side. |
| freq_hz | - Signed frequency shift, in Hz. |
| int ad9088_set_cnco_test_tone | ( | struct ad9088_phy * | phy, |
| adi_apollo_terminal_e | terminal, | ||
| uint8_t | side, | ||
| uint8_t | cddc_num, | ||
| bool | enable, | ||
| uint16_t | offset ) |
Enable or disable the coarse NCO DC test tone.
While the tone is enabled the mixer runs in test mode and emits a DC offset instead of mixing; disabling it restores the mixer mode the device profile asks for.
| phy | - The device structure. |
| terminal | - Selects the transmit or receive datapath. |
| side | - Datapath side index. |
| cddc_num | - Coarse datapath index within the side. |
| enable | - True to emit the tone, false to restore normal mixing. |
| offset | - Tone amplitude as a raw DC offset, clamped to the maximum the datapath accepts. |
| int ad9088_set_fnco_freq | ( | struct ad9088_phy * | phy, |
| adi_apollo_terminal_e | terminal, | ||
| uint8_t | side, | ||
| uint8_t | fddc_num, | ||
| int64_t | freq_hz ) |
Set the fine NCO frequency shift.
| phy | - The device structure. |
| terminal | - Selects the transmit or receive datapath. |
| side | - Datapath side index. |
| fddc_num | - Fine datapath index within the side. |
| freq_hz | - Signed frequency shift, in Hz. |
| int ad9088_set_fnco_test_tone | ( | struct ad9088_phy * | phy, |
| adi_apollo_terminal_e | terminal, | ||
| uint8_t | side, | ||
| uint8_t | fddc_num, | ||
| bool | enable, | ||
| uint16_t | offset ) |
Enable or disable the fine NCO DC test tone.
While the tone is enabled the mixer runs in test mode and emits a DC offset instead of mixing; disabling it restores the mixer mode the device profile asks for.
| phy | - The device structure. |
| terminal | - Selects the transmit or receive datapath. |
| side | - Datapath side index. |
| fddc_num | - Fine datapath index within the side. |
| enable | - True to emit the tone, false to restore normal mixing. |
| offset | - Tone amplitude as a raw DC offset, clamped to the maximum the datapath accepts. |
| int ad9088_set_loopback_mode | ( | struct ad9088_phy * | phy, |
| uint8_t | side, | ||
| uint8_t | mode ) |
Select the datapath loopback mode for one side.
Any active loopback is torn down first, so switching modes needs a single call. A loopback only makes sense when the two directions run at the same sample rate, which is checked here.
| phy | - The device structure. |
| side | - Datapath side index. |
| mode | - One of the ADI_APOLLO_LOOPBACK_* modes. |
| uint8_t ad9088_to_link | ( | uint8_t | linkid | ) |
Map a state-machine link identifier onto a device link identifier.
The state machine numbers the transmit and receive links in one sequence, while the device numbers each direction from zero, so the two halves of the range fold onto the same device identifiers.
| linkid | - State-machine link identifier. |
| int adi_ad9088_calc_nco_freq | ( | struct ad9088_phy * | phy, |
| uint64_t | freq, | ||
| uint64_t | ftw, | ||
| uint32_t | a, | ||
| uint32_t | b, | ||
| uint32_t | bits, | ||
| int64_t * | nco_shift ) |
Convert a frequency tuning word back into a frequency shift.
The inverse of adi_ad9088_calc_nco_ftw(). Tuning words in the upper half of the accumulator range encode a negative shift.
| phy | - The device structure. |
| freq | - NCO clock rate, in Hz. |
| ftw | - Integer frequency tuning word. |
| a | - Numerator of the fractional part. |
| b | - Denominator of the fractional part. |
| bits | - Accumulator width of the source NCO, in bits. |
| nco_shift | - Decoded signed frequency shift, in Hz. |
| int adi_ad9088_calc_nco_ftw | ( | struct ad9088_phy * | phy, |
| uint64_t | freq, | ||
| int64_t | nco_shift, | ||
| uint32_t | div, | ||
| uint32_t | bits, | ||
| uint64_t * | ftw, | ||
| uint64_t * | frac_a, | ||
| uint64_t * | frac_b ) |
Convert an NCO frequency shift into a frequency tuning word.
The tuning word is the shift expressed as a fraction of the NCO clock, scaled to the accumulator width. Whatever the integer word cannot express is returned as the fraction frac_a / frac_b, which the dual-modulus modes use to reach an exact shift.
| phy | - The device structure. |
| freq | - Converter sample rate, in Hz. |
| nco_shift | - Signed frequency shift to encode, in Hz. |
| div | - Decimation or interpolation ratio between the converter and the NCO, so that freq / div is the NCO clock. |
| bits | - Accumulator width of the target NCO, in bits. |
| ftw | - Integer frequency tuning word. |
| frac_a | - Numerator of the leftover fraction. |
| frac_b | - Denominator of the leftover fraction. |
|
extern |
|
extern |