emacps: xemacps_ieee1588.h File Reference

| emacps Xilinx SDK Drivers API Documentation

- Overview
- Data Structures
- APIs
- File List
- Examples

Functions
xemacps_ieee1588.h File Reference

## Overview

Defines hash defines, common data types and prototypes to be used with the PTP standalone example source code residing in this directory.

The PTP standalone example files implement the basic PTPv2 protocol as an example application. However the accuracy of clock offset adjustment is not guaranteed as of now. Also the clock rate adjustment and signalling frames are not implemented. Also it may not be implementing all aspects of PTPv2 strictly as per specs. Since it is based on AVB driver (which is 802.1as based), some aspects of 802.1as which are not there in IEEE1588 may be there in the protocol implementation inadvertently. The sync frame interval, announce frame interval and PDelayReq frame intervals are hard-coded.

    MODIFICATION HISTORY:

    Ver   Who  Date     Changes

    1.00a asa  09/16/11 First release based on AVB driver
    1.01a asa  03/03/12 New hashdefines are added and new function prototypes
                                              are added.
    3.3   asa  05/19/16 Fix for CR#951152. Made following changes.

    Removed code specific for PEEP.
    Ensured that each buffer in RxBuf array is cache
                          line aligned. The Rxbuf array itself is made cache
                          line aligned.
    The XEMACPS_PACKET_LEN is changed from 1538 to 1598.
                          Though the packet length can never be 1598 for
                          non-jumbo ethernet packets, it is changes to ensure
                          that each Rx buffer becomes cache line aligned.
                          If a Rx buffer is not cache line aligned, the
                          A9 based invalidation logic flushes the first cache
                          line to ensure that other data faling in this cache
                          line are not lost when the buffer in invalidated
                          upon reception of a packet. But that will also mean
                          the data received in this cache line is lost.
                          By making this change we always ensure that when an
                          invalidation happens no flushing takes place and no
                          incoming data is lost.
    Changes made not to disable and enable back the MMU
                          when we change the attribute of BD space to make it
                          strongly ordered.
    The number of Rx and Tx bufs are changed from 32 to 16
                          as for this simple example so many BDs will never
                          be needed.

## Functions
void | XEmacPs_PtpRxInterruptHandler (XEmacPs_Ieee1588 *InstancePtr)
| This function is the EmacPs Rx interrupt callback invoked from the EmacPs driver. More...
int | XEmacPs_PtpTxPacket (XEmacPs_Ieee1588 *InstancePtr, u8 *PacketBuf, int PacketLen)
| This function is initiates a PTP Tx. More...
u32 | XEmacPs_ComparePortIdentity (XEmacPs_PortIdentity Identity1, XEmacPs_PortIdentity Identity2)
| A function to compare two PortIdentity values. More...
u32 | XEmacPs_CompareClockIdentity (XEmacPs_ClockIdentity Identity1, XEmacPs_ClockIdentity Identity2)
| A function to compare two ClockIdentity values. More...
void | XEmacPs_MasterSendAnnounce (XEmacPs_Ieee1588 *InstancePtr)
| A function to format and then initiate the Tx of a PTP Announce Packet. More...
void | XEmacPs_MasterSendSync (XEmacPs_Ieee1588 *InstancePtr)
| A function to format and then initiate the Tx of a PTP SYNC Packet. More...
void | XEmacPs_MasterSendFollowUp (XEmacPs_Ieee1588 *InstancePtr)
| A function to format and then initiate the Tx of a PTP FOLLOWUP Packet. More...
void | XEmacPs_SendPDelayReq (XEmacPs_Ieee1588 *InstancePtr)
| A function to format and then initiate the Tx of a PTP PDelayReq Packet. More...
void | XEmacPs_SendPDelayResp (XEmacPs_Ieee1588 *InstancePtr)
| A function to format and then initiate the Tx of a PTP PDelayResp Packet. More...
void | XEmacPs_SendPDelayRespFollowUp (XEmacPs_Ieee1588 *InstancePtr)
| A function to format and then initiate the Tx of a PTP PDelayRespFollowUp Packet. More...
u32 | XEmacPs_IsRxFramePTP (u8 *PacketBuf)
| This function extracts length/type information from the Ethernet packet. More...
void | XEmacPs_DecodeRxSync (XEmacPs_Ieee1588 *InstancePtr, u8 *PacketBuf)
| A function to decode a received PTP Sync Packet. More...
void | XEmacPs_DecodeRxFollowUp (XEmacPs_Ieee1588 *InstancePtr, u8 *PacketBuf)
| A function to decode a received PTP FollowUp Packet. More...
void | XEmacPs_DecodeRxPDelayResp (XEmacPs_Ieee1588 *InstancePtr, u8 *PacketBuf)
| A function to decode a received PTP PDelayResp Packet. More...
void | XEmacPs_DecodeRxPDelayRespFollowUp (XEmacPs_Ieee1588 *InstancePtr, u8 *PacketBuf)
| A function to decode a received PTP PDelayRespFollowUp Packet. More...
void | XEmacPs_DecodeRxSignaling (XEmacPs_Ieee1588 *InstancePtr, u8 *PacketBuf)
| A function to decode a received PTP Signalling Packet. More...
void | XEmacPs_DecodeTxAnnounceFrame (XEmacPs_Ieee1588 *InstancePtr, u8 *PacketBuf)
| This function is invoked to compare the Current Master clock's parameter with that of the PTP node's (own) and run Best Master Clock Algorithm. More...
void | XEmacPs_DecodeRxAnnounceFrame (XEmacPs_Ieee1588 *InstancePtr, u8 *PacketBuf)
| This function is invoked when a new Announce frame is received. More...
void | XEmacPs_ReadAnnounceFrame (u8 *PacketBuf, XEmacPs_BmcData *AnnounceFrame)
| This function is invoked from various places to extract clock information from a buffer and populate the XEmacPs_BmcData instance passed. More...
void | XEmacPs_UpdateBmcRecords (XEmacPs_BmcData *NewMaster, XEmacPs_BmcData *CurrentBmc)
| This function updates the PTP master records (BMC records) with incoming BMC data. More...
u32 | XEmacPs_BestMasterClockAlgorithm (XEmacPs_BmcData *AnnounceFrame, XEmacPs_BmcData *CurrentBmc)
| This function will accept the data pointer to the current BMCA records, accept a pointer to an equivalent data structure for the new Announce Packet. More...
void | XEmacPs_BecomeRtcMaster (XEmacPs_Ieee1588 *InstancePtr, u8 txAnnounceHasWon)
| This function is called when the PTP node becomes RTC or PTP Master. More...
void | XEmacPs_BecomeRtcSlave (XEmacPs_Ieee1588 *InstancePtr)
| This function is called when the PTP node becomes PTP Slave. More...
void | XEmacPs_ChangePeerIeee1588v2Capability (XEmacPs_Ieee1588 *InstancePtr, u8 capable)
| This function is called to change the Peer capability of processing Iee1588v2 specific frames, e.g. More...
void | XEmacPs_CalcDelay (XEmacPs_Ieee1588 *InstancePtr)
| This function is called to calculate the link delay. More...
void | XEmacPs_CalcRtcOffset (XEmacPs_Ieee1588 *InstancePtr)
| This function calculates the Slave Offset from the GrandMaster time. More...
void | XEmacPs_UpdateRtcIncrement (XEmacPs_Ieee1588 *InstancePtr)
| This function clock rate adjustment. More...
u32 | XEmacPs_htonll (unsigned long long int n)
| A function to do endian conversion for long long int type. More...
u32 | XEmacPs_ntohll (long long int n)
| A function to do endian conversion for long long int type. More...
u8 | XEmacPs_GetMsgType (u8 *PacketBuf)
| This function extracts PTP messgae type information from the PTP packet. More...
void | XEmacPs_GetPortIdentity (u8 *PacketBuf, XEmacPs_PortIdentity *portID)
| A function to extract portIdentity information from a received PTP frame. More...
u16 | XEmacPs_GetSequenceId (u8 *PacketBuf)
| A function to extract SequenceId information from a received PTP frame. More...
u16 | XEmacPs_IncSequenceId (u8 *PacketBuf)
| A function to increment sequence ID in a PTP frames. More...
void | XEmacPs_SetMdioDivisor (XEmacPs *InstancePtr, XEmacPs_MdcDiv Divisor)
| Set the MDIO clock divisor. More...
unsigned int | XEmacPs_TsuCalcClk (u32 Freq)
| Calculate clock configuration register values for indicated input clock. More...

## Function Documentation

void XEmacPs_BecomeRtcMaster | ( | XEmacPs_Ieee1588 * | InstancePtr,
|  | u8 | txAnnounceHasWon
| ) |  |

This function is called when the PTP node becomes RTC or PTP Master.

This will make any adjustments needed when the node becomes the Grand Master, including resetting the RTC to its nominal value

Parameters

  InstancePtr | is a pointer to the XEmacPs_Ieee1588 instance.
  txAnnounceHasWon | if 1, indicates that this function has been called from the function XEmacPs_DecodeTxAnnounceFrame(). This way it can avoid performing things that are already done.

Returns
  None.

Note
  None.

References XEMACPS_1588_INC_OFFSET, XEmacPs_ReadAnnounceFrame(), XEmacPs_TsuCalcClk(), XEmacPs_UpdateBmcRecords(), and XEmacPs_WriteReg.

Referenced by XEmacPs_DecodeTxAnnounceFrame(), XEmacPs_InitializeProtocolData(), and XEmacPs_TimerInterruptHandler().

void XEmacPs_BecomeRtcSlave | ( | XEmacPs_Ieee1588 * | InstancePtr | ) |

This function is called when the PTP node becomes PTP Slave.

Parameters

  InstancePtr | is a pointer to the XEmacPs_Ieee1588 instance.

Returns
  None.

Note
  None.

Referenced by XEmacPs_DecodeRxAnnounceFrame().

u32 XEmacPs_BestMasterClockAlgorithm | ( | XEmacPs_BmcData * | AnnounceFrame,
|  | XEmacPs_BmcData * | CurrentBmc
| ) |  |

This function will accept the data pointer to the current BMCA records, accept a pointer to an equivalent data structure for the new Announce Packet.

TheBest Master Clock Algorithm (BMCA) is then performed on these two data structures by comparing the data fields

Parameters

  AnnounceFrame | of the received new frame
  CurrentBmc | is the existing BMC records

Returns
  None.

Note
  None.

Referenced by XEmacPs_DecodeRxAnnounceFrame(), and XEmacPs_DecodeTxAnnounceFrame().

void XEmacPs_CalcDelay | ( | XEmacPs_Ieee1588 * | InstancePtr | ) |

This function is called to calculate the link delay.

This is called after a complete sequence of PDelay packets. The PTP node sends a PDelayReq packet to start. Afterwards it receives the PDelayResp and PDelayRespFollowUp frames. Upon receiving the PDelayRespFollowUp, this function is invoked to calculate the link delay.

Parameters

  InstancePtr | is a pointer to the XEmacPs_Ieee1588 instance.

Returns
  None.

Note
  None.

References XEmacPs_ChangePeerIeee1588v2Capability().

Referenced by XEmacPs_DecodeRxPDelayRespFollowUp().

void XEmacPs_CalcRtcOffset | ( | XEmacPs_Ieee1588 * | InstancePtr | ) |

This function calculates the Slave Offset from the GrandMaster time.

It is called after receiving a Sync and FollowUp frame pair.

Parameters

  InstancePtr | is a pointer to the XEmacPs_Ieee1588 instance.

Returns
  None.

Note
  None.

References XEMACPS_1588_ADJ_OFFSET, XEMACPS_1588_SEC_OFFSET, XEmacPs_ReadReg, and XEmacPs_WriteReg.

Referenced by XEmacPs_DecodeRxFollowUp().

void XEmacPs_ChangePeerIeee1588v2Capability | ( | XEmacPs_Ieee1588 * | InstancePtr,
|  | u8 | Capable
| ) |  |

This function is called to change the Peer capability of processing Iee1588v2 specific frames, e.g.

PDelayReq, PDelayResp etc. A peer is Ieee1588v2 capable when it is able to send PDelayReq frames or able to respond to PDelayReq frames.

Parameters

  InstancePtr | is a pointer to the XEmacPs_Ieee1588 instance.
  capable | is Peer's capability

Returns
  None.

Note
  None.

Referenced by XEmacPs_CalcDelay(), XEmacPs_DecodeRxPDelayResp(), XEmacPs_InitializeProtocolData(), and XEmacPs_TimerInterruptHandler().

u32 XEmacPs_CompareClockIdentity | ( | XEmacPs_ClockIdentity | Identity1,
|  | XEmacPs_ClockIdentity | Identity2
| ) |  |

A function to compare two ClockIdentity values.

Parameters

  Identity1 | is the first ClockIdentity to be compared
  Identity2 | is the second ClockIdentity to be compared

Returns
  - 1 if the two values are equal
  - 0 if not equal

Note
  None.

Referenced by XEmacPs_DecodeRxAnnounceFrame().

u32 XEmacPs_ComparePortIdentity | ( | XEmacPs_PortIdentity | Identity1,
|  | XEmacPs_PortIdentity | Identity2
| ) |  |

A function to compare two PortIdentity values.

Parameters

  Identity1 | is the first sourcePortIdentity to be compared
  Identity2 | is the second sourcePortIdentity to be compared

Returns
  - 1 if the two values are equal
  - 0 if not equal

Note
  None.

Referenced by XEmacPs_DecodeRxAnnounceFrame(), XEmacPs_DecodeRxFollowUp(), XEmacPs_DecodeRxPDelayResp(), XEmacPs_DecodeRxPDelayRespFollowUp(), and XEmacPs_DecodeRxSync().

void XEmacPs_DecodeRxAnnounceFrame | ( | XEmacPs_Ieee1588 * | InstancePtr,
|  | u8 * | PacketBuf
| ) |  |

This function is invoked when a new Announce frame is received.

This function first reads the Announce frame parameters. If it is found that the announce frame has been received from the PTP master then the records are updated with the clock parameters. The Best Master Clock Algorithm is run in case any of the parameters in the announce frame has changed. There can be cases when the PTP master reduces its clock priority that may force the current PTP node to become master. If the PTP node is master and it has received this announce frame, then BMCA is run and if the incoming clock parameters are better tyhan that of the present node, the present node becomes SLAVE.

Parameters

  InstancePtr | is a pointer to the XEmacPs_Ieee1588 instance.
  PacketBuf | is the buffer that contains the Announce Frame.

Returns
  None.

Note
  None.

References XEmacPs_BecomeRtcSlave(), XEmacPs_BestMasterClockAlgorithm(), XEmacPs_CompareClockIdentity(), XEmacPs_ComparePortIdentity(), XEmacPs_DecodeTxAnnounceFrame(), XEmacPs_ReadAnnounceFrame(), and XEmacPs_UpdateBmcRecords().

Referenced by XEmacPs_HandleRecdPTPPacket().

void XEmacPs_DecodeRxFollowUp | ( | XEmacPs_Ieee1588 * | InstancePtr,
|  | u8 * | PacketBuf
| ) |  |

A function to decode a received PTP FollowUp Packet.

If the PTP node is master, source port identity of the received FollowUp frame matches that with this node's source port identity, the sequence Id of the received folowup frame matches that of last received Sync frame sequence Id, the function XEmacPs_CalcRtcOffset is invoked to calculate clock offset. Similalry for every 2 sync frames clock rate adjustment is done by calling XEmacPs_UpdateRtcIncrement. However, as of now, this function is not implemented and is empty.

Parameters

  InstancePtr | is a pointer to the XEmacPs_Ieee1588 instance.
  PacketBuf | is the buffer that contains the followup packet.

Returns
  None.

Note
  The clock rate adjustment is not implemented as of now. Though the function XEmacPs_UpdateRtcIncrement is called from here, the function does nothing!

References XEmacPs_CalcRtcOffset(), XEmacPs_ComparePortIdentity(), XEmacPs_GetPortIdentity(), XEmacPs_GetSequenceId(), and XEmacPs_UpdateRtcIncrement().

Referenced by XEmacPs_HandleRecdPTPPacket().

void XEmacPs_DecodeRxPDelayResp | ( | XEmacPs_Ieee1588 * | InstancePtr,
|  | u8 * | PacketBuf
| ) |  |

A function to decode a received PTP PDelayResp Packet.

Parameters

  InstancePtr | is a pointer to the XEmacPs_Ieee1588 instance.
  PacketBuf | is the buffer that contains the PDelayResp packet.

Returns
  None.

Note
  None.

References XEmacPs_ChangePeerIeee1588v2Capability(), XEmacPs_ComparePortIdentity(), XEmacPs_GetPortIdentity(), XEmacPs_GetSequenceId(), XEMACPS_PTPP_RXNANOSEC_OFFSET, and XEmacPs_ReadReg.

Referenced by XEmacPs_HandleRecdPTPPacket().

void XEmacPs_DecodeRxPDelayRespFollowUp | ( | XEmacPs_Ieee1588 * | InstancePtr,
|  | u8 * | PacketBuf
| ) |  |

A function to decode a received PTP PDelayRespFollowUp Packet.

Parameters

  InstancePtr | is a pointer to the XEmacPs_Ieee1588 instance.
  PacketBuf | is the buffer that contains the PDelayRespFollowUp packet.

Returns
  None.

Note
  None.

References XEmacPs_CalcDelay(), XEmacPs_ComparePortIdentity(), XEmacPs_GetPortIdentity(), and XEmacPs_GetSequenceId().

Referenced by XEmacPs_HandleRecdPTPPacket().

void XEmacPs_DecodeRxSignaling | ( | XEmacPs_Ieee1588 * | InstancePtr,
|  | u8 * | PacketBuf
| ) |  |

A function to decode a received PTP Signalling Packet.

Empty as of now.

Parameters

  InstancePtr | is a pointer to the XEmacPs_Ieee1588 instance.
  PacketBuf | is the buffer that contains the signalling packet.

Returns
  None.

Note
  None.

Referenced by XEmacPs_HandleRecdPTPPacket().

void XEmacPs_DecodeRxSync | ( | XEmacPs_Ieee1588 * | InstancePtr,
|  | u8 * | PacketBuf
| ) |  |

A function to decode a received PTP Sync Packet.

It extracts the sync frame time stamp and stores it in appropriate buffer. It stores the sequence ID as well.

Parameters

  InstancePtr | is a pointer to the XEmacPs_Ieee1588 instance.
  PacketBuf | is the buffer that contains the sync packet.

Returns
  None.

Note
  None.

References XEmacPs_ComparePortIdentity(), XEmacPs_GetPortIdentity(), XEmacPs_GetSequenceId(), XEMACPS_PTP_RXNANOSEC_OFFSET, XEMACPS_PTP_RXSEC_OFFSET, and XEmacPs_ReadReg.

Referenced by XEmacPs_HandleRecdPTPPacket().

void XEmacPs_DecodeTxAnnounceFrame | ( | XEmacPs_Ieee1588 * | InstancePtr,
|  | u8 * | PacketBuf
| ) |  |

This function is invoked to compare the Current Master clock's parameter with that of the PTP node's (own) and run Best Master Clock Algorithm.

A typical scenario is a new Announce frame has been received from the PTP Master and the PTP master record has been updated. Then this function is invoked to run Best Master Clock Algorithm with the PTP node's Announce Frame parameters and Current PTP Master's parameter.

Parameters

  InstancePtr | is a pointer to the XEmacPs_Ieee1588 instance.
  PacketBuf | is the buffer that contains the Announce Frame. For this function the buffer passed is the Tx Announce Frame stored in the buffer AnnounceFrmToTx in XEmacPs_Ieee1588 instance.

Returns
  None.

Note
  None.

References XEmacPs_BecomeRtcMaster(), XEmacPs_BestMasterClockAlgorithm(), XEmacPs_ReadAnnounceFrame(), and XEmacPs_UpdateBmcRecords().

Referenced by XEmacPs_DecodeRxAnnounceFrame(), and XEmacPs_InitializeProtocolData().

u8 XEmacPs_GetMsgType | ( | u8 * | PacketBuf | ) |

This function extracts PTP messgae type information from the PTP packet.

Parameters

  PacketBuf | contains the Ethernet packet.

Returns
  None.

Note
  None.

Referenced by XEmacPs_HandleRecdPTPPacket(), and XEmacPs_PtpTxDoFurtherProcessing().

void XEmacPs_GetPortIdentity | ( | u8 * | PacketBuf,
|  | XEmacPs_PortIdentity * | portID
| ) |  |

A function to extract portIdentity information from a received PTP frame.

This can be any portIdentity field (header portIdentity, requestingPortIdentity etc...)

Parameters

  PacketBuf | contains the PTP buffer from which the portIdentity is to be extracted.
  portID | is the address of type XEmacPs_PortIdentity is which the extracted port identity is put.

Returns
  None.

Note
  None.

Referenced by XEmacPs_DecodeRxFollowUp(), XEmacPs_DecodeRxPDelayResp(), XEmacPs_DecodeRxPDelayRespFollowUp(), XEmacPs_DecodeRxSync(), XEmacPs_ReadAnnounceFrame(), XEmacPs_SendPDelayResp(), and XEmacPs_SendPDelayRespFollowUp().

u16 XEmacPs_GetSequenceId | ( | u8 * | PacketBuf | ) |

A function to extract SequenceId information from a received PTP frame.

Parameters

  PacketBuf | contains the PTP buffer from which the portIdentity is to be extracted.

Returns
  The extracted sequence ID.

Note
  None.

Referenced by XEmacPs_DecodeRxFollowUp(), XEmacPs_DecodeRxPDelayResp(), XEmacPs_DecodeRxPDelayRespFollowUp(), XEmacPs_DecodeRxSync(), XEmacPs_PtpTxDoFurtherProcessing(), XEmacPs_SendPDelayResp(), and XEmacPs_SendPDelayRespFollowUp().

u32 XEmacPs_htonll | ( | unsigned long long int | n | ) |

A function to do endian conversion for long long int type.

This is for little to big endian conversion.

Parameters

  Parameter | whose endian conversion is needed

Returns
  The endian converted value.

Note
  None.

Referenced by XEmacPs_ntohll().

u16 XEmacPs_IncSequenceId | ( | u8 * | PacketBuf | ) |

A function to increment sequence ID in a PTP frames.

It first extracts the sequence ID and then increments and puts it back in the PTP frame.

Parameters

  PacketBuf | contains the PTP buffer from which the portIdentity is to be extracted.

Returns
  The incremented sequence ID.

Note
  None.

Referenced by XEmacPs_MasterSendAnnounce(), XEmacPs_MasterSendSync(), and XEmacPs_SendPDelayReq().

u32 XEmacPs_IsRxFramePTP | ( | u8 * | PacketBuf | ) |

This function extracts length/type information from the Ethernet packet.

Parameters

  PacketBuf | contains the Ethernet packet.

Returns
  None.

Note
  None.

Referenced by XEmacPs_HandleRecdPTPPacket().

void XEmacPs_MasterSendAnnounce | ( | XEmacPs_Ieee1588 * | InstancePtr | ) |

A function to format and then initiate the Tx of a PTP Announce Packet.

The sequence Id of the announce frame is incremented before initiating the Tx.

Parameters

  InstancePtr | is a pointer to the XEmacPs_Ieee1588 instance.

Returns
  None.

Note
  None.

References XEmacPs_IncSequenceId(), and XEmacPs_PtpTxPacket().

Referenced by XEmacPs_TimerInterruptHandler().

void XEmacPs_MasterSendFollowUp | ( | XEmacPs_Ieee1588 * | InstancePtr | ) |

A function to format and then initiate the Tx of a PTP FOLLOWUP Packet.

Updates the correction field in the buffer.

Parameters

  InstancePtr | is a pointer to the XEmacPs_Ieee1588 instance.

Returns
  None.

Note
  The correction field is hard coded to zero as of now.

References XEmacPs_PtpTxPacket().

Referenced by XEmacPs_RunIEEE1588Protocol().

void XEmacPs_MasterSendSync | ( | XEmacPs_Ieee1588 * | InstancePtr | ) |

A function to format and then initiate the Tx of a PTP SYNC Packet.

The sequence Id of the announce frame is incremented before initiating the Tx.

Parameters

  InstancePtr | is a pointer to the XEmacPs_Ieee1588 instance.

Returns
  None.

Note
  None.

References XEmacPs_IncSequenceId().

Referenced by XEmacPs_TimerInterruptHandler().

u32 XEmacPs_ntohll | ( | long long int | n | ) |

A function to do endian conversion for long long int type.

This is for big to little endian conversion.

Parameters

  Parameter | whose endian conversion is needed

Returns
  The endian converted value.

Note
  None.

References XEmacPs_htonll().

void XEmacPs_PtpRxInterruptHandler | ( | XEmacPs_Ieee1588 * | InstancePtr | ) |

This function is the EmacPs Rx interrupt callback invoked from the EmacPs driver.

Here we set the flag PtpNewPktRecd to true. This flag is checked for in the function XEmacPs_RunIEEE1588Protocol for further processing of packets.

Parameters

  InstancePntr | is a pointer to the instance of the XEmacPs_Ieee1588.

Returns
  None.

Note
  None.

Referenced by main(), and XEmacPs_PtpErrorInterruptHandler().

int XEmacPs_PtpTxPacket | ( | XEmacPs_Ieee1588 * | InstancePtr,
|  | u8 * | PacketBuf,
|  | int | PacketLen
| ) |  |

This function is initiates a PTP Tx.

This is called from various places.

Parameters

  InstancePntr | is a pointer to the instance of the XEmacPs_Ieee1588.
  PacketBuf | is the buffer that contains the packet to be Txed
  PacketLen | is the length of the packet to be Txed.

Returns
  None.

Note
  None.

References XEmacPs_BdClearTxUsed, XEmacPs_BdRingAlloc(), XEmacPs_BdRingToHw(), XEmacPs_BdSetAddressTx, XEmacPs_BdSetLast, XEmacPs_BdSetLength, XEmacPs_GetTxRing, XEmacPs_ReadReg, XEmacPs_Transmit, and XEMACPS_TXSR_OFFSET.

Referenced by XEmacPs_MasterSendAnnounce(), XEmacPs_MasterSendFollowUp(), XEmacPs_RunIEEE1588Protocol(), and XEmacPs_SendPDelayRespFollowUp().

void XEmacPs_ReadAnnounceFrame | ( | u8 * | PacketBuf,
|  | XEmacPs_BmcData * | AnnounceFrame
| ) |  |

This function is invoked from various places to extract clock information from a buffer and populate the XEmacPs_BmcData instance passed.

Parameters

  PacketBuf | from which the clock information is extracted
  AnnounceFrame | which is populated with clock information

Returns
  None.

Note
  None.

References XEmacPs_GetPortIdentity().

Referenced by XEmacPs_BecomeRtcMaster(), XEmacPs_DecodeRxAnnounceFrame(), and XEmacPs_DecodeTxAnnounceFrame().

void XEmacPs_SendPDelayReq | ( | XEmacPs_Ieee1588 * | InstancePtr | ) |

A function to format and then initiate the Tx of a PTP PDelayReq Packet.

The sequence Id of the announce frame is incremented before initiating the Tx.

Parameters

  InstancePtr | is a pointer to the XEmacPs_Ieee1588 instance.

Returns
  None.

Note
  None.

References XEmacPs_IncSequenceId().

Referenced by XEmacPs_TimerInterruptHandler().

void XEmacPs_SendPDelayResp | ( | XEmacPs_Ieee1588 * | InstancePtr | ) |

A function to format and then initiate the Tx of a PTP PDelayResp Packet.

This function is invoked upon receiving a PDelayReq frame. It first gets the time stamps of the received PDelayReq from the hardware and stores them at appropriate entries in the structure instance PtpRecords. It then formats the PDelayResp frame with these time stamp values.

Parameters

  InstancePtr | is a pointer to the XEmacPs_Ieee1588 instance.

Returns
  None.

Note
  None.

References XEmacPs_GetPortIdentity(), XEmacPs_GetSequenceId(), XEMACPS_PTPP_RXNANOSEC_OFFSET, XEMACPS_PTPP_RXSEC_OFFSET, and XEmacPs_ReadReg.

Referenced by XEmacPs_HandleRecdPTPPacket().

void XEmacPs_SendPDelayRespFollowUp | ( | XEmacPs_Ieee1588 * | InstancePtr | ) |

A function to format and then initiate the Tx of a PTP PDelayRespFollowUp Packet.

This function is invoked after a PDelayResp is successfully sent out (Tx done interrupt is received for PDelayResp packet). It populates the PDelayRespFollowUp frame with time stamps of the just transmitted PDelayResp packet.

Parameters

  InstancePtr | is a pointer to the XEmacPs_Ieee1588 instance.

Returns
  None.

Note
  None.

References XEmacPs_GetPortIdentity(), XEmacPs_GetSequenceId(), and XEmacPs_PtpTxPacket().

Referenced by XEmacPs_RunIEEE1588Protocol().

unsigned int XEmacPs_TsuCalcClk | ( | u32 | Freq | ) |

Calculate clock configuration register values for indicated input clock.

Parameters

  - | Freq

Returns
  - XST_SUCCESS to indicate success.
  - XST_FAILURE to indicate failure

Note
  None.

Referenced by main(), XEmacPs_BecomeRtcMaster(), and XEmacPs_PtpErrorInterruptHandler().

void XEmacPs_UpdateBmcRecords | ( | XEmacPs_BmcData * | NewMaster,
|  | XEmacPs_BmcData * | CurrentBmc
| ) |  |

This function updates the PTP master records (BMC records) with incoming BMC data.

Parameters

  NewMaster | is the new data to be updated
  CurrentBmc | is the existing BMC records that needs to be updated.

Returns
  None.

Note
  None.

Referenced by XEmacPs_BecomeRtcMaster(), XEmacPs_DecodeRxAnnounceFrame(), and XEmacPs_DecodeTxAnnounceFrame().

void XEmacPs_UpdateRtcIncrement | ( | XEmacPs_Ieee1588 * | InstancePtr | ) |

This function clock rate adjustment.

Not implemented as of now.

Parameters

  InstancePtr | is a pointer to the XEmacPs_Ieee1588 instance.

Returns
  None.

Note
  None.

Referenced by XEmacPs_DecodeRxFollowUp().