xref: /drstd/src/std/sys/solid/abi/mod.rs (revision 0fe3ff0054d3aec7fbf9bddecfecb10bc7d23a51)
1 use crate::std::os::raw::c_int;
2 
3 mod fs;
4 pub mod sockets;
5 pub use self::fs::*;
6 
7 // `solid_types.h`
8 pub use super::itron::abi::{ER, ER_ID, E_TMOUT, ID};
9 
10 pub const SOLID_ERR_NOTFOUND: ER = -1000;
11 pub const SOLID_ERR_NOTSUPPORTED: ER = -1001;
12 pub const SOLID_ERR_EBADF: ER = -1002;
13 pub const SOLID_ERR_INVALIDCONTENT: ER = -1003;
14 pub const SOLID_ERR_NOTUSED: ER = -1004;
15 pub const SOLID_ERR_ALREADYUSED: ER = -1005;
16 pub const SOLID_ERR_OUTOFBOUND: ER = -1006;
17 pub const SOLID_ERR_BADSEQUENCE: ER = -1007;
18 pub const SOLID_ERR_UNKNOWNDEVICE: ER = -1008;
19 pub const SOLID_ERR_BUSY: ER = -1009;
20 pub const SOLID_ERR_TIMEOUT: ER = -1010;
21 pub const SOLID_ERR_INVALIDACCESS: ER = -1011;
22 pub const SOLID_ERR_NOTREADY: ER = -1012;
23 
24 // `solid_rtc.h`
25 #[repr(C)]
26 #[derive(Debug, Copy, Clone)]
27 pub struct SOLID_RTC_TIME {
28     pub tm_sec: c_int,
29     pub tm_min: c_int,
30     pub tm_hour: c_int,
31     pub tm_mday: c_int,
32     pub tm_mon: c_int,
33     pub tm_year: c_int,
34     pub tm_wday: c_int,
35 }
36 
37 extern "C" {
38     pub fn SOLID_RTC_ReadTime(time: *mut SOLID_RTC_TIME) -> c_int;
39 }
40 
41 // `solid_log.h`
42 extern "C" {
43     pub fn SOLID_LOG_write(s: *const u8, l: usize);
44 }
45 
46 // `solid_mem.h`
47 extern "C" {
48     pub fn SOLID_TLS_AddDestructor(id: i32, dtor: unsafe extern "C" fn(*mut u8));
49 }
50 
51 // `solid_rng.h`
52 extern "C" {
53     pub fn SOLID_RNG_SampleRandomBytes(buffer: *mut u8, length: usize) -> c_int;
54 }
55 
56 // `rwlock.h`
57 extern "C" {
58     pub fn rwl_loc_rdl(id: ID) -> ER;
59     pub fn rwl_loc_wrl(id: ID) -> ER;
60     pub fn rwl_ploc_rdl(id: ID) -> ER;
61     pub fn rwl_ploc_wrl(id: ID) -> ER;
62     pub fn rwl_unl_rwl(id: ID) -> ER;
63     pub fn rwl_acre_rwl() -> ER_ID;
64     pub fn rwl_del_rwl(id: ID) -> ER;
65 }
66