XilinxProcessorIPLib/drivers/axiethernet/examples/avb/xavb_ptp_packets.c
u32 XAvb_IsRxFramePTP(XAvb * InstancePtr,
                      u32    PtpFrameBaseAddr) {
  u32 FrameIsPTP;
  u32 FrameField;

  /** Start by assuming that it is a valid PTP frame */
  FrameIsPTP = 1;

  /** Perform a 32-bit read from the relevant position in the frame */
  FrameField = XAvb_ReadPtpBuffer(InstancePtr->Config.BaseAddress,
                                   PtpFrameBaseAddr,
                                   XAVB_PTP_RX_PKT_TYPE_OFFSET);

  FrameField = XAvb_ReorderWord(FrameField);

  /** Check the Length/Type field for a valid Ethertype */
  if ((FrameField >>16) != XAVB_PTP_ETHERTYPE) {
    FrameIsPTP = 0;
#ifdef DEBUG_XAVB_LEVEL1
    xil_printf("\r\nXAvb_IsRxFramePTP(): Bad Ethertype: %x", (FrameField >>16));
#endif
  }

  /** Check the versionPTP */
  if ((FrameField & 0xF) != XAVB_PTP_VERSION_PTP) {
    FrameIsPTP = 0;
#ifdef DEBUG_XAVB_LEVEL1
    xil_printf("\r\nXAvb_IsRxFramePTP():Bad versionPTP:%x", (FrameField & 0xF));
#endif
  }

  return FrameIsPTP;

}
/****************************************************************************/
/**
*
* A function to check that various fields in the received frame contain the
* expected values which define it as a valid AVB PTP frame.  If this check does
* not pass then the frame should not be decoded and used.
*
* @param  InstancePtr is a pointer to the XAvb instance to be worked on
* @param  PtpFrameBaseAddr is the base address of the received Announce Packet
*         in the Rx PTP Packet Buffer
*
* @return An updated True/False decision as to whether this received frame
*         really is a valid PTP type.
*
* @note   None.
*
*****************************************************************************/
A function to check that various fields in the received frame contain the
expected values which define it as a valid AVB PTP frame.  If this check does
not pass then the frame should not be decoded and used.
A function to check that various fields in the received frame contain the expected values which define it as a valid AVB PTP frame . If this check does not pass then the frame should not be decoded and used .
u32 XAvb_IsRxFramePTP(XAvb * InstancePtr,
                      u32    PtpFrameBaseAddr) {
  u32 FrameIsPTP;
  u32 FrameField;
  FrameIsPTP = 1;
  FrameField = XAvb_ReadPtpBuffer(InstancePtr->Config.BaseAddress,
                                   PtpFrameBaseAddr,
                                   XAVB_PTP_RX_PKT_TYPE_OFFSET);
  FrameField = XAvb_ReorderWord(FrameField);
  if ((FrameField >>16) != XAVB_PTP_ETHERTYPE) {
    FrameIsPTP = 0;
#ifdef DEBUG_XAVB_LEVEL1
    xil_printf("\r\nXAvb_IsRxFramePTP(): Bad Ethertype: %x", (FrameField >>16));
#endif
  }
  if ((FrameField & 0xF) != XAVB_PTP_VERSION_PTP) {
    FrameIsPTP = 0;
#ifdef DEBUG_XAVB_LEVEL1
    xil_printf("\r\nXAvb_IsRxFramePTP():Bad versionPTP:%x", (FrameField & 0xF));
#endif
  }
  return FrameIsPTP;
}
u32 XAvb_IsRxFramePTP ( XAvb * InstancePtr , u32 PtpFrameBaseAddr ) { u32 FrameIsPTP ; u32 FrameField ; FrameIsPTP = 1 ; FrameField = XAvb_ReadPtpBuffer ( InstancePtr -> Config . BaseAddress , PtpFrameBaseAddr , XAVB_PTP_RX_PKT_TYPE_OFFSET ) ; FrameField = XAvb_ReorderWord ( FrameField ) ; if ( ( FrameField >> 16 ) != XAVB_PTP_ETHERTYPE ) { FrameIsPTP = 0 ; #ifdef DEBUG_XAVB_LEVEL1 xil_printf ( " \r \n " , ( FrameField >> 16 ) ) ; #endif } if ( ( FrameField & 0xF ) != XAVB_PTP_VERSION_PTP ) { FrameIsPTP = 0 ; #ifdef DEBUG_XAVB_LEVEL1 xil_printf ( " \r \n " , ( FrameField & 0xF ) ) ; #endif } return FrameIsPTP ; }
A function to check that various fields in the received frame contain the
expected values which define it as a valid AVB PTP frame.
A function to check that various fields in the received frame contain the expected values which define it as a valid AVB PTP frame .
/** Start by assuming that it is a valid PTP frame */ /** Perform a 32-bit read from the relevant position in the frame */ /** Check the Length/Type field for a valid Ethertype */ /** Check the versionPTP */