source: rtems/cpukit/libdrvmgr/drvmgr_lock.c @ 7075fb11

5
Last change on this file since 7075fb11 was bb2f220, checked in by Daniel Hellstrom <daniel@…>, on 04/13/15 at 08:49:47

DRVMGR: renamed private drv_mgr and its struct name

  • Property mode set to 100644
File size: 736 bytes
Line 
1/* Driver Manager Internal locking implementation
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.h>
11#include <drvmgr/drvmgr.h>
12#include "drvmgr_internal.h"
13
14void _DRV_Manager_Lock(void)
15{
16        rtems_semaphore_obtain(drvmgr.lock, RTEMS_WAIT, RTEMS_NO_TIMEOUT);
17}
18
19void _DRV_Manager_Unlock(void)
20{
21        rtems_semaphore_release(drvmgr.lock);
22}
23
24int _DRV_Manager_Init_Lock(void)
25{
26        int rc;
27
28        rc = rtems_semaphore_create(
29                rtems_build_name('D', 'R', 'V', 'M'),
30                1,
31                RTEMS_DEFAULT_ATTRIBUTES,
32                0,
33                &drvmgr.lock);
34        if (rc != RTEMS_SUCCESSFUL)
35                return -1;
36        return 0;
37}
Note: See TracBrowser for help on using the repository browser.