XilinxProcessorIPLib/drivers/axiethernet/examples/avb/xavb_ptp_packets.c
void XAvb_SendPDelayReq(XAvb * InstancePtr) {
  u32 SequenceId;

  /** Wait until there are no PTP frames to be transmitted */
  XAvb_WaitOnTxPtpQueue(InstancePtr);

  /** Increment the SequenceId */
  SequenceId = XAvb_IncSequenceId(InstancePtr->Config.BaseAddress,
                                  XAVB_PTP_TX_PDELAYREQ_OFFSET)
               & 0x0000FFFF;

#ifdef DEBUG_XAVB_LEVEL3
  xil_printf("\r\n--------------------------------");
  xil_printf("\r\n------XAvb_SendPDelayReq()------");
  xil_printf("\r\n--------------------------------");
  xil_printf("\r\nsequenceId is %x", SequenceId);
#endif

  /** Send the PDelayReq Frame! */
  XAvb_WriteReg(InstancePtr->Config.BaseAddress,
                 XAVB_PTP_TX_CONTROL_OFFSET,
                 XAVB_PTP_TX_SEND_PDELAYREQ_FRAME_MASK);

  /** Wait for the frame to be transmitted */
  XAvb_WaitOnTxPtpQueue(InstancePtr);

  /** Capture the Timestamp for Tx of PDelayReq (t1) and adjust it for MAC
   *  transmit latency */
  InstancePtr->PtpRecords.PDelayTimestampT1
      = XAvb_ReadPtpBuffer(InstancePtr->Config.BaseAddress,
                            XAVB_PTP_TX_PDELAYREQ_OFFSET,
                            XAVB_PTP_PKT_CAPTURED_TIMESTAMP_OFFSET)
        + XAVB_TX_MAC_LATENCY_IN_NS;

  /** Capture the SequenceID of the the PDelayReq */
  InstancePtr->SequenceIdRecords.PDelayReqSequenceId =
     XAvb_ReorderWord(XAvb_ReadPtpBuffer(InstancePtr->Config.BaseAddress,
                          XAVB_PTP_TX_PDELAYREQ_OFFSET,
                          XAVB_PTP_TX_PKT_SEQUENCEID_OFFSET)) >> 16;
}
/****************************************************************************/
/**
*
* A function to format then request the transmission of a PTP PDelay Request
* Packet
*
* @param  InstancePtr is a pointer to the XAvb instance to be worked on
*
* @return None.  But the relevant Tx PTP Packet Buffer is written to with the
*                updated PTP fields, and then the Tx PTP Packet Buffer Control
*                Register is written to request the frame transmission.
*
* @note   None.
*
*****************************************************************************/
A function to format then request the transmission of a PTP PDelay Request
Packet
A function to format then request the transmission of a PTP PDelay Request Packet
void XAvb_SendPDelayReq(XAvb * InstancePtr) {
  u32 SequenceId;
  XAvb_WaitOnTxPtpQueue(InstancePtr);
  SequenceId = XAvb_IncSequenceId(InstancePtr->Config.BaseAddress,
                                  XAVB_PTP_TX_PDELAYREQ_OFFSET)
               & 0x0000FFFF;
#ifdef DEBUG_XAVB_LEVEL3
  xil_printf("\r\n--------------------------------");
  xil_printf("\r\n------XAvb_SendPDelayReq()------");
  xil_printf("\r\n--------------------------------");
  xil_printf("\r\nsequenceId is %x", SequenceId);
#endif
  XAvb_WriteReg(InstancePtr->Config.BaseAddress,
                 XAVB_PTP_TX_CONTROL_OFFSET,
                 XAVB_PTP_TX_SEND_PDELAYREQ_FRAME_MASK);
  XAvb_WaitOnTxPtpQueue(InstancePtr);
  InstancePtr->PtpRecords.PDelayTimestampT1
      = XAvb_ReadPtpBuffer(InstancePtr->Config.BaseAddress,
                            XAVB_PTP_TX_PDELAYREQ_OFFSET,
                            XAVB_PTP_PKT_CAPTURED_TIMESTAMP_OFFSET)
        + XAVB_TX_MAC_LATENCY_IN_NS;
  InstancePtr->SequenceIdRecords.PDelayReqSequenceId =
     XAvb_ReorderWord(XAvb_ReadPtpBuffer(InstancePtr->Config.BaseAddress,
                          XAVB_PTP_TX_PDELAYREQ_OFFSET,
                          XAVB_PTP_TX_PKT_SEQUENCEID_OFFSET)) >> 16;
}
void XAvb_SendPDelayReq ( XAvb * InstancePtr ) { u32 SequenceId ; XAvb_WaitOnTxPtpQueue ( InstancePtr ) ; SequenceId = XAvb_IncSequenceId ( InstancePtr -> Config . BaseAddress , XAVB_PTP_TX_PDELAYREQ_OFFSET ) & 0x0000FFFF ; #ifdef DEBUG_XAVB_LEVEL3 xil_printf ( " \r \n " ) ; xil_printf ( " \r \n " ) ; xil_printf ( " \r \n " ) ; xil_printf ( " \r \n " , SequenceId ) ; #endif XAvb_WriteReg ( InstancePtr -> Config . BaseAddress , XAVB_PTP_TX_CONTROL_OFFSET , XAVB_PTP_TX_SEND_PDELAYREQ_FRAME_MASK ) ; XAvb_WaitOnTxPtpQueue ( InstancePtr ) ; InstancePtr -> PtpRecords . PDelayTimestampT1 = XAvb_ReadPtpBuffer ( InstancePtr -> Config . BaseAddress , XAVB_PTP_TX_PDELAYREQ_OFFSET , XAVB_PTP_PKT_CAPTURED_TIMESTAMP_OFFSET ) + XAVB_TX_MAC_LATENCY_IN_NS ; InstancePtr -> SequenceIdRecords . PDelayReqSequenceId = XAvb_ReorderWord ( XAvb_ReadPtpBuffer ( InstancePtr -> Config . BaseAddress , XAVB_PTP_TX_PDELAYREQ_OFFSET , XAVB_PTP_TX_PKT_SEQUENCEID_OFFSET ) ) >> 16 ; }
A function to format then request the transmission of a PTP PDelay Request
Packet
A function to format then request the transmission of a PTP PDelay Request Packet
/** Wait until there are no PTP frames to be transmitted */ /** Increment the SequenceId */ /** Send the PDelayReq Frame! */ /** Wait for the frame to be transmitted */ /** Capture the Timestamp for Tx of PDelayReq (t1) and adjust it for MAC
   *  transmit latency */ /** Capture the SequenceID of the the PDelayReq */