source: rtems/cpukit/score/src/apimutex.c @ eea7c937

4.115
Last change on this file since eea7c937 was a2e3f33, checked in by Sebastian Huber <sebastian.huber@…>, on 07/24/13 at 11:50:54

score: Create object implementation header

Move implementation specific parts of object.h and object.inl into new
header file objectimpl.h. The object.h contains now only the
application visible API.

  • Property mode set to 100644
File size: 1.8 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.com/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#if defined(RTEMS_MULTIPROCESSING)
41    ,
42    true,                        /* true if this is a global object class */
43    NULL                         /* Proxy extraction support callout */
44#endif
45  );
46}
47
48void _API_Mutex_Allocate(
49  API_Mutex_Control **the_mutex
50)
51{
52  API_Mutex_Control *mutex;
53
54  CORE_mutex_Attributes attr =  {
55    CORE_MUTEX_NESTING_ACQUIRES,
56    false,
57    CORE_MUTEX_DISCIPLINES_PRIORITY_INHERIT,
58    0
59  };
60
61  mutex = (API_Mutex_Control *) _Objects_Allocate( &_API_Mutex_Information );
62
63  _CORE_mutex_Initialize( &mutex->Mutex, NULL, &attr, CORE_MUTEX_UNLOCKED );
64
65  _Objects_Open_u32( &_API_Mutex_Information, &mutex->Object, 1 );
66
67  *the_mutex = mutex;
68}
Note: See TracBrowser for help on using the repository browser.