1 /* 2 * Copyright (c) 2017 Intel Corporation. 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 7 /** 8 * @file 9 * @brief GPTP Media Dependent interface for full duplex and point to point 10 * 11 * This is not to be included by the application. 12 */ 13 14 #ifndef __GPTP_MD_H 15 #define __GPTP_MD_H 16 17 #include <zephyr/net/gptp.h> 18 19 #ifdef __cplusplus 20 extern "C" { 21 #endif 22 23 /** 24 * @brief Media Dependent Sync Information. 25 * 26 * This structure applies for MDSyncReceive as well as MDSyncSend. 27 */ 28 struct gptp_md_sync_info { 29 /* Time of the current grandmaster compared to the previous. */ 30 struct gptp_scaled_ns last_gm_phase_change; 31 32 /** Most recent preciseOriginTimestamp from the PortSyncSync. */ 33 struct net_ptp_time precise_orig_ts; 34 35 /** Most recent followupCorrectionField from the PortSyncSync. */ 36 int64_t follow_up_correction_field; 37 38 /** Most recent upstreamTxTime from the PortSyncSync. */ 39 uint64_t upstream_tx_time; 40 41 /* Frequency of the current grandmaster compared to the previous. */ 42 double last_gm_freq_change; 43 44 /** Most recent rateRatio from the PortSyncSync. */ 45 double rate_ratio; 46 47 /** PortIdentity of this port. */ 48 struct gptp_port_identity src_port_id; 49 50 /* Time Base Indicator of the current Grand Master. */ 51 uint16_t gm_time_base_indicator; 52 53 /** Current Log Sync Interval for this port. */ 54 int8_t log_msg_interval; 55 }; 56 57 /** 58 * @brief Initialize all Media Dependent State Machines. 59 */ 60 void gptp_md_init_state_machine(void); 61 62 /** 63 * @brief Run all Media Dependent State Machines. 64 * 65 * @param port Number of the port the State Machines needs to be run on. 66 */ 67 void gptp_md_state_machines(int port); 68 69 #ifdef __cplusplus 70 } 71 #endif 72 73 #endif /* __GPTP_MD_H */ 74