├── src ├── .gitignore ├── package.ned ├── Makefrag_GenericBuildOptions ├── Testbenches │ ├── ClockTest │ │ ├── ClockTest.ned │ │ └── ClockTest.h │ ├── PTP_EthSink │ │ ├── PTP_EthSink.ned │ │ └── PTP_EthSink.h │ ├── PtpStackTest │ │ ├── PtpStackTest.ned │ │ ├── PtpStackTest.h │ │ ├── PtpStackTestType.h │ │ └── ParameterParser │ │ │ └── PtpStackTest_Parser.h │ ├── EncapTest │ │ ├── EncapTest.ned │ │ └── EncapTest.h │ ├── ClockScaleTest │ │ ├── ClockScaleTest.ned │ │ └── ClockScaleTest.h │ ├── BabblingIP │ │ ├── BabblingIP.ned │ │ └── BabblingIP.h │ ├── ClockScheduleTest │ │ ├── ClockScheduleTest.ned │ │ └── ClockScheduleTest.h │ ├── EtherPhyTester │ │ ├── EtherPhyTester.ned │ │ └── EtherPhyTester.h │ └── ClockServoTest │ │ ├── ClockServoTest.ned │ │ └── ClockServoTest.h ├── Hardware │ ├── PTP_EtherEncap │ │ ├── IPTP_EtherEncap.ned │ │ ├── PTP_EtherEncap.ned │ │ └── PTP_EtherEncap.h │ ├── DualDelayer │ │ ├── DelayQueue │ │ │ ├── DelayQueue.ned │ │ │ └── DelayQueue.h │ │ ├── IDualDelayer.ned │ │ ├── NopDualDelayer.ned │ │ └── DualDelayer.ned │ ├── HwClock │ │ ├── ScheduleClock │ │ │ ├── IScheduleClock.ned │ │ │ └── Internal_ScheduleClock.ned │ │ ├── AdjustableClock │ │ │ ├── IAdjustableClock.ned │ │ │ ├── AdjustableClockTypes.ned │ │ │ └── Internal_AdjustableClock.ned │ │ ├── HwClock │ │ │ ├── IHwClock.ned │ │ │ ├── HwClock_ParameterParser.h │ │ │ ├── HwClockTypes.ned │ │ │ ├── Internal_HwClock.ned │ │ │ └── HwClock_ParameterParser.cc │ │ ├── TdGen │ │ │ ├── PerfectTdGen.h │ │ │ ├── TdGen_ParameterParser.h │ │ │ ├── ITdGen.h │ │ │ ├── ConstDriftTdGen.h │ │ │ ├── SineTdGen.h │ │ │ ├── libPLN_TdGen.h │ │ │ ├── TdGen_ParameterParser.cc │ │ │ ├── ITdGen.cc │ │ │ └── PerfectTdGen.cc │ │ ├── ClockEvents │ │ │ ├── IClockEventSink.h │ │ │ └── IClockEventSink.cc │ │ ├── SeedProvider │ │ │ └── SeedProvider.cc │ │ └── LocalTimeStamp │ │ │ └── LocalTimeStamp.h │ ├── EtherPhy │ │ ├── IEtherPhy.ned │ │ └── EtherPhy.ned │ ├── PTP_RelayUnit │ │ ├── IPTP_MACRelayUnit.ned │ │ ├── PTP_MACRelayUnit.ned │ │ ├── MACRelayUnitBase.h │ │ └── PTP_MACRelayUnit.h │ ├── PTP_MAC │ │ ├── IPTP_MAC.ned │ │ └── PTP_MAC.ned │ └── PTP_NIC_Ctrl │ │ ├── PTP_Requ_Msg │ │ └── PtpPortRequ.msg │ │ └── PTP_Config_Msg │ │ └── PtpPortConfig.msg ├── Makefrag_Boost ├── Software │ ├── PTP_EthernetMapping │ │ ├── PTP_Ctrl │ │ │ └── PTP_Ctrl.msg │ │ ├── PTP_EthernetMapping.ned │ │ └── PTP_EthernetMapping.h │ ├── ClockServo │ │ ├── IClockServo.ned │ │ └── PI_ClockServo │ │ │ └── PI_ClockServo_ParameterParser.h │ ├── SimTimeFilter │ │ ├── SimTimeFilterTypes.h │ │ ├── SimTimeFilter_ParameterParser.h │ │ ├── ISimTimeFilter.h │ │ ├── Identity │ │ │ └── IdentitySimTimeFilter.h │ │ ├── SimTimeFilter_ParameterParser.cc │ │ └── MovingAvg │ │ │ └── MovingAvgSimTimeFilter.h │ └── PTP_Stack │ │ ├── PTP_EventMsg │ │ └── PTP_EventMsg.msg │ │ ├── AppServices │ │ ├── AppService.h │ │ ├── Delay │ │ │ └── TimestampMatcher.h │ │ └── Announce │ │ │ └── AppAnnounce.h │ │ ├── Includes │ │ └── PTP.h │ │ └── DataTypes │ │ ├── PTP_TLV.h │ │ ├── PTP_PTPText.h │ │ └── DataSets │ │ └── PTP_ForeignClockMsg.h ├── Utils │ ├── Constants │ │ ├── PhysicalConstants.h │ │ └── PhysicalConstants.cc │ └── ByteOrder │ │ └── ByteOrder.h ├── Components │ ├── BasicBlocks │ │ └── IPTP_EtherNode.ned │ ├── Cables │ │ └── Cables.ned │ └── Utilities │ │ └── TimeDiffObserver │ │ └── TimeDiffObserver.ned └── Firmware │ └── EthernetII_LLC │ ├── EthernetII_LLC.ned │ └── EthernetII_LLC.h ├── .nedfolders ├── .gitignore ├── simulations ├── .gitignore ├── run └── package.ned ├── doc └── img │ ├── NodeSymbols.png │ ├── MessageSymbols.png │ ├── SyncInterval_Mean.png │ ├── BC8_Port2_StateDecisions.png │ └── NodeSymbols_ExampleNetwork.png ├── images └── PTP │ ├── Messages │ ├── Sync.png │ ├── SyncFU.png │ ├── Announce.png │ ├── DelayReq.png │ ├── DelayResp.png │ ├── Management.png │ ├── PDelayReq.png │ ├── PDelayResp.png │ ├── Signaling.png │ ├── PDelayRespFU.png │ └── License.txt │ ├── Base │ └── Blank │ │ ├── Blank.xcf │ │ └── License.txt │ ├── Components │ ├── MAC │ │ ├── MAC.png │ │ └── License.txt │ ├── NIC │ │ ├── NIC.png │ │ └── License.txt │ ├── PHY │ │ ├── PHY.png │ │ └── License.txt │ ├── Encap │ │ ├── Encap.png │ │ └── License.txt │ ├── Clock │ │ ├── RealClock.png │ │ ├── SineClock.png │ │ ├── DigitalClock.png │ │ ├── DigitalClock.xcf │ │ ├── PerfectClock.png │ │ ├── ConstantDriftClock.png │ │ └── License.txt │ ├── Delayer │ │ ├── Delayer.png │ │ └── License.txt │ ├── NIC_Ctrl │ │ ├── NIC_Ctrl.png │ │ └── License.txt │ ├── PTP_Stack │ │ ├── PTP_Stack.png │ │ └── License.txt │ ├── RelayUnit │ │ ├── RelayUnit.png │ │ └── License.txt │ ├── ClockServo │ │ ├── ClockServo.png │ │ ├── PI_ClockServo.dia │ │ ├── PI_ClockServo.png │ │ ├── PI_ClockServo.xcf │ │ └── License.txt │ ├── InternalModule │ │ ├── InternalModule.png │ │ └── License.txt │ └── PTP_EthernetMapping │ │ ├── PTP_EthernetMapping.png │ │ ├── PTP_EthernetMapping.xcf │ │ └── License.txt │ ├── Nodes │ ├── PTP_Nodes │ │ ├── Node.xcf │ │ ├── B_E_1_M1.png │ │ ├── B_E_1_M2.png │ │ ├── B_E_1_M3.png │ │ ├── B_E_1_SO.png │ │ ├── B_E_2_M1.png │ │ ├── B_E_2_M2.png │ │ ├── B_E_2_M3.png │ │ ├── B_E_2_SO.png │ │ ├── B_P_1_M1.png │ │ ├── B_P_1_M2.png │ │ ├── B_P_1_M3.png │ │ ├── B_P_1_SO.png │ │ ├── B_P_2_M1.png │ │ ├── B_P_2_M2.png │ │ ├── B_P_2_M3.png │ │ ├── B_P_2_SO.png │ │ ├── Generic.png │ │ ├── Generic.xcf │ │ ├── N_E_1_M1.png │ │ ├── N_E_1_M2.png │ │ ├── N_E_1_M3.png │ │ ├── N_E_1_SO.png │ │ ├── N_E_2_M1.png │ │ ├── N_E_2_M2.png │ │ ├── N_E_2_M3.png │ │ ├── N_E_2_SO.png │ │ ├── N_P_1_M1.png │ │ ├── N_P_1_M2.png │ │ ├── N_P_1_M3.png │ │ ├── N_P_1_SO.png │ │ ├── N_P_2_M1.png │ │ ├── N_P_2_M2.png │ │ ├── N_P_2_M3.png │ │ ├── N_P_2_SO.png │ │ ├── T_E_1_M1.png │ │ ├── T_E_1_M2.png │ │ ├── T_E_1_M3.png │ │ ├── T_E_1_SO.png │ │ ├── T_E_2_M1.png │ │ ├── T_E_2_M2.png │ │ ├── T_E_2_M3.png │ │ ├── T_E_2_SO.png │ │ ├── T_P_1_M1.png │ │ ├── T_P_1_M2.png │ │ ├── T_P_1_M3.png │ │ ├── T_P_1_SO.png │ │ ├── T_P_2_M1.png │ │ ├── T_P_2_M2.png │ │ ├── T_P_2_M3.png │ │ ├── T_P_2_SO.png │ │ └── License.txt │ └── TimeDiffObserver │ │ ├── TimeDiffObserver.png │ │ └── License.txt │ └── LICENSE.txt ├── Docs ├── Usage_with_libPLN │ ├── Usage_with_libPLN.odt │ ├── Usage_with_libPLN.pdf │ └── images │ │ ├── Dependencies.dia │ │ └── Dependencies.png └── Measurements │ └── SimpleNetwork │ ├── PI_Parameters.ods │ └── AsymmetryExperiment.ods ├── .oppbuildspec ├── Makefile ├── Makefile.vc ├── .project └── Tools └── Bash_Scripts └── CleanUpSources.sh /src/.gitignore: -------------------------------------------------------------------------------- 1 | Makefile 2 | -------------------------------------------------------------------------------- /.nedfolders: -------------------------------------------------------------------------------- 1 | simulations 2 | src 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *~ 2 | out 3 | *_m.cc 4 | *_m.h 5 | *.so 6 | -------------------------------------------------------------------------------- /simulations/.gitignore: -------------------------------------------------------------------------------- 1 | Makefile 2 | omnetpp.ini 3 | new.anf 4 | core 5 | -------------------------------------------------------------------------------- /doc/img/NodeSymbols.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptp-sim/libPTP/HEAD/doc/img/NodeSymbols.png -------------------------------------------------------------------------------- /doc/img/MessageSymbols.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptp-sim/libPTP/HEAD/doc/img/MessageSymbols.png -------------------------------------------------------------------------------- /doc/img/SyncInterval_Mean.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptp-sim/libPTP/HEAD/doc/img/SyncInterval_Mean.png -------------------------------------------------------------------------------- /images/PTP/Messages/Sync.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptp-sim/libPTP/HEAD/images/PTP/Messages/Sync.png -------------------------------------------------------------------------------- /images/PTP/Base/Blank/Blank.xcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptp-sim/libPTP/HEAD/images/PTP/Base/Blank/Blank.xcf -------------------------------------------------------------------------------- /images/PTP/Messages/SyncFU.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptp-sim/libPTP/HEAD/images/PTP/Messages/SyncFU.png -------------------------------------------------------------------------------- /images/PTP/Components/MAC/MAC.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptp-sim/libPTP/HEAD/images/PTP/Components/MAC/MAC.png -------------------------------------------------------------------------------- /images/PTP/Components/NIC/NIC.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptp-sim/libPTP/HEAD/images/PTP/Components/NIC/NIC.png -------------------------------------------------------------------------------- /images/PTP/Components/PHY/PHY.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptp-sim/libPTP/HEAD/images/PTP/Components/PHY/PHY.png -------------------------------------------------------------------------------- /images/PTP/Messages/Announce.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptp-sim/libPTP/HEAD/images/PTP/Messages/Announce.png -------------------------------------------------------------------------------- /images/PTP/Messages/DelayReq.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptp-sim/libPTP/HEAD/images/PTP/Messages/DelayReq.png -------------------------------------------------------------------------------- /images/PTP/Messages/DelayResp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptp-sim/libPTP/HEAD/images/PTP/Messages/DelayResp.png -------------------------------------------------------------------------------- /images/PTP/Messages/Management.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptp-sim/libPTP/HEAD/images/PTP/Messages/Management.png -------------------------------------------------------------------------------- /images/PTP/Messages/PDelayReq.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptp-sim/libPTP/HEAD/images/PTP/Messages/PDelayReq.png -------------------------------------------------------------------------------- /images/PTP/Messages/PDelayResp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptp-sim/libPTP/HEAD/images/PTP/Messages/PDelayResp.png -------------------------------------------------------------------------------- /images/PTP/Messages/Signaling.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptp-sim/libPTP/HEAD/images/PTP/Messages/Signaling.png -------------------------------------------------------------------------------- /doc/img/BC8_Port2_StateDecisions.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptp-sim/libPTP/HEAD/doc/img/BC8_Port2_StateDecisions.png -------------------------------------------------------------------------------- /images/PTP/Messages/PDelayRespFU.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptp-sim/libPTP/HEAD/images/PTP/Messages/PDelayRespFU.png -------------------------------------------------------------------------------- /images/PTP/Nodes/PTP_Nodes/Node.xcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptp-sim/libPTP/HEAD/images/PTP/Nodes/PTP_Nodes/Node.xcf -------------------------------------------------------------------------------- /doc/img/NodeSymbols_ExampleNetwork.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptp-sim/libPTP/HEAD/doc/img/NodeSymbols_ExampleNetwork.png -------------------------------------------------------------------------------- /images/PTP/Components/Encap/Encap.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptp-sim/libPTP/HEAD/images/PTP/Components/Encap/Encap.png -------------------------------------------------------------------------------- /images/PTP/Nodes/PTP_Nodes/B_E_1_M1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptp-sim/libPTP/HEAD/images/PTP/Nodes/PTP_Nodes/B_E_1_M1.png -------------------------------------------------------------------------------- /images/PTP/Nodes/PTP_Nodes/B_E_1_M2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptp-sim/libPTP/HEAD/images/PTP/Nodes/PTP_Nodes/B_E_1_M2.png -------------------------------------------------------------------------------- /images/PTP/Nodes/PTP_Nodes/B_E_1_M3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptp-sim/libPTP/HEAD/images/PTP/Nodes/PTP_Nodes/B_E_1_M3.png -------------------------------------------------------------------------------- /images/PTP/Nodes/PTP_Nodes/B_E_1_SO.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptp-sim/libPTP/HEAD/images/PTP/Nodes/PTP_Nodes/B_E_1_SO.png -------------------------------------------------------------------------------- /images/PTP/Nodes/PTP_Nodes/B_E_2_M1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptp-sim/libPTP/HEAD/images/PTP/Nodes/PTP_Nodes/B_E_2_M1.png -------------------------------------------------------------------------------- /images/PTP/Nodes/PTP_Nodes/B_E_2_M2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptp-sim/libPTP/HEAD/images/PTP/Nodes/PTP_Nodes/B_E_2_M2.png -------------------------------------------------------------------------------- /images/PTP/Nodes/PTP_Nodes/B_E_2_M3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptp-sim/libPTP/HEAD/images/PTP/Nodes/PTP_Nodes/B_E_2_M3.png -------------------------------------------------------------------------------- /images/PTP/Nodes/PTP_Nodes/B_E_2_SO.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptp-sim/libPTP/HEAD/images/PTP/Nodes/PTP_Nodes/B_E_2_SO.png -------------------------------------------------------------------------------- /images/PTP/Nodes/PTP_Nodes/B_P_1_M1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptp-sim/libPTP/HEAD/images/PTP/Nodes/PTP_Nodes/B_P_1_M1.png -------------------------------------------------------------------------------- /images/PTP/Nodes/PTP_Nodes/B_P_1_M2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptp-sim/libPTP/HEAD/images/PTP/Nodes/PTP_Nodes/B_P_1_M2.png -------------------------------------------------------------------------------- /images/PTP/Nodes/PTP_Nodes/B_P_1_M3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptp-sim/libPTP/HEAD/images/PTP/Nodes/PTP_Nodes/B_P_1_M3.png -------------------------------------------------------------------------------- /images/PTP/Nodes/PTP_Nodes/B_P_1_SO.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptp-sim/libPTP/HEAD/images/PTP/Nodes/PTP_Nodes/B_P_1_SO.png -------------------------------------------------------------------------------- /images/PTP/Nodes/PTP_Nodes/B_P_2_M1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptp-sim/libPTP/HEAD/images/PTP/Nodes/PTP_Nodes/B_P_2_M1.png -------------------------------------------------------------------------------- /images/PTP/Nodes/PTP_Nodes/B_P_2_M2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptp-sim/libPTP/HEAD/images/PTP/Nodes/PTP_Nodes/B_P_2_M2.png -------------------------------------------------------------------------------- /images/PTP/Nodes/PTP_Nodes/B_P_2_M3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptp-sim/libPTP/HEAD/images/PTP/Nodes/PTP_Nodes/B_P_2_M3.png -------------------------------------------------------------------------------- /images/PTP/Nodes/PTP_Nodes/B_P_2_SO.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptp-sim/libPTP/HEAD/images/PTP/Nodes/PTP_Nodes/B_P_2_SO.png -------------------------------------------------------------------------------- /images/PTP/Nodes/PTP_Nodes/Generic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptp-sim/libPTP/HEAD/images/PTP/Nodes/PTP_Nodes/Generic.png -------------------------------------------------------------------------------- /images/PTP/Nodes/PTP_Nodes/Generic.xcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptp-sim/libPTP/HEAD/images/PTP/Nodes/PTP_Nodes/Generic.xcf -------------------------------------------------------------------------------- /images/PTP/Nodes/PTP_Nodes/N_E_1_M1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptp-sim/libPTP/HEAD/images/PTP/Nodes/PTP_Nodes/N_E_1_M1.png -------------------------------------------------------------------------------- /images/PTP/Nodes/PTP_Nodes/N_E_1_M2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptp-sim/libPTP/HEAD/images/PTP/Nodes/PTP_Nodes/N_E_1_M2.png -------------------------------------------------------------------------------- /images/PTP/Nodes/PTP_Nodes/N_E_1_M3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptp-sim/libPTP/HEAD/images/PTP/Nodes/PTP_Nodes/N_E_1_M3.png -------------------------------------------------------------------------------- /images/PTP/Nodes/PTP_Nodes/N_E_1_SO.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptp-sim/libPTP/HEAD/images/PTP/Nodes/PTP_Nodes/N_E_1_SO.png -------------------------------------------------------------------------------- /images/PTP/Nodes/PTP_Nodes/N_E_2_M1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptp-sim/libPTP/HEAD/images/PTP/Nodes/PTP_Nodes/N_E_2_M1.png -------------------------------------------------------------------------------- /images/PTP/Nodes/PTP_Nodes/N_E_2_M2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptp-sim/libPTP/HEAD/images/PTP/Nodes/PTP_Nodes/N_E_2_M2.png -------------------------------------------------------------------------------- /images/PTP/Nodes/PTP_Nodes/N_E_2_M3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptp-sim/libPTP/HEAD/images/PTP/Nodes/PTP_Nodes/N_E_2_M3.png -------------------------------------------------------------------------------- /images/PTP/Nodes/PTP_Nodes/N_E_2_SO.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptp-sim/libPTP/HEAD/images/PTP/Nodes/PTP_Nodes/N_E_2_SO.png -------------------------------------------------------------------------------- /images/PTP/Nodes/PTP_Nodes/N_P_1_M1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptp-sim/libPTP/HEAD/images/PTP/Nodes/PTP_Nodes/N_P_1_M1.png -------------------------------------------------------------------------------- /images/PTP/Nodes/PTP_Nodes/N_P_1_M2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptp-sim/libPTP/HEAD/images/PTP/Nodes/PTP_Nodes/N_P_1_M2.png -------------------------------------------------------------------------------- /images/PTP/Nodes/PTP_Nodes/N_P_1_M3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptp-sim/libPTP/HEAD/images/PTP/Nodes/PTP_Nodes/N_P_1_M3.png -------------------------------------------------------------------------------- /images/PTP/Nodes/PTP_Nodes/N_P_1_SO.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptp-sim/libPTP/HEAD/images/PTP/Nodes/PTP_Nodes/N_P_1_SO.png -------------------------------------------------------------------------------- /images/PTP/Nodes/PTP_Nodes/N_P_2_M1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptp-sim/libPTP/HEAD/images/PTP/Nodes/PTP_Nodes/N_P_2_M1.png -------------------------------------------------------------------------------- /images/PTP/Nodes/PTP_Nodes/N_P_2_M2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptp-sim/libPTP/HEAD/images/PTP/Nodes/PTP_Nodes/N_P_2_M2.png -------------------------------------------------------------------------------- /images/PTP/Nodes/PTP_Nodes/N_P_2_M3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptp-sim/libPTP/HEAD/images/PTP/Nodes/PTP_Nodes/N_P_2_M3.png -------------------------------------------------------------------------------- /images/PTP/Nodes/PTP_Nodes/N_P_2_SO.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptp-sim/libPTP/HEAD/images/PTP/Nodes/PTP_Nodes/N_P_2_SO.png -------------------------------------------------------------------------------- /images/PTP/Nodes/PTP_Nodes/T_E_1_M1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptp-sim/libPTP/HEAD/images/PTP/Nodes/PTP_Nodes/T_E_1_M1.png -------------------------------------------------------------------------------- /images/PTP/Nodes/PTP_Nodes/T_E_1_M2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptp-sim/libPTP/HEAD/images/PTP/Nodes/PTP_Nodes/T_E_1_M2.png -------------------------------------------------------------------------------- /images/PTP/Nodes/PTP_Nodes/T_E_1_M3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptp-sim/libPTP/HEAD/images/PTP/Nodes/PTP_Nodes/T_E_1_M3.png -------------------------------------------------------------------------------- /images/PTP/Nodes/PTP_Nodes/T_E_1_SO.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptp-sim/libPTP/HEAD/images/PTP/Nodes/PTP_Nodes/T_E_1_SO.png -------------------------------------------------------------------------------- /images/PTP/Nodes/PTP_Nodes/T_E_2_M1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptp-sim/libPTP/HEAD/images/PTP/Nodes/PTP_Nodes/T_E_2_M1.png -------------------------------------------------------------------------------- /images/PTP/Nodes/PTP_Nodes/T_E_2_M2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptp-sim/libPTP/HEAD/images/PTP/Nodes/PTP_Nodes/T_E_2_M2.png -------------------------------------------------------------------------------- /images/PTP/Nodes/PTP_Nodes/T_E_2_M3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptp-sim/libPTP/HEAD/images/PTP/Nodes/PTP_Nodes/T_E_2_M3.png -------------------------------------------------------------------------------- /images/PTP/Nodes/PTP_Nodes/T_E_2_SO.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptp-sim/libPTP/HEAD/images/PTP/Nodes/PTP_Nodes/T_E_2_SO.png -------------------------------------------------------------------------------- /images/PTP/Nodes/PTP_Nodes/T_P_1_M1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptp-sim/libPTP/HEAD/images/PTP/Nodes/PTP_Nodes/T_P_1_M1.png -------------------------------------------------------------------------------- /images/PTP/Nodes/PTP_Nodes/T_P_1_M2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptp-sim/libPTP/HEAD/images/PTP/Nodes/PTP_Nodes/T_P_1_M2.png -------------------------------------------------------------------------------- /images/PTP/Nodes/PTP_Nodes/T_P_1_M3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptp-sim/libPTP/HEAD/images/PTP/Nodes/PTP_Nodes/T_P_1_M3.png -------------------------------------------------------------------------------- /images/PTP/Nodes/PTP_Nodes/T_P_1_SO.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptp-sim/libPTP/HEAD/images/PTP/Nodes/PTP_Nodes/T_P_1_SO.png -------------------------------------------------------------------------------- /images/PTP/Nodes/PTP_Nodes/T_P_2_M1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptp-sim/libPTP/HEAD/images/PTP/Nodes/PTP_Nodes/T_P_2_M1.png -------------------------------------------------------------------------------- /images/PTP/Nodes/PTP_Nodes/T_P_2_M2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptp-sim/libPTP/HEAD/images/PTP/Nodes/PTP_Nodes/T_P_2_M2.png -------------------------------------------------------------------------------- /images/PTP/Nodes/PTP_Nodes/T_P_2_M3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptp-sim/libPTP/HEAD/images/PTP/Nodes/PTP_Nodes/T_P_2_M3.png -------------------------------------------------------------------------------- /images/PTP/Nodes/PTP_Nodes/T_P_2_SO.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptp-sim/libPTP/HEAD/images/PTP/Nodes/PTP_Nodes/T_P_2_SO.png -------------------------------------------------------------------------------- /images/PTP/Components/Clock/RealClock.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptp-sim/libPTP/HEAD/images/PTP/Components/Clock/RealClock.png -------------------------------------------------------------------------------- /images/PTP/Components/Clock/SineClock.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptp-sim/libPTP/HEAD/images/PTP/Components/Clock/SineClock.png -------------------------------------------------------------------------------- /images/PTP/Components/Delayer/Delayer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptp-sim/libPTP/HEAD/images/PTP/Components/Delayer/Delayer.png -------------------------------------------------------------------------------- /Docs/Usage_with_libPLN/Usage_with_libPLN.odt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptp-sim/libPTP/HEAD/Docs/Usage_with_libPLN/Usage_with_libPLN.odt -------------------------------------------------------------------------------- /Docs/Usage_with_libPLN/Usage_with_libPLN.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptp-sim/libPTP/HEAD/Docs/Usage_with_libPLN/Usage_with_libPLN.pdf -------------------------------------------------------------------------------- /images/PTP/Components/Clock/DigitalClock.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptp-sim/libPTP/HEAD/images/PTP/Components/Clock/DigitalClock.png -------------------------------------------------------------------------------- /images/PTP/Components/Clock/DigitalClock.xcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptp-sim/libPTP/HEAD/images/PTP/Components/Clock/DigitalClock.xcf -------------------------------------------------------------------------------- /images/PTP/Components/Clock/PerfectClock.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptp-sim/libPTP/HEAD/images/PTP/Components/Clock/PerfectClock.png -------------------------------------------------------------------------------- /images/PTP/Components/NIC_Ctrl/NIC_Ctrl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptp-sim/libPTP/HEAD/images/PTP/Components/NIC_Ctrl/NIC_Ctrl.png -------------------------------------------------------------------------------- /Docs/Usage_with_libPLN/images/Dependencies.dia: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptp-sim/libPTP/HEAD/Docs/Usage_with_libPLN/images/Dependencies.dia -------------------------------------------------------------------------------- /Docs/Usage_with_libPLN/images/Dependencies.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptp-sim/libPTP/HEAD/Docs/Usage_with_libPLN/images/Dependencies.png -------------------------------------------------------------------------------- /images/PTP/Components/PTP_Stack/PTP_Stack.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptp-sim/libPTP/HEAD/images/PTP/Components/PTP_Stack/PTP_Stack.png -------------------------------------------------------------------------------- /images/PTP/Components/RelayUnit/RelayUnit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptp-sim/libPTP/HEAD/images/PTP/Components/RelayUnit/RelayUnit.png -------------------------------------------------------------------------------- /Docs/Measurements/SimpleNetwork/PI_Parameters.ods: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptp-sim/libPTP/HEAD/Docs/Measurements/SimpleNetwork/PI_Parameters.ods -------------------------------------------------------------------------------- /images/PTP/Components/ClockServo/ClockServo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptp-sim/libPTP/HEAD/images/PTP/Components/ClockServo/ClockServo.png -------------------------------------------------------------------------------- /images/PTP/Components/Clock/ConstantDriftClock.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptp-sim/libPTP/HEAD/images/PTP/Components/Clock/ConstantDriftClock.png -------------------------------------------------------------------------------- /images/PTP/Components/Clock/License.txt: -------------------------------------------------------------------------------- 1 | The clock icons are a derivative work of the alarmd.png file from the GPLv2 licensed Buttonized icon theme. 2 | -------------------------------------------------------------------------------- /images/PTP/Components/ClockServo/PI_ClockServo.dia: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptp-sim/libPTP/HEAD/images/PTP/Components/ClockServo/PI_ClockServo.dia -------------------------------------------------------------------------------- /images/PTP/Components/ClockServo/PI_ClockServo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptp-sim/libPTP/HEAD/images/PTP/Components/ClockServo/PI_ClockServo.png -------------------------------------------------------------------------------- /images/PTP/Components/ClockServo/PI_ClockServo.xcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptp-sim/libPTP/HEAD/images/PTP/Components/ClockServo/PI_ClockServo.xcf -------------------------------------------------------------------------------- /images/PTP/Components/NIC/License.txt: -------------------------------------------------------------------------------- 1 | The NIC icon is a derivative work of the audio-card.png file from the GPLv2 licensed Buttonized icon theme. 2 | -------------------------------------------------------------------------------- /images/PTP/Nodes/TimeDiffObserver/TimeDiffObserver.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptp-sim/libPTP/HEAD/images/PTP/Nodes/TimeDiffObserver/TimeDiffObserver.png -------------------------------------------------------------------------------- /Docs/Measurements/SimpleNetwork/AsymmetryExperiment.ods: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptp-sim/libPTP/HEAD/Docs/Measurements/SimpleNetwork/AsymmetryExperiment.ods -------------------------------------------------------------------------------- /images/PTP/Components/InternalModule/InternalModule.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptp-sim/libPTP/HEAD/images/PTP/Components/InternalModule/InternalModule.png -------------------------------------------------------------------------------- /images/PTP/Components/Encap/License.txt: -------------------------------------------------------------------------------- 1 | The Encap icon is a derivative work of the add-folder-to-archive.png file from the GPLv2 licensed Buttonized icon theme. 2 | -------------------------------------------------------------------------------- /images/PTP/Components/MAC/License.txt: -------------------------------------------------------------------------------- 1 | The MAC icon is renamed and resized version of the nm-device-wired.png file from the GPLv2 licensed Buttonized icon theme. 2 | -------------------------------------------------------------------------------- /simulations/run: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | cd `dirname $0` 3 | ../src/ptp_simulation -n .:../src $* 4 | # for shared lib, use: opp_run -l ../src/ptp_simulation -n .:../src $* 5 | -------------------------------------------------------------------------------- /images/PTP/Components/PHY/License.txt: -------------------------------------------------------------------------------- 1 | The PHY icon is renamed and resized version of the applications-electronics.png file from the GPLv2 licensed Buttonized icon theme. 2 | -------------------------------------------------------------------------------- /images/PTP/Components/PTP_Stack/License.txt: -------------------------------------------------------------------------------- 1 | The PTP_Stack icon is renamed and resized version of the player_time.png file from the GPLv2 licensed Buttonized icon theme. 2 | -------------------------------------------------------------------------------- /images/PTP/Components/Delayer/License.txt: -------------------------------------------------------------------------------- 1 | The Delayer icon is renamed and resized version of the object-flip-vertical.png file from the GPLv2 licensed Buttonized icon theme. 2 | -------------------------------------------------------------------------------- /images/PTP/Components/RelayUnit/License.txt: -------------------------------------------------------------------------------- 1 | The RelayUnit icon is renamed and resized version of the stock_shuffle.png file from the GPLv2 licensed Buttonized icon theme. 2 | -------------------------------------------------------------------------------- /images/PTP/Base/Blank/License.txt: -------------------------------------------------------------------------------- 1 | The Blank icon is a derivative work from the GPLv2 licensed Buttonized icon theme. 2 | It is the generic background that is common to all images. 3 | -------------------------------------------------------------------------------- /images/PTP/Components/NIC_Ctrl/License.txt: -------------------------------------------------------------------------------- 1 | The NIC_Ctrl icon is renamed and resized version of the system-control-network.png file from the GPLv2 licensed Buttonized icon theme. 2 | -------------------------------------------------------------------------------- /images/PTP/Components/PTP_EthernetMapping/PTP_EthernetMapping.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptp-sim/libPTP/HEAD/images/PTP/Components/PTP_EthernetMapping/PTP_EthernetMapping.png -------------------------------------------------------------------------------- /images/PTP/Components/PTP_EthernetMapping/PTP_EthernetMapping.xcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptp-sim/libPTP/HEAD/images/PTP/Components/PTP_EthernetMapping/PTP_EthernetMapping.xcf -------------------------------------------------------------------------------- /images/PTP/Nodes/TimeDiffObserver/License.txt: -------------------------------------------------------------------------------- 1 | The TimeDiffObserver icon is a renamed and resized version of the gnome-util.png file from the GPLv2 licensed Buttonized icon theme. 2 | -------------------------------------------------------------------------------- /images/PTP/Components/InternalModule/License.txt: -------------------------------------------------------------------------------- 1 | The InternalModule icon is renamed and resized version of the emblem-danger.png file from the GPLv2 licensed Buttonized icon theme. 2 | -------------------------------------------------------------------------------- /images/PTP/Components/PTP_EthernetMapping/License.txt: -------------------------------------------------------------------------------- 1 | The PTP_EthernetMapping icon is a derivative work of the files network.png, arrow-down.png and arrow-up.png from the GPLv2 licensed Buttonized icon theme. 2 | -------------------------------------------------------------------------------- /images/PTP/Nodes/PTP_Nodes/License.txt: -------------------------------------------------------------------------------- 1 | The PTP node icons are a derivative work of the generic background and the bookmarks.png file from the GPLv2 licensed Buttonized icon theme combinded with self-made artwork. 2 | -------------------------------------------------------------------------------- /images/PTP/Components/ClockServo/License.txt: -------------------------------------------------------------------------------- 1 | The ClockServo icon is a renamed and resized version of the configure.png file from the GPLv2 licensed Buttonized icon theme. 2 | The PI_ClockServo icon is based on the generic background of the Buttonized icon theme, combined with self-made artwork. 3 | -------------------------------------------------------------------------------- /.oppbuildspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /images/PTP/LICENSE.txt: -------------------------------------------------------------------------------- 1 | 2 | Relationship to the Buttonized icon theme: 3 | ================================================== 4 | 5 | The icons used in the libPTP project are a derivative work. 6 | They are based on icons from the 'Buttonized' icon theme. 7 | This icon theme is licensed by Shaun Marolf under the terms of the GPLv2. 8 | 9 | Any derivative icons are again licensed under terms of the GPLv2. 10 | 11 | The URL from where the original Buttonized icon theme was downloaded is 12 | http://kde-look.org/content/show.php/?content=161553 13 | -------------------------------------------------------------------------------- /images/PTP/Messages/License.txt: -------------------------------------------------------------------------------- 1 | The PTP message icons are based on icons from the GPLv2 licensed Buttonized icon theme. 2 | In detail, the original icons from which they are derived are as follows: 3 | 4 | Announce: applications-chat.png 5 | DelayReq: stock_repeat.png 6 | DelayResp: stock_repeat.png 7 | Management: package_settings.png 8 | PDelayReq: stock_refresh.png 9 | PDelayResp: stock_refresh.png 10 | PDelayRespFU: stock_refresh.png 11 | Signaling: emblem-important.png 12 | Sync: bookmarks.png 13 | SyncFU: bookmarks.png 14 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | all: checkmakefiles 2 | cd src && $(MAKE) 3 | 4 | clean: checkmakefiles 5 | cd src && $(MAKE) clean 6 | 7 | cleanall: checkmakefiles 8 | cd src && $(MAKE) MODE=release clean 9 | cd src && $(MAKE) MODE=debug clean 10 | rm -f src/Makefile 11 | 12 | makefiles: 13 | cd src && opp_makemake -f --deep 14 | 15 | checkmakefiles: 16 | @if [ ! -f src/Makefile ]; then \ 17 | echo; \ 18 | echo '======================================================================='; \ 19 | echo 'src/Makefile does not exist. Please use "make makefiles" to generate it!'; \ 20 | echo '======================================================================='; \ 21 | echo; \ 22 | exit 1; \ 23 | fi 24 | -------------------------------------------------------------------------------- /Makefile.vc: -------------------------------------------------------------------------------- 1 | all: checkmakefiles 2 | cd src && $(MAKE) -f Makefile.vc 3 | 4 | clean: checkmakefiles 5 | cd src && $(MAKE) -f Makefile.vc clean 6 | 7 | cleanall: checkmakefiles 8 | cd src && $(MAKE) -f Makefile.vc MODE=release clean 9 | cd src && $(MAKE) -f Makefile.vc MODE=debug clean 10 | 11 | makefiles: 12 | cd src && call opp_nmakemake -f --deep 13 | 14 | checkmakefiles: 15 | @if not exist src\Makefile.vc ( \ 16 | echo. && \ 17 | echo ============================================================================ && \ 18 | echo src/Makefile.vc does not exist. Please use the following command to generate it: && \ 19 | echo nmake -f Makefile.vc makefiles && \ 20 | echo ============================================================================ && \ 21 | echo. && \ 22 | exit 1 ) 23 | -------------------------------------------------------------------------------- /src/package.ned: -------------------------------------------------------------------------------- 1 | // ============================================================================ 2 | // 3 | // Copyright 2013-2015 Wolfgang Wallner (wolfgang-wallner AT gmx.at) 4 | // 5 | // This file is part of the LibPTP project. 6 | // 7 | // The LibPTP project is free software: you can redistribute it 8 | // and/or modify it under the terms of the GNU General Public License as 9 | // published by the Free Software Foundation, either version 3 of the License, 10 | // or (at your option) any later version. 11 | // 12 | // The LibPTP project is distributed in the hope that it will be 13 | // useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License.com for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License.com 18 | // along with The LibPTP project. 19 | // If not, see . 20 | // 21 | // ============================================================================ 22 | 23 | package libptp; 24 | 25 | @license(GPL); 26 | -------------------------------------------------------------------------------- /simulations/package.ned: -------------------------------------------------------------------------------- 1 | // ============================================================================ 2 | // 3 | // Copyright 2013-2015 Wolfgang Wallner (wolfgang-wallner AT gmx.at) 4 | // 5 | // This file is part of the LibPTP project. 6 | // 7 | // The LibPTP project is free software: you can redistribute it 8 | // and/or modify it under the terms of the GNU General Public License as 9 | // published by the Free Software Foundation, either version 3 of the License, 10 | // or (at your option) any later version. 11 | // 12 | // The LibPTP project is distributed in the hope that it will be 13 | // useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License.com for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License.com 18 | // along with The LibPTP project. 19 | // If not, see . 20 | // 21 | // ============================================================================ 22 | 23 | package libptp.simulations; 24 | 25 | @license(PTP); 26 | -------------------------------------------------------------------------------- /src/Makefrag_GenericBuildOptions: -------------------------------------------------------------------------------- 1 | 2 | # =================================================================== 3 | # Instructions 4 | # =================================================================== 5 | # 6 | # This file contains generic configuration for the entire project. 7 | # Changes to this file should commited upstream. 8 | # 9 | # Local changes to the configuration should be kept in separate 10 | # files. 11 | # 12 | 13 | # =================================================================== 14 | # Compiler flags 15 | # =================================================================== 16 | #CXXFLAGS += -pedantic 17 | 18 | # =================================================================== 19 | # Include paths 20 | # =================================================================== 21 | 22 | # =================================================================== 23 | # Library paths 24 | # =================================================================== 25 | 26 | # =================================================================== 27 | # Libraries 28 | # =================================================================== 29 | -------------------------------------------------------------------------------- /src/Testbenches/ClockTest/ClockTest.ned: -------------------------------------------------------------------------------- 1 | // ============================================================================ 2 | // 3 | // Copyright 2013-2015 Wolfgang Wallner (wolfgang-wallner AT gmx.at) 4 | // 5 | // This file is part of the LibPTP project. 6 | // 7 | // The LibPTP project is free software: you can redistribute it 8 | // and/or modify it under the terms of the GNU General Public License as 9 | // published by the Free Software Foundation, either version 3 of the License, 10 | // or (at your option) any later version. 11 | // 12 | // The LibPTP project is distributed in the hope that it will be 13 | // useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License.com for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License.com 18 | // along with The LibPTP project. 19 | // If not, see . 20 | // 21 | // ============================================================================ 22 | 23 | package libptp.Testbenches.ClockTest; 24 | 25 | simple ClockTest 26 | { 27 | parameters: 28 | string ClockPath = default("^.Clock"); 29 | 30 | gates: 31 | } 32 | -------------------------------------------------------------------------------- /src/Testbenches/PTP_EthSink/PTP_EthSink.ned: -------------------------------------------------------------------------------- 1 | // ============================================================================ 2 | // 3 | // Copyright 2013-2015 Wolfgang Wallner (wolfgang-wallner AT gmx.at) 4 | // 5 | // This file is part of the LibPTP project. 6 | // 7 | // The LibPTP project is free software: you can redistribute it 8 | // and/or modify it under the terms of the GNU General Public License as 9 | // published by the Free Software Foundation, either version 3 of the License, 10 | // or (at your option) any later version. 11 | // 12 | // The LibPTP project is distributed in the hope that it will be 13 | // useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License.com for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License.com 18 | // along with The LibPTP project. 19 | // If not, see . 20 | // 21 | // ============================================================================ 22 | 23 | package libptp.Testbenches.PTP_EthSink; 24 | 25 | simple PTP_EthSink 26 | { 27 | @display("i=block/filter"); 28 | gates: 29 | input lowerLayerIn @labels(EtherFrame); 30 | } 31 | -------------------------------------------------------------------------------- /src/Testbenches/PtpStackTest/PtpStackTest.ned: -------------------------------------------------------------------------------- 1 | // ============================================================================ 2 | // 3 | // Copyright 2013-2015 Wolfgang Wallner (wolfgang-wallner AT gmx.at) 4 | // 5 | // This file is part of the LibPTP project. 6 | // 7 | // The LibPTP project is free software: you can redistribute it 8 | // and/or modify it under the terms of the GNU General Public License as 9 | // published by the Free Software Foundation, either version 3 of the License, 10 | // or (at your option) any later version. 11 | // 12 | // The LibPTP project is distributed in the hope that it will be 13 | // useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License.com for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License.com 18 | // along with The LibPTP project. 19 | // If not, see . 20 | // 21 | // ============================================================================ 22 | 23 | package libptp.Testbenches.PtpStackTest; 24 | 25 | simple PtpStackTest 26 | { 27 | parameters: 28 | 29 | string TestType = default("NONE"); 30 | @display("i=msg/req"); 31 | } 32 | -------------------------------------------------------------------------------- /src/Testbenches/EncapTest/EncapTest.ned: -------------------------------------------------------------------------------- 1 | // ============================================================================ 2 | // 3 | // Copyright 2013-2015 Wolfgang Wallner (wolfgang-wallner AT gmx.at) 4 | // 5 | // This file is part of the LibPTP project. 6 | // 7 | // The LibPTP project is free software: you can redistribute it 8 | // and/or modify it under the terms of the GNU General Public License as 9 | // published by the Free Software Foundation, either version 3 of the License, 10 | // or (at your option) any later version. 11 | // 12 | // The LibPTP project is distributed in the hope that it will be 13 | // useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License.com for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License.com 18 | // along with The LibPTP project. 19 | // If not, see . 20 | // 21 | // ============================================================================ 22 | 23 | package libptp.Testbenches.EncapTest; 24 | 25 | simple EncapTest 26 | { 27 | gates: 28 | input upperLayerIn @labels(Ieee802Ctrl/up); 29 | output upperLayerOut @labels(Ieee802Ctrl/down); 30 | } 31 | -------------------------------------------------------------------------------- /src/Testbenches/ClockScaleTest/ClockScaleTest.ned: -------------------------------------------------------------------------------- 1 | // ============================================================================ 2 | // 3 | // Copyright 2013-2015 Wolfgang Wallner (wolfgang-wallner AT gmx.at) 4 | // 5 | // This file is part of the LibPTP project. 6 | // 7 | // The LibPTP project is free software: you can redistribute it 8 | // and/or modify it under the terms of the GNU General Public License as 9 | // published by the Free Software Foundation, either version 3 of the License, 10 | // or (at your option) any later version. 11 | // 12 | // The LibPTP project is distributed in the hope that it will be 13 | // useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License.com for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License.com 18 | // along with The LibPTP project. 19 | // If not, see . 20 | // 21 | // ============================================================================ 22 | 23 | package libptp.Testbenches.ClockScaleTest; 24 | 25 | simple ClockScaleTest 26 | { 27 | @display("i=block/telnet"); 28 | 29 | string ClockPath = default("^.Clock"); 30 | 31 | bool Enabled = default(true); 32 | } 33 | -------------------------------------------------------------------------------- /.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | libPTP 4 | 5 | 6 | inet 7 | OMNeT_Utils 8 | 9 | 10 | 11 | org.omnetpp.cdt.MakefileBuilder 12 | 13 | 14 | 15 | 16 | org.omnetpp.scave.builder.vectorfileindexer 17 | 18 | 19 | 20 | 21 | org.eclipse.cdt.managedbuilder.core.genmakebuilder 22 | clean,full,incremental, 23 | 24 | 25 | 26 | 27 | org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder 28 | full,incremental, 29 | 30 | 31 | 32 | 33 | 34 | org.eclipse.cdt.core.cnature 35 | org.eclipse.cdt.core.ccnature 36 | org.eclipse.cdt.managedbuilder.core.managedBuildNature 37 | org.eclipse.cdt.managedbuilder.core.ScannerConfigNature 38 | org.omnetpp.main.omnetppnature 39 | 40 | 41 | -------------------------------------------------------------------------------- /src/Testbenches/BabblingIP/BabblingIP.ned: -------------------------------------------------------------------------------- 1 | // ============================================================================ 2 | // 3 | // Copyright 2013-2015 Wolfgang Wallner (wolfgang-wallner AT gmx.at) 4 | // 5 | // This file is part of the LibPTP project. 6 | // 7 | // The LibPTP project is free software: you can redistribute it 8 | // and/or modify it under the terms of the GNU General Public License as 9 | // published by the Free Software Foundation, either version 3 of the License, 10 | // or (at your option) any later version. 11 | // 12 | // The LibPTP project is distributed in the hope that it will be 13 | // useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License.com for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License.com 18 | // along with The LibPTP project. 19 | // If not, see . 20 | // 21 | // ============================================================================ 22 | 23 | package libptp.Testbenches.BabblingIP; 24 | 25 | simple BabblingIP 26 | { 27 | parameters: 28 | 29 | @display("i=block/user"); 30 | volatile double Interval @unit(s) = default( uniform(1s,5s) ); 31 | 32 | gates: 33 | output IpOut; 34 | } 35 | -------------------------------------------------------------------------------- /src/Testbenches/ClockScheduleTest/ClockScheduleTest.ned: -------------------------------------------------------------------------------- 1 | // ============================================================================ 2 | // 3 | // Copyright 2013-2015 Wolfgang Wallner (wolfgang-wallner AT gmx.at) 4 | // 5 | // This file is part of the LibPTP project. 6 | // 7 | // The LibPTP project is free software: you can redistribute it 8 | // and/or modify it under the terms of the GNU General Public License as 9 | // published by the Free Software Foundation, either version 3 of the License, 10 | // or (at your option) any later version. 11 | // 12 | // The LibPTP project is distributed in the hope that it will be 13 | // useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License.com for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License.com 18 | // along with The LibPTP project. 19 | // If not, see . 20 | // 21 | // ============================================================================ 22 | 23 | package libptp.Testbenches.ClockScheduleTest; 24 | 25 | simple ClockScheduleTest 26 | { 27 | @display("i=block/layer"); 28 | 29 | string ClockPath = default("^.Clock"); 30 | 31 | bool Enabled = default( true ); 32 | } 33 | -------------------------------------------------------------------------------- /src/Hardware/PTP_EtherEncap/IPTP_EtherEncap.ned: -------------------------------------------------------------------------------- 1 | // ============================================================================ 2 | // 3 | // Copyright 2013-2015 Wolfgang Wallner (wolfgang-wallner AT gmx.at) 4 | // 5 | // This file is part of the LibPTP project. 6 | // 7 | // The LibPTP project is free software: you can redistribute it 8 | // and/or modify it under the terms of the GNU General Public License as 9 | // published by the Free Software Foundation, either version 3 of the License, 10 | // or (at your option) any later version. 11 | // 12 | // The LibPTP project is distributed in the hope that it will be 13 | // useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License.com for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License.com 18 | // along with The LibPTP project. 19 | // If not, see . 20 | // 21 | // ============================================================================ 22 | 23 | package libptp.Hardware.PTP_EtherEncap; 24 | 25 | import inet.linklayer.ethernet.IEtherEncap; 26 | 27 | moduleinterface IPTP_EtherEncap extends IEtherEncap 28 | { 29 | parameters: 30 | @display("i=PTP/Components/Encap/Encap"); 31 | 32 | // PTP configuration 33 | bool PTP_Enable; 34 | } 35 | -------------------------------------------------------------------------------- /src/Testbenches/EtherPhyTester/EtherPhyTester.ned: -------------------------------------------------------------------------------- 1 | // ============================================================================ 2 | // 3 | // Copyright 2013-2015 Wolfgang Wallner (wolfgang-wallner AT gmx.at) 4 | // 5 | // This file is part of the LibPTP project. 6 | // 7 | // The LibPTP project is free software: you can redistribute it 8 | // and/or modify it under the terms of the GNU General Public License as 9 | // published by the Free Software Foundation, either version 3 of the License, 10 | // or (at your option) any later version. 11 | // 12 | // The LibPTP project is distributed in the hope that it will be 13 | // useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License.com for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License.com 18 | // along with The LibPTP project. 19 | // If not, see . 20 | // 21 | // ============================================================================ 22 | 23 | package libptp.Testbenches.EtherPhyTester; 24 | 25 | simple EtherPhyTester 26 | { 27 | parameters: 28 | 29 | @display("i=block/mac"); 30 | 31 | @signal[Delay](type=simtime_t); 32 | @statistic[Delay](record=stats,vector,histogram); 33 | 34 | gates: 35 | 36 | inout TestGate @labels(EtherFrame); 37 | 38 | } 39 | -------------------------------------------------------------------------------- /src/Hardware/PTP_EtherEncap/PTP_EtherEncap.ned: -------------------------------------------------------------------------------- 1 | // ============================================================================ 2 | // 3 | // Copyright 2013-2015 Wolfgang Wallner (wolfgang-wallner AT gmx.at) 4 | // 5 | // This file is part of the LibPTP project. 6 | // 7 | // The LibPTP project is free software: you can redistribute it 8 | // and/or modify it under the terms of the GNU General Public License as 9 | // published by the Free Software Foundation, either version 3 of the License, 10 | // or (at your option) any later version. 11 | // 12 | // The LibPTP project is distributed in the hope that it will be 13 | // useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License.com for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License.com 18 | // along with The LibPTP project. 19 | // If not, see . 20 | // 21 | // ============================================================================ 22 | 23 | package libptp.Hardware.PTP_EtherEncap; 24 | 25 | import inet.linklayer.ethernet.EtherEncap; 26 | 27 | simple PTP_EtherEncap extends EtherEncap like IPTP_EtherEncap 28 | { 29 | parameters: 30 | @display("i=PTP/Components/Encap/Encap"); 31 | @class(PTP_EtherEncap); 32 | 33 | // PTP configuration 34 | bool PTP_Enable = default(true); 35 | } 36 | -------------------------------------------------------------------------------- /src/Hardware/DualDelayer/DelayQueue/DelayQueue.ned: -------------------------------------------------------------------------------- 1 | // ============================================================================ 2 | // 3 | // Copyright 2013-2015 Wolfgang Wallner (wolfgang-wallner AT gmx.at) 4 | // 5 | // This file is part of the LibPTP project. 6 | // 7 | // The LibPTP project is free software: you can redistribute it 8 | // and/or modify it under the terms of the GNU General Public License as 9 | // published by the Free Software Foundation, either version 3 of the License, 10 | // or (at your option) any later version. 11 | // 12 | // The LibPTP project is distributed in the hope that it will be 13 | // useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License.com for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License.com 18 | // along with The LibPTP project. 19 | // If not, see . 20 | // 21 | // ============================================================================ 22 | 23 | package libptp.Hardware.DualDelayer.DelayQueue; 24 | 25 | import inet.base.IHook; 26 | 27 | simple DelayQueue like IHook 28 | { 29 | parameters: 30 | @display("i=status/lightning"); 31 | 32 | volatile double Delay @unit(s) = default(0s); 33 | int Size = default(10); 34 | 35 | gates: 36 | input in; 37 | output out; 38 | } 39 | -------------------------------------------------------------------------------- /src/Testbenches/ClockServoTest/ClockServoTest.ned: -------------------------------------------------------------------------------- 1 | // ============================================================================ 2 | // 3 | // Copyright 2013-2015 Wolfgang Wallner (wolfgang-wallner AT gmx.at) 4 | // 5 | // This file is part of the LibPTP project. 6 | // 7 | // The LibPTP project is free software: you can redistribute it 8 | // and/or modify it under the terms of the GNU General Public License as 9 | // published by the Free Software Foundation, either version 3 of the License, 10 | // or (at your option) any later version. 11 | // 12 | // The LibPTP project is distributed in the hope that it will be 13 | // useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License.com for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License.com 18 | // along with The LibPTP project. 19 | // If not, see . 20 | // 21 | // ============================================================================ 22 | 23 | package libptp.Testbenches.ClockServoTest; 24 | 25 | simple ClockServoTest 26 | { 27 | parameters: 28 | 29 | @display("i=block/mac"); 30 | 31 | string ClockServoPath = default("^.ClockServo"); 32 | string MasterClockPath = default("^.MasterClock"); 33 | string SlaveClockPath = default("^.SlaveClock"); 34 | 35 | double SampleInterval @unit(s) = default(1s); 36 | } 37 | -------------------------------------------------------------------------------- /src/Makefrag_Boost: -------------------------------------------------------------------------------- 1 | # =================================================================== 2 | # Instructions 3 | # =================================================================== 4 | # 5 | # This file contains configuration options to link against your 6 | # local boost installation. It needs to be customized to your 7 | # local setup. 8 | # 9 | # Changes to this file should be kept local, and should not be 10 | # commited upstream. 11 | # 12 | # To avoid checking in your local changes to this file, the 13 | # following git command might be useful: 14 | # 15 | # git update-index --assume-unchanged src/Makefrag_Boost 16 | # 17 | # The effect of this command can be inverted using the option 18 | # --no-assume-unchanged 19 | # 20 | 21 | # =================================================================== 22 | # Compiler flags 23 | # =================================================================== 24 | 25 | # =================================================================== 26 | # Include paths 27 | # =================================================================== 28 | 29 | # Include path for Boost library 30 | #INCLUDE_PATH += -I"C:/boost" 31 | 32 | # =================================================================== 33 | # Library paths 34 | # =================================================================== 35 | 36 | # =================================================================== 37 | # Libraries 38 | # =================================================================== 39 | -------------------------------------------------------------------------------- /src/Hardware/HwClock/ScheduleClock/IScheduleClock.ned: -------------------------------------------------------------------------------- 1 | // ============================================================================ 2 | // 3 | // Copyright 2013-2015 Wolfgang Wallner (wolfgang-wallner AT gmx.at) 4 | // 5 | // This file is part of the LibPTP project. 6 | // 7 | // The LibPTP project is free software: you can redistribute it 8 | // and/or modify it under the terms of the GNU General Public License as 9 | // published by the Free Software Foundation, either version 3 of the License, 10 | // or (at your option) any later version. 11 | // 12 | // The LibPTP project is distributed in the hope that it will be 13 | // useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License.com for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License.com 18 | // along with The LibPTP project. 19 | // If not, see . 20 | // 21 | // ============================================================================ 22 | 23 | package libptp.Hardware.HwClock.ScheduleClock; 24 | 25 | import libptp.Hardware.HwClock.AdjustableClock.IAdjustableClock; 26 | 27 | moduleinterface IScheduleClock extends IAdjustableClock 28 | { 29 | parameters: 30 | @display("i=PTP/Components/Clock/DigitalClock"); 31 | 32 | // Clock configuration 33 | double ScheduleEdgePrecision @unit(s); 34 | 35 | // Debug parameters 36 | bool EnableScheduleDebugOutput; 37 | } 38 | -------------------------------------------------------------------------------- /src/Software/PTP_EthernetMapping/PTP_Ctrl/PTP_Ctrl.msg: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 6 | // 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | 16 | // ================================================= 17 | // Make needed C++ stuff available 18 | // ================================================= 19 | cplusplus {{ 20 | #include "Ieee802Ctrl_m.h" 21 | }} 22 | 23 | // ================================================= 24 | // Class announcements 25 | // ================================================= 26 | class noncobject Ieee802Ctrl; 27 | 28 | // ================================================= 29 | // Type definitions 30 | // ================================================= 31 | 32 | // ================================================= 33 | // Message definitions 34 | // ================================================= 35 | class PTP_Ctrl extends Ieee802Ctrl { 36 | int rxPort = -1; 37 | int txPort = -1; 38 | } 39 | -------------------------------------------------------------------------------- /src/Hardware/HwClock/AdjustableClock/IAdjustableClock.ned: -------------------------------------------------------------------------------- 1 | // ============================================================================ 2 | // 3 | // Copyright 2013-2015 Wolfgang Wallner (wolfgang-wallner AT gmx.at) 4 | // 5 | // This file is part of the LibPTP project. 6 | // 7 | // The LibPTP project is free software: you can redistribute it 8 | // and/or modify it under the terms of the GNU General Public License as 9 | // published by the Free Software Foundation, either version 3 of the License, 10 | // or (at your option) any later version. 11 | // 12 | // The LibPTP project is distributed in the hope that it will be 13 | // useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License.com for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License.com 18 | // along with The LibPTP project. 19 | // If not, see . 20 | // 21 | // ============================================================================ 22 | 23 | package libptp.Hardware.HwClock.AdjustableClock; 24 | 25 | import libptp.Hardware.HwClock.HwClock.IHwClock; 26 | 27 | moduleinterface IAdjustableClock extends IHwClock 28 | { 29 | parameters: 30 | @display("i=PTP/Components/Clock/DigitalClock"); 31 | 32 | // Clock configuration 33 | bool EnableAdjustments; 34 | int ScaleFactor_LowerBound_ppb; 35 | int ScaleFactor_UpperBound_ppb; 36 | double BeginScaledTime @unit(s); 37 | } 38 | -------------------------------------------------------------------------------- /src/Hardware/DualDelayer/IDualDelayer.ned: -------------------------------------------------------------------------------- 1 | // ============================================================================ 2 | // 3 | // Copyright 2013-2015 Wolfgang Wallner (wolfgang-wallner AT gmx.at) 4 | // 5 | // This file is part of the LibPTP project. 6 | // 7 | // The LibPTP project is free software: you can redistribute it 8 | // and/or modify it under the terms of the GNU General Public License as 9 | // published by the Free Software Foundation, either version 3 of the License, 10 | // or (at your option) any later version. 11 | // 12 | // The LibPTP project is distributed in the hope that it will be 13 | // useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License.com for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License.com 18 | // along with The LibPTP project. 19 | // If not, see . 20 | // 21 | // ============================================================================ 22 | 23 | package libptp.Hardware.DualDelayer; 24 | 25 | moduleinterface IDualDelayer 26 | { 27 | parameters: 28 | 29 | @display("i=PTP/Components/Delayer/Delayer"); 30 | 31 | volatile double UpDelay @unit(s); 32 | volatile double DownDelay @unit(s); 33 | 34 | bool EnableUpDelay; 35 | bool EnableDownDelay; 36 | 37 | gates: 38 | 39 | input upperLayerIn; 40 | output upperLayerOut; 41 | input lowerLayerIn; 42 | output lowerLayerOut; 43 | } 44 | -------------------------------------------------------------------------------- /src/Software/ClockServo/IClockServo.ned: -------------------------------------------------------------------------------- 1 | // ============================================================================ 2 | // 3 | // Copyright 2013-2015 Wolfgang Wallner (wolfgang-wallner AT gmx.at) 4 | // 5 | // This file is part of the LibPTP project. 6 | // 7 | // The LibPTP project is free software: you can redistribute it 8 | // and/or modify it under the terms of the GNU General Public License as 9 | // published by the Free Software Foundation, either version 3 of the License, 10 | // or (at your option) any later version. 11 | // 12 | // The LibPTP project is distributed in the hope that it will be 13 | // useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License.com for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License.com 18 | // along with The LibPTP project. 19 | // If not, see . 20 | // 21 | // ============================================================================ 22 | 23 | package libptp.Software.ClockServo; 24 | 25 | moduleinterface IClockServo 26 | { 27 | parameters: 28 | @display("i=PTP/Components/ClockServo/ClockServo"); 29 | 30 | // Control configuration 31 | bool EnableSyntonize; 32 | bool EnableTimeJump; 33 | bool EnableSynchronize; 34 | int FrequEstShift; 35 | double MaxFrequEstInterval @unit(s); 36 | double OffsetThreshForReset @unit(s); 37 | 38 | // Debug 39 | bool EnableDebugOutput; 40 | } 41 | -------------------------------------------------------------------------------- /src/Hardware/EtherPhy/IEtherPhy.ned: -------------------------------------------------------------------------------- 1 | // ============================================================================ 2 | // 3 | // Copyright 2013-2015 Wolfgang Wallner (wolfgang-wallner AT gmx.at) 4 | // 5 | // This file is part of the LibPTP project. 6 | // 7 | // The LibPTP project is free software: you can redistribute it 8 | // and/or modify it under the terms of the GNU General Public License as 9 | // published by the Free Software Foundation, either version 3 of the License, 10 | // or (at your option) any later version. 11 | // 12 | // The LibPTP project is distributed in the hope that it will be 13 | // useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License.com for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License.com 18 | // along with The LibPTP project. 19 | // If not, see . 20 | // 21 | // ============================================================================ 22 | 23 | package libptp.Hardware.EtherPhy; 24 | 25 | moduleinterface IEtherPhy 26 | { 27 | parameters: 28 | 29 | @display("i=PTP/Components/PHY/PHY"); 30 | 31 | // The Rx delay is added to incoming frames (phy -> mii). 32 | volatile double rxDelay @unit(s); 33 | 34 | // The Tx delay is added to outgoing frames (mii -> phy). 35 | volatile double txDelay @unit(s); 36 | 37 | gates: 38 | inout mii @labels(EtherFrame); // Media Independent Interface to MAC 39 | inout phy @labels(EtherFrame); // Phy interface to network 40 | } 41 | -------------------------------------------------------------------------------- /src/Hardware/PTP_RelayUnit/IPTP_MACRelayUnit.ned: -------------------------------------------------------------------------------- 1 | // ============================================================================ 2 | // 3 | // Copyright 2013-2015 Wolfgang Wallner (wolfgang-wallner AT gmx.at) 4 | // 5 | // This file is part of the LibPTP project. 6 | // 7 | // The LibPTP project is free software: you can redistribute it 8 | // and/or modify it under the terms of the GNU General Public License as 9 | // published by the Free Software Foundation, either version 3 of the License, 10 | // or (at your option) any later version. 11 | // 12 | // The LibPTP project is distributed in the hope that it will be 13 | // useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License.com for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License.com 18 | // along with The LibPTP project. 19 | // If not, see . 20 | // 21 | // ============================================================================ 22 | 23 | package libptp.Hardware.PTP_RelayUnit; 24 | 25 | import inet.linklayer.IMACRelayUnit; 26 | 27 | moduleinterface IPTP_MACRelayUnit extends IMACRelayUnit 28 | { 29 | parameters: 30 | 31 | @display("i=PTP/Components/RelayUnit/RelayUnit"); 32 | 33 | bool PTP_Enable; 34 | string PTP_ClockType; 35 | 36 | string MAC_Address; 37 | 38 | // Defines the internal port of a node 39 | // The value -1 means that there is no internal port configured 40 | int internalPort; 41 | 42 | gates: 43 | 44 | } 45 | 46 | -------------------------------------------------------------------------------- /src/Hardware/PTP_RelayUnit/PTP_MACRelayUnit.ned: -------------------------------------------------------------------------------- 1 | // ============================================================================ 2 | // 3 | // Copyright 2013-2015 Wolfgang Wallner (wolfgang-wallner AT gmx.at) 4 | // 5 | // This file is part of the LibPTP project. 6 | // 7 | // The LibPTP project is free software: you can redistribute it 8 | // and/or modify it under the terms of the GNU General Public License as 9 | // published by the Free Software Foundation, either version 3 of the License, 10 | // or (at your option) any later version. 11 | // 12 | // The LibPTP project is distributed in the hope that it will be 13 | // useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License.com for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License.com 18 | // along with The LibPTP project. 19 | // If not, see . 20 | // 21 | // ============================================================================ 22 | 23 | package libptp.Hardware.PTP_RelayUnit; 24 | 25 | import inet.linklayer.ethernet.switch.MACRelayUnit; 26 | 27 | simple PTP_MACRelayUnit extends MACRelayUnit like IPTP_MACRelayUnit 28 | { 29 | parameters: 30 | @display("i=PTP/Components/RelayUnit/RelayUnit"); 31 | @class(PTP_MACRelayUnit); 32 | 33 | bool PTP_Enable = default(true); 34 | string PTP_ClockType = default("PTP_CLOCK_TYPE_ORDINARY"); 35 | string MAC_Address = default("C0:FF:EE:BA:D0:1D"); 36 | int internalPort = default( 0 ); 37 | 38 | gates: 39 | } 40 | 41 | -------------------------------------------------------------------------------- /src/Testbenches/ClockScaleTest/ClockScaleTest.h: -------------------------------------------------------------------------------- 1 | // ============================================================================ 2 | // 3 | // Copyright 2013-2015 Wolfgang Wallner (wolfgang-wallner AT gmx.at) 4 | // 5 | // This file is part of the LibPTP project. 6 | // 7 | // The LibPTP project is free software: you can redistribute it 8 | // and/or modify it under the terms of the GNU General Public License as 9 | // published by the Free Software Foundation, either version 3 of the License, 10 | // or (at your option) any later version. 11 | // 12 | // The LibPTP project is distributed in the hope that it will be 13 | // useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License.com for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License.com 18 | // along with The LibPTP project. 19 | // If not, see . 20 | // 21 | // ============================================================================ 22 | 23 | #ifndef LIBPTP_CLOCK_SCALE_TEST_H_ 24 | #define LIBPTP_CLOCK_SCALE_TEST_H_ 25 | 26 | #include 27 | 28 | #include "AdjustableClock.h" 29 | 30 | class ClockScaleTest : public cSimpleModule 31 | { 32 | private: 33 | 34 | cAdjustableClock *pClock; 35 | 36 | cMessage *pTestMsg1; 37 | cMessage *pTestMsg2; 38 | cMessage *pTestMsg3; 39 | cMessage *pTestMsg4; 40 | cMessage *pTestMsg5; 41 | cMessage *pTestMsg6; 42 | 43 | protected: 44 | virtual void initialize(); 45 | virtual void handleMessage(cMessage *pMsg); 46 | }; 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /src/Utils/Constants/PhysicalConstants.h: -------------------------------------------------------------------------------- 1 | // ============================================================================ 2 | // 3 | // Copyright 2013-2015 Wolfgang Wallner (wolfgang-wallner AT gmx.at) 4 | // 5 | // This file is part of the LibPTP project. 6 | // 7 | // The LibPTP project is free software: you can redistribute it 8 | // and/or modify it under the terms of the GNU General Public License as 9 | // published by the Free Software Foundation, either version 3 of the License, 10 | // or (at your option) any later version. 11 | // 12 | // The LibPTP project is distributed in the hope that it will be 13 | // useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License.com for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License.com 18 | // along with The LibPTP project. 19 | // If not, see . 20 | // 21 | // ============================================================================ 22 | 23 | #ifndef LIBPTP_PHYSICAL_CONSTANTS_H_ 24 | #define LIBPTP_PHYSICAL_CONSTANTS_H_ 25 | 26 | // ====================================================== 27 | // Includes 28 | // ====================================================== 29 | 30 | #include 31 | 32 | // ====================================================== 33 | // Types 34 | // ====================================================== 35 | 36 | // ====================================================== 37 | // Declarations 38 | // ====================================================== 39 | 40 | extern const Integer64 NANOSECS_PER_S; 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /src/Software/SimTimeFilter/SimTimeFilterTypes.h: -------------------------------------------------------------------------------- 1 | // ============================================================================ 2 | // 3 | // Copyright 2013-2015 Wolfgang Wallner (wolfgang-wallner AT gmx.at) 4 | // 5 | // This file is part of the LibPTP project. 6 | // 7 | // The LibPTP project is free software: you can redistribute it 8 | // and/or modify it under the terms of the GNU General Public License as 9 | // published by the Free Software Foundation, either version 3 of the License, 10 | // or (at your option) any later version. 11 | // 12 | // The LibPTP project is distributed in the hope that it will be 13 | // useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License.com for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License.com 18 | // along with The LibPTP project. 19 | // If not, see . 20 | // 21 | // ============================================================================ 22 | 23 | #ifndef LIBPTP_SIMTIME_FILTER_TYPES_H_ 24 | #define LIBPTP_SIMTIME_FILTER_TYPES_H_ 25 | 26 | // ====================================================== 27 | // Includes 28 | // ====================================================== 29 | 30 | // ====================================================== 31 | // Types 32 | // ====================================================== 33 | 34 | typedef enum 35 | { 36 | NO_FILTER, 37 | MOVING_AVG_FILTER, 38 | } 39 | SimTimeFilter_t; 40 | 41 | // ====================================================== 42 | // Declarations 43 | // ====================================================== 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /src/Hardware/HwClock/HwClock/IHwClock.ned: -------------------------------------------------------------------------------- 1 | // ============================================================================ 2 | // 3 | // Copyright 2013-2015 Wolfgang Wallner (wolfgang-wallner AT gmx.at) 4 | // 5 | // This file is part of the LibPTP project. 6 | // 7 | // The LibPTP project is free software: you can redistribute it 8 | // and/or modify it under the terms of the GNU General Public License as 9 | // published by the Free Software Foundation, either version 3 of the License, 10 | // or (at your option) any later version. 11 | // 12 | // The LibPTP project is distributed in the hope that it will be 13 | // useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License.com for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License.com 18 | // along with The LibPTP project. 19 | // If not, see . 20 | // 21 | // ============================================================================ 22 | 23 | package libptp.Hardware.HwClock.HwClock; 24 | 25 | moduleinterface IHwClock 26 | { 27 | parameters: 28 | @display("i=PTP/Components/Clock/DigitalClock"); 29 | 30 | // Clock configuration 31 | double TickLenNom @unit(s); 32 | 33 | double InitialPhaseNom; 34 | 35 | // Time Deviation configuration 36 | string TdGenType; 37 | 38 | // Trace configuration 39 | double TimeTraceInterval @unit(s); // 0 -> tracing disabled 40 | // 1 -> tracing enabled, this will result in an infinite simulation run if not stopped manually or via sim-time-limit 41 | } 42 | -------------------------------------------------------------------------------- /src/Testbenches/PtpStackTest/PtpStackTest.h: -------------------------------------------------------------------------------- 1 | // ============================================================================ 2 | // 3 | // Copyright 2013-2015 Wolfgang Wallner (wolfgang-wallner AT gmx.at) 4 | // 5 | // This file is part of the LibPTP project. 6 | // 7 | // The LibPTP project is free software: you can redistribute it 8 | // and/or modify it under the terms of the GNU General Public License as 9 | // published by the Free Software Foundation, either version 3 of the License, 10 | // or (at your option) any later version. 11 | // 12 | // The LibPTP project is distributed in the hope that it will be 13 | // useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License.com for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License.com 18 | // along with The LibPTP project. 19 | // If not, see . 20 | // 21 | // ============================================================================ 22 | 23 | #ifndef LIBPTP_PTP_STACK_TEST_H_ 24 | #define LIBPTP_PTP_STACK_TEST_H_ 25 | 26 | #include 27 | 28 | #include "ModuleInitBase.h" 29 | #include "PtpStackTestType.h" 30 | 31 | class PtpStackTest: public cModuleInitBase 32 | { 33 | private: 34 | 35 | // Configuration 36 | PtpStackTestType_t TestType; 37 | 38 | // Internal functions 39 | void CarryOutTest(); 40 | void TestClockIdentity(); 41 | void TestPortIdentity(); 42 | void TestForeignClockDS(); 43 | 44 | protected: 45 | // Init API 46 | void ParseParameters(); 47 | void FinishInit(); 48 | }; 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /src/Hardware/DualDelayer/NopDualDelayer.ned: -------------------------------------------------------------------------------- 1 | // ============================================================================ 2 | // 3 | // Copyright 2013-2015 Wolfgang Wallner (wolfgang-wallner AT gmx.at) 4 | // 5 | // This file is part of the LibPTP project. 6 | // 7 | // The LibPTP project is free software: you can redistribute it 8 | // and/or modify it under the terms of the GNU General Public License as 9 | // published by the Free Software Foundation, either version 3 of the License, 10 | // or (at your option) any later version. 11 | // 12 | // The LibPTP project is distributed in the hope that it will be 13 | // useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License.com for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License.com 18 | // along with The LibPTP project. 19 | // If not, see . 20 | // 21 | // ============================================================================ 22 | 23 | package libptp.Hardware.DualDelayer; 24 | 25 | module NopDualDelayer like IDualDelayer 26 | { 27 | parameters: 28 | 29 | @display("i=PTP/Components/Delayer/Delayer"); 30 | 31 | volatile double UpDelay @unit(s) = default(0s); 32 | volatile double DownDelay @unit(s) = default(0s); 33 | 34 | bool EnableUpDelay = default(false); 35 | bool EnableDownDelay = default(false); 36 | 37 | gates: 38 | 39 | input upperLayerIn; 40 | output upperLayerOut; 41 | input lowerLayerIn; 42 | output lowerLayerOut; 43 | 44 | connections: 45 | 46 | upperLayerIn --> lowerLayerOut; 47 | lowerLayerIn --> upperLayerOut; 48 | } 49 | -------------------------------------------------------------------------------- /src/Testbenches/PtpStackTest/PtpStackTestType.h: -------------------------------------------------------------------------------- 1 | // ============================================================================ 2 | // 3 | // Copyright 2013-2015 Wolfgang Wallner (wolfgang-wallner AT gmx.at) 4 | // 5 | // This file is part of the LibPTP project. 6 | // 7 | // The LibPTP project is free software: you can redistribute it 8 | // and/or modify it under the terms of the GNU General Public License as 9 | // published by the Free Software Foundation, either version 3 of the License, 10 | // or (at your option) any later version. 11 | // 12 | // The LibPTP project is distributed in the hope that it will be 13 | // useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License.com for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License.com 18 | // along with The LibPTP project. 19 | // If not, see . 20 | // 21 | // ============================================================================ 22 | 23 | #ifndef LIBPTP_PTP_STACK_TEST_TYPE_H_ 24 | #define LIBPTP_PTP_STACK_TEST_TYPE_H_ 25 | 26 | // ====================================================== 27 | // Includes 28 | // ====================================================== 29 | 30 | // ====================================================== 31 | // Types 32 | // ====================================================== 33 | 34 | typedef enum 35 | { 36 | NONE, 37 | CLOCK_IDENTITY, 38 | PORT_IDENTITY, 39 | FOREIGN_CLOCK_DS, 40 | ALL, 41 | } 42 | PtpStackTestType_t; 43 | 44 | // ====================================================== 45 | // Declarations 46 | // ====================================================== 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /src/Testbenches/EtherPhyTester/EtherPhyTester.h: -------------------------------------------------------------------------------- 1 | // ============================================================================ 2 | // 3 | // Copyright 2013-2015 Wolfgang Wallner (wolfgang-wallner AT gmx.at) 4 | // 5 | // This file is part of the LibPTP project. 6 | // 7 | // The LibPTP project is free software: you can redistribute it 8 | // and/or modify it under the terms of the GNU General Public License as 9 | // published by the Free Software Foundation, either version 3 of the License, 10 | // or (at your option) any later version. 11 | // 12 | // The LibPTP project is distributed in the hope that it will be 13 | // useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License.com for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License.com 18 | // along with The LibPTP project. 19 | // If not, see . 20 | // 21 | // ============================================================================ 22 | 23 | #ifndef LIBPTP_ETHER_PHY_TESTER_H_ 24 | #define LIBPTP_ETHER_PHY_TESTER_H_ 25 | 26 | #include 27 | 28 | #include "EtherFrame_m.h" 29 | 30 | class EtherPhyTester : public cSimpleModule 31 | { 32 | private: 33 | 34 | // Config 35 | simtime_t TestInterval; 36 | 37 | // Resources 38 | cMessage *IntervalTimer; 39 | simtime_t T_tx; 40 | 41 | // Signals 42 | simsignal_t Delay_SigId; 43 | 44 | // Internal functions 45 | void SendMsg(); 46 | void HandleRx( EthernetIIFrame *pEthFrame ); 47 | 48 | protected: 49 | 50 | virtual void initialize(); 51 | virtual void handleMessage(cMessage *pMsg); 52 | }; 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /src/Testbenches/PtpStackTest/ParameterParser/PtpStackTest_Parser.h: -------------------------------------------------------------------------------- 1 | // ============================================================================ 2 | // 3 | // Copyright 2013-2015 Wolfgang Wallner (wolfgang-wallner AT gmx.at) 4 | // 5 | // This file is part of the LibPTP project. 6 | // 7 | // The LibPTP project is free software: you can redistribute it 8 | // and/or modify it under the terms of the GNU General Public License as 9 | // published by the Free Software Foundation, either version 3 of the License, 10 | // or (at your option) any later version. 11 | // 12 | // The LibPTP project is distributed in the hope that it will be 13 | // useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License.com for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License.com 18 | // along with The LibPTP project. 19 | // If not, see . 20 | // 21 | // ============================================================================ 22 | 23 | #ifndef LIBPTP_PTP_STACK_TEST_PARSER_H_ 24 | #define LIBPTP_PTP_STACK_TEST_PARSER_H_ 25 | 26 | // ====================================================== 27 | // Includes 28 | // ====================================================== 29 | 30 | #include "PtpStackTestType.h" 31 | 32 | // ====================================================== 33 | // Types 34 | // ====================================================== 35 | 36 | class cPtpStackTest_Parser 37 | { 38 | public: 39 | 40 | static PtpStackTestType_t ParseTestType (const char *Str); 41 | }; 42 | 43 | // ====================================================== 44 | // Declarations 45 | // ====================================================== 46 | 47 | #endif 48 | 49 | -------------------------------------------------------------------------------- /src/Testbenches/PTP_EthSink/PTP_EthSink.h: -------------------------------------------------------------------------------- 1 | // ============================================================================ 2 | // 3 | // Copyright 2013-2015 Wolfgang Wallner (wolfgang-wallner AT gmx.at) 4 | // 5 | // This file is part of the LibPTP project. 6 | // 7 | // The LibPTP project is free software: you can redistribute it 8 | // and/or modify it under the terms of the GNU General Public License as 9 | // published by the Free Software Foundation, either version 3 of the License, 10 | // or (at your option) any later version. 11 | // 12 | // The LibPTP project is distributed in the hope that it will be 13 | // useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License.com for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License.com 18 | // along with The LibPTP project. 19 | // If not, see . 20 | // 21 | // ============================================================================ 22 | 23 | #ifndef LIBPTP_PTP_TESTBENCH_PTP_ETH_SINK_H_ 24 | #define LIBPTP_PTP_TESTBENCH_PTP_ETH_SINK_H_ 25 | 26 | // ====================================================== 27 | // Includes 28 | // ====================================================== 29 | 30 | #include 31 | 32 | // ====================================================== 33 | // Types 34 | // ====================================================== 35 | 36 | // ====================================================== 37 | // Declarations 38 | // ====================================================== 39 | 40 | class PTP_EthSink : public cSimpleModule 41 | { 42 | protected: 43 | 44 | virtual void initialize(); 45 | virtual void handleMessage(cMessage *msg); 46 | }; 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /src/Software/SimTimeFilter/SimTimeFilter_ParameterParser.h: -------------------------------------------------------------------------------- 1 | // ============================================================================ 2 | // 3 | // Copyright 2013-2015 Wolfgang Wallner (wolfgang-wallner AT gmx.at) 4 | // 5 | // This file is part of the LibPTP project. 6 | // 7 | // The LibPTP project is free software: you can redistribute it 8 | // and/or modify it under the terms of the GNU General Public License as 9 | // published by the Free Software Foundation, either version 3 of the License, 10 | // or (at your option) any later version. 11 | // 12 | // The LibPTP project is distributed in the hope that it will be 13 | // useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License.com for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License.com 18 | // along with The LibPTP project. 19 | // If not, see . 20 | // 21 | // ============================================================================ 22 | 23 | #ifndef LIBPTP_SIMTIME_FILTER_PARAMETER_PARSER_H_ 24 | #define LIBPTP_SIMTIME_FILTER_PARAMETER_PARSER_H_ 25 | 26 | // ====================================================== 27 | // Includes 28 | // ====================================================== 29 | 30 | #include "SimTimeFilterTypes.h" 31 | 32 | // ====================================================== 33 | // Types 34 | // ====================================================== 35 | 36 | class cSimTimeFilter_ParameterParser 37 | { 38 | public: 39 | 40 | static SimTimeFilter_t ParseSimTimeFilterType(const char *Str); 41 | }; 42 | 43 | // ====================================================== 44 | // Declarations 45 | // ====================================================== 46 | 47 | #endif 48 | 49 | -------------------------------------------------------------------------------- /src/Software/PTP_Stack/PTP_EventMsg/PTP_EventMsg.msg: -------------------------------------------------------------------------------- 1 | // ============================================================================ 2 | // 3 | // Copyright 2013-2015 Wolfgang Wallner (wolfgang-wallner AT gmx.at) 4 | // 5 | // This file is part of the LibPTP project. 6 | // 7 | // The LibPTP project is free software: you can redistribute it 8 | // and/or modify it under the terms of the GNU General Public License as 9 | // published by the Free Software Foundation, either version 3 of the License, 10 | // or (at your option) any later version. 11 | // 12 | // The LibPTP project is distributed in the hope that it will be 13 | // useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License.com for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License.com 18 | // along with The LibPTP project. 19 | // If not, see . 20 | // 21 | // ============================================================================ 22 | 23 | // ================================================= 24 | // Make needed C++ stuff available 25 | // ================================================= 26 | 27 | cplusplus {{ 28 | #include 29 | }}; 30 | 31 | // ================================================= 32 | // Class announcements 33 | // ================================================= 34 | 35 | class noncobject portEvent_t; 36 | 37 | // ================================================= 38 | // Type definitions 39 | // ================================================= 40 | 41 | // ================================================= 42 | // Message definitions 43 | // ================================================= 44 | 45 | message PTP_EventMsg { 46 | int PortID; 47 | portEvent_t Event; 48 | } 49 | -------------------------------------------------------------------------------- /src/Software/ClockServo/PI_ClockServo/PI_ClockServo_ParameterParser.h: -------------------------------------------------------------------------------- 1 | // ============================================================================ 2 | // 3 | // Copyright 2013-2015 Wolfgang Wallner (wolfgang-wallner AT gmx.at) 4 | // 5 | // This file is part of the LibPTP project. 6 | // 7 | // The LibPTP project is free software: you can redistribute it 8 | // and/or modify it under the terms of the GNU General Public License as 9 | // published by the Free Software Foundation, either version 3 of the License, 10 | // or (at your option) any later version. 11 | // 12 | // The LibPTP project is distributed in the hope that it will be 13 | // useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License.com for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License.com 18 | // along with The LibPTP project. 19 | // If not, see . 20 | // 21 | // ============================================================================ 22 | 23 | #ifndef LIBPTP_PI_CLOCKSERVO_PARAMETER_PARSER_H_ 24 | #define LIBPTP_PI_CLOCKSERVO_PARAMETER_PARSER_H_ 25 | 26 | // ====================================================== 27 | // Includes 28 | // ====================================================== 29 | 30 | #include "PI_ClockServo.h" 31 | 32 | // ====================================================== 33 | // Types 34 | // ====================================================== 35 | 36 | class cPI_ClockServo_ParameterParser 37 | { 38 | public: 39 | 40 | static cPI_ClockServo::ParameterMode_t ParseParameterMode(const char *Str); 41 | }; 42 | 43 | // ====================================================== 44 | // Declarations 45 | // ====================================================== 46 | 47 | #endif 48 | 49 | -------------------------------------------------------------------------------- /src/Hardware/PTP_MAC/IPTP_MAC.ned: -------------------------------------------------------------------------------- 1 | // ============================================================================ 2 | // 3 | // Copyright 2013-2015 Wolfgang Wallner (wolfgang-wallner AT gmx.at) 4 | // 5 | // This file is part of the LibPTP project. 6 | // 7 | // The LibPTP project is free software: you can redistribute it 8 | // and/or modify it under the terms of the GNU General Public License as 9 | // published by the Free Software Foundation, either version 3 of the License, 10 | // or (at your option) any later version. 11 | // 12 | // The LibPTP project is distributed in the hope that it will be 13 | // useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License.com for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License.com 18 | // along with The LibPTP project. 19 | // If not, see . 20 | // 21 | // ============================================================================ 22 | 23 | package libptp.Hardware.PTP_MAC; 24 | 25 | import inet.linklayer.IEtherMAC; 26 | 27 | moduleinterface IPTP_MAC extends IEtherMAC 28 | { 29 | parameters: 30 | 31 | @display("i=PTP/Components/MAC/MAC"); 32 | @class(PTP_MAC); 33 | 34 | // PTP configuration 35 | bool PTP_Enable; 36 | string PTP_ClockType; 37 | bool PTP_TwoStepFlag; 38 | string PTP_DelayMechanism; 39 | 40 | // Hardware setup 41 | string PTP_NIC_CtrlPath; 42 | string ClockPath; 43 | 44 | // Debug configuration 45 | bool EnableDebugOutput; 46 | 47 | // Fault simulation 48 | bool SimulateFault; 49 | double FaultTime @unit(s); 50 | double FaultDuration @unit(s); 51 | 52 | gates: 53 | } 54 | 55 | -------------------------------------------------------------------------------- /src/Hardware/HwClock/TdGen/PerfectTdGen.h: -------------------------------------------------------------------------------- 1 | // ============================================================================ 2 | // 3 | // Copyright 2013-2015 Wolfgang Wallner (wolfgang-wallner AT gmx.at) 4 | // 5 | // This file is part of the LibPTP project. 6 | // 7 | // The LibPTP project is free software: you can redistribute it 8 | // and/or modify it under the terms of the GNU General Public License as 9 | // published by the Free Software Foundation, either version 3 of the License, 10 | // or (at your option) any later version. 11 | // 12 | // The LibPTP project is distributed in the hope that it will be 13 | // useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License.com for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License.com 18 | // along with The LibPTP project. 19 | // If not, see . 20 | // 21 | // ============================================================================ 22 | 23 | #ifndef LIBPTP_PERFECT_TD_GEN_H_ 24 | #define LIBPTP_PERFECT_TD_GEN_H_ 25 | 26 | // ====================================================== 27 | // Includes 28 | // ====================================================== 29 | 30 | #include "ITdGen.h" 31 | 32 | // ====================================================== 33 | // Types 34 | // ====================================================== 35 | 36 | // ====================================================== 37 | // Declarations 38 | // ====================================================== 39 | 40 | class cPerfectTdGen: public ITdGen 41 | { 42 | private: 43 | 44 | protected: 45 | 46 | 47 | public: 48 | 49 | cPerfectTdGen(); 50 | ~cPerfectTdGen(); 51 | 52 | // Time readout 53 | simtime_t GetTD( simtime_t RealTime ); 54 | }; 55 | 56 | #endif 57 | 58 | -------------------------------------------------------------------------------- /src/Hardware/HwClock/TdGen/TdGen_ParameterParser.h: -------------------------------------------------------------------------------- 1 | // ============================================================================ 2 | // 3 | // Copyright 2013-2015 Wolfgang Wallner (wolfgang-wallner AT gmx.at) 4 | // 5 | // This file is part of the LibPTP project. 6 | // 7 | // The LibPTP project is free software: you can redistribute it 8 | // and/or modify it under the terms of the GNU General Public License as 9 | // published by the Free Software Foundation, either version 3 of the License, 10 | // or (at your option) any later version. 11 | // 12 | // The LibPTP project is distributed in the hope that it will be 13 | // useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License.com for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License.com 18 | // along with The LibPTP project. 19 | // If not, see . 20 | // 21 | // ============================================================================ 22 | 23 | #ifndef LIBPTP_TD_GEN_PARAMETER_PARSER_H_ 24 | #define LIBPTP_TD_GEN_PARAMETER_PARSER_H_ 25 | 26 | // ====================================================== 27 | // Includes 28 | // ====================================================== 29 | 30 | // ====================================================== 31 | // Types 32 | // ====================================================== 33 | 34 | typedef enum 35 | { 36 | LIBPLN_EXAMPLE_AVG_OSC, 37 | LIBPLN_EXAMPLE_WATCH_QUARTZ, 38 | } 39 | LibPLN_Example_t; 40 | 41 | class cTdGen_ParameterParser 42 | { 43 | public: 44 | 45 | static LibPLN_Example_t ParseLibPLN_Example(const char *Str); 46 | }; 47 | 48 | // ====================================================== 49 | // Declarations 50 | // ====================================================== 51 | 52 | #endif 53 | 54 | -------------------------------------------------------------------------------- /src/Hardware/HwClock/HwClock/HwClock_ParameterParser.h: -------------------------------------------------------------------------------- 1 | // ============================================================================ 2 | // 3 | // Copyright 2013-2015 Wolfgang Wallner (wolfgang-wallner AT gmx.at) 4 | // 5 | // This file is part of the LibPTP project. 6 | // 7 | // The LibPTP project is free software: you can redistribute it 8 | // and/or modify it under the terms of the GNU General Public License as 9 | // published by the Free Software Foundation, either version 3 of the License, 10 | // or (at your option) any later version. 11 | // 12 | // The LibPTP project is distributed in the hope that it will be 13 | // useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License.com for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License.com 18 | // along with The LibPTP project. 19 | // If not, see . 20 | // 21 | // ============================================================================ 22 | 23 | #ifndef LIBPTP_CLOCK_PARAMETER_PARSER_H_ 24 | #define LIBPTP_CLOCK_PARAMETER_PARSER_H_ 25 | 26 | // ====================================================== 27 | // Includes 28 | // ====================================================== 29 | 30 | // ====================================================== 31 | // Types 32 | // ====================================================== 33 | 34 | typedef enum 35 | { 36 | TDGEN_TYPE_PERFECT, 37 | TDGEN_TYPE_CONST_DRIFT, 38 | TDGEN_TYPE_SINE, 39 | TDGEN_TYPE_LIBPLN, 40 | } 41 | TdGenType_t; 42 | 43 | class cHwClock_ParameterParser 44 | { 45 | public: 46 | 47 | static TdGenType_t ParseTdGenType(const char *Str); 48 | }; 49 | 50 | // ====================================================== 51 | // Declarations 52 | // ====================================================== 53 | 54 | #endif 55 | 56 | -------------------------------------------------------------------------------- /src/Hardware/HwClock/HwClock/HwClockTypes.ned: -------------------------------------------------------------------------------- 1 | // ============================================================================ 2 | // 3 | // Copyright 2013-2015 Wolfgang Wallner (wolfgang-wallner AT gmx.at) 4 | // 5 | // This file is part of the LibPTP project. 6 | // 7 | // The LibPTP project is free software: you can redistribute it 8 | // and/or modify it under the terms of the GNU General Public License as 9 | // published by the Free Software Foundation, either version 3 of the License, 10 | // or (at your option) any later version. 11 | // 12 | // The LibPTP project is distributed in the hope that it will be 13 | // useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License.com for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License.com 18 | // along with The LibPTP project. 19 | // If not, see . 20 | // 21 | // ============================================================================ 22 | 23 | package libptp.Hardware.HwClock.HwClock; 24 | 25 | moduleinterface IPerfectHwClock extends IHwClock 26 | { 27 | parameters: 28 | @display("i=PTP/Components/Clock/PerfectClock"); 29 | } 30 | 31 | moduleinterface IConstantDriftHwClock extends IHwClock 32 | { 33 | parameters: 34 | 35 | @display("i=PTP/Components/Clock/ConstantDriftClock"); 36 | 37 | double ConstDriftTdGen_k; 38 | } 39 | 40 | moduleinterface ISineHwClock extends IHwClock 41 | { 42 | parameters: 43 | 44 | @display("i=PTP/Components/Clock/SineClock"); 45 | 46 | double SineTdGen_f; 47 | double SineTdGen_A; 48 | double SineTdGen_phi; 49 | } 50 | 51 | moduleinterface ILibPLN_HwClock extends IHwClock 52 | { 53 | parameters: 54 | 55 | @display("i=PTP/Components/Clock/RealClock"); 56 | 57 | int libPLN_TdGen_Seed; 58 | bool libPLN_TdGen_AllowSkipping; 59 | } 60 | -------------------------------------------------------------------------------- /src/Hardware/HwClock/ClockEvents/IClockEventSink.h: -------------------------------------------------------------------------------- 1 | // ============================================================================ 2 | // 3 | // Copyright 2013-2015 Wolfgang Wallner (wolfgang-wallner AT gmx.at) 4 | // 5 | // This file is part of the LibPTP project. 6 | // 7 | // The LibPTP project is free software: you can redistribute it 8 | // and/or modify it under the terms of the GNU General Public License as 9 | // published by the Free Software Foundation, either version 3 of the License, 10 | // or (at your option) any later version. 11 | // 12 | // The LibPTP project is distributed in the hope that it will be 13 | // useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License.com for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License.com 18 | // along with The LibPTP project. 19 | // If not, see . 20 | // 21 | // ============================================================================ 22 | 23 | #ifndef LIBPTP_ICLOCK_EVENT_SINK_H_ 24 | #define LIBPTP_ICLOCK_EVENT_SINK_H_ 25 | 26 | // ====================================================== 27 | // Includes 28 | // ====================================================== 29 | 30 | #include 31 | 32 | #include "ClockEvent.h" 33 | #include "ICallableBase.h" 34 | 35 | // ====================================================== 36 | // Types 37 | // ====================================================== 38 | 39 | // ====================================================== 40 | // Declarations 41 | // ====================================================== 42 | 43 | class IClockEventSink : public virtual ICallableBase 44 | { 45 | private: 46 | 47 | protected: 48 | 49 | public: 50 | 51 | virtual void HandleClockEvent( cClockEvent &ClockEvent ) = 0; 52 | 53 | void ClockEventCallback( cClockEvent &ClockEvent ); 54 | }; 55 | 56 | #endif 57 | -------------------------------------------------------------------------------- /src/Software/PTP_Stack/AppServices/AppService.h: -------------------------------------------------------------------------------- 1 | // ============================================================================ 2 | // 3 | // Copyright 2013-2015 Wolfgang Wallner (wolfgang-wallner AT gmx.at) 4 | // 5 | // This file is part of the LibPTP project. 6 | // 7 | // The LibPTP project is free software: you can redistribute it 8 | // and/or modify it under the terms of the GNU General Public License as 9 | // published by the Free Software Foundation, either version 3 of the License, 10 | // or (at your option) any later version. 11 | // 12 | // The LibPTP project is distributed in the hope that it will be 13 | // useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License.com for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License.com 18 | // along with The LibPTP project. 19 | // If not, see . 20 | // 21 | // ============================================================================ 22 | 23 | #ifndef LIBPTP_APP_SERVICE_H_ 24 | #define LIBPTP_APP_SERVICE_H_ 25 | 26 | // ====================================================== 27 | // Includes 28 | // ====================================================== 29 | 30 | #include 31 | 32 | #include "BasicService.h" 33 | 34 | // ====================================================== 35 | // Types 36 | // ====================================================== 37 | 38 | // ====================================================== 39 | // Declarations 40 | // ====================================================== 41 | 42 | class cAppService : public cBasicService 43 | { 44 | private: 45 | 46 | protected: 47 | 48 | public: 49 | 50 | // Constructors/Destructor 51 | cAppService(); 52 | virtual ~cAppService(); 53 | 54 | // Setters 55 | 56 | // Getters 57 | 58 | // API functions 59 | 60 | // Clock API 61 | }; 62 | 63 | #endif 64 | -------------------------------------------------------------------------------- /src/Utils/Constants/PhysicalConstants.cc: -------------------------------------------------------------------------------- 1 | // ============================================================================ 2 | // 3 | // Copyright 2013-2015 Wolfgang Wallner (wolfgang-wallner AT gmx.at) 4 | // 5 | // This file is part of the LibPTP project. 6 | // 7 | // The LibPTP project is free software: you can redistribute it 8 | // and/or modify it under the terms of the GNU General Public License as 9 | // published by the Free Software Foundation, either version 3 of the License, 10 | // or (at your option) any later version. 11 | // 12 | // The LibPTP project is distributed in the hope that it will be 13 | // useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License.com for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License.com 18 | // along with The LibPTP project. 19 | // If not, see . 20 | // 21 | // ============================================================================ 22 | 23 | // ====================================================== 24 | // Includes 25 | // ====================================================== 26 | 27 | #include "PhysicalConstants.h" 28 | 29 | // ====================================================== 30 | // Definitions 31 | // ====================================================== 32 | 33 | // ====================================================== 34 | // Types 35 | // ====================================================== 36 | 37 | // ====================================================== 38 | // Variables 39 | // ====================================================== 40 | 41 | const Integer64 NANOSECS_PER_S = 1E9; 42 | 43 | // ====================================================== 44 | // Declarations 45 | // ====================================================== 46 | 47 | // ====================================================== 48 | // Definitions 49 | // ====================================================== 50 | -------------------------------------------------------------------------------- /src/Hardware/EtherPhy/EtherPhy.ned: -------------------------------------------------------------------------------- 1 | // ============================================================================ 2 | // 3 | // Copyright 2013-2015 Wolfgang Wallner (wolfgang-wallner AT gmx.at) 4 | // 5 | // This file is part of the LibPTP project. 6 | // 7 | // The LibPTP project is free software: you can redistribute it 8 | // and/or modify it under the terms of the GNU General Public License as 9 | // published by the Free Software Foundation, either version 3 of the License, 10 | // or (at your option) any later version. 11 | // 12 | // The LibPTP project is distributed in the hope that it will be 13 | // useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License.com for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License.com 18 | // along with The LibPTP project. 19 | // If not, see . 20 | // 21 | // ============================================================================ 22 | 23 | package libptp.Hardware.EtherPhy; 24 | 25 | import libptp.Hardware.EtherPhy.IEtherPhy; 26 | 27 | import ned.DelayChannel; 28 | import utils.Channels.VolatileDelayChannel.VolatileDelayChannel; 29 | 30 | module EtherPhy like IEtherPhy 31 | { 32 | parameters: 33 | // The Rx delay is added to incoming frames (phy -> mii). 34 | volatile double rxDelay @unit(s) = default(176ns + intuniform(0,4) * 8ns); 35 | 36 | // The Tx delay is added to outgoing frames (mii -> phy). 37 | volatile double txDelay @unit(s) = default(76ns + intuniform(0,1) * 8ns); 38 | 39 | @display("i=PTP/Components/PHY/PHY"); 40 | 41 | gates: 42 | inout mii @labels(EtherFrame); // Media Independent Interface to MAC 43 | inout phy @labels(EtherFrame); // Phy interface to network 44 | 45 | connections: 46 | 47 | mii$i --> VolatileDelayChannel{ delay = txDelay; } --> phy$o; 48 | mii$o <-- VolatileDelayChannel{ delay = rxDelay; } <-- phy$i; 49 | } 50 | -------------------------------------------------------------------------------- /src/Hardware/HwClock/ScheduleClock/Internal_ScheduleClock.ned: -------------------------------------------------------------------------------- 1 | // ============================================================================ 2 | // 3 | // Copyright 2013-2015 Wolfgang Wallner (wolfgang-wallner AT gmx.at) 4 | // 5 | // This file is part of the LibPTP project. 6 | // 7 | // The LibPTP project is free software: you can redistribute it 8 | // and/or modify it under the terms of the GNU General Public License as 9 | // published by the Free Software Foundation, either version 3 of the License, 10 | // or (at your option) any later version. 11 | // 12 | // The LibPTP project is distributed in the hope that it will be 13 | // useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License.com for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License.com 18 | // along with The LibPTP project. 19 | // If not, see . 20 | // 21 | // ============================================================================ 22 | 23 | package libptp.Hardware.HwClock.ScheduleClock; 24 | 25 | import libptp.Hardware.HwClock.AdjustableClock.Internal_AdjustableClock; 26 | 27 | simple Internal_ScheduleClock extends Internal_AdjustableClock like IScheduleClock 28 | { 29 | parameters: 30 | 31 | @display("i=PTP/Components/InternalModule/InternalModule"); 32 | @class("cScheduleClock"); 33 | 34 | // Clock configuration 35 | double ScheduleEdgePrecision @unit(s) = default(1ns); 36 | 37 | // Debug parameters 38 | bool EnableScheduleDebugOutput = default(false); 39 | 40 | // ----------------------------------------------------------------------- 41 | // Signals 42 | // ----------------------------------------------------------------------- 43 | 44 | // ----------------------------------------------------------------------- 45 | // Statistics 46 | // ----------------------------------------------------------------------- 47 | } 48 | -------------------------------------------------------------------------------- /src/Components/BasicBlocks/IPTP_EtherNode.ned: -------------------------------------------------------------------------------- 1 | // ============================================================================ 2 | // 3 | // Copyright 2013-2015 Wolfgang Wallner (wolfgang-wallner AT gmx.at) 4 | // 5 | // This file is part of the LibPTP project. 6 | // 7 | // The LibPTP project is free software: you can redistribute it 8 | // and/or modify it under the terms of the GNU General Public License as 9 | // published by the Free Software Foundation, either version 3 of the License, 10 | // or (at your option) any later version. 11 | // 12 | // The LibPTP project is distributed in the hope that it will be 13 | // useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License.com for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License.com 18 | // along with The LibPTP project. 19 | // If not, see . 20 | // 21 | // ============================================================================ 22 | 23 | // ====================================================== 24 | // Package description 25 | // ====================================================== 26 | 27 | package libptp.Components.BasicBlocks; 28 | 29 | // ====================================================== 30 | // Imports 31 | // ====================================================== 32 | 33 | // ====================================================== 34 | // Channel declarations 35 | // ====================================================== 36 | 37 | // ====================================================== 38 | // Network declarations 39 | // ====================================================== 40 | 41 | moduleinterface IPTP_EtherNode 42 | { 43 | parameters: 44 | 45 | @display("i=PTP/Nodes/PTP_Nodes/Generic"); 46 | 47 | string PTP_ClockType; 48 | bool PTP_TwoStepFlag; 49 | string PTP_DelayMechanism; 50 | 51 | string ClockServoType; 52 | 53 | gates: 54 | 55 | inout ethg[] @labels(EtherFrame-conn); 56 | } 57 | -------------------------------------------------------------------------------- /src/Testbenches/BabblingIP/BabblingIP.h: -------------------------------------------------------------------------------- 1 | // ============================================================================ 2 | // 3 | // Copyright 2013-2015 Wolfgang Wallner (wolfgang-wallner AT gmx.at) 4 | // 5 | // This file is part of the LibPTP project. 6 | // 7 | // The LibPTP project is free software: you can redistribute it 8 | // and/or modify it under the terms of the GNU General Public License as 9 | // published by the Free Software Foundation, either version 3 of the License, 10 | // or (at your option) any later version. 11 | // 12 | // The LibPTP project is distributed in the hope that it will be 13 | // useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License.com for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License.com 18 | // along with The LibPTP project. 19 | // If not, see . 20 | // 21 | // ============================================================================ 22 | 23 | #ifndef LIBPTP_PTP_TESTBENCH_BABBLING_IP_H_ 24 | #define LIBPTP_PTP_TESTBENCH_BABBLING_IP_H_ 25 | 26 | // ====================================================== 27 | // Includes 28 | // ====================================================== 29 | 30 | #include 31 | 32 | #include "MACAddress.h" 33 | 34 | // ====================================================== 35 | // Types 36 | // ====================================================== 37 | 38 | // ====================================================== 39 | // Declarations 40 | // ====================================================== 41 | 42 | class BabblingIP : public cSimpleModule 43 | { 44 | private: 45 | 46 | cMessage *pScheduleTrigger; 47 | cPar *intervalPar; 48 | 49 | MACAddress SrcMAC; 50 | 51 | void SendIpMsg(); 52 | void ScheduleNext(); 53 | 54 | protected: 55 | virtual void initialize(); 56 | virtual void handleMessage(cMessage *msg); 57 | 58 | public: 59 | }; 60 | 61 | #endif 62 | -------------------------------------------------------------------------------- /src/Testbenches/ClockTest/ClockTest.h: -------------------------------------------------------------------------------- 1 | // ============================================================================ 2 | // 3 | // Copyright 2013-2015 Wolfgang Wallner (wolfgang-wallner AT gmx.at) 4 | // 5 | // This file is part of the LibPTP project. 6 | // 7 | // The LibPTP project is free software: you can redistribute it 8 | // and/or modify it under the terms of the GNU General Public License as 9 | // published by the Free Software Foundation, either version 3 of the License, 10 | // or (at your option) any later version. 11 | // 12 | // The LibPTP project is distributed in the hope that it will be 13 | // useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License.com for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License.com 18 | // along with The LibPTP project. 19 | // If not, see . 20 | // 21 | // ============================================================================ 22 | 23 | #ifndef LIBPTP_PTP_TESTBENCH_CLOCK_TEST_H_ 24 | #define LIBPTP_PTP_TESTBENCH_CLOCK_TEST_H_ 25 | 26 | // ====================================================== 27 | // Includes 28 | // ====================================================== 29 | 30 | #include 31 | 32 | #include "CallableModule.h" 33 | #include "ScheduleClock.h" 34 | #include "IClockEventSink.h" 35 | 36 | // ====================================================== 37 | // Types 38 | // ====================================================== 39 | 40 | // ====================================================== 41 | // Declarations 42 | // ====================================================== 43 | 44 | class ClockTest : public cCallableModule, public IClockEventSink 45 | { 46 | private: 47 | cScheduleClock *pClock; 48 | 49 | protected: 50 | virtual void initialize(); 51 | virtual void handleMessage(cMessage *msg); 52 | 53 | public: 54 | 55 | ClockTest(); 56 | 57 | void HandleClockEvent( cClockEvent& ClockEvent ); 58 | }; 59 | 60 | #endif 61 | -------------------------------------------------------------------------------- /src/Testbenches/ClockServoTest/ClockServoTest.h: -------------------------------------------------------------------------------- 1 | // ============================================================================ 2 | // 3 | // Copyright 2013-2015 Wolfgang Wallner (wolfgang-wallner AT gmx.at) 4 | // 5 | // This file is part of the LibPTP project. 6 | // 7 | // The LibPTP project is free software: you can redistribute it 8 | // and/or modify it under the terms of the GNU General Public License as 9 | // published by the Free Software Foundation, either version 3 of the License, 10 | // or (at your option) any later version. 11 | // 12 | // The LibPTP project is distributed in the hope that it will be 13 | // useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License.com for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License.com 18 | // along with The LibPTP project. 19 | // If not, see . 20 | // 21 | // ============================================================================ 22 | 23 | #ifndef LIBPTP_CLOCKSERVO_TEST_H_ 24 | #define LIBPTP_CLOCKSERVO_TEST_H_ 25 | 26 | #include 27 | 28 | #include "IClockServo.h" 29 | 30 | #include "ScheduleClock.h" 31 | 32 | class ClockServoTest : public cSimpleModule 33 | { 34 | private: 35 | 36 | // Types 37 | typedef enum 38 | { 39 | INIT, 40 | CONFIG, 41 | ENABLE, 42 | RUN, 43 | INVALID, 44 | } 45 | TestState_t; 46 | 47 | // Resources 48 | IClockServo *pClockServo; 49 | cScheduleClock *pMasterClock; 50 | cScheduleClock *pSlaveClock; 51 | cMessage *pTimerMsg; 52 | 53 | // Configuration 54 | simtime_t Interval; 55 | 56 | // House keeping 57 | TestState_t TestState; 58 | 59 | void ParseParameters(); 60 | 61 | protected: 62 | 63 | virtual void initialize(); 64 | virtual void handleMessage(cMessage *msg); 65 | 66 | public: 67 | 68 | ClockServoTest(); 69 | }; 70 | 71 | #endif 72 | -------------------------------------------------------------------------------- /src/Testbenches/EncapTest/EncapTest.h: -------------------------------------------------------------------------------- 1 | // ============================================================================ 2 | // 3 | // Copyright 2013-2015 Wolfgang Wallner (wolfgang-wallner AT gmx.at) 4 | // 5 | // This file is part of the LibPTP project. 6 | // 7 | // The LibPTP project is free software: you can redistribute it 8 | // and/or modify it under the terms of the GNU General Public License as 9 | // published by the Free Software Foundation, either version 3 of the License, 10 | // or (at your option) any later version. 11 | // 12 | // The LibPTP project is distributed in the hope that it will be 13 | // useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License.com for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License.com 18 | // along with The LibPTP project. 19 | // If not, see . 20 | // 21 | // ============================================================================ 22 | 23 | #ifndef LIBPTP_PTP_TESTBENCH_ENCAP_TEST_H_ 24 | #define LIBPTP_PTP_TESTBENCH_ENCAP_TEST_H_ 25 | 26 | // ====================================================== 27 | // Includes 28 | // ====================================================== 29 | 30 | #include 31 | 32 | #include "PTPv2_m.h" 33 | 34 | // ====================================================== 35 | // Types 36 | // ====================================================== 37 | 38 | // ====================================================== 39 | // Declarations 40 | // ====================================================== 41 | 42 | class EncapTest : public cSimpleModule 43 | { 44 | private: 45 | 46 | const MACAddress SrcMAC; 47 | const MACAddress PtpMcMAC; 48 | const MACAddress PtpMcPDelayMAC; 49 | 50 | void SendPtpMsg( tPtpMessageType MsgType ); 51 | void SendIpMsg(); 52 | 53 | protected: 54 | virtual void initialize(); 55 | virtual void handleMessage(cMessage *msg); 56 | 57 | public: 58 | EncapTest(); 59 | }; 60 | 61 | #endif 62 | -------------------------------------------------------------------------------- /src/Firmware/EthernetII_LLC/EthernetII_LLC.ned: -------------------------------------------------------------------------------- 1 | // ============================================================================ 2 | // 3 | // Copyright 2013-2015 Wolfgang Wallner (wolfgang-wallner AT gmx.at) 4 | // 5 | // This file is part of the LibPTP project. 6 | // 7 | // The LibPTP project is free software: you can redistribute it 8 | // and/or modify it under the terms of the GNU General Public License as 9 | // published by the Free Software Foundation, either version 3 of the License, 10 | // or (at your option) any later version. 11 | // 12 | // The LibPTP project is distributed in the hope that it will be 13 | // useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License.com for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License.com 18 | // along with The LibPTP project. 19 | // If not, see . 20 | // 21 | // ============================================================================ 22 | 23 | // ====================================================== 24 | // Package description 25 | // ====================================================== 26 | 27 | package libptp.Firmware.EthernetII_LLC; 28 | 29 | // ====================================================== 30 | // Imports 31 | // ====================================================== 32 | 33 | // ====================================================== 34 | // Channel declarations 35 | // ====================================================== 36 | 37 | // ====================================================== 38 | // Network declarations 39 | // ====================================================== 40 | 41 | simple EthernetII_LLC 42 | { 43 | parameters: 44 | @display("i=block/fork_l"); 45 | 46 | string EtherTypeMapping = default(""); 47 | 48 | gates: 49 | 50 | input upperLayerIn[] @labels(Ieee802Ctrl/down); 51 | output upperLayerOut[] @labels(Ieee802Ctrl/up); 52 | 53 | input lowerLayerIn @labels(Ieee802Ctrl/up); 54 | output lowerLayerOut @labels(Ieee802Ctrl/down); 55 | } 56 | -------------------------------------------------------------------------------- /src/Hardware/HwClock/AdjustableClock/AdjustableClockTypes.ned: -------------------------------------------------------------------------------- 1 | // ============================================================================ 2 | // 3 | // Copyright 2013-2015 Wolfgang Wallner (wolfgang-wallner AT gmx.at) 4 | // 5 | // This file is part of the LibPTP project. 6 | // 7 | // The LibPTP project is free software: you can redistribute it 8 | // and/or modify it under the terms of the GNU General Public License as 9 | // published by the Free Software Foundation, either version 3 of the License, 10 | // or (at your option) any later version. 11 | // 12 | // The LibPTP project is distributed in the hope that it will be 13 | // useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License.com for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License.com 18 | // along with The LibPTP project. 19 | // If not, see . 20 | // 21 | // ============================================================================ 22 | 23 | package libptp.Hardware.HwClock.AdjustableClock; 24 | 25 | import libptp.Hardware.HwClock.HwClock.IPerfectHwClock; 26 | import libptp.Hardware.HwClock.HwClock.IConstantDriftHwClock; 27 | import libptp.Hardware.HwClock.HwClock.ISineHwClock; 28 | import libptp.Hardware.HwClock.HwClock.ILibPLN_HwClock; 29 | 30 | moduleinterface IPerfectAdjustableClock extends IAdjustableClock, IPerfectHwClock 31 | { 32 | parameters: 33 | 34 | @display("i=PTP/Components/Clock/PerfectClock"); 35 | } 36 | 37 | moduleinterface IConstantDriftAdjustableClock extends IAdjustableClock, IConstantDriftHwClock 38 | { 39 | parameters: 40 | 41 | @display("i=PTP/Components/Clock/ConstantDriftClock"); 42 | } 43 | 44 | moduleinterface ISineAdjustableClock extends IAdjustableClock, ISineHwClock 45 | { 46 | parameters: 47 | 48 | @display("i=PTP/Components/Clock/SineClock"); 49 | } 50 | 51 | moduleinterface ILibPLN_AdjustableClock extends IAdjustableClock, ILibPLN_HwClock 52 | { 53 | parameters: 54 | 55 | @display("i=PTP/Components/Clock/RealClock"); 56 | } 57 | 58 | 59 | -------------------------------------------------------------------------------- /src/Hardware/HwClock/ClockEvents/IClockEventSink.cc: -------------------------------------------------------------------------------- 1 | // ============================================================================ 2 | // 3 | // Copyright 2013-2015 Wolfgang Wallner (wolfgang-wallner AT gmx.at) 4 | // 5 | // This file is part of the LibPTP project. 6 | // 7 | // The LibPTP project is free software: you can redistribute it 8 | // and/or modify it under the terms of the GNU General Public License as 9 | // published by the Free Software Foundation, either version 3 of the License, 10 | // or (at your option) any later version. 11 | // 12 | // The LibPTP project is distributed in the hope that it will be 13 | // useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License.com for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License.com 18 | // along with The LibPTP project. 19 | // If not, see . 20 | // 21 | // ============================================================================ 22 | 23 | // ====================================================== 24 | // Includes 25 | // ====================================================== 26 | 27 | #include "IClockEventSink.h" 28 | 29 | // ====================================================== 30 | // Types 31 | // ====================================================== 32 | 33 | // ====================================================== 34 | // Constants 35 | // ====================================================== 36 | 37 | // ====================================================== 38 | // Variables 39 | // ====================================================== 40 | 41 | // ====================================================== 42 | // Declarations 43 | // ====================================================== 44 | 45 | // ====================================================== 46 | // Definitions 47 | // ====================================================== 48 | 49 | void 50 | IClockEventSink::ClockEventCallback( cClockEvent &ClockEvent ) 51 | { 52 | EnterModuleSilent(); 53 | HandleClockEvent( ClockEvent ); 54 | LeaveModule(); 55 | } 56 | -------------------------------------------------------------------------------- /src/Software/PTP_EthernetMapping/PTP_EthernetMapping.ned: -------------------------------------------------------------------------------- 1 | // ============================================================================ 2 | // 3 | // Copyright 2013-2015 Wolfgang Wallner (wolfgang-wallner AT gmx.at) 4 | // 5 | // This file is part of the LibPTP project. 6 | // 7 | // The LibPTP project is free software: you can redistribute it 8 | // and/or modify it under the terms of the GNU General Public License as 9 | // published by the Free Software Foundation, either version 3 of the License, 10 | // or (at your option) any later version. 11 | // 12 | // The LibPTP project is distributed in the hope that it will be 13 | // useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License.com for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License.com 18 | // along with The LibPTP project. 19 | // If not, see . 20 | // 21 | // ============================================================================ 22 | 23 | // ====================================================== 24 | // Package description 25 | // ====================================================== 26 | 27 | package libptp.Software.PTP_EthernetMapping; 28 | 29 | // ====================================================== 30 | // Imports 31 | // ====================================================== 32 | 33 | // ====================================================== 34 | // Channel declarations 35 | // ====================================================== 36 | 37 | // ====================================================== 38 | // Network declarations 39 | // ====================================================== 40 | 41 | simple PTP_EthernetMapping 42 | { 43 | parameters: 44 | 45 | @display("i=PTP/Components/PTP_EthernetMapping/PTP_EthernetMapping"); 46 | 47 | bool Enable = default(true); 48 | 49 | gates: 50 | input upperLayerIn[]; 51 | output upperLayerOut[]; 52 | 53 | input lowerLayerIn @labels(Ieee802Ctrl/up); 54 | output lowerLayerOut @labels(Ieee802Ctrl/down); 55 | } 56 | -------------------------------------------------------------------------------- /src/Hardware/HwClock/TdGen/ITdGen.h: -------------------------------------------------------------------------------- 1 | // ============================================================================ 2 | // 3 | // Copyright 2013-2015 Wolfgang Wallner (wolfgang-wallner AT gmx.at) 4 | // 5 | // This file is part of the LibPTP project. 6 | // 7 | // The LibPTP project is free software: you can redistribute it 8 | // and/or modify it under the terms of the GNU General Public License as 9 | // published by the Free Software Foundation, either version 3 of the License, 10 | // or (at your option) any later version. 11 | // 12 | // The LibPTP project is distributed in the hope that it will be 13 | // useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License.com for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License.com 18 | // along with The LibPTP project. 19 | // If not, see . 20 | // 21 | // ============================================================================ 22 | 23 | #ifndef LIBPTP_ITD_GEN_H_ 24 | #define LIBPTP_ITD_GEN_H_ 25 | 26 | // ====================================================== 27 | // Includes 28 | // ====================================================== 29 | 30 | #include "SubmoduleInitBase.h" 31 | 32 | // ====================================================== 33 | // Types 34 | // ====================================================== 35 | 36 | // ====================================================== 37 | // Declarations 38 | // ====================================================== 39 | 40 | class ITdGen: public cSubmoduleInitBase 41 | { 42 | private: 43 | 44 | // Resources 45 | const std::string TdGenType; 46 | 47 | // Configuration 48 | 49 | // Internal housekeeping 50 | 51 | // Debug functions 52 | 53 | protected: 54 | 55 | public: 56 | 57 | ITdGen( std::string TdGenType ); 58 | virtual ~ITdGen(); 59 | 60 | // Time readout 61 | virtual simtime_t GetTD( simtime_t RealTime ) = 0; 62 | 63 | std::string GetTdGenType(); 64 | 65 | }; 66 | 67 | #endif 68 | 69 | -------------------------------------------------------------------------------- /src/Hardware/PTP_MAC/PTP_MAC.ned: -------------------------------------------------------------------------------- 1 | // ============================================================================ 2 | // 3 | // Copyright 2013-2015 Wolfgang Wallner (wolfgang-wallner AT gmx.at) 4 | // 5 | // This file is part of the LibPTP project. 6 | // 7 | // The LibPTP project is free software: you can redistribute it 8 | // and/or modify it under the terms of the GNU General Public License as 9 | // published by the Free Software Foundation, either version 3 of the License, 10 | // or (at your option) any later version. 11 | // 12 | // The LibPTP project is distributed in the hope that it will be 13 | // useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License.com for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License.com 18 | // along with The LibPTP project. 19 | // If not, see . 20 | // 21 | // ============================================================================ 22 | 23 | package libptp.Hardware.PTP_MAC; 24 | 25 | import inet.linklayer.ethernet.EtherMAC; 26 | 27 | simple PTP_MAC extends EtherMAC like IPTP_MAC 28 | { 29 | parameters: 30 | 31 | @display("i=PTP/Components/MAC/MAC"); 32 | @class(PTP_MAC); 33 | 34 | // PTP configuration 35 | bool PTP_Enable = default(true); 36 | string PTP_ClockType = default("PTP_CLOCK_TYPE_ORDINARY"); 37 | bool PTP_TwoStepFlag = default(false); 38 | string PTP_DelayMechanism = default("DELAY_MECH_E2E"); 39 | 40 | // Hardware setup 41 | string PTP_NIC_CtrlPath = default("^.PTP_NIC_Ctrl"); 42 | string ClockPath = default("^.Clock"); 43 | 44 | // Debug configuration 45 | bool EnableDebugOutput = default( false ); 46 | 47 | // Fault simulation 48 | bool SimulateFault = default( false ); 49 | double FaultTime @unit(s) = default( 0s ); 50 | double FaultDuration @unit(s) = default( 1s ); 51 | 52 | gates: 53 | } 54 | 55 | -------------------------------------------------------------------------------- /src/Firmware/EthernetII_LLC/EthernetII_LLC.h: -------------------------------------------------------------------------------- 1 | // ============================================================================ 2 | // 3 | // Copyright 2013-2015 Wolfgang Wallner (wolfgang-wallner AT gmx.at) 4 | // 5 | // This file is part of the LibPTP project. 6 | // 7 | // The LibPTP project is free software: you can redistribute it 8 | // and/or modify it under the terms of the GNU General Public License as 9 | // published by the Free Software Foundation, either version 3 of the License, 10 | // or (at your option) any later version. 11 | // 12 | // The LibPTP project is distributed in the hope that it will be 13 | // useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License.com for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License.com 18 | // along with The LibPTP project. 19 | // If not, see . 20 | // 21 | // ============================================================================ 22 | 23 | #ifndef LIBPTP_ETHERNET_II_LLC_H_ 24 | #define LIBPTP_ETHERNET_II_LLC_H_ 25 | 26 | // ====================================================== 27 | // Includes 28 | // ====================================================== 29 | 30 | #include 31 | #include 32 | 33 | #include "ModuleInitBase.h" 34 | 35 | // ====================================================== 36 | // Types 37 | // ====================================================== 38 | 39 | // ====================================================== 40 | // Declarations 41 | // ====================================================== 42 | 43 | class EthernetII_LLC : public cModuleInitBase 44 | { 45 | private: 46 | 47 | // Resources 48 | ProtocolMapping mapping; 49 | int lowerLayerInID; 50 | int lowerLayerOutID; 51 | int upperLayerOutBaseID; 52 | 53 | // Config 54 | 55 | // Init API 56 | void AllocateResources(); 57 | void ParseParameters(); 58 | 59 | protected: 60 | 61 | virtual void handleMessage(cMessage *msg); 62 | }; 63 | 64 | #endif 65 | -------------------------------------------------------------------------------- /Tools/Bash_Scripts/CleanUpSources.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Simple script to clean up source code (line endings, trailing spaces, ...) 3 | 4 | # ========================================================================== 5 | # Variable initialization 6 | # ========================================================================== 7 | declare -a SRC_PATHS=("src" "simulations") 8 | #declare -a SRC_PATHS=(".") 9 | declare -a FILE_EXTENSIONS=("*.c" "*.cc" "*.cpp" "*.h" ".hpp" "*.msg" "*.ned" "*.ini") 10 | 11 | #declare -a SRC_PATHS=("../../src/Components/BasicBlocks") 12 | #declare -a FILE_EXTENSIONS=("*.ned") 13 | 14 | # ========================================================================== 15 | # Functions 16 | # ========================================================================== 17 | 18 | # -------------------------------------------------------------------------- 19 | # Clean source directory 20 | # -------------------------------------------------------------------------- 21 | 22 | function CleanSourceDir 23 | { 24 | Path=$1 25 | Ext=$2 26 | 27 | echo "Searching for ${Ext} in ${Path}" 28 | echo "" 29 | 30 | echo " Converting DOS encoding to UNIX encoding" 31 | find ${Path} -name ${Ext} ! -type d -exec bash -c 'dos2unix -q "$0"' {} \; 32 | 33 | echo " Replacing tabs with 4 spaces" 34 | find ${Path} -name ${Ext} ! -type d -exec bash -c 'expand -t 4 "$0" > /tmp/e && mv /tmp/e "$0"' {} \; 35 | 36 | echo " Removing trailing spaces" 37 | SED_CMD='sed '\''s/[[:space:]]*$//'\'' $0 > /tmp/e && mv /tmp/e $0' 38 | 39 | find ${Path} -name ${Ext} ! -type d -exec bash -c "${SED_CMD}" {} \; 40 | } 41 | 42 | # -------------------------------------------------------------------------- 43 | # main 44 | # -------------------------------------------------------------------------- 45 | for SrcPath in "${SRC_PATHS[@]}" 46 | do 47 | for FileExt in "${FILE_EXTENSIONS[@]}" 48 | do 49 | 50 | if [ "$#" -ne 1 ]; then 51 | echo "Illegal number of parameters. Root directory required." 52 | exit 53 | fi 54 | 55 | ROOT_PATH="$1" 56 | 57 | echo "Root: " ${ROOT_PATH} 58 | 59 | CleanSourceDir "${ROOT_PATH}/${SrcPath}" ${FileExt} 60 | 61 | done 62 | done 63 | -------------------------------------------------------------------------------- /src/Hardware/PTP_RelayUnit/MACRelayUnitBase.h: -------------------------------------------------------------------------------- 1 | // ============================================================================ 2 | // 3 | // Copyright 2013-2015 Wolfgang Wallner (wolfgang-wallner AT gmx.at) 4 | // 5 | // This file is part of the LibPTP project. 6 | // 7 | // The LibPTP project is free software: you can redistribute it 8 | // and/or modify it under the terms of the GNU General Public License as 9 | // published by the Free Software Foundation, either version 3 of the License, 10 | // or (at your option) any later version. 11 | // 12 | // The LibPTP project is distributed in the hope that it will be 13 | // useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License.com for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License.com 18 | // along with The LibPTP project. 19 | // If not, see . 20 | // 21 | // ============================================================================ 22 | 23 | #ifndef LIBPTP_MAC_RELAY_UNIT_BASE_H_ 24 | #define LIBPTP_MAC_RELAY_UNIT_BASE_H_ 25 | 26 | // ====================================================== 27 | // Includes 28 | // ====================================================== 29 | 30 | #include 31 | 32 | // ====================================================== 33 | // Types 34 | // ====================================================== 35 | 36 | // ====================================================== 37 | // Declarations 38 | // ====================================================== 39 | 40 | 41 | class MACRelayUnitBase : public MACRelayUnit 42 | { 43 | protected: 44 | 45 | virtual void handleAndDispatchFrame_Prefix(EtherFrame *frame, int &inputport); 46 | virtual void handleAndDispatchFrame_Dispatch(EtherFrame *frame, int inputport); 47 | virtual void handleAndDispatchFrame(EtherFrame *frame); 48 | 49 | virtual void unicastFrame(EtherFrame *frame, int inputport); 50 | virtual void multicastFrame(EtherFrame *frame, int inputport); 51 | 52 | public: 53 | 54 | // Constructor 55 | MACRelayUnitBase(); 56 | }; 57 | 58 | #endif 59 | 60 | -------------------------------------------------------------------------------- /src/Testbenches/ClockScheduleTest/ClockScheduleTest.h: -------------------------------------------------------------------------------- 1 | // ============================================================================ 2 | // 3 | // Copyright 2013-2015 Wolfgang Wallner (wolfgang-wallner AT gmx.at) 4 | // 5 | // This file is part of the LibPTP project. 6 | // 7 | // The LibPTP project is free software: you can redistribute it 8 | // and/or modify it under the terms of the GNU General Public License as 9 | // published by the Free Software Foundation, either version 3 of the License, 10 | // or (at your option) any later version. 11 | // 12 | // The LibPTP project is distributed in the hope that it will be 13 | // useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License.com for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License.com 18 | // along with The LibPTP project. 19 | // If not, see . 20 | // 21 | // ============================================================================ 22 | 23 | #ifndef LIBPTP_CLOCK_SCHEDULE_TEST_H_ 24 | #define LIBPTP_CLOCK_SCHEDULE_TEST_H_ 25 | 26 | #include 27 | 28 | #include "CallableModule.h" 29 | #include "IClockEventSink.h" 30 | #include "ScheduleClock.h" 31 | 32 | class ClockScheduleTest : public cCallableModule, public IClockEventSink 33 | { 34 | private: 35 | 36 | // Resources 37 | cScheduleClock *pClock; 38 | 39 | cMessage *pTestMsg1; 40 | cMessage *pTestMsg2; 41 | cMessage *pTestMsg3; 42 | cMessage *pTestMsg4; 43 | cMessage *pTestMsg5; 44 | 45 | cClockEvent Event1; 46 | cClockEvent Event2; 47 | cClockEvent Event3; 48 | cClockEvent Event4; 49 | 50 | cScheduledClockEvent ScheduledEvent1; 51 | cScheduledClockEvent ScheduledEvent2; 52 | cScheduledClockEvent ScheduledEvent3; 53 | cScheduledClockEvent ScheduledEvent4; 54 | 55 | // Configuration 56 | bool Enabled; 57 | 58 | protected: 59 | virtual void initialize(); 60 | virtual void handleMessage(cMessage *pMsg); 61 | 62 | public: 63 | ClockScheduleTest(); 64 | 65 | void HandleClockEvent( cClockEvent& ClockEvent ); 66 | }; 67 | 68 | #endif 69 | -------------------------------------------------------------------------------- /src/Hardware/HwClock/TdGen/ConstDriftTdGen.h: -------------------------------------------------------------------------------- 1 | // ============================================================================ 2 | // 3 | // Copyright 2013-2015 Wolfgang Wallner (wolfgang-wallner AT gmx.at) 4 | // 5 | // This file is part of the LibPTP project. 6 | // 7 | // The LibPTP project is free software: you can redistribute it 8 | // and/or modify it under the terms of the GNU General Public License as 9 | // published by the Free Software Foundation, either version 3 of the License, 10 | // or (at your option) any later version. 11 | // 12 | // The LibPTP project is distributed in the hope that it will be 13 | // useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License.com for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License.com 18 | // along with The LibPTP project. 19 | // If not, see . 20 | // 21 | // ============================================================================ 22 | 23 | #ifndef LIBPTP_CONST_DRIFT_TD_GEN_H_ 24 | #define LIBPTP_CONST_DRIFT_TD_GEN_H_ 25 | 26 | // ====================================================== 27 | // Includes 28 | // ====================================================== 29 | 30 | #include "ITdGen.h" 31 | 32 | // ====================================================== 33 | // Types 34 | // ====================================================== 35 | 36 | // ====================================================== 37 | // Declarations 38 | // ====================================================== 39 | 40 | class cConstDriftTdGen: public ITdGen 41 | { 42 | private: 43 | 44 | // Resources 45 | 46 | // Configuration 47 | double k; 48 | 49 | // Internal housekeeping 50 | 51 | // Debug functions 52 | 53 | protected: 54 | 55 | // Debugging 56 | 57 | // Configuration 58 | 59 | // Init API 60 | void ParseParameters(); 61 | void RegisterSignals(); 62 | 63 | public: 64 | 65 | cConstDriftTdGen(); 66 | ~cConstDriftTdGen(); 67 | 68 | // Time readout 69 | simtime_t GetTD( simtime_t RealTime ); 70 | }; 71 | 72 | #endif 73 | 74 | -------------------------------------------------------------------------------- /src/Hardware/HwClock/TdGen/SineTdGen.h: -------------------------------------------------------------------------------- 1 | // ============================================================================ 2 | // 3 | // Copyright 2013-2015 Wolfgang Wallner (wolfgang-wallner AT gmx.at) 4 | // 5 | // This file is part of the LibPTP project. 6 | // 7 | // The LibPTP project is free software: you can redistribute it 8 | // and/or modify it under the terms of the GNU General Public License as 9 | // published by the Free Software Foundation, either version 3 of the License, 10 | // or (at your option) any later version. 11 | // 12 | // The LibPTP project is distributed in the hope that it will be 13 | // useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License.com for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License.com 18 | // along with The LibPTP project. 19 | // If not, see . 20 | // 21 | // ============================================================================ 22 | 23 | #ifndef LIBPTP_SINE_TD_GEN_H_ 24 | #define LIBPTP_SINE_TD_GEN_H_ 25 | 26 | // ====================================================== 27 | // Includes 28 | // ====================================================== 29 | 30 | #include "ITdGen.h" 31 | 32 | // ====================================================== 33 | // Types 34 | // ====================================================== 35 | 36 | // ====================================================== 37 | // Declarations 38 | // ====================================================== 39 | 40 | class cSineTdGen: public ITdGen 41 | { 42 | private: 43 | 44 | // Resources 45 | 46 | // Configuration 47 | double f; 48 | double A; 49 | double phi; 50 | 51 | // Internal housekeeping 52 | 53 | // Debug functions 54 | 55 | protected: 56 | 57 | // Debugging 58 | 59 | // Configuration 60 | 61 | // Init API 62 | void ParseParameters(); 63 | void RegisterSignals(); 64 | 65 | public: 66 | 67 | cSineTdGen(); 68 | ~cSineTdGen(); 69 | 70 | // Time readout 71 | simtime_t GetTD( simtime_t RealTime ); 72 | }; 73 | 74 | #endif 75 | 76 | -------------------------------------------------------------------------------- /src/Hardware/HwClock/SeedProvider/SeedProvider.cc: -------------------------------------------------------------------------------- 1 | // ============================================================================ 2 | // 3 | // Copyright 2013-2015 Wolfgang Wallner (wolfgang-wallner AT gmx.at) 4 | // 5 | // This file is part of the LibPTP project. 6 | // 7 | // The LibPTP project is free software: you can redistribute it 8 | // and/or modify it under the terms of the GNU General Public License as 9 | // published by the Free Software Foundation, either version 3 of the License, 10 | // or (at your option) any later version. 11 | // 12 | // The LibPTP project is distributed in the hope that it will be 13 | // useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License.com for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License.com 18 | // along with The LibPTP project. 19 | // If not, see . 20 | // 21 | // ============================================================================ 22 | 23 | // ====================================================== 24 | // Includes 25 | // ====================================================== 26 | 27 | #include 28 | 29 | // ====================================================== 30 | // Definitions 31 | // ====================================================== 32 | 33 | // ====================================================== 34 | // Types 35 | // ====================================================== 36 | 37 | // ====================================================== 38 | // Variables 39 | // ====================================================== 40 | 41 | // ====================================================== 42 | // Definitions 43 | // ====================================================== 44 | 45 | static cNEDValue SeedProvider(cComponent *context, cNEDValue argv[], int argc) 46 | { 47 | static long Seed = 0; 48 | 49 | if( Seed == 0 ) 50 | { 51 | Seed = argv[0].longValue(); 52 | } 53 | 54 | return Seed++; 55 | } 56 | 57 | // ====================================================== 58 | // Declarations 59 | // ====================================================== 60 | 61 | Define_NED_Function(SeedProvider, "int SeedProvider(int Offset)"); 62 | -------------------------------------------------------------------------------- /src/Software/PTP_Stack/Includes/PTP.h: -------------------------------------------------------------------------------- 1 | // ============================================================================ 2 | // 3 | // Copyright 2013-2015 Wolfgang Wallner (wolfgang-wallner AT gmx.at) 4 | // 5 | // This file is part of the LibPTP project. 6 | // 7 | // The LibPTP project is free software: you can redistribute it 8 | // and/or modify it under the terms of the GNU General Public License as 9 | // published by the Free Software Foundation, either version 3 of the License, 10 | // or (at your option) any later version. 11 | // 12 | // The LibPTP project is distributed in the hope that it will be 13 | // useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License.com for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License.com 18 | // along with The LibPTP project. 19 | // If not, see . 20 | // 21 | // ============================================================================ 22 | 23 | #ifndef LIBPTP_PTP_H_ 24 | #define LIBPTP_PTP_H_ 25 | 26 | // ====================================================== 27 | // Includes 28 | // ====================================================== 29 | 30 | #include 31 | 32 | // Basic stuff 33 | #include "PTP_Constants.h" 34 | #include "PTP_PrimitiveDataTypes.h" 35 | 36 | // Derived data types 37 | #include "PTP_ClockIdentity.h" 38 | #include "PTP_ClockQuality.h" 39 | #include "PTP_FaultRecord.h" 40 | #include "PTP_PortAddress.h" 41 | #include "PTP_PortIdentity.h" 42 | #include "PTP_PTPText.h" 43 | #include "PTP_TimeInterval.h" 44 | #include "PTP_TimeStamp.h" 45 | #include "PTP_TLV.h" 46 | 47 | // Data sets 48 | #include "PTP_CurrentDS.h" 49 | #include "PTP_DefaultDS.h" 50 | #include "PTP_ParentDS.h" 51 | #include "PTP_TimePropertiesDS.h" 52 | #include "PTP_PortDS.h" 53 | #include "PTP_TransparentClockDefaultDS.h" 54 | #include "PTP_TransparentClockPortDS.h" 55 | #include "PTP_ForeignMasterDS.h" 56 | 57 | // ====================================================== 58 | // Declarations 59 | // ====================================================== 60 | 61 | // ====================================================== 62 | // Types 63 | // ====================================================== 64 | 65 | #endif 66 | -------------------------------------------------------------------------------- /src/Software/SimTimeFilter/ISimTimeFilter.h: -------------------------------------------------------------------------------- 1 | // ============================================================================ 2 | // 3 | // Copyright 2013-2015 Wolfgang Wallner (wolfgang-wallner AT gmx.at) 4 | // 5 | // This file is part of the LibPTP project. 6 | // 7 | // The LibPTP project is free software: you can redistribute it 8 | // and/or modify it under the terms of the GNU General Public License as 9 | // published by the Free Software Foundation, either version 3 of the License, 10 | // or (at your option) any later version. 11 | // 12 | // The LibPTP project is distributed in the hope that it will be 13 | // useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License.com for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License.com 18 | // along with The LibPTP project. 19 | // If not, see . 20 | // 21 | // ============================================================================ 22 | 23 | #ifndef LIBPTP_ISIMTIME_FILTER_H_ 24 | #define LIBPTP_ISIMTIME_FILTER_H_ 25 | 26 | // ====================================================== 27 | // Includes 28 | // ====================================================== 29 | 30 | #include 31 | 32 | // ====================================================== 33 | // Types 34 | // ====================================================== 35 | 36 | // ====================================================== 37 | // Declarations 38 | // ====================================================== 39 | 40 | class ISimTimeFilter 41 | { 42 | private: 43 | 44 | protected: 45 | 46 | public: 47 | 48 | // Constructors/Destructor 49 | ISimTimeFilter(); 50 | ISimTimeFilter( const ISimTimeFilter& other ); 51 | virtual ~ISimTimeFilter(); 52 | 53 | virtual ISimTimeFilter* Clone() const = 0; // Virtual constructor (copying) 54 | 55 | // Setters 56 | 57 | // Getters 58 | 59 | // API Functions 60 | virtual void reset() = 0; 61 | virtual void push( simtime_t v ) = 0; 62 | virtual simtime_t pop() = 0; 63 | 64 | // Operators 65 | ISimTimeFilter& operator= (const ISimTimeFilter& other); 66 | }; 67 | 68 | #endif 69 | -------------------------------------------------------------------------------- /src/Hardware/PTP_NIC_Ctrl/PTP_Requ_Msg/PtpPortRequ.msg: -------------------------------------------------------------------------------- 1 | // ============================================================================ 2 | // 3 | // Copyright 2013-2015 Wolfgang Wallner (wolfgang-wallner AT gmx.at) 4 | // 5 | // This file is part of the LibPTP project. 6 | // 7 | // The LibPTP project is free software: you can redistribute it 8 | // and/or modify it under the terms of the GNU General Public License as 9 | // published by the Free Software Foundation, either version 3 of the License, 10 | // or (at your option) any later version. 11 | // 12 | // The LibPTP project is distributed in the hope that it will be 13 | // useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License.com for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License.com 18 | // along with The LibPTP project. 19 | // If not, see . 20 | // 21 | // ============================================================================ 22 | 23 | // ================================================= 24 | // Make needed C++ stuff available 25 | // ================================================= 26 | 27 | cplusplus {{ 28 | #include "PTPv2_m.h" 29 | }}; 30 | 31 | // ================================================= 32 | // Class announcements 33 | // ================================================= 34 | 35 | class noncobject PTPv2_SyncFrame; 36 | class noncobject PTPv2_PDelay_RespFrame; 37 | 38 | // ================================================= 39 | // Type definitions 40 | // ================================================= 41 | 42 | enum tPtpPortRequ 43 | { 44 | PTP_PORT_REQU_TYPE_TRIG_SFU = 0; 45 | PTP_PORT_REQU_TYPE_TRIG_PDFU = 1; 46 | PTP_PORT_REQU_TYPE_FAULT = 2; 47 | PTP_PORT_REQU_TYPE_RECOVERY = 3; 48 | }; 49 | 50 | // ================================================= 51 | // Message definitions 52 | // ================================================= 53 | 54 | message PtpPortRequ 55 | { 56 | int Type @enum(tPtpPortRequ); 57 | } 58 | 59 | message PtpPortRequ_TrigSyncFU extends PtpPortRequ 60 | { 61 | PTPv2_SyncFrame SyncFrame; 62 | } 63 | 64 | message PtpPortRequ_TrigPDelayFU extends PtpPortRequ 65 | { 66 | PTPv2_PDelay_RespFrame PDelayFrame; 67 | } 68 | -------------------------------------------------------------------------------- /src/Components/Cables/Cables.ned: -------------------------------------------------------------------------------- 1 | // ============================================================================ 2 | // 3 | // Copyright 2013-2015 Wolfgang Wallner (wolfgang-wallner AT gmx.at) 4 | // 5 | // This file is part of the LibPTP project. 6 | // 7 | // The LibPTP project is free software: you can redistribute it 8 | // and/or modify it under the terms of the GNU General Public License as 9 | // published by the Free Software Foundation, either version 3 of the License, 10 | // or (at your option) any later version. 11 | // 12 | // The LibPTP project is distributed in the hope that it will be 13 | // useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License.com for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License.com 18 | // along with The LibPTP project. 19 | // If not, see . 20 | // 21 | // ============================================================================ 22 | 23 | // ====================================================== 24 | // Package description 25 | // ====================================================== 26 | package libptp.Components.Cables; 27 | 28 | // ====================================================== 29 | // Imports 30 | // ====================================================== 31 | 32 | import inet.nodes.ethernet.Eth1G; 33 | 34 | // ====================================================== 35 | // Channel declarations 36 | // ====================================================== 37 | 38 | channel GigabitCable extends Eth1G 39 | { 40 | } 41 | 42 | channel GigabitCable20cm extends Eth1G 43 | { 44 | parameters: 45 | 46 | length = 0.2m; 47 | } 48 | 49 | channel GigabitCable1m extends Eth1G 50 | { 51 | parameters: 52 | 53 | length = 1m; 54 | } 55 | 56 | channel GigabitCable10m extends Eth1G 57 | { 58 | parameters: 59 | 60 | length = 10m; 61 | } 62 | 63 | channel GigabitCable100m extends Eth1G 64 | { 65 | parameters: 66 | 67 | length = 100m; 68 | } 69 | 70 | channel GigabitCable1000m extends Eth1G 71 | { 72 | parameters: 73 | 74 | length = 1000m; 75 | } 76 | 77 | // ====================================================== 78 | // Network declarations 79 | // ====================================================== 80 | 81 | -------------------------------------------------------------------------------- /src/Components/Utilities/TimeDiffObserver/TimeDiffObserver.ned: -------------------------------------------------------------------------------- 1 | // ============================================================================ 2 | // 3 | // Copyright 2013-2015 Wolfgang Wallner (wolfgang-wallner AT gmx.at) 4 | // 5 | // This file is part of the LibPTP project. 6 | // 7 | // The LibPTP project is free software: you can redistribute it 8 | // and/or modify it under the terms of the GNU General Public License as 9 | // published by the Free Software Foundation, either version 3 of the License, 10 | // or (at your option) any later version. 11 | // 12 | // The LibPTP project is distributed in the hope that it will be 13 | // useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License.com for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License.com 18 | // along with The LibPTP project. 19 | // If not, see . 20 | // 21 | // ============================================================================ 22 | 23 | package libptp.Components.Utilities.TimeDiffObserver; 24 | 25 | simple TimeDiffObserver 26 | { 27 | parameters: 28 | 29 | @display("i=PTP/Nodes/TimeDiffObserver/TimeDiffObserver"); 30 | @class(cTimeDiffObserver); 31 | 32 | // Hardware configuration 33 | string ClockPath1 = default( "^.Clock1" ); 34 | string ClockPath2 = default( "^.Clock2" ); 35 | 36 | // Trace configuration 37 | double TraceInterval @unit(s) = default(0); // 0 -> tracing disabled 38 | 39 | // GUI configuration 40 | int GuiExponent = default(-6); 41 | bool AutomaticGuiExponent = default(true); 42 | 43 | // ----------------------------------------------------------------------- 44 | // Signals 45 | // ----------------------------------------------------------------------- 46 | @signal[HwTimeDiff](type=simtime_t); 47 | @signal[ScaledTimeDiff](type=double); 48 | 49 | // ----------------------------------------------------------------------- 50 | // Statistics 51 | // ----------------------------------------------------------------------- 52 | @statistic[HwTimeDiff](record=stats?,vector?); 53 | @statistic[ScaledTimeDiff](record=stats?,vector?); 54 | } 55 | -------------------------------------------------------------------------------- /src/Hardware/PTP_EtherEncap/PTP_EtherEncap.h: -------------------------------------------------------------------------------- 1 | // ============================================================================ 2 | // 3 | // Copyright 2013-2015 Wolfgang Wallner (wolfgang-wallner AT gmx.at) 4 | // 5 | // This file is part of the LibPTP project. 6 | // 7 | // The LibPTP project is free software: you can redistribute it 8 | // and/or modify it under the terms of the GNU General Public License as 9 | // published by the Free Software Foundation, either version 3 of the License, 10 | // or (at your option) any later version. 11 | // 12 | // The LibPTP project is distributed in the hope that it will be 13 | // useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License.com for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License.com 18 | // along with The LibPTP project. 19 | // If not, see . 20 | // 21 | // ============================================================================ 22 | 23 | #ifndef LIBPTP_PTP_ETHER_ENCAP_H_ 24 | #define LIBPTP_PTP_ETHER_ENCAP_H_ 25 | 26 | // ====================================================== 27 | // Includes 28 | // ====================================================== 29 | 30 | #include "EtherEncap.h" 31 | #include "MACAddress.h" 32 | 33 | #include "IInitBase.h" 34 | 35 | // ====================================================== 36 | // Types 37 | // ====================================================== 38 | 39 | // ====================================================== 40 | // Declarations 41 | // ====================================================== 42 | 43 | class PTP_EtherEncap : public EtherEncap, public IInitBase 44 | { 45 | private: 46 | 47 | // Configuration 48 | bool PTP_Enable; 49 | const MACAddress PtpMcMAC; 50 | const MACAddress PtpMcPDelayMAC; 51 | 52 | // Inherited EtherEncap API 53 | void processPacketFromHigherLayer(cPacket *msg); 54 | void processFrameFromMAC(EtherFrame *frame); 55 | 56 | protected: 57 | 58 | // Init API 59 | void ParseParameters(); 60 | 61 | // OMNeT API 62 | int numInitStages() const; 63 | void initialize(int stage); 64 | 65 | public: 66 | PTP_EtherEncap(); 67 | }; 68 | 69 | #endif 70 | 71 | -------------------------------------------------------------------------------- /src/Software/PTP_Stack/AppServices/Delay/TimestampMatcher.h: -------------------------------------------------------------------------------- 1 | // ============================================================================ 2 | // 3 | // Copyright 2013-2015 Wolfgang Wallner (wolfgang-wallner AT gmx.at) 4 | // 5 | // This file is part of the LibPTP project. 6 | // 7 | // The LibPTP project is free software: you can redistribute it 8 | // and/or modify it under the terms of the GNU General Public License as 9 | // published by the Free Software Foundation, either version 3 of the License, 10 | // or (at your option) any later version. 11 | // 12 | // The LibPTP project is distributed in the hope that it will be 13 | // useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License.com for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License.com 18 | // along with The LibPTP project. 19 | // If not, see . 20 | // 21 | // ============================================================================ 22 | 23 | #ifndef LIBPTP_TIMESTAMP_MATCHER_H_ 24 | #define LIBPTP_TIMESTAMP_MATCHER_H_ 25 | 26 | // ====================================================== 27 | // Includes 28 | // ====================================================== 29 | 30 | #include 31 | 32 | // ====================================================== 33 | // Types 34 | // ====================================================== 35 | 36 | // ====================================================== 37 | // Declarations 38 | // ====================================================== 39 | 40 | struct MatchedTime_t 41 | { 42 | simtime_t Time1; 43 | simtime_t Time2; 44 | simtime_t Corr1; 45 | simtime_t Corr2; 46 | uint16_t SequId; 47 | }; 48 | 49 | class cTimestampMatcher 50 | { 51 | private: 52 | 53 | uint16_t Sequ1; 54 | uint16_t Sequ2; 55 | simtime_t Time1; 56 | simtime_t Time2; 57 | simtime_t Corr1; 58 | simtime_t Corr2; 59 | 60 | MatchedTime_t MostRecentMatch; 61 | 62 | protected: 63 | 64 | public: 65 | 66 | void PushFirst( simtime_t Time, simtime_t Corr, uint16_t SequId ); 67 | void PushSecond( simtime_t Time, simtime_t Corr, uint16_t SequId ); 68 | 69 | MatchedTime_t GetMostRecent(); 70 | }; 71 | 72 | #endif 73 | -------------------------------------------------------------------------------- /src/Hardware/HwClock/TdGen/libPLN_TdGen.h: -------------------------------------------------------------------------------- 1 | // ============================================================================ 2 | // 3 | // Copyright 2013-2015 Wolfgang Wallner (wolfgang-wallner AT gmx.at) 4 | // 5 | // This file is part of the LibPTP project. 6 | // 7 | // The LibPTP project is free software: you can redistribute it 8 | // and/or modify it under the terms of the GNU General Public License as 9 | // published by the Free Software Foundation, either version 3 of the License, 10 | // or (at your option) any later version. 11 | // 12 | // The LibPTP project is distributed in the hope that it will be 13 | // useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License.com for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License.com 18 | // along with The LibPTP project. 19 | // If not, see . 20 | // 21 | // ============================================================================ 22 | 23 | #ifndef LIBPTP_LIBPLN_TD_GEN_H_ 24 | #define LIBPTP_LIBPLN_TD_GEN_H_ 25 | 26 | #ifdef HAS_LIBPLN 27 | 28 | // ====================================================== 29 | // Includes 30 | // ====================================================== 31 | 32 | #include "ITdGen.h" 33 | 34 | #include "libPLN.hpp" 35 | 36 | #include "TdGen_ParameterParser.h" 37 | 38 | // ====================================================== 39 | // Types 40 | // ====================================================== 41 | 42 | // ====================================================== 43 | // Declarations 44 | // ====================================================== 45 | 46 | class cLibPLN_TdGen: public ITdGen 47 | { 48 | private: 49 | 50 | // Resources 51 | TdOracle *pTdGen; 52 | 53 | // Config 54 | unsigned int Seed; 55 | bool AllowSkipping; 56 | LibPLN_Example_t ExampleType; 57 | 58 | protected: 59 | 60 | // Init API 61 | void ParseResourceParameters(); 62 | void AllocateResources(); 63 | void ParseParameters(); 64 | 65 | public: 66 | 67 | cLibPLN_TdGen(); 68 | ~cLibPLN_TdGen(); 69 | 70 | // Time readout 71 | simtime_t GetTD( simtime_t RealTime ); 72 | }; 73 | 74 | #endif 75 | 76 | #endif 77 | 78 | -------------------------------------------------------------------------------- /src/Hardware/HwClock/TdGen/TdGen_ParameterParser.cc: -------------------------------------------------------------------------------- 1 | // ============================================================================ 2 | // 3 | // Copyright 2013-2015 Wolfgang Wallner (wolfgang-wallner AT gmx.at) 4 | // 5 | // This file is part of the LibPTP project. 6 | // 7 | // The LibPTP project is free software: you can redistribute it 8 | // and/or modify it under the terms of the GNU General Public License as 9 | // published by the Free Software Foundation, either version 3 of the License, 10 | // or (at your option) any later version. 11 | // 12 | // The LibPTP project is distributed in the hope that it will be 13 | // useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License.com for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License.com 18 | // along with The LibPTP project. 19 | // If not, see . 20 | // 21 | // ============================================================================ 22 | 23 | // ====================================================== 24 | // Includes 25 | // ====================================================== 26 | 27 | #include "TdGen_ParameterParser.h" 28 | #include "ParameterParser.h" 29 | 30 | // ====================================================== 31 | // Definitions 32 | // ====================================================== 33 | 34 | // ====================================================== 35 | // Variables 36 | // ====================================================== 37 | 38 | ParseType LibPLN_ExampleParse[] = 39 | { 40 | { LIBPLN_EXAMPLE_AVG_OSC, "AVG_OSC" }, 41 | { LIBPLN_EXAMPLE_WATCH_QUARTZ, "WATCH_QUARTZ" }, 42 | }; 43 | 44 | // ====================================================== 45 | // Declarations 46 | // ====================================================== 47 | 48 | // ====================================================== 49 | // Definitions 50 | // ====================================================== 51 | 52 | // ------------------------------------------------------ 53 | // TdGen type 54 | // ------------------------------------------------------ 55 | LibPLN_Example_t 56 | cTdGen_ParameterParser::ParseLibPLN_Example(const char *Str) 57 | { 58 | return Parse( LibPLN_ExampleParse, ArrayLen(LibPLN_ExampleParse), Str ); 59 | } 60 | -------------------------------------------------------------------------------- /src/Hardware/HwClock/AdjustableClock/Internal_AdjustableClock.ned: -------------------------------------------------------------------------------- 1 | // ============================================================================ 2 | // 3 | // Copyright 2013-2015 Wolfgang Wallner (wolfgang-wallner AT gmx.at) 4 | // 5 | // This file is part of the LibPTP project. 6 | // 7 | // The LibPTP project is free software: you can redistribute it 8 | // and/or modify it under the terms of the GNU General Public License as 9 | // published by the Free Software Foundation, either version 3 of the License, 10 | // or (at your option) any later version. 11 | // 12 | // The LibPTP project is distributed in the hope that it will be 13 | // useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License.com for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License.com 18 | // along with The LibPTP project. 19 | // If not, see . 20 | // 21 | // ============================================================================ 22 | 23 | package libptp.Hardware.HwClock.AdjustableClock; 24 | 25 | import libptp.Hardware.HwClock.HwClock.Internal_HwClock; 26 | 27 | simple Internal_AdjustableClock extends Internal_HwClock like IAdjustableClock 28 | { 29 | parameters: 30 | 31 | @display("i=PTP/Components/InternalModule/InternalModule"); 32 | @class("cAdjustableClock"); 33 | 34 | // Clock configuration 35 | bool EnableAdjustments = default(true); 36 | int ScaleFactor_LowerBound_ppb = default(-32767999); // Limit value taken from Intel i210 data sheet 37 | int ScaleFactor_UpperBound_ppb = default(32767999); 38 | double BeginScaledTime@unit(s) = default(uniform(0ms,5ms)); 39 | 40 | // ----------------------------------------------------------------------- 41 | // Signals 42 | // ----------------------------------------------------------------------- 43 | @signal[ScaledTime](type=double); 44 | @signal[ScaleFactor_ppb](type=long); 45 | 46 | // ----------------------------------------------------------------------- 47 | // Statistics 48 | // ----------------------------------------------------------------------- 49 | @statistic[ScaledTime](record=vector?); 50 | @statistic[ScaleFactor_ppb](record=stats?,vector?); 51 | } 52 | -------------------------------------------------------------------------------- /src/Hardware/DualDelayer/DelayQueue/DelayQueue.h: -------------------------------------------------------------------------------- 1 | // ============================================================================ 2 | // 3 | // Copyright 2013-2015 Wolfgang Wallner (wolfgang-wallner AT gmx.at) 4 | // 5 | // This file is part of the LibPTP project. 6 | // 7 | // The LibPTP project is free software: you can redistribute it 8 | // and/or modify it under the terms of the GNU General Public License as 9 | // published by the Free Software Foundation, either version 3 of the License, 10 | // or (at your option) any later version. 11 | // 12 | // The LibPTP project is distributed in the hope that it will be 13 | // useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License.com for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License.com 18 | // along with The LibPTP project. 19 | // If not, see . 20 | // 21 | // ============================================================================ 22 | 23 | #ifndef LIBPTP_DELAY_QUEUE_H_ 24 | #define LIBPTP_DELAY_QUEUE_H_ 25 | 26 | // ====================================================== 27 | // Includes 28 | // ====================================================== 29 | 30 | #include 31 | 32 | #include 33 | 34 | #include "ModuleInitBase.h" 35 | 36 | // ====================================================== 37 | // Types 38 | // ====================================================== 39 | 40 | // ====================================================== 41 | // Declarations 42 | // ====================================================== 43 | 44 | class DelayQueue: public cModuleInitBase 45 | { 46 | private: 47 | 48 | // Configuration 49 | size_t MaxSize; 50 | 51 | // Resources 52 | std::queue MsgQueue; 53 | cMessage *ReminderMsg; 54 | cPar *delayPar; 55 | cGate *pOutGate; 56 | 57 | // Private functions 58 | void HandleReminder(); 59 | void ScheduleReminder(); 60 | 61 | protected: 62 | 63 | // Init API 64 | void AllocateResources(); 65 | void ParseParameters(); 66 | 67 | // OMNeT API 68 | virtual void handleMessage(cMessage *pMsg); 69 | 70 | public: 71 | DelayQueue(); 72 | ~DelayQueue(); 73 | }; 74 | 75 | #endif 76 | 77 | -------------------------------------------------------------------------------- /src/Software/SimTimeFilter/Identity/IdentitySimTimeFilter.h: -------------------------------------------------------------------------------- 1 | // ============================================================================ 2 | // 3 | // Copyright 2013-2015 Wolfgang Wallner (wolfgang-wallner AT gmx.at) 4 | // 5 | // This file is part of the LibPTP project. 6 | // 7 | // The LibPTP project is free software: you can redistribute it 8 | // and/or modify it under the terms of the GNU General Public License as 9 | // published by the Free Software Foundation, either version 3 of the License, 10 | // or (at your option) any later version. 11 | // 12 | // The LibPTP project is distributed in the hope that it will be 13 | // useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License.com for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License.com 18 | // along with The LibPTP project. 19 | // If not, see . 20 | // 21 | // ============================================================================ 22 | 23 | #ifndef LIBPTP_IDENTITY_SIMTIME_FILTER_H_ 24 | #define LIBPTP_IDENTITY_SIMTIME_FILTER_H_ 25 | 26 | // ====================================================== 27 | // Includes 28 | // ====================================================== 29 | 30 | #include 31 | 32 | // ====================================================== 33 | // Types 34 | // ====================================================== 35 | 36 | // ====================================================== 37 | // Declarations 38 | // ====================================================== 39 | 40 | class IdentitySimTimeFilter : public ISimTimeFilter 41 | { 42 | private: 43 | 44 | // Resources 45 | simtime_t buf; 46 | 47 | protected: 48 | 49 | public: 50 | 51 | // Constructors/Destructor 52 | IdentitySimTimeFilter(); 53 | IdentitySimTimeFilter( const IdentitySimTimeFilter& other ); 54 | ~IdentitySimTimeFilter(); 55 | 56 | IdentitySimTimeFilter* Clone() const; 57 | 58 | // Setters 59 | 60 | // Getters 61 | 62 | // API Functions 63 | virtual void reset(); 64 | virtual void push( simtime_t v ); 65 | virtual simtime_t pop(); 66 | 67 | // Operators 68 | IdentitySimTimeFilter& operator= (const IdentitySimTimeFilter& other); 69 | }; 70 | 71 | #endif 72 | -------------------------------------------------------------------------------- /src/Software/SimTimeFilter/SimTimeFilter_ParameterParser.cc: -------------------------------------------------------------------------------- 1 | // ============================================================================ 2 | // 3 | // Copyright 2013-2015 Wolfgang Wallner (wolfgang-wallner AT gmx.at) 4 | // 5 | // This file is part of the LibPTP project. 6 | // 7 | // The LibPTP project is free software: you can redistribute it 8 | // and/or modify it under the terms of the GNU General Public License as 9 | // published by the Free Software Foundation, either version 3 of the License, 10 | // or (at your option) any later version. 11 | // 12 | // The LibPTP project is distributed in the hope that it will be 13 | // useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License.com for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License.com 18 | // along with The LibPTP project. 19 | // If not, see . 20 | // 21 | // ============================================================================ 22 | 23 | // ====================================================== 24 | // Includes 25 | // ====================================================== 26 | 27 | #include "SimTimeFilter_ParameterParser.h" 28 | #include "ParameterParser.h" 29 | 30 | // ====================================================== 31 | // Definitions 32 | // ====================================================== 33 | 34 | // ====================================================== 35 | // Variables 36 | // ====================================================== 37 | 38 | ParseType SimTimeFilterTypeParse[] = 39 | { 40 | { NO_FILTER, "NO_FILTER" }, 41 | { MOVING_AVG_FILTER, "MOVING_AVG_FILTER" }, 42 | }; 43 | 44 | // ====================================================== 45 | // Declarations 46 | // ====================================================== 47 | 48 | // ====================================================== 49 | // Definitions 50 | // ====================================================== 51 | 52 | // ------------------------------------------------------ 53 | // TdGen type 54 | // ------------------------------------------------------ 55 | 56 | SimTimeFilter_t 57 | cSimTimeFilter_ParameterParser::ParseSimTimeFilterType(const char *Str) 58 | { 59 | return Parse( SimTimeFilterTypeParse, ArrayLen(SimTimeFilterTypeParse), Str ); 60 | } 61 | -------------------------------------------------------------------------------- /src/Hardware/HwClock/HwClock/Internal_HwClock.ned: -------------------------------------------------------------------------------- 1 | // ============================================================================ 2 | // 3 | // Copyright 2013-2015 Wolfgang Wallner (wolfgang-wallner AT gmx.at) 4 | // 5 | // This file is part of the LibPTP project. 6 | // 7 | // The LibPTP project is free software: you can redistribute it 8 | // and/or modify it under the terms of the GNU General Public License as 9 | // published by the Free Software Foundation, either version 3 of the License, 10 | // or (at your option) any later version. 11 | // 12 | // The LibPTP project is distributed in the hope that it will be 13 | // useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License.com for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License.com 18 | // along with The LibPTP project. 19 | // If not, see . 20 | // 21 | // ============================================================================ 22 | 23 | package libptp.Hardware.HwClock.HwClock; 24 | 25 | simple Internal_HwClock like IHwClock 26 | { 27 | parameters: 28 | 29 | @display("i=PTP/Components/InternalModule/InternalModule"); 30 | @class("cHwClock"); 31 | 32 | // Clock configuration 33 | double TickLenNom @unit(s) = default(50ns); 34 | double InitialPhaseNom = default(uniform(0.0,1.0)); // Initial phase offset, 0.0-1.0 35 | 36 | // Time Deviation configuration 37 | string TdGenType = default("TDGEN_TYPE_PERFECT"); 38 | 39 | // Trace configuration 40 | double TimeTraceInterval @unit(s) = default(0); 41 | 42 | // ----------------------------------------------------------------------- 43 | // Signals 44 | // ----------------------------------------------------------------------- 45 | @signal[TimeDeviation](type=simtime_t); 46 | @signal[HwTime](type=simtime_t); 47 | @signal[RequestedHwTime](type=simtime_t); 48 | 49 | // ----------------------------------------------------------------------- 50 | // Statistics 51 | // ----------------------------------------------------------------------- 52 | @statistic[TimeDeviation](record=stats,vector?); 53 | @statistic[HwTime](record=vector?); 54 | @statistic[RequestedHwTime](record=vector?); 55 | } 56 | -------------------------------------------------------------------------------- /src/Utils/ByteOrder/ByteOrder.h: -------------------------------------------------------------------------------- 1 | // ============================================================================ 2 | // 3 | // Copyright 2013-2015 Wolfgang Wallner (wolfgang-wallner AT gmx.at) 4 | // 5 | // This file is part of the LibPTP project. 6 | // 7 | // The LibPTP project is free software: you can redistribute it 8 | // and/or modify it under the terms of the GNU General Public License as 9 | // published by the Free Software Foundation, either version 3 of the License, 10 | // or (at your option) any later version. 11 | // 12 | // The LibPTP project is distributed in the hope that it will be 13 | // useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License.com for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License.com 18 | // along with The LibPTP project. 19 | // If not, see . 20 | // 21 | // ============================================================================ 22 | 23 | #ifndef LIBPTP_BYTE_ORDER_H_ 24 | #define LIBPTP_BYTE_ORDER_H_ 25 | 26 | // ====================================================== 27 | // Includes 28 | // ====================================================== 29 | 30 | #include "PTP_PrimitiveDataTypes.h" 31 | 32 | #include 33 | 34 | // ====================================================== 35 | // Definitions 36 | // ====================================================== 37 | 38 | // ====================================================== 39 | // Types 40 | // ====================================================== 41 | 42 | // ====================================================== 43 | // Declarations 44 | // ====================================================== 45 | 46 | UInteger16 NetToHostUI16( UInteger16 UInt16 ); 47 | UInteger32 NetToHostUI32( UInteger32 UInt32 ); 48 | Integer16 NetToHostI16 ( Integer16 Int16 ); 49 | Integer32 NetToHostI32 ( Integer32 Int32 ); 50 | Integer64 NetToHostI64 ( Integer64 Int64 ); 51 | 52 | UInteger48 BufToHostUI48( Octet Buf[], size_t BufSize ); 53 | 54 | UInteger16 HostToNetUI16( UInteger16 UInt16 ); 55 | UInteger32 HostToNetUI32( UInteger32 UInt32 ); 56 | Integer16 HostToNetI16 ( Integer16 Int16 ); 57 | Integer32 HostToNetI32 ( Integer32 Int32 ); 58 | Integer64 HostToNetI64 ( Integer64 Int64 ); 59 | 60 | void HostToBufUI48( UInteger48 UInt48, Octet Buf[], size_t BufSize ); 61 | 62 | #endif 63 | -------------------------------------------------------------------------------- /src/Hardware/HwClock/TdGen/ITdGen.cc: -------------------------------------------------------------------------------- 1 | // ============================================================================ 2 | // 3 | // Copyright 2013-2015 Wolfgang Wallner (wolfgang-wallner AT gmx.at) 4 | // 5 | // This file is part of the LibPTP project. 6 | // 7 | // The LibPTP project is free software: you can redistribute it 8 | // and/or modify it under the terms of the GNU General Public License as 9 | // published by the Free Software Foundation, either version 3 of the License, 10 | // or (at your option) any later version. 11 | // 12 | // The LibPTP project is distributed in the hope that it will be 13 | // useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License.com for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License.com 18 | // along with The LibPTP project. 19 | // If not, see . 20 | // 21 | // ============================================================================ 22 | 23 | // ====================================================== 24 | // Includes 25 | // ====================================================== 26 | 27 | #include "ITdGen.h" 28 | 29 | // ====================================================== 30 | // Types 31 | // ====================================================== 32 | 33 | // ====================================================== 34 | // Constants 35 | // ====================================================== 36 | 37 | // ====================================================== 38 | // Variables 39 | // ====================================================== 40 | 41 | // ====================================================== 42 | // Declarations 43 | // ====================================================== 44 | 45 | // ====================================================== 46 | // Definitions 47 | // ====================================================== 48 | 49 | // ------------------------------------------------------ 50 | // Constructors/Destructor 51 | // ------------------------------------------------------ 52 | 53 | ITdGen::ITdGen( std::string TdGenType ) 54 | : cSubmoduleInitBase(), TdGenType( TdGenType ) 55 | { 56 | } 57 | 58 | ITdGen::~ITdGen() 59 | { 60 | } 61 | 62 | // ------------------------------------------------------ 63 | // Getters 64 | // ------------------------------------------------------ 65 | 66 | std::string 67 | ITdGen::GetTdGenType() 68 | { 69 | return TdGenType; 70 | } 71 | -------------------------------------------------------------------------------- /src/Hardware/HwClock/TdGen/PerfectTdGen.cc: -------------------------------------------------------------------------------- 1 | // ============================================================================ 2 | // 3 | // Copyright 2013-2015 Wolfgang Wallner (wolfgang-wallner AT gmx.at) 4 | // 5 | // This file is part of the LibPTP project. 6 | // 7 | // The LibPTP project is free software: you can redistribute it 8 | // and/or modify it under the terms of the GNU General Public License as 9 | // published by the Free Software Foundation, either version 3 of the License, 10 | // or (at your option) any later version. 11 | // 12 | // The LibPTP project is distributed in the hope that it will be 13 | // useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License.com for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License.com 18 | // along with The LibPTP project. 19 | // If not, see . 20 | // 21 | // ============================================================================ 22 | 23 | // ====================================================== 24 | // Includes 25 | // ====================================================== 26 | 27 | #include "PerfectTdGen.h" 28 | 29 | // ====================================================== 30 | // Types 31 | // ====================================================== 32 | 33 | // ====================================================== 34 | // Constants 35 | // ====================================================== 36 | 37 | // ====================================================== 38 | // Variables 39 | // ====================================================== 40 | 41 | // ====================================================== 42 | // Declarations 43 | // ====================================================== 44 | 45 | // ====================================================== 46 | // Definitions 47 | // ====================================================== 48 | 49 | // ------------------------------------------------------ 50 | // Constructors/Destructor 51 | // ------------------------------------------------------ 52 | 53 | cPerfectTdGen::cPerfectTdGen() 54 | : ITdGen( "PerfectTdGen" ) 55 | { 56 | } 57 | 58 | cPerfectTdGen::~cPerfectTdGen() 59 | { 60 | } 61 | 62 | // ------------------------------------------------------ 63 | // Getters 64 | // ------------------------------------------------------ 65 | 66 | simtime_t 67 | cPerfectTdGen::GetTD( simtime_t RealTime ) 68 | { 69 | return SIMTIME_ZERO; 70 | } 71 | -------------------------------------------------------------------------------- /src/Hardware/HwClock/HwClock/HwClock_ParameterParser.cc: -------------------------------------------------------------------------------- 1 | // ============================================================================ 2 | // 3 | // Copyright 2013-2015 Wolfgang Wallner (wolfgang-wallner AT gmx.at) 4 | // 5 | // This file is part of the LibPTP project. 6 | // 7 | // The LibPTP project is free software: you can redistribute it 8 | // and/or modify it under the terms of the GNU General Public License as 9 | // published by the Free Software Foundation, either version 3 of the License, 10 | // or (at your option) any later version. 11 | // 12 | // The LibPTP project is distributed in the hope that it will be 13 | // useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License.com for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License.com 18 | // along with The LibPTP project. 19 | // If not, see . 20 | // 21 | // ============================================================================ 22 | 23 | // ====================================================== 24 | // Includes 25 | // ====================================================== 26 | 27 | #include "HwClock_ParameterParser.h" 28 | #include "ParameterParser.h" 29 | 30 | // ====================================================== 31 | // Definitions 32 | // ====================================================== 33 | 34 | // ====================================================== 35 | // Variables 36 | // ====================================================== 37 | 38 | ParseType TdGenTypeParse[] = 39 | { 40 | { TDGEN_TYPE_PERFECT, "TDGEN_TYPE_PERFECT" }, 41 | { TDGEN_TYPE_CONST_DRIFT, "TDGEN_TYPE_CONST_DRIFT" }, 42 | { TDGEN_TYPE_SINE, "TDGEN_TYPE_SINE" }, 43 | { TDGEN_TYPE_LIBPLN, "TDGEN_TYPE_LIBPLN" }, 44 | }; 45 | 46 | // ====================================================== 47 | // Declarations 48 | // ====================================================== 49 | 50 | // ====================================================== 51 | // Definitions 52 | // ====================================================== 53 | 54 | // ------------------------------------------------------ 55 | // TdGen type 56 | // ------------------------------------------------------ 57 | TdGenType_t 58 | cHwClock_ParameterParser::ParseTdGenType(const char *Str) 59 | { 60 | return Parse( TdGenTypeParse, ArrayLen(TdGenTypeParse), Str ); 61 | } 62 | -------------------------------------------------------------------------------- /src/Hardware/PTP_NIC_Ctrl/PTP_Config_Msg/PtpPortConfig.msg: -------------------------------------------------------------------------------- 1 | // ============================================================================ 2 | // 3 | // Copyright 2013-2015 Wolfgang Wallner (wolfgang-wallner AT gmx.at) 4 | // 5 | // This file is part of the LibPTP project. 6 | // 7 | // The LibPTP project is free software: you can redistribute it 8 | // and/or modify it under the terms of the GNU General Public License as 9 | // published by the Free Software Foundation, either version 3 of the License, 10 | // or (at your option) any later version. 11 | // 12 | // The LibPTP project is distributed in the hope that it will be 13 | // useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License.com for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License.com 18 | // along with The LibPTP project. 19 | // If not, see . 20 | // 21 | // ============================================================================ 22 | 23 | // ================================================= 24 | // Make needed C++ stuff available 25 | // ================================================= 26 | 27 | cplusplus {{ 28 | #include 29 | #include "MACAddress.h" 30 | }}; 31 | 32 | // ================================================= 33 | // Class announcements 34 | // ================================================= 35 | 36 | class noncobject simtime_t; 37 | class noncobject MACAddress; 38 | 39 | // ================================================= 40 | // Type definitions 41 | // ================================================= 42 | 43 | enum tPtpNicConf 44 | { 45 | PTP_NIC_CONF_TYPE_MAC = 0; 46 | }; 47 | 48 | enum tPtpPortConf 49 | { 50 | PTP_PORT_CONF_TYPE_PATH_DELAY = 0; 51 | PTP_PORT_CONF_TYPE_ASYMMETRY = 1; 52 | }; 53 | 54 | // ================================================= 55 | // Message definitions 56 | // ================================================= 57 | 58 | message PtpNicConfig 59 | { 60 | int Type @enum(tPtpNicConf); 61 | } 62 | 63 | message PtpNicConfig_MAC extends PtpNicConfig 64 | { 65 | MACAddress MAC; 66 | } 67 | 68 | message PtpPortConfig 69 | { 70 | int Type @enum(tPtpPortConf); 71 | } 72 | 73 | message PtpPortConfig_PathDelay extends PtpPortConfig 74 | { 75 | simtime_t MeanPathDelay; 76 | } 77 | 78 | message PtpPortConfig_Asymmetry extends PtpPortConfig 79 | { 80 | simtime_t Asymmetry; 81 | } 82 | -------------------------------------------------------------------------------- /src/Software/PTP_Stack/AppServices/Announce/AppAnnounce.h: -------------------------------------------------------------------------------- 1 | // ============================================================================ 2 | // 3 | // Copyright 2013-2015 Wolfgang Wallner (wolfgang-wallner AT gmx.at) 4 | // 5 | // This file is part of the LibPTP project. 6 | // 7 | // The LibPTP project is free software: you can redistribute it 8 | // and/or modify it under the terms of the GNU General Public License as 9 | // published by the Free Software Foundation, either version 3 of the License, 10 | // or (at your option) any later version. 11 | // 12 | // The LibPTP project is distributed in the hope that it will be 13 | // useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License.com for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License.com 18 | // along with The LibPTP project. 19 | // If not, see . 20 | // 21 | // ============================================================================ 22 | 23 | #ifndef LIBPTP_APP_ANNOUNCE_H_ 24 | #define LIBPTP_APP_ANNOUNCE_H_ 25 | 26 | // ====================================================== 27 | // Includes 28 | // ====================================================== 29 | 30 | #include "PTP.h" 31 | #include "PortService.h" 32 | 33 | #include "PTPv2_m.h" 34 | 35 | // ====================================================== 36 | // Types 37 | // ====================================================== 38 | 39 | // ====================================================== 40 | // Declarations 41 | // ====================================================== 42 | 43 | class cAppAnnounce : public cPortService 44 | { 45 | private: 46 | 47 | // Signals for statistics 48 | simsignal_t AnnounceRcvd_SigId; 49 | simsignal_t ErbestModuleID_SigId; 50 | 51 | PTPv2_AnnounceFrame *CreateAnnounceFrame(); 52 | 53 | // Init API 54 | void RegisterSignals(); 55 | void InitSignals(); 56 | 57 | protected: 58 | 59 | public: 60 | 61 | // Constructors 62 | cAppAnnounce(); 63 | 64 | // Destructor 65 | 66 | // Setters 67 | 68 | // Getters 69 | 70 | // API functions 71 | void StartListening(); 72 | void StopListening(); 73 | void HandleMsg( PTPv2_Frame *pPtpFrame ); 74 | 75 | void HandleIntervalEvent(); 76 | void HandleTimeoutEvent(); 77 | }; 78 | 79 | #endif 80 | -------------------------------------------------------------------------------- /src/Software/PTP_EthernetMapping/PTP_EthernetMapping.h: -------------------------------------------------------------------------------- 1 | // ============================================================================ 2 | // 3 | // Copyright 2013-2015 Wolfgang Wallner (wolfgang-wallner AT gmx.at) 4 | // 5 | // This file is part of the LibPTP project. 6 | // 7 | // The LibPTP project is free software: you can redistribute it 8 | // and/or modify it under the terms of the GNU General Public License as 9 | // published by the Free Software Foundation, either version 3 of the License, 10 | // or (at your option) any later version. 11 | // 12 | // The LibPTP project is distributed in the hope that it will be 13 | // useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License.com for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License.com 18 | // along with The LibPTP project. 19 | // If not, see . 20 | // 21 | // ============================================================================ 22 | 23 | #ifndef LIBPTP_PTP_ETHERNET_MAPPING_H_ 24 | #define LIBPTP_PTP_ETHERNET_MAPPING_H_ 25 | 26 | // ====================================================== 27 | // Includes 28 | // ====================================================== 29 | 30 | #include 31 | 32 | #include 33 | 34 | #include "ModuleInitBase.h" 35 | 36 | // ====================================================== 37 | // Types 38 | // ====================================================== 39 | 40 | // ====================================================== 41 | // Declarations 42 | // ====================================================== 43 | 44 | class PTP_EthernetMapping : public cModuleInitBase 45 | { 46 | private: 47 | 48 | // Resources 49 | int LowerLayerOutGateID; 50 | int LowerLayerInGateID; 51 | int UpperLayerOutGateID; 52 | int UpperLayerInGateID; 53 | int GateSize; 54 | 55 | const MACAddress PtpMcMAC; 56 | const MACAddress PtpMcPDelayMAC; 57 | 58 | // Config 59 | bool Enable; 60 | 61 | // Init API 62 | void AllocateResources(); 63 | void ParseParameters(); 64 | 65 | protected: 66 | 67 | // OMNeT API 68 | virtual void handleMessage(cMessage *msg); 69 | 70 | public: 71 | 72 | // Constructor 73 | PTP_EthernetMapping(); 74 | 75 | // Setters 76 | void SetMACAddress( MACAddress MAC ); 77 | }; 78 | 79 | #endif 80 | -------------------------------------------------------------------------------- /src/Software/PTP_Stack/DataTypes/PTP_TLV.h: -------------------------------------------------------------------------------- 1 | // ============================================================================ 2 | // 3 | // Copyright 2013-2015 Wolfgang Wallner (wolfgang-wallner AT gmx.at) 4 | // 5 | // This file is part of the LibPTP project. 6 | // 7 | // The LibPTP project is free software: you can redistribute it 8 | // and/or modify it under the terms of the GNU General Public License as 9 | // published by the Free Software Foundation, either version 3 of the License, 10 | // or (at your option) any later version. 11 | // 12 | // The LibPTP project is distributed in the hope that it will be 13 | // useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License.com for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License.com 18 | // along with The LibPTP project. 19 | // If not, see . 20 | // 21 | // ============================================================================ 22 | 23 | #ifndef LIBPTP_PTP_TLV_H_ 24 | #define LIBPTP_PTP_TLV_H_ 25 | 26 | // ====================================================== 27 | // Includes 28 | // ====================================================== 29 | 30 | #include "PTP_PrimitiveDataTypes.h" 31 | 32 | #include 33 | 34 | // ====================================================== 35 | // Types 36 | // ====================================================== 37 | 38 | // ====================================================== 39 | // Declarations 40 | // ====================================================== 41 | 42 | // Type Length Value, see clause 5.3.8 in IEEE 1588-2008 43 | class cTLV 44 | { 45 | private: 46 | struct TLV_t 47 | { 48 | Enumeration16 tlvType; // 49 | UInteger16 lengthField; // Length of lengthField 50 | Octet *pValueField; // Size defined by lengthField 51 | }; 52 | 53 | TLV_Type_t tlvType; 54 | std::vector Value; 55 | 56 | protected: 57 | 58 | public: 59 | 60 | // Constructors 61 | cTLV(); 62 | cTLV( TLV_Type_t tlvType, 63 | UInteger16 lengthField, 64 | Octet *pValueField); 65 | 66 | // Setters/Getters 67 | // TODO 68 | 69 | // Operators 70 | bool operator== (const cTLV& other); 71 | cTLV& operator= (const cTLV& other); 72 | }; 73 | 74 | #endif 75 | -------------------------------------------------------------------------------- /src/Software/SimTimeFilter/MovingAvg/MovingAvgSimTimeFilter.h: -------------------------------------------------------------------------------- 1 | // ============================================================================ 2 | // 3 | // Copyright 2013-2015 Wolfgang Wallner (wolfgang-wallner AT gmx.at) 4 | // 5 | // This file is part of the LibPTP project. 6 | // 7 | // The LibPTP project is free software: you can redistribute it 8 | // and/or modify it under the terms of the GNU General Public License as 9 | // published by the Free Software Foundation, either version 3 of the License, 10 | // or (at your option) any later version. 11 | // 12 | // The LibPTP project is distributed in the hope that it will be 13 | // useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License.com for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License.com 18 | // along with The LibPTP project. 19 | // If not, see . 20 | // 21 | // ============================================================================ 22 | 23 | #ifndef LIBPTP_MOVING_AVG_SIMTIME_FILTER_H_ 24 | #define LIBPTP_MOVING_AVG_SIMTIME_FILTER_H_ 25 | 26 | // ====================================================== 27 | // Includes 28 | // ====================================================== 29 | 30 | #include 31 | 32 | // ====================================================== 33 | // Types 34 | // ====================================================== 35 | 36 | class cSimTimeCircBuf; 37 | 38 | // ====================================================== 39 | // Declarations 40 | // ====================================================== 41 | 42 | class MovingAvgSimTimeFilter : public ISimTimeFilter 43 | { 44 | private: 45 | 46 | // Configuration 47 | bool DiscardMinMax; 48 | 49 | // Resources 50 | cSimTimeCircBuf *pBuf; 51 | 52 | protected: 53 | 54 | public: 55 | 56 | // Constructors/Destructor 57 | MovingAvgSimTimeFilter( size_t size, bool DiscardMinMax ); 58 | MovingAvgSimTimeFilter( const MovingAvgSimTimeFilter& other ); 59 | ~MovingAvgSimTimeFilter(); 60 | 61 | MovingAvgSimTimeFilter* Clone() const; 62 | 63 | // Setters 64 | 65 | // Getters 66 | 67 | // API Functions 68 | virtual void reset(); 69 | virtual void push( simtime_t v ); 70 | virtual simtime_t pop(); 71 | 72 | // Operators 73 | MovingAvgSimTimeFilter& operator= (const MovingAvgSimTimeFilter& other); 74 | }; 75 | 76 | #endif 77 | -------------------------------------------------------------------------------- /src/Software/PTP_Stack/DataTypes/PTP_PTPText.h: -------------------------------------------------------------------------------- 1 | // ============================================================================ 2 | // 3 | // Copyright 2013-2015 Wolfgang Wallner (wolfgang-wallner AT gmx.at) 4 | // 5 | // This file is part of the LibPTP project. 6 | // 7 | // The LibPTP project is free software: you can redistribute it 8 | // and/or modify it under the terms of the GNU General Public License as 9 | // published by the Free Software Foundation, either version 3 of the License, 10 | // or (at your option) any later version. 11 | // 12 | // The LibPTP project is distributed in the hope that it will be 13 | // useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License.com for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License.com 18 | // along with The LibPTP project. 19 | // If not, see . 20 | // 21 | // ============================================================================ 22 | 23 | #ifndef LIBPTP_PTP_PTPTEXT_H_ 24 | #define LIBPTP_PTP_PTPTEXT_H_ 25 | 26 | // ====================================================== 27 | // Includes 28 | // ====================================================== 29 | 30 | #include "PTP_PrimitiveDataTypes.h" 31 | 32 | #include 33 | 34 | // ====================================================== 35 | // Types 36 | // ====================================================== 37 | 38 | // ====================================================== 39 | // Declarations 40 | // ====================================================== 41 | 42 | // PTP text, see clause 5.3.9 in IEEE 1588-2008 43 | class cPTPText 44 | { 45 | private: 46 | 47 | // Types 48 | struct PTPText_t 49 | { 50 | UInteger8 lengthField; // Length of pTextField 51 | Octet *pTextField; // Size defined by lengthField 52 | }; 53 | 54 | // Resources 55 | std::string s; 56 | 57 | protected: 58 | 59 | public: 60 | 61 | // Constructors 62 | cPTPText(); 63 | cPTPText( const char *Str ); 64 | ~cPTPText(); 65 | 66 | // Setters/Getters 67 | UInteger8 GetLengthField(); 68 | 69 | // Operators 70 | bool operator== (const cPTPText& other); 71 | cPTPText &operator= (const cPTPText& other); 72 | cPTPText &operator= (const char *Str); 73 | 74 | // Debug functions 75 | }; 76 | 77 | 78 | #endif 79 | -------------------------------------------------------------------------------- /src/Hardware/HwClock/LocalTimeStamp/LocalTimeStamp.h: -------------------------------------------------------------------------------- 1 | // ============================================================================ 2 | // 3 | // Copyright 2013-2015 Wolfgang Wallner (wolfgang-wallner AT gmx.at) 4 | // 5 | // This file is part of the LibPTP project. 6 | // 7 | // The LibPTP project is free software: you can redistribute it 8 | // and/or modify it under the terms of the GNU General Public License as 9 | // published by the Free Software Foundation, either version 3 of the License, 10 | // or (at your option) any later version. 11 | // 12 | // The LibPTP project is distributed in the hope that it will be 13 | // useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License.com for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License.com 18 | // along with The LibPTP project. 19 | // If not, see . 20 | // 21 | // ============================================================================ 22 | 23 | #ifndef LIBPTP_LOCAL_TIMESTAMP_H_ 24 | #define LIBPTP_LOCAL_TIMESTAMP_H_ 25 | 26 | // ====================================================== 27 | // Includes 28 | // ====================================================== 29 | 30 | #include 31 | 32 | // ====================================================== 33 | // Types 34 | // ====================================================== 35 | 36 | // ====================================================== 37 | // Declarations 38 | // ====================================================== 39 | 40 | class cLocalTimeStamp 41 | { 42 | private: 43 | 44 | // Resources 45 | uint64_t EpochID; 46 | simtime_t Time; 47 | 48 | public: 49 | 50 | // Constructor 51 | cLocalTimeStamp(); 52 | cLocalTimeStamp(uint64_t EpochID, simtime_t Time); 53 | cLocalTimeStamp( const cLocalTimeStamp &other ); 54 | ~cLocalTimeStamp(); 55 | 56 | // Getters 57 | uint64_t GetEpochID() const; 58 | simtime_t GetTime() const; 59 | 60 | // Setters 61 | 62 | // Operators 63 | bool operator== (const cLocalTimeStamp& other) const; 64 | cLocalTimeStamp& operator=( const cLocalTimeStamp& other ); 65 | simtime_t operator-( const cLocalTimeStamp& other ); 66 | }; 67 | 68 | // ------------------------------------------------------ 69 | // Stream operators 70 | // ------------------------------------------------------ 71 | std::ostream& operator<<(std::ostream& os, const cLocalTimeStamp& o ); 72 | 73 | #endif 74 | -------------------------------------------------------------------------------- /src/Software/PTP_Stack/DataTypes/DataSets/PTP_ForeignClockMsg.h: -------------------------------------------------------------------------------- 1 | // ============================================================================ 2 | // 3 | // Copyright 2013-2015 Wolfgang Wallner (wolfgang-wallner AT gmx.at) 4 | // 5 | // This file is part of the LibPTP project. 6 | // 7 | // The LibPTP project is free software: you can redistribute it 8 | // and/or modify it under the terms of the GNU General Public License as 9 | // published by the Free Software Foundation, either version 3 of the License, 10 | // or (at your option) any later version. 11 | // 12 | // The LibPTP project is distributed in the hope that it will be 13 | // useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License.com for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License.com 18 | // along with The LibPTP project. 19 | // If not, see . 20 | // 21 | // ============================================================================ 22 | 23 | #ifndef LIBPTP_PTP_FOREIGN_CLOCK_MSG_H_ 24 | #define LIBPTP_PTP_FOREIGN_CLOCK_MSG_H_ 25 | 26 | // ====================================================== 27 | // Includes 28 | // ====================================================== 29 | 30 | #include "PTP_ForeignClockDS.h" 31 | 32 | // ====================================================== 33 | // Types 34 | // ====================================================== 35 | 36 | // ====================================================== 37 | // Declarations 38 | // ====================================================== 39 | 40 | class cForeignClockMsg 41 | { 42 | private: 43 | 44 | cForeignClockDS foreignClockDS; 45 | simtime_t RxTime; 46 | 47 | public: 48 | 49 | // Constructors/Destructor 50 | cForeignClockMsg(); 51 | cForeignClockMsg( cForeignClockDS ForeignClockDS, simtime_t RxTime ); 52 | cForeignClockMsg(const cForeignClockMsg& other); 53 | ~cForeignClockMsg(); 54 | 55 | // Instance methods 56 | cForeignClockDS &ForeignClockDS(); 57 | 58 | // Setters 59 | void SetRxTime( simtime_t RxTime ); 60 | 61 | // Getters 62 | simtime_t GetRxTime(); 63 | cForeignClockDS GetForeignClockDS(); 64 | 65 | // Operators 66 | bool operator<(const cForeignClockMsg& rhs) const; 67 | bool operator>(const cForeignClockMsg& rhs) const; 68 | 69 | cForeignClockMsg& operator= (const cForeignClockMsg& other); 70 | }; 71 | 72 | #endif 73 | 74 | -------------------------------------------------------------------------------- /src/Hardware/DualDelayer/DualDelayer.ned: -------------------------------------------------------------------------------- 1 | // ============================================================================ 2 | // 3 | // Copyright 2013-2015 Wolfgang Wallner (wolfgang-wallner AT gmx.at) 4 | // 5 | // This file is part of the LibPTP project. 6 | // 7 | // The LibPTP project is free software: you can redistribute it 8 | // and/or modify it under the terms of the GNU General Public License as 9 | // published by the Free Software Foundation, either version 3 of the License, 10 | // or (at your option) any later version. 11 | // 12 | // The LibPTP project is distributed in the hope that it will be 13 | // useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License.com for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License.com 18 | // along with The LibPTP project. 19 | // If not, see . 20 | // 21 | // ============================================================================ 22 | 23 | package libptp.Hardware.DualDelayer; 24 | 25 | import libptp.Hardware.DualDelayer.DelayQueue.*; 26 | 27 | module DualDelayer like IDualDelayer 28 | { 29 | parameters: 30 | 31 | @display("i=PTP/Components/Delayer/Delayer"); 32 | 33 | volatile double UpDelay @unit(s) = default(0s); 34 | volatile double DownDelay @unit(s) = default(0s); 35 | 36 | bool EnableUpDelay = default(false); 37 | bool EnableDownDelay = default(false); 38 | 39 | gates: 40 | 41 | input upperLayerIn; 42 | output upperLayerOut; 43 | input lowerLayerIn; 44 | output lowerLayerOut; 45 | 46 | submodules: 47 | 48 | UpDelayer: DelayQueue if EnableUpDelay == true { 49 | parameters: 50 | Delay = UpDelay; 51 | @display("p=62,30"); 52 | } 53 | 54 | DownDelayer: DelayQueue if EnableDownDelay == true { 55 | parameters: 56 | Delay = DownDelay; 57 | @display("p=62,76"); 58 | } 59 | 60 | connections: 61 | 62 | if EnableDownDelay == true { 63 | upperLayerIn --> DownDelayer.in; 64 | DownDelayer.out --> lowerLayerOut; 65 | } 66 | if EnableDownDelay == false { 67 | upperLayerIn --> lowerLayerOut; 68 | } 69 | 70 | if EnableUpDelay == true { 71 | lowerLayerIn --> UpDelayer.in; 72 | UpDelayer.out --> upperLayerOut; 73 | } 74 | if EnableUpDelay == false { 75 | lowerLayerIn --> upperLayerOut; 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /src/Hardware/PTP_RelayUnit/PTP_MACRelayUnit.h: -------------------------------------------------------------------------------- 1 | // ============================================================================ 2 | // 3 | // Copyright 2013-2015 Wolfgang Wallner (wolfgang-wallner AT gmx.at) 4 | // 5 | // This file is part of the LibPTP project. 6 | // 7 | // The LibPTP project is free software: you can redistribute it 8 | // and/or modify it under the terms of the GNU General Public License as 9 | // published by the Free Software Foundation, either version 3 of the License, 10 | // or (at your option) any later version. 11 | // 12 | // The LibPTP project is distributed in the hope that it will be 13 | // useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License.com for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License.com 18 | // along with The LibPTP project. 19 | // If not, see . 20 | // 21 | // ============================================================================ 22 | 23 | #ifndef LIBPTP_PTP_MAC_RELAY_UNIT_H_ 24 | #define LIBPTP_PTP_MAC_RELAY_UNIT_H_ 25 | 26 | // ====================================================== 27 | // Includes 28 | // ====================================================== 29 | 30 | #include "MACRelayUnitBase.h" 31 | 32 | #include "PTP.h" 33 | #include "IInitBase.h" 34 | 35 | // ====================================================== 36 | // Types 37 | // ====================================================== 38 | 39 | // ====================================================== 40 | // Declarations 41 | // ====================================================== 42 | 43 | 44 | class PTP_MACRelayUnit : public MACRelayUnitBase, public IInitBase 45 | { 46 | private: 47 | 48 | // Configuration 49 | bool PTP_Enable; 50 | PTP_ClockType_t PTP_ClockType; 51 | MACAddress MAC; 52 | 53 | // Init API 54 | void ParseParameters(); 55 | 56 | protected: 57 | 58 | // Configuration 59 | int internalPort; 60 | 61 | // Internal functions 62 | virtual void handleAndDispatchFrame_Dispatch(EtherFrame *frame, int inputport); 63 | 64 | virtual void broadcastFrame(EtherFrame *frame, int inputport); 65 | 66 | public: 67 | 68 | // Constructor 69 | PTP_MACRelayUnit(); 70 | 71 | // OMNeT API 72 | int numInitStages() const; 73 | void initialize(int stage); 74 | 75 | // Setters 76 | void SetMACAddress( MACAddress MAC ); 77 | }; 78 | 79 | #endif 80 | 81 | --------------------------------------------------------------------------------