SZSPTP ez430-RF2480 1.0

ZigBee Sensor Network with synchronized time and time-stamped measurements.
ptp_datasets.h
Go to the documentation of this file.
1 /*
2  * ptp_datasets.h
3  *
4  * Date: 19/06/2014
5  * Author: Fernando Biazi Nascimento
6  * Copyright © 2014 Fernando Biazi Nascimento. All rights reserved.
7  *
8  * License of use and copy on file license.txt
9  *
10  */
11 
21 #ifndef PTP_DATASETS_H
22 #define PTP_DATASETS_H
23 
24 /*
25  * ======== Includes ========
26  */
27 
28 #include "ptp_cfg.h"
29 #include "ptp_types.h"
30 
31 /*
32  * ======== Doxygen ========
33  */
46 /*
47  * ======== Constants ========
48  */
49 
50 /*
51  * ======== Macros ========
52  */
53 
54 /*
55  * ======== Types ========
56  */
57 
58 #if (PTP_CLOCK_TYPE == PTP_CLOCK_TYPE_BOUNDARY) || (PTP_CLOCK_TYPE == PTP_CLOCK_TYPE_ORDINARY)
59 //
60 // Ordinary and boundary clock data sets
61 //
62 
63 // PTP_defaultDS
69 typedef struct PTP_defaultDS {
70  // static
71  ptp_boolean twoStepFlag :1;
72  ptp_clockIdentity *clockIdentity;
73  ptp_uinteger16 numberPorts;
74  // dynamic
75  PTP_ClockQuality clockQuality;
76  // configurable
77  ptp_uinteger8 priority1;
78  ptp_uinteger8 priority2;
79  ptp_uinteger8 domainNumber;
80  ptp_boolean slaveOnly :1;
82 
88 typedef struct PTP_currentDS {
89  // dynamic
90  ptp_uinteger16 stepsRemoved;
91  PTP_TimeInterval offsetFromMaster;
92  PTP_TimeInterval meanPathDelay;
94 
100 typedef struct PTP_parentDS {
101  // dynamic
102  PTP_ParentPortIdentityP parentPortIdentity;
103  ptp_boolean parentStats :1;
104  ptp_uinteger16 observedParentOffsetScaledLogVariance;
105  ptp_integer32 observedParentClockPhaseChangeRate;
106  ptp_clockIdentity *grandMasterIdentity;
107  PTP_ClockQuality grandMasterclockQuality;
108  ptp_uinteger8 grandMasterPriority1;
109  ptp_uinteger8 grandMasterPriority2;
110 } PTP_parentDS;
111 
117 typedef struct PTP_timePropertiesDS {
118  // - ptpTimescale must be initialized first
119  // dynamic
120  ptp_integer16 currentUtcOffset;
121  ptp_boolean currentUtcOffsetValid;
122  ptp_boolean leap59 :1;
123  ptp_boolean leap61 :1;
124  ptp_boolean timeTraceable :1;
125  ptp_boolean frequencyTraceable :1;
126  ptp_boolean ptpTimescale :1;
127  ptp_timeSource timeSource :8;
129 
135 typedef struct PTP_portDS {
136  // static
137 // PTP_PortIdentityP portIdentity; // read values from other locations
138  // dynamic
139  ptp_portState portState :8;
140  ptp_uinteger8 logMinDelayReqInterval;
141  PTP_TimeInterval peerMeanPathDelay;
142  // configurable
143  ptp_integer8 logAnnounceInterval;
144  ptp_uinteger8 announceReceiptTimeout;
145  ptp_integer8 logSyncInterval;
146  ptp_delayMechanism delayMechanism :8;
147  ptp_integer8 logMinPdelayReqInterval;
148  ptp_uinteger4 versionNumber :4; // must use 4 bits on communication packets.
149 } PTP_portDS;
150 
151 #elif PTP_CLOCK_TYPE == PTP_CLOCK_TYPE_TRANSPARENT
152 
153 //
154 // Transparent clock data sets
155 //
156 
162 typedef struct PTP_transparentClockDefaultDS {
163  // static
164  ptp_clockIdentity *clockIdentity;
165  ptp_uinteger16 numberPorts;
166  // configurable
167  ptp_delayMechanism delayMechanism;
168  ptp_uinteger8 primaryDomain;
169 }PTP_transparentClockDefaultDS;
170 
171 // PTP_transparentClockPortDS - per port
177 typedef struct PTP_transparentClockPortDS {
178  // static
179 // PTP_PortIdentityP portIdentity; // read values from other locations
180  // dynamic
181  ptp_integer8 logMinPdelayReqInterval;
182  ptp_boolean faultyFlag:1;
183  PTP_TimeInterval peerMeanPathDelay;
184 }PTP_transparentClockPortDS;
185 
186 #endif
187 
188 //
189 // BMC data sets
190 //
191 
197 typedef struct PTP_foreignMasterDS {
198 // PTP_PortIdentity foreignMasterPortIdentity; // - the port is registered at the network unit, save some memory here
199  ptp_clockIdentity clockIdentity;
200  ptp_uinteger8 foreignMasterAnnounceMessages;
202 
208 typedef struct PTP_announceDS {
209  ptp_uinteger8 grandMasterPriority1;
210  ptp_clockIdentity grandMasterIdentity;
211  PTP_ClockQuality grandMasterClockQuality;
212  ptp_uinteger8 grandMasterPriority2;
213  ptp_uinteger16 stepsRemoved;
214  ptp_uinteger16 currentUtcOffset;
215  ptp_boolean currentUtcOffsetValid :1;
216  ptp_boolean leap59 :1;
217  ptp_boolean leap61 :1;
218  ptp_boolean timeTraceable :1;
219  ptp_boolean frequencyTraceable :1;
220  ptp_boolean ptpTimescale :1;
221  ptp_timeSource timeSource :8;
223 
229 typedef struct PTP_P2PPDelayReqDS {
230  ptp_uinteger8 localPortNumber;
231  PTP_TimeStamp t2;
232  ptp_uinteger16 sequenceId;
233  ptp_clockIdentity clockIdentity;
234  ptp_uinteger8 domain;
235  ptp_uinteger64 correctionField;
237 
238 /*
239  * ======== Global Variables ========
240  */
241 
242 /*
243  * ======== Global Functions ========
244  */
245 
250 #endif /* PTP_DATASETS_H */
unsigned char ptp_boolean
Definition: ptp_types.h:68
struct PTP_P2PPDelayReqDS PTP_P2PPDelayReqDS
unsigned char ptp_uinteger4
Definition: ptp_types.h:80
unsigned long long ptp_uinteger64
Definition: ptp_types.h:125
struct PTP_parentDS PTP_parentDS
ptp_timeSource
Definition: ptp_types.h:244
signed char ptp_integer8
Definition: ptp_types.h:85
struct PTP_currentDS PTP_currentDS
ptp_portState
Definition: ptp_types.h:260
ptp_octet ptp_clockIdentity[8]
Definition: ptp_types.h:322
unsigned char ptp_uinteger8
Definition: ptp_types.h:90
struct PTP_announceDS PTP_announceDS
struct PTP_portDS PTP_portDS
short ptp_integer16
Definition: ptp_types.h:95
long ptp_integer32
Definition: ptp_types.h:105
struct PTP_defaultDS PTP_defaultDS
PTP data types specifications.
PTP configuration values to compile.
struct PTP_timePropertiesDS PTP_timePropertiesDS
struct PTP_foreignMasterDS PTP_foreignMasterDS
unsigned short ptp_uinteger16
Definition: ptp_types.h:100
ptp_delayMechanism
Definition: ptp_types.h:277