diff options
Diffstat (limited to 'testsuites/sptests/spintrcritical09/init.c')
-rw-r--r-- | testsuites/sptests/spintrcritical09/init.c | 30 |
1 files changed, 13 insertions, 17 deletions
diff --git a/testsuites/sptests/spintrcritical09/init.c b/testsuites/sptests/spintrcritical09/init.c index 2f9caa5ad6..cc119e88c1 100644 --- a/testsuites/sptests/spintrcritical09/init.c +++ b/testsuites/sptests/spintrcritical09/init.c @@ -14,28 +14,22 @@ #include <tmacros.h> #include <intrcritical.h> -#include <rtems/rtems/semimpl.h> +#include <rtems/score/threadimpl.h> #include <rtems/score/watchdogimpl.h> const char rtems_test_name[] = "SPINTRCRITICAL 9"; +static Thread_Control *thread; + static rtems_id Semaphore; -static bool case_hit = false; -static Thread_blocking_operation_States getState(void) +static bool case_hit; + +static bool is_interrupt_timeout(void) { - Objects_Locations location; - Semaphore_Control *sem; - - sem = (Semaphore_Control *)_Objects_Get( - &_Semaphore_Information, Semaphore, &location ); - if ( location != OBJECTS_LOCAL ) { - puts( "Bad object lookup" ); - rtems_test_exit(0); - } - _Thread_Unnest_dispatch(); + Thread_Wait_flags flags = _Thread_Wait_flags_get( thread ); - return sem->Core_control.semaphore.Wait_queue.sync_state; + return flags == ( THREAD_WAIT_CLASS_OBJECT | THREAD_WAIT_STATE_READY_AGAIN ); } static rtems_timer_service_routine test_release_from_isr( @@ -50,14 +44,14 @@ static rtems_timer_service_routine test_release_from_isr( if ( watchdog->delta_interval == 0 - && watchdog->routine == _Thread_queue_Timeout + && watchdog->routine == _Thread_Timeout ) { - Watchdog_States state = _Watchdog_Remove( watchdog ); + Watchdog_States state = _Watchdog_Remove_ticks( watchdog ); rtems_test_assert( state == WATCHDOG_ACTIVE ); (*watchdog->routine)( watchdog->id, watchdog->user_data ); - if ( getState() == THREAD_BLOCKING_OPERATION_TIMEOUT ) { + if ( is_interrupt_timeout() ) { case_hit = true; } } @@ -81,6 +75,8 @@ static rtems_task Init( TEST_BEGIN(); + thread = _Thread_Get_executing(); + puts( "Init - Test may not be able to detect case is hit reliably" ); puts( "Init - Trying to generate timeout from ISR while blocking" ); sc = rtems_semaphore_create( |