pt1588-SH7216 1
IEEE1588v2 Implementation for Renesas SH7216 Demo

C:/Users/mzimmer/IEEE1588/pt1588/branches/pt1588-SH7216/pt1588/ptp-data-types.h

Go to the documentation of this file.
00001 /*
00002 Copyright (c) 2010-2011 The Regents of the University of California. All rights
00003 reserved.
00004 
00005 Permission is hereby granted, without written agreement and without license or 
00006 royalty fees, to use, copy, modify, and distribute this software and its 
00007 documentation for any purpose, provided that the above copyright notice and the
00008 following two paragraphs appear in all copies of this software.
00009 
00010 IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
00011 DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF
00012 THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF 
00013 CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00014 
00015 THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
00016 BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 
00017 A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, 
00018 AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO PROVIDE MAINTENANCE, 
00019 SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
00020 */
00021 
00032 typedef struct 
00033 {
00034     Integer64 scaledNanoseconds; 
00039 } TimeInterval;
00040 
00044 typedef struct
00045 {
00046     UInteger48 secondsField; 
00049     UInteger32 nanosecondsField; 
00052 } Timestamp;
00053 
00056 typedef Octet ClockIdentity[8];
00057 
00059 typedef struct
00060 {
00061     ClockIdentity clockIdentity; 
00064     UInteger16 portNumber; 
00067 } PortIdentity;
00068 
00070 typedef struct
00071 {
00072     Enumeration16 networkProtocol; 
00075     UInteger16 addressLength; 
00078     Octet* addressField; 
00081 } PortAddress;
00082 
00084 typedef struct 
00085 {
00086     UInteger8 clockClass; 
00087     Enumeration8 clockAccuracy; 
00089     UInteger16 offsetScaledLogVariance; 
00092 } ClockQuality;
00093 
00095 typedef struct
00096 {
00097     Enumeration16 tlvType; 
00098     UInteger16 lengthField; 
00100     Octet* valueField; 
00103 } TLV;
00104 
00106 typedef struct
00107 {
00108     UInteger8 lengthField; 
00111     Octet* textField; 
00114 } PTPText;
00115 
00117 typedef struct
00118 {
00119     UInteger16 faultRecordLength; 
00122     Timestamp faultTime; 
00125     Enumeration8 severityCode; 
00128     PTPText faultName; 
00129     PTPText faultValue; 
00130     PTPText faultDescription; 
00133 } FaultRecord;
00134 
00136 typedef struct {
00137     Boolean twoStepFlag; 
00140     ClockIdentity clockIdentity; 
00143     UInteger8 numberPorts; 
00145     ClockQuality clockQuality; 
00148     UInteger8 priority1; 
00152     UInteger8 priority2; 
00156     UInteger8 domainNumber; 
00159     Boolean slaveOnly; 
00162 } DefaultDS;
00163     
00165 typedef struct {
00166     UInteger16 stepsRemoved; 
00169     TimeInterval offsetFromMaster; 
00173     TimeInterval meanPathDelay; 
00177     TimeInterval lastOffsetFromMaster; 
00178 } CurrentDS;
00179 
00184 typedef struct {
00185     PortIdentity parentPortIdentity; 
00188     Boolean parentStats; 
00192     UInteger16 observedParentOffsetScaledLogVariance; 
00195     UInteger32 observedParentClockPhaseChangeRate; 
00201     ClockIdentity grandmasterIdentity; 
00204     ClockQuality grandmasterClockQuality; 
00207     UInteger8 priority1; 
00211     UInteger8 priority2; 
00216 } ParentDS;
00217  
00219 typedef struct {
00220     UInteger16 currentUtcOffset; 
00223     Boolean currentUtcOffsetValid; 
00226     Boolean leap59; 
00229     Boolean leap61; 
00232     Boolean timeTraceable; 
00235     Boolean frequencyTraceable; 
00238     Boolean ptpTimescale; 
00241     UInteger8 timeSource; 
00244 } TimePropertiesDS;
00245     
00247 typedef struct {
00248     PortIdentity portIdentity; 
00251     Enumeration8 portState; 
00254     Integer8 logMinDelayReqInterval; 
00260     TimeInterval peerMeanPathDelay; 
00263     Integer8 logAnnounceInterval; 
00267     UInteger8 announceReceiptTimeout; 
00271     Integer8 logSyncInterval; 
00275     Enumeration8 delayMechanism; 
00278     UInteger4 versionNumber; 
00281 } PortDS;
00282 
00284 typedef struct {
00285     Enumeration16 tlvType; 
00286     UInteger16 lengthField; 
00289     Enumeration16 managementId; 
00290     Octet* dataField; 
00293     UInteger16 dataFieldLength; 
00296 } ManagementTLV;
00297 
00299 typedef struct {
00300     Nibble transportSpecific; 
00303     Enumeration4 messageType; 
00304     UInteger4 versionPTP; 
00307     UInteger16 messageLength; 
00308     UInteger8 domainNumber; 
00311     Octet flagField[2]; 
00314     Integer64 correctionField; 
00318     PortIdentity sourcePortIdentity; 
00320     UInteger16 sequenceId; 
00324     UInteger8 controlField; 
00326     Integer8 logMessageInterval; 
00328 } Header;
00329 
00331 typedef struct {
00332     Header header; 
00333     Timestamp originTimestamp; 
00336     Integer16 currentUtcOffset; 
00339     UInteger8 grandmasterPriority1; 
00342     ClockQuality grandmasterClockQuality; 
00345     UInteger8 grandmasterPriority2; 
00348     ClockIdentity grandmasterIdentity; 
00351     UInteger16 stepsRemoved; 
00354     Enumeration8 timeSource; 
00357 } AnnounceMsg;
00358 
00360 typedef struct {
00361     Header header; 
00362     Timestamp originTimestamp; 
00365 } SyncMsg;
00366 
00368 typedef struct {
00369     Header header; 
00370     Timestamp preciseOriginTimestamp; 
00373 } FollowUpMsg;
00374 
00376 typedef struct {
00377     Header header; 
00378     Timestamp originTimestamp; 
00381 } DelayReqMsg;
00382 
00384 typedef struct {
00385     Header header; 
00386     Timestamp receiveTimestamp; 
00390     PortIdentity requestingPortIdentity; 
00394 } DelayRespMsg;
00395 
00397 typedef struct { 
00398     Header header; 
00399     PortIdentity targetPortIdentity; 
00402     UInteger8 startingBoundaryHops; 
00403     UInteger8 boundaryHops; 
00404     Enumeration4 actionField; 
00407     ManagementTLV managementTLV; 
00409 } ManagementMsg;
00410 
00415 typedef struct {
00416     UInteger8* priority1; 
00419     ClockIdentity *identity;
00422     UInteger8* clockClass;
00426     Enumeration8* accuracy;
00430     UInteger16* offsetScaledLogVariance; 
00434     UInteger8* priority2;
00437     UInteger16* stepsRemoved;
00440     ClockIdentity* sender;
00443     ClockIdentity* receiver;
00446     UInteger16* receiverPortNumber;
00449 } ClockDataSet;
00450 
00452 typedef struct {
00453     Timestamp eventTimestamp; 
00456     UInteger8 eventType; 
00457     UInteger8 *eventDataPointer; 
00458 } Event;
00459 
00463 typedef struct {
00464     PortIdentity foreignMasterPortIdentity; 
00467     UInteger16 foreignMasterAnnounceMessages; 
00472     AnnounceMsg msg; 
00475     Timestamp announceMessageTimestamps[2]; 
00481 } ForeignMasterDS;
00482 
00484 typedef struct {
00485 
00486     // PTP data sets. (8.1)
00487     DefaultDS defaultDS; 
00488     CurrentDS currentDS; 
00489     ParentDS parentDS; 
00490     TimePropertiesDS timePropertiesDS; 
00491     PortDS portDS; 
00495     ForeignMasterDS foreignMasterDS[FOREIGNMASTERDSSIZE]; 
00499     UInteger8 foreignMasterDSIndex; 
00503     UInteger16 sequenceIdAnnounce; 
00506     UInteger16 sequenceIdSync; 
00509     UInteger16 sequenceIdDelayReq; 
00512     UInteger16 sequenceIdManagement; 
00516     Timestamp syncEventIngressTimestamp; 
00519     Timestamp syncEventEgressTimestamp; 
00522     Timestamp delayEventIngressTimestamp; 
00525     Timestamp delayEventEgressTimestamp; 
00528     TimeInterval syncEventTimeInterval; 
00531     TimeInterval delayEventTimeInterval; 
00534     Integer64 lastCorrectionField; 
00538     // Used in servo algorithm to synchronize slave clock to master clock.
00539     Integer32 rateAdjFreq; 
00543     Integer32 rateAdjFreqAcc; 
00544     Integer32 rateAdjOffset; 
00549     Integer32 rateAdjOffsetAcc; 
00551     UInteger8 lastAdjType; 
00555     UInteger16 announceReceiptTimeoutExpiresID; 
00560     // Follow_Up message requires information about last Sync message.
00561     PortIdentity lastSyncMsgSourcePortIdentity; 
00565     UInteger16 lastSyncMsgSequenceId; 
00568     Integer64 lastSyncMsgCorrectionField; 
00573     Boolean sameMaster; 
00577 } PTPState;
00578 
00579 
00580 
00581 
 All Data Structures Files Functions Variables Typedefs Enumerator Defines