no-OS
Functions
mykonos_dbgjesd.c File Reference

Contains Mykonos APIs for Jesd debug facilities. More...

#include <stdint.h>
#include <stddef.h>
#include "mykonos_dbgjesd.h"
#include "mykonos_macros.h"
Include dependency graph for mykonos_dbgjesd.c:

Functions

const char * getDbgJesdMykonosErrorMessage (mykonosDbgErr_t errorCode)
 Helper function for return of character string based on 32-bit mykonosDbgErr_t enum value. More...
 
mykonosDbgErr_t MYKONOS_jesdIndWrReg (mykonosDevice_t *device, mykonos_jesdcore_t jesdCore, uint8_t intAddr, uint8_t data)
 Performs indirect write access to internal JESD register. More...
 
mykonosDbgErr_t MYKONOS_jesdIndRdReg (mykonosDevice_t *device, mykonos_jesdcore_t jesdCore, uint8_t intAddr, uint8_t *data)
 Performs indirect read access to internal JESD register. More...
 
mykonosDbgErr_t MYKONOS_deframerRd2Stat (mykonosDevice_t *device, uint8_t *defStat2)
 Performs reads to JESD Deframer secondary status register. More...
 
mykonosDbgErr_t MYKONOS_deframerGetErrLane (mykonosDevice_t *device, mykonosErrType_t errType, uint8_t *lane)
 Performs read back lanes in error for the given errType of the JESD Deframer. More...
 
mykonosDbgErr_t MYKONOS_deframerRstErrCntr (mykonosDevice_t *device, mykonosErrType_t errType, mykonosLaneSel_t lane)
 Performs reset of the selected error type for the selected lane. More...
 
mykonosDbgErr_t MYKONOS_deframerRstErrIrq (mykonosDevice_t *device, mykonosErrType_t errType, mykonosLaneSel_t lane)
 Performs reset of the selected error type IRQ for the given lane. More...
 
mykonosDbgErr_t MYKONOS_deframerRdErrCntr (mykonosDevice_t *device, mykonosLaneSel_t laneSel, mykonosLaneErr_t *laneErr)
 Performs read back of the error counters for selected lane of the JESD Deframer. More...
 
mykonosDbgErr_t MYKONOS_deframerSetErrThrs (mykonosDevice_t *device, uint8_t errThrs)
 Performs set JESD Deframer error thresholds. More...
 
mykonosDbgErr_t MYKONOS_deframerGetErrThrs (mykonosDevice_t *device, uint8_t *errThrs)
 Performs read JESD Deframer error thresholds. More...
 
mykonosDbgErr_t MYKONOS_deframerSetSyncMask (mykonosDevice_t *device, uint8_t errSyncMask)
 Performs set JESD Deframer Sync mask. More...
 
mykonosDbgErr_t MYKONOS_deframerGetSyncMask (mykonosDevice_t *device, uint8_t *errSyncMask)
 Performs get JESD Deframer SyncMask. More...
 
mykonosDbgErr_t MYKONOS_deframerGetEnLanes (mykonosDevice_t *device, uint8_t *lane)
 Performs read of enabled JESD Deframer lanes. More...
 
mykonosDbgErr_t MYKONOS_deframerForceSyncReq (mykonosDevice_t *device, uint8_t syncReq)
 Performs Deframer Force SYNC requests. More...
 
mykonosDbgErr_t MYKONOS_deframerSetIrqMask (mykonosDevice_t *device, uint8_t errIrqMsk)
 Performs set JESD Deframer IRQ mask that will be used to generates interrupts. More...
 
mykonosDbgErr_t MYKONOS_deframerGetIrq (mykonosDevice_t *device, uint8_t *errIrq)
 Performs a read of the JESD IRQ vector for the deframer. More...
 
mykonosDbgErr_t MYKONOS_framerSetPatternGen (mykonosDevice_t *device, mykonos_jesdcore_t jesdCore, uint32_t pattern, uint8_t enable, uint8_t toggle)
 Performs set JESD framer Pattern Generator. More...
 
mykonosDbgErr_t MYKONOS_framerGetPatternGen (mykonosDevice_t *device, mykonos_jesdcore_t jesdCore, uint32_t *pattern, uint8_t *enable, uint8_t *toggle)
 Gets JESD framer Pattern generator. More...
 
mykonosDbgErr_t MYKONOS_framerSetZeroData (mykonosDevice_t *device, mykonos_jesdcore_t jesdCore, mykonosLaneSel_t lane)
 Performs set JESD framer Zero data samples per lane. More...
 
mykonosDbgErr_t MYKONOS_framerGetZeroData (mykonosDevice_t *device, mykonos_jesdcore_t jesdCore, mykonosLaneSel_t *lane)
 Performs get JESD framer Zero data samples. More...
 
mykonosDbgErr_t MYKONOS_framerCoreSel (mykonos_jesdcore_t jesdCore, uint16_t rxFramerAdd, uint16_t *baseAddr)
 Helper function to perform JESD framer core selection. More...
 

Detailed Description

Contains Mykonos APIs for Jesd debug facilities.

Mykonos API version: 1.5.2.3566

Function Documentation

◆ getDbgJesdMykonosErrorMessage()

const char* getDbgJesdMykonosErrorMessage ( mykonosDbgErr_t  errorCode)

Helper function for return of character string based on 32-bit mykonosDbgErr_t enum value.

Legal Disclaimer Copyright 2015-2017 Analog Devices Inc. Released under the AD9371 API license, for more information see the "LICENSE.txt" file in this zip file. To save codespace, these error strings are ifdef'd out unless the user adds a define MYKONOS_VERBOSE to their workspace. This function can be useful for debug. Each function also returns unique error codes to make it easier to determine where the code broke.

Parameters
errorCodeis enumerated error code value
Returns
Returns character string based on enumerated value
Here is the caller graph for this function:

◆ MYKONOS_deframerForceSyncReq()

mykonosDbgErr_t MYKONOS_deframerForceSyncReq ( mykonosDevice_t device,
uint8_t  syncReq 
)

Performs Deframer Force SYNC requests.

Using this feature, the user can force SYNC request on the Deframer

Dependencies

  • device->spiSettings->chipSelectIndex
Parameters
devicePointer to Mykonos device data structure containing settings
syncReqsync Request parameter Setting the syncReq causes the deframer to assert the SYNC~. Clearing syncReq causes the deframer to de-assert the SYNC~.
Return values
MYKONOS_ERR_DBG_OKFunction completed successfully

◆ MYKONOS_deframerGetEnLanes()

mykonosDbgErr_t MYKONOS_deframerGetEnLanes ( mykonosDevice_t device,
uint8_t *  lane 
)

Performs read of enabled JESD Deframer lanes.

Dependencies

  • device->spiSettings->chipSelectIndex
Parameters
devicePointer to Mykonos device data structure containing settings
lanePointer to store the current enabled lanes
Value Description of Lane
8 Lane 3 is enabled
4 Lane 2 is enabled
2 Lane 1 is enabled
1 Lane 0 is enabled
0 No lanes are enabled
Return values
MYKONOS_ERR_DBG_OKFunction completed successfully
MYKONOS_ERR_DBG_ILLEGAL_DATA_POINTERData pointer passed lane is NULL

◆ MYKONOS_deframerGetErrLane()

mykonosDbgErr_t MYKONOS_deframerGetErrLane ( mykonosDevice_t device,
mykonosErrType_t  errType,
uint8_t *  lane 
)

Performs read back lanes in error for the given errType of the JESD Deframer.

Dependencies

  • device->spiSettings->chipSelectIndex
Parameters
devicePointer to Mykonos device data structure containing settings
errTypewhich error counter to read back
lanePointer to store which lane has reached the error threshold. Every bit shows per lane which error count has reached the threshold count. A value of 0x0F will represent that all the lanes has reached the error threshold.
Value Description of Lane
8 Lane 3 has reached the error threshold
4 Lane 2 has reached the error threshold
2 Lane 1 has reached the error threshold
1 Lane 0 has reached the error threshold
0 No errors in lanes
Return values
MYKONOS_ERR_DBG_OKFunction completed successfully
MYKONOS_ERR_DBG_ILLEGAL_DATA_POINTERData pointer passed lane is NULL
MYKONOS_ERR_DBG_ILLEGAL_ERROR_SELECTEDIllegal errType passed, valid errType are BADDISP, NIT and UEKC

◆ MYKONOS_deframerGetErrThrs()

mykonosDbgErr_t MYKONOS_deframerGetErrThrs ( mykonosDevice_t device,
uint8_t *  errThrs 
)

Performs read JESD Deframer error thresholds.

The value for the error threshold is common to all the error counters.

Dependencies

  • device->spiSettings->chipSelectIndex
  • laneErr structure must be initialised
Parameters
devicePointer to Mykonos device data structure containing settings
errThrsPointer to store the error threshold value read back
Return values
MYKONOS_ERR_DBG_OKFunction completed successfully
MYKONOS_ERR_DBG_ILLEGAL_DATA_POINTERData pointer passed errThrs is NULL

◆ MYKONOS_deframerGetIrq()

mykonosDbgErr_t MYKONOS_deframerGetIrq ( mykonosDevice_t device,
uint8_t *  errIrq 
)

Performs a read of the JESD IRQ vector for the deframer.

Dependencies

  • device->spiSettings->chipSelectIndex
Parameters
devicePointer to Mykonos device data structure containing settings
errIrqPointer to store the deframer IRQ status, the different bits mask are:
IRQ Bit mask Description of errIrq
CMM 3 Configuration mismatch 0 if is CMM ok, 1 if CMM is detected
BADDISP 2 Incorrect disparity 0 if is BADDISP ok, 1 if BADDISP character is detected
NIT 1 Not in table 0 if is NIT ok, 1 if NIT character is detected
UEKC 0 Unexpected K character 0 if is UEKC ok, 1 if UEKC character is detected
Return values
MYKONOS_ERR_DBG_OKFunction completed successfully
MYKONOS_ERR_DBG_ILLEGAL_DATA_POINTERData pointer passed errIrqMask is NULL

◆ MYKONOS_deframerGetSyncMask()

mykonosDbgErr_t MYKONOS_deframerGetSyncMask ( mykonosDevice_t device,
uint8_t *  errSyncMask 
)

Performs get JESD Deframer SyncMask.

This function read the SyncMask that is programmed into Mykonos.

Dependencies

  • device->spiSettings->chipSelectIndex
Parameters
devicePointer to Mykonos device data structure containing settings
errSyncMaskPointer to store the sync mask currently being used:
Sync Bit mask Description of errSyncMask
SYNC_BADDISP 2 Bad disparity mask
SYNC_NIT 1 Not in table
SYNC_UEKC 0 Unexpected K character
Return values
MYKONOS_ERR_DBG_OKFunction completed successfully
MYKONOS_ERR_DBG_ILLEGAL_DATA_POINTERData pointer passed errSyncMask is NULL

◆ MYKONOS_deframerRd2Stat()

mykonosDbgErr_t MYKONOS_deframerRd2Stat ( mykonosDevice_t device,
uint8_t *  defStat2 
)

Performs reads to JESD Deframer secondary status register.

Dependencies

  • device->spiSettings->chipSelectIndex
Parameters
devicePointer to Mykonos device data structure containing settings
defStat2Pointer to store the deframer secondary status
Bit mask Description of defStat2
2 DeframerSYSREF Phase Error, when set, this bit reports that an incoming SYSREF is not aligned to the current LMFC boundary.
1 Deframer Det Lat FIFO RD, this bit is the status of rd_enable for deterministic sample FIFO. If set deterministic latency is achieved.
0 Deframer Lane FIFO PTR Delta Changed. If set this bit reports that the offset between the read and write FIFO pointers has changed.
Return values
MYKONOS_ERR_DBG_OKFunction completed successfully
MYKONOS_ERR_DBG_ILLEGAL_DATA_POINTERData pointer passed defStat2 is NULL

◆ MYKONOS_deframerRdErrCntr()

mykonosDbgErr_t MYKONOS_deframerRdErrCntr ( mykonosDevice_t device,
mykonosLaneSel_t  laneSel,
mykonosLaneErr_t laneErr 
)

Performs read back of the error counters for selected lane of the JESD Deframer.

This function reads the counters per the given lane for the bad disparity, not in table and unexpected K character errors and stores them in the structure laneErr. The structure laneErr must be initialised in the calling function as it will contain the values of the counters per error type for the given lane.

Dependencies

  • device->spiSettings->chipSelectIndex
  • laneErr structure must be initialised
Parameters
devicePointer to Mykonos device data structure containing settings
laneSelwhich JESD lane error counter to be read
laneErrPointer to a mykonosLaneErr_t structure type to store counter values for different errors
Return values
MYKONOS_ERR_OKFunction completed successfully
MYKONOS_ERR_DBG_ILLEGAL_DATA_POINTERData pointer passed laneErr is NULL
MYKONOS_ERR_DBG_ILLEGAL_LANE_NUMBERIllegal laneSel parameter passed, valid laneSel are given in mykonosLaneSel_t

◆ MYKONOS_deframerRstErrCntr()

mykonosDbgErr_t MYKONOS_deframerRstErrCntr ( mykonosDevice_t device,
mykonosErrType_t  errType,
mykonosLaneSel_t  lane 
)

Performs reset of the selected error type for the selected lane.

Dependencies

  • device->spiSettings->chipSelectIndex
Parameters
devicePointer to Mykonos device data structure containing settings
errTypeWhich error counter to be reset
laneWhich lane error counter to be reset
Return values
MYKONOS_ERR_DBG_OKFunction completed successfully
MYKONOS_ERR_DBG_ILLEGAL_LANE_NUMBERIllegal lane passed, valid lanes are given in mykonosLaneSel_t
MYKONOS_ERR_DBG_ILLEGAL_ERROR_SELECTEDIllegal errType passed, valid errType are BADDISP, NIT and UEKC

◆ MYKONOS_deframerRstErrIrq()

mykonosDbgErr_t MYKONOS_deframerRstErrIrq ( mykonosDevice_t device,
mykonosErrType_t  errType,
mykonosLaneSel_t  lane 
)

Performs reset of the selected error type IRQ for the given lane.

Dependencies

  • device->spiSettings->chipSelectIndex
Parameters
devicePointer to Mykonos device data structure containing settings
errTypeWhich error counter to be reset, for the full list
laneWhich lane error counter to be reset
Return values
MYKONOS_ERR_DBG_OKFunction completed successfully
MYKONOS_ERR_DBG_ILLEGAL_LANE_NUMBERIllegal lane passed, valid lanes are given in mykonosLaneSel_t
MYKONOS_ERR_DBG_ILLEGAL_ERROR_TYPEIllegal errType passed, valid errType are given in mykonosErrType_t

◆ MYKONOS_deframerSetErrThrs()

mykonosDbgErr_t MYKONOS_deframerSetErrThrs ( mykonosDevice_t device,
uint8_t  errThrs 
)

Performs set JESD Deframer error thresholds.

The value for the error threshold will be applied to all the error counters for all the enabled lanes. Bad disparity, NIT disparity and Unexpected K char. Errors are counted and compared to the errThrs value. When the count is equal, then the user has the ability of raising an IRQ, see MYKONOS_deframerSetIrqMask, or asserted the SYNC signal per the mask register settings, see MYKONOS_deframerSetSyncMask, or do nothing upon threshold reach.

Dependencies

  • device->spiSettings->chipSelectIndex
Parameters
devicePointer to Mykonos device data structure containing settings
errThrsis the value that will be written to the error threshold, valid error threshold is in the range 0x00 to 0xFF.
Return values
MYKONOS_ERR_DBG_OKFunction completed successfully

◆ MYKONOS_deframerSetIrqMask()

mykonosDbgErr_t MYKONOS_deframerSetIrqMask ( mykonosDevice_t device,
uint8_t  errIrqMsk 
)

Performs set JESD Deframer IRQ mask that will be used to generates interrupts.

Bad disparity, NIT disparity and Unexpected K char. Errors are counted and compared to the errThrs value. When the count is equal, either an IRQ is generated if the mask for the particular error is set. Configuration mismatch flag does not have a counter. Function is performed in all lanes.

Dependencies

  • device->spiSettings->chipSelectIndex
Parameters
devicePointer to Mykonos device data structure containing settings
errIrqMskthe value of the mask applied to the IRQ generation, possible combinations are:
IRQ Bit mask Description of errIrq
CMM 3 Configuration mismatch flag 0 if is CMM ok, 1 if CMM is detected
BADDISP 2 Incorrect disparity flag 0 if is BADDISP ok, 1 if BADDISP is detected
NIT 1 Not in table flag 0 if is NIT ok, 1 if NIT character is detected
UEKC 0 Unexpected K character flag 0 if is UEKC ok, 1 if UEKC is detected
Return values
MYKONOS_ERR_DBG_OKFunction completed successfully
MYKONOS_ERR_DBG_ERROR_IRQ_MASKIllegal parameter passed for errIrqMsk, valid parameter is in the range of 0x00 to 0x1FF

◆ MYKONOS_deframerSetSyncMask()

mykonosDbgErr_t MYKONOS_deframerSetSyncMask ( mykonosDevice_t device,
uint8_t  errSyncMask 
)

Performs set JESD Deframer Sync mask.

This function sets the syncMask that will be programmed in to Mykonos. When the error counter reaches the error threshold value programmed by MYKONOS_deframerSetErrThrs function, if the syncMask is set for the particular errors type then the SYNC~ is asserted. The syncMask is applied to all the enabled lanes.

Dependencies

  • device->spiSettings->chipSelectIndex
Parameters
devicePointer to Mykonos device data structure containing settings
errSyncMaskis the mask that will be used in order to assert SYNC~ Setting the syncMask bits causes the deframer to assert the SYNC~ when the count of the corresponding error reaches the errThrs value.
Sync Bit mask Description of sync
SYNC_BADDISP 2 Bad disparity mask
SYNC_NIT 1 Not in table
SYNC_UEKC 0 Unexpected K character
Return values
MYKONOS_ERR_DBG_OKFunction completed successfully.
MYKONOS_ERR_DBG_ERROR_SYNC_MASKPassed errSyncMask parameter is outside its boundaries, valid sync mask are in the range 0x00 to 0x07.

◆ MYKONOS_framerCoreSel()

mykonosDbgErr_t MYKONOS_framerCoreSel ( mykonos_jesdcore_t  jesdCore,
uint16_t  rxFramerAdd,
uint16_t *  baseAddr 
)

Helper function to perform JESD framer core selection.

Dependencies

  • device->spiSettings->chipSelectIndex
Parameters
jesdCoreselection for FRAMER and OBS_FRAMER
rxFramerAddbase address for Framer selection
baseAddrPointer to store the selected address base
Return values
MYKONOS_ERR_DBG_FRAMER_SEL_BASE_ADD_NULLbase address is null
MYKONOS_ERR_DBG_FRAMER_ILLEGAL_JESD_COREOnly valid JESD cores are FRAMER and OBS_FRAMER
MYKONOS_ERR_DBG_OKFunction completed successfully
Here is the caller graph for this function:

◆ MYKONOS_framerGetPatternGen()

mykonosDbgErr_t MYKONOS_framerGetPatternGen ( mykonosDevice_t device,
mykonos_jesdcore_t  jesdCore,
uint32_t *  pattern,
uint8_t *  enable,
uint8_t *  toggle 
)

Gets JESD framer Pattern generator.

Dependencies

  • device->spiSettings->chipSelectIndex
Parameters
devicePointer to Mykonos device data structure containing settings
jesdCoreselection for FRAMER and OBS_FRAMER
patternPointer to store the programmed pattern
enablePointer to store the programmed enable
togglePointer to store the programmed toggle
Return values
MYKONOS_ERR_DBG_PATTERN_GEN_NULL_PATTERNFunction parameter pattern is a NULL pointer
MYKONOS_ERR_DBG_PATTERN_GEN_NULL_ENABLEFunction parameter enable is a NULL pointer
MYKONOS_ERR_DBG_PATTERN_GEN_NULL_TOGGLEFunction parameter toggle is a NULL pointer
MYKONOS_ERR_DBG_OKFunction completed successfully

◆ MYKONOS_framerGetZeroData()

mykonosDbgErr_t MYKONOS_framerGetZeroData ( mykonosDevice_t device,
mykonos_jesdcore_t  jesdCore,
mykonosLaneSel_t lane 
)

Performs get JESD framer Zero data samples.

This functions will get the settings for zero the Framer data samples.

Dependencies

  • device->spiSettings->chipSelectIndex
Parameters
devicePointer to Mykonos device data structure containing settings
jesdCoreselection for MYK_FRAMER and MYK_OBS_FRAMER
lanePointer to store the programmed pattern
Return values
MYKONOS_ERR_DBG_ZERO_DATA_LANE_NULLFunction parameter lane is a NULL pointer
MYKONOS_ERR_DBG_OKFunction completed successfully

◆ MYKONOS_framerSetPatternGen()

mykonosDbgErr_t MYKONOS_framerSetPatternGen ( mykonosDevice_t device,
mykonos_jesdcore_t  jesdCore,
uint32_t  pattern,
uint8_t  enable,
uint8_t  toggle 
)

Performs set JESD framer Pattern Generator.

The Pattern Generator is a function for JESD testing. The JESD framer will be transmitting the "pattern" once the enabled.

Dependencies

  • device->spiSettings->chipSelectIndex
Parameters
devicePointer to Mykonos device data structure containing settings
jesdCoreselection for FRAMER and OBS_FRAMER
patternpattern to be transmitted by the Framer, is a 20 bit field having a range from 0x00000 to 0xFFFFF
enableBit used to enable the Pattern Generator facility
toggleif 0 the transfer data will be not modified, if 1 the transfered data will be toggling
Return values
MYKONOS_ERR_DBG_ILLEGAL_TOGGLEToggle is not valid, valid values are 0 and 1.
MYKONOS_ERR_DBG_ILLEGAL_FRAMER_PATTERNPattern passed is outside the range valid range from 0x00000 to 0xFFFFF
MYKONOS_ERR_DBG_ILLEGAL_ENABLEEnable not valid, valid values are 0 and 1.
MYKONOS_ERR_DBG_PATTERN_GEN_ILLEGAL_JESD_CORE
MYKONOS_ERR_DBG_OKFunction completed successfully

◆ MYKONOS_framerSetZeroData()

mykonosDbgErr_t MYKONOS_framerSetZeroData ( mykonosDevice_t device,
mykonos_jesdcore_t  jesdCore,
mykonosLaneSel_t  lane 
)

Performs set JESD framer Zero data samples per lane.

This functions will zero the Framer data samples for the specify lane or lanes. For the specified Framer or ObsFramer.

Dependencies

  • device->spiSettings->chipSelectIndex
Parameters
devicePointer to Mykonos device data structure containing settings
jesdCoreselection for FRAMER and OBS_FRAMER
lanelanes to zero the Framer data samples
Return values
MYKONOS_ERR_DBG_ZERO_DATA_INV_LANEthe lane selection is out of range
MYKONOS_ERR_DBG_OKFunction completed successfully

◆ MYKONOS_jesdIndRdReg()

mykonosDbgErr_t MYKONOS_jesdIndRdReg ( mykonosDevice_t device,
mykonos_jesdcore_t  jesdCore,
uint8_t  intAddr,
uint8_t *  data 
)

Performs indirect read access to internal JESD register.

Dependencies

  • device->spiSettings->chipSelectIndex
Parameters
devicePointer to Mykonos device data structure containing settings
jesdCoreJESD core selection
intAddrInternal address to access in JESD core
dataPointer to store data
Return values
MYKONOS_ERR_OKFunction completed successfully
MYKONOS_ERR_DBG_ILLEGAL_DATA_POINTERData pointer passed is a NULL pointer
Here is the caller graph for this function:

◆ MYKONOS_jesdIndWrReg()

mykonosDbgErr_t MYKONOS_jesdIndWrReg ( mykonosDevice_t device,
mykonos_jesdcore_t  jesdCore,
uint8_t  intAddr,
uint8_t  data 
)

Performs indirect write access to internal JESD register.

Dependencies

  • device->spiSettings->chipSelectIndex
Parameters
devicePointer to Mykonos device data structure containing settings
jesdCoreJESD core selection
intAddrInternal address to access in JESD core
dataData to write into internal address
Return values
MYKONOS_ERR_OKFunction completed successfully
MYKONOS_ERR_DBG_ILLEGAL_JESD_COREAn illegal JESD core passed, valid cores are given in mykonos_jesdcore_t
Here is the caller graph for this function: