Xilinx IP Ethernet AVB Endpoint v2.4 UG492 User Manual

Page 135

Advertising
background image

Ethernet AVB Endpoint User Guide

www.xilinx.com

135

UG492 September 21, 2010

Software System Integration

You should also update the following #define if there is a known asymmetry in the
propagation delay on the link. This #define models the per-port global variable
“delayAsymmetry” as defined in IEEE P802.1AS and should be edited based on the
description given in this specification. However, the current implementation uses
truncated nanoseconds rather than the scaled Ns type. The value is set to 0 by default.

#define XAVB_PROP_DELAY_ASYMMETRY 0

Setting up SourcePortIdentity (and Default TX PTP Messages)

The TX Packet buffers are pre-initialized with default values for all of the possible fields in
each message. However, in order for the Ethernet AVB Endpoint software drivers to run
correctly the following fields need to be written with sensible values.

sourcePortIdentity in all TX PTP default messages

grandmasterIdentity in TX PTP Announce message

pathSequence (ClockIdentity[1]) in TX PTP Announce message

The example design

xavb_example.c

provides a simple mechanism to achieve this using

the following #defines.

#define ETH_SOURCE_ADDRESS_EUI48_HIGH 0xFFEEDD

#define ETH_SOURCE_ADDRESS_EUI48_LOW 0xCCBBAA

You can edit the #defines above to be the Ethernet Source Address for the device and the
example software then provides code that translates this address into an
XAvb_PortIdentity struct. The function XAvb_SetupSourcePortIdentity() is called with the
XAvb_PortIdentity struct and writes it to the appropriate fields in the TX PTP Buffer.
Additionally it stores it in the XAvb struct as the following member:

/** Contains the local port Identity information */

XAvb_PortIdentity portIdLocal;

The example software also provides an example of how to write the Ethernet Source
Address into all TX PTP packet buffers.

Setting up GrandMaster Discontinuity Callback Handler

The Ethernet AVB Endpoint software defines a callback routine which is called when the
endpoint switches between being a Master and a Slave (or vice versa), or when it loses PTP
lock. The application software must define a callback handler for this otherwise an error
will be asserted. The example software provides an example of this as follows:

/** Function Prototype */

static void GMDiscontinuityHandler(void *CallBackRef,

unsigned int TimestampsUncertain);

/** Main function in this example */

main() {

/** ... */

XAvb_Config *AvbConfigPtr;

/** Setup the handler that will be called if the PTP drivers

* identify a possible discontinuity in GrandMaster time. */

XAvb_SetGMDiscontinuityHandler(&Avb, GMDiscontinuityHandler, &Avb);

/** ... */

/*****************************************************************/

/**

Advertising