1 | /** |
---|
2 | * @file |
---|
3 | * |
---|
4 | * @ingroup RTEMSScoreMutex |
---|
5 | * |
---|
6 | * @brief CORE Mutex API |
---|
7 | * |
---|
8 | * This include file contains all the constants and structures associated with |
---|
9 | * the Mutex Handler. A mutex is an enhanced version of the standard Dijkstra |
---|
10 | * binary semaphore used to provide synchronization and mutual exclusion |
---|
11 | * capabilities. |
---|
12 | */ |
---|
13 | |
---|
14 | /* |
---|
15 | * COPYRIGHT (c) 1989-2011. |
---|
16 | * On-Line Applications Research Corporation (OAR). |
---|
17 | * |
---|
18 | * The license and distribution terms for this file may be |
---|
19 | * found in the file LICENSE in this distribution or at |
---|
20 | * http://www.rtems.org/license/LICENSE. |
---|
21 | */ |
---|
22 | |
---|
23 | #ifndef _RTEMS_SCORE_COREMUTEX_H |
---|
24 | #define _RTEMS_SCORE_COREMUTEX_H |
---|
25 | |
---|
26 | #include <rtems/score/thread.h> |
---|
27 | #include <rtems/score/threadq.h> |
---|
28 | #include <rtems/score/priority.h> |
---|
29 | #include <rtems/score/watchdog.h> |
---|
30 | #include <rtems/score/interr.h> |
---|
31 | |
---|
32 | struct _Scheduler_Control; |
---|
33 | |
---|
34 | #ifdef __cplusplus |
---|
35 | extern "C" { |
---|
36 | #endif |
---|
37 | |
---|
38 | /** |
---|
39 | * @defgroup RTEMSScoreMutex Mutex Handler |
---|
40 | * |
---|
41 | * @ingroup RTEMSScore |
---|
42 | * |
---|
43 | * @brief Mutex Handler |
---|
44 | * |
---|
45 | * This handler encapsulates functionality which provides the foundation |
---|
46 | * Mutex services used in all of the APIs supported by RTEMS. |
---|
47 | * |
---|
48 | * @{ |
---|
49 | */ |
---|
50 | |
---|
51 | /** |
---|
52 | * @brief Control block used to manage each mutex. |
---|
53 | * |
---|
54 | * The following defines the control block used to manage each mutex. |
---|
55 | */ |
---|
56 | typedef struct { |
---|
57 | /** |
---|
58 | * @brief The thread queue of this mutex. |
---|
59 | * |
---|
60 | * The owner of the thread queue indicates the mutex owner. |
---|
61 | */ |
---|
62 | Thread_queue_Control Wait_queue; |
---|
63 | } CORE_mutex_Control; |
---|
64 | |
---|
65 | /** |
---|
66 | * @brief The recursive mutex control. |
---|
67 | */ |
---|
68 | typedef struct { |
---|
69 | /** |
---|
70 | * @brief The plain non-recursive mutex. |
---|
71 | */ |
---|
72 | CORE_mutex_Control Mutex; |
---|
73 | |
---|
74 | /** |
---|
75 | * @brief The nest level in case of a recursive seize. |
---|
76 | */ |
---|
77 | unsigned int nest_level; |
---|
78 | } CORE_recursive_mutex_Control; |
---|
79 | |
---|
80 | /** |
---|
81 | * @brief The recursive mutex control with priority ceiling protocol support. |
---|
82 | */ |
---|
83 | typedef struct { |
---|
84 | /** |
---|
85 | * @brief The plain recursive mutex. |
---|
86 | */ |
---|
87 | CORE_recursive_mutex_Control Recursive; |
---|
88 | |
---|
89 | /** |
---|
90 | * @brief The priority ceiling node for the mutex owner. |
---|
91 | */ |
---|
92 | Priority_Node Priority_ceiling; |
---|
93 | |
---|
94 | #if defined(RTEMS_SMP) |
---|
95 | /** |
---|
96 | * @brief The scheduler instance for this priority ceiling mutex. |
---|
97 | */ |
---|
98 | const struct _Scheduler_Control *scheduler; |
---|
99 | #endif |
---|
100 | } CORE_ceiling_mutex_Control; |
---|
101 | |
---|
102 | /** @} */ |
---|
103 | |
---|
104 | #ifdef __cplusplus |
---|
105 | } |
---|
106 | #endif |
---|
107 | |
---|
108 | #endif |
---|
109 | /* end of include file */ |
---|