File: native_2ppd_8h-source.html

package info (click to toggle)
xenomai 2.5.4-3squeeze1
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 36,140 kB
  • ctags: 35,509
  • sloc: ansic: 109,084; sh: 11,745; makefile: 2,205; xml: 1,356; asm: 613; php: 316; perl: 155
file content (141 lines) | stat: -rw-r--r-- 11,920 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>Xenomai API: include/native/ppd.h Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.5.6 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="main.html"><span>Main&nbsp;Page</span></a></li>
      <li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li><a href="annotated.html"><span>Data&nbsp;Structures</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li><a href="examples.html"><span>Examples</span></a></li>
    <li>
      <form action="search.php" method="get">
        <table cellspacing="0" cellpadding="0" border="0">
          <tr>
            <td><label>&nbsp;<u>S</u>earch&nbsp;for&nbsp;</label></td>
            <td><input type="text" name="query" value="" size="20" accesskey="s"/></td>
          </tr>
        </table>
      </form>
    </li>
    </ul>
  </div>
<h1>include/native/ppd.h</h1><a href="native_2ppd_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 
<a name="l00022"></a>00022 <span class="preprocessor">#ifndef _XENO_PPD_H</span>
<a name="l00023"></a>00023 <span class="preprocessor"></span><span class="preprocessor">#define _XENO_PPD_H</span>
<a name="l00024"></a>00024 <span class="preprocessor"></span>
<a name="l00025"></a>00025 <span class="preprocessor">#include &lt;<a class="code" href="pod_8h.html" title="Real-time pod interface header.">nucleus/pod.h</a>&gt;</span>
<a name="l00026"></a>00026 <span class="preprocessor">#include &lt;nucleus/ppd.h&gt;</span>
<a name="l00027"></a>00027 <span class="preprocessor">#include &lt;nucleus/heap.h&gt;</span>
<a name="l00028"></a>00028 
<a name="l00029"></a>00029 <span class="keyword">typedef</span> <span class="keyword">struct </span>xeno_resource_holder {
<a name="l00030"></a>00030 
<a name="l00031"></a>00031         xnshadow_ppd_t ppd;
<a name="l00032"></a>00032 
<a name="l00033"></a>00033 <span class="preprocessor">#define ppd2rholder(a)  container_of(a, struct xeno_resource_holder, ppd)</span>
<a name="l00034"></a>00034 <span class="preprocessor"></span>
<a name="l00035"></a>00035         xnqueue_t alarmq;
<a name="l00036"></a>00036         xnqueue_t condq;
<a name="l00037"></a>00037         xnqueue_t eventq;
<a name="l00038"></a>00038         xnqueue_t heapq;
<a name="l00039"></a>00039         xnqueue_t intrq;
<a name="l00040"></a>00040         xnqueue_t mutexq;
<a name="l00041"></a>00041         xnqueue_t pipeq;
<a name="l00042"></a>00042         xnqueue_t queueq;
<a name="l00043"></a>00043         xnqueue_t semq;
<a name="l00044"></a>00044         xnqueue_t ioregionq;
<a name="l00045"></a>00045         xnqueue_t bufferq;
<a name="l00046"></a>00046 
<a name="l00047"></a>00047 } xeno_rholder_t;
<a name="l00048"></a>00048 
<a name="l00049"></a>00049 <span class="keyword">extern</span> xeno_rholder_t __native_global_rholder;
<a name="l00050"></a>00050 
<a name="l00051"></a>00051 <span class="preprocessor">#ifdef CONFIG_XENO_OPT_PERVASIVE</span>
<a name="l00052"></a>00052 <span class="preprocessor"></span>
<a name="l00053"></a>00053 <span class="keyword">extern</span> <span class="keywordtype">int</span> __native_muxid;
<a name="l00054"></a>00054 
<a name="l00055"></a>00055 <span class="keyword">static</span> <span class="keyword">inline</span> xeno_rholder_t *xeno_get_rholder(<span class="keywordtype">void</span>)
<a name="l00056"></a>00056 {
<a name="l00057"></a>00057         xnshadow_ppd_t *ppd = <a class="code" href="group__shadow.html#g14c8b586498491f886d7b5335f92c3b1" title="Return the per-process data attached to the calling process.">xnshadow_ppd_get</a>(__native_muxid);
<a name="l00058"></a>00058 
<a name="l00059"></a>00059         <span class="keywordflow">if</span> (ppd == NULL)
<a name="l00060"></a>00060                 <span class="keywordflow">return</span> &amp;__native_global_rholder;
<a name="l00061"></a>00061 
<a name="l00062"></a>00062         <span class="keywordflow">return</span> ppd2rholder(ppd);
<a name="l00063"></a>00063 }
<a name="l00064"></a>00064 
<a name="l00065"></a>00065 <span class="preprocessor">#define __xeno_release_obj(obj)                 \</span>
<a name="l00066"></a>00066 <span class="preprocessor">        do {                                    \</span>
<a name="l00067"></a>00067 <span class="preprocessor">                if ((obj)-&gt;cpid)                \</span>
<a name="l00068"></a>00068 <span class="preprocessor">                        xnfree(obj);            \</span>
<a name="l00069"></a>00069 <span class="preprocessor">        } while(0)</span>
<a name="l00070"></a>00070 <span class="preprocessor"></span>
<a name="l00071"></a>00071 <span class="preprocessor">#else </span><span class="comment">/* !CONFIG_XENO_OPT_PERVASIVE */</span>
<a name="l00072"></a>00072 
<a name="l00073"></a>00073 <span class="keyword">static</span> <span class="keyword">inline</span> xeno_rholder_t *xeno_get_rholder(<span class="keywordtype">void</span>)
<a name="l00074"></a>00074 {
<a name="l00075"></a>00075         <span class="keywordflow">return</span> &amp;__native_global_rholder;
<a name="l00076"></a>00076 }
<a name="l00077"></a>00077 
<a name="l00078"></a>00078 <span class="preprocessor">#define __xeno_release_obj(obj)         do { } while(0)</span>
<a name="l00079"></a>00079 <span class="preprocessor"></span>
<a name="l00080"></a>00080 <span class="preprocessor">#endif </span><span class="comment">/* !CONFIG_XENO_OPT_PERVASIVE */</span>
<a name="l00081"></a>00081 
<a name="l00082"></a>00082 <span class="preprocessor">#if XENO_DEBUG(NATIVE)</span>
<a name="l00083"></a>00083 <span class="preprocessor"></span><span class="preprocessor">#define __xeno_trace_release(__name, __obj, __err)              \</span>
<a name="l00084"></a>00084 <span class="preprocessor">        xnprintf("native: cleaning up %s \"%s\" (ret=%d).\n",   \</span>
<a name="l00085"></a>00085 <span class="preprocessor">                 __name, (__obj)-&gt;name, __err)</span>
<a name="l00086"></a>00086 <span class="preprocessor"></span><span class="preprocessor">#else </span><span class="comment">/* !XENO_DEBUG(NATIVE) */</span>
<a name="l00087"></a>00087 <span class="preprocessor">#define __xeno_trace_release(__name, __obj, __err)</span>
<a name="l00088"></a>00088 <span class="preprocessor"></span><span class="preprocessor">#endif </span><span class="comment">/* !XENO_DEBUG(NATIVE) */</span>
<a name="l00089"></a>00089 
<a name="l00090"></a>00090 <span class="preprocessor">#define __xeno_flush_rq(__type, __rq, __name, __release)                \</span>
<a name="l00091"></a>00091 <span class="preprocessor">        do {                                                            \</span>
<a name="l00092"></a>00092 <span class="preprocessor">                int rt_##__name##_delete(__type *);                     \</span>
<a name="l00093"></a>00093 <span class="preprocessor">                xnholder_t *holder, *nholder;                           \</span>
<a name="l00094"></a>00094 <span class="preprocessor">                __type *obj;                                            \</span>
<a name="l00095"></a>00095 <span class="preprocessor">                int err;                                                \</span>
<a name="l00096"></a>00096 <span class="preprocessor">                spl_t s;                                                \</span>
<a name="l00097"></a>00097 <span class="preprocessor">                xnlock_get_irqsave(&amp;nklock, s);                         \</span>
<a name="l00098"></a>00098 <span class="preprocessor">                nholder = getheadq(__rq);                               \</span>
<a name="l00099"></a>00099 <span class="preprocessor">                while ((holder = nholder) != NULL) {                    \</span>
<a name="l00100"></a>00100 <span class="preprocessor">                        nholder = nextq((__rq), holder);                \</span>
<a name="l00101"></a>00101 <span class="preprocessor">                        xnlock_put_irqrestore(&amp;nklock, s);              \</span>
<a name="l00102"></a>00102 <span class="preprocessor">                        obj = rlink2##__name(holder);                   \</span>
<a name="l00103"></a>00103 <span class="preprocessor">                        err = rt_##__name##_delete(obj);                \</span>
<a name="l00104"></a>00104 <span class="preprocessor">                        __xeno_trace_release(#__name, obj, err);        \</span>
<a name="l00105"></a>00105 <span class="preprocessor">                        if (unlikely(err)) {                            \</span>
<a name="l00106"></a>00106 <span class="preprocessor">                                if ((__rq) != &amp;__native_global_rholder.__name##q) { \</span>
<a name="l00107"></a>00107 <span class="preprocessor">                                        xnlock_get_irqsave(&amp;nklock, s); \</span>
<a name="l00108"></a>00108 <span class="preprocessor">                                        nholder = popq((__rq), holder); \</span>
<a name="l00109"></a>00109 <span class="preprocessor">                                        appendq(&amp;__native_global_rholder.__name##q, holder); \</span>
<a name="l00110"></a>00110 <span class="preprocessor">                                        obj-&gt;rqueue = &amp;__native_global_rholder.__name##q; \</span>
<a name="l00111"></a>00111 <span class="preprocessor">                                }                                       \</span>
<a name="l00112"></a>00112 <span class="preprocessor">                        } else {                                        \</span>
<a name="l00113"></a>00113 <span class="preprocessor">                                if (__release)                          \</span>
<a name="l00114"></a>00114 <span class="preprocessor">                                        __xeno_release_obj(obj);        \</span>
<a name="l00115"></a>00115 <span class="preprocessor">                                xnlock_get_irqsave(&amp;nklock, s);         \</span>
<a name="l00116"></a>00116 <span class="preprocessor">                        }                                               \</span>
<a name="l00117"></a>00117 <span class="preprocessor">                }                                                       \</span>
<a name="l00118"></a>00118 <span class="preprocessor">                xnlock_put_irqrestore(&amp;nklock, s);                      \</span>
<a name="l00119"></a>00119 <span class="preprocessor">        } while(0)</span>
<a name="l00120"></a>00120 <span class="preprocessor"></span>
<a name="l00121"></a>00121 <span class="preprocessor">#define xeno_flush_rq(__type, __rq, __name)  \</span>
<a name="l00122"></a>00122 <span class="preprocessor">        __xeno_flush_rq(__type, __rq, __name, 1)</span>
<a name="l00123"></a>00123 <span class="preprocessor"></span>
<a name="l00124"></a>00124 <span class="preprocessor">#define xeno_flush_rq_norelease(__type, __rq, __name)  \</span>
<a name="l00125"></a>00125 <span class="preprocessor">        __xeno_flush_rq(__type, __rq, __name, 0)</span>
<a name="l00126"></a>00126 <span class="preprocessor"></span>
<a name="l00127"></a>00127 <span class="preprocessor">#endif </span><span class="comment">/* !_XENO_PPD_H */</span>
</pre></div></div>
<hr size="1"><address style="text-align: right;"><small>Generated on Mon Aug 2 12:48:36 2010 for Xenomai API by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.6 </small></address>
</body>
</html>