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