Xenomai  3.1
psos.h
1 /*
2  * Copyright (C) 2001-2010 Philippe Gerum <rpm@xenomai.org>.
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13 
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
17  *
18  * This file satisfies the references within the emulator code
19  * mimicking a pSOS-like API built upon the copperplate library.
20  *
21  * pSOS and pSOS+ are registered trademarks of Wind River Systems, Inc.
22  */
23 
24 #ifndef _XENOMAI_PSOS_PSOS_H
25 #define _XENOMAI_PSOS_PSOS_H
26 
27 #include <sys/types.h>
28 
29 #ifndef SUCCESS
30 #define SUCCESS 0
31 #endif
32 
33 #define T_NOPREEMPT 0x0001
34 #define T_PREEMPT 0x0000
35 #define T_TSLICE 0x0002
36 #define T_NOTSLICE 0x0000
37 #define T_NOASR 0x0004
38 #define T_ASR 0x0000
39 #define T_SUPV 0x2000
40 #define T_USER 0x0000
41 #define T_LEVELMASK0 0x0000
42 #define T_LEVELMASK1 0x0100
43 #define T_LEVELMASK2 0x0200
44 #define T_LEVELMASK3 0x0300
45 #define T_LEVELMASK4 0x0400
46 #define T_LEVELMASK5 0x0500
47 #define T_LEVELMASK6 0x0600
48 #define T_LEVELMASK7 0x0700
49 #define T_NOISR 0x0700
50 #define T_ISR 0x0000
51 #define T_GLOBAL 0x0001
52 #define T_LOCAL 0x0000
53 #define T_NOFPU 0x0000
54 #define T_FPU 0x0002
55 
56 #define RN_PRIOR 0x0002
57 #define RN_FIFO 0x0000
58 #define RN_DEL 0x0004
59 #define RN_NODEL 0x0000
60 #define RN_NOWAIT 0x0001
61 #define RN_WAIT 0x0000
62 
63 #define SM_GLOBAL 0x0001
64 #define SM_LOCAL 0x0000
65 #define SM_PRIOR 0x0002
66 #define SM_FIFO 0x0000
67 #define SM_NOWAIT 0x0001
68 #define SM_WAIT 0x0000
69 
70 #define EV_NOWAIT 0x0001
71 #define EV_WAIT 0x0000
72 #define EV_ANY 0x0002
73 #define EV_ALL 0x0000
74 
75 #define K_GLOBAL 0x0001
76 #define K_LOCAL 0x0000
77 
78 #define PT_GLOBAL 0x0001
79 #define PT_LOCAL 0x0000
80 #define PT_DEL 0x0004
81 #define PT_NODEL 0x0000
82 
83 #define Q_GLOBAL 0x0001
84 #define Q_LOCAL 0x0000
85 #define Q_PRIOR 0x0002
86 #define Q_FIFO 0x0000
87 #define Q_LIMIT 0x0004
88 #define Q_NOLIMIT 0x0000
89 #define Q_PRIBUF 0x0008
90 #define Q_SYSBUF 0x0000
91 #define Q_NOWAIT 0x0001
92 #define Q_WAIT 0x0000
93 
94 #define ERR_TIMEOUT 0x01
95 #define ERR_SSFN 0x03
96 #define ERR_NODENO 0x04
97 #define ERR_OBJDEL 0x05
98 #define ERR_OBJID 0x06
99 #define ERR_OBJTYPE 0x07
100 #define ERR_OBJTFULL 0x08
101 #define ERR_OBJNF 0x09
102 
103 #define ERR_NOTCB 0x0E
104 #define ERR_NOSTK 0x0F
105 #define ERR_TINYSTK 0x10
106 #define ERR_PRIOR 0x11
107 #define ERR_ACTIVE 0x12
108 #define ERR_NACTIVE 0x13
109 #define ERR_SUSP 0x14
110 #define ERR_NOTSUSP 0x15
111 #define ERR_SETPRI 0x16
112 #define ERR_REGNUM 0x17
113 
114 #define ERR_RNADDR 0x1B
115 #define ERR_UNITSIZE 0x1C
116 #define ERR_TINYUNIT 0x1D
117 #define ERR_TINYRN 0x1E
118 #define ERR_SEGINUSE 0x1F
119 #define ERR_TOOBIG 0x21
120 #define ERR_NOSEG 0x22
121 #define ERR_NOTINRN 0x23
122 #define ERR_SEGADDR 0x24
123 #define ERR_SEGFREE 0x25
124 #define ERR_RNKILLD 0x26
125 #define ERR_TATRNDEL 0x27
126 
127 #define ERR_PTADDR 0x28
128 #define ERR_BUFSIZE 0x29
129 #define ERR_TINYPT 0x2A
130 #define ERR_BUFINUSE 0x2B
131 #define ERR_NOBUF 0x2C
132 #define ERR_BUFADDR 0x2D
133 #define ERR_BUFFREE 0x2F
134 
135 #define ERR_MSGSIZ 0x31
136 #define ERR_BUFSIZ 0x32
137 #define ERR_NOQCB 0x33
138 #define ERR_NOMGB 0x34
139 #define ERR_QFULL 0x35
140 #define ERR_QKILLD 0x36
141 #define ERR_NOMSG 0x37
142 #define ERR_TATQDEL 0x38
143 #define ERR_MATQDEL 0x39
144 #define ERR_VARQ 0x3A
145 #define ERR_NOTVARQ 0x3B
146 
147 #define ERR_NOEVS 0x3C
148 #define ERR_NOTINASR 0x3E
149 #define ERR_NOASR 0x3F
150 
151 #define ERR_NOSCB 0x41
152 #define ERR_NOSEM 0x42
153 #define ERR_SKILLD 0x43
154 #define ERR_TATSDEL 0x44
155 
156 #define ERR_NOTIME 0x47
157 #define ERR_ILLDATE 0x48
158 #define ERR_ILLTIME 0x49
159 #define ERR_ILLTICKS 0x4A
160 #define ERR_NOTIMERS 0x4B
161 #define ERR_BADTMID 0x4C
162 #define ERR_TMNOTSET 0x4D
163 #define ERR_TOOLATE 0x4E
164 
165 #ifdef __cplusplus
166 extern "C" {
167 #endif /* __cplusplus */
168 
169 u_long ev_receive(u_long events,
170  u_long flags,
171  u_long timeout,
172  u_long *events_r);
173 
174 u_long ev_send(u_long tid,
175  u_long events);
176 
177 u_long pt_create(const char *name,
178  void *paddr,
179  void *laddr,
180  u_long psize,
181  u_long bsize,
182  u_long flags,
183  u_long *tid_r,
184  u_long *nbuf_r);
185 
186 u_long pt_delete(u_long tid);
187 
188 u_long pt_getbuf(u_long tid,
189  void **bufaddr);
190 
191 u_long pt_ident(const char *name,
192  u_long node,
193  u_long *ptid_r);
194 
195 u_long pt_retbuf(u_long tid,
196  void *buf);
197 
198 u_long q_broadcast(u_long qid,
199  u_long msgbuf[4],
200  u_long *count_r);
201 
202 u_long q_create(const char *name,
203  u_long count,
204  u_long flags,
205  u_long *qid_r);
206 
207 u_long q_delete(u_long qid);
208 
209 u_long q_ident(const char *name,
210  u_long node,
211  u_long *qid_r);
212 
213 u_long q_receive(u_long qid,
214  u_long flags,
215  u_long timeout,
216  u_long msgbuf[4]);
217 
218 u_long q_send(u_long qid,
219  u_long msgbuf[4]);
220 
221 u_long q_urgent(u_long qid,
222  u_long msgbuf[4]);
223 
224 u_long q_vcreate(const char *name,
225  u_long flags,
226  u_long count,
227  u_long maxlen,
228  u_long *qid_r);
229 
230 u_long q_vdelete(u_long qid);
231 
232 u_long q_vident(const char *name,
233  u_long node,
234  u_long *qid_r);
235 
236 u_long q_vreceive(u_long qid,
237  u_long flags,
238  u_long timeout,
239  void *msgbuf,
240  u_long msglen,
241  u_long *msglen_r);
242 
243 u_long q_vsend(u_long qid,
244  void *msgbuf,
245  u_long msglen);
246 
247 u_long q_vurgent(u_long qid,
248  void *msgbuf,
249  u_long msglen);
250 
251 u_long q_vbroadcast(u_long qid,
252  void *msgbuf,
253  u_long msglen,
254  u_long *count_r);
255 
256 u_long rn_create(const char *name,
257  void *saddr,
258  u_long rnsize,
259  u_long usize,
260  u_long flags,
261  u_long *rnid_r,
262  u_long *asize_r);
263 
264 u_long rn_delete(u_long rnid);
265 
266 u_long rn_getseg(u_long rnid,
267  u_long size,
268  u_long flags,
269  u_long timeout,
270  void **segaddr);
271 
272 u_long rn_ident(const char *name,
273  u_long *rnid_r);
274 
275 u_long rn_retseg(u_long rnid,
276  void *segaddr);
277 
278 u_long sm_create(const char *name,
279  u_long count,
280  u_long flags,
281  u_long *smid_r);
282 
283 u_long sm_delete(u_long smid);
284 
285 u_long sm_ident(const char *name,
286  u_long node,
287  u_long *smid_r);
288 
289 u_long sm_p(u_long smid,
290  u_long flags,
291  u_long timeout);
292 
293 u_long sm_v(u_long smid);
294 
295 u_long t_create(const char *name,
296  u_long prio,
297  u_long sstack,
298  u_long ustack,
299  u_long flags,
300  u_long *tid_r);
301 
302 u_long t_delete(u_long tid);
303 
304 u_long t_getreg(u_long tid,
305  u_long regnum,
306  u_long *regvalue_r);
307 
308 u_long t_ident(const char *name,
309  u_long node,
310  u_long *tid_r);
311 
312 u_long t_mode(u_long mask,
313  u_long newmask,
314  u_long *oldmode_r);
315 
316 u_long t_resume(u_long tid);
317 
318 u_long t_setpri(u_long tid,
319  u_long newprio,
320  u_long *oldprio_r);
321 
322 u_long t_setreg(u_long tid,
323  u_long regnum,
324  u_long regvalue);
325 
326 u_long t_start(u_long tid,
327  u_long mode,
328  void (*entry)(u_long a0,
329  u_long a1,
330  u_long a2,
331  u_long a3),
332  u_long args[]);
333 
334 u_long t_suspend(u_long tid);
335 
336 u_long tm_cancel(u_long tmid);
337 
338 u_long tm_evafter(u_long ticks,
339  u_long events,
340  u_long *tmid_r);
341 
342 u_long tm_evevery(u_long ticks,
343  u_long events,
344  u_long *tmid_r);
345 
346 u_long tm_evwhen(u_long date,
347  u_long time,
348  u_long ticks,
349  u_long events,
350  u_long *tmid_r);
351 
352 u_long tm_get(u_long *date_r,
353  u_long *time_r,
354  u_long *ticks_r);
355 
356 u_long tm_set(u_long date,
357  u_long time,
358  u_long ticks);
359 
360 u_long tm_getm(unsigned long long *ns);
361 
362 u_long tm_wkafter(u_long ticks);
363 
364 u_long tm_wkwhen(u_long date,
365  u_long time,
366  u_long ticks);
367 
368 int psos_task_normalize_priority(u_long psos_prio);
369 
370 u_long psos_task_denormalize_priority(int core_prio);
371 
372 #ifdef __cplusplus
373 }
374 #endif /* __cplusplus */
375 
376 #endif /* !_XENOMAI_PSOS_PSOS_H */