summaryrefslogtreecommitdiffstats
path: root/cpukit/libdrvmgr/drvmgr_lock.c
diff options
context:
space:
mode:
authorDaniel Hellstrom <daniel@gaisler.com>2011-11-28 09:52:03 +0100
committerDaniel Hellstrom <daniel@gaisler.com>2015-04-17 01:10:16 +0200
commite7fade3ac4559214ab0508dc54a71a3d1f522afb (patch)
tree13e32728a3b6adccd3f435db73091a8233d5dadf /cpukit/libdrvmgr/drvmgr_lock.c
parentLIBPCI: added PCI shell command (diff)
downloadrtems-e7fade3ac4559214ab0508dc54a71a3d1f522afb.tar.bz2
DRVMGR: added driver manager to cpukit/libdrvmgr
Diffstat (limited to 'cpukit/libdrvmgr/drvmgr_lock.c')
-rw-r--r--cpukit/libdrvmgr/drvmgr_lock.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/cpukit/libdrvmgr/drvmgr_lock.c b/cpukit/libdrvmgr/drvmgr_lock.c
new file mode 100644
index 0000000000..d6601d35c9
--- /dev/null
+++ b/cpukit/libdrvmgr/drvmgr_lock.c
@@ -0,0 +1,38 @@
+/* Driver Manager Internal locking implementation
+ *
+ * COPYRIGHT (c) 2009.
+ * Cobham Gaisler AB.
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ */
+
+#include <rtems.h>
+#include <drvmgr/drvmgr.h>
+#include "drvmgr_internal.h"
+
+void _DRV_Manager_Lock(void)
+{
+ rtems_semaphore_obtain(drv_mgr.lock, RTEMS_WAIT, RTEMS_NO_TIMEOUT);
+}
+
+void _DRV_Manager_Unlock(void)
+{
+ rtems_semaphore_release(drv_mgr.lock);
+}
+
+int _DRV_Manager_Init_Lock(void)
+{
+ int rc;
+
+ rc = rtems_semaphore_create(
+ rtems_build_name('D', 'R', 'V', 'M'),
+ 1,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ 0,
+ &drv_mgr.lock);
+ if (rc != RTEMS_SUCCESSFUL)
+ return -1;
+ return 0;
+}