summaryrefslogtreecommitdiffstats
path: root/library/std/src/sys/solid/abi/mod.rs
blob: 8440d572cfbd3fe5d0e3eb3fd9325aa1d872c7c4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
use crate::os::raw::c_int;

mod fs;
pub mod sockets;
pub use self::fs::*;

// `solid_types.h`
pub use super::itron::abi::{ER, ER_ID, E_TMOUT, ID};

pub const SOLID_ERR_NOTFOUND: ER = -1000;
pub const SOLID_ERR_NOTSUPPORTED: ER = -1001;
pub const SOLID_ERR_EBADF: ER = -1002;
pub const SOLID_ERR_INVALIDCONTENT: ER = -1003;
pub const SOLID_ERR_NOTUSED: ER = -1004;
pub const SOLID_ERR_ALREADYUSED: ER = -1005;
pub const SOLID_ERR_OUTOFBOUND: ER = -1006;
pub const SOLID_ERR_BADSEQUENCE: ER = -1007;
pub const SOLID_ERR_UNKNOWNDEVICE: ER = -1008;
pub const SOLID_ERR_BUSY: ER = -1009;
pub const SOLID_ERR_TIMEOUT: ER = -1010;
pub const SOLID_ERR_INVALIDACCESS: ER = -1011;
pub const SOLID_ERR_NOTREADY: ER = -1012;

// `solid_rtc.h`
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct SOLID_RTC_TIME {
    pub tm_sec: c_int,
    pub tm_min: c_int,
    pub tm_hour: c_int,
    pub tm_mday: c_int,
    pub tm_mon: c_int,
    pub tm_year: c_int,
    pub tm_wday: c_int,
}

extern "C" {
    pub fn SOLID_RTC_ReadTime(time: *mut SOLID_RTC_TIME) -> c_int;
}

// `solid_log.h`
extern "C" {
    pub fn SOLID_LOG_write(s: *const u8, l: usize);
}

// `solid_mem.h`
extern "C" {
    pub fn SOLID_TLS_AddDestructor(id: i32, dtor: unsafe extern "C" fn(*mut u8));
}

// `solid_rng.h`
extern "C" {
    pub fn SOLID_RNG_SampleRandomBytes(buffer: *mut u8, length: usize) -> c_int;
}

// `rwlock.h`
extern "C" {
    pub fn rwl_loc_rdl(id: ID) -> ER;
    pub fn rwl_loc_wrl(id: ID) -> ER;
    pub fn rwl_ploc_rdl(id: ID) -> ER;
    pub fn rwl_ploc_wrl(id: ID) -> ER;
    pub fn rwl_unl_rwl(id: ID) -> ER;
    pub fn rwl_acre_rwl() -> ER_ID;
    pub fn rwl_del_rwl(id: ID) -> ER;
}