2 * Copyright (C) 2001,2002 IDEALX (http://www.idealx.com/).
3 * Written by Julien Pinon <jpinon@idealx.com>.
4 * Copyright (C) 2003 Philippe Gerum <rpm@xenomai.org>.
6 * Xenomai is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * Xenomai is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with Xenomai; if not, write to the Free Software Foundation,
18 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 #ifndef _XENO_VRTX_VRTX_H
22 #define _XENO_VRTX_VRTX_H
24 #include <nucleus/heap.h>
26 #define VRTX_SKIN_MAGIC 0x56525458
27 #define VRTX_SKIN_VERSION 6
29 #define TBSSUSP 0x0001
30 #define TBSMBOX 0x0002
31 #define TBSPUTC 0x0008
32 #define TBSDELAY 0x0020
33 #define TBSQUEUE 0x0040
34 #define TBSIDLE 0x0100
35 #define TBSFLAG 0x0200
36 #define TBSSEMA 0x0400
37 #define TBSMUTEX 0x0800
38 #define TBSADELAY 0x8000
60 #define seconds tv_sec
61 #define nanoseconds tv_nsec
69 typedef struct _vrtx_hdesc
{
76 typedef struct _vrtx_pdesc
{
83 #if defined(__KERNEL__) || defined(__XENO_SIM__)
87 #endif /* __cplusplus */
93 #endif /* __cplusplus */
95 #else /* !(__KERNEL__ || __XENO_SIM__) */
97 #include <vrtx/syscall.h>
99 #endif /* __KERNEL__ || __XENO_SIM__ */
102 * The following macros return normalized or native VRTX priority
103 * values. The core scheduler uses an ascending [0-257] priority scale
104 * (include/nucleus/sched.h), whilst the VRTX personality exhibits a
105 * decreasing scale [255-0]; normalization is done in the [1-256]
106 * range so that priority 0 is kept for non-realtime shadows.
108 #define vrtx_normalized_prio(prio) \
109 ({ int __p = (prio) ? XNSCHED_RT_MAX_PRIO - (prio) - 1 : 0; __p; })
110 #define vrtx_denormalized_prio(prio) \
111 ({ int __p = (prio) ? 256 - (prio) : 0; __p; })
115 #endif /* __cplusplus */
119 int sc_tecreate(void (*entry
)(void *),
127 int *errp
) __deprecated_in_kernel__
;
129 int sc_tcreate(void (*entry
)(void*),
132 int *errp
) __deprecated_in_kernel__
;
134 void sc_tdelete(int tid
,
138 TCB
*sc_tinquiry(int pinfo
[],
142 void sc_tpriority(int tid
,
146 void sc_tresume(int tid
,
150 void sc_tslice(unsigned short ticks
);
152 void sc_tsuspend(int tid
,
158 void sc_unlock(void);
160 int sc_mcreate(unsigned int opt
,
163 void sc_maccept(int mid
,
166 void sc_mdelete(int mid
,
169 int sc_minquiry(int mid
,
172 void sc_mpend(int mid
,
173 unsigned long timeout
,
176 void sc_mpost(int mid
,
179 int sc_qcreate(int qid
,
183 int sc_qecreate(int qid
,
188 void sc_qdelete(int qid
,
192 void sc_qjam(int qid
,
196 void sc_qpost(int qid
,
200 void sc_qbrdcst(int qid
,
204 char *sc_qaccept(int qid
,
207 char *sc_qinquiry(int qid
,
211 char *sc_qpend(int qid
,
215 void sc_post(char **mboxp
,
219 char *sc_accept(char **mboxp
,
222 char *sc_pend(char **mboxp
,
226 int sc_fcreate(int *errp
);
228 void sc_fdelete(int fid
,
232 void sc_fpost(int fid
,
236 int sc_fpend(int fid
,
242 int sc_fclear(int fid
,
246 int sc_finquiry(int fid
,
249 int sc_screate(unsigned initval
,
253 void sc_sdelete(int semid
,
257 void sc_spend(int semid
,
261 void sc_saccept(int semid
,
264 void sc_spost(int semid
,
267 int sc_sinquiry(int semid
,
270 int sc_pcreate(int pid
,
276 void sc_pdelete(int tid
,
280 void sc_pextend(int pid
,
285 void sc_pinquiry(unsigned long info
[3],
289 char *sc_gblock(int pid
,
292 void sc_rblock(int pid
,
296 int sc_hcreate(char *heapaddr
,
297 unsigned long heapsize
,
301 void sc_hdelete(int hid
,
305 char *sc_halloc(int hid
,
309 void sc_hfree(int hid
,
313 void sc_hinquiry(int info
[3],
317 void sc_delay(long timeout
);
319 void sc_adelay (struct timespec time
,
322 void sc_stime(unsigned long ticks
);
324 unsigned long sc_gtime(void);
326 void sc_gclock(struct timespec
*timep
,
330 void sc_sclock(struct timespec time
,
334 int sc_gversion(void);
338 #endif /* __cplusplus */
340 #endif /* !_XENO_VRTX_VRTX_H */