4.115
Last change
on this file since 30594a9 was
e7fade3,
checked in by Daniel Hellstrom <daniel@…>, on 11/28/11 at 08:52:03
|
DRVMGR: added driver manager to cpukit/libdrvmgr
|
-
Property mode set to
100644
|
File size:
855 bytes
|
Line | |
---|
1 | /* Driver Manager optional dynamic function interface |
---|
2 | * |
---|
3 | * COPYRIGHT (c) 2011. |
---|
4 | * Cobham Gaisler AB. |
---|
5 | * |
---|
6 | * The license and distribution terms for this file may be |
---|
7 | * found in the file LICENSE in this distribution or at |
---|
8 | * http://www.rtems.com/license/LICENSE. |
---|
9 | */ |
---|
10 | |
---|
11 | #include <drvmgr/drvmgr.h> |
---|
12 | |
---|
13 | /* Get Function from Function ID */ |
---|
14 | int drvmgr_func_get(void *obj, int funcid, void **func) |
---|
15 | { |
---|
16 | int objtype; |
---|
17 | struct drvmgr_func *f; |
---|
18 | |
---|
19 | if (!obj) |
---|
20 | return DRVMGR_FAIL; |
---|
21 | objtype = *(int *)obj; |
---|
22 | |
---|
23 | if (objtype == DRVMGR_OBJ_BUS) |
---|
24 | f = ((struct drvmgr_bus *)obj)->funcs; |
---|
25 | else if (objtype == DRVMGR_OBJ_DRV) |
---|
26 | f = ((struct drvmgr_drv *)obj)->funcs; |
---|
27 | else |
---|
28 | return DRVMGR_FAIL; |
---|
29 | |
---|
30 | if (f == NULL) |
---|
31 | return DRVMGR_FAIL; |
---|
32 | |
---|
33 | while (f->funcid != DRVMGR_FUNCID_NONE) { |
---|
34 | if (f->funcid == funcid) { |
---|
35 | *func = f->func; |
---|
36 | return DRVMGR_OK; |
---|
37 | } |
---|
38 | f++; |
---|
39 | } |
---|
40 | |
---|
41 | return DRVMGR_FAIL; |
---|
42 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.