/**************************************************************************** ** File name : HTIEEE1588V2.h ** Description : IEEE1588 v2 Ptp timer protoclo api ** Create date : 2019.09.01 ** Auther by : Liuyx ** Version info : V1.0.01 ** Copyright (C) 2002-2019 xi'an huatek, Inc Co., Ltd ** Update record: ** DATE AUTHER DESC ** ------------------------------------------------------------------------- ** 2019.09.01 Liuyx first build ****************************************************************************/ #ifndef __HT_IEEE1588_V2_H #define __HT_IEEE1588_V2_H #include "HTGlobal.h" /* ether_header */ //#include #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ typedef struct ptp_header { uint8_t ptp_ts : 4, /*transportSpecific*/ ptp_type : 4; /*messageType*/ uint8_t ptp_v; /*versionPTP (4 bits in size)*/ uint16_t ptp_ml; /*messageLength*/ uint8_t ptp_dn; /*domainNumber*/ uint8_t ptp_res; /*reserved*/ uint16_t ptp_flags; /*flags*/ uint64_t ptp_cf; /*correctionField*/ uint32_t ptp_res2; /*reserved*/ uint8_t ptp_src[10]; /*sourcePortIdentity,8 byte mac,2 byte portId*/ uint16_t ptp_sid; /*sequenceId*/ uint8_t ptp_ctlf; /*controlField*/ uint8_t ptp_lmi; /*logMessageInterval*/ } ST_PTP_HEADER; // __attribute__((__packed__)); typedef struct pkt_ptp { //struct ether_header eh; ST_PTP_HEADER ph; uint64_t s : 48; uint32_t ns; } ST_PKT_PTPS; // __attribute__((__packed__)); enum ptp_msg_type { SYNC = 0x0, DELAY_REQ = 0x1, FOLLOW_UP = 0x8, DELAY_RESP = 0x9, }; #ifdef __cplusplus } #endif #endif /* end __HT_IEEE1588_V2_H */