Changeset 98b52e3 in rtems for cpukit/libdrvmgr


Ignore:
Timestamp:
Dec 4, 2017, 7:48:10 AM (18 months ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
bc5b56a
Parents:
61bd8cd6
git-author:
Sebastian Huber <sebastian.huber@…> (12/04/17 07:48:10)
git-committer:
Sebastian Huber <sebastian.huber@…> (12/06/17 06:13:04)
Message:

drvmgr: Use API mutex

Location:
cpukit/libdrvmgr
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • cpukit/libdrvmgr/drvmgr.c

    r61bd8cd6 r98b52e3  
    3131        .level =                0,
    3232        .initializing_objs =    0,
    33         .lock =                 0,
     33        .lock =                 API_MUTEX_INITIALIZER("_Drvmgr"),
    3434        .root_dev =             {0},
    3535        .root_drv =             NULL,
     
    9696{
    9797        drvmgr_drv_reg_func *drvreg;
    98 
    99         /* drvmgr is already initialized statically by compiler except
    100          * the lock
    101          */
    102         DRVMGR_LOCK_INIT();
    10398
    10499        /* Call driver register functions. */
  • cpukit/libdrvmgr/drvmgr_internal.h

    r61bd8cd6 r98b52e3  
    88 */
    99
     10#include <rtems/score/apimutex.h>
     11
    1012/*  Structure hold all information the driver manager needs to know of. Used
    1113 *  internally by Driver Manager routines.
     
    1618
    1719        /* Device tree Lock */
    18         rtems_id                lock;
     20        API_Mutex_Control       lock;
    1921
    2022        /* The first device - The root device and it's driver */
     
    5052extern void _DRV_Manager_Lock(void);
    5153extern void _DRV_Manager_Unlock(void);
    52 extern int _DRV_Manager_Init_Lock(void);
    5354
    5455/* The best solution is to implement the locking with a RW lock, however there
     
    5758 */
    5859#if defined(DRVMGR_USE_LOCKS) && (DRVMGR_USE_LOCKS == 1)
    59  #define DRVMGR_LOCK_INIT() _DRV_Manager_Init_Lock()
    6060 #define DRVMGR_LOCK_WRITE() _DRV_Manager_Lock()
    6161 #define DRVMGR_LOCK_READ() _DRV_Manager_Lock()
     
    6363#else
    6464 /* no locking */
    65  #define DRVMGR_LOCK_INIT()
    6665 #define DRVMGR_LOCK_WRITE()
    6766 #define DRVMGR_LOCK_READ()
  • cpukit/libdrvmgr/drvmgr_lock.c

    r61bd8cd6 r98b52e3  
    1414void _DRV_Manager_Lock(void)
    1515{
    16         rtems_semaphore_obtain(drvmgr.lock, RTEMS_WAIT, RTEMS_NO_TIMEOUT);
     16        _API_Mutex_Lock(&drvmgr.lock);
    1717}
    1818
    1919void _DRV_Manager_Unlock(void)
    2020{
    21         rtems_semaphore_release(drvmgr.lock);
     21        _API_Mutex_Unlock(&drvmgr.lock);
    2222}
    23 
    24 int _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 TracChangeset for help on using the changeset viewer.