RTEMS
Main Page
Related Pages
Modules
+
Classes
Class List
Class Index
+
Class Members
+
All
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
y
+
Variables
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
y
+
Files
File List
+
File Members
+
All
_
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
v
w
+
Functions
_
b
c
g
m
p
r
s
t
u
v
+
Variables
_
b
c
r
+
Typedefs
b
c
f
h
i
o
p
r
s
t
u
w
+
Enumerations
c
h
i
m
o
p
r
s
t
w
+
Enumerator
c
h
i
m
p
r
s
t
w
+
Macros
_
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
w
•
All
Classes
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Modules
Pages
bsps
shared
grlib
amba
ambapp_find_by_idx.c
1
/*
2
* AMBA Plug & Play routines
3
*
4
* COPYRIGHT (c) 2011
5
* Aeroflex Gaisler
6
*
7
* The license and distribution terms for this file may be
8
* found in the file LICENSE in this distribution or at
9
* http://www.rtems.org/license/LICENSE.
10
*/
11
12
#include <
grlib/ambapp.h
>
13
14
/* AMBAPP helper routine to find a device by index. The function is given to
15
* ambapp_for_each, the argument may be NULL (find first device) or a pointer
16
* to a index which is downcounted until 0 is reached. If the int-pointer
17
* points to a value of:
18
* 0 - first device is returned
19
* 1 - second device is returned
20
* ...
21
*
22
* The matching device is returned, which will stop the ambapp_for_each search.
23
* If zero is returned from ambapp_for_each no device matching the index was
24
* found
25
*/
26
int
ambapp_find_by_idx(
struct
ambapp_dev
*dev,
int
index,
void
*pcount)
27
{
28
int
*pi = pcount;
29
30
if
(pi) {
31
if
((*pi)-- == 0)
32
return
(
int
)dev;
33
else
34
return
0;
35
}
else
{
36
/* Satisfied with first matching device, stop search */
37
return
(
int
)dev;
38
}
39
}
ambapp_dev
Definition:
ambapp.h:73
ambapp.h
Generated by
1.8.14