]> git.lizzy.rs Git - rust.git/blob - library/std/src/sys/solid/abi/mod.rs
Auto merge of #89219 - nickkuk:str_split_once_get_unchecked, r=Mark-Simulacrum
[rust.git] / library / std / src / sys / solid / abi / mod.rs
1 use crate::os::raw::c_int;
2
3 mod fs;
4 pub mod sockets;
5 pub use self::fs::*;
6
7 pub const SOLID_BP_PROGRAM_EXITED: usize = 15;
8 pub const SOLID_BP_CSABORT: usize = 16;
9
10 #[inline(always)]
11 pub fn breakpoint_program_exited(tid: usize) {
12     unsafe {
13         match () {
14             #[cfg(target_arch = "arm")]
15             () => asm!("bkpt #{}", const SOLID_BP_PROGRAM_EXITED, in("r0") tid),
16             #[cfg(target_arch = "aarch64")]
17             () => asm!("hlt #{}", const SOLID_BP_PROGRAM_EXITED, in("x0") tid),
18         }
19     }
20 }
21
22 #[inline(always)]
23 pub fn breakpoint_abort() {
24     unsafe {
25         match () {
26             #[cfg(target_arch = "arm")]
27             () => asm!("bkpt #{}", const SOLID_BP_CSABORT),
28             #[cfg(target_arch = "aarch64")]
29             () => asm!("hlt #{}", const SOLID_BP_CSABORT),
30         }
31     }
32 }
33
34 // `solid_types.h`
35 pub use super::itron::abi::{ER, ER_ID, E_TMOUT, ID};
36
37 pub const SOLID_ERR_NOTFOUND: ER = -1000;
38 pub const SOLID_ERR_NOTSUPPORTED: ER = -1001;
39 pub const SOLID_ERR_EBADF: ER = -1002;
40 pub const SOLID_ERR_INVALIDCONTENT: ER = -1003;
41 pub const SOLID_ERR_NOTUSED: ER = -1004;
42 pub const SOLID_ERR_ALREADYUSED: ER = -1005;
43 pub const SOLID_ERR_OUTOFBOUND: ER = -1006;
44 pub const SOLID_ERR_BADSEQUENCE: ER = -1007;
45 pub const SOLID_ERR_UNKNOWNDEVICE: ER = -1008;
46 pub const SOLID_ERR_BUSY: ER = -1009;
47 pub const SOLID_ERR_TIMEOUT: ER = -1010;
48 pub const SOLID_ERR_INVALIDACCESS: ER = -1011;
49 pub const SOLID_ERR_NOTREADY: ER = -1012;
50
51 // `solid_rtc.h`
52 #[repr(C)]
53 #[derive(Debug, Copy, Clone)]
54 pub struct SOLID_RTC_TIME {
55     pub tm_sec: c_int,
56     pub tm_min: c_int,
57     pub tm_hour: c_int,
58     pub tm_mday: c_int,
59     pub tm_mon: c_int,
60     pub tm_year: c_int,
61     pub tm_wday: c_int,
62 }
63
64 extern "C" {
65     pub fn SOLID_RTC_ReadTime(time: *mut SOLID_RTC_TIME) -> c_int;
66 }
67
68 // `solid_log.h`
69 extern "C" {
70     pub fn SOLID_LOG_write(s: *const u8, l: usize);
71 }
72
73 // `solid_mem.h`
74 extern "C" {
75     pub fn SOLID_TLS_AddDestructor(id: i32, dtor: unsafe extern "C" fn(*mut u8));
76 }
77
78 // `solid_rng.h`
79 extern "C" {
80     pub fn SOLID_RNG_SampleRandomBytes(buffer: *mut u8, length: usize) -> c_int;
81 }
82
83 // `rwlock.h`
84 extern "C" {
85     pub fn rwl_loc_rdl(id: ID) -> ER;
86     pub fn rwl_loc_wrl(id: ID) -> ER;
87     pub fn rwl_ploc_rdl(id: ID) -> ER;
88     pub fn rwl_ploc_wrl(id: ID) -> ER;
89     pub fn rwl_unl_rwl(id: ID) -> ER;
90     pub fn rwl_acre_rwl() -> ER_ID;
91     pub fn rwl_del_rwl(id: ID) -> ER;
92 }