@@ -650,6 +650,57 @@ s! {
650650 pub val: :: c_int,
651651 }
652652
653+ // linux/ptp_clock.h
654+ pub struct ptp_clock_time {
655+ pub sec: :: __s64,
656+ pub nsec: :: __u32,
657+ pub reserved: :: __u32,
658+ }
659+
660+ pub struct ptp_clock_caps {
661+ pub max_adj: :: c_int,
662+ pub n_alarm: :: c_int,
663+ pub n_ext_ts: :: c_int,
664+ pub n_per_out: :: c_int,
665+ pub pps: :: c_int,
666+ pub n_pins: :: c_int,
667+ pub cross_timestamping: :: c_int,
668+ #[ cfg( target_env = "gnu" ) ]
669+ pub adjust_phase: :: c_int,
670+ #[ cfg( target_env = "gnu" ) ]
671+ pub max_phase_adj: :: c_int,
672+ #[ cfg( target_env = "gnu" ) ]
673+ pub rsv: [ :: c_int; 11 ] ,
674+ #[ cfg( any( target_env = "musl" , target_env = "ohos" ) ) ]
675+ pub rsv: [ :: c_int; 13 ] ,
676+ }
677+
678+ pub struct ptp_extts_request {
679+ pub index: :: c_uint,
680+ pub flags: :: c_uint,
681+ pub rsv: [ :: c_uint; 2 ] ,
682+ }
683+
684+ pub struct ptp_sys_offset_extended {
685+ pub n_samples: :: c_uint,
686+ pub rsv: [ :: c_uint; 3 ] ,
687+ pub ts: [ [ ptp_clock_time; 3 ] ; 25 ] ,
688+ }
689+
690+ pub struct ptp_sys_offset_precise {
691+ pub device: ptp_clock_time,
692+ pub sys_realtime: ptp_clock_time,
693+ pub sys_monoraw: ptp_clock_time,
694+ pub rsv: [ :: c_uint; 4 ] ,
695+ }
696+
697+ pub struct ptp_extts_event {
698+ pub t: ptp_clock_time,
699+ index: :: c_uint,
700+ flags: :: c_uint,
701+ rsv: [ :: c_uint; 2 ] ,
702+ }
703+
653704 // linux/sctp.h
654705
655706 pub struct sctp_initmsg {
@@ -889,6 +940,21 @@ s_no_extra_traits! {
889940 pub sched_deadline: :: __u64,
890941 pub sched_period: :: __u64,
891942 }
943+
944+ // linux/ptp_clock.h
945+ pub struct ptp_sys_offset {
946+ pub n_samples: :: c_uint,
947+ pub rsv: [ :: c_uint; 3 ] ,
948+ pub ts: [ ptp_clock_time; 51 ] ,
949+ }
950+
951+ pub struct ptp_pin_desc {
952+ pub name: [ :: c_char; 64 ] ,
953+ pub index: :: c_uint,
954+ pub func: :: c_uint,
955+ pub chan: :: c_uint,
956+ pub rsv: [ :: c_uint; 5 ] ,
957+ }
892958}
893959
894960s_no_extra_traits ! {
@@ -920,6 +986,34 @@ cfg_if! {
920986 }
921987}
922988
989+ cfg_if ! {
990+ if #[ cfg( libc_union) ] {
991+ s_no_extra_traits! {
992+ // linux/ptp_clock.h
993+ #[ allow( missing_debug_implementations) ]
994+ pub union __c_anonymous_ptp_perout_request_1 {
995+ pub start: ptp_clock_time,
996+ pub phase: ptp_clock_time,
997+ }
998+
999+ #[ allow( missing_debug_implementations) ]
1000+ pub union __c_anonymous_ptp_perout_request_2 {
1001+ pub on: ptp_clock_time,
1002+ pub rsv: [ :: c_uint; 4 ] ,
1003+ }
1004+
1005+ #[ allow( missing_debug_implementations) ]
1006+ pub struct ptp_perout_request {
1007+ pub anonymous_1: __c_anonymous_ptp_perout_request_1,
1008+ pub period: ptp_clock_time,
1009+ pub index: :: c_uint,
1010+ pub flags: :: c_uint,
1011+ pub anonymous_2: __c_anonymous_ptp_perout_request_2,
1012+ }
1013+ }
1014+ }
1015+ }
1016+
9231017cfg_if ! {
9241018 if #[ cfg( feature = "extra_traits" ) ] {
9251019 impl PartialEq for sockaddr_nl {
@@ -1394,6 +1488,62 @@ cfg_if! {
13941488 self . sched_period. hash( state) ;
13951489 }
13961490 }
1491+
1492+ impl PartialEq for ptp_sys_offset {
1493+ fn eq( & self , other: & ptp_sys_offset) -> bool {
1494+ self . n_samples == other. n_samples &&
1495+ self . rsv == other. rsv &&
1496+ self . ts. as_slice( ) == other. ts. as_slice( )
1497+ }
1498+ }
1499+ impl Eq for ptp_sys_offset { }
1500+ impl :: fmt:: Debug for ptp_sys_offset {
1501+ fn fmt( & self , f: & mut :: fmt:: Formatter ) -> :: fmt:: Result {
1502+ f. debug_struct( "ptp_sys_offset" )
1503+ . field( "n_samples" , & self . n_samples)
1504+ . field( "rsv" , & self . rsv)
1505+ . field( "ts" , & self . ts)
1506+ . finish( )
1507+ }
1508+ }
1509+ impl :: hash:: Hash for ptp_sys_offset {
1510+ fn hash<H : :: hash:: Hasher >( & self , state: & mut H ) {
1511+ self . n_samples. hash( state) ;
1512+ self . rsv. hash( state) ;
1513+ self . ts. as_slice( ) . hash( state) ;
1514+ }
1515+ }
1516+
1517+ impl PartialEq for ptp_pin_desc {
1518+ fn eq( & self , other: & ptp_pin_desc) -> bool {
1519+ self . name. as_slice( ) == other. name. as_slice( ) &&
1520+ self . index == other. index &&
1521+ self . func == other. func &&
1522+ self . chan == other. chan &&
1523+ self . rsv == other. rsv
1524+ }
1525+ }
1526+ impl Eq for ptp_pin_desc { }
1527+ impl :: fmt:: Debug for ptp_pin_desc {
1528+ fn fmt( & self , f: & mut :: fmt:: Formatter ) -> :: fmt:: Result {
1529+ f. debug_struct( "ptp_pin_desc" )
1530+ . field( "name" , & self . name)
1531+ . field( "index" , & self . index)
1532+ . field( "func" , & self . func)
1533+ . field( "chan" , & self . chan)
1534+ . field( "rsv" , & self . rsv)
1535+ . finish( )
1536+ }
1537+ }
1538+ impl :: hash:: Hash for ptp_pin_desc {
1539+ fn hash<H : :: hash:: Hasher >( & self , state: & mut H ) {
1540+ self . name. hash( state) ;
1541+ self . index. hash( state) ;
1542+ self . func. hash( state) ;
1543+ self . chan. hash( state) ;
1544+ self . rsv. hash( state) ;
1545+ }
1546+ }
13971547 }
13981548}
13991549
@@ -3638,6 +3788,58 @@ pub const HWTSTAMP_FILTER_PTP_V2_SYNC: ::c_uint = 13;
36383788pub const HWTSTAMP_FILTER_PTP_V2_DELAY_REQ : :: c_uint = 14 ;
36393789pub const HWTSTAMP_FILTER_NTP_ALL : :: c_uint = 15 ;
36403790
3791+ // linux/ptp_clock.h
3792+ pub const PTP_MAX_SAMPLES : :: c_uint = 25 ;
3793+
3794+ cfg_if ! {
3795+ if #[ cfg( any( target_arch = "powerpc" , target_arch = "powerpc64" , target_arch = "sparc64" ) ) ] {
3796+ pub const PTP_CLOCK_GETCAPS : :: c_uint = 0x40503d01 ;
3797+ pub const PTP_EXTTS_REQUEST : :: c_uint = 0x80103d02 ;
3798+ pub const PTP_PEROUT_REQUEST : :: c_uint = 0x80383d03 ;
3799+ pub const PTP_ENABLE_PPS : :: c_uint = 0x80043d04 ;
3800+ pub const PTP_SYS_OFFSET : :: c_uint = 0x83403d05 ;
3801+ pub const PTP_PIN_GETFUNC : :: c_uint = 0xc0603d06 ;
3802+ pub const PTP_PIN_SETFUNC : :: c_uint = 0x80603d07 ;
3803+ pub const PTP_SYS_OFFSET_PRECISE : :: c_uint = 0xc0403d08 ;
3804+ pub const PTP_SYS_OFFSET_EXTENDED : :: c_uint = 0xc4c03d09 ;
3805+
3806+ pub const PTP_CLOCK_GETCAPS2 : :: c_uint = 0x40503d0a ;
3807+ pub const PTP_EXTTS_REQUEST2 : :: c_uint = 0x80103d0b ;
3808+ pub const PTP_PEROUT_REQUEST2 : :: c_uint = 0x80383d0c ;
3809+ pub const PTP_ENABLE_PPS2 : :: c_uint = 0x80043d0d ;
3810+ pub const PTP_SYS_OFFSET2 : :: c_uint = 0x83403d0e ;
3811+ pub const PTP_PIN_GETFUNC2 : :: c_uint = 0xc0603d0f ;
3812+ pub const PTP_PIN_SETFUNC2 : :: c_uint = 0x80603d10 ;
3813+ pub const PTP_SYS_OFFSET_PRECISE2 : :: c_uint = 0xc0403d11 ;
3814+ pub const PTP_SYS_OFFSET_EXTENDED2 : :: c_uint = 0xc4c03d12 ;
3815+ } else {
3816+ pub const PTP_CLOCK_GETCAPS : :: c_uint = 0x80503d01 ;
3817+ pub const PTP_EXTTS_REQUEST : :: c_uint = 0x40103d02 ;
3818+ pub const PTP_PEROUT_REQUEST : :: c_uint = 0x40383d03 ;
3819+ pub const PTP_ENABLE_PPS : :: c_uint = 0x40043d04 ;
3820+ pub const PTP_SYS_OFFSET : :: c_uint = 0x43403d05 ;
3821+ pub const PTP_PIN_GETFUNC : :: c_uint = 0xc0603d06 ;
3822+ pub const PTP_PIN_SETFUNC : :: c_uint = 0x40603d07 ;
3823+ pub const PTP_SYS_OFFSET_PRECISE : :: c_uint = 0xc0403d08 ;
3824+ pub const PTP_SYS_OFFSET_EXTENDED : :: c_uint = 0xc4c03d09 ;
3825+
3826+ pub const PTP_CLOCK_GETCAPS2 : :: c_uint = 0x80503d0a ;
3827+ pub const PTP_EXTTS_REQUEST2 : :: c_uint = 0x40103d0b ;
3828+ pub const PTP_PEROUT_REQUEST2 : :: c_uint = 0x40383d0c ;
3829+ pub const PTP_ENABLE_PPS2 : :: c_uint = 0x40043d0d ;
3830+ pub const PTP_SYS_OFFSET2 : :: c_uint = 0x43403d0e ;
3831+ pub const PTP_PIN_GETFUNC2 : :: c_uint = 0xc0603d0f ;
3832+ pub const PTP_PIN_SETFUNC2 : :: c_uint = 0x40603d10 ;
3833+ pub const PTP_SYS_OFFSET_PRECISE2 : :: c_uint = 0xc0403d11 ;
3834+ pub const PTP_SYS_OFFSET_EXTENDED2 : :: c_uint = 0xc4c03d12 ;
3835+ }
3836+ }
3837+
3838+ pub const PTP_PF_NONE : :: c_uint = 0 ;
3839+ pub const PTP_PF_EXTTS : :: c_uint = 1 ;
3840+ pub const PTP_PF_PEROUT : :: c_uint = 2 ;
3841+ pub const PTP_PF_PHYSYNC : :: c_uint = 3 ;
3842+
36413843// linux/tls.h
36423844pub const TLS_TX : :: c_int = 1 ;
36433845pub const TLS_RX : :: c_int = 2 ;
0 commit comments