PDK API Guide for J721E
CPTS Functions

Introduction

Functions

void CSL_CPTS_getCptsVersionInfo (const CSL_cptsRegs *pCptsRegs, CSL_CPTS_VERSION *pVersionInfo)
 
uint32_t CSL_CPTS_isCptsEnabled (const CSL_cptsRegs *pCptsRegs)
 
void CSL_CPTS_enableCpts (CSL_cptsRegs *pCptsRegs)
 
void CSL_CPTS_disableCpts (CSL_cptsRegs *pCptsRegs)
 
void CSL_CPTS_getCntlReg (const CSL_cptsRegs *pCptsRegs, CSL_CPTS_CONTROL *pCntlCfg)
 
void CSL_CPTS_setCntlReg (CSL_cptsRegs *pCptsRegs, const CSL_CPTS_CONTROL *pCntlCfg)
 
void CSL_CPTS_getRFTCLKSelectReg (const CSL_cptsRegs *pCptsRegs, uint32_t *pRefClockSelect)
 
void CSL_CPTS_setRFTCLKSelectReg (CSL_cptsRegs *pCptsRegs, uint32_t refClockSetVal)
 
void CSL_CPTS_TSEventPush (CSL_cptsRegs *pCptsRegs)
 
void CSL_CPTS_getTSLoadValReg (const CSL_cptsRegs *pCptsRegs, uint32_t *pTSLoadVal)
 
void CSL_CPTS_setTSLoadValReg (CSL_cptsRegs *pCptsRegs, uint32_t tsLoadValLo, uint32_t tsLoadValHi)
 
void CSL_CPTS_setTSVal (CSL_cptsRegs *pCptsRegs, uint32_t tsValLo, uint32_t tsValHi)
 
void CSL_CPTS_setTSCompVal (CSL_cptsRegs *pCptsRegs, uint32_t tsCompValLo, uint32_t tsCompValHi, uint32_t tsCompLen)
 
void CSL_CPTS_setTSCompNudge (CSL_cptsRegs *pCptsRegs, int32_t tsCompNudge)
 
uint32_t CSL_CPTS_getTSAddVal (CSL_cptsRegs *pCptsRegs)
 
void CSL_CPTS_setTSAddVal (CSL_cptsRegs *pCptsRegs, uint32_t tsAddVal)
 
void CSL_CPTS_setTSNudge (CSL_cptsRegs *pCptsRegs, int32_t tsNudge)
 
void CSL_CPTS_getTSPpm (const CSL_cptsRegs *pCptsRegs, uint32_t tsPpmVal[2])
 
void CSL_CPTS_setTSPpm (CSL_cptsRegs *pCptsRegs, uint32_t tsPpmValLo, uint32_t tsPpmValHi, CSL_CPTS_TS_PPM_DIR tsPpmDir)
 
uint32_t CSL_CPTS_isRawInterruptStatusBitSet (const CSL_cptsRegs *pCptsRegs)
 
uint32_t CSL_CPTS_isMaskedInterruptStatusBitSet (const CSL_cptsRegs *pCptsRegs)
 
uint32_t CSL_CPTS_isInterruptEnabled (const CSL_cptsRegs *pCptsRegs)
 
void CSL_CPTS_enableInterrupt (CSL_cptsRegs *pCptsRegs)
 
void CSL_CPTS_disableInterrupt (CSL_cptsRegs *pCptsRegs)
 
void CSL_CPTS_popEvent (CSL_cptsRegs *pCptsRegs)
 
void CSL_CPTS_getEventInfo (const CSL_cptsRegs *pCptsRegs, CSL_CPTS_EVENTINFO *pEventInfo)
 
int32_t CSL_CPTS_getGENFnLength (CSL_cptsRegs *pCptsRegs, uint32_t genfIndex, uint32_t *pGenfLength)
 
int32_t CSL_CPTS_setupGENFn (CSL_cptsRegs *pCptsRegs, uint32_t genfIndex, uint32_t length, uint64_t compare, uint32_t polarityInv, uint64_t ppmAdjust, CSL_CPTS_TS_PPM_DIR ppmDir)
 
int32_t CSL_CPTS_setGENFnNudge (CSL_cptsRegs *pCptsRegs, uint32_t genfIndex, int32_t tsNudge)
 
int32_t CSL_CPTS_getESTFnLength (CSL_cptsRegs *pCptsRegs, uint32_t estfIndex, uint32_t *pEstfLength)
 
int32_t CSL_CPTS_setupESTFn (CSL_cptsRegs *pCptsRegs, uint32_t estfIndex, uint32_t length, uint64_t compare, uint32_t polarityInv, uint64_t ppmAdjust, CSL_CPTS_TS_PPM_DIR ppmDir)
 
int32_t CSL_CPTS_setESTFnNudge (CSL_cptsRegs *pCptsRegs, uint32_t estfIndex, int32_t tsNudge)
 

Function Documentation

void CSL_CPTS_getCptsVersionInfo ( const CSL_cptsRegs *  pCptsRegs,
CSL_CPTS_VERSION pVersionInfo 
)

============================================================================
CSL_CPTS_getCptsVersionInfo

Description
This function retrieves the CPTS module identification and version information.

Arguments

       pCptsRegs           Pointer to CSL_cptsRegs structure
       pVersionInfo        CSL_CPTS_VERSION structure that needs to be populated
                           with the version info read from the hardware.
*   

Return Value
None

Pre Condition
None

Post Condition
None

Reads
CPTS_IDVER_REG_MINOR_VER, CPTS_IDVER_REG_MAJOR_VER, CPTS_IDVER_REG_RTL_VER, CPTS_IDVER_REG_TX_IDENT

Example

       CSL_CPTS_VERSION    versionInfo;

       CSL_CPTS_getCptsVersionInfo (pCptsRegs, &versionInfo);

uint32_t CSL_CPTS_isCptsEnabled ( const CSL_cptsRegs *  pCptsRegs)

============================================================================
CSL_CPTS_isCptsEnabled

Description
This function indicates if time sync is enabled or not.

Arguments

       pCptsRegs           Pointer to CSL_cptsRegs structure
*   

Return Value
TRUE CPTS enabled.
FALSE CPTS disabled.

Pre Condition
None

Post Condition
None

Reads
CPTS_CONTROL_REG_CPTS_EN

Example

       if (CSL_CPTS_isCptsEnabled (pCptsRegs) == TRUE)
       {
           // CPTS on
       }
       else
       {
           // CPTS off
       }

void CSL_CPTS_enableCpts ( CSL_cptsRegs *  pCptsRegs)

============================================================================
CSL_CPTS_enableCpts

Description
This function configures the CPTS control register to enable time sync.

Arguments

       pCptsRegs           Pointer to CSL_cptsRegs structure
*   

Return Value
None

Pre Condition
None

Post Condition
None

Writes
CPTS_CONTROL_REG_CPTS_EN=1

Example

       CSL_CPTS_enableCpts (pCptsRegs);

void CSL_CPTS_disableCpts ( CSL_cptsRegs *  pCptsRegs)

============================================================================
CSL_CPTS_disableCpts

Description
This function configures the CPTS control register to disable time sync.

Arguments

       pCptsRegs           Pointer to CSL_cptsRegs structure
*   

Return Value
None

Pre Condition
None

Post Condition
None

Writes
CPTS_CONTROL_REG_CPTS_EN=0

Example

       CSL_CPTS_disableCpts (pCptsRegs);

void CSL_CPTS_getCntlReg ( const CSL_cptsRegs *  pCptsRegs,
CSL_CPTS_CONTROL pCntlCfg 
)

============================================================================
CSL_CPTS_getCntllReg

Description
This function retreives the contents of CPTS control register

Arguments

       pCptsRegs           Pointer to CSL_cptsRegs structure
       pCntlCfg            CSL_CPTS_CONTROL that needs to be populated with
                           contents of CPTS control register.
*   

Return Value
None

Pre Condition
None

Post Condition
None

Reads
CPTS_CONTROL_REG_CPTS_EN CPTS_CONTROL_REG_INT_TEST CPTS_CONTROL_REG_TS_COMP_POLARITY CPTS_CONTROL_REG_TSTAMP_EN CPTS_CONTROL_REG_SEQUENCE_EN CPTS_CONTROL_REG_MODE CPTS_CONTROL_REG_TS_COMP_TOG CPTS_CONTROL_REG_HW1_TS_PUSH_EN CPTS_CONTROL_REG_HW2_TS_PUSH_EN CPTS_CONTROL_REG_HW3_TS_PUSH_EN CPTS_CONTROL_REG_HW4_TS_PUSH_EN CPTS_CONTROL_REG_HW5_TS_PUSH_EN CPTS_CONTROL_REG_HW6_TS_PUSH_EN CPTS_CONTROL_REG_HW7_TS_PUSH_EN CPTS_CONTROL_REG_HW8_TS_PUSH_EN CPTS_CONTROL_REG_TS_SYNC_SEL CPTS_CONTROL_REG_TS_RX_NO_EVENT CPTS_CONTROL_REG_TS_GENF_CLR_EN

Example

       CSL_CPTS_CONTROL     cntlCfg;

       CSL_CPTS_getCntlReg (pCptsRegs, &cntlCfg);

void CSL_CPTS_setCntlReg ( CSL_cptsRegs *  pCptsRegs,
const CSL_CPTS_CONTROL pCntlCfg 
)

============================================================================
CSL_CPTS_setCntllReg

Description
This function sets up the contents of CPTS control register

Arguments

       pCptsRegs           Pointer to CSL_cptsRegs structure
       pCntlCfg            CSL_CPTS_CONTROL contain settings for
                           CPTS control register.
*   

Return Value
None

Pre Condition
None

Post Condition
None

Writes
CPTS_CONTROL_REG_CPTS_EN CPTS_CONTROL_REG_INT_TEST CPTS_CONTROL_REG_TS_COMP_POLARITY CPTS_CONTROL_REG_TSTAMP_EN CPTS_CONTROL_REG_SEQUENCE_EN CPTS_CONTROL_REG_MODE CPTS_CONTROL_REG_TS_COMP_TOG CPTS_CONTROL_REG_HW1_TS_PUSH_EN CPTS_CONTROL_REG_HW2_TS_PUSH_EN CPTS_CONTROL_REG_HW3_TS_PUSH_EN CPTS_CONTROL_REG_HW4_TS_PUSH_EN CPTS_CONTROL_REG_HW5_TS_PUSH_EN CPTS_CONTROL_REG_HW6_TS_PUSH_EN CPTS_CONTROL_REG_HW7_TS_PUSH_EN CPTS_CONTROL_REG_HW8_TS_PUSH_EN CPTS_CONTROL_REG_TS_SYNC_SEL CPTS_CONTROL_REG_TS_RX_NO_EVENT CPTS_CONTROL_REG_TS_GENF_CLR_EN

Example

       CSL_CPTS_CONTROL     cntlCfg;

       CSL_CPTS_setCntlReg (pCptsRegs, &cntlCfg);

void CSL_CPTS_getRFTCLKSelectReg ( const CSL_cptsRegs *  pCptsRegs,
uint32_t *  pRefClockSelect 
)

============================================================================
CSL_CPTS_getRFTCLKSelectReg

Description
This function retrieves the contents of the reference clock select register.

Arguments

       pCptsRegs           Pointer to CSL_cptsRegs structure
       pRefClockSelect     Reference clock select value read from hardware.
*   

Return Value
None

Pre Condition
None

Post Condition
None

Reads
CPTS_RFTCLK_SEL_REG_RFTCLK_SEL

Example

       uint32_t          refClockSelect;

       CSL_CPTS_getRFTCLKSelectReg (pCptsRegs, &refClockSelect);

void CSL_CPTS_setRFTCLKSelectReg ( CSL_cptsRegs *  pCptsRegs,
uint32_t  refClockSetVal 
)

============================================================================
CSL_CPTS_setRFTCLKSelectReg

Description
This function sets up the reference clock select value. The Reference clock value can be setup only when the CPTS enable bit is cleared in the CPTS control register.

Arguments

       pCptsRegs           Pointer to CSL_cptsRegs structure
       refClockSetVal      Reference clock select value to configure.
*   

Return Value
None

Pre Condition
CSL_CPTS_setTimeSyncControlReg () must be called to clear the CPTS enable bit before calling this API.

Post Condition
None

Affects
CPTS_RFTCLK_SEL_REG_RFTCLK_SEL

Example

       uint32_t          refClockSelect;

       refClockSelect  =   0;

       CSL_CPTS_setRFTCLKSelectReg (pCptsRegs, refClockSelect);

void CSL_CPTS_TSEventPush ( CSL_cptsRegs *  pCptsRegs)

============================================================================
CSL_CPTS_TSEventPush

Description
This function writes an 1 to the Time Stamp Event Push register to generate a timestamp event. The time stamp value is the time of the write of this register, not the time of the event read. The time stamp value can then be read on interrupt via the event registers.

Arguments

       pCptsRegs           Pointer to CSL_cptsRegs structure
*   

Return Value
None

Pre Condition
None

Post Condition
None

Affects
CPTS_TS_PUSH_REG_TS_PUSH

Example

       CSL_CPTS_TSEventPush (pCptsRegs);
Note
: Software should not push a second time stamp event onto the event FIFO until the first time stamp value has been read from the event FIFO (there should be only one time stamp event in the event FIFO at any

given time).

void CSL_CPTS_getTSLoadValReg ( const CSL_cptsRegs *  pCptsRegs,
uint32_t *  pTSLoadVal 
)

============================================================================
CSL_CPTS_getTSLoadValReg

Description
This function retrieves the contents of the Time Stamp Load Value register.

Arguments

       pCptsRegs           Pointer to CSL_cptsRegs structure
       pTSLoadVal          Time stamp load value read from hardware.
*   

Return Value
None

Pre Condition
None

Post Condition
None

Reads
CPTS_TS_LOAD_VAL_REG_TS_LOAD_VAL
CPTS_TS_LOAD_HIGH_VAL_REG_TS_LOAD_VAL

Example

       uint32_t          tsLoadVal[2];

       CSL_CPTS_getTSLoadValReg (pCptsRegs, tsLoadVal);
Note
: When reading this register, the value read is not the time

stamp, but is the value that was last written to this register.

void CSL_CPTS_setTSLoadValReg ( CSL_cptsRegs *  pCptsRegs,
uint32_t  tsLoadValLo,
uint32_t  tsLoadValHi 
)

============================================================================
CSL_CPTS_setTSLoadValReg

Description
This function sets up the Time Stamp Load Value.

Arguments

       pCptsRegs           Pointer to CSL_cptsRegs structure
       tsLoadValLo         Time stamp load value (lower 32-bits) to configure
       tsLoadValHi         Time stamp load value (upper 32-bits) to configure
*   

Return Value
None

Pre Condition
None.

Post Condition
None

Affects
CPTS_TS_LOAD_VAL_REG_TS_LOAD_VAL
CPTS_TS_LOAD_HIGH_VAL_REG_TS_LOAD_VAL

Example

       uint32_t tsLoadValLo, tsLoadValHi;

       tsLoadValLo = tsLoadValHi = 0;

       CSL_CPTS_setTSLoadValReg (pCptsRegs, tsLoadValLo, tsLoadValHi);

void CSL_CPTS_setTSVal ( CSL_cptsRegs *  pCptsRegs,
uint32_t  tsValLo,
uint32_t  tsValHi 
)

============================================================================
CSL_CPTS_setTSVal

Description
This function sets the Time Stamp Value.

Arguments

       pCptsRegs           Pointer to CSL_cptsRegs structure
       tsValLo             Time stamp value (lower 32-bits) to be loaded.
       tsValHi             Time stamp value (upper 32-bits) to be loaded.
*   

Return Value
None

Pre Condition
None.

Post Condition
None

Affects
CPTS_TS_LOAD_VAL_REG_TS_LOAD_VAL
CPTS_TS_LOAD_HIGH_VAL_REG_TS_LOAD_VAL
CPTS_TS_LOAD_EN_REG_TS_LOAD_EN

Example

       uint32_t tsValLo, tsValHi;

       tsValLo = tsValHi = 0;

       CSL_CPTS_setTSVal (pCptsRegs, tsValLo, tsValHi);

void CSL_CPTS_setTSCompVal ( CSL_cptsRegs *  pCptsRegs,
uint32_t  tsCompValLo,
uint32_t  tsCompValHi,
uint32_t  tsCompLen 
)

============================================================================
CSL_CPTS_setTSCompVal

Description
This function sets the Time Stamp Compare Value and triggers the Time Stamp Comparsion operation.

Arguments

       pCptsRegs           Pointer to CSL_cptsRegs structure
       tsCompValLo         Time stamp compare value (lower 32-bits) to be loaded.
       tsCompValHi         Time stamp compare value (upper 32-bits) to be loaded.
       tsCompLen           Length of the TS_COMP output pluse in non-toggle mode
                           Half Period of the TS_COMP wave in toggle mode
*   

Return Value
None

Pre Condition
None.

Post Condition
None

Affects
CPTS_TS_COMP_VAL_REG_TS_COMP_VAL
CPTS_TS_COMP_HIGH_VAL_REG_TS_COMP_VAL
CPTS_TS_COMP_LEN_REG_TS_COMP_LENGTH

Example

       uint32_t          tsCompValLo, tsCompValHi;
       uint32_t          tsCompLen;

       tsCompValLo =   0x3000;
       tsCompValHi =   0;
       tsCompLen   =   1000;

       CSL_CPTS_setTSCompVal (pCptsRegs, tsCompValLo, tsCompValHi, tsCompLen);

void CSL_CPTS_setTSCompNudge ( CSL_cptsRegs *  pCptsRegs,
int32_t  tsCompNudge 
)

============================================================================
CSL_CPTS_setTSCompNudge

Description
This function sets the Time Stamp Compare Nudge Value to adjust the phase of time compare wave in Toggle mode. This two's complement number is added to the ts_comp_length[23:0] value to increase or decrease the TS_COMP length by the ts_comp_nudge amount. Only a single high or low time is adjusted and the tsCompNudge value is cleared to zero when the nudge has occurred.

Arguments

       pCptsRegs           Pointer to CSL_cptsRegs structure
       tsCompNudge         Time stamp compare nudge value [-128, 127]
*
*   

Return Value
None

Pre Condition
None.

Post Condition
None

Affects
CPTS_TS_COMP_NUDGE_REG_NUDGE

Example

       int32_t        tsCompNudge;

       tsCompNudge   =   -2;

       CSL_CPTS_setTSCompNudge (pCptsRegs, tsCompNudge);

uint32_t CSL_CPTS_getTSAddVal ( CSL_cptsRegs *  pCptsRegs)

============================================================================
CSL_CPTS_getTSAddVal

Description
This function retrieves the contents of the Time Stamp Add Value register.

Arguments

       pCptsRegs           Pointer to CSL_cptsRegs structure
       pTsAddVal           Time stamp add value read from hardware.
*   

Return Value
tsAddVal Time stamp add value read from hardware.

Pre Condition
None

Post Condition
None

Reads
CPTS_TS_ADD_VAL_REG_ADD_VAL

Example

       uint32_t          tsAddVal;

       tsAddVal = CSL_CPTS_getTSAddVal (pCptsRegs);

void CSL_CPTS_setTSAddVal ( CSL_cptsRegs *  pCptsRegs,
uint32_t  tsAddVal 
)

============================================================================
CSL_CPTS_setTSAddVal

Description
This function sets the Time Stamp Add Value to adjust the 64-bit timestamp value. The tsAddVal[2:0] is added to 1 to comprise the timestamp increment value. The timestamp increment value is added to the current timestamp (time_stamp[63:0]) on each RCLK.

Note that this function is only applicable for 64-bit timestamp mode. In 32-bit timestamp mode, 0 is written.

Arguments

       pCptsRegs           Pointer to CSL_cptsRegs structure
       tsAddVal            Time stamp add value [0, 7]
*
*   

Return Value
None

Pre Condition
None.

Post Condition
None

Affects
CPTS_TS_ADD_VAL_REG_ADD_VAL

Example

       uint32_t          tsAddVal;

       tsAddVal   =   3;

       CSL_CPTS_setTSAddVal (pCptsRegs, tsAddVal);

void CSL_CPTS_setTSNudge ( CSL_cptsRegs *  pCptsRegs,
int32_t  tsNudge 
)

============================================================================
CSL_CPTS_setTSNudge

Description
This function sets the Time Stamp Nudge Value to adjust the 64-bit timestamp value. This two's complement number is added to the time_stamp[63:0] value to increase or decrease the timestamp value by the tsNudge amount. The tsNudge value is cleared to zero when the nudge has occurred.

Note that this function is only applicable for 64-bit timestamp mode. In 32-bit timestamp mode, this function does nothing.

Arguments

       pCptsRegs           Pointer to CSL_cptsRegs structure
       tsNudge             Time stamp nudge value [-128, 127]
*
*   

Return Value
None

Pre Condition
None.

Post Condition
None

Affects
CPTS_TS_NUDGE_VAL_REG_TS_NUDGE_VAL

Example

       int32_t        tsNudge;

       tsNudge   =   -2;

       CSL_CPTS_setTSNudge (pCptsRegs, tsNudge);

void CSL_CPTS_getTSPpm ( const CSL_cptsRegs *  pCptsRegs,
uint32_t  tsPpmVal[2] 
)

============================================================================
CSL_CPTS_getTSPpm

Description
This function retrieves the contents of the Time Stamp PPM Value register.

Arguments

       pCptsRegs           Pointer to CSL_cptsRegs structure
       pTSPpm              PPM value read from hardware.
*   

Return Value
None

Pre Condition
None

Post Condition
None

Reads
CPTS_TS_PPM_LOW_VAL_REG_TS_PPM_LOW_VAL
CPTS_TS_PPM_HIGH_VAL_REG_TS_PPM_HIGH_VAL

Example

       uint32_t          tsPpmVal[2];

       CSL_CPTS_getTSPpm (pCptsRegs, tsPpmVal);

void CSL_CPTS_setTSPpm ( CSL_cptsRegs *  pCptsRegs,
uint32_t  tsPpmValLo,
uint32_t  tsPpmValHi,
CSL_CPTS_TS_PPM_DIR  tsPpmDir 
)

============================================================================
CSL_CPTS_setTSPpm

Description
This function sets the parts per million or parts per hour 64-bit timestamp adjustment value. Writing a non-zero tsPpm value enables PPM operations. The adjustment is up or down depending on the tsPpmDir value. The timestamp value is increased by the PPM value when tsPpmDir is CSL_CPTS_TS_PPM_DIR_INCREASE and decreased by the PPM value when tsPpmDir is CSL_CPTS_TS_PPM_DIR_DECREASE.

Note that this function is only applicable for 64-bit timestamp mode. In 32-bit timestamp mode, this function does nothing.

Arguments

       pCptsRegs           Pointer to CSL_cptsRegs structure
       tsPpm               Time stamp nudge value [-128, 127]
       tsPpmDir            Adjustment direction
*
*   

Return Value
None

Pre Condition
None.

Post Condition
None

Affects
CPTS_CONTROL_REG_TS_PPM_DIR
CPTS_TS_PPM_HIGH_VAL_REG_TS_PPM_HIGH_VAL
CPTS_TS_PPM_LOW_VAL_REG_TS_PPM_LOW_VAL

Example

       uint32_t                      tsPpmValLo,
       uint32_t                      tsPpmValHi,
       CSL_CPTS_TS_PPM_DIR         tsPpmDir;

       tsPpmValLo   =   10000UL;
       tsPpmValHi   =   0;
       tsPpmDir = CSL_CPTS_TS_PPM_DIR_INCREASE;

       CSL_CPTS_setTSPpm (pCptsRegs, tsPpmValLo, tsPpmValHi, tsPpmDir);

uint32_t CSL_CPTS_isRawInterruptStatusBitSet ( const CSL_cptsRegs *  pCptsRegs)

============================================================================
CSL_CPTS_isRawInterruptStatusBitSet

Description
This function checks the Time Sync Raw Pending Interrupt Register to determine if there is one or more events in the event FIFO.

Arguments

       pCptsRegs           Pointer to CSL_cptsRegs structure
*   

Return Value
TRUE One or more events in FIFO. Raw interrupt status bit set.
FALSE No events in FIFO. Raw interrupt status bit cleared.

Pre Condition
None

Post Condition
None

Reads
CPTS_INTSTAT_RAW_REG_TS_PEND_RAW

Example

       if (CSL_CPTS_isRawInterruptStatusBitSet (pCptsRegs) == TRUE)
       {
          // interrupt set
       }
       else
       {
           // interrupt bit not set
       }

uint32_t CSL_CPTS_isMaskedInterruptStatusBitSet ( const CSL_cptsRegs *  pCptsRegs)

============================================================================
CSL_CPTS_isMaskedInterruptStatusBitSet

Description
This function checks the Time Sync Interrupt Status Masked Register to determine if there is one or more events in the event FIFO.

Arguments

       pCptsRegs           Pointer to CSL_cptsRegs structure
*   

Return Value
TRUE One or more events in FIFO. masked interrupt status bit set.
FALSE No events in FIFO. masked interrupt status bit cleared.

Pre Condition
None

Post Condition
None

Reads
CPTS_INTSTAT_MASKED_REG_TS_PEND

Example

       if (CSL_CPTS_isMaskedInterruptStatusBitSet (pCptsRegs) == TRUE)
       {
          // masked interrupt set
       }
       else
       {
           // masked interrupt bit not set
       }

uint32_t CSL_CPTS_isInterruptEnabled ( const CSL_cptsRegs *  pCptsRegs)

============================================================================
CSL_CPTS_isInterruptEnabled

Description
This function indicates if Time sync interrupts are enabled.

Arguments

       pCptsRegs           Pointer to CSL_cptsRegs structure
*   

Return Value
TRUE Time sync interrupts enabled.
FALSE Time sync interrupts disabled.

Pre Condition
None

Post Condition
None

Reads
CPTS_INT_ENABLE_REG_TS_PEND_EN

Example

       if (CSL_CPTS_isInterruptEnabled (pCptsRegs) == TRUE)
       {
          // interrupts enabled
       }
       else
       {
           // interrupts disabled
       }

void CSL_CPTS_enableInterrupt ( CSL_cptsRegs *  pCptsRegs)

============================================================================
CSL_CPTS_enableInterrupt

Description
This function enables the interrupts in Time sync submodule.

Arguments

       pCptsRegs           Pointer to CSL_cptsRegs structure
*   

Return Value
None

Pre Condition
None

Post Condition
None

Writes
CPTS_INT_ENABLE_REG_TS_PEND_EN=1

Example

       CSL_CPTS_enableInterrupt (pCptsRegs);

void CSL_CPTS_disableInterrupt ( CSL_cptsRegs *  pCptsRegs)

============================================================================
CSL_CPTS_disableInterrupt

Description
This function disables the interrupts in Time sync submodule.

Arguments

       pCptsRegs           Pointer to CSL_cptsRegs structure
*   

Return Value
None

Pre Condition
None

Post Condition
None

Writes
CPTS_INT_ENABLE_REG_TS_PEND_EN=0

Example

       CSL_CPTS_disableInterrupt (pCptsRegs);

void CSL_CPTS_popEvent ( CSL_cptsRegs *  pCptsRegs)

============================================================================
CSL_CPTS_popEvent

Description
This function sets up the Event pop bit in Event pop register. This initiates an event to be popped off the event FIFO. Popping an event discards the event and causes the next event, if any, to be moved to the top of the FIFO ready to be read by software on interrupt.

Arguments

       pCptsRegs           Pointer to CSL_cptsRegs structure
*   

Return Value
None

Pre Condition
None

Post Condition
None

Writes
CPTS_EVENT_POP_REG_EVENT_POP=1

Example

       CSL_CPTS_popEvent (pCptsRegs);

void CSL_CPTS_getEventInfo ( const CSL_cptsRegs *  pCptsRegs,
CSL_CPTS_EVENTINFO pEventInfo 
)

============================================================================
CSL_CPTS_getEventInfo

Description
This function retrieves the contents of the Event Low, Event Middle and Event High registers.

Arguments

       pCptsRegs           Pointer to CSL_cptsRegs structure
       pEventInfo          CSL_CPTS_EVENTINFO structure that needs to be filled
                           with time sync event info read from hardware.
*   

Return Value
None

Pre Condition
None

Post Condition
None

Reads
CPTS_EVENT_LOW_REG_TIME_STAMP, CPTS_EVENT_MIDDLE_REG_SEQUENCE_ID, CPTS_EVENT_MIDDLE_REG_MESSAGE_TYPE, CPTS_EVENT_MIDDLE_REG_EVENT_TYPE, CPTS_EVENT_MIDDLE_REG_PORT_NUMBER, CPTS_EVENT_HIGH_REG_DOMAIN

Example

       CSL_CPTS_EVENTINFO          eventInfo;

       CSL_CPTS_getEventInfo (pCptsRegs, &eventInfo);

int32_t CSL_CPTS_getGENFnLength ( CSL_cptsRegs *  pCptsRegs,
uint32_t  genfIndex,
uint32_t *  pGenfLength 
)

============================================================================
CSL_CPTS_getGENFnLength

Description
This function retrieves the contents of the GENFn length register.

Arguments

       pCptsRegs           Pointer to CSL_cptsRegs structure
       genfIndex           Index of the GENFn to configure
       pGenfLength         GENFn length value obtained from hardware
*   

Return Value
0 = success
-1 = genfIndex is invalid (outside of the valid range)

Pre Condition
None

Post Condition
None

Reads
CPTS_TS_GENF_LENGTH_REG_LENGTH

Example

       uint32_t          genfLength, genfIndex;

       genfIndex = 0;

       CSL_CPTS_getGENFnLength (pCptsRegs, genfIndex, &genfLength);

int32_t CSL_CPTS_setupGENFn ( CSL_cptsRegs *  pCptsRegs,
uint32_t  genfIndex,
uint32_t  length,
uint64_t  compare,
uint32_t  polarityInv,
uint64_t  ppmAdjust,
CSL_CPTS_TS_PPM_DIR  ppmDir 
)

============================================================================
CSL_CPTS_setupGENFn

Description
This function sets the Time Stamp Compare Value of GENFn and triggers the Time Stamp Comparsion operation.

Arguments

       pCptsRegs   Pointer to CSL_cptsRegs structure
       genfIndex   Index of the GENFn to configure
       length      Length of the GENFn output pulse in RCLK periods
       compare     Time stamp compare value (64-bit value) to be loaded
       polarityInv 0 = TS_GENFn is asserted low
                   1 = TS_GENFn is asserted high
       ppmAdjust   PPM adjustment value
       ppmDir      CSL_CPTS_TS_PPM_DIR_INCREASE(0) = A single RCLK is added to
                   the generate function counter at the PPM rate which has the
                   effect of decreasing the generate function frequency by the
                   PPM amount.
                   CSL_CPTS_TS_PPM_DIR_DECREASE(1) = A single RCLK is subtracted
                   from the generate function counter at the PPM rate which
                   has the effect of increasing the generate function
                   frequency by the PPM amount.
*   

Return Value
0 = success
-1 = genfIndex is invalid (outside of the valid range)

Pre Condition
None.

Post Condition
None

Affects
CPTS_TS_GENF_LENGTH_REG_LENGTH
CPTS_TS_GENF_COMP_LOW_REG_COMP_LOW
CPTS_TS_GENF_COMP_HIGH_REG_COMP_HIGH
CPTS_TS_GENF_PPM_LOW_REG_PPM_LOW
CPTS_TS_GENF_PPM_HIGH_REG_PPM_HIGH
CPTS_TS_GENF_CONTROL_REG_PPM_DIR
CPTS_TS_GENF_CONTROL_REG_POLARITY_INV

Example

       uint64_t          tsGENFnCompVal;
       uint32_t          tsGENFnLen, tsGENFnIndex;

       tsGENFnIndex   = 0;
       tsGENFnCompVal = 0x3000U;
       tsGENFnLen     = 1000;

       CSL_CPTS_setupGENFn( pCptsRegs, tsGENFnIndex, tsGENFnLen, tsGENFnCompVal, 0, 0, CSL_CPTS_TS_PPM_DIR_INCREASE );

int32_t CSL_CPTS_setGENFnNudge ( CSL_cptsRegs *  pCptsRegs,
uint32_t  genfIndex,
int32_t  tsNudge 
)

============================================================================
CSL_CPTS_setGENFnNudge

Description
This function adjusts the GENFn cycle length by the specified 2's complement value. For example, a value of -2 will subtract 2 RCLKs from the ts_genfN_length[31:0] value. A value of 1 will add 1 RCLK to the ts_genfN_comp_length[23:0] value.

Arguments

       pCptsRegs   Pointer to CSL_cptsRegs structure
       genfIndex   Index of the GENFn to configure
       tsNudge     Nudge value
*   

Return Value
0 = success
-1 = genfIndex is invalid (outside of the valid range)

Pre Condition
None

Post Condition
None

Affects
CPTS_TS_GENF_NUDGE_REG_NUDGE

Example

       int32_t tsNudge = -2;

       CSL_CPTS_setGENFnNudge( pCptsRegs, tsNudge );

int32_t CSL_CPTS_getESTFnLength ( CSL_cptsRegs *  pCptsRegs,
uint32_t  estfIndex,
uint32_t *  pEstfLength 
)

============================================================================
CSL_CPTS_getESTFnLength

Description
This function retrieves the contents of the ESTFn length register.

Arguments

       pCptsRegs           Pointer to CSL_cptsRegs structure
       estfIndex           Index of the ESTFn to configure
       pEstfLength         ESTFn length value obtained from hardware
*   

Return Value
0 = success
-1 = estfIndex is invalid (outside of the valid range)

Pre Condition
None

Post Condition
None

Reads
CPTS_TS_ESTF_LENGTH_REG_LENGTH

Example

       uint32_t          estfLength, estfIndex;

    estfIndex = 0;

       CSL_CPTS_getESTFnLength (pCptsRegs, estfIndex, &estfLength);

int32_t CSL_CPTS_setupESTFn ( CSL_cptsRegs *  pCptsRegs,
uint32_t  estfIndex,
uint32_t  length,
uint64_t  compare,
uint32_t  polarityInv,
uint64_t  ppmAdjust,
CSL_CPTS_TS_PPM_DIR  ppmDir 
)

============================================================================
CSL_CPTS_setupESTFn

Description
This function sets the Time Stamp Compare Value of ESTFn and triggers the Time Stamp Comparsion operation.

Arguments

       pCptsRegs   Pointer to CSL_cptsRegs structure
       estfIndex   Index of the ESTFn to configure
       length      Length of the ESTFn output pulse in RCLK periods
       compare     Time stamp compare value (64-bit value) to be loaded
       polarityInv 0 = TS_ESTFn is asserted low
                   1 = TS_ESTFn is asserted high
       ppmAdjust   PPM adjustment value
       ppmDir      CSL_CPTS_TS_PPM_DIR_INCREASE(0) = A single RCLK is added to
                   the generate function counter at the PPM rate which has the
                   effect of decreasing the generate function frequency by the
                   PPM amount.
                   CSL_CPTS_TS_PPM_DIR_DECREASE(1) = A single RCLK is subtracted
                   from the generate function counter at the PPM rate which
                   has the effect of increasing the generate function
                   frequency by the PPM amount.
*   

Return Value
0 = success
-1 = estfIndex is invalid (outside of the valid range)

Pre Condition
None.

Post Condition
None

Affects
CPTS_TS_ESTF_LENGTH_REG_LENGTH
CPTS_TS_ESTF_COMP_LOW_REG_COMP_LOW
CPTS_TS_ESTF_COMP_HIGH_REG_COMP_HIGH
CPTS_TS_ESTF_PPM_LOW_REG_PPM_LOW
CPTS_TS_ESTF_PPM_HIGH_REG_PPM_HIGH
CPTS_TS_ESTF_CONTROL_REG_PPM_DIR
CPTS_TS_ESTF_CONTROL_REG_POLARITY_INV

Example

       uint64_t          tsESTFnCompVal;
       uint32_t          tsESTFnLen, tsESTFnIndex;

       tsESTFnIndex   = 0;
       tsESTFnCompVal = 0x3000U;
       tsESTFnLen     = 1000;

       CSL_CPTS_setupESTFn( pCptsRegs, tsESTFnIndex, tsESTFnLen, tsESTFnCompVal, 0, 0, CSL_CPTS_TS_PPM_DIR_INCREASE );

int32_t CSL_CPTS_setESTFnNudge ( CSL_cptsRegs *  pCptsRegs,
uint32_t  estfIndex,
int32_t  tsNudge 
)

============================================================================
CSL_CPTS_setESTFnNudge

Description
This function adjusts the ESTFn cycle length by the specified 2's complement value. For example, a value of -2 will subtract 2 RCLKs from the ts_ESTFn_length[31:0] value. A value of 1 will add 1 RCLK to the ts_ESTFn_comp_length[23:0] value.

Arguments

       pCptsRegs   Pointer to CSL_cptsRegs structure
       estfIndex   Index of the ESTFn to configure
       tsNudge     Nudge value
*   

Return Value
0 = success
-1 = estfIndex is invalid (outside of the valid range)

Pre Condition
None

Post Condition
None

Affects
CPTS_TS_ESTF_NUDGE_REG_NUDGE

Example

       int32_t tsNudge = -2;

       CSL_CPTS_setESTFnNudge( pCptsRegs, tsNudge );