aienux
Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately.
Brought by drakestapleton
aienux / vendor / libc / src / new / netbsd / sys / timex.rs
| 1 | //! Header: `sys/timex.h` |
| 2 | //! |
| 3 | //! <https://github.com/NetBSD/src/tree/trunk/sys/sys/timex.h> |
| 4 | |
| 5 | use crate::prelude::*; |
| 6 | |
| 7 | pub const MAXPHASE: c_long = 500000000; |
| 8 | pub const MAXFREQ: c_long = 500000; |
| 9 | pub const MINSEC: c_int = 256; |
| 10 | pub const MAXSEC: c_int = 2048; |
| 11 | pub const NANOSECOND: c_long = 1000000000; |
| 12 | pub const SCALE_PPM: c_int = 65; |
| 13 | pub const MAXTC: c_int = 10; |
| 14 | |
| 15 | pub const MOD_OFFSET: c_uint = 0x0001; |
| 16 | pub const MOD_FREQUENCY: c_uint = 0x0002; |
| 17 | pub const MOD_MAXERROR: c_uint = 0x0004; |
| 18 | pub const MOD_ESTERROR: c_uint = 0x0008; |
| 19 | pub const MOD_STATUS: c_uint = 0x0010; |
| 20 | pub const MOD_TIMECONST: c_uint = 0x0020; |
| 21 | pub const MOD_PPSMAX: c_uint = 0x0040; |
| 22 | pub const MOD_TAI: c_uint = 0x0080; |
| 23 | pub const MOD_MICRO: c_uint = 0x1000; |
| 24 | pub const MOD_NANO: c_uint = 0x2000; |
| 25 | pub const MOD_CLKB: c_uint = 0x4000; |
| 26 | pub const MOD_CLKA: c_uint = 0x8000; |
| 27 | |
| 28 | pub const STA_PLL: c_int = 0x0001; |
| 29 | pub const STA_PPSFREQ: c_int = 0x0002; |
| 30 | pub const STA_PPSTIME: c_int = 0x0004; |
| 31 | pub const STA_FLL: c_int = 0x0008; |
| 32 | pub const STA_INS: c_int = 0x0010; |
| 33 | pub const STA_DEL: c_int = 0x0020; |
| 34 | pub const STA_UNSYNC: c_int = 0x0040; |
| 35 | pub const STA_FREQHOLD: c_int = 0x0080; |
| 36 | pub const STA_PPSSIGNAL: c_int = 0x0100; |
| 37 | pub const STA_PPSJITTER: c_int = 0x0200; |
| 38 | pub const STA_PPSWANDER: c_int = 0x0400; |
| 39 | pub const STA_PPSERROR: c_int = 0x0800; |
| 40 | pub const STA_CLOCKERR: c_int = 0x1000; |
| 41 | pub const STA_NANO: c_int = 0x2000; |
| 42 | pub const STA_MODE: c_int = 0x4000; |
| 43 | pub const STA_CLK: c_int = 0x8000; |
| 44 | |
| 45 | pub const STA_RONLY: c_int = STA_PPSSIGNAL |
| 46 | | STA_PPSJITTER |
| 47 | | STA_PPSWANDER |
| 48 | | STA_PPSERROR |
| 49 | | STA_CLOCKERR |
| 50 | | STA_NANO |
| 51 | | STA_MODE |
| 52 | | STA_CLK; |
| 53 | |
| 54 | pub const TIME_OK: c_int = 0; |
| 55 | pub const TIME_INS: c_int = 1; |
| 56 | pub const TIME_DEL: c_int = 2; |
| 57 | pub const TIME_OOP: c_int = 3; |
| 58 | pub const TIME_WAIT: c_int = 4; |
| 59 | pub const TIME_ERROR: c_int = 5; |
| 60 | |
| 61 | s! { |
| 62 | pub struct ntptimeval { |
| 63 | pub time: crate::timespec, |
| 64 | pub maxerror: c_long, |
| 65 | pub esterror: c_long, |
| 66 | pub tai: c_long, |
| 67 | pub time_state: c_int, |
| 68 | } |
| 69 | |
| 70 | pub struct timex { |
| 71 | pub modes: c_uint, |
| 72 | pub offset: c_long, |
| 73 | pub freq: c_long, |
| 74 | pub maxerror: c_long, |
| 75 | pub esterror: c_long, |
| 76 | pub status: c_int, |
| 77 | pub constant: c_long, |
| 78 | pub precision: c_long, |
| 79 | pub tolerance: c_long, |
| 80 | pub ppsfreq: c_long, |
| 81 | pub jitter: c_long, |
| 82 | pub shift: c_int, |
| 83 | pub stabil: c_long, |
| 84 | pub jitcnt: c_long, |
| 85 | pub calcnt: c_long, |
| 86 | pub errcnt: c_long, |
| 87 | pub stbcnt: c_long, |
| 88 | } |
| 89 | } |
| 90 | |
| 91 | extern "C" { |
| 92 | #[link_name = "__ntp_gettime50"] |
| 93 | pub fn ntp_gettime(buf: *mut ntptimeval) -> c_int; |
| 94 | pub fn ntp_adjtime(buf: *mut timex) -> c_int; |
| 95 | } |