# CPTS Functions
[Time Sync Submodule (CPTS)]

## Functions
CSL_IDEF_INLINE void | CSL_CPTS_getCptsVersionInfo (CSL_CPTS_VERSION *pVersionInfo)
CSL_IDEF_INLINE Uint32 | CSL_CPTS_isCptsEnabled (void)
CSL_IDEF_INLINE void | CSL_CPTS_enableCpts (void)
CSL_IDEF_INLINE void | CSL_CPTS_disableCpts (void)
CSL_IDEF_INLINE void | CSL_CPTS_getRFTCLKSelectReg (Uint32 *pRefClockSelect)
CSL_IDEF_INLINE void | CSL_CPTS_setRFTCLKSelectReg (Uint32 refClockSetVal)
CSL_IDEF_INLINE void | CSL_CPTS_getTSEventPushReg (Uint32 *pTSPushVal)
CSL_IDEF_INLINE void | CSL_CPTS_setTSEventPushReg (Uint32 tsPushVal)
CSL_IDEF_INLINE void | CSL_CPTS_getTSLoadValReg (Uint32 *pTSLoadVal)
CSL_IDEF_INLINE void | CSL_CPTS_setTSLoadValReg (Uint32 tsLoadVal)
CSL_IDEF_INLINE Uint32 | CSL_CPTS_isRawInterruptStatusBitSet (void)
CSL_IDEF_INLINE Uint32 | CSL_CPTS_isMaskedInterruptStatusBitSet (void)
CSL_IDEF_INLINE Uint32 | CSL_CPTS_isInterruptEnabled (void)
CSL_IDEF_INLINE void | CSL_CPTS_enableInterrupt (void)
CSL_IDEF_INLINE void | CSL_CPTS_disableInterrupt (void)
CSL_IDEF_INLINE void | CSL_CPTS_popEvent (void)
CSL_IDEF_INLINE void | CSL_CPTS_getEventInfo (CSL_CPTS_EVENTINFO *pEventInfo)

## Function Documentation

CSL_IDEF_INLINE void CSL_CPTS_disableCpts | ( | void |  | ) |

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

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

Arguments
None

Return Value
None

Pre Condition
None

Post Condition
None

Writes
CPTS_CONTROL_REG_CPTS_EN=0

Example

            CSL_CPTS_disableCpts ();

=============================================================================

CSL_IDEF_INLINE void CSL_CPTS_disableInterrupt | ( | void |  | ) |

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

Description
This function disables the interrupts in Time sync submodule.

Arguments
None

Return Value
None

Pre Condition
None

Post Condition
None

Writes
CPTS_INT_ENABLE_REG_TS_PEND_EN=0

Example

            CSL_CPTS_disableInterrupt ();

=============================================================================

CSL_IDEF_INLINE void CSL_CPTS_enableCpts | ( | void |  | ) |

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

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

Arguments
None

Return Value
None

Pre Condition
None

Post Condition
None

Writes
CPTS_CONTROL_REG_CPTS_EN=1

Example

            CSL_CPTS_enableCpts ();

=============================================================================

CSL_IDEF_INLINE void CSL_CPTS_enableInterrupt | ( | void |  | ) |

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

Description
This function enables the interrupts in Time sync submodule.

Arguments
None

Return Value
None

Pre Condition
None

Post Condition
None

Writes
CPTS_INT_ENABLE_REG_TS_PEND_EN=1

Example

            CSL_CPTS_enableInterrupt ();

=============================================================================

CSL_IDEF_INLINE void CSL_CPTS_getCptsVersionInfo | ( | CSL_CPTS_VERSION * | pVersionInfo | ) |

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

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

Arguments

            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 (&versionInfo);

=============================================================================

CSL_IDEF_INLINE void CSL_CPTS_getEventInfo | ( | CSL_CPTS_EVENTINFO * | pEventInfo | ) |

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

Description
This function retrieves the contents of the Event low and Event High registers.

Arguments

            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_HIGH_REG_SEQUENCE_ID, CPTS_EVENT_HIGH_REG_MESSAGE_TYPE, CPTS_EVENT_HIGH_REG_EVENT_TYPE, CPTS_EVENT_HIGH_REG_PORT_NUMBER

Example

            CSL_CPTS_EVENTINFO          eventInfo;

            CSL_CPTS_getEventInfo (&eventInfo);

=============================================================================

CSL_IDEF_INLINE void CSL_CPTS_getRFTCLKSelectReg | ( | Uint32 * | pRefClockSelect | ) |

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

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

Arguments

            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          refClockSelect;

            CSL_CPTS_getRFTCLKSelectReg (&refClockSelect);

=============================================================================

CSL_IDEF_INLINE void CSL_CPTS_getTSEventPushReg | ( | Uint32 * | pTSPushVal | ) |

============================================================================
CSL_CPTS_getTSEventPushReg

Description
This function retrieves the contents of the Time Stamp Event Push register.

Arguments

            pTSPushVal              Time stamp push value read from hardware.
     *

Return Value
None

Pre Condition
None

Post Condition
None

Reads
CPTS_TS_PUSH_REG_TS_PUSH

Example

            Uint32          tsPushVal;

            CSL_CPTS_getTSEventPushReg (&tsPushVal);

=============================================================================

CSL_IDEF_INLINE void CSL_CPTS_getTSLoadValReg | ( | Uint32 * | pTSLoadVal | ) |

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

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

Arguments

            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

Example

            Uint32          tsLoadVal;

            CSL_CPTS_getTSLoadValReg (&tsLoadVal);

=============================================================================

CSL_IDEF_INLINE Uint32 CSL_CPTS_isCptsEnabled | ( | void |  | ) |

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

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

Arguments
None

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 () == TRUE)
            {
                // CPTS on
            }
            else
            {
                // CPTS off
            }

=============================================================================

CSL_IDEF_INLINE Uint32 CSL_CPTS_isInterruptEnabled | ( | void |  | ) |

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

Description
This function indicates if Time sync interrupts are enabled.

Arguments
None

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 () == TRUE)
            {
               // interrupts enabled
            }
            else
            {
                // interrupts disabled
            }

=============================================================================

CSL_IDEF_INLINE Uint32 CSL_CPTS_isMaskedInterruptStatusBitSet | ( | void |  | ) |

============================================================================
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
None

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 () == TRUE)
            {
               // masked interrupt set
            }
            else
            {
                // masked interrupt bit not set
            }

=============================================================================

CSL_IDEF_INLINE Uint32 CSL_CPTS_isRawInterruptStatusBitSet | ( | void |  | ) |

============================================================================
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
None

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 () == TRUE)
            {
               // interrupt set
            }
            else
            {
                // interrupt bit not set
            }

=============================================================================

CSL_IDEF_INLINE void CSL_CPTS_popEvent | ( | void |  | ) |

============================================================================
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
None

Return Value
None

Pre Condition
None

Post Condition
None

Writes
CPTS_EVENT_POP_REG_EVENT_POP=1

Example

            CSL_CPTS_popEvent ();

=============================================================================

CSL_IDEF_INLINE void CSL_CPTS_setRFTCLKSelectReg | ( | Uint32 | 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

            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          refClockSelect;

            refClockSelect  =   0;

            CSL_CPTS_setRFTCLKSelectReg (refClockSelect);

=============================================================================

CSL_IDEF_INLINE void CSL_CPTS_setTSEventPushReg | ( | Uint32 | tsPushVal | ) |

============================================================================
CSL_CPTS_setTSEventPushReg

Description
This function sets up the contents of the Time Stamp Event Push register.

Arguments

            tsPushVal               Time stamp push value to configure.
     *

Return Value
None

Pre Condition
None

Post Condition
None

Affects
CPTS_TS_PUSH_REG_TS_PUSH

Example

            Uint32          tsPushVal;

            tsPushVal   =   0;

            CSL_CPTS_setTSEventPushReg (tsPushVal);

=============================================================================

CSL_IDEF_INLINE void CSL_CPTS_setTSLoadValReg | ( | Uint32 | tsLoadVal | ) |

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

Description
This function sets up the Time Stamp Load Value.

Arguments

            tsLoadVal               Time stamp load value to configure.
     *

Return Value
None

Pre Condition
None.

Post Condition
None

Affects
CPTS_TS_LOAD_VAL_REG_TS_LOAD_VAL

Example

            Uint32          tsLoadVal;

            tsLoadVal   =   0;

            CSL_CPTS_setTSLoadValReg (tsLoadVal);

=============================================================================

Copyright 2012, Texas Instruments Incorporated