forked from Imagelibrary/rtems
@@ -59,6 +59,22 @@ RTEMS_INLINE_ROUTINE void _ASR_Destroy( ASR_Information *asr )
|
||||
_ISR_lock_Destroy( &asr->Lock );
|
||||
}
|
||||
|
||||
RTEMS_INLINE_ROUTINE void _ASR_Acquire(
|
||||
ASR_Information *asr,
|
||||
ISR_lock_Context *lock_context
|
||||
)
|
||||
{
|
||||
_ISR_lock_ISR_disable_and_acquire( &asr->Lock, lock_context );
|
||||
}
|
||||
|
||||
RTEMS_INLINE_ROUTINE void _ASR_Release(
|
||||
ASR_Information *asr,
|
||||
ISR_lock_Context *lock_context
|
||||
)
|
||||
{
|
||||
_ISR_lock_Release_and_ISR_enable( &asr->Lock, lock_context );
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ASR_Swap_signals
|
||||
*
|
||||
@@ -73,11 +89,11 @@ RTEMS_INLINE_ROUTINE void _ASR_Swap_signals (
|
||||
rtems_signal_set _signals;
|
||||
ISR_lock_Context lock_context;
|
||||
|
||||
_ISR_lock_ISR_disable_and_acquire( &asr->Lock, &lock_context );
|
||||
_ASR_Acquire( asr, &lock_context );
|
||||
_signals = asr->signals_pending;
|
||||
asr->signals_pending = asr->signals_posted;
|
||||
asr->signals_posted = _signals;
|
||||
_ISR_lock_Release_and_ISR_enable( &asr->Lock, &lock_context );
|
||||
_ASR_Release( asr, &lock_context );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -122,9 +138,9 @@ RTEMS_INLINE_ROUTINE void _ASR_Post_signals(
|
||||
{
|
||||
ISR_lock_Context lock_context;
|
||||
|
||||
_ISR_lock_ISR_disable_and_acquire( &asr->Lock, &lock_context );
|
||||
_ASR_Acquire( asr, &lock_context );
|
||||
*signal_set |= signals;
|
||||
_ISR_lock_Release_and_ISR_enable( &asr->Lock, &lock_context );
|
||||
_ASR_Release( asr, &lock_context );
|
||||
}
|
||||
|
||||
RTEMS_INLINE_ROUTINE rtems_signal_set _ASR_Get_posted_signals(
|
||||
@@ -134,10 +150,10 @@ RTEMS_INLINE_ROUTINE rtems_signal_set _ASR_Get_posted_signals(
|
||||
rtems_signal_set signal_set;
|
||||
ISR_lock_Context lock_context;
|
||||
|
||||
_ISR_lock_ISR_disable_and_acquire( &asr->Lock, &lock_context );
|
||||
_ASR_Acquire( asr, &lock_context );
|
||||
signal_set = asr->signals_posted;
|
||||
asr->signals_posted = 0;
|
||||
_ISR_lock_Release_and_ISR_enable( &asr->Lock, &lock_context );
|
||||
_ASR_Release( asr, &lock_context );
|
||||
|
||||
return signal_set;
|
||||
}
|
||||
|
||||
@@ -72,21 +72,22 @@ rtems_status_code rtems_signal_catch(
|
||||
Thread_Control *executing;
|
||||
RTEMS_API_Control *api;
|
||||
ASR_Information *asr;
|
||||
ISR_lock_Context lock_context;
|
||||
|
||||
executing = _Thread_Get_executing();
|
||||
api = (RTEMS_API_Control*)executing->API_Extensions[ THREAD_API_RTEMS ];
|
||||
asr = &api->Signal;
|
||||
|
||||
_Thread_Disable_dispatch(); /* cannot reschedule while */
|
||||
/* the thread is inconsistent */
|
||||
_ASR_Acquire( asr, &lock_context );
|
||||
|
||||
if ( !_ASR_Is_null_handler( asr_handler ) ) {
|
||||
asr->mode_set = mode_set;
|
||||
asr->handler = asr_handler;
|
||||
}
|
||||
else
|
||||
} else {
|
||||
_ASR_Initialize( asr );
|
||||
_Thread_Enable_dispatch();
|
||||
}
|
||||
|
||||
_ASR_Release( asr, &lock_context );
|
||||
return RTEMS_SUCCESSFUL;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user