RTEMS  5.0.0
semimpl.h
Go to the documentation of this file.
1 
9 /* COPYRIGHT (c) 1989-2008.
10  * On-Line Applications Research Corporation (OAR).
11  *
12  * The license and distribution terms for this file may be
13  * found in the file LICENSE in this distribution or at
14  * http://www.rtems.org/license/LICENSE.
15  */
16 
17 #ifndef _RTEMS_RTEMS_SEMIMPL_H
18 #define _RTEMS_RTEMS_SEMIMPL_H
19 
20 #include <rtems/rtems/semdata.h>
23 #include <rtems/score/mrspimpl.h>
24 
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 
42 typedef enum {
43  SEMAPHORE_VARIANT_MUTEX_INHERIT_PRIORITY,
44  SEMAPHORE_VARIANT_MUTEX_PRIORITY_CEILING,
45  SEMAPHORE_VARIANT_MUTEX_NO_PROTOCOL,
46  SEMAPHORE_VARIANT_SIMPLE_BINARY,
47  SEMAPHORE_VARIANT_COUNTING
48 #if defined(RTEMS_SMP)
49  ,
50  SEMAPHORE_VARIANT_MRSP
51 #endif
53 
54 typedef enum {
55  SEMAPHORE_DISCIPLINE_PRIORITY,
56  SEMAPHORE_DISCIPLINE_FIFO
57 } Semaphore_Discipline;
58 
59 RTEMS_INLINE_ROUTINE const Thread_queue_Operations *_Semaphore_Get_operations(
60  const Semaphore_Control *the_semaphore
61 )
62 {
63  if ( the_semaphore->variant == SEMAPHORE_VARIANT_MUTEX_INHERIT_PRIORITY ) {
64  return &_Thread_queue_Operations_priority_inherit;
65  }
66 
67  if ( the_semaphore->discipline == SEMAPHORE_DISCIPLINE_PRIORITY ) {
68  return &_Thread_queue_Operations_priority;
69  }
70 
71  return &_Thread_queue_Operations_FIFO;
72 }
73 
82 {
84 }
85 
94  Semaphore_Control *the_semaphore
95 )
96 {
97  _Objects_Free( &_Semaphore_Information, &the_semaphore->Object );
98 }
99 
101  Objects_Id id,
102  Thread_queue_Context *queue_context
103 )
104 {
105  _Thread_queue_Context_initialize( queue_context );
106  return (Semaphore_Control *) _Objects_Get(
107  id,
108  &queue_context->Lock_context.Lock_context,
110  );
111 }
112 
115 #ifdef __cplusplus
116 }
117 #endif
118 
119 #ifdef RTEMS_MULTIPROCESSING
120 #include <rtems/rtems/semmp.h>
121 #endif
122 
123 #endif
124 /* end of include file */
void _Objects_Free(Objects_Information *information, Objects_Control *the_object)
Frees an object.
Definition: objectfree.c:25
CORE Mutex Implementation.
Thread queue context for the thread queue methods.
Definition: threadq.h:193
Objects_Control * _Objects_Allocate(Objects_Information *information)
Allocates an object.
Definition: objectallocate.c:89
#define RTEMS_INLINE_ROUTINE
Definition: basedefs.h:65
Objects_Control * _Objects_Get(Objects_Id id, ISR_lock_Context *lock_context, const Objects_Information *information)
Maps the specified object identifier to the associated local object control block.
Definition: objectgetlocal.c:28
Classic Semaphore Manager Data Structures.
Objects_Control Object
Definition: semdata.h:42
RTEMS_INLINE_ROUTINE Semaphore_Control * _Semaphore_Allocate(void)
Allocates a semaphore control block from the inactive chain of free semaphore control blocks...
Definition: semimpl.h:81
RTEMS_INLINE_ROUTINE void _Thread_queue_Context_initialize(Thread_queue_Context *queue_context)
Initializes a thread queue context.
Definition: threadqimpl.h:108
Thread queue operations.
Definition: threadq.h:512
Definition: semdata.h:40
Thread_queue_Lock_context Lock_context
The lock context for the thread queue acquire and release operations.
Definition: threadq.h:198
RTEMS_INLINE_ROUTINE void _Semaphore_Free(Semaphore_Control *the_semaphore)
Frees a semaphore control block to the inactive chain of free semaphore control blocks.
Definition: semimpl.h:93
unsigned int discipline
The semaphore thread queue discipline.
Definition: semdata.h:88
Inlined Routines Associated with the SuperCore Semaphore.
Objects_Information _Semaphore_Information
The Classic Semaphore objects information.
ISR_lock_Context Lock_context
The lock context for the thread queue acquire and release operations.
Definition: threadq.h:125
uint32_t Objects_Id
Definition: object.h:75
Semaphore_Variant
Classic semaphore variants.
Definition: semimpl.h:42
unsigned int variant
The semaphore variant.
Definition: semdata.h:81