File: group__subdevice.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 (279 lines) | stat: -rw-r--r-- 21,968 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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
<!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: Subdevice management services</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><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>
</div>
<div class="contents">
<h1>Subdevice management services<br>
<small>
[<a class="el" href="group__driverfacilities.html">Driver API.</a>]</small>
</h1>
<p>
<div class="dynheader">
Collaboration diagram for Subdevice management services:</div>
<div class="dynsection">
<center><table><tr><td><img src="group__subdevice.png" border="0" alt="" usemap="#group____subdevice_map">
<map name="group____subdevice_map">
<area shape="rect" href="group__driverfacilities.html" title="Driver API." alt="" coords="5,5,93,32"></map></td></tr></table></center>
</div>
<hr><a name="_details"></a><h2>Detailed Description</h2>
Subdevice declaration in a driver<p>
The subdevice structure is the most complex one in the Analogy driver layer. It contains some description fields to fill and some callbacks to declare.<p>
The description fields are:<ul>
<li>flags: to define the subdevice type and its capabilities;</li><li>chan_desc: to describe the channels which compose the subdevice;</li><li>rng_desc: to declare the usable ranges;</li></ul>
<p>
The functions callbakcs are:<ul>
<li>do_cmd() and do_cmdtest(): to performe asynchronous acquisitions thanks to commands;</li><li>cancel(): to abort a working asynchronous acquisition;</li><li>munge(): to apply modifications on the data freshly acquired during an asynchronous transfer. Warning: using this feature with can significantly reduce the performances (if the munge operation is complex, it will trigger high CPU charge and if the acquisition device is DMA capable, many cache-misses and cache-replaces will occur (the benefits of the DMA controller will vanish);</li><li>trigger(): optionnaly to launch an asynchronous acquisition;</li><li>insn_read(), insn_write(), insn_bits(), insn_config(): to perform synchronous acquisition operations.</li></ul>
<p>
Once the subdevice is filled, it must be inserted into the driver structure thanks to <a class="el" href="group__subdevice.html#g229e7725db234534da6e6973c63f1cef" title="Add a subdevice to the driver descriptor.">a4l_add_subd()</a>. 
<p>
<table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Data Structures</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">struct &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="structa4l__subdevice.html">a4l_subdevice</a></td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Structure describing the subdevice.  <a href="structa4l__subdevice.html#_details">More...</a><br></td></tr>
<tr><td colspan="2"><br><h2>Subdevices types</h2></td></tr>
<tr><td colspan="2">Flags to define the subdevice type<p>
<a class="anchor" name="ANALOGY_SUBD_xxx"></a> <br><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="g0c70964ed18393fdeb7f6b985d7ae4f1"></a><!-- doxytag: member="subdevice::A4L_SUBD_UNUSED" ref="g0c70964ed18393fdeb7f6b985d7ae4f1" args="" -->
#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__subdevice.html#g0c70964ed18393fdeb7f6b985d7ae4f1">A4L_SUBD_UNUSED</a>&nbsp;&nbsp;&nbsp;(A4L_SUBD_MASK_SPECIAL|0x1)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Unused subdevice. <br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="gfe08fcb0bd2ac9015e058a1a38ebfade"></a><!-- doxytag: member="subdevice::A4L_SUBD_AI" ref="gfe08fcb0bd2ac9015e058a1a38ebfade" args="" -->
#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__subdevice.html#gfe08fcb0bd2ac9015e058a1a38ebfade">A4L_SUBD_AI</a>&nbsp;&nbsp;&nbsp;(A4L_SUBD_MASK_READ|0x2)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Analog input subdevice. <br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="g5285a5093bd9279588a4b8fd05bb7c3f"></a><!-- doxytag: member="subdevice::A4L_SUBD_AO" ref="g5285a5093bd9279588a4b8fd05bb7c3f" args="" -->
#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__subdevice.html#g5285a5093bd9279588a4b8fd05bb7c3f">A4L_SUBD_AO</a>&nbsp;&nbsp;&nbsp;(A4L_SUBD_MASK_WRITE|0x4)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Analog output subdevice. <br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="gd4b6ee48948dc35895606488de102e14"></a><!-- doxytag: member="subdevice::A4L_SUBD_DI" ref="gd4b6ee48948dc35895606488de102e14" args="" -->
#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__subdevice.html#gd4b6ee48948dc35895606488de102e14">A4L_SUBD_DI</a>&nbsp;&nbsp;&nbsp;(A4L_SUBD_MASK_READ|0x8)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Digital input subdevice. <br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="gf86e53e7a480bfb73df538dfd230efa2"></a><!-- doxytag: member="subdevice::A4L_SUBD_DO" ref="gf86e53e7a480bfb73df538dfd230efa2" args="" -->
#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__subdevice.html#gf86e53e7a480bfb73df538dfd230efa2">A4L_SUBD_DO</a>&nbsp;&nbsp;&nbsp;(A4L_SUBD_MASK_WRITE|0x10)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Digital output subdevice. <br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="g56fb70a0e2cf39e1be994d4b1e346162"></a><!-- doxytag: member="subdevice::A4L_SUBD_DIO" ref="g56fb70a0e2cf39e1be994d4b1e346162" args="" -->
#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__subdevice.html#g56fb70a0e2cf39e1be994d4b1e346162">A4L_SUBD_DIO</a>&nbsp;&nbsp;&nbsp;(A4L_SUBD_MASK_SPECIAL|0x20)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Digital input/output subdevice. <br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="g9769a5004db6f3d45c1ac908fd1b9123"></a><!-- doxytag: member="subdevice::A4L_SUBD_COUNTER" ref="g9769a5004db6f3d45c1ac908fd1b9123" args="" -->
#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__subdevice.html#g9769a5004db6f3d45c1ac908fd1b9123">A4L_SUBD_COUNTER</a>&nbsp;&nbsp;&nbsp;(A4L_SUBD_MASK_SPECIAL|0x40)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Counter subdevice. <br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ge4e41940b17d812ba852ac8739165262"></a><!-- doxytag: member="subdevice::A4L_SUBD_TIMER" ref="ge4e41940b17d812ba852ac8739165262" args="" -->
#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__subdevice.html#ge4e41940b17d812ba852ac8739165262">A4L_SUBD_TIMER</a>&nbsp;&nbsp;&nbsp;(A4L_SUBD_MASK_SPECIAL|0x80)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Timer subdevice. <br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga38f1355eb6a7874ce5dcf8f90072d14"></a><!-- doxytag: member="subdevice::A4L_SUBD_MEMORY" ref="ga38f1355eb6a7874ce5dcf8f90072d14" args="" -->
#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__subdevice.html#ga38f1355eb6a7874ce5dcf8f90072d14">A4L_SUBD_MEMORY</a>&nbsp;&nbsp;&nbsp;(A4L_SUBD_MASK_SPECIAL|0x100)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Memory, EEPROM, DPRAM. <br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ge9eee756dede608de5263143191edec2"></a><!-- doxytag: member="subdevice::A4L_SUBD_CALIB" ref="ge9eee756dede608de5263143191edec2" args="" -->
#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__subdevice.html#ge9eee756dede608de5263143191edec2">A4L_SUBD_CALIB</a>&nbsp;&nbsp;&nbsp;(A4L_SUBD_MASK_SPECIAL|0x200)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Calibration subdevice DACs. <br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="gcf4d6837ce92a27aaf9b78d59fb6ba8e"></a><!-- doxytag: member="subdevice::A4L_SUBD_PROC" ref="gcf4d6837ce92a27aaf9b78d59fb6ba8e" args="" -->
#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__subdevice.html#gcf4d6837ce92a27aaf9b78d59fb6ba8e">A4L_SUBD_PROC</a>&nbsp;&nbsp;&nbsp;(A4L_SUBD_MASK_SPECIAL|0x400)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Processor, DSP. <br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="g14c863f8e99d6be9a0d6371bcbe8fff1"></a><!-- doxytag: member="subdevice::A4L_SUBD_SERIAL" ref="g14c863f8e99d6be9a0d6371bcbe8fff1" args="" -->
#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__subdevice.html#g14c863f8e99d6be9a0d6371bcbe8fff1">A4L_SUBD_SERIAL</a>&nbsp;&nbsp;&nbsp;(A4L_SUBD_MASK_SPECIAL|0x800)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Serial IO subdevice. <br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="gffcb131508d9920aa4436c7df18a8ab1"></a><!-- doxytag: member="subdevice::A4L_SUBD_TYPES" ref="gffcb131508d9920aa4436c7df18a8ab1" args="" -->
#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__subdevice.html#gffcb131508d9920aa4436c7df18a8ab1">A4L_SUBD_TYPES</a></td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Mask which gathers all the types. <br></td></tr>
<tr><td colspan="2"><br><h2>Subdevice features</h2></td></tr>
<tr><td colspan="2">Flags to define the subdevice's capabilities<p>
<a class="anchor" name="ANALOGY_SUBD_FT_xxx"></a> <br><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ge57f549ab2689782e35af2c8941aeecf"></a><!-- doxytag: member="subdevice::A4L_SUBD_CMD" ref="ge57f549ab2689782e35af2c8941aeecf" args="" -->
#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__subdevice.html#ge57f549ab2689782e35af2c8941aeecf">A4L_SUBD_CMD</a>&nbsp;&nbsp;&nbsp;0x1000</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">The subdevice can handle command (i.e it can perform asynchronous acquisition). <br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="g4ec26f0982c64fe7aab38678af7a20a4"></a><!-- doxytag: member="subdevice::A4L_SUBD_MMAP" ref="g4ec26f0982c64fe7aab38678af7a20a4" args="" -->
#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__subdevice.html#g4ec26f0982c64fe7aab38678af7a20a4">A4L_SUBD_MMAP</a>&nbsp;&nbsp;&nbsp;0x8000</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">The subdevice support mmap operations (technically, any driver can do it; however, the developer might want that his driver must be accessed through read / write. <br></td></tr>
<tr><td colspan="2"><br><h2>Subdevice status</h2></td></tr>
<tr><td colspan="2">Flags to define the subdevice's status<p>
<a class="anchor" name="ANALOGY_SUBD_ST_xxx"></a> <br><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="g943b015c909276644de277f4135e7579"></a><!-- doxytag: member="subdevice::A4L_SUBD_BUSY_NR" ref="g943b015c909276644de277f4135e7579" args="" -->
#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__subdevice.html#g943b015c909276644de277f4135e7579">A4L_SUBD_BUSY_NR</a>&nbsp;&nbsp;&nbsp;0</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">The subdevice is busy, a synchronous or an asynchronous acquisition is occuring. <br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="gf6114bf76458b8c6fd84813fa30f9338"></a><!-- doxytag: member="subdevice::A4L_SUBD_BUSY" ref="gf6114bf76458b8c6fd84813fa30f9338" args="" -->
#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__subdevice.html#gf6114bf76458b8c6fd84813fa30f9338">A4L_SUBD_BUSY</a>&nbsp;&nbsp;&nbsp;(1 &lt;&lt; A4L_SUBD_BUSY_NR)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">The subdevice is busy, a synchronous or an asynchronous acquisition is occuring. <br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="g6992c2972bde497a4039a21c5436dc75"></a><!-- doxytag: member="subdevice::A4L_SUBD_CLEAN_NR" ref="g6992c2972bde497a4039a21c5436dc75" args="" -->
#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__subdevice.html#g6992c2972bde497a4039a21c5436dc75">A4L_SUBD_CLEAN_NR</a>&nbsp;&nbsp;&nbsp;1</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">The subdevice is about to be cleaned in the middle of the detach procedure. <br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="g9cb84629a30d54bf81ea9daacc077238"></a><!-- doxytag: member="subdevice::A4L_SUBD_CLEAN" ref="g9cb84629a30d54bf81ea9daacc077238" args="" -->
#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__subdevice.html#g9cb84629a30d54bf81ea9daacc077238">A4L_SUBD_CLEAN</a>&nbsp;&nbsp;&nbsp;(1 &lt;&lt; A4L_SUBD_CLEAN_NR)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">The subdevice is busy, a synchronous or an asynchronous acquisition is occuring. <br></td></tr>
<tr><td colspan="2"><br><h2>Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="structa4l__subdevice.html">a4l_subd_t</a> *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__subdevice.html#g32595b3806dd3e73038a2022c0b1e204">a4l_alloc_subd</a> (int sizeof_priv, void(*setup)(<a class="el" href="structa4l__subdevice.html">a4l_subd_t</a> *))</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Allocate a subdevice descriptor.  <a href="#g32595b3806dd3e73038a2022c0b1e204"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__subdevice.html#g229e7725db234534da6e6973c63f1cef">a4l_add_subd</a> (a4l_dev_t *dev, <a class="el" href="structa4l__subdevice.html">a4l_subd_t</a> *subd)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Add a subdevice to the driver descriptor.  <a href="#g229e7725db234534da6e6973c63f1cef"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="structa4l__subdevice.html">a4l_subd_t</a> *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__subdevice.html#ga8b2dfadeac340e288725e1f2ce9b63b">a4l_get_subd</a> (a4l_dev_t *dev, int idx)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Get a pointer to the subdevice descriptor referenced by its registration index.  <a href="#ga8b2dfadeac340e288725e1f2ce9b63b"></a><br></td></tr>
</table>
<hr><h2>Function Documentation</h2>
<a class="anchor" name="g229e7725db234534da6e6973c63f1cef"></a><!-- doxytag: member="driver_facilities.c::a4l_add_subd" ref="g229e7725db234534da6e6973c63f1cef" args="(a4l_dev_t *dev, a4l_subd_t *subd)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int a4l_add_subd           </td>
          <td>(</td>
          <td class="paramtype">a4l_dev_t *&nbsp;</td>
          <td class="paramname"> <em>dev</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structa4l__subdevice.html">a4l_subd_t</a> *&nbsp;</td>
          <td class="paramname"> <em>subd</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Add a subdevice to the driver descriptor. 
<p>
Once the driver descriptor structure is initialized, the function <a class="el" href="group__subdevice.html#g229e7725db234534da6e6973c63f1cef" title="Add a subdevice to the driver descriptor.">a4l_add_subd()</a> must be used so to add some subdevices to the driver.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"><tt>[in]</tt>&nbsp;</td><td valign="top"><em>dev</em>&nbsp;</td><td>Device descriptor structure </td></tr>
    <tr><td valign="top"><tt>[in]</tt>&nbsp;</td><td valign="top"><em>subd</em>&nbsp;</td><td>Subdevice descriptor structure</td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>the index with which the subdevice has been registered, in case of error a negative error code is returned. </dd></dl>

</div>
</div><p>
<a class="anchor" name="g32595b3806dd3e73038a2022c0b1e204"></a><!-- doxytag: member="driver_facilities.c::a4l_alloc_subd" ref="g32595b3806dd3e73038a2022c0b1e204" args="(int sizeof_priv, void(*setup)(a4l_subd_t *))" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="structa4l__subdevice.html">a4l_subd_t</a>* a4l_alloc_subd           </td>
          <td>(</td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>sizeof_priv</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">void(*)(<a class="el" href="structa4l__subdevice.html">a4l_subd_t</a> *)&nbsp;</td>
          <td class="paramname"> <em>setup</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Allocate a subdevice descriptor. 
<p>
This is a helper function so as to get a suitable subdevice descriptor<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"><tt>[in]</tt>&nbsp;</td><td valign="top"><em>sizeof_priv</em>&nbsp;</td><td>Size of the subdevice's private data </td></tr>
    <tr><td valign="top"><tt>[in]</tt>&nbsp;</td><td valign="top"><em>setup</em>&nbsp;</td><td>Setup function to be called after the allocation</td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>the index with which the subdevice has been registered, in case of error a negative error code is returned. </dd></dl>

</div>
</div><p>
<a class="anchor" name="ga8b2dfadeac340e288725e1f2ce9b63b"></a><!-- doxytag: member="driver_facilities.c::a4l_get_subd" ref="ga8b2dfadeac340e288725e1f2ce9b63b" args="(a4l_dev_t *dev, int idx)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="structa4l__subdevice.html">a4l_subd_t</a>* a4l_get_subd           </td>
          <td>(</td>
          <td class="paramtype">a4l_dev_t *&nbsp;</td>
          <td class="paramname"> <em>dev</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>idx</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Get a pointer to the subdevice descriptor referenced by its registration index. 
<p>
This function is scarcely useful as all the drivers callbacks get the related subdevice descriptor as first argument. This function is not optimized, it goes through a linked list to get the proper pointer. So it must not be used in real-time context but at initialization / cleanup time (attach / detach).<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"><tt>[in]</tt>&nbsp;</td><td valign="top"><em>dev</em>&nbsp;</td><td>Device descriptor structure </td></tr>
    <tr><td valign="top"><tt>[in]</tt>&nbsp;</td><td valign="top"><em>idx</em>&nbsp;</td><td>Subdevice index</td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>0 on success, otherwise negative error code. </dd></dl>

</div>
</div><p>
</div>
<hr size="1"><address style="text-align: right;"><small>Generated on Mon Aug 2 12:48:39 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>