AM263Px MCU+ SDK: CPSW CPTS

| AM263Px MCU+ SDK 26.00.00 |

Data Structures | Functions | Typedefs | Enumerations | Macros
CPSW CPTS
APIs for Networking modules » APIs for Enet LLD » Enet Time Synchronization

## Introduction

The CPSW CPTS module provides additional IOCTL commands than those supported by the generic Enet Time Synchronization API set.

CPSW CPTS clocks:

Interrupts:

- CPSW_EVNT_PEND - Event pending interrupt.

SoC parameters:

- CpswCpts_Obj::hwPushCnt - Maximum hardware push instances in hardware.

Errata:

- CPSW_CPTS_ERRATA_GENFN_RECONFIG - GENFn/ESTFn reconfiguration bug.

Compile-time configuration:

- ENET_CFG_CPSW_CPTS_EVENTS_POOL_SIZE - Maximum size of CPTS event pool.
- ENET_CFG_CPSW_CPTS_STATS - Event counter (software) statistics. CPTS statistics can be printed via ENET_TIMESYNC_IOCTL_PRINT_STATS.

## Data Structures
struct | CpswCpts_Event
| CPTS event. More...
struct | CpswCpts_EstEventMatchParams
| CPTS EST event match params. More...
struct | CpswCpts_EstEvent
| CPTS EST timestamp. More...
struct | CpswCpts_RegisterStackInArgs
| Input args for CPSW_CPTS_IOCTL_REGISTER_STACK command. More...
struct | CpswCpts_RegisterHwPushCbInArgs
| Input args for CPSW_CPTS_IOCTL_REGISTER_HWPUSH_CALLBACK command. More...
struct | CpswCpts_SetCompValInArgs
| Input args for CPSW_CPTS_IOCTL_SET_COMP command. More...
struct | CpswCpts_SetFxnGenInArgs
| Input args for CPSW_CPTS_IOCTL_SET_GENF and CPSW_CPTS_IOCTL_SET_ESTF commands. More...
struct | CpswCpts_SetFxnGenNudgeInArgs
| Input args for CPSW_CPTS_IOCTL_SET_GENF_NUDGE and CPSW_CPTS_IOCTL_SET_ESTF_NUDGE commands. More...
struct | CpswCpts_Cfg
| CPTS configuration. More...

## Functions
void | CpswCpts_initCfg (CpswCpts_Cfg *cptsCfg)
| Initialize CPSW CPTS configuration parameters. More...

## Typedefs
typedef void(* | CpswCpts_EventNotifyCb) (void *eventNotifyCbArg, CpswCpts_Event *eventInfo)
| CPTS event notify callback. More...
typedef void(* | CpswCpts_HwPushNotifyCb) (void *hwPushNotifyCbArg, CpswCpts_HwPush hwPushNum)
| CPTS hardware push notify callback/. More...

## Enumerations
enum | CpswCpts_Ioctl { CPSW_CPTS_IOCTL_REGISTER_STACK = CPSW_CPTS_PUBLIC_IOCTL(0U), CPSW_CPTS_IOCTL_UNREGISTER_STACK = CPSW_CPTS_PUBLIC_IOCTL(1U), CPSW_CPTS_IOCTL_REGISTER_HWPUSH_CALLBACK = CPSW_CPTS_PUBLIC_IOCTL(2U), CPSW_CPTS_IOCTL_UNREGISTER_HWPUSH_CALLBACK = CPSW_CPTS_PUBLIC_IOCTL(3U), CPSW_CPTS_IOCTL_SET_TS_NUDGE = CPSW_CPTS_PUBLIC_IOCTL(4U), CPSW_CPTS_IOCTL_SET_COMP = CPSW_CPTS_PUBLIC_IOCTL(5U), CPSW_CPTS_IOCTL_SET_COMP_NUDGE = CPSW_CPTS_PUBLIC_IOCTL(6U), CPSW_CPTS_IOCTL_SET_GENF = CPSW_CPTS_PUBLIC_IOCTL(7U), CPSW_CPTS_IOCTL_SET_GENF_NUDGE = CPSW_CPTS_PUBLIC_IOCTL(8U), CPSW_CPTS_IOCTL_SET_ESTF = CPSW_CPTS_PUBLIC_IOCTL(9U), CPSW_CPTS_IOCTL_SET_ESTF_NUDGE = CPSW_CPTS_PUBLIC_IOCTL(10U), CPSW_CPTS_IOCTL_SELECT_TS_OUTPUT_BIT = CPSW_CPTS_PUBLIC_IOCTL(11U), CPSW_CPTS_IOCTL_LOOKUP_EVENT = CPSW_CPTS_PUBLIC_IOCTL(12U), CPSW_CPTS_IOCTL_LOOKUP_EST_EVENT = CPSW_CPTS_PUBLIC_IOCTL(13U) }
| CPSW CPTS IOCTL commands. More...
enum | CpswCpts_RftClkFreq { CPSW_CPTS_RFTCLK_FREQ_1000MHZ = 0U, CPSW_CPTS_RFTCLK_FREQ_500MHZ = 1U, CPSW_CPTS_RFTCLK_FREQ_333_33MHZ = 2U, CPSW_CPTS_RFTCLK_FREQ_250MHZ = 3U, CPSW_CPTS_RFTCLK_FREQ_200MHZ = 4U, CPSW_CPTS_RFTCLK_FREQ_166_66MHZ = 5U, CPSW_CPTS_RFTCLK_FREQ_142_85MHZ = 6U, CPSW_CPTS_RFTCLK_FREQ_125MHZ = 7U }
| CPTS clock frequency add value. More...
enum | CpswCpts_EventType { CPSW_CPTS_EVENTTYPE_TS_PUSH = 0U, CPSW_CPTS_EVENTTYPE_TS_ROLLOVER, CPSW_CPTS_EVENTTYPE_TS_HALFROLLOVER, CPSW_CPTS_EVENTTYPE_HW_TS_PUSH, CPSW_CPTS_EVENTTYPE_ETH_RECEIVE, CPSW_CPTS_EVENTTYPE_ETH_TRANSMIT, CPSW_CPTS_EVENTTYPE_TS_COMP, CPSW_CPTS_EVENTTYPE_TS_HOST_TX, CPSW_CPTS_EVENTTYPE_INVALID = -1 }
| CPTS event type. More...
enum | CpswCpts_OutputBitSel { CPSW_CPTS_TS_OUTPUT_BIT_DISABLED = 0U, CPSW_CPTS_TS_OUTPUT_BIT_17, CPSW_CPTS_TS_OUTPUT_BIT_18, CPSW_CPTS_TS_OUTPUT_BIT_19, CPSW_CPTS_TS_OUTPUT_BIT_20, CPSW_CPTS_TS_OUTPUT_BIT_21, CPSW_CPTS_TS_OUTPUT_BIT_22, CPSW_CPTS_TS_OUTPUT_BIT_23, CPSW_CPTS_TS_OUTPUT_BIT_24, CPSW_CPTS_TS_OUTPUT_BIT_25, CPSW_CPTS_TS_OUTPUT_BIT_26, CPSW_CPTS_TS_OUTPUT_BIT_27, CPSW_CPTS_TS_OUTPUT_BIT_28, CPSW_CPTS_TS_OUTPUT_BIT_29, CPSW_CPTS_TS_OUTPUT_BIT_30, CPSW_CPTS_TS_OUTPUT_BIT_31 }
| CPTS time stamp output bit. More...
enum | CpswCpts_HwPush { CPSW_CPTS_HWPUSH_FIRST = 1U, CPSW_CPTS_HWPUSH_1 = CPSW_CPTS_HWPUSH_FIRST, CPSW_CPTS_HWPUSH_2, CPSW_CPTS_HWPUSH_3, CPSW_CPTS_HWPUSH_4, CPSW_CPTS_HWPUSH_5, CPSW_CPTS_HWPUSH_6, CPSW_CPTS_HWPUSH_7, CPSW_CPTS_HWPUSH_8, CPSW_CPTS_HWPUSH_LAST = CPSW_CPTS_HWPUSH_8, CPSW_CPTS_HWPUSH_INVALID = -1 }
| CPTS Hardware push instances. More...
enum | CpswCpts_FxnGenAdjDir { CPSW_CPTS_GENF_PPM_ADJDIR_DECREASE = 0U, CPSW_CPTS_GENF_PPM_ADJDIR_INCREASE }
| Genf adjustment direction. More...

## Macros
#define | CPSW_CPTS_PUBLIC_IOCTL(x)
| Helper macro to create IOCTL commands for CPSW CPTS module. More...
#define | CPSW_CPTS_NUDGE_MIN_VAL (-128)
| Minimum nudge value. More...
#define | CPSW_CPTS_NUDGE_MAX_VAL (127)
| Maximum nudge value. More...
#define | CPSW_CPTS_HWPUSH_COUNT_MAX ((uint32_t)CPSW_CPTS_HWPUSH_LAST)
| Max number of hardware push instances. More...
#define | CPSW_CPTS_HWPUSH_NORM(x) ((uint32_t)((x) - CPSW_CPTS_HWPUSH_FIRST))
| Helper macro to normalize CpswCpts_HwPush values. More...

## Macro Definition Documentation

## ◆ CPSW_CPTS_PUBLIC_IOCTL

#define CPSW_CPTS_PUBLIC_IOCTL | ( |  | x | ) |

Value:
(ENET_IOCTL_TYPE_PUBLIC | \
ENET_IOCTL_TIMESYNC_BASE | \
ENET_IOCTL_PER_CPSW | \
ENET_IOCTL_MIN(x))

Helper macro to create IOCTL commands for CPSW CPTS module.

## ◆ CPSW_CPTS_NUDGE_MIN_VAL

#define CPSW_CPTS_NUDGE_MIN_VAL (-128)

Minimum nudge value.

## ◆ CPSW_CPTS_NUDGE_MAX_VAL

#define CPSW_CPTS_NUDGE_MAX_VAL (127)

Maximum nudge value.

## ◆ CPSW_CPTS_HWPUSH_COUNT_MAX

#define CPSW_CPTS_HWPUSH_COUNT_MAX ((uint32_t)CPSW_CPTS_HWPUSH_LAST)

Max number of hardware push instances.

## ◆ CPSW_CPTS_HWPUSH_NORM

#define CPSW_CPTS_HWPUSH_NORM | ( |  | x | ) | ((uint32_t)((x) - CPSW_CPTS_HWPUSH_FIRST))

Helper macro to normalize CpswCpts_HwPush values.

## Typedef Documentation

## ◆ CpswCpts_EventNotifyCb

typedef void(* CpswCpts_EventNotifyCb) (void *eventNotifyCbArg, CpswCpts_Event *eventInfo)

CPTS event notify callback.

Parameters

  eventNotifyCbArg | Callback argument
  eventInfo | CPTS event information

## ◆ CpswCpts_HwPushNotifyCb

typedef void(* CpswCpts_HwPushNotifyCb) (void *hwPushNotifyCbArg, CpswCpts_HwPush hwPushNum)

CPTS hardware push notify callback/.

Parameters

  hwPushNotifyCbArg | Callback argument
  hwPushNum | CPTS hardware push instance number

## Enumeration Type Documentation

## ◆ CpswCpts_Ioctl

enum CpswCpts_Ioctl

CPSW CPTS IOCTL commands.

Enumerator
CPSW_CPTS_IOCTL_REGISTER_STACK | CPTS register stack. IOCTL parameters: inArgs: CpswCpts_RegisterStackInArgs outArgs: None
CPSW_CPTS_IOCTL_UNREGISTER_STACK | CPTS unregister stack. IOCTL parameters: inArgs: None outArgs: None
CPSW_CPTS_IOCTL_REGISTER_HWPUSH_CALLBACK | CPTS register hardware push event callback. IOCTL parameters: inArgs: CpswCpts_RegisterHwPushCbInArgs outArgs: None
CPSW_CPTS_IOCTL_UNREGISTER_HWPUSH_CALLBACK | CPTS unregister hardware push event callback. IOCTL parameters: inArgs: CpswCpts_HwPush outArgs: None
CPSW_CPTS_IOCTL_SET_TS_NUDGE | CPTS set timestamp nudge. Sets time nudge value. Nudge value must be within the range of CPSW_CPTS_NUDGE_MIN_VAL and CPSW_CPTS_NUDGE_MAX_VAL. IOCTL parameters: inArgs: int32_t outArgs: None
CPSW_CPTS_IOCTL_SET_COMP | CPTS set compare value. IOCTL parameters: inArgs: CpswCpts_SetCompValInArgs outArgs: None
CPSW_CPTS_IOCTL_SET_COMP_NUDGE | CPTS set compare nudge. IOCTL parameters: inArgs: int32_t outArgs: None
CPSW_CPTS_IOCTL_SET_GENF | CPTS set function generator. IOCTL parameters: inArgs: CpswCpts_SetFxnGenInArgs outArgs: None
CPSW_CPTS_IOCTL_SET_GENF_NUDGE | CPTS set GenFn stamp nudge. IOCTL parameters: inArgs: CpswCpts_SetFxnGenNudgeInArgs outArgs: None
CPSW_CPTS_IOCTL_SET_ESTF | CPTS set EST function generator. IOCTL parameters: inArgs: CpswCpts_SetFxnGenInArgs outArgs: None
CPSW_CPTS_IOCTL_SET_ESTF_NUDGE | CPTS set ESTFn stamp nudge. IOCTL parameters: inArgs: CpswCpts_SetFxnGenNudgeInArgs outArgs: None
CPSW_CPTS_IOCTL_SELECT_TS_OUTPUT_BIT | CPTS TS output bit select. IOCTL parameters: inArgs: CpswCpts_OutputBitSel outArgs: None
CPSW_CPTS_IOCTL_LOOKUP_EVENT | CPTS lookup event. IOCTL parameters: inArgs: CpswCpts_Event outArgs: CpswCpts_Event
CPSW_CPTS_IOCTL_LOOKUP_EST_EVENT | CPTS lookup EST event/. IOCTL parameters: inArgs: CpswCpts_EstEventMatchParams outArgs: CpswCpts_EstEvent

## ◆ CpswCpts_RftClkFreq

enum CpswCpts_RftClkFreq

CPTS clock frequency add value.

Enumerator
CPSW_CPTS_RFTCLK_FREQ_1000MHZ | CPTS reference clock frequency: 1000MHz
CPSW_CPTS_RFTCLK_FREQ_500MHZ | CPTS reference clock frequency: 500MHz
CPSW_CPTS_RFTCLK_FREQ_333_33MHZ | CPTS reference clock frequency: 333.33MHz
CPSW_CPTS_RFTCLK_FREQ_250MHZ | CPTS reference clock frequency: 250MHz
CPSW_CPTS_RFTCLK_FREQ_200MHZ | CPTS reference clock frequency: 200MHz
CPSW_CPTS_RFTCLK_FREQ_166_66MHZ | CPTS reference clock frequency: 166.66MHz
CPSW_CPTS_RFTCLK_FREQ_142_85MHZ | CPTS reference clock frequency: 142.85MHz
CPSW_CPTS_RFTCLK_FREQ_125MHZ | CPTS reference clock frequency: 125MHz

## ◆ CpswCpts_EventType

enum CpswCpts_EventType

CPTS event type.

Enumerator
CPSW_CPTS_EVENTTYPE_TS_PUSH | CPTS software time stamp push event
CPSW_CPTS_EVENTTYPE_TS_ROLLOVER | CPTS time stamp rollover event (32-bit mode only)
CPSW_CPTS_EVENTTYPE_TS_HALFROLLOVER | CPTS time stamp half rollover event (32-bit mode only)
CPSW_CPTS_EVENTTYPE_HW_TS_PUSH | CPTS hardware time stamp push event
CPSW_CPTS_EVENTTYPE_ETH_RECEIVE | CPTS Ethernet receive event
CPSW_CPTS_EVENTTYPE_ETH_TRANSMIT | CPTS Ethernet transmit event
CPSW_CPTS_EVENTTYPE_TS_COMP | CPTS time stamp compare event
CPSW_CPTS_EVENTTYPE_TS_HOST_TX | CPTS time stamp host transmit event
CPSW_CPTS_EVENTTYPE_INVALID | Invalid event

## ◆ CpswCpts_OutputBitSel

enum CpswCpts_OutputBitSel

CPTS time stamp output bit.

Enumerator
CPSW_CPTS_TS_OUTPUT_BIT_DISABLED | CPTS time stamp output bit selection disabled
CPSW_CPTS_TS_OUTPUT_BIT_17 | CPTS select time stamp output bit 17
CPSW_CPTS_TS_OUTPUT_BIT_18 | CPTS select time stamp output bit 18
CPSW_CPTS_TS_OUTPUT_BIT_19 | CPTS select time stamp output bit 19
CPSW_CPTS_TS_OUTPUT_BIT_20 | CPTS select time stamp output bit 20
CPSW_CPTS_TS_OUTPUT_BIT_21 | CPTS select time stamp output bit 21
CPSW_CPTS_TS_OUTPUT_BIT_22 | CPTS select time stamp output bit 22
CPSW_CPTS_TS_OUTPUT_BIT_23 | CPTS select time stamp output bit 23
CPSW_CPTS_TS_OUTPUT_BIT_24 | CPTS select time stamp output bit 24
CPSW_CPTS_TS_OUTPUT_BIT_25 | CPTS select time stamp output bit 25
CPSW_CPTS_TS_OUTPUT_BIT_26 | CPTS select time stamp output bit 26
CPSW_CPTS_TS_OUTPUT_BIT_27 | CPTS select time stamp output bit 27
CPSW_CPTS_TS_OUTPUT_BIT_28 | CPTS select time stamp output bit 28
CPSW_CPTS_TS_OUTPUT_BIT_29 | CPTS select time stamp output bit 29
CPSW_CPTS_TS_OUTPUT_BIT_30 | CPTS select time stamp output bit 30
CPSW_CPTS_TS_OUTPUT_BIT_31 | CPTS select time stamp output bit 31

## ◆ CpswCpts_HwPush

enum CpswCpts_HwPush

CPTS Hardware push instances.

Enumerator
CPSW_CPTS_HWPUSH_FIRST | First hardware push instance
CPSW_CPTS_HWPUSH_1 | Hardware push instance 1
CPSW_CPTS_HWPUSH_2 | Hardware push instance 2
CPSW_CPTS_HWPUSH_3 | Hardware push instance 3
CPSW_CPTS_HWPUSH_4 | Hardware push instance 4
CPSW_CPTS_HWPUSH_5 | Hardware push instance 5
CPSW_CPTS_HWPUSH_6 | Hardware push instance 6
CPSW_CPTS_HWPUSH_7 | Hardware push instance 7
CPSW_CPTS_HWPUSH_8 | Hardware push instance 8
CPSW_CPTS_HWPUSH_LAST | Last hardware push instance
CPSW_CPTS_HWPUSH_INVALID | Invalid hardware push instance

## ◆ CpswCpts_FxnGenAdjDir

enum CpswCpts_FxnGenAdjDir

Genf adjustment direction.

Enumerator
CPSW_CPTS_GENF_PPM_ADJDIR_DECREASE | Decrease the Genf frequency with adjustment value
CPSW_CPTS_GENF_PPM_ADJDIR_INCREASE | Increase the Genf frequency with adjustment value

## Function Documentation

## ◆ CpswCpts_initCfg()

void CpswCpts_initCfg | ( | CpswCpts_Cfg * | cptsCfg | ) |

Initialize CPSW CPTS configuration parameters.

Parameters

  cptsCfg | Configuration parameters to be initialized

ENET_IOCTL_TYPE_PUBLIC
@ ENET_IOCTL_TYPE_PUBLIC
Definition: enet_ioctl.h:216