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/score/include/rtems/score/coresemimpl.h | |
parent | rtems: Simplify rtems_semaphore_delete() (diff) | |
download | rtems-2581a563f9182dc2debdba97f33feee6d797e53a.tar.bz2 |
score: Add semaphore variants
Diffstat (limited to 'cpukit/score/include/rtems/score/coresemimpl.h')
-rw-r--r-- | cpukit/score/include/rtems/score/coresemimpl.h | 54 |
1 files changed, 28 insertions, 26 deletions
diff --git a/cpukit/score/include/rtems/score/coresemimpl.h b/cpukit/score/include/rtems/score/coresemimpl.h index a55089e399..24d8c5114d 100644 --- a/cpukit/score/include/rtems/score/coresemimpl.h +++ b/cpukit/score/include/rtems/score/coresemimpl.h @@ -46,13 +46,11 @@ extern "C" { * This routine initializes the semaphore based on the parameters passed. * * @param[in] the_semaphore is the semaphore to initialize - * @param[in] discipline the blocking discipline * @param[in] initial_value is the initial count of the semaphore */ void _CORE_semaphore_Initialize( - CORE_semaphore_Control *the_semaphore, - CORE_semaphore_Disciplines discipline, - uint32_t initial_value + CORE_semaphore_Control *the_semaphore, + uint32_t initial_value ); RTEMS_INLINE_ROUTINE void _CORE_semaphore_Acquire_critical( @@ -78,13 +76,14 @@ RTEMS_INLINE_ROUTINE void _CORE_semaphore_Release( } RTEMS_INLINE_ROUTINE void _CORE_semaphore_Destroy( - CORE_semaphore_Control *the_semaphore, - Thread_queue_Context *queue_context + CORE_semaphore_Control *the_semaphore, + const Thread_queue_Operations *operations, + Thread_queue_Context *queue_context ) { _Thread_queue_Flush_critical( &the_semaphore->Wait_queue.Queue, - the_semaphore->operations, + operations, _Thread_queue_Flush_status_object_was_deleted, queue_context ); @@ -99,15 +98,17 @@ RTEMS_INLINE_ROUTINE void _CORE_semaphore_Destroy( * given to that task. Otherwise, the unit will be returned to the semaphore. * * @param[in] the_semaphore is the semaphore to surrender + * @param[in] operations The thread queue operations. * @param[in] queue_context is a temporary variable used to contain the ISR * disable level cookie * * @retval an indication of whether the routine succeeded or failed */ RTEMS_INLINE_ROUTINE Status_Control _CORE_semaphore_Surrender( - CORE_semaphore_Control *the_semaphore, - uint32_t maximum_count, - Thread_queue_Context *queue_context + CORE_semaphore_Control *the_semaphore, + const Thread_queue_Operations *operations, + uint32_t maximum_count, + Thread_queue_Context *queue_context ) { Thread_Control *the_thread; @@ -119,12 +120,12 @@ RTEMS_INLINE_ROUTINE Status_Control _CORE_semaphore_Surrender( the_thread = _Thread_queue_First_locked( &the_semaphore->Wait_queue, - the_semaphore->operations + operations ); if ( the_thread != NULL ) { _Thread_queue_Extract_critical( &the_semaphore->Wait_queue.Queue, - the_semaphore->operations, + operations, the_thread, queue_context ); @@ -141,13 +142,14 @@ RTEMS_INLINE_ROUTINE Status_Control _CORE_semaphore_Surrender( } RTEMS_INLINE_ROUTINE void _CORE_semaphore_Flush( - CORE_semaphore_Control *the_semaphore, - Thread_queue_Context *queue_context + CORE_semaphore_Control *the_semaphore, + const Thread_queue_Operations *operations, + Thread_queue_Context *queue_context ) { _Thread_queue_Flush_critical( &the_semaphore->Wait_queue.Queue, - the_semaphore->operations, + operations, _Thread_queue_Flush_status_unavailable, queue_context ); @@ -161,7 +163,7 @@ RTEMS_INLINE_ROUTINE void _CORE_semaphore_Flush( * @return the current count of this semaphore */ RTEMS_INLINE_ROUTINE uint32_t _CORE_semaphore_Get_count( - CORE_semaphore_Control *the_semaphore + const CORE_semaphore_Control *the_semaphore ) { return the_semaphore->count; @@ -174,23 +176,23 @@ RTEMS_INLINE_ROUTINE uint32_t _CORE_semaphore_Get_count( * available. * * @param[in] the_semaphore is the semaphore to obtain - * @param[in,out] executing The currently executing thread. + * @param[in] operations The thread queue operations. + * @param[in] executing The currently executing thread. * @param[in] wait is true if the thread is willing to wait * @param[in] timeout is the maximum number of ticks to block * @param[in] queue_context is a temporary variable used to contain the ISR * disable level cookie - * - * @note There is currently no MACRO version of this routine. */ RTEMS_INLINE_ROUTINE Status_Control _CORE_semaphore_Seize( - CORE_semaphore_Control *the_semaphore, - Thread_Control *executing, - bool wait, - Watchdog_Interval timeout, - Thread_queue_Context *queue_context + CORE_semaphore_Control *the_semaphore, + const Thread_queue_Operations *operations, + Thread_Control *executing, + bool wait, + Watchdog_Interval timeout, + Thread_queue_Context *queue_context ) { - /* disabled when you get here */ + _Assert( _ISR_Get_level() != 0 ); _CORE_semaphore_Acquire_critical( the_semaphore, queue_context ); if ( the_semaphore->count != 0 ) { @@ -207,7 +209,7 @@ RTEMS_INLINE_ROUTINE Status_Control _CORE_semaphore_Seize( _Thread_queue_Context_set_expected_level( queue_context, 1 ); _Thread_queue_Enqueue_critical( &the_semaphore->Wait_queue.Queue, - the_semaphore->operations, + operations, executing, STATES_WAITING_FOR_SEMAPHORE, timeout, |