AM64x MCU+ SDK  10.00.00
icss_timeSyncApi.h File Reference

Go to the source code of this file.

Data Structures

struct  timeStamp
 802.1AS-rev Timestamp structure More...
 
struct  ExtendedTimestamp
 802.1AS-rev ExtendedTimestamp More...
 
struct  TimeSync_parent_params_t
 Parent clock params. More...
 
struct  TimeSync_master_params_t
 Master and grand master clock params. More...
 
struct  TimeSync_frame_buffers_t
 Time synchronization configuration structure. More...
 
struct  TimeSync_Config_t
 Time synchronization configuration structure. More...
 
struct  timeSync_RuntimeVar_t
 Runtime variables for Time Sync implementation. More...
 
struct  timeSync_Offset_Stable_Algo_t
 Variables used for offset stabilization algorithm. More...
 
struct  syncParam_t
 Parameters required for calculating Cable Delay. More...
 
struct  timeSync_SyntInfo_t
 Parameters required for clock syntonization. More...
 
struct  timeSync_NrrInfo_t
 Parameters required for calculating Nighbor Rate Ratio. More...
 
struct  delayReqRespParams_t
 Parameters required for calculating Cable Delay. More...
 
struct  peerDelayParams_t
 Parameters required for calculating Cable Delay. More...
 
struct  ipParams_t
 Used to populate IP/UDP Parameters. These must be populated from Switch params. More...
 
struct  ptpDparams_t
 PTPd stack parameters. More...
 
struct  TimeSync_ParamsHandle
 Time synchronization parameter handle structure. More...
 

Macros

#define lswap(x)
 
#define htonl_ts(l)   (lswap(l))
 
#define ntohl_ts(l)   (lswap(l))
 
#define htons_ts(s)   ((u_short)((u_short)(s) >> 8) | (u_short)((u_short)(s) << 8))
 
#define ntohs_ts(s)   htons_ts(s)
 
#define TASK_STACK_SIZE   (2048)
 
#define ICSS_TIMESYNC_EVENT_BIT0   (0x000001)
 
#define ICSS_TIMESYNC_EVENT_BIT1   (0x000002)
 
#define ICSS_TIMESYNC_EVENT_BIT2   (0x000004)
 
#define ICSS_TIMESYNC_EVENT_BIT3   (0x000008)
 
#define ICSS_TIMESYNC_EVENT_BIT4   (0x000010)
 
#define ICSS_TIMESYNC_EVENT_BIT5   (0x000020)
 
#define ICSS_TIMESYNC_EVENT_BIT6   (0x000040)
 
#define ICSS_TIMESYNC_EVENT_BIT7   (0x000080)
 
#define SYNT_DEPTH   3
 
#define TS_NUM_DOMAINS   1
 
#define TS_STATE_MACHINE_FIRST_ADJUSTMENT_DONE   1
 
#define TS_STATE_MACHINE_LINE_DELAY_COMPUTED   2
 
#define TS_STATE_MACHINE_SYNC_INTERVAL_COMPUTED   4
 
#define TS_STATE_MACHINE_READY_FOR_SYNC   7
 
#define TS_STATE_MACHINE_DEVICE_IN_SYNC   8
 
#define OFFSET_ALGO_BIN_SIZE   5
 
#define OFFSET_ALGO_CLUSTER_SIZE   3
 
#define TIMESYNC_OK   (0)
 
#define ERROR_TX_FRAMETYPE_NOTVALID   (-1)
 
#define ERROR_TX_PORTNUMBER_NOTVALID   (-2)
 
#define ERROR_HANDLE_INVALID   (-3)
 
#define ERROR_RX_FRAMETYPE_NOTVALID   (-4)
 
#define ERROR_RX_PORTNUMBER_NOTVALID   (-5)
 

Typedefs

typedef void(* TimeSync_SyncLossCallBack_t) (void)
 Sync loss callback function. Call cross module functions in case of loss of synchronization. More...
 
typedef void(* TimeSync_stackResetCallback_t) (void *arg)
 PTP Stack Reset callback function. Timesync handle (of type TimeSync_ParamsHandle_t) will be passed as arg. More...
 
typedef struct TimeSync_ParamsHandle_s * TimeSync_ParamsHandle_t
 

Enumerations

enum  port_State {
  INITIALIZING = 1, FAULTY = 2, DISABLED = 3, LISTENING = 4,
  PRE_MASTER = 5, MASTER = 6, PASSIVE = 7, UNCALIBRATED = 8,
  SLAVE = 9
}
 Port States, from IEEE 1588v2. More...
 
enum  netWorkProtType {
  UDP_IPV4 = 1, UDP_IPV6 = 2, IEEE_802_3 = 3, DEVICE_NET = 4,
  CONTROL_NET = 5, PROFINET = 6, UNKNOWN = 0xFFFE
}
 Network Protocol Type. More...
 
enum  deviceConfig { TC = 1, OC = 2, BOTH = 3 }
 Current Device configuration. More...
 
enum  delayType { E2E = 1, P2P = 2 }
 PTP Delay Mechanism Type. From Table 9 of Standard. More...
 
enum  ptpFrameTypes_t { NON_SYNC_DELAY_FRAME = 0, SYNC_FRAME = 1, DELAY_REQ_FRAME = 2, DELAY_RESP_FRAME = 3 }
 PTP Delay Mechanism Type. From Table 9 of Standard. More...
 
enum  timeSource {
  ATOMIC_CLOCK = 0x10, GPS = 0x20, TERRESTRIAL_RADIO = 0x30, PTP = 0x40,
  NTP = 0x50, HAND_SET = 0x60, OTHER = 0x90, INTERNAL_OSCILLATOR = 0xA0
}
 802.1AS-rev Enumeration8 More...
 

Functions

int32_t TimeSync_getRxTimestamp (TimeSync_ParamsHandle_t timeSyncParamsHandle, ptpFrameTypes_t rxFrameType, uint8_t rxPort, uint32_t *nanoseconds, uint64_t *seconds)
 Reads and provides timestamp of a received event message. More...
 
int32_t TimeSync_getRxTimestampFromFrame (TimeSync_ParamsHandle_t timeSyncParamsHandle, uint8_t rxPort, uint32_t *nanoseconds, uint64_t *seconds, uint8_t *TimeStampFromFrame)
 Reads and provides timestamp of a received event message. More...
 
int32_t TimeSync_config (TimeSync_ParamsHandle_t timeSyncHandle)
 Function to configure domain number and/or log message intervals and/or sync0 signal start time, pulse width. More...
 
int32_t TimeSync_getTxTimestamp (TimeSync_ParamsHandle_t timeSyncParamsHandle, ptpFrameTypes_t txFrameType, uint8_t txPort, uint32_t *nanoseconds, uint64_t *seconds)
 Reads and provides timestamp of a transmitted event message. More...
 
int8_t TimeSync_adjTimeSlowComp (TimeSync_ParamsHandle_t timeSyncParamsHandle, int32_t adjOffset)
 Adjusts the IEP clock by the drift value over one Sync interval. More...
 
int32_t TimeSync_setClockTime (TimeSync_ParamsHandle_t timeSyncParamsHandle)
 Configures the driver memory. More...
 
void TimeSync_getCurrentTime (TimeSync_ParamsHandle_t timeSyncParamsHandle, uint32_t *nanoseconds, uint64_t *seconds)
 Returns the current time on device. More...
 
void TimeSync_updateDomainNumberInPTPFrames (TimeSync_ParamsHandle_t timeSyncHandle)
 Update PTP domain number in TX Buffers. More...
 
void TimeSync_updateLogMessageIntervalInPTPFrames (TimeSync_ParamsHandle_t timeSyncHandle)
 Update log message interval in PTP TX buffers. More...
 
void TimeSync_updateDscpValueInDelayRequestFrame (TimeSync_ParamsHandle_t timeSyncHandle, uint8_t dscpValue)
 Update DSCP value in IP header in PTP Delay Request buffer. More...
 

Macro Definition Documentation

◆ lswap

#define lswap (   x)
Value:
((((x) & 0xff000000) >> 24) | \
(((x) & 0x00ff0000) >> 8) | \
(((x) & 0x0000ff00) << 8) | \
(((x) & 0x000000ff) << 24))

◆ htonl_ts

#define htonl_ts (   l)    (lswap(l))

◆ ntohl_ts

#define ntohl_ts (   l)    (lswap(l))

◆ htons_ts

#define htons_ts (   s)    ((u_short)((u_short)(s) >> 8) | (u_short)((u_short)(s) << 8))

◆ ntohs_ts

#define ntohs_ts (   s)    htons_ts(s)

◆ TASK_STACK_SIZE

#define TASK_STACK_SIZE   (2048)

◆ ICSS_TIMESYNC_EVENT_BIT0

#define ICSS_TIMESYNC_EVENT_BIT0   (0x000001)

◆ ICSS_TIMESYNC_EVENT_BIT1

#define ICSS_TIMESYNC_EVENT_BIT1   (0x000002)

◆ ICSS_TIMESYNC_EVENT_BIT2

#define ICSS_TIMESYNC_EVENT_BIT2   (0x000004)

◆ ICSS_TIMESYNC_EVENT_BIT3

#define ICSS_TIMESYNC_EVENT_BIT3   (0x000008)

◆ ICSS_TIMESYNC_EVENT_BIT4

#define ICSS_TIMESYNC_EVENT_BIT4   (0x000010)

◆ ICSS_TIMESYNC_EVENT_BIT5

#define ICSS_TIMESYNC_EVENT_BIT5   (0x000020)

◆ ICSS_TIMESYNC_EVENT_BIT6

#define ICSS_TIMESYNC_EVENT_BIT6   (0x000040)

◆ ICSS_TIMESYNC_EVENT_BIT7

#define ICSS_TIMESYNC_EVENT_BIT7   (0x000080)

◆ SYNT_DEPTH

#define SYNT_DEPTH   3

Syntonization depth. No. of timestamps stored to do RCF & NRR calculation

◆ TS_NUM_DOMAINS

#define TS_NUM_DOMAINS   1

Number of domains supported by implementation

◆ TS_STATE_MACHINE_FIRST_ADJUSTMENT_DONE

#define TS_STATE_MACHINE_FIRST_ADJUSTMENT_DONE   1

Bit 0. Indicates that driver has copied TS value directly to IEP registers

◆ TS_STATE_MACHINE_LINE_DELAY_COMPUTED

#define TS_STATE_MACHINE_LINE_DELAY_COMPUTED   2

Bit 1. Indicates that Peer delay or Line delay (in case of E2E) has been computed

◆ TS_STATE_MACHINE_SYNC_INTERVAL_COMPUTED

#define TS_STATE_MACHINE_SYNC_INTERVAL_COMPUTED   4

Bit 2. Sync interval computed

◆ TS_STATE_MACHINE_READY_FOR_SYNC

#define TS_STATE_MACHINE_READY_FOR_SYNC   7

Mask for all three bits. Indicates that driver is now ready to do synchronization

◆ TS_STATE_MACHINE_DEVICE_IN_SYNC

#define TS_STATE_MACHINE_DEVICE_IN_SYNC   8

Bit 3. Device is in sync with master This is continuously monitored

◆ OFFSET_ALGO_BIN_SIZE

#define OFFSET_ALGO_BIN_SIZE   5

Bin size used for stabilization algo See design doc for details

◆ OFFSET_ALGO_CLUSTER_SIZE

#define OFFSET_ALGO_CLUSTER_SIZE   3

Number of entries used for clustering See design doc for details

◆ TIMESYNC_OK

#define TIMESYNC_OK   (0)

◆ ERROR_TX_FRAMETYPE_NOTVALID

#define ERROR_TX_FRAMETYPE_NOTVALID   (-1)

◆ ERROR_TX_PORTNUMBER_NOTVALID

#define ERROR_TX_PORTNUMBER_NOTVALID   (-2)

◆ ERROR_HANDLE_INVALID

#define ERROR_HANDLE_INVALID   (-3)

◆ ERROR_RX_FRAMETYPE_NOTVALID

#define ERROR_RX_FRAMETYPE_NOTVALID   (-4)

◆ ERROR_RX_PORTNUMBER_NOTVALID

#define ERROR_RX_PORTNUMBER_NOTVALID   (-5)

Typedef Documentation

◆ TimeSync_SyncLossCallBack_t

typedef void(* TimeSync_SyncLossCallBack_t) (void)

Sync loss callback function. Call cross module functions in case of loss of synchronization.

◆ TimeSync_stackResetCallback_t

typedef void(* TimeSync_stackResetCallback_t) (void *arg)

PTP Stack Reset callback function. Timesync handle (of type TimeSync_ParamsHandle_t) will be passed as arg.

◆ TimeSync_ParamsHandle_t

typedef struct TimeSync_ParamsHandle_s* TimeSync_ParamsHandle_t

Enumeration Type Documentation

◆ port_State

enum port_State

Port States, from IEEE 1588v2.

Enumerator
INITIALIZING 
FAULTY 
DISABLED 
LISTENING 
PRE_MASTER 
MASTER 
PASSIVE 
UNCALIBRATED 
SLAVE 

◆ netWorkProtType

Network Protocol Type.

Enumerator
UDP_IPV4 

IPv4

UDP_IPV6 

IPv6

IEEE_802_3 

Ethernet without TCP/IP

DEVICE_NET 
CONTROL_NET 
PROFINET 
UNKNOWN 

◆ deviceConfig

Current Device configuration.

Enumerator
TC 

Only Transparent Clock

OC 

Only Ordinary Clock

BOTH 

Both OC and TC

◆ delayType

enum delayType

PTP Delay Mechanism Type. From Table 9 of Standard.

Enumerator
E2E 

Used for CIP Sync

P2P 

Used for IEC 61558

◆ ptpFrameTypes_t

PTP Delay Mechanism Type. From Table 9 of Standard.

Enumerator
NON_SYNC_DELAY_FRAME 

Non Sync or Delay Req/Res frame

SYNC_FRAME 

SYNC Frame

DELAY_REQ_FRAME 

Delay Request Frame

DELAY_RESP_FRAME 

Delay Response Frame

◆ timeSource

enum timeSource

802.1AS-rev Enumeration8

Enumerator
ATOMIC_CLOCK 
GPS 
TERRESTRIAL_RADIO 
PTP 
NTP 
HAND_SET 
OTHER 
INTERNAL_OSCILLATOR