From ac15b0716af784c68b98076fc81e1d60d6d3f2bc Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Wed, 17 Jul 2013 15:20:03 +0200 Subject: score: Convert to inline function --- cpukit/score/include/rtems/score/coremuteximpl.h | 55 +++++++++++++----------- 1 file changed, 30 insertions(+), 25 deletions(-) diff --git a/cpukit/score/include/rtems/score/coremuteximpl.h b/cpukit/score/include/rtems/score/coremuteximpl.h index 69be9ac393..c35c0f3050 100644 --- a/cpukit/score/include/rtems/score/coremuteximpl.h +++ b/cpukit/score/include/rtems/score/coremuteximpl.h @@ -235,31 +235,36 @@ void _CORE_mutex_Seize_interrupt_blocking( * * If the caller is willing to wait * then they are blocked. */ -#define _CORE_mutex_Seize_body( \ - _the_mutex, _id, _wait, _timeout, _level ) \ - do { \ - if ( _CORE_mutex_Check_dispatch_for_seize(_wait) ) { \ - _Internal_error_Occurred( \ - INTERNAL_ERROR_CORE, \ - false, \ - INTERNAL_ERROR_MUTEX_OBTAIN_FROM_BAD_STATE \ - ); \ - } \ - if ( _CORE_mutex_Seize_interrupt_trylock( _the_mutex, _level ) ) { \ - if ( !(_wait) ) { \ - _ISR_Enable( _level ); \ - _Thread_Executing->Wait.return_code = \ - CORE_MUTEX_STATUS_UNSATISFIED_NOWAIT; \ - } else { \ - _Thread_queue_Enter_critical_section( &(_the_mutex)->Wait_queue ); \ - _Thread_Executing->Wait.queue = &(_the_mutex)->Wait_queue; \ - _Thread_Executing->Wait.id = _id; \ - _Thread_Disable_dispatch(); \ - _ISR_Enable( _level ); \ - _CORE_mutex_Seize_interrupt_blocking( _the_mutex, _timeout ); \ - } \ - } \ - } while (0) +RTEMS_INLINE_ROUTINE void _CORE_mutex_Seize_body( + CORE_mutex_Control *the_mutex, + Objects_Id id, + bool wait, + Watchdog_Interval timeout, + ISR_Level level +) +{ + if ( _CORE_mutex_Check_dispatch_for_seize( wait ) ) { + _Internal_error_Occurred( + INTERNAL_ERROR_CORE, + false, + INTERNAL_ERROR_MUTEX_OBTAIN_FROM_BAD_STATE + ); + } + if ( _CORE_mutex_Seize_interrupt_trylock( the_mutex, level ) ) { + if ( !wait ) { + _ISR_Enable( level ); + _Thread_Executing->Wait.return_code = + CORE_MUTEX_STATUS_UNSATISFIED_NOWAIT; + } else { + _Thread_queue_Enter_critical_section( &the_mutex->Wait_queue ); + _Thread_Executing->Wait.queue = &the_mutex->Wait_queue; + _Thread_Executing->Wait.id = id; + _Thread_Disable_dispatch(); + _ISR_Enable( level ); + _CORE_mutex_Seize_interrupt_blocking( the_mutex, timeout ); + } + } +} /** * This method is used to obtain a core mutex. -- cgit v1.2.3