pt1588-SH7216 1
IEEE1588v2 Implementation for Renesas SH7216 Demo

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

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

Go to the source code of this file.

Functions

void getClock (Timestamp *timestamp)
 Update the provided Timestamp timestamp with the current clock timestamp.
void stepClockTimeInterval (const TimeInterval *timeInterval)
 Step the clock by the negated value of the provided TimeInterval timeInterval.
void rateAdjustClock (Integer32 rateAdj)
 Adjust the rate of the clock by rateAdj.
void toTimeInterval (const Timestamp *t1, const Timestamp *t2, TimeInterval *timeInterval)
 Convert the difference between two Timestamp, t2 - t1, to a TimeInterval timeInterval.
void addTimeIntervalToTimestamp (const TimeInterval *timeInterval, Timestamp *timestamp)
 Add the TimeInterval timeInterval to the Timestamp timestamp.
void addFutureEvent (const Event *event)
 Fire PTPActor() with Event event at the time of event's timestamp.

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.h 51 2011-04-12 01:19:19Z mzimmer

Definition in file ptp-clock.h.


Function Documentation

void addFutureEvent ( const Event event)

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

Parameters:
[in]eventThe future event.

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 
)

Add the TimeInterval timeInterval to the Timestamp timestamp.

Parameters:
[in]timeIntervalThe TimeInterval being added.
[in,out]timestampThe Timestamp being added to.

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)

Update the provided Timestamp timestamp with the current clock timestamp.

Parameters:
[in,out]timestampThe destination of timestamp from clock read.

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.

Parameters:
[in]rateAdjThe amount to adjust the rate of the clock 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 the negated value of the provided TimeInterval timeInterval.

Parameters:
[in]timeIntervalThe time interval that is negated to step the clock.

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 
)

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

Parameters:
[in]t1Base Timestamp.
[in]t2Timestamp being subtracted.
[out]timeIntervalThe TimeInterval difference.

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