forked from Imagelibrary/rtems
score: ISR lock API changes
This commit is contained in:
@@ -186,7 +186,7 @@ typedef ISR_lock_Control rtems_interrupt_lock;
|
||||
* @see rtems_interrupt_lock_release().
|
||||
*/
|
||||
#define rtems_interrupt_lock_acquire( _lock, _isr_cookie ) \
|
||||
_ISR_lock_Acquire( _lock, _isr_cookie )
|
||||
_ISR_lock_ISR_disable_and_acquire( _lock, _isr_cookie )
|
||||
|
||||
/**
|
||||
* @brief Releases an interrupt lock.
|
||||
@@ -202,7 +202,7 @@ typedef ISR_lock_Control rtems_interrupt_lock;
|
||||
* @see rtems_interrupt_lock_acquire().
|
||||
*/
|
||||
#define rtems_interrupt_lock_release( _lock, _isr_cookie ) \
|
||||
_ISR_lock_Release( _lock, _isr_cookie )
|
||||
_ISR_lock_Release_and_ISR_enable( _lock, _isr_cookie )
|
||||
|
||||
/**
|
||||
* @brief Acquires an interrupt lock in the corresponding interrupt service
|
||||
@@ -219,15 +219,8 @@ typedef ISR_lock_Control rtems_interrupt_lock;
|
||||
*
|
||||
* @see rtems_interrupt_lock_release_isr().
|
||||
*/
|
||||
#if defined( RTEMS_SMP )
|
||||
#define rtems_interrupt_lock_acquire_isr( _lock ) \
|
||||
_SMP_lock_Acquire( &( _lock )->lock )
|
||||
#else
|
||||
#define rtems_interrupt_lock_acquire_isr( _lock ) \
|
||||
do { \
|
||||
(void) _lock; \
|
||||
} while (0)
|
||||
#endif
|
||||
#define rtems_interrupt_lock_acquire_isr( _lock ) \
|
||||
_ISR_lock_Acquire( _lock )
|
||||
|
||||
/**
|
||||
* @brief Releases an interrupt lock in the corresponding interrupt service
|
||||
@@ -240,15 +233,8 @@ typedef ISR_lock_Control rtems_interrupt_lock;
|
||||
*
|
||||
* @see rtems_interrupt_lock_acquire_isr().
|
||||
*/
|
||||
#if defined( RTEMS_SMP )
|
||||
#define rtems_interrupt_lock_release_isr( _lock ) \
|
||||
_SMP_lock_Release( &( _lock )->lock )
|
||||
#else
|
||||
#define rtems_interrupt_lock_release_isr( _lock ) \
|
||||
do { \
|
||||
(void) _lock; \
|
||||
} while (0)
|
||||
#endif
|
||||
#define rtems_interrupt_lock_release_isr( _lock ) \
|
||||
_ISR_lock_Release( _lock )
|
||||
|
||||
/** @} */
|
||||
|
||||
|
||||
@@ -95,13 +95,13 @@ typedef struct {
|
||||
* @param[in,out] _lock The ISR lock control.
|
||||
* @param[out] _isr_cookie The interrupt status to restore will be returned.
|
||||
*
|
||||
* @see _ISR_lock_Release().
|
||||
* @see _ISR_lock_Release_and_ISR_enable().
|
||||
*/
|
||||
#if defined( RTEMS_SMP )
|
||||
#define _ISR_lock_Acquire( _lock, _isr_cookie ) \
|
||||
#define _ISR_lock_ISR_disable_and_acquire( _lock, _isr_cookie ) \
|
||||
_SMP_lock_ISR_disable_and_acquire( &( _lock )->lock, _isr_cookie )
|
||||
#else
|
||||
#define _ISR_lock_Acquire( _lock, _isr_cookie ) \
|
||||
#define _ISR_lock_ISR_disable_and_acquire( _lock, _isr_cookie ) \
|
||||
do { \
|
||||
(void) _lock; \
|
||||
_ISR_Disable( _isr_cookie ); \
|
||||
@@ -119,19 +119,63 @@ typedef struct {
|
||||
* @param[in,out] _lock The ISR lock control.
|
||||
* @param[in] _isr_cookie The interrupt status to restore.
|
||||
*
|
||||
* @see _ISR_lock_Acquire().
|
||||
* @see _ISR_lock_ISR_disable_and_acquire().
|
||||
*/
|
||||
#if defined( RTEMS_SMP )
|
||||
#define _ISR_lock_Release( _lock, _isr_cookie ) \
|
||||
#define _ISR_lock_Release_and_ISR_enable( _lock, _isr_cookie ) \
|
||||
_SMP_lock_Release_and_ISR_enable( &( _lock )->lock, _isr_cookie )
|
||||
#else
|
||||
#define _ISR_lock_Release( _lock, _isr_cookie ) \
|
||||
#define _ISR_lock_Release_and_ISR_enable( _lock, _isr_cookie ) \
|
||||
do { \
|
||||
(void) _lock; \
|
||||
_ISR_Enable( _isr_cookie ); \
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Acquires an ISR lock inside an ISR disabled section.
|
||||
*
|
||||
* The interrupt status will remain unchanged. On SMP configurations this
|
||||
* function acquires an SMP lock.
|
||||
*
|
||||
* In case the executing context can be interrupted by higher priority
|
||||
* interrupts and these interrupts enter the critical section protected by this
|
||||
* lock, then the result is unpredictable.
|
||||
*
|
||||
* @param[in,out] _lock The ISR lock control.
|
||||
*
|
||||
* @see _ISR_lock_Release().
|
||||
*/
|
||||
#if defined( RTEMS_SMP )
|
||||
#define _ISR_lock_Acquire( _lock ) \
|
||||
_SMP_lock_Acquire( &( _lock )->lock )
|
||||
#else
|
||||
#define _ISR_lock_Acquire( _lock ) \
|
||||
do { \
|
||||
(void) _lock; \
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Releases an ISR lock inside an ISR disabled section.
|
||||
*
|
||||
* The interrupt status will remain unchanged. On SMP configurations this
|
||||
* function releases an SMP lock.
|
||||
*
|
||||
* @param[in,out] _lock The ISR lock control.
|
||||
*
|
||||
* @see _ISR_lock_Acquire().
|
||||
*/
|
||||
#if defined( RTEMS_SMP )
|
||||
#define _ISR_lock_Release( _lock ) \
|
||||
_SMP_lock_Release( &( _lock )->lock )
|
||||
#else
|
||||
#define _ISR_lock_Release( _lock ) \
|
||||
do { \
|
||||
(void) _lock; \
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -54,9 +54,15 @@ static void test_isr_locks( void )
|
||||
_ISR_lock_Initialize( &lock );
|
||||
rtems_test_assert( memcmp( &lock, &initialized, sizeof( lock ) ) == 0 );
|
||||
|
||||
_ISR_lock_Acquire( &lock, level );
|
||||
_ISR_lock_ISR_disable_and_acquire( &lock, level );
|
||||
rtems_test_assert( normal_interrupt_level != _ISR_Get_level() );
|
||||
_ISR_lock_Release( &lock, level );
|
||||
_ISR_lock_Release_and_ISR_enable( &lock, level );
|
||||
|
||||
rtems_test_assert( normal_interrupt_level == _ISR_Get_level() );
|
||||
|
||||
_ISR_lock_Acquire( &lock );
|
||||
rtems_test_assert( normal_interrupt_level == _ISR_Get_level() );
|
||||
_ISR_lock_Release( &lock );
|
||||
|
||||
rtems_test_assert( normal_interrupt_level == _ISR_Get_level() );
|
||||
}
|
||||
@@ -91,6 +97,8 @@ static void test_interrupt_locks( void )
|
||||
rtems_interrupt_lock_acquire_isr( &lock );
|
||||
rtems_test_assert( normal_interrupt_level == get_interrupt_level() );
|
||||
rtems_interrupt_lock_release_isr( &lock );
|
||||
|
||||
rtems_test_assert( normal_interrupt_level == get_interrupt_level() );
|
||||
}
|
||||
|
||||
void test_interrupt_inline(void)
|
||||
|
||||
Reference in New Issue
Block a user