XilinxProcessorIPLib/drivers/axiethernet/examples/avb/xavb_ptp_packets.c
void XAvb_DecodeRxSignaling(XAvb * InstancePtr, u32 PtpFrameBaseAddr) {

  u32 ReadData;
  char currentInterval;

  /** Read the requested logMeanMessage durations from the Signalling frame */
  ReadData = XAvb_ReorderWord(XAvb_ReadPtpBuffer(InstancePtr->Config.BaseAddress,
                                                  PtpFrameBaseAddr,
                                                  XAVB_PTP_RX_PKT_SIGNALING_DELAY_INTERVAL_OFFSET));

  /** update linkDelayInterval */
  currentInterval = (ReadData >> 24);
  switch( currentInterval ) {
  case (-128):
    /** don't change the interval */
    break;
  /** currently only support the default value */
  case XAVB_DEFAULT_LOG_MEAN_PDELAY_REQ_INTERVAL:
  case 126:
    /** set the interval to initial value */
    InstancePtr->SignallingFrameData.LinkDelayIntervalDuration =
      XAvb_UpdateIntervalDuration(InstancePtr->SignallingFrameData.LinkDelayIntervalDuration,
                                  XAVB_DEFAULT_LOG_MEAN_PDELAY_REQ_INTERVAL);

    /** Update logMeanMessageInterval in the pre-loaded TX PDELAYREQ message buffer */
    XAvb_UpdateLogMeanMessageInterval(InstancePtr->Config.BaseAddress,
                                      XAVB_PTP_TX_PDELAYREQ_OFFSET,
                                      InstancePtr->SignallingFrameData.LinkDelayIntervalDuration);
    break;
  case 127:
    /** stop sending pDelay messages */
    InstancePtr->SignallingFrameData.LinkDelayIntervalDuration = XAVB_PKT_TYPE_DISABLED;
    break;
  default:
      xil_printf( "Got a signalling message with an interval (%d) I don't support!\r\n", currentInterval);
  }

  /** update timeSyncInterval */
  currentInterval = (ReadData >> 16);
  switch( currentInterval ) {
  case (-128):
    /** don't change the interval */
    break;
  case XAVB_DEFAULT_LOG_MEAN_SYNC_INTERVAL:
  case 126:
    /** set the interval to initial value */
    InstancePtr->SignallingFrameData.SyncIntervalDuration =
      XAvb_UpdateIntervalDuration(InstancePtr->SignallingFrameData.SyncIntervalDuration,
                                  XAVB_DEFAULT_LOG_MEAN_SYNC_INTERVAL);

    /** Update logMeanMessageInterval in the pre-loaded TX SYNC message buffer */
    XAvb_UpdateLogMeanMessageInterval(InstancePtr->Config.BaseAddress,
                                      XAVB_PTP_TX_SYNC_OFFSET,
                                      InstancePtr->SignallingFrameData.SyncIntervalDuration);
    /** Update logMeanMessageInterval in the pre-loaded TX FOLLOW_UP message buffer */
    XAvb_UpdateLogMeanMessageInterval(InstancePtr->Config.BaseAddress,
                                    XAVB_PTP_TX_FOLLOW_UP_OFFSET,
                                    InstancePtr->SignallingFrameData.SyncIntervalDuration);
    break;
  case 127:
    /** stop sending sync messages */
    InstancePtr->SignallingFrameData.SyncIntervalDuration = XAVB_PKT_TYPE_DISABLED;
    break;
  default:
      xil_printf( "Got a signalling message with an interval (%d) I don't support!\r\n", currentInterval);
  }

  /** update announceInterval */
  currentInterval = (ReadData >> 8);
  switch( currentInterval ) {
  case (-128):
    /** don't change the interval */
    break;
  case XAVB_DEFAULT_LOG_MEAN_ANNOUNCE_INTERVAL:
  case 126:
    /** set the interval to initial value */
    InstancePtr->SignallingFrameData.AnnounceIntervalDuration =
      XAvb_UpdateIntervalDuration(InstancePtr->SignallingFrameData.AnnounceIntervalDuration,
                                  XAVB_DEFAULT_LOG_MEAN_ANNOUNCE_INTERVAL);

    /** Update logMeanMessageInterval in the pre-loaded TX ANNOUNCE message buffer  */
    XAvb_UpdateLogMeanMessageInterval(InstancePtr->Config.BaseAddress,
                                      XAVB_PTP_TX_ANNOUNCE_OFFSET,
                                      InstancePtr->SignallingFrameData.AnnounceIntervalDuration);
    break;
  case 127:
    /** stop sending Announce messages */
    InstancePtr->SignallingFrameData.AnnounceIntervalDuration = XAVB_PKT_TYPE_DISABLED;
    break;
  default:
      xil_printf( "Got a signalling message with an interval (%d) I don't support!\r\n", currentInterval);
  }
}
/****************************************************************************/
/**
*
* A function to decode a received Signalling Packet and modify the TX PTP
* Buffers based on the requested values.
*
* @param  InstancePtr is a pointer to the XAvb instance to be worked on
* @param  PtpFrameBaseAddr is the base address of the received Signaling Packet
*         in the Rx PTP Packet Buffer
*
* @return None.
*
* @note   None.
*
*****************************************************************************/
A function to decode a received Signalling Packet and modify the TX PTP
Buffers based on the requested values.
A function to decode a received Signalling Packet and modify the TX PTP Buffers based on the requested values .
void XAvb_DecodeRxSignaling(XAvb * InstancePtr, u32 PtpFrameBaseAddr) {
  u32 ReadData;
  char currentInterval;
  ReadData = XAvb_ReorderWord(XAvb_ReadPtpBuffer(InstancePtr->Config.BaseAddress,
                                                  PtpFrameBaseAddr,
                                                  XAVB_PTP_RX_PKT_SIGNALING_DELAY_INTERVAL_OFFSET));
  currentInterval = (ReadData >> 24);
  switch( currentInterval ) {
  case (-128):
    break;
  case XAVB_DEFAULT_LOG_MEAN_PDELAY_REQ_INTERVAL:
  case 126:
    InstancePtr->SignallingFrameData.LinkDelayIntervalDuration =
      XAvb_UpdateIntervalDuration(InstancePtr->SignallingFrameData.LinkDelayIntervalDuration,
                                  XAVB_DEFAULT_LOG_MEAN_PDELAY_REQ_INTERVAL);
    XAvb_UpdateLogMeanMessageInterval(InstancePtr->Config.BaseAddress,
                                      XAVB_PTP_TX_PDELAYREQ_OFFSET,
                                      InstancePtr->SignallingFrameData.LinkDelayIntervalDuration);
    break;
  case 127:
    InstancePtr->SignallingFrameData.LinkDelayIntervalDuration = XAVB_PKT_TYPE_DISABLED;
    break;
  default:
      xil_printf( "Got a signalling message with an interval (%d) I don't support!\r\n", currentInterval);
  }
  currentInterval = (ReadData >> 16);
  switch( currentInterval ) {
  case (-128):
    break;
  case XAVB_DEFAULT_LOG_MEAN_SYNC_INTERVAL:
  case 126:
    InstancePtr->SignallingFrameData.SyncIntervalDuration =
      XAvb_UpdateIntervalDuration(InstancePtr->SignallingFrameData.SyncIntervalDuration,
                                  XAVB_DEFAULT_LOG_MEAN_SYNC_INTERVAL);
    XAvb_UpdateLogMeanMessageInterval(InstancePtr->Config.BaseAddress,
                                      XAVB_PTP_TX_SYNC_OFFSET,
                                      InstancePtr->SignallingFrameData.SyncIntervalDuration);
    XAvb_UpdateLogMeanMessageInterval(InstancePtr->Config.BaseAddress,
                                    XAVB_PTP_TX_FOLLOW_UP_OFFSET,
                                    InstancePtr->SignallingFrameData.SyncIntervalDuration);
    break;
  case 127:
    InstancePtr->SignallingFrameData.SyncIntervalDuration = XAVB_PKT_TYPE_DISABLED;
    break;
  default:
      xil_printf( "Got a signalling message with an interval (%d) I don't support!\r\n", currentInterval);
  }
  currentInterval = (ReadData >> 8);
  switch( currentInterval ) {
  case (-128):
    break;
  case XAVB_DEFAULT_LOG_MEAN_ANNOUNCE_INTERVAL:
  case 126:
    InstancePtr->SignallingFrameData.AnnounceIntervalDuration =
      XAvb_UpdateIntervalDuration(InstancePtr->SignallingFrameData.AnnounceIntervalDuration,
                                  XAVB_DEFAULT_LOG_MEAN_ANNOUNCE_INTERVAL);
    XAvb_UpdateLogMeanMessageInterval(InstancePtr->Config.BaseAddress,
                                      XAVB_PTP_TX_ANNOUNCE_OFFSET,
                                      InstancePtr->SignallingFrameData.AnnounceIntervalDuration);
    break;
  case 127:
    InstancePtr->SignallingFrameData.AnnounceIntervalDuration = XAVB_PKT_TYPE_DISABLED;
    break;
  default:
      xil_printf( "Got a signalling message with an interval (%d) I don't support!\r\n", currentInterval);
  }
}
void XAvb_DecodeRxSignaling ( XAvb * InstancePtr , u32 PtpFrameBaseAddr ) { u32 ReadData ; char currentInterval ; ReadData = XAvb_ReorderWord ( XAvb_ReadPtpBuffer ( InstancePtr -> Config . BaseAddress , PtpFrameBaseAddr , XAVB_PTP_RX_PKT_SIGNALING_DELAY_INTERVAL_OFFSET ) ) ; currentInterval = ( ReadData >> 24 ) ; switch ( currentInterval ) { case ( -128 ) : break ; case XAVB_DEFAULT_LOG_MEAN_PDELAY_REQ_INTERVAL : case 126 : InstancePtr -> SignallingFrameData . LinkDelayIntervalDuration = XAvb_UpdateIntervalDuration ( InstancePtr -> SignallingFrameData . LinkDelayIntervalDuration , XAVB_DEFAULT_LOG_MEAN_PDELAY_REQ_INTERVAL ) ; XAvb_UpdateLogMeanMessageInterval ( InstancePtr -> Config . BaseAddress , XAVB_PTP_TX_PDELAYREQ_OFFSET , InstancePtr -> SignallingFrameData . LinkDelayIntervalDuration ) ; break ; case 127 : InstancePtr -> SignallingFrameData . LinkDelayIntervalDuration = XAVB_PKT_TYPE_DISABLED ; break ; default : xil_printf ( " \r \n " , currentInterval ) ; } currentInterval = ( ReadData >> 16 ) ; switch ( currentInterval ) { case ( -128 ) : break ; case XAVB_DEFAULT_LOG_MEAN_SYNC_INTERVAL : case 126 : InstancePtr -> SignallingFrameData . SyncIntervalDuration = XAvb_UpdateIntervalDuration ( InstancePtr -> SignallingFrameData . SyncIntervalDuration , XAVB_DEFAULT_LOG_MEAN_SYNC_INTERVAL ) ; XAvb_UpdateLogMeanMessageInterval ( InstancePtr -> Config . BaseAddress , XAVB_PTP_TX_SYNC_OFFSET , InstancePtr -> SignallingFrameData . SyncIntervalDuration ) ; XAvb_UpdateLogMeanMessageInterval ( InstancePtr -> Config . BaseAddress , XAVB_PTP_TX_FOLLOW_UP_OFFSET , InstancePtr -> SignallingFrameData . SyncIntervalDuration ) ; break ; case 127 : InstancePtr -> SignallingFrameData . SyncIntervalDuration = XAVB_PKT_TYPE_DISABLED ; break ; default : xil_printf ( " \r \n " , currentInterval ) ; } currentInterval = ( ReadData >> 8 ) ; switch ( currentInterval ) { case ( -128 ) : break ; case XAVB_DEFAULT_LOG_MEAN_ANNOUNCE_INTERVAL : case 126 : InstancePtr -> SignallingFrameData . AnnounceIntervalDuration = XAvb_UpdateIntervalDuration ( InstancePtr -> SignallingFrameData . AnnounceIntervalDuration , XAVB_DEFAULT_LOG_MEAN_ANNOUNCE_INTERVAL ) ; XAvb_UpdateLogMeanMessageInterval ( InstancePtr -> Config . BaseAddress , XAVB_PTP_TX_ANNOUNCE_OFFSET , InstancePtr -> SignallingFrameData . AnnounceIntervalDuration ) ; break ; case 127 : InstancePtr -> SignallingFrameData . AnnounceIntervalDuration = XAVB_PKT_TYPE_DISABLED ; break ; default : xil_printf ( " \r \n " , currentInterval ) ; } }
A function to decode a received Signalling Packet and modify the TX PTP
Buffers based on the requested values.
A function to decode a received Signalling Packet and modify the TX PTP Buffers based on the requested values .
/** Read the requested logMeanMessage durations from the Signalling frame */ /** update linkDelayInterval */ /** don't change the interval */ /** currently only support the default value */ /** set the interval to initial value */ /** Update logMeanMessageInterval in the pre-loaded TX PDELAYREQ message buffer */ /** stop sending pDelay messages */ /** update timeSyncInterval */ /** don't change the interval */ /** set the interval to initial value */ /** Update logMeanMessageInterval in the pre-loaded TX SYNC message buffer */ /** Update logMeanMessageInterval in the pre-loaded TX FOLLOW_UP message buffer */ /** stop sending sync messages */ /** update announceInterval */ /** don't change the interval */ /** set the interval to initial value */ /** Update logMeanMessageInterval in the pre-loaded TX ANNOUNCE message buffer  */ /** stop sending Announce messages */