pt1588-SH7216 1
IEEE1588v2 Implementation for Renesas SH7216 Demo

C:/Users/mzimmer/IEEE1588/pt1588/branches/pt1588-SH7216/pt1588/platform/ptp-clock.c File Reference

Define the platform-dependent interface with the real time clock that is required for the correct operation of PTP. More...

#include "../ptp-protocol.h"
#include "DP83640.h"

Go to the source code of this file.

Functions

void getClock (Timestamp *timestamp)
 Attempt to provide an accurate clock timestamp.
void stepClockTimeInterval (const TimeInterval *timeInterval)
 Step the clock by -timeInterval.
void rateAdjustClock (Integer32 rateAdj)
 Adjust the rate of the clock by rateAdj (in units of 100ps/sec).
void toTimeInterval (const Timestamp *t1, const Timestamp *t2, TimeInterval *timeInterval)
 Compute: timeInterval = t2 - t1.
void addTimeIntervalToTimestamp (const TimeInterval *timeInterval, Timestamp *timestamp)
 Compute: timeInterval = timeInterval + timestamp.
void addFutureEvent (const Event *event)
 Result in PTPActor() being fired with this event at the time event.eventTimestamp.

Detailed Description

Define the platform-dependent interface with the real time clock that is required for the correct operation of PTP.

Author:
Michael Zimmer (mzimmer@eecs.berkeley.edu)
Version:
Id:
ptp-clock.c 51 2011-04-12 01:19:19Z mzimmer

Definition in file ptp-clock.c.


Function Documentation

void addFutureEvent ( const Event event)

Result in PTPActor() being fired with this event at the time event.eventTimestamp.

Fire PTPActor() with Event event at the time of event's timestamp.

This is implementation specific because it is the responsibily of the program utilizing the PTP protocol to fire the PTPActor() at the correct time.

Definition at line 194 of file ptp-clock.c.

void addTimeIntervalToTimestamp ( const TimeInterval timeInterval,
Timestamp timestamp 
)

Compute: timeInterval = timeInterval + timestamp.

Add the TimeInterval timeInterval to the Timestamp timestamp.

This function may be implementation specific depending on how Integer64 values are handled in computations.

Definition at line 156 of file ptp-clock.c.

void getClock ( Timestamp timestamp)

Attempt to provide an accurate clock timestamp.

Update the provided Timestamp timestamp with the current clock timestamp.

In this implementation, the clock timestamp is retrieved by reading the timestamp from the registers on the DP83640 via a serial interface.

Definition at line 38 of file ptp-clock.c.

void rateAdjustClock ( Integer32  rateAdj)

Adjust the rate of the clock by rateAdj (in units of 100ps/sec).

Adjust the rate of the clock by rateAdj.

In this implementation, this is done by correctly setting registers in the DP83640 via a serial interface. Positive is higher frequency.

Definition at line 107 of file ptp-clock.c.

void stepClockTimeInterval ( const TimeInterval timeInterval)

Step the clock by -timeInterval.

Step the clock by the negated value of the provided TimeInterval timeInterval.

In this implementation, this is done by setting registers on the DP83640 via a serial interface. Note: The timeInterval supplied is an offset (slave time - master time) so actual adjustment is the opposite sign of the offset. The timestamps of events in the event queue are also fixed to account for clock step.

Definition at line 65 of file ptp-clock.c.

void toTimeInterval ( const Timestamp t1,
const Timestamp t2,
TimeInterval timeInterval 
)

Compute: timeInterval = t2 - t1.

Convert the difference between two Timestamp, t2 - t1, to a TimeInterval timeInterval.

This function may be implementation specific depending on how Integer64 values are handled in computations.

Definition at line 138 of file ptp-clock.c.

 All Data Structures Files Functions Variables Typedefs Enumerator Defines