doc: regenerate
[xenomai-head.git] / doc / generated / html / api / native_2buffer_8h_source.html
blob19256d5ffd7d3e864348d8c05961fc803cb1a135
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2 <html xmlns="http://www.w3.org/1999/xhtml">
3 <head>
4 <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
5 <title>Xenomai API: include/native/buffer.h Source File</title>
6 <link href="tabs.css" rel="stylesheet" type="text/css"/>
7 <link href="doxygen.css" rel="stylesheet" type="text/css"/>
8 </head>
9 <body>
10 <!-- Generated by Doxygen 1.7.1 -->
11 <div class="navigation" id="top">
12 <div class="tabs">
13 <ul class="tablist">
14 <li><a href="main.html"><span>Main&nbsp;Page</span></a></li>
15 <li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
16 <li><a href="modules.html"><span>Modules</span></a></li>
17 <li><a href="annotated.html"><span>Data&nbsp;Structures</span></a></li>
18 <li class="current"><a href="files.html"><span>Files</span></a></li>
19 <li><a href="examples.html"><span>Examples</span></a></li>
20 </ul>
21 </div>
22 <div class="tabs2">
23 <ul class="tablist">
24 <li><a href="files.html"><span>File&nbsp;List</span></a></li>
25 <li><a href="globals.html"><span>Globals</span></a></li>
26 </ul>
27 </div>
28 <div class="header">
29 <div class="headertitle">
30 <h1>include/native/buffer.h</h1> </div>
31 </div>
32 <div class="contents">
33 <a href="native_2buffer_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001
34 <a name="l00022"></a>00022 <span class="preprocessor">#ifndef _XENO_BUFFER_H</span>
35 <a name="l00023"></a>00023 <span class="preprocessor"></span><span class="preprocessor">#define _XENO_BUFFER_H</span>
36 <a name="l00024"></a>00024 <span class="preprocessor"></span>
37 <a name="l00025"></a>00025 <span class="preprocessor">#include &lt;<a class="code" href="native_2types_8h.html" title="This file is part of the Xenomai project.">native/types.h</a>&gt;</span>
38 <a name="l00026"></a>00026
39 <a name="l00027"></a>00027 <span class="comment">/* Creation flags. */</span>
40 <a name="l00028"></a>00028 <span class="preprocessor">#define B_PRIO XNSYNCH_PRIO </span><span class="comment">/* Pend by task priority order. */</span>
41 <a name="l00029"></a>00029 <span class="preprocessor">#define B_FIFO XNSYNCH_FIFO </span><span class="comment">/* Pend by FIFO order. */</span>
42 <a name="l00030"></a>00030
43 <a name="l00031"></a>00031 <span class="keyword">typedef</span> <span class="keyword">struct </span>rt_buffer_info {
44 <a name="l00032"></a>00032
45 <a name="l00033"></a>00033 <span class="keywordtype">int</span> iwaiters;
46 <a name="l00034"></a>00034 <span class="keywordtype">int</span> owaiters;
47 <a name="l00035"></a>00035 <span class="keywordtype">size_t</span> totalmem;
48 <a name="l00036"></a>00036 <span class="keywordtype">size_t</span> availmem;
49 <a name="l00037"></a>00037 <span class="keywordtype">char</span> name[XNOBJECT_NAME_LEN];
50 <a name="l00038"></a>00038
51 <a name="l00039"></a>00039 } RT_BUFFER_INFO;
52 <a name="l00040"></a>00040
53 <a name="l00041"></a>00041 <span class="keyword">typedef</span> <span class="keyword">struct </span>rt_buffer_placeholder {
54 <a name="l00042"></a>00042 xnhandle_t opaque;
55 <a name="l00043"></a>00043 } RT_BUFFER_PLACEHOLDER;
56 <a name="l00044"></a>00044
57 <a name="l00045"></a>00045 <span class="preprocessor">#if (defined(__KERNEL__) || defined(__XENO_SIM__)) &amp;&amp; !defined(DOXYGEN_CPP)</span>
58 <a name="l00046"></a>00046 <span class="preprocessor"></span>
59 <a name="l00047"></a>00047 <span class="preprocessor">#include &lt;nucleus/synch.h&gt;</span>
60 <a name="l00048"></a>00048 <span class="preprocessor">#include &lt;nucleus/heap.h&gt;</span>
61 <a name="l00049"></a>00049 <span class="preprocessor">#include &lt;<a class="code" href="native_2ppd_8h.html" title="This file is part of the Xenomai project.">native/ppd.h</a>&gt;</span>
62 <a name="l00050"></a>00050
63 <a name="l00051"></a>00051 <span class="preprocessor">#define XENO_BUFFER_MAGIC 0x55550c0c</span>
64 <a name="l00052"></a>00052 <span class="preprocessor"></span>
65 <a name="l00053"></a>00053 <span class="keyword">typedef</span> <span class="keyword">struct </span>rt_buffer {
66 <a name="l00054"></a>00054
67 <a name="l00055"></a>00055 <span class="keywordtype">unsigned</span> magic; <span class="comment">/* !&lt; Magic code - must be first */</span>
68 <a name="l00056"></a>00056
69 <a name="l00057"></a>00057 xnsynch_t isynch_base; <span class="comment">/* !&lt; Base synchronization object -- input side. */</span>
70 <a name="l00058"></a>00058 xnsynch_t osynch_base; <span class="comment">/* !&lt; Base synchronization object -- output side. */</span>
71 <a name="l00059"></a>00059 xnhandle_t handle; <span class="comment">/* !&lt; Handle in registry -- zero if unregistered. */</span>
72 <a name="l00060"></a>00060 <span class="keywordtype">char</span> name[XNOBJECT_NAME_LEN]; <span class="comment">/* !&lt; Symbolic name. */</span>
73 <a name="l00061"></a>00061
74 <a name="l00062"></a>00062 <span class="keywordtype">int</span> mode; <span class="comment">/* !&lt; Creation mode. */</span>
75 <a name="l00063"></a>00063 off_t rdoff; <span class="comment">/* !&lt; Read offset. */</span>
76 <a name="l00064"></a>00064 off_t wroff; <span class="comment">/* !&lt; Write offset. */</span>
77 <a name="l00065"></a>00065 <span class="keywordtype">size_t</span> fillsz; <span class="comment">/* !&lt; Filled space. */</span>
78 <a name="l00066"></a>00066
79 <a name="l00067"></a>00067 u_long wrtoken; <span class="comment">/* !&lt; Write token. */</span>
80 <a name="l00068"></a>00068 u_long rdtoken; <span class="comment">/* !&lt; Read token. */</span>
81 <a name="l00069"></a>00069
82 <a name="l00070"></a>00070 <span class="keywordtype">size_t</span> bufsz; <span class="comment">/* !&lt; Buffer size. */</span>
83 <a name="l00071"></a>00071 caddr_t bufmem; <span class="comment">/* !&lt; Buffer space. */</span>
84 <a name="l00072"></a>00072
85 <a name="l00073"></a>00073 <span class="preprocessor">#ifdef CONFIG_XENO_OPT_PERVASIVE</span>
86 <a name="l00074"></a>00074 <span class="preprocessor"></span> pid_t cpid; <span class="comment">/* !&lt; Creator&#39;s pid. */</span>
87 <a name="l00075"></a>00075 <span class="preprocessor">#endif </span><span class="comment">/* CONFIG_XENO_OPT_PERVASIVE */</span>
88 <a name="l00076"></a>00076 xnholder_t rlink; <span class="comment">/* !&lt; Link in resource queue. */</span>
89 <a name="l00077"></a>00077 <span class="preprocessor">#define rlink2buffer(ln) container_of(ln, RT_BUFFER, rlink)</span>
90 <a name="l00078"></a>00078 <span class="preprocessor"></span> xnqueue_t *rqueue; <span class="comment">/* !&lt; Backpointer to resource queue. */</span>
91 <a name="l00079"></a>00079
92 <a name="l00080"></a>00080 } RT_BUFFER;
93 <a name="l00081"></a>00081
94 <a name="l00082"></a>00082 <span class="preprocessor">#ifdef __cplusplus</span>
95 <a name="l00083"></a>00083 <span class="preprocessor"></span><span class="keyword">extern</span> <span class="stringliteral">&quot;C&quot;</span> {
96 <a name="l00084"></a>00084 <span class="preprocessor">#endif</span>
97 <a name="l00085"></a>00085 <span class="preprocessor"></span>
98 <a name="l00086"></a>00086 <span class="preprocessor">#ifdef CONFIG_XENO_OPT_NATIVE_BUFFER</span>
99 <a name="l00087"></a>00087 <span class="preprocessor"></span>
100 <a name="l00088"></a>00088 <span class="keywordtype">int</span> __native_buffer_pkg_init(<span class="keywordtype">void</span>);
101 <a name="l00089"></a>00089
102 <a name="l00090"></a>00090 <span class="keywordtype">void</span> __native_buffer_pkg_cleanup(<span class="keywordtype">void</span>);
103 <a name="l00091"></a>00091
104 <a name="l00092"></a>00092 <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> __native_buffer_flush_rq(xnqueue_t *rq)
105 <a name="l00093"></a>00093 {
106 <a name="l00094"></a>00094 xeno_flush_rq(RT_BUFFER, rq, buffer);
107 <a name="l00095"></a>00095 }
108 <a name="l00096"></a>00096
109 <a name="l00097"></a>00097 <span class="keyword">struct </span>xnbufd;
110 <a name="l00098"></a>00098
111 <a name="l00099"></a>00099 ssize_t rt_buffer_read_inner(RT_BUFFER *bf, <span class="keyword">struct</span> xnbufd *bufd,
112 <a name="l00100"></a>00100 xntmode_t timeout_mode, RTIME timeout);
113 <a name="l00101"></a>00101
114 <a name="l00102"></a>00102 ssize_t rt_buffer_write_inner(RT_BUFFER *bf, <span class="keyword">struct</span> xnbufd *bufd,
115 <a name="l00103"></a>00103 xntmode_t timeout_mode, RTIME timeout);
116 <a name="l00104"></a>00104
117 <a name="l00105"></a>00105 <span class="preprocessor">#else </span><span class="comment">/* !CONFIG_XENO_OPT_NATIVE_BUFFER */</span>
118 <a name="l00106"></a>00106
119 <a name="l00107"></a>00107 <span class="preprocessor">#define __native_buffer_pkg_init() ({ 0; })</span>
120 <a name="l00108"></a>00108 <span class="preprocessor"></span><span class="preprocessor">#define __native_buffer_pkg_cleanup() do { } while(0)</span>
121 <a name="l00109"></a>00109 <span class="preprocessor"></span><span class="preprocessor">#define __native_buffer_flush_rq(rq) do { } while(0)</span>
122 <a name="l00110"></a>00110 <span class="preprocessor"></span>
123 <a name="l00111"></a>00111 <span class="preprocessor">#endif </span><span class="comment">/* !CONFIG_XENO_OPT_NATIVE_BUFFER */</span>
124 <a name="l00112"></a>00112
125 <a name="l00113"></a>00113 <span class="preprocessor">#ifdef __cplusplus</span>
126 <a name="l00114"></a>00114 <span class="preprocessor"></span>}
127 <a name="l00115"></a>00115 <span class="preprocessor">#endif</span>
128 <a name="l00116"></a>00116 <span class="preprocessor"></span>
129 <a name="l00117"></a>00117 <span class="preprocessor">#else </span><span class="comment">/* !(__KERNEL__ || __XENO_SIM__) */</span>
130 <a name="l00118"></a>00118
131 <a name="l00119"></a>00119 <span class="keyword">typedef</span> RT_BUFFER_PLACEHOLDER RT_BUFFER;
132 <a name="l00120"></a>00120
133 <a name="l00121"></a>00121 <span class="preprocessor">#ifdef __cplusplus</span>
134 <a name="l00122"></a>00122 <span class="preprocessor"></span><span class="keyword">extern</span> <span class="stringliteral">&quot;C&quot;</span> {
135 <a name="l00123"></a>00123 <span class="preprocessor">#endif</span>
136 <a name="l00124"></a>00124 <span class="preprocessor"></span>
137 <a name="l00125"></a>00125 <span class="keywordtype">int</span> <a class="code" href="group__buffer.html#ga9d88ba56f1dc341b1b78c1549678fa4e" title="Bind to a buffer.">rt_buffer_bind</a>(RT_BUFFER *bf,
138 <a name="l00126"></a>00126 <span class="keyword">const</span> <span class="keywordtype">char</span> *name,
139 <a name="l00127"></a>00127 RTIME timeout);
140 <a name="l00128"></a>00128
141 <a name="l00129"></a><a class="code" href="group__buffer.html#ga85e669d38297fa6dff6e78339bb8329d">00129</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code" href="group__buffer.html#ga85e669d38297fa6dff6e78339bb8329d" title="Unbind from a buffer.">rt_buffer_unbind</a>(RT_BUFFER *bf)
142 <a name="l00130"></a>00130 {
143 <a name="l00131"></a>00131 bf-&gt;opaque = XN_NO_HANDLE;
144 <a name="l00132"></a>00132 <span class="keywordflow">return</span> 0;
145 <a name="l00133"></a>00133 }
146 <a name="l00134"></a>00134
147 <a name="l00135"></a>00135 <span class="preprocessor">#ifdef __cplusplus</span>
148 <a name="l00136"></a>00136 <span class="preprocessor"></span>}
149 <a name="l00137"></a>00137 <span class="preprocessor">#endif</span>
150 <a name="l00138"></a>00138 <span class="preprocessor"></span>
151 <a name="l00139"></a>00139 <span class="preprocessor">#endif </span><span class="comment">/* __KERNEL__ || __XENO_SIM__ */</span>
152 <a name="l00140"></a>00140
153 <a name="l00141"></a>00141 <span class="preprocessor">#ifdef __cplusplus</span>
154 <a name="l00142"></a>00142 <span class="preprocessor"></span><span class="keyword">extern</span> <span class="stringliteral">&quot;C&quot;</span> {
155 <a name="l00143"></a>00143 <span class="preprocessor">#endif</span>
156 <a name="l00144"></a>00144 <span class="preprocessor"></span>
157 <a name="l00145"></a>00145 <span class="comment">/* Public interface. */</span>
158 <a name="l00146"></a>00146
159 <a name="l00147"></a>00147 <span class="keywordtype">int</span> <a class="code" href="group__buffer.html#ga7aa6a3b48ba6b6ecdd7f2ad9152d2a61" title="Create a buffer.">rt_buffer_create</a>(RT_BUFFER *bf,
160 <a name="l00148"></a>00148 <span class="keyword">const</span> <span class="keywordtype">char</span> *name,
161 <a name="l00149"></a>00149 <span class="keywordtype">size_t</span> bufsz,
162 <a name="l00150"></a>00150 <span class="keywordtype">int</span> mode);
163 <a name="l00151"></a>00151
164 <a name="l00152"></a>00152 <span class="keywordtype">int</span> <a class="code" href="group__buffer.html#gabd852c3c957d2dd37c15899119a3551e" title="Delete a buffer.">rt_buffer_delete</a>(RT_BUFFER *bf);
165 <a name="l00153"></a>00153
166 <a name="l00154"></a>00154 ssize_t <a class="code" href="group__buffer.html#ga1819fcb58ee95c4ce13513039f5c447a" title="Write to a buffer.">rt_buffer_write</a>(RT_BUFFER *bf,
167 <a name="l00155"></a>00155 <span class="keyword">const</span> <span class="keywordtype">void</span> *ptr, <span class="keywordtype">size_t</span> size,
168 <a name="l00156"></a>00156 RTIME timeout);
169 <a name="l00157"></a>00157
170 <a name="l00158"></a>00158 ssize_t <a class="code" href="group__buffer.html#ga8050d5c2639b0b6ac56d926acd8f938c" title="Write to a buffer (with absolute timeout date).">rt_buffer_write_until</a>(RT_BUFFER *bf,
171 <a name="l00159"></a>00159 <span class="keyword">const</span> <span class="keywordtype">void</span> *ptr, <span class="keywordtype">size_t</span> size,
172 <a name="l00160"></a>00160 RTIME timeout);
173 <a name="l00161"></a>00161
174 <a name="l00162"></a>00162 ssize_t <a class="code" href="group__buffer.html#ga24686310221a83682adcdf3347ac7dea" title="Read from a buffer.">rt_buffer_read</a>(RT_BUFFER *bf,
175 <a name="l00163"></a>00163 <span class="keywordtype">void</span> *ptr, <span class="keywordtype">size_t</span> size,
176 <a name="l00164"></a>00164 RTIME timeout);
177 <a name="l00165"></a>00165
178 <a name="l00166"></a>00166 ssize_t rt_buffer_read_until(RT_BUFFER *bf,
179 <a name="l00167"></a>00167 <span class="keywordtype">void</span> *ptr, <span class="keywordtype">size_t</span> size,
180 <a name="l00168"></a>00168 RTIME timeout);
181 <a name="l00169"></a>00169
182 <a name="l00170"></a>00170 <span class="keywordtype">int</span> <a class="code" href="group__buffer.html#gaf78c43664dda8a17c5c63ad4be2da179" title="Clear a buffer.">rt_buffer_clear</a>(RT_BUFFER *bf);
183 <a name="l00171"></a>00171
184 <a name="l00172"></a>00172 <span class="keywordtype">int</span> <a class="code" href="group__buffer.html#ga98722ca524c008906069607a289fb26a" title="Inquire about a buffer.">rt_buffer_inquire</a>(RT_BUFFER *bf,
185 <a name="l00173"></a>00173 RT_BUFFER_INFO *info);
186 <a name="l00174"></a>00174
187 <a name="l00175"></a>00175 <span class="preprocessor">#ifdef __cplusplus</span>
188 <a name="l00176"></a>00176 <span class="preprocessor"></span>}
189 <a name="l00177"></a>00177 <span class="preprocessor">#endif</span>
190 <a name="l00178"></a>00178 <span class="preprocessor"></span>
191 <a name="l00179"></a>00179 <span class="preprocessor">#endif </span><span class="comment">/* !_XENO_BUFFER_H */</span>
192 </pre></div></div>
193 </div>
194 <hr class="footer"/><address class="footer"><small>Generated on Wed Nov 2 2011 18:01:06 for Xenomai API by&nbsp;
195 <a href="http://www.doxygen.org/index.html">
196 <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.1 </small></address>
197 </body>
198 </html>