diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-05-20 21:39:56 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-05-30 16:16:21 +0200 |
commit | 2581a563f9182dc2debdba97f33feee6d797e53a (patch) | |
tree | 97883371771f9a2905d159d8e11c0b2e9da0408c /cpukit/rtems/include/rtems | |
parent | rtems: Simplify rtems_semaphore_delete() (diff) | |
download | rtems-2581a563f9182dc2debdba97f33feee6d797e53a.tar.bz2 |
score: Add semaphore variants
Diffstat (limited to '')
-rw-r--r-- | cpukit/rtems/include/rtems/rtems/sem.h | 18 | ||||
-rw-r--r-- | cpukit/rtems/include/rtems/rtems/semimpl.h | 25 |
2 files changed, 43 insertions, 0 deletions
diff --git a/cpukit/rtems/include/rtems/rtems/sem.h b/cpukit/rtems/include/rtems/rtems/sem.h index 2c99f57deb..fe74f44dfa 100644 --- a/cpukit/rtems/include/rtems/rtems/sem.h +++ b/cpukit/rtems/include/rtems/rtems/sem.h @@ -97,6 +97,24 @@ typedef struct { } Core_control; /** + * @brief The semaphore variant. + * + * @see Semaphore_Variant. + */ + unsigned int variant : 3; + + /** + * @brief The semaphore thread queue discipline. + * + * @see Semaphore_Discipline. + */ + unsigned int discipline : 1; + +#if defined(RTEMS_MULTIPROCESSING) + unsigned int is_global : 1; +#endif + + /** * This is the Classic API attribute provided to the create directive. * It is translated into behavioral attributes on the SuperCore Semaphore * or Mutex instance. diff --git a/cpukit/rtems/include/rtems/rtems/semimpl.h b/cpukit/rtems/include/rtems/rtems/semimpl.h index a498927691..813f885d5f 100644 --- a/cpukit/rtems/include/rtems/rtems/semimpl.h +++ b/cpukit/rtems/include/rtems/rtems/semimpl.h @@ -26,12 +26,37 @@ extern "C" { #endif +typedef enum { + SEMAPHORE_VARIANT_MUTEX, + SEMAPHORE_VARIANT_COUNTING +#if defined(RTEMS_SMP) + , + SEMAPHORE_VARIANT_MRSP +#endif +} Semaphore_Variant; + +typedef enum { + SEMAPHORE_DISCIPLINE_PRIORITY, + SEMAPHORE_DISCIPLINE_FIFO +} Semaphore_Discipline; + /** * The following defines the information control block used to manage * this class of objects. */ extern Objects_Information _Semaphore_Information; +RTEMS_INLINE_ROUTINE const Thread_queue_Operations *_Semaphore_Get_operations( + const Semaphore_Control *the_semaphore +) +{ + if ( the_semaphore->discipline == SEMAPHORE_DISCIPLINE_PRIORITY ) { + return &_Thread_queue_Operations_priority; + } else { + return &_Thread_queue_Operations_FIFO; + } +} + /** * @brief Allocates a semaphore control block from * the inactive chain of free semaphore control blocks. |