Xenomai API  2.6.5
sys_ppd.h
1 /*
2  * Copyright (C) 2008,2011 Gilles Chanteperdrix <[email protected]>.
3  *
4  * Xenomai is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published
6  * by the Free Software Foundation; either version 2 of the License,
7  * or (at your option) any later version.
8  *
9  * Xenomai is distributed in the hope that it will be useful, but
10  * WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with Xenomai; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
17  * 02111-1307, USA.
18  */
19 
20 #ifndef _XENO_NUCLEUS_SYS_PPD_H
21 #define _XENO_NUCLEUS_SYS_PPD_H
22 
23 #include <nucleus/ppd.h>
24 #include <nucleus/heap.h>
25 
26 struct xnsys_ppd {
27  xnshadow_ppd_t ppd;
28  xnheap_t sem_heap;
29 #ifdef XNARCH_HAVE_MAYDAY
30  unsigned long mayday_addr;
31 #endif
32  xnarch_atomic_t refcnt;
33 #define ppd2sys(addr) container_of(addr, struct xnsys_ppd, ppd)
34 };
35 
36 extern struct xnsys_ppd __xnsys_global_ppd;
37 
38 #ifdef CONFIG_XENO_OPT_PERVASIVE
39 
40 static inline struct xnsys_ppd *xnsys_ppd_get(int global)
41 {
42  xnshadow_ppd_t *ppd;
43 
44  if (global || !(ppd = xnshadow_ppd_get(0)))
45  return &__xnsys_global_ppd;
46 
47  return ppd2sys(ppd);
48 }
49 
50 #else /* !CONFIG_XENO_OPT_PERVASIVE */
51 
52 static inline struct xnsys_ppd *xnsys_ppd_get(int global)
53 {
54  return &__xnsys_global_ppd;
55 }
56 
57 #endif /* !CONFIG_XENO_OPT_PERVASIVE */
58 
59 #endif /* _XENO_NUCLEUS_SYS_PPD_H */
xnshadow_ppd_t * xnshadow_ppd_get(unsigned muxid)
Return the per-process data attached to the calling process.
Definition: shadow.c:3014