summaryrefslogtreecommitdiffstats
path: root/testsuites/tmtests/tm26/task1.c
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2013-07-31 10:53:57 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2013-07-31 15:09:04 +0200
commite31a9c8b0d6ed4fefdac66473784e874038365e7 (patch)
tree0ff2f5faa3da51e5b0b785802c42c87c33421f2e /testsuites/tmtests/tm26/task1.c
parentsmp: Provide cache optimized Per_CPU_Control (diff)
downloadrtems-e31a9c8b0d6ed4fefdac66473784e874038365e7.tar.bz2
tmtests/tm26: Fixes for RTEMS_DEBUG
Diffstat (limited to 'testsuites/tmtests/tm26/task1.c')
-rw-r--r--testsuites/tmtests/tm26/task1.c136
1 files changed, 100 insertions, 36 deletions
diff --git a/testsuites/tmtests/tm26/task1.c b/testsuites/tmtests/tm26/task1.c
index 2c8ddfca61..26785b2f84 100644
--- a/testsuites/tmtests/tm26/task1.c
+++ b/testsuites/tmtests/tm26/task1.c
@@ -12,7 +12,6 @@
#endif
#define CONFIGURE_INIT
-#define __RTEMS_VIOLATE_KERNEL_VISIBILITY__
#include <rtems.h>
#include "system.h"
#include "fptest.h"
@@ -83,6 +82,51 @@ rtems_task Floating_point_task_2(
void complete_test( void );
+static void set_thread_dispatch_necessary( bool dispatch_necessary )
+{
+#if defined( RTEMS_SMP )
+ rtems_interrupt_level level;
+
+ rtems_interrupt_disable( level );
+#endif
+
+ _Thread_Dispatch_necessary = dispatch_necessary;
+
+#if defined( RTEMS_SMP )
+ rtems_interrupt_enable( level );
+#endif
+}
+
+static void set_thread_heir( Thread_Control *thread )
+{
+#if defined( RTEMS_SMP )
+ rtems_interrupt_level level;
+
+ rtems_interrupt_disable( level );
+#endif
+
+ _Thread_Heir = thread;
+
+#if defined( RTEMS_SMP )
+ rtems_interrupt_enable( level );
+#endif
+}
+
+static void set_thread_executing( Thread_Control *thread )
+{
+#if defined( RTEMS_SMP )
+ rtems_interrupt_level level;
+
+ rtems_interrupt_disable( level );
+#endif
+
+ _Thread_Executing = thread;
+
+#if defined( RTEMS_SMP )
+ rtems_interrupt_enable( level );
+#endif
+}
+
rtems_task null_task(
rtems_task_argument argument
)
@@ -232,10 +276,10 @@ rtems_task High_task(
thread_enable_dispatch_time = benchmark_timer_read();
benchmark_timer_initialize();
- _Thread_Set_state( _Thread_Executing, STATES_SUSPENDED );
+ _Thread_Set_state( _Thread_Get_executing(), STATES_SUSPENDED );
thread_set_state_time = benchmark_timer_read();
- _Thread_Dispatch_necessary = true;
+ set_thread_dispatch_necessary( true );
benchmark_timer_initialize();
_Thread_Dispatch(); /* dispatches Middle_task */
@@ -249,22 +293,26 @@ rtems_task Middle_task(
thread_dispatch_no_fp_time = benchmark_timer_read();
- _Thread_Set_state( _Thread_Executing, STATES_SUSPENDED );
+ _Thread_Set_state( _Thread_Get_executing(), STATES_SUSPENDED );
- Middle_tcb = _Thread_Executing;
+ Middle_tcb = _Thread_Get_executing();
ready_queues = (Chain_Control *) _Scheduler.information;
- _Thread_Executing =
- (Thread_Control *) _Chain_First(&ready_queues[LOW_PRIORITY]);
+ set_thread_executing(
+ (Thread_Control *) _Chain_First(&ready_queues[LOW_PRIORITY])
+ );
/* do not force context switch */
- _Thread_Dispatch_necessary = false;
+ set_thread_dispatch_necessary( false );
_Thread_Disable_dispatch();
benchmark_timer_initialize();
- _Context_Switch( &Middle_tcb->Registers, &_Thread_Executing->Registers );
+ _Context_Switch(
+ &Middle_tcb->Registers,
+ &_Thread_Get_executing()->Registers
+ );
benchmark_timer_initialize();
_Context_Switch(&Middle_tcb->Registers, &Low_tcb->Registers);
@@ -281,7 +329,7 @@ rtems_task Low_task(
context_switch_no_fp_time = benchmark_timer_read();
- executing = _Thread_Executing;
+ executing = _Thread_Get_executing();
Low_tcb = executing;
@@ -294,20 +342,24 @@ rtems_task Low_task(
context_switch_another_task_time = benchmark_timer_read();
- _Thread_Executing =
- (Thread_Control *) _Chain_First(&ready_queues[FP1_PRIORITY]);
+ set_thread_executing(
+ (Thread_Control *) _Chain_First(&ready_queues[FP1_PRIORITY])
+ );
/* do not force context switch */
- _Thread_Dispatch_necessary = false;
+ set_thread_dispatch_necessary( false );
_Thread_Disable_dispatch();
benchmark_timer_initialize();
#if (CPU_HARDWARE_FP == 1) || (CPU_SOFTWARE_FP == 1)
- _Context_Restore_fp( &_Thread_Executing->fp_context );
+ _Context_Restore_fp( &_Thread_Get_executing()->fp_context );
#endif
- _Context_Switch( &executing->Registers, &_Thread_Executing->Registers );
+ _Context_Switch(
+ &executing->Registers,
+ &_Thread_Get_executing()->Registers
+ );
}
rtems_task Floating_point_task_1(
@@ -320,48 +372,56 @@ rtems_task Floating_point_task_1(
context_switch_restore_1st_fp_time = benchmark_timer_read();
- executing = _Thread_Executing;
+ executing = _Thread_Get_executing();
ready_queues = (Chain_Control *) _Scheduler.information;
- _Thread_Executing =
- (Thread_Control *) _Chain_First(&ready_queues[FP2_PRIORITY]);
+ set_thread_executing(
+ (Thread_Control *) _Chain_First(&ready_queues[FP2_PRIORITY])
+ );
/* do not force context switch */
- _Thread_Dispatch_necessary = false;
+ set_thread_dispatch_necessary( false );
_Thread_Disable_dispatch();
benchmark_timer_initialize();
#if (CPU_HARDWARE_FP == 1) || (CPU_SOFTWARE_FP == 1)
_Context_Save_fp( &executing->fp_context );
- _Context_Restore_fp( &_Thread_Executing->fp_context );
+ _Context_Restore_fp( &_Thread_Get_executing()->fp_context );
#endif
- _Context_Switch( &executing->Registers, &_Thread_Executing->Registers );
+ _Context_Switch(
+ &executing->Registers,
+ &_Thread_Get_executing()->Registers
+ );
/* switch to Floating_point_task_2 */
context_switch_save_idle_restore_initted_time = benchmark_timer_read();
FP_LOAD( 1.0 );
- executing = _Thread_Executing;
+ executing = _Thread_Get_executing();
ready_queues = (Chain_Control *) _Scheduler.information;
- _Thread_Executing =
- (Thread_Control *) _Chain_First(&ready_queues[FP2_PRIORITY]);
+ set_thread_executing(
+ (Thread_Control *) _Chain_First(&ready_queues[FP2_PRIORITY])
+ );
/* do not force context switch */
- _Thread_Dispatch_necessary = false;
+ set_thread_dispatch_necessary( false );
_Thread_Disable_dispatch();
benchmark_timer_initialize();
#if (CPU_HARDWARE_FP == 1) || (CPU_SOFTWARE_FP == 1)
_Context_Save_fp( &executing->fp_context );
- _Context_Restore_fp( &_Thread_Executing->fp_context );
+ _Context_Restore_fp( &_Thread_Get_executing()->fp_context );
#endif
- _Context_Switch( &executing->Registers, &_Thread_Executing->Registers );
+ _Context_Switch(
+ &executing->Registers,
+ &_Thread_Get_executing()->Registers
+ );
/* switch to Floating_point_task_2 */
}
@@ -375,26 +435,30 @@ rtems_task Floating_point_task_2(
context_switch_save_restore_idle_time = benchmark_timer_read();
- executing = _Thread_Executing;
+ executing = _Thread_Get_executing();
ready_queues = (Chain_Control *) _Scheduler.information;
- _Thread_Executing =
- (Thread_Control *) _Chain_First(&ready_queues[FP1_PRIORITY]);
+ set_thread_executing(
+ (Thread_Control *) _Chain_First(&ready_queues[FP1_PRIORITY])
+ );
FP_LOAD( 1.0 );
/* do not force context switch */
- _Thread_Dispatch_necessary = false;
+ set_thread_dispatch_necessary( false );
_Thread_Disable_dispatch();
benchmark_timer_initialize();
#if (CPU_HARDWARE_FP == 1) || (CPU_SOFTWARE_FP == 1)
_Context_Save_fp( &executing->fp_context );
- _Context_Restore_fp( &_Thread_Executing->fp_context );
+ _Context_Restore_fp( &_Thread_Get_executing()->fp_context );
#endif
- _Context_Switch( &executing->Registers, &_Thread_Executing->Registers );
+ _Context_Switch(
+ &executing->Registers,
+ &_Thread_Get_executing()->Registers
+ );
/* switch to Floating_point_task_1 */
context_switch_save_restore_initted_time = benchmark_timer_read();
@@ -450,9 +514,9 @@ void complete_test( void )
* we need to set some internal tracking information to match this.
*/
- _Thread_Heir = _Thread_Executing;
- _Thread_Dispatch_necessary = false;
-
+ set_thread_heir( _Thread_Get_executing() );
+ set_thread_dispatch_necessary( false );
+
_Thread_Dispatch_set_disable_level( 0 );
/*