source: rtems/cpukit/score/src/apimutex.c @ 33e250c9

5
Last change on this file since 33e250c9 was 33e250c9, checked in by Sebastian Huber <sebastian.huber@…>, on 05/27/16 at 13:41:41

score: Rework CORE priority ceiling mutex

Rework seize and surrender methods to use CORE_ceiling_mutex_Control.
This eliminates CORE_mutex_Disciplines.

  • Property mode set to 100644
File size: 1.6 KB
Line 
1/**
2 * @file
3 *
4 * @brief Initialization and Allocation for API Mutex Handler
5 *
6 * @ingroup ScoreAPIMutex
7 */
8
9/*
10 *  COPYRIGHT (c) 1989-2007.
11 *  On-Line Applications Research Corporation (OAR).
12 *
13 *  The license and distribution terms for this file may be
14 *  found in the file LICENSE in this distribution or at
15 *  http://www.rtems.org/license/LICENSE.
16 */
17
18#if HAVE_CONFIG_H
19#include "config.h"
20#endif
21
22#include <rtems/score/apimutex.h>
23#include <rtems/score/coremuteximpl.h>
24#include <rtems/score/objectimpl.h>
25
26static Objects_Information _API_Mutex_Information;
27
28void _API_Mutex_Initialization(
29  uint32_t maximum_mutexes
30)
31{
32  _Objects_Initialize_information(
33    &_API_Mutex_Information,     /* object information table */
34    OBJECTS_INTERNAL_API,        /* object API */
35    OBJECTS_INTERNAL_MUTEXES,    /* object class */
36    maximum_mutexes,             /* maximum objects of this class */
37    sizeof( API_Mutex_Control ), /* size of this object's control block */
38    false,                       /* true if the name is a string */
39    0,                           /* maximum length of an object name */
40    NULL                         /* Proxy extraction support callout */
41  );
42}
43
44void _API_Mutex_Allocate(
45  API_Mutex_Control **the_mutex
46)
47{
48  API_Mutex_Control *mutex;
49
50  CORE_mutex_Attributes attr =  {
51    CORE_MUTEX_NESTING_ACQUIRES
52  };
53
54  mutex = (API_Mutex_Control *)
55    _Objects_Allocate_unprotected( &_API_Mutex_Information );
56
57  _Assert( mutex != NULL );
58
59  _CORE_mutex_Initialize( &mutex->Mutex, NULL, &attr, false );
60
61  _Objects_Open_u32( &_API_Mutex_Information, &mutex->Object, 1 );
62
63  *the_mutex = mutex;
64}
Note: See TracBrowser for help on using the repository browser.