summaryrefslogtreecommitdiff
path: root/daemons/gptp/linux/src/linux_hal_common.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'daemons/gptp/linux/src/linux_hal_common.hpp')
-rw-r--r--daemons/gptp/linux/src/linux_hal_common.hpp90
1 files changed, 77 insertions, 13 deletions
diff --git a/daemons/gptp/linux/src/linux_hal_common.hpp b/daemons/gptp/linux/src/linux_hal_common.hpp
index fb77be19..28332f01 100644
--- a/daemons/gptp/linux/src/linux_hal_common.hpp
+++ b/daemons/gptp/linux/src/linux_hal_common.hpp
@@ -44,6 +44,8 @@
#include "avbts_osthread.hpp"
#include "avbts_osipc.hpp"
#include "ieee1588.hpp"
+#include <ether_tstamper.hpp>
+#include <linux/ethtool.h>
#include <list>
@@ -123,7 +125,7 @@ private:
* @brief LinuxTimestamper: Provides a generic hardware
* timestamp interface for linux based systems.
*/
-class LinuxTimestamper : public HWTimestamper {
+class LinuxTimestamper : public EtherTimestamper {
public:
/**
* @brief Destructor
@@ -157,7 +159,7 @@ public:
/**
* @brief Sends a packet to a remote address
* @param addr [in] Remote link layer address
- * @param etherType [in] The EtherType of the message
+ * @param etherType [in] The EtherType of the message in host order
* @param payload [in] Data buffer
* @param length Size of data buffer
* @param timestamp TRUE if to use the event socket with the PTP multicast address. FALSE if to use
@@ -177,7 +179,7 @@ public:
* an error on the transmit side, net_fatal if error on reception
*/
virtual net_result nrecv
- ( LinkLayerAddress *addr, uint8_t *payload, size_t &length, struct phy_delay *delay );
+ ( LinkLayerAddress *addr, uint8_t *payload, size_t &length );
/**
* @brief Disables rx socket descriptor rx queue
@@ -201,9 +203,18 @@ public:
}
/**
+ * @brief Get speed of network link
+ *
+ * @param [in] sd Open socket descriptor
+ * @param [out] speed Link speed in kb/sec
+ * @return false on error
+ */
+ bool getLinkSpeed( int sd, uint32_t *speed );
+
+ /**
* @brief Watch for net link changes.
*/
- virtual void watchNetLink(IEEE1588Port *pPort);
+ virtual void watchNetLink( CommonPort *pPort );
/**
* @brief Gets the payload offset
@@ -292,7 +303,8 @@ public:
* @param type OSLockType enumeration
* @return Pointer to OSLock object
*/
- OSLock * createLock(OSLockType type) {
+ OSLock * createLock( OSLockType type ) const
+ {
LinuxLock *lock = new LinuxLock();
if (lock->initialize(type) != oslock_ok) {
delete lock;
@@ -365,7 +377,8 @@ public:
* @brief Creates LinuxCondition objects
* @return Pointer to the OSCondition object in case of success. NULL otherwise
*/
- OSCondition * createCondition() {
+ OSCondition *createCondition() const
+ {
LinuxCondition *result = new LinuxCondition();
return result->initialize() ? result : NULL;
}
@@ -487,7 +500,8 @@ class LinuxTimerFactory : public OSTimerFactory {
* @brief Creates the linux timer
* @return Pointer to OSTimer object
*/
- virtual OSTimer * createTimer() {
+ virtual OSTimer *createTimer() const
+ {
return new LinuxTimer();
}
};
@@ -551,7 +565,7 @@ class LinuxThreadFactory:public OSThreadFactory {
* @brief Creates a new LinuxThread
* @return Pointer to LinuxThread object
*/
- OSThread * createThread() {
+ OSThread *createThread() const {
return new LinuxThread();
}
};
@@ -570,7 +584,7 @@ public:
*/
virtual bool createInterface
( OSNetworkInterface **net_iface, InterfaceLabel *label,
- HWTimestamper *timestamper );
+ CommonTimestamper *timestamper );
};
/**
@@ -632,6 +646,7 @@ public:
/**
* @brief Updates IPC values
+ *
* @param ml_phoffset Master to local phase offset
* @param ls_phoffset Local to slave phase offset
* @param ml_freqoffset Master to local frequency offset
@@ -641,12 +656,61 @@ public:
* @param pdelay_count Count of pdelays
* @param port_state Port's state
* @param asCapable asCapable flag
+ *
+ * @return TRUE
+ */
+ virtual bool update(
+ int64_t ml_phoffset,
+ int64_t ls_phoffset,
+ FrequencyRatio ml_freqoffset,
+ FrequencyRatio ls_freqoffset,
+ uint64_t local_time,
+ uint32_t sync_count,
+ uint32_t pdelay_count,
+ PortState port_state,
+ bool asCapable );
+
+ /**
+ * @brief Updates grandmaster IPC values
+ *
+ * @param gptp_grandmaster_id Current grandmaster id (all 0's if no grandmaster selected)
+ * @param gptp_domain_number gPTP domain number
+ *
+ * @return TRUE
+ */
+ virtual bool update_grandmaster(
+ uint8_t gptp_grandmaster_id[],
+ uint8_t gptp_domain_number );
+
+ /**
+ * @brief Updates network interface IPC values
+ *
+ * @param clock_identity The clock identity of the interface
+ * @param priority1 The priority1 field of the grandmaster functionality of the interface, or 0xFF if not supported
+ * @param clock_class The clockClass field of the grandmaster functionality of the interface, or 0xFF if not supported
+ * @param offset_scaled_log_variance The offsetScaledLogVariance field of the grandmaster functionality of the interface, or 0x0000 if not supported
+ * @param clock_accuracy The clockAccuracy field of the grandmaster functionality of the interface, or 0xFF if not supported
+ * @param priority2 The priority2 field of the grandmaster functionality of the interface, or 0xFF if not supported
+ * @param domain_number The domainNumber field of the grandmaster functionality of the interface, or 0 if not supported
+ * @param log_sync_interval The currentLogSyncInterval field of the grandmaster functionality of the interface, or 0 if not supported
+ * @param log_announce_interval The currentLogAnnounceInterval field of the grandmaster functionality of the interface, or 0 if not supported
+ * @param log_pdelay_interval The currentLogPDelayReqInterval field of the grandmaster functionality of the interface, or 0 if not supported
+ * @param port_number The portNumber field of the interface, or 0x0000 if not supported
+ *
* @return TRUE
*/
- virtual bool update
- (int64_t ml_phoffset, int64_t ls_phoffset, FrequencyRatio ml_freqoffset,
- FrequencyRatio ls_freqoffset, uint64_t local_time, uint32_t sync_count,
- uint32_t pdelay_count, PortState port_state, bool asCapable );
+ virtual bool update_network_interface(
+ uint8_t clock_identity[],
+ uint8_t priority1,
+ uint8_t clock_class,
+ int16_t offset_scaled_log_variance,
+ uint8_t clock_accuracy,
+ uint8_t priority2,
+ uint8_t domain_number,
+ int8_t log_sync_interval,
+ int8_t log_announce_interval,
+ int8_t log_pdelay_interval,
+ uint16_t port_number );
/**
* @brief unmaps and unlink shared memory