RTEMS: cpukit/libdrvmgr/drvmgr_internal.h Source File

| RTEMS 5.4-rc2

Loading...
Searching...
No Matches
drvmgr_internal.h
1/* Private driver manager declarations
2 *
3 * COPYRIGHT (c) 2009 Cobham Gaisler AB.
4 *
5 * The license and distribution terms for this file may be
6 * found in the file LICENSE in this distribution or at
7 * http://www.rtems.org/license/LICENSE.
8 */
9
10#include <rtems/score/apimutex.h>
11
12/* Structure hold all information the driver manager needs to know of. Used
13 * internally by Driver Manager routines.
14 */
15 struct drvmgr {
16 int level;
17 int initializing_objs;
18
19 /* Device tree Lock */
20 API_Mutex_Control lock;
21
22 /* The first device - The root device and it's driver */
23 struct drvmgr_drv *root_drv;
24 struct drvmgr_dev root_dev;
25
27 struct drvmgr_list drivers;
28
29 /* Buses that reached a certain initialization level.
30 * Lists by Level:
31 * N=0 - Not intialized, just registered
32 * N=1..MAX-1 - Reached init level N
33 * N=MAX - Successfully initialized bus
34 */
35 struct drvmgr_list buses[DRVMGR_LEVEL_MAX+1];
36 /* Buses failed to initialize or has been removed by not freed */
37 struct drvmgr_list buses_inactive;
38
39 /* Devices that reached a certain initialization level.
40 * Lists by Level:
41 * N=0 - Not intialized, just registered
42 * N=1..MAX-1 - Reached init level N
43 * N=MAX - Successfully initialized device
44 */
45 struct drvmgr_list devices[DRVMGR_LEVEL_MAX+1];
47 struct drvmgr_list devices_inactive;
48};
49
50extern struct drvmgr drvmgr;
51
52extern void _DRV_Manager_Lock(void);
53extern void _DRV_Manager_Unlock(void);
54
55/* The best solution is to implement the locking with a RW lock, however there
56 * is no such API available. Care must be taken so that dead-lock isn't created
57 * for example in recursive functions.
58 */
59#if defined(DRVMGR_USE_LOCKS) && (DRVMGR_USE_LOCKS == 1)
60 #define DRVMGR_LOCK_WRITE() _DRV_Manager_Lock()
61 #define DRVMGR_LOCK_READ() _DRV_Manager_Lock()
62 #define DRVMGR_UNLOCK() _DRV_Manager_Unlock()
63#else
64 /* no locking */
65 #define DRVMGR_LOCK_WRITE()
66 #define DRVMGR_LOCK_READ()
67 #define DRVMGR_UNLOCK()
68#endif
apimutex.h
API Mutex Handler API.
API_Mutex_Control
Control block used to manage each API mutex.
Definition: apimutex.h:42
drvmgr_dev
Definition: drvmgr.h:273
drvmgr_drv
Definition: drvmgr.h:303
drvmgr_list
Definition: drvmgr_list.h:24
drvmgr
Definition: drvmgr_internal.h:15
drvmgr::devices
struct drvmgr_list devices[DRVMGR_LEVEL_MAX+1]
Definition: drvmgr_internal.h:45
drvmgr::root_dev
struct drvmgr_dev root_dev
Definition: drvmgr_internal.h:24