RTEMS CPU Kit with SuperCore  4.11.3
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/sem.h>
23 #include <rtems/score/mrspimpl.h>
24 
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 
40 #ifndef RTEMS_SEM_EXTERN
41 #define RTEMS_SEM_EXTERN extern
42 #endif
43 
49 
50 extern const rtems_status_code
51  _Semaphore_Translate_core_mutex_return_code_[];
52 
53 extern const rtems_status_code
54  _Semaphore_Translate_core_semaphore_return_code_[];
55 
62 
75  uint32_t status
76 )
77 {
78  /*
79  * If this thread is blocking waiting for a result on a remote operation.
80  */
81  #if defined(RTEMS_MULTIPROCESSING)
82  if ( _Thread_Is_proxy_blocking(status) )
83  return RTEMS_PROXY_BLOCKING;
84  #endif
85 
86  /*
87  * Internal consistency check for bad status from SuperCore
88  */
89  #if defined(RTEMS_DEBUG)
90  if ( status > CORE_MUTEX_STATUS_LAST )
91  return RTEMS_INTERNAL_ERROR;
92  #endif
93  return _Semaphore_Translate_core_mutex_return_code_[status];
94 }
95 
96 #if defined(RTEMS_SMP)
98 _Semaphore_Translate_MRSP_status_code( MRSP_Status mrsp_status )
99 {
100  return (rtems_status_code) mrsp_status;
101 }
102 #endif
103 
116  uint32_t status
117 )
118 {
119  #if defined(RTEMS_MULTIPROCESSING)
120  if ( _Thread_Is_proxy_blocking(status) )
121  return RTEMS_PROXY_BLOCKING;
122  #endif
123  /*
124  * Internal consistency check for bad status from SuperCore
125  */
126  #if defined(RTEMS_DEBUG)
127  if ( status > CORE_SEMAPHORE_STATUS_LAST )
128  return RTEMS_INTERNAL_ERROR;
129  #endif
130  return _Semaphore_Translate_core_semaphore_return_code_[status];
131 }
132 
141 {
142  return (Semaphore_Control *) _Objects_Allocate( &_Semaphore_Information );
143 }
144 
153  Semaphore_Control *the_semaphore
154 )
155 {
156  _Objects_Free( &_Semaphore_Information, &the_semaphore->Object );
157 }
158 
171  Objects_Id id,
172  Objects_Locations *location
173 )
174 {
175  return (Semaphore_Control *)
176  _Objects_Get( &_Semaphore_Information, id, location );
177 }
178 
191  Objects_Id id,
192  Objects_Locations *location,
193  ISR_lock_Context *lock_context
194 )
195 {
197  &_Semaphore_Information,
198  id,
199  location,
200  lock_context
201  );
202 }
203 
204 #ifdef __cplusplus
205 }
206 #endif
207 
208 #ifdef RTEMS_MULTIPROCESSING
209 #include <rtems/rtems/semmp.h>
210 #endif
211 
212 #endif
213 /* end of include file */
RTEMS_INLINE_ROUTINE rtems_status_code _Semaphore_Translate_core_mutex_return_code(uint32_t status)
Semaphore Translate Core Mutex Return Code.
Definition: semimpl.h:74
void _Objects_Free(Objects_Information *information, Objects_Control *the_object)
Frees an object.
Definition: objectfree.c:25
CORE Mutex Implementation.
RTEMS_INLINE_ROUTINE bool _Thread_Is_proxy_blocking(uint32_t code)
Is proxy blocking.
Definition: threadimpl.h:713
RTEMS_INLINE_ROUTINE Semaphore_Control * _Semaphore_Get_interrupt_disable(Objects_Id id, Objects_Locations *location, ISR_lock_Context *lock_context)
Maps semaphore IDs to semaphore control blocks.
Definition: semimpl.h:190
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:152
Objects_Control * _Objects_Allocate(Objects_Information *information)
Allocates an object.
Definition: objectallocate.c:101
#define RTEMS_INLINE_ROUTINE
The following (in conjunction with compiler arguments) are used to choose between the use of static i...
Definition: basedefs.h:135
RTEMS_INLINE_ROUTINE rtems_status_code _Semaphore_Translate_core_semaphore_return_code(uint32_t status)
Semaphore Translate Core Semaphore Return Code.
Definition: semimpl.h:115
RTEMS_SEM_EXTERN Objects_Information _Semaphore_Information
The following defines the information control block used to manage this class of objects.
Definition: semimpl.h:48
#define CORE_SEMAPHORE_STATUS_LAST
Core semaphore last status value.
Definition: coresemimpl.h:68
Objects_Control Object
This field is the object management portion of a Semaphore instance.
Definition: sem.h:65
Classic Semaphores API.
Objects_Control * _Objects_Get(Objects_Information *information, Objects_Id id, Objects_Locations *location)
Maps object ids to object control blocks.
Definition: objectget.c:23
#define RTEMS_SEM_EXTERN
Instantiate Semaphore Data.
Definition: semimpl.h:41
rtems_status_code
Classic API Status.
Definition: status.h:46
This is the status is used internally to RTEMS when performing operations on behalf of remote tasks...
Definition: status.h:180
void _Semaphore_Manager_initialization(void)
Semaphore Manager Initialization.
Definition: sem.c:35
This is the status to indicate that an internal RTEMS inconsistency was detected. ...
Definition: status.h:162
The following defines the control block used to manage each semaphore.
Definition: sem.h:63
The following defines the structure for the information used to manage each class of objects...
Definition: objectimpl.h:136
Objects_Locations
This enumerated type lists the locations which may be returned by _Objects_Get.
Definition: objectimpl.h:117
Inlined Routines Associated with the SuperCore Semaphore.
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:140
Local ISR lock context for acquire and release pairs.
Definition: isrlock.h:65
uint32_t Objects_Id
The following type defines the control block used to manage object IDs.
Definition: object.h:122
#define CORE_MUTEX_STATUS_LAST
The last status value.
Definition: coremuteximpl.h:99
Objects_Control * _Objects_Get_isr_disable(Objects_Information *information, Objects_Id id, Objects_Locations *location, ISR_lock_Context *lock_context)
Maps object ids to object control blocks.
Definition: objectgetisr.c:23
RTEMS_INLINE_ROUTINE Semaphore_Control * _Semaphore_Get(Objects_Id id, Objects_Locations *location)
Maps semaphore IDs to semaphore control blocks.
Definition: semimpl.h:170