1 //! ABI for μITRON derivatives
2 pub type int_t = crate::os::raw::c_int;
3 pub type uint_t = crate::os::raw::c_uint;
4 pub type bool_t = int_t;
10 pub const TSK_SELF: ID = 0;
13 pub type RELTIM = u32;
15 /// Timeout (a valid `RELTIM` value or `TMO_FEVR`)
18 /// The infinite timeout value
19 pub const TMO_FEVR: TMO = TMO::MAX;
21 /// The maximum valid value of `RELTIM`
22 pub const TMAX_RELTIM: RELTIM = 4_000_000_000;
25 pub type SYSTIM = u64;
30 /// Error code type, `ID` on success
31 pub type ER_ID = int_t;
33 /// Service call operational mode
34 pub type MODE = uint_t;
36 /// OR waiting condition for an eventflag
37 pub const TWF_ORW: MODE = 0x01;
40 pub type ATR = uint_t;
43 pub const TA_FIFO: ATR = 0;
44 /// Only one task is allowed to be in the waiting state for the eventflag
45 pub const TA_WSGL: ATR = 0;
46 /// The eventflag’s bit pattern is cleared when a task is released from the
47 /// waiting state for that eventflag.
48 pub const TA_CLR: ATR = 0x04;
50 /// Bit pattern of an eventflag
51 pub type FLGPTN = uint_t;
53 /// Task or interrupt priority
56 /// The special value of `PRI` representing the current task's priority.
57 pub const TPRI_SELF: PRI = 0;
59 /// Use the priority inheritance protocol
60 #[cfg(target_os = "solid_asp3")]
61 pub const TA_INHERIT: ATR = 0x02;
63 /// Activate the task on creation
64 pub const TA_ACT: ATR = 0x01;
66 /// The maximum count of a semaphore
67 pub const TMAX_MAXSEM: uint_t = uint_t::MAX;
69 /// Callback parameter
70 pub type EXINF = isize;
73 pub type TASK = Option<unsafe extern "C" fn(EXINF)>;
76 pub const E_OK: ER = 0;
77 pub const E_SYS: ER = -5;
78 pub const E_NOSPT: ER = -9;
79 pub const E_RSFN: ER = -10;
80 pub const E_RSATR: ER = -11;
81 pub const E_PAR: ER = -17;
82 pub const E_ID: ER = -18;
83 pub const E_CTX: ER = -25;
84 pub const E_MACV: ER = -26;
85 pub const E_OACV: ER = -27;
86 pub const E_ILUSE: ER = -28;
87 pub const E_NOMEM: ER = -33;
88 pub const E_NOID: ER = -34;
89 pub const E_NORES: ER = -35;
90 pub const E_OBJ: ER = -41;
91 pub const E_NOEXS: ER = -42;
92 pub const E_QOVR: ER = -43;
93 pub const E_RLWAI: ER = -49;
94 pub const E_TMOUT: ER = -50;
95 pub const E_DLT: ER = -51;
96 pub const E_CLS: ER = -52;
97 pub const E_RASTER: ER = -53;
98 pub const E_WBLK: ER = -57;
99 pub const E_BOVR: ER = -58;
100 pub const E_COMM: ER = -65;
102 #[derive(Clone, Copy)]
110 #[derive(Clone, Copy)]
117 #[derive(Clone, Copy)]
124 #[derive(Clone, Copy)]
136 #[link_name = "__asp3_acre_tsk"]
137 pub fn acre_tsk(pk_ctsk: *const T_CTSK) -> ER_ID;
138 #[link_name = "__asp3_get_tid"]
139 pub fn get_tid(p_tskid: *mut ID) -> ER;
140 #[link_name = "__asp3_dly_tsk"]
141 pub fn dly_tsk(dlytim: RELTIM) -> ER;
142 #[link_name = "__asp3_ter_tsk"]
143 pub fn ter_tsk(tskid: ID) -> ER;
144 #[link_name = "__asp3_del_tsk"]
145 pub fn del_tsk(tskid: ID) -> ER;
146 #[link_name = "__asp3_get_pri"]
147 pub fn get_pri(tskid: ID, p_tskpri: *mut PRI) -> ER;
148 #[link_name = "__asp3_rot_rdq"]
149 pub fn rot_rdq(tskpri: PRI) -> ER;
150 #[link_name = "__asp3_slp_tsk"]
151 pub fn slp_tsk() -> ER;
152 #[link_name = "__asp3_tslp_tsk"]
153 pub fn tslp_tsk(tmout: TMO) -> ER;
154 #[link_name = "__asp3_wup_tsk"]
155 pub fn wup_tsk(tskid: ID) -> ER;
156 #[link_name = "__asp3_unl_cpu"]
157 pub fn unl_cpu() -> ER;
158 #[link_name = "__asp3_dis_dsp"]
159 pub fn dis_dsp() -> ER;
160 #[link_name = "__asp3_ena_dsp"]
161 pub fn ena_dsp() -> ER;
162 #[link_name = "__asp3_sns_dsp"]
163 pub fn sns_dsp() -> bool_t;
164 #[link_name = "__asp3_get_tim"]
165 pub fn get_tim(p_systim: *mut SYSTIM) -> ER;
166 #[link_name = "__asp3_acre_flg"]
167 pub fn acre_flg(pk_cflg: *const T_CFLG) -> ER_ID;
168 #[link_name = "__asp3_del_flg"]
169 pub fn del_flg(flgid: ID) -> ER;
170 #[link_name = "__asp3_set_flg"]
171 pub fn set_flg(flgid: ID, setptn: FLGPTN) -> ER;
172 #[link_name = "__asp3_clr_flg"]
173 pub fn clr_flg(flgid: ID, clrptn: FLGPTN) -> ER;
174 #[link_name = "__asp3_wai_flg"]
175 pub fn wai_flg(flgid: ID, waiptn: FLGPTN, wfmode: MODE, p_flgptn: *mut FLGPTN) -> ER;
176 #[link_name = "__asp3_twai_flg"]
181 p_flgptn: *mut FLGPTN,
184 #[link_name = "__asp3_acre_mtx"]
185 pub fn acre_mtx(pk_cmtx: *const T_CMTX) -> ER_ID;
186 #[link_name = "__asp3_del_mtx"]
187 pub fn del_mtx(tskid: ID) -> ER;
188 #[link_name = "__asp3_loc_mtx"]
189 pub fn loc_mtx(mtxid: ID) -> ER;
190 #[link_name = "__asp3_ploc_mtx"]
191 pub fn ploc_mtx(mtxid: ID) -> ER;
192 #[link_name = "__asp3_tloc_mtx"]
193 pub fn tloc_mtx(mtxid: ID, tmout: TMO) -> ER;
194 #[link_name = "__asp3_unl_mtx"]
195 pub fn unl_mtx(mtxid: ID) -> ER;
196 pub fn exd_tsk() -> ER;