[739df1f5] | 1 | /** |
---|
| 2 | * @file |
---|
| 3 | * |
---|
| 4 | * @ingroup ClassicSemImpl |
---|
| 5 | * |
---|
| 6 | * @brief Classic Semaphore Manager Data Structures |
---|
| 7 | */ |
---|
| 8 | |
---|
| 9 | /* |
---|
| 10 | * COPYRIGHT (c) 1989-2008, 2016. |
---|
| 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 | #ifndef _RTEMS_RTEMS_SEMDATA_H |
---|
| 19 | #define _RTEMS_RTEMS_SEMDATA_H |
---|
| 20 | |
---|
| 21 | #include <rtems/rtems/sem.h> |
---|
| 22 | #include <rtems/score/coremutex.h> |
---|
| 23 | #include <rtems/score/coresem.h> |
---|
| 24 | #include <rtems/score/mrsp.h> |
---|
| 25 | #include <rtems/score/object.h> |
---|
| 26 | |
---|
| 27 | #ifdef __cplusplus |
---|
| 28 | extern "C" { |
---|
| 29 | #endif |
---|
| 30 | |
---|
| 31 | /** |
---|
| 32 | * @addtogroup ClassicSemImpl |
---|
| 33 | * |
---|
| 34 | * @{ |
---|
| 35 | */ |
---|
| 36 | |
---|
| 37 | /** |
---|
| 38 | * The following defines the control block used to manage each semaphore. |
---|
| 39 | */ |
---|
| 40 | typedef struct { |
---|
| 41 | /** This field is the object management portion of a Semaphore instance. */ |
---|
| 42 | Objects_Control Object; |
---|
| 43 | |
---|
| 44 | /** |
---|
| 45 | * This contains the memory associated with the SuperCore Semaphore or |
---|
| 46 | * Mutex instance that provides the primary functionality of each |
---|
| 47 | * Classic API Semaphore instance. The structure used is dependent |
---|
| 48 | * on the attributes specified by the user on the create directive. |
---|
| 49 | * |
---|
| 50 | * @note Only one of these has meaning in a particular Classic API |
---|
| 51 | * Semaphore instance. |
---|
| 52 | */ |
---|
| 53 | union { |
---|
| 54 | /** |
---|
| 55 | * @brief The thread queue present in all other variants. |
---|
| 56 | */ |
---|
| 57 | Thread_queue_Control Wait_queue; |
---|
| 58 | |
---|
| 59 | /** |
---|
| 60 | * This is the SuperCore Mutex instance associated with this Classic |
---|
| 61 | * API Semaphore instance. |
---|
| 62 | */ |
---|
| 63 | CORE_ceiling_mutex_Control Mutex; |
---|
| 64 | |
---|
| 65 | /** |
---|
| 66 | * This is the SuperCore Semaphore instance associated with this Classic |
---|
| 67 | * API Semaphore instance. |
---|
| 68 | */ |
---|
| 69 | CORE_semaphore_Control Semaphore; |
---|
| 70 | |
---|
| 71 | #if defined(RTEMS_SMP) |
---|
| 72 | MRSP_Control MRSP; |
---|
| 73 | #endif |
---|
| 74 | } Core_control; |
---|
| 75 | |
---|
| 76 | /** |
---|
| 77 | * @brief The semaphore variant. |
---|
| 78 | * |
---|
| 79 | * @see Semaphore_Variant. |
---|
| 80 | */ |
---|
| 81 | unsigned int variant : 3; |
---|
| 82 | |
---|
| 83 | /** |
---|
| 84 | * @brief The semaphore thread queue discipline. |
---|
| 85 | * |
---|
| 86 | * @see Semaphore_Discipline. |
---|
| 87 | */ |
---|
| 88 | unsigned int discipline : 1; |
---|
| 89 | |
---|
| 90 | #if defined(RTEMS_MULTIPROCESSING) |
---|
| 91 | unsigned int is_global : 1; |
---|
| 92 | #endif |
---|
| 93 | } Semaphore_Control; |
---|
| 94 | |
---|
[21275b58] | 95 | /** |
---|
| 96 | * @brief The Classic Semaphore objects information. |
---|
| 97 | */ |
---|
| 98 | extern Objects_Information _Semaphore_Information; |
---|
| 99 | |
---|
| 100 | #if defined(RTEMS_MULTIPROCESSING) |
---|
| 101 | /** |
---|
| 102 | * @brief Semaphore MP Send Extract Proxy |
---|
| 103 | * |
---|
| 104 | * This routine is invoked when a task is deleted and it |
---|
| 105 | * has a proxy which must be removed from a thread queue and |
---|
| 106 | * the remote node must be informed of this. |
---|
| 107 | */ |
---|
| 108 | void _Semaphore_MP_Send_extract_proxy ( |
---|
| 109 | Thread_Control *the_thread, |
---|
| 110 | Objects_Id id |
---|
| 111 | ); |
---|
| 112 | #endif |
---|
| 113 | |
---|
| 114 | /** |
---|
| 115 | * @brief Macro to define the objects information for the Classic Semaphore |
---|
| 116 | * objects. |
---|
| 117 | * |
---|
| 118 | * This macro should only be used by <rtems/confdefs.h>. |
---|
| 119 | * |
---|
| 120 | * @param max The configured object maximum (the OBJECTS_UNLIMITED_OBJECTS flag |
---|
| 121 | * may be set). |
---|
| 122 | */ |
---|
| 123 | #define SEMAPHORE_INFORMATION_DEFINE( max ) \ |
---|
| 124 | OBJECTS_INFORMATION_DEFINE( \ |
---|
| 125 | _Semaphore, \ |
---|
| 126 | OBJECTS_CLASSIC_API, \ |
---|
| 127 | OBJECTS_RTEMS_SEMAPHORES, \ |
---|
| 128 | Semaphore_Control, \ |
---|
| 129 | max, \ |
---|
| 130 | OBJECTS_NO_STRING_NAME, \ |
---|
| 131 | _Semaphore_MP_Send_extract_proxy \ |
---|
| 132 | ) |
---|
| 133 | |
---|
[739df1f5] | 134 | /** @} */ |
---|
| 135 | |
---|
| 136 | #ifdef __cplusplus |
---|
| 137 | } |
---|
| 138 | #endif |
---|
| 139 | |
---|
| 140 | #endif |
---|
| 141 | /* end of include file */ |
---|