no-OS
Classes | Macros | Enumerations | Functions
ad9208_jesd_api.c File Reference

Contains AD9208 APIs for ADC JESD Configuration and Control. More...

#include "ad9208_api.h"
#include "ad9208_reg.h"
#include "api_errors.h"
Include dependency graph for ad9208_jesd_api.c:

Classes

struct  jesd_serdes_pll_cfg
 

Macros

#define K_MIN   4
 
#define K_MAX   32
 
#define LANE_MIN   1
 
#define LANE_MAX   8
 
#define CS_MAX   3
 
#define N_MIN   7
 
#define N_MAX   16
 
#define CF_DEFAULT   0
 
#define LANE_RATE_MIN_MBPS   390
 
#define LANE_RATE_MAX_MBPS   16000
 

Enumerations

enum  ad9208_control_bit_sel {
  AD9208_CB_LOW = 0,
  AD9208_CB_OVR_RANGE = 1,
  AD9208_CB_SIGNAL_MON = 2,
  AD9208_CB_FAST_DETECT = 3,
  AD9208_CB_SYSREF = 5
}
 

Functions

int ad9208_jesd_enable_link (ad9208_handle_t *h, uint8_t en)
 Enable JESD Link. More...
 
int ad9208_jesd_set_if_config (ad9208_handle_t *h, jesd_param_t jesd_param, uint64_t *lane_rate_kbps)
 Configure the JESD Interface for AD9208. More...
 
int ad9208_jesd_get_cfg_param (ad9208_handle_t *h, jesd_param_t *jesd_param)
 Read back all current JESD parameter settings. More...
 
int ad9208_jesd_enable_scrambler (ad9208_handle_t *h, uint8_t en)
 Enable the scrambler for the JESD Link. More...
 
int ad9208_jesd_set_lane_xbar (ad9208_handle_t *h, uint8_t logical_lane, uint8_t physical_lane)
 Configure the Lane Cross Bar in the JESD datalink layer. More...
 
int ad9208_jesd_get_lane_xbar (ad9208_handle_t *h, uint8_t *phy_log_map)
 Get current Lane Cross Bar configuration for the JESD datalink layer. More...
 
int ad9208_jesd_get_pll_status (ad9208_handle_t *h, uint8_t *pll_status)
 Get SERDES PLL Status Flags. More...
 
int ad9208_jesd_subclass_set (ad9208_handle_t *h, uint8_t subclass)
 Set JESD SYNCHRONIZATION Mode. More...
 
int ad9208_jesd_syref_mode_set (ad9208_handle_t *h, jesd_sysref_mode_t mode, uint8_t sysref_count)
 Set JESD SYNCHRONIZATION Mode. More...
 
int ad9208_jesd_syref_config_set (ad9208_handle_t *h, uint8_t sysref_edge_sel, uint8_t clk_edge_sel, uint8_t neg_window_skew, uint8_t pos_window_skew)
 Set SYSREF Signal Capture settings. More...
 
int ad9208_jesd_syref_status_get (ad9208_handle_t *h, uint8_t *hold_status, uint8_t *setup_status, uint8_t *phase_status)
 Get SYSREF status for sysref monitoring. More...
 
int ad9208_jesd_sysref_timestamp_set (ad9208_handle_t *h, uint8_t timestamp_en, uint8_t control_bit, uint8_t delay)
 Set JESD SYNCHRONIZATION Time Stamp Mode. More...
 
int ad9208_jesd_syref_lmfc_offset_set (ad9208_handle_t *h, uint8_t offset)
 Set JESD LMFC Offset. More...
 

Detailed Description

Contains AD9208 APIs for ADC JESD Configuration and Control.

Release 1.0.x

Copyright(c) 2017 Analog Devices, Inc. All Rights Reserved. This software is proprietary to Analog Devices, Inc. and its licensors. By using this software you agree to the terms of the associated Analog Devices Software License Agreement.

Macro Definition Documentation

◆ CF_DEFAULT

#define CF_DEFAULT   0

◆ CS_MAX

#define CS_MAX   3

◆ K_MAX

#define K_MAX   32

◆ K_MIN

#define K_MIN   4

◆ LANE_MAX

#define LANE_MAX   8

◆ LANE_MIN

#define LANE_MIN   1

◆ LANE_RATE_MAX_MBPS

#define LANE_RATE_MAX_MBPS   16000

◆ LANE_RATE_MIN_MBPS

#define LANE_RATE_MIN_MBPS   390

◆ N_MAX

#define N_MAX   16

◆ N_MIN

#define N_MIN   7

Enumeration Type Documentation

◆ ad9208_control_bit_sel

Enumerator
AD9208_CB_LOW 
AD9208_CB_OVR_RANGE 
AD9208_CB_SIGNAL_MON 
AD9208_CB_FAST_DETECT 
AD9208_CB_SYSREF 

Function Documentation

◆ ad9208_jesd_enable_link()

int ad9208_jesd_enable_link ( ad9208_handle_t h,
uint8_t  en 
)

Enable JESD Link.

Enable SERDES Link to start JESD tranmission

Parameters
hPointer to the AD9208 device reference handle.
enEnable control for the JESD Link
Return values
API_ERROR_OKAPI Completed Successfully
API_ERROR_INVALID_HANDLE_PTRInvalid reference handle.
API_ERROR_INVALID_XFER_PTRSPI Access Failed
API_ERROR_SPI_XFERSPI XFER Function Failed
API_ERROR_INVALID_PARAMInvalid Parameter

◆ ad9208_jesd_enable_scrambler()

int ad9208_jesd_enable_scrambler ( ad9208_handle_t h,
uint8_t  en 
)

Enable the scrambler for the JESD Link.

Enable or Disable the scrambler for the JESD Link

Parameters
hPointer to the AD9208 device reference handle.
enEnable control for JESD Scrambler.
Return values
API_ERROR_OKAPI Completed Successfully
API_ERROR_INVALID_HANDLE_PTRInvalid reference handle.
API_ERROR_INVALID_XFER_PTRSPI Access Failed
API_ERROR_SPI_XFERSPI XFER Function Failed
API_ERROR_INVALID_PARAMInvalid Parameter

◆ ad9208_jesd_get_cfg_param()

int ad9208_jesd_get_cfg_param ( ad9208_handle_t h,
jesd_param_t jesd_param 
)

Read back all current JESD parameter settings.

Read-back all the currently configured JESD Interface parameters.

Parameters
hPointer to the AD9208 device reference handle.
jesd_paramPointer to a variable that will be set will the current values of the JESD interface parameters.
Return values
API_ERROR_OKAPI Completed Successfully
API_ERROR_INVALID_HANDLE_PTRInvalid reference handle.
API_ERROR_INVALID_XFER_PTRSPI Access Failed
API_ERROR_SPI_XFERSPI XFER Function Failed
API_ERROR_INVALID_PARAMInvalid Parameter

◆ ad9208_jesd_get_lane_xbar()

int ad9208_jesd_get_lane_xbar ( ad9208_handle_t h,
uint8_t *  phy_log_map 
)

Get current Lane Cross Bar configuration for the JESD datalink layer.

Return the physical to logical lane mapping set by the configured by the current Lane Cross Bar configuration.

Parameters
hPointer to the AD9208 device reference handle.
phy_log_mapPointer a 8 deep uint8_t array.Each element of the array represents the physical lane 0 - 7 and the value represents the logical lane assigned to that physical lane.
Return values
API_ERROR_OKAPI Completed Successfully
API_ERROR_INVALID_HANDLE_PTRInvalid reference handle.
API_ERROR_INVALID_XFER_PTRSPI Access Failed
API_ERROR_INVALID_PARAMInvalid Parameter

◆ ad9208_jesd_get_pll_status()

int ad9208_jesd_get_pll_status ( ad9208_handle_t h,
uint8_t *  pll_status 
)

Get SERDES PLL Status Flags.

Read Serdes PLL status and return the status via the pll_status parameter.

Parameters
hPointer to the AD9208 device reference handle.
*pll_statusPointer to the variable that will be set with the PLL status. Lock Status bits are enumerated by ad9208_jesd_serdes_pll_flg_t; bit[7] => PLL Lock Status bit[3] => PLL Lost Lock Status
Return values
API_ERROR_OKAPI Completed Successfully
API_ERROR_INVALID_HANDLE_PTRInvalid reference handle.
API_ERROR_INVALID_XFER_PTRSPI Access Failed
API_ERROR_SPI_XFERSPI XFER Function Failed
API_ERROR_INVALID_PARAMInvalid Parameter

◆ ad9208_jesd_set_if_config()

int ad9208_jesd_set_if_config ( ad9208_handle_t h,
jesd_param_t  jesd_param,
uint64_t *  lane_rate_kbps 
)

Configure the JESD Interface for AD9208.

Configure JESD interface parameters

Parameters
hPointer to the AD9208 device reference handle.
jesd_paramThe desired JESD link parameters for which to configure the JESD Interface to AD9208. jesd_param_t structure defines the parameter their ranges supported by the AD9208.
*lane_rate_kbpsPointer to uint64_t to return the determined Lane Rate. Set to NULL if not required.
Return values
API_ERROR_OKAPI Completed Successfully
API_ERROR_INVALID_HANDLE_PTRInvalid reference handle.
API_ERROR_INVALID_XFER_PTRSPI Access Failed
API_ERROR_SPI_XFERSPI XFER Function Failed
API_ERROR_INVALID_PARAMInvalid Parameter

◆ ad9208_jesd_set_lane_xbar()

int ad9208_jesd_set_lane_xbar ( ad9208_handle_t h,
uint8_t  logical_lane,
uint8_t  physical_lane 
)

Configure the Lane Cross Bar in the JESD datalink layer.

Configure AD9208 Lane Cross Bar to route the physical JESD lanes to the desired logical lanes.

Parameters
hPointer to the AD9208 device reference handle.
physical_laneuint8_t value indicating the Physical Lanes to be routed to the serdes logical indicated by the logical_lane parameter. Valid Range 0 -7
logical_laneuint8_t value indicating the corresponding logical lane for the physical lane listed in parameter physical_lane. Valid Range 0 -7
Return values
API_ERROR_OKAPI Completed Successfully
API_ERROR_INVALID_HANDLE_PTRInvalid reference handle.
API_ERROR_INVALID_XFER_PTRSPI Access Failed
API_ERROR_SPI_XFERSPI XFER Function Failed
API_ERROR_INVALID_PARAMInvalid Parameter

◆ ad9208_jesd_subclass_set()

int ad9208_jesd_subclass_set ( ad9208_handle_t h,
uint8_t  subclass 
)

Set JESD SYNCHRONIZATION Mode.

Parameters
hPointer to the AD9208 device reference handle.
subclassDesired Jesd Subclass Mode. Valid Range 0 to 1 0 - Sub Class 0 1 - Sub Class 1
Return values
API_ERROR_OKAPI Completed Successfully
API_ERROR_INVALID_HANDLE_PTRInvalid reference handle.
API_ERROR_INVALID_XFER_PTRSPI Access Failed
API_ERROR_SPI_XFERSPI XFER Function Failed
API_ERROR_INVALID_PARAMInvalid Parameter

◆ ad9208_jesd_syref_config_set()

int ad9208_jesd_syref_config_set ( ad9208_handle_t h,
uint8_t  sysref_edge_sel,
uint8_t  clk_edge_sel,
uint8_t  neg_window_skew,
uint8_t  pos_window_skew 
)

Set SYSREF Signal Capture settings.

Parameters
hPointer to the AD9208 device reference handle.
sysref_edge_selSet the transition on which SYSREF is valid. Valid values are: 0 LOW to HIGH transition 1 HIGH to LOW transition
clk_edge_selSet the Sysref Capture clock Edge. Valid values are: 0 Rising clock Edge 1 Falling Clock Edge
neg_window_skewSkew sample clock by which captured sysref is ignored. Skew set in clock cycles. Valid range 0-3
pos_window_skewSkew sample clock by which captured sysref is ignored. Skew set in clock cycles. Valid range 0-3
Return values
API_ERROR_OKAPI Completed Successfully
API_ERROR_INVALID_HANDLE_PTRInvalid reference handle.
API_ERROR_INVALID_XFER_PTRSPI Access Failed
API_ERROR_SPI_XFERSPI XFER Function Failed
API_ERROR_INVALID_PARAMInvalid Parameter

◆ ad9208_jesd_syref_lmfc_offset_set()

int ad9208_jesd_syref_lmfc_offset_set ( ad9208_handle_t h,
uint8_t  offset 
)

Set JESD LMFC Offset.

Parameters
hPointer to the AD9208 device reference handle.
offsetAdjust the LMFC phase offset in frame clock cycles. For F = 1, only 4-frame shifts are valid For F = 2, Only 2-frame shifts are valid In all other cases for F, 1 frame shift are valid Refer to the AD9208 Datasheet for more details.
Return values
API_ERROR_OKAPI Completed Successfully
API_ERROR_INVALID_HANDLE_PTRInvalid reference handle.
API_ERROR_INVALID_XFER_PTRSPI Access Failed
API_ERROR_SPI_XFERSPI XFER Function Failed
API_ERROR_INVALID_PARAMInvalid Parameter

◆ ad9208_jesd_syref_mode_set()

int ad9208_jesd_syref_mode_set ( ad9208_handle_t h,
jesd_sysref_mode_t  mode,
uint8_t  sysref_count 
)

Set JESD SYNCHRONIZATION Mode.

Parameters
hPointer to the AD9208 device reference handle.
modeSysref Synchronization Mode. SYREF_NONE - NO SYSREF, Subclass 1 only SYSREF_ONESHOT - single sysref signal mode SYSREF_CONT - Continuous sysref signal mode
sysref_countNumber of initial sysref sgnals to ignore in sysref n-shot mode 0-15 Valid only for N-Shot Mode.
Return values
API_ERROR_OKAPI Completed Successfully
API_ERROR_INVALID_HANDLE_PTRInvalid reference handle.
API_ERROR_INVALID_XFER_PTRSPI Access Failed
API_ERROR_SPI_XFERSPI XFER Function Failed
API_ERROR_INVALID_PARAMInvalid Parameter

◆ ad9208_jesd_syref_status_get()

int ad9208_jesd_syref_status_get ( ad9208_handle_t h,
uint8_t *  hold_status,
uint8_t *  setup_status,
uint8_t *  phase_status 
)

Get SYSREF status for sysref monitoring.

Parameters
hPointer to the AD9208 device reference handle.
*hold_statusPointer to a uint8_t variable to which the Sysref +/- Hold Status will be set
*setup_statusPointer to a uint8_t varaiable to whch the Sysref +/- Setup Status will be set
*phase_statusPoint to a uint8_t variable to which the Sysref Divider Phase during Sysref Capture will be set.
Return values
API_ERROR_OKAPI Completed Successfully
API_ERROR_INVALID_HANDLE_PTRInvalid reference handle.
API_ERROR_INVALID_XFER_PTRSPI Access Failed
API_ERROR_SPI_XFERSPI XFER Function Failed
API_ERROR_INVALID_PARAMInvalid Parameter

◆ ad9208_jesd_sysref_timestamp_set()

int ad9208_jesd_sysref_timestamp_set ( ad9208_handle_t h,
uint8_t  timestamp_en,
uint8_t  control_bit,
uint8_t  delay 
)

Set JESD SYNCHRONIZATION Time Stamp Mode.

Parameters
hPointer to the AD9208 device reference handle.
timestamp_enEnable Timestamp Mode, Sysref signal will trigger a timestamp sample. 0 - Timestamp Mode Enable, Sysref will trigger a timestamp smaple. 1 - Timestamp Mode Disable, Sysref will reset internal Synchronization.
control_bitDesired control bit for Sysref time_stamp control.
delayDelay of sysref timestamp in smaple clock cycles
Return values
API_ERROR_OKAPI Completed Successfully
API_ERROR_INVALID_HANDLE_PTRInvalid reference handle.
API_ERROR_INVALID_XFER_PTRSPI Access Failed
API_ERROR_SPI_XFERSPI XFER Function Failed
API_ERROR_INVALID_PARAMInvalid Parameter