Xenomai  3.0-rc3
scope.h
1 /*
2  * Copyright (C) 2013 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 #ifndef _BOILERPLATE_SCOPE_H
19 #define _BOILERPLATE_SCOPE_H
20 
21 #include <sys/types.h>
22 #include <stddef.h>
23 #include <stdint.h>
24 #include <xeno_config.h>
25 
26 typedef uintptr_t memoff_t;
27 
28 #ifdef CONFIG_XENO_PSHARED
29 
30 extern void *__main_heap;
31 
32 int pshared_check(void *heap, void *addr);
33 
34 #define dref_type(t) memoff_t
35 #define __memoff(base, addr) ((caddr_t)(addr) - (caddr_t)(base))
36 #define __memptr(base, off) ((caddr_t)(base) + (off))
37 #define __memchk(base, addr) pshared_check(base, addr)
38 
39 #define mutex_scope_attribute PTHREAD_PROCESS_SHARED
40 #define sem_scope_attribute 1
41 #ifdef CONFIG_XENO_COBALT
42 #define monitor_scope_attribute COBALT_MONITOR_SHARED
43 #define event_scope_attribute COBALT_EVENT_SHARED
44 #endif
45 
46 #else /* !CONFIG_XENO_PSHARED */
47 
48 #define __main_heap NULL
49 
50 #define dref_type(t) __typeof__(t)
51 #define __memoff(base, addr) (addr)
52 #define __memptr(base, off) (off)
53 #define __memchk(base, addr) 1
54 
55 #define mutex_scope_attribute PTHREAD_PROCESS_PRIVATE
56 #define sem_scope_attribute 0
57 #ifdef CONFIG_XENO_COBALT
58 #define monitor_scope_attribute 0
59 #define event_scope_attribute 0
60 #endif
61 
62 #endif /* !CONFIG_XENO_PSHARED */
63 
64 #endif /* _BOILERPLATE_SCOPE_H */