From 41310c026ca3869adbbe4962474c596ab92b3e5c Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Fri, 18 Jan 2019 13:16:29 +0100 Subject: score: Improve debug support for ISR locks Ensure that interrupts are disabled while acquiring an ISR lock. --- testsuites/sptests/sp37/init.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'testsuites') diff --git a/testsuites/sptests/sp37/init.c b/testsuites/sptests/sp37/init.c index b050d7f7d1..52c02b09ac 100644 --- a/testsuites/sptests/sp37/init.c +++ b/testsuites/sptests/sp37/init.c @@ -178,6 +178,7 @@ static void test_isr_locks( void ) ISR_lock_Context lock_context; size_t i; const uint8_t *initialized_bytes; + ISR_Level interrupt_level; memset( &container, 0xff, sizeof( container ) ); _ISR_lock_Initialize( &container.lock, "test" ); @@ -203,9 +204,20 @@ static void test_isr_locks( void ) rtems_test_assert( normal_interrupt_level == _ISR_Get_level() ); +#if defined(RTEMS_DEBUG) + _ISR_lock_ISR_disable( &lock_context ); +#endif + interrupt_level = _ISR_Get_level(); _ISR_lock_Acquire( &container.lock, &lock_context ); + rtems_test_assert( interrupt_level == _ISR_Get_level() ); +#if !defined(RTEMS_DEBUG) rtems_test_assert( normal_interrupt_level == _ISR_Get_level() ); +#endif _ISR_lock_Release( &container.lock, &lock_context ); + rtems_test_assert( interrupt_level == _ISR_Get_level() ); +#if defined(RTEMS_DEBUG) + _ISR_lock_ISR_enable( &lock_context ); +#endif rtems_test_assert( normal_interrupt_level == _ISR_Get_level() ); -- cgit v1.2.3