summaryrefslogtreecommitdiffstats
path: root/testsuites/sptests/spintrcritical09
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2012-11-12 17:58:48 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2012-11-13 09:38:03 +0100
commit8f548cea5fe76f8ab94ed02da71b4c884d8288cc (patch)
treee81b58062a56aab873b56df34211b79cb5aa0d43 /testsuites/sptests/spintrcritical09
parentfstests/fsrfsbitmap01: Fix NULL pointer access (diff)
downloadrtems-8f548cea5fe76f8ab94ed02da71b4c884d8288cc.tar.bz2
sptests/spintrcritical09: Fix check order
The critical section check never succeeded since watchdogs are ordered with respect to the insertion time. Now we call the watchdog routine if appropriate and bypass the normal watchdog mechanic.
Diffstat (limited to 'testsuites/sptests/spintrcritical09')
-rw-r--r--testsuites/sptests/spintrcritical09/init.c42
1 files changed, 25 insertions, 17 deletions
diff --git a/testsuites/sptests/spintrcritical09/init.c b/testsuites/sptests/spintrcritical09/init.c
index c953799f0a..a00aae0e31 100644
--- a/testsuites/sptests/spintrcritical09/init.c
+++ b/testsuites/sptests/spintrcritical09/init.c
@@ -15,16 +15,10 @@
#include <tmacros.h>
#include <intrcritical.h>
-/* forward declarations to avoid warnings */
-rtems_task Init(rtems_task_argument argument);
-rtems_timer_service_routine test_release_from_isr(rtems_id timer, void *arg);
-Thread_blocking_operation_States getState(void);
+static rtems_id Semaphore;
+static bool case_hit;
-rtems_id Main_task;
-rtems_id Semaphore;
-volatile bool case_hit;
-
-Thread_blocking_operation_States getState(void)
+static Thread_blocking_operation_States getState(void)
{
Objects_Locations location;
Semaphore_Control *sem;
@@ -40,17 +34,33 @@ Thread_blocking_operation_States getState(void)
return sem->Core_control.semaphore.Wait_queue.sync_state;
}
-rtems_timer_service_routine test_release_from_isr(
+static rtems_timer_service_routine test_release_from_isr(
rtems_id timer,
void *arg
)
{
- if ( getState() == THREAD_BLOCKING_OPERATION_TIMEOUT ) {
- case_hit = true;
+ Chain_Control *chain = &_Watchdog_Ticks_chain;
+
+ if ( !_Chain_Is_empty( chain ) ) {
+ Watchdog_Control *watchdog = _Watchdog_First( chain );
+
+ if (
+ watchdog->delta_interval == 0
+ && watchdog->routine == _Thread_queue_Timeout
+ ) {
+ Watchdog_States state = _Watchdog_Remove( watchdog );
+
+ rtems_test_assert( state == WATCHDOG_ACTIVE );
+ (*watchdog->routine)( watchdog->id, watchdog->user_data );
+
+ if ( getState() == THREAD_BLOCKING_OPERATION_TIMEOUT ) {
+ case_hit = true;
+ }
+ }
}
}
-rtems_task Init(
+static rtems_task Init(
rtems_task_argument ignored
)
{
@@ -63,15 +73,13 @@ rtems_task Init(
puts( "Init - Trying to generate timeout from ISR while blocking" );
sc = rtems_semaphore_create(
rtems_build_name( 'S', 'M', '1', ' ' ),
- 1,
+ 0,
RTEMS_DEFAULT_ATTRIBUTES,
RTEMS_NO_PRIORITY,
&Semaphore
);
directive_failed( sc, "rtems_semaphore_create of SM1" );
- Main_task = rtems_task_self();
-
interrupt_critical_section_test_support_initialize( test_release_from_isr );
case_hit = false;
@@ -97,7 +105,7 @@ rtems_task Init(
#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
-#define CONFIGURE_MAXIMUM_TASKS 2
+#define CONFIGURE_MAXIMUM_TASKS 1
#define CONFIGURE_MAXIMUM_TIMERS 1
#define CONFIGURE_MAXIMUM_SEMAPHORES 1
#define CONFIGURE_RTEMS_INIT_TASKS_TABLE