gPTP Documentation
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
avbts_port.hpp
Go to the documentation of this file.
1 /******************************************************************************
2 
3  Copyright (c) 2009-2012, Intel Corporation
4  All rights reserved.
5 
6  Redistribution and use in source and binary forms, with or without
7  modification, are permitted provided that the following conditions are met:
8 
9  1. Redistributions of source code must retain the above copyright notice,
10  this list of conditions and the following disclaimer.
11 
12  2. Redistributions in binary form must reproduce the above copyright
13  notice, this list of conditions and the following disclaimer in the
14  documentation and/or other materials provided with the distribution.
15 
16  3. Neither the name of the Intel Corporation nor the names of its
17  contributors may be used to endorse or promote products derived from
18  this software without specific prior written permission.
19 
20  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
24  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30  POSSIBILITY OF SUCH DAMAGE.
31 
32 ******************************************************************************/
33 
34 #ifndef AVBTS_PORT_HPP
35 #define AVBTS_PORT_HPP
36 
37 #include <ieee1588.hpp>
38 #include <avbts_message.hpp>
39 
40 #include <avbts_ostimer.hpp>
41 #include <avbts_oslock.hpp>
42 #include <avbts_osnet.hpp>
43 #include <avbts_osthread.hpp>
44 #include <avbts_oscondition.hpp>
45 #include <ipcdef.hpp>
46 
47 #include <stdint.h>
48 
49 #include <map>
50 #include <list>
51 
54 #define GPTP_MULTICAST 0x0180C200000EULL
55 #define PDELAY_MULTICAST GPTP_MULTICAST
56 #define OTHER_MULTICAST GPTP_MULTICAST
58 #define PDELAY_RESP_RECEIPT_TIMEOUT_MULTIPLIER 3
59 #define SYNC_RECEIPT_TIMEOUT_MULTIPLIER 3
60 #define ANNOUNCE_RECEIPT_TIMEOUT_MULTIPLIER 3
66 typedef enum {
67  V1,
68  V2_E2E,
69  V2_P2P
70 } PortType;
71 
76 class PortIdentity {
77 private:
78  ClockIdentity clock_id;
79  uint16_t portNumber;
80 public:
84  PortIdentity() { };
85 
91  PortIdentity(uint8_t * clock_id, uint16_t * portNumber) {
92  this->portNumber = *portNumber;
93  this->portNumber = PLAT_ntohs(this->portNumber);
94  this->clock_id.set(clock_id);
95  }
96 
102  bool operator!=(const PortIdentity & cmp) const {
103  return
104  !(this->clock_id == cmp.clock_id) ||
105  this->portNumber != cmp.portNumber ? true : false;
106  }
107 
113  bool operator==(const PortIdentity & cmp)const {
114  return
115  this->clock_id == cmp.clock_id &&
116  this->portNumber == cmp.portNumber ? true : false;
117  }
118 
124  bool operator<(const PortIdentity & cmp)const {
125  return
126  this->clock_id < cmp.clock_id ?
127  true : this->clock_id == cmp.clock_id &&
128  this->portNumber < cmp.portNumber ? true : false;
129  }
130 
136  bool operator>(const PortIdentity & cmp)const {
137  return
138  this->clock_id > cmp.clock_id ?
139  true : this->clock_id == cmp.clock_id &&
140  this->portNumber > cmp.portNumber ? true : false;
141  }
142 
148  void getClockIdentityString(uint8_t *id) {
149  clock_id.getIdentityString(id);
150  }
151 
158  this->clock_id = clock_id;
159  }
160 
166  return this->clock_id;
167  }
168 
174  void getPortNumberNO(uint16_t * id) { // Network byte order
175  uint16_t portNumberNO = PLAT_htons(portNumber);
176  *id = portNumberNO;
177  }
178 
185  void getPortNumber(uint16_t * id) { // Host byte order
186  *id = portNumber;
187  }
188 
194  void setPortNumber(uint16_t * id) {
195  portNumber = *id;
196  }
197 };
198 
202 typedef std::map < PortIdentity, LinkLayerAddress > IdentityMap_t;
203 
208  static LinkLayerAddress other_multicast;
209  static LinkLayerAddress pdelay_multicast;
210 
211  PortIdentity port_identity;
212  /* directly connected node */
213  PortIdentity peer_identity;
214 
215  OSNetworkInterface *net_iface;
216  LinkLayerAddress local_addr;
217 
218  /* Port Status */
219  unsigned sync_count; // 0 for master, ++ for each sync receive as slave
220  // set to 0 when asCapable is false, increment for each pdelay recvd
221  unsigned pdelay_count;
222 
223  /* Port Configuration */
224  unsigned char delay_mechanism;
225  PortState port_state;
226  char log_mean_unicast_sync_interval;
227  char log_mean_sync_interval;
228  char log_mean_announce_interval;
229  char log_min_mean_delay_req_interval;
230  char log_min_mean_pdelay_req_interval;
231  bool burst_enabled;
232  int _accelerated_sync_count;
233  /* Signed value allows this to be negative result because of inaccurate
234  timestamp */
235  int64_t one_way_delay;
236  /* Implementation Specific data/methods */
237  IEEE1588Clock *clock;
238 
239  bool _syntonize;
240 
241  bool asCapable;
242 
243  int32_t *rate_offset_array;
244  uint32_t rate_offset_array_size;
245  uint32_t rate_offset_count;
246  uint32_t rate_offset_index;
247 
248  FrequencyRatio _peer_rate_offset;
249  Timestamp _peer_offset_ts_theirs;
250  Timestamp _peer_offset_ts_mine;
251  bool _peer_offset_init;
252 
253  int32_t _initial_clock_offset;
254  int32_t _current_clock_offset;
255 
256  PTPMessageAnnounce *qualified_announce;
257 
258  uint16_t announce_sequence_id;
259  uint16_t sync_sequence_id;
260 
261  uint16_t pdelay_sequence_id;
262  PTPMessagePathDelayReq *last_pdelay_req;
263  PTPMessagePathDelayResp *last_pdelay_resp;
264  PTPMessagePathDelayRespFollowUp *last_pdelay_resp_fwup;
265 
266  /* Network socket description
267  physical interface number that object represents */
268  uint16_t ifindex;
269 
270  IdentityMap_t identity_map;
271 
272  PTPMessageSync *last_sync;
273 
274  OSThread *listening_thread;
275 
276  OSCondition *port_ready_condition;
277 
278  OSLock *pdelay_rx_lock;
279  OSLock *port_tx_lock;
280 
281  OSThreadFactory *thread_factory;
282  OSTimerFactory *timer_factory;
283 
284  HWTimestamper *_hw_timestamper;
285 
286  net_result port_send
287  (uint8_t * buf, int size, MulticastType mcast_type,
288  PortIdentity * destIdentity, bool timestamp);
289 
290  InterfaceLabel *net_label;
291 
292  OSLockFactory *lock_factory;
293  OSConditionFactory *condition_factory;
294 
295  bool pdelay_started;
296  public:
297  bool forceSlave;
298 
313  bool serializeState( void *buf, long *count );
314 
327  bool restoreSerializedState( void *buf, long *count );
328 
334  void becomeMaster( bool annc );
335 
341  void becomeSlave( bool restart_syntonization );
342 
347  void startPDelay();
348 
353  void startAnnounce();
354 
359  void syncDone() {
360  if( !pdelay_started ) {
361  startPDelay();
362  }
363  }
364 
370  return timer_factory;
371  }
372 
378  void setAsCapable(bool ascap) {
379  if (ascap != asCapable) {
380  fprintf(stderr, "AsCapable: %s\n",
381  ascap == true ? "Enabled" : "Disabled");
382  }
383  if(!ascap){
384  _peer_offset_init = false;
385  }
386  asCapable = ascap;
387  }
388 
393  bool getAsCapable() { return( asCapable ); }
394 
398  ~IEEE1588Port();
399 
415  (IEEE1588Clock * clock, uint16_t index,
416  bool forceSlave, int accelerated_sync_count,
417  HWTimestamper * timestamper,
418  int32_t offset, InterfaceLabel * net_label,
419  OSConditionFactory * condition_factory,
420  OSThreadFactory * thread_factory,
421  OSTimerFactory * timer_factory,
422  OSLockFactory * lock_factory);
423 
429  bool init_port();
430 
435  void recoverPort(void);
436 
441  void *openPort(void);
442 
447  unsigned getPayloadOffset();
448 
457  void sendEventPort
458  (uint8_t * buf, int len, MulticastType mcast_type,
459  PortIdentity * destIdentity);
460 
469  void sendGeneralPort
470  (uint8_t * buf, int len, MulticastType mcast_type,
471  PortIdentity * destIdentity);
472 
478  void processEvent(Event e);
479 
485 
493 
501 
507  void removeForeignMasterAll(void);
508 
509 
516  if( qualified_announce != NULL ) delete qualified_announce;
517  qualified_announce = msg;
518  }
519 
524  char getSyncInterval(void) {
525  return log_mean_sync_interval;
526  }
527 
532  char getAnnounceInterval(void) {
533  return log_mean_announce_interval;
534  }
535 
540  char getPDelayInterval(void) {
541  return log_min_mean_pdelay_req_interval;
542  }
543 
549  return port_state;
550  }
551 
557  void setPortState( PortState state ) {
558  port_state = state;
559  }
560 
566  void getPortIdentity(PortIdentity & identity) {
567  identity = this->port_identity;
568  }
569 
574  bool burstEnabled(void) {
575  return burst_enabled;
576  }
577 
582  uint16_t getNextAnnounceSequenceId(void) {
583  return announce_sequence_id++;
584  }
585 
590  uint16_t getNextSyncSequenceId(void) {
591  return sync_sequence_id++;
592  }
593 
598  uint16_t getNextPDelaySequenceId(void) {
599  return pdelay_sequence_id++;
600  }
601 
607  uint16_t getParentLastSyncSequenceNumber(void);
608 
615  void setParentLastSyncSequenceNumber(uint16_t num);
616 
621  IEEE1588Clock *getClock(void);
622 
629  last_sync = msg;
630  }
631 
637  return last_sync;
638  }
639 
645  return pdelay_rx_lock->lock() == oslock_ok ? true : false;
646  }
647 
653  return pdelay_rx_lock->trylock() == oslock_ok ? true : false;
654  }
655 
661  return pdelay_rx_lock->unlock() == oslock_ok ? true : false;
662  }
663 
668  bool getTxLock() {
669  return port_tx_lock->lock() == oslock_ok ? true : false;
670  }
671 
676  bool putTxLock() {
677  return port_tx_lock->unlock() == oslock_ok ? true : false;
678  }
679 
685  return _hw_timestamper->getVersion();
686  }
687 
694  last_pdelay_req = msg;
695  }
696 
702  return last_pdelay_req;
703  }
704 
711  last_pdelay_resp = msg;
712  }
713 
719  return last_pdelay_resp;
720  }
721 
728  last_pdelay_resp_fwup = msg;
729  }
730 
736  return last_pdelay_resp_fwup;
737  }
738 
744  return _peer_rate_offset;
745  }
746 
753  _peer_rate_offset = offset;
754  }
755 
762  void setPeerOffset(Timestamp mine, Timestamp theirs) {
763  _peer_offset_ts_mine = mine;
764  _peer_offset_ts_theirs = theirs;
765  _peer_offset_init = true;
766  }
767 
774  bool getPeerOffset(Timestamp & mine, Timestamp & theirs) {
775  mine = _peer_offset_ts_mine;
776  theirs = _peer_offset_ts_theirs;
777  return _peer_offset_init;
778  }
779 
785  bool _adjustClockRate( FrequencyRatio freq_offset ) {
786  if( _hw_timestamper ) {
787  return _hw_timestamper->HWTimestamper_adjclockrate((float) freq_offset );
788  }
789  return false;
790  }
791 
797  bool adjustClockRate( FrequencyRatio freq_offset ) {
798  return _adjustClockRate( freq_offset );
799  }
800 
806  void getExtendedError(char *msg) {
807  if (_hw_timestamper) {
808  _hw_timestamper->HWTimestamper_get_extderror(msg);
809  } else {
810  *msg = '\0';
811  }
812  }
813 
823  int getRxTimestamp
824  (PortIdentity * sourcePortIdentity, uint16_t sequenceId,
825  Timestamp & timestamp, unsigned &counter_value, bool last);
826 
836  int getTxTimestamp
837  (PortIdentity * sourcePortIdentity, uint16_t sequenceId,
838  Timestamp & timestamp, unsigned &counter_value, bool last);
839 
848  int getTxTimestamp
849  (PTPMessageCommon * msg, Timestamp & timestamp, unsigned &counter_value,
850  bool last);
851 
860  int getRxTimestamp
861  (PTPMessageCommon * msg, Timestamp & timestamp, unsigned &counter_value,
862  bool last);
863 
877  void getDeviceTime
878  (Timestamp & system_time, Timestamp & device_time, uint32_t & local_clock,
879  uint32_t & nominal_clock_rate);
880 
885  uint64_t getLinkDelay(void) {
886  return one_way_delay > 0LL ? one_way_delay : 0LL;
887  }
888 
896  void setLinkDelay(int64_t delay) {
897  one_way_delay = delay;
898  }
899 
906  void recommendState(PortState state, bool changed_external_master);
907 
914  void mapSocketAddr
915  (PortIdentity * destIdentity, LinkLayerAddress * remote);
916 
923  void addSockAddrMap
924  (PortIdentity * destIdentity, LinkLayerAddress * remote);
925 
930  void incPdelayCount() {
931  ++pdelay_count;
932  }
933 
939  unsigned getPdelayCount() {
940  return pdelay_count;
941  }
942 
947  void incSyncCount() {
948  ++sync_count;
949  }
950 
956  unsigned getSyncCount() {
957  return sync_count;
958  }
959 };
960 
961 #endif
962 
void addSockAddrMap(PortIdentity *destIdentity, LinkLayerAddress *remote)
Adds New sock addr map.
void mapSocketAddr(PortIdentity *destIdentity, LinkLayerAddress *remote)
Maps socket addr to the remote link layer address.
void setLastPDelayRespFollowUp(PTPMessagePathDelayRespFollowUp *msg)
Sets the last PTPMessagePathDelayRespFollowUp message.
Definition: avbts_port.hpp:727
Definition: avbts_message.hpp:542
Definition: ieee1588.hpp:101
void sendGeneralPort(uint8_t *buf, int len, MulticastType mcast_type, PortIdentity *destIdentity)
Sends a general message to a port. No timestamps.
Definition: ieee1588.hpp:445
Definition: avbts_message.hpp:434
uint16_t getNextPDelaySequenceId(void)
Increments PDelay sequence ID and returns.
Definition: avbts_port.hpp:598
bool putPDelayRxLock()
Unlocks PDelay RX.
Definition: avbts_port.hpp:660
PortIdentity(uint8_t *clock_id, uint16_t *portNumber)
Constructs PortIdentity interface.
Definition: avbts_port.hpp:91
void setLastPDelayReq(PTPMessagePathDelayReq *msg)
Sets the last_pdelay_req message.
Definition: avbts_port.hpp:693
Definition: avbts_ostimer.hpp:62
void setPeerRateOffset(FrequencyRatio offset)
Sets the peer rate offset. Used to calculate neighbor rate ratio.
Definition: avbts_port.hpp:752
bool _adjustClockRate(FrequencyRatio freq_offset)
Adjusts the clock frequency.
Definition: avbts_port.hpp:785
unsigned getPayloadOffset()
Get the payload offset inside a packet.
bool operator>(const PortIdentity &cmp) const
Implements the operator '>' overloading method. Compares clock_id and portNumber.
Definition: avbts_port.hpp:136
unsigned getSyncCount()
Gets current sync count value. It is set to zero when master and incremented at each sync received fo...
Definition: avbts_port.hpp:956
void removeForeignMasterAll(void)
Remove all foreign masters.
void getPortNumber(uint16_t *id)
Gets the port number in the host byte order, which can be either Big-Endian or Little-Endian, depending on the processor where it is running.
Definition: avbts_port.hpp:185
Definition: avbts_message.hpp:839
bool operator!=(const PortIdentity &cmp) const
Implements the operator '!=' overloading method. Compares clock_id and portNumber.
Definition: avbts_port.hpp:102
PTPMessageAnnounce * calculateERBest(void)
Gets the "best" announce.
int getVersion()
Gets the HWTimestamper version.
Definition: ieee1588.hpp:572
void * openPort(void)
Receives messages from the network interface.
void incSyncCount()
Increments sync count.
Definition: avbts_port.hpp:947
bool restoreSerializedState(void *buf, long *count)
Restores the serialized state from the buffer. Copies the information from buffer to the variables (i...
uint16_t PLAT_ntohs(uint16_t s)
Converts the unsigned short integer netshort from network byte order to host byte order...
PTPMessagePathDelayReq * getLastPDelayReq(void)
Gets the last PTPMessagePathDelayReq message.
Definition: avbts_port.hpp:701
void setParentLastSyncSequenceNumber(uint16_t num)
Sets last sync sequence number from parent.
virtual void HWTimestamper_get_extderror(char *msg)
Gets a string with the error from the hardware timestamp block.
Definition: ieee1588.hpp:552
Definition: avbts_port.hpp:76
void getDeviceTime(Timestamp &system_time, Timestamp &device_time, uint32_t &local_clock, uint32_t &nominal_clock_rate)
Get the cross timestamping information. The gPTP subsystem uses these samples to calculate ratios whi...
PortIdentity()
Definition: avbts_port.hpp:84
void recoverPort(void)
Currently doesnt do anything. Just returns.
bool putTxLock()
Unlocks the port TX.
Definition: avbts_port.hpp:676
void getClockIdentityString(uint8_t *id)
Gets the ClockIdentity string.
Definition: avbts_port.hpp:148
void setPortNumber(uint16_t *id)
Sets the Port number.
Definition: avbts_port.hpp:194
Definition: avbts_clock.hpp:77
Definition: avbts_oscondition.hpp:106
void setPortState(PortState state)
Sets the PortState.
Definition: avbts_port.hpp:557
IEEE1588Port(IEEE1588Clock *clock, uint16_t index, bool forceSlave, int accelerated_sync_count, HWTimestamper *timestamper, int32_t offset, InterfaceLabel *net_label, OSConditionFactory *condition_factory, OSThreadFactory *thread_factory, OSTimerFactory *timer_factory, OSLockFactory *lock_factory)
Creates the IEEE1588Port interface.
uint16_t getNextAnnounceSequenceId(void)
Increments announce sequence id and returns.
Definition: avbts_port.hpp:582
Definition: ieee1588.hpp:111
void setLastPDelayResp(PTPMessagePathDelayResp *msg)
Sets the last PTPMessagePathDelayResp message.
Definition: avbts_port.hpp:710
void syncDone()
Starts pDelay event timer if not yet started.
Definition: avbts_port.hpp:359
Event
Definition: ieee1588.hpp:74
void becomeMaster(bool annc)
Switches port to a gPTP master.
virtual bool HWTimestamper_adjclockrate(float frequency_offset)
Adjusts the hardware clock frequency.
Definition: ieee1588.hpp:471
uint16_t getNextSyncSequenceId(void)
Increments sync sequence ID and returns.
Definition: avbts_port.hpp:590
bool operator==(const PortIdentity &cmp) const
Implements the operator '==' overloading method. Compares clock_id and portNumber.
Definition: avbts_port.hpp:113
void setAsCapable(bool ascap)
Sets asCapable flag.
Definition: avbts_port.hpp:378
IEEE1588Clock * getClock(void)
Gets a pointer to IEEE1588Clock.
MulticastType
Definition: avbts_message.hpp:157
Definition: avbts_message.hpp:770
unsigned getPdelayCount()
Gets current pdelay count value. It is set to zero when asCapable is false.
Definition: avbts_port.hpp:939
void processEvent(Event e)
Process all events for a IEEE1588Port.
PortState
Definition: ptptypes.hpp:48
PTPMessageSync * getLastSync(void)
Gets last sync message.
Definition: avbts_port.hpp:636
Definition: avbts_message.hpp:167
PTPMessagePathDelayRespFollowUp * getLastPDelayRespFollowUp(void)
Gets the last PTPMessagePathDelayRespFollowUp message.
Definition: avbts_port.hpp:735
PortState getPortState(void)
Gets the portState information.
Definition: avbts_port.hpp:548
bool operator<(const PortIdentity &cmp) const
Implements the operator '<' overloading method. Compares clock_id and portNumber.
Definition: avbts_port.hpp:124
char getSyncInterval(void)
Gets the sync interval value.
Definition: avbts_port.hpp:524
void getPortIdentity(PortIdentity &identity)
Gets port identity.
Definition: avbts_port.hpp:566
Definition: avbts_osnet.hpp:52
void addQualifiedAnnounce(PTPMessageAnnounce *msg)
Adds a new qualified announce the port. IEEE 802.1AS Clause 10.3.10.2.
Definition: avbts_port.hpp:515
bool getPDelayRxLock()
Locks PDelay RX.
Definition: avbts_port.hpp:644
PortType
Definition: avbts_port.hpp:66
void incPdelayCount()
Increments Pdelay count.
Definition: avbts_port.hpp:930
bool forceSlave
Forces port to be slave. Added for testing.
Definition: avbts_port.hpp:297
bool getTxLock()
Locks the TX port.
Definition: avbts_port.hpp:668
void removeForeignMaster(PTPMessageAnnounce *msg)
Remove a foreign master.
void addForeignMaster(PTPMessageAnnounce *msg)
Adds a foreign master.
Definition: avbts_oscondition.hpp:42
std::string getIdentityString()
Gets the identity string from the ClockIdentity object.
void startPDelay()
Starts pDelay event timer.
bool getAsCapable()
Gets the asCapable flag.
Definition: avbts_port.hpp:393
virtual OSLockResult trylock()=0
Tries locking a critical section.
int getTimestampVersion()
Gets the hardware timestamper version.
Definition: avbts_port.hpp:684
Definition: avbts_osnet.hpp:277
virtual OSLockResult unlock()=0
Unlocks a critical section.
bool burstEnabled(void)
Gets the burst_enabled flag.
Definition: avbts_port.hpp:574
Definition: avbts_port.hpp:207
bool init_port()
Initializes the port. Creates network interface, initializes hardware timestamper and create OS locks...
void getPortNumberNO(uint16_t *id)
Gets the port number following the network byte order, i.e. Big-Endian.
Definition: avbts_port.hpp:174
bool adjustClockRate(FrequencyRatio freq_offset)
Adjusts the clock frequency.
Definition: avbts_port.hpp:797
void startAnnounce()
Starts announce event timer.
FrequencyRatio getPeerRateOffset(void)
Gets the Peer rate offset. Used to calculate neighbor rate ratio.
Definition: avbts_port.hpp:743
bool getPeerOffset(Timestamp &mine, Timestamp &theirs)
Gets peer offset timestamps.
Definition: avbts_port.hpp:774
char getAnnounceInterval(void)
Gets the announce interval.
Definition: avbts_port.hpp:532
uint16_t getParentLastSyncSequenceNumber(void)
Gets last sync sequence number from parent.
std::map< PortIdentity, LinkLayerAddress > IdentityMap_t
Definition: avbts_port.hpp:202
void setClockIdentity(ClockIdentity clock_id)
Sets the ClockIdentity.
Definition: avbts_port.hpp:157
void setPeerOffset(Timestamp mine, Timestamp theirs)
Sets peer offset timestamps.
Definition: avbts_port.hpp:762
uint64_t getLinkDelay(void)
Gets the link delay information.
Definition: avbts_port.hpp:885
Definition: avbts_oslock.hpp:98
char getPDelayInterval(void)
Gets the pDelay minimum interval.
Definition: avbts_port.hpp:540
Definition: avbts_osthread.hpp:54
net_result
Definition: avbts_osnet.hpp:272
ClockIdentity getClockIdentity(void)
Gets the clockIdentity value.
Definition: avbts_port.hpp:165
OSTimerFactory * getTimerFactory()
Gets a pointer to timer_factory object.
Definition: avbts_port.hpp:369
Definition: avbts_oslock.hpp:57
bool serializeState(void *buf, long *count)
Serializes (i.e. copy over buf pointer) the information from the variables (in that order): ...
void recommendState(PortState state, bool changed_external_master)
Changes the port state.
Definition: avbts_message.hpp:721
long double FrequencyRatio
Definition: ptptypes.hpp:39
void becomeSlave(bool restart_syntonization)
Switches port to a gPTP slave.
int getTxTimestamp(PortIdentity *sourcePortIdentity, uint16_t sequenceId, Timestamp &timestamp, unsigned &counter_value, bool last)
Gets TX timestamp based on port identity.
void setLinkDelay(int64_t delay)
Sets link delay information. Signed value allows this to be negative result because of inaccurate tim...
Definition: avbts_port.hpp:896
uint16_t PLAT_htons(uint16_t s)
Converts the unsigned short integer hostshort from host byte order to network byte order...
bool tryPDelayRxLock()
Do a trylock on the PDelay RX.
Definition: avbts_port.hpp:652
virtual OSLockResult lock()=0
Locks a critical section.
void sendEventPort(uint8_t *buf, int len, MulticastType mcast_type, PortIdentity *destIdentity)
Sends and event to a IEEE1588 port. It includes timestamp.
Definition: avbts_osthread.hpp:78
void getExtendedError(char *msg)
Gets extended error message from hardware timestamper.
Definition: avbts_port.hpp:806
Definition: ieee1588.hpp:222
int getRxTimestamp(PortIdentity *sourcePortIdentity, uint16_t sequenceId, Timestamp &timestamp, unsigned &counter_value, bool last)
Gets RX timestamp based on port identity.
void setLastSync(PTPMessageSync *msg)
Sets last sync ptp message.
Definition: avbts_port.hpp:628
PTPMessagePathDelayResp * getLastPDelayResp(void)
Gets the last PTPMessagePathDelayResp message.
Definition: avbts_port.hpp:718