diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-05-25 16:30:23 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-05-30 16:16:21 +0200 |
commit | af746b093a12871f7faec81c17f8b67fdd76799e (patch) | |
tree | 032b648c2be669815a51b2f3c59ca70e2ec396b1 | |
parent | 93306058c0417b1c6e950b44ef279e096062dfba (diff) |
score: Use thread queue lock for MrsP
Replace the ISR lock in MRSP_Control with a thread queue. This
simplifies the Classic semaphore implementation. Only the lock part of
the thread queue is used.
-rw-r--r-- | cpukit/rtems/src/semobtain.c | 7 | ||||
-rw-r--r-- | cpukit/score/include/rtems/score/mrsp.h | 15 | ||||
-rw-r--r-- | cpukit/score/include/rtems/score/mrspimpl.h | 12 |
3 files changed, 24 insertions, 10 deletions
diff --git a/cpukit/rtems/src/semobtain.c b/cpukit/rtems/src/semobtain.c index 06c2e1009e..1a73120655 100644 --- a/cpukit/rtems/src/semobtain.c +++ b/cpukit/rtems/src/semobtain.c @@ -33,6 +33,13 @@ THREAD_QUEUE_OBJECT_ASSERT( Core_control.semaphore.Wait_queue ); +#if defined(RTEMS_SMP) +THREAD_QUEUE_OBJECT_ASSERT( + Semaphore_Control, + Core_control.mrsp.Wait_queue +); +#endif + rtems_status_code rtems_semaphore_obtain( rtems_id id, rtems_option option_set, diff --git a/cpukit/score/include/rtems/score/mrsp.h b/cpukit/score/include/rtems/score/mrsp.h index 595884864f..08a2427492 100644 --- a/cpukit/score/include/rtems/score/mrsp.h +++ b/cpukit/score/include/rtems/score/mrsp.h @@ -20,9 +20,9 @@ #if defined(RTEMS_SMP) #include <rtems/score/chain.h> -#include <rtems/score/isrlock.h> #include <rtems/score/scheduler.h> #include <rtems/score/thread.h> +#include <rtems/score/threadq.h> #ifdef __cplusplus extern "C" { @@ -115,6 +115,14 @@ typedef struct { */ struct MRSP_Control { /** + * @brief Lock to protect the resource dependency tree. + * + * This is a thread queue since this simplifies the Classic semaphore + * implementation. Only the lock part of the thread queue is used. + */ + Thread_queue_Control Wait_queue; + + /** * @brief Basic resource control. */ Resource_Control Resource; @@ -127,11 +135,6 @@ struct MRSP_Control { Chain_Control Rivals; /** - * @brief Lock to protect the resource dependency tree. - */ - ISR_LOCK_MEMBER( Lock ) - - /** * @brief The initial priority of the owner before it was elevated to the * ceiling priority. */ diff --git a/cpukit/score/include/rtems/score/mrspimpl.h b/cpukit/score/include/rtems/score/mrspimpl.h index 5a1fcda54d..cdeaff35c1 100644 --- a/cpukit/score/include/rtems/score/mrspimpl.h +++ b/cpukit/score/include/rtems/score/mrspimpl.h @@ -24,6 +24,7 @@ #include <rtems/score/resourceimpl.h> #include <rtems/score/schedulerimpl.h> #include <rtems/score/status.h> +#include <rtems/score/threadqimpl.h> #include <rtems/score/watchdogimpl.h> #include <rtems/score/wkspace.h> @@ -65,7 +66,10 @@ RTEMS_INLINE_ROUTINE void _MRSP_Acquire_critical( Thread_queue_Context *queue_context ) { - _ISR_lock_Acquire( &mrsp->Lock, &queue_context->Lock_context ); + _Thread_queue_Acquire_critical( + &mrsp->Wait_queue, + &queue_context->Lock_context + ); } RTEMS_INLINE_ROUTINE void _MRSP_Release( @@ -73,7 +77,7 @@ RTEMS_INLINE_ROUTINE void _MRSP_Release( Thread_queue_Context *queue_context ) { - _ISR_lock_Release_and_ISR_enable( &mrsp->Lock, &queue_context->Lock_context ); + _Thread_queue_Release( &mrsp->Wait_queue, &queue_context->Lock_context ); } RTEMS_INLINE_ROUTINE bool _MRSP_Restore_priority_filter( @@ -160,7 +164,7 @@ RTEMS_INLINE_ROUTINE Status_Control _MRSP_Initialize( _Resource_Initialize( &mrsp->Resource ); _Chain_Initialize_empty( &mrsp->Rivals ); - _ISR_lock_Initialize( &mrsp->Lock, "MrsP" ); + _Thread_queue_Initialize( &mrsp->Wait_queue ); return STATUS_SUCCESSFUL; } @@ -438,7 +442,7 @@ RTEMS_INLINE_ROUTINE void _MRSP_Destroy( ) { _MRSP_Release( mrsp, queue_context ); - _ISR_lock_Destroy( &mrsp->Lock ); + _Thread_queue_Destroy( &mrsp->Wait_queue ); _Workspace_Free( mrsp->ceiling_priorities ); } |