pt1588-SH7216 1
IEEE1588v2 Implementation for Renesas SH7216 Demo

C:/Users/mzimmer/IEEE1588/pt1588/branches/pt1588-SH7216/pt1588/ptp-protocol.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 
00030  #include <stdio.h>
00031  #include <stdarg.h>
00032  #include "ptp-constants.h"
00033  #include "platform/ptp-config.h"
00034  #include "platform/ptp-platform-data-types.h"
00035  #include "ptp-data-types.h"
00036  #include "platform/ptp-msg.h"
00037  #include "platform/ptp-clock.h"
00038 
00039  
00040 
00061 void PTPActor(const Event *eventIn);
00062 
00064 void PTPInitialize();
00065 
00069 void computeMeanPathDelay();
00070 
00074 void computeOffsetFromMaster();
00075 
00077 void adjustClock();
00078 
00083 void generateAnnounceReceiptTimeout();
00084 
00088 void generateQualificationTimeout(UInteger8 N);
00089 
00090 // Functions to handle events and state changes.
00091 
00095 void eventMsgIn(const Event *eventIn);
00096 
00100 void eventPowerup();
00101 
00105 void eventInitialize();
00106 
00110 void eventDesignatedEnabled();
00111 
00115 void eventDesignatedDisabled();
00116 
00120 void eventFaultCleared();
00121 
00125 void eventFaultDetected();
00126 
00130 void eventStateDecisionEvent();
00131 
00136 void eventQualificationTimeoutExpires();
00137 
00144 void eventAnnounceReceiptTimeoutExpires(const Event *eventIn);
00145 
00149 void eventSynchronizationFault();
00150 
00154 void eventMasterClockSelected();
00155 
00159 void eventPeriodicAnnounce();
00160 
00163 void eventPeriodicSync();
00164 
00168 void eventDelayReq();
00169 
00173 void eventFollowUp();
00174 
00176 void stateInitializing();
00177 
00179 void stateFaulty();
00180 
00182 void stateDisabled();
00183 
00185 void stateListening();
00186 
00188 void statePreMaster();
00189 
00191 void stateMaster();
00192 
00194 void statePassive();
00195 
00197 void stateUncalibrated();
00198 
00200 void stateSlave();
00201 
00202 // Functions to handle received messages.
00203 
00207 void announceMsgIn(UInteger8* msg);
00208 
00212 void syncMsgIn(UInteger8* msg);
00213 
00217 void followUpMsgIn(UInteger8* msg);
00218 
00222 void delayReqMsgIn(UInteger8* msg);
00223 
00227 void delayRespMsgIn(UInteger8* msg);
00228 
00232 void managementMsgIn(UInteger8* msg);
00233 
00238 void toDataSetFromMsg(ClockDataSet *ds, AnnounceMsg *msg);
00239 
00244 void toDataSetFromLocal(ClockDataSet *ds);
00245 
00251 UInteger8 compareDataSet(const ClockDataSet *a, const ClockDataSet *b);
00252 
00258 void updateDataSet(UInteger8 code, const AnnounceMsg *msg);
00259 
00265 Boolean comparePortIdentity(const PortIdentity *a, const PortIdentity *b);
00266 
00271 Boolean isQualified(const ForeignMasterDS *d);
00272 
00274 void fixTimestamps(const TimeInterval *timeInterval);
00275 
00277 void printStatus();
 All Data Structures Files Functions Variables Typedefs Enumerator Defines