Skip to content

Commit 687f7bc

Browse files
author
Folkert
committed
definitions for linux hardware timestamping
1 parent bac1442 commit 687f7bc

File tree

2 files changed

+74
-0
lines changed

2 files changed

+74
-0
lines changed

libc-test/semver/linux.txt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -818,6 +818,26 @@ GLOB_NOSPACE
818818
GRND_NONBLOCK
819819
GRND_RANDOM
820820
GRND_INSECURE
821+
HWTSTAMP_TX_OFF
822+
HWTSTAMP_TX_ON
823+
HWTSTAMP_TX_ONESTEP_SYNC
824+
HWTSTAMP_TX_ONESTEP_P2P
825+
HWTSTAMP_FILTER_NONE
826+
HWTSTAMP_FILTER_ALL
827+
HWTSTAMP_FILTER_SOME
828+
HWTSTAMP_FILTER_PTP_V1_L4_EVENT
829+
HWTSTAMP_FILTER_PTP_V1_L4_SYNC
830+
HWTSTAMP_FILTER_PTP_V1_L4_DELAY_REQ
831+
HWTSTAMP_FILTER_PTP_V2_L4_EVENT
832+
HWTSTAMP_FILTER_PTP_V2_L4_SYNC
833+
HWTSTAMP_FILTER_PTP_V2_L4_DELAY_REQ
834+
HWTSTAMP_FILTER_PTP_V2_L2_EVENT
835+
HWTSTAMP_FILTER_PTP_V2_L2_SYNC
836+
HWTSTAMP_FILTER_PTP_V2_L2_DELAY_REQ
837+
HWTSTAMP_FILTER_PTP_V2_EVENT
838+
HWTSTAMP_FILTER_PTP_V2_SYNC
839+
HWTSTAMP_FILTER_PTP_V2_DELAY_REQ
840+
HWTSTAMP_FILTER_NTP_ALL
821841
IBSHIFT
822842
IFA_ADDRESS
823843
IFA_ANYCAST
@@ -3115,6 +3135,7 @@ getspnam_r
31153135
gettid
31163136
getxattr
31173137
hasmntopt
3138+
hwtstamp_config
31183139
iconv
31193140
iconv_close
31203141
iconv_open

src/unix/linux_like/linux/mod.rs

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -798,6 +798,12 @@ s_no_extra_traits! {
798798
#[cfg(not(libc_union))]
799799
pub ifr_ifru: ::sockaddr,
800800
}
801+
802+
pub struct hwtstamp_config {
803+
pub flags: ::c_int,
804+
pub tx_type: ::c_int,
805+
pub rx_filter: ::c_int,
806+
}
801807
}
802808

803809
s_no_extra_traits! {
@@ -1221,6 +1227,31 @@ cfg_if! {
12211227
.finish()
12221228
}
12231229
}
1230+
1231+
impl ::fmt::Debug for hwtstamp_config {
1232+
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
1233+
f.debug_struct("hwtstamp_config")
1234+
.field("flags", &self.flags)
1235+
.field("tx_type", &self.tx_type)
1236+
.field("rx_filter", &self.rx_filter)
1237+
.finish()
1238+
}
1239+
}
1240+
impl PartialEq for hwtstamp_config {
1241+
fn eq(&self, other: &hwtstamp_config) -> bool {
1242+
self.flags == other.flags &&
1243+
self.tx_type == other.tx_type &&
1244+
self.rx_filter == other.rx_filter
1245+
}
1246+
}
1247+
impl Eq for hwtstamp_config {}
1248+
impl ::hash::Hash for hwtstamp_config {
1249+
fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
1250+
self.flags.hash(state);
1251+
self.tx_type.hash(state);
1252+
self.rx_filter.hash(state);
1253+
}
1254+
}
12241255
}
12251256
}
12261257

@@ -3121,6 +3152,28 @@ pub const SOF_TIMESTAMPING_OPT_TX_SWHW: ::c_uint = 1 << 14;
31213152
pub const SOF_TXTIME_DEADLINE_MODE: u32 = 1 << 0;
31223153
pub const SOF_TXTIME_REPORT_ERRORS: u32 = 1 << 1;
31233154

3155+
pub const HWTSTAMP_TX_OFF: ::c_uint = 0;
3156+
pub const HWTSTAMP_TX_ON: ::c_uint = 1;
3157+
pub const HWTSTAMP_TX_ONESTEP_SYNC: ::c_uint = 2;
3158+
pub const HWTSTAMP_TX_ONESTEP_P2P: ::c_uint = 3;
3159+
3160+
pub const HWTSTAMP_FILTER_NONE: ::c_uint = 0;
3161+
pub const HWTSTAMP_FILTER_ALL: ::c_uint = 1;
3162+
pub const HWTSTAMP_FILTER_SOME: ::c_uint = 2;
3163+
pub const HWTSTAMP_FILTER_PTP_V1_L4_EVENT: ::c_uint = 3;
3164+
pub const HWTSTAMP_FILTER_PTP_V1_L4_SYNC: ::c_uint = 4;
3165+
pub const HWTSTAMP_FILTER_PTP_V1_L4_DELAY_REQ: ::c_uint = 5;
3166+
pub const HWTSTAMP_FILTER_PTP_V2_L4_EVENT: ::c_uint = 6;
3167+
pub const HWTSTAMP_FILTER_PTP_V2_L4_SYNC: ::c_uint = 7;
3168+
pub const HWTSTAMP_FILTER_PTP_V2_L4_DELAY_REQ: ::c_uint = 8;
3169+
pub const HWTSTAMP_FILTER_PTP_V2_L2_EVENT: ::c_uint = 9;
3170+
pub const HWTSTAMP_FILTER_PTP_V2_L2_SYNC: ::c_uint = 10;
3171+
pub const HWTSTAMP_FILTER_PTP_V2_L2_DELAY_REQ: ::c_uint = 11;
3172+
pub const HWTSTAMP_FILTER_PTP_V2_EVENT: ::c_uint = 12;
3173+
pub const HWTSTAMP_FILTER_PTP_V2_SYNC: ::c_uint = 13;
3174+
pub const HWTSTAMP_FILTER_PTP_V2_DELAY_REQ: ::c_uint = 14;
3175+
pub const HWTSTAMP_FILTER_NTP_ALL: ::c_uint = 15;
3176+
31243177
// linux/if_alg.h
31253178
pub const ALG_SET_KEY: ::c_int = 1;
31263179
pub const ALG_SET_IV: ::c_int = 2;

0 commit comments

Comments
 (0)