summaryrefslogtreecommitdiffstats
path: root/testsuites/tmtests/tm27/task1.c
diff options
context:
space:
mode:
Diffstat (limited to 'testsuites/tmtests/tm27/task1.c')
-rw-r--r--testsuites/tmtests/tm27/task1.c125
1 files changed, 71 insertions, 54 deletions
diff --git a/testsuites/tmtests/tm27/task1.c b/testsuites/tmtests/tm27/task1.c
index c0f8bd1088..7f2ce6663c 100644
--- a/testsuites/tmtests/tm27/task1.c
+++ b/testsuites/tmtests/tm27/task1.c
@@ -1,10 +1,29 @@
+/* SPDX-License-Identifier: BSD-2-Clause */
+
/*
* COPYRIGHT (c) 1989-2013.
* On-Line Applications Research Corporation (OAR).
*
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- * http://www.rtems.org/license/LICENSE.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
*/
/*
@@ -43,10 +62,6 @@ volatile uint32_t Interrupt_return_time, Interrupt_return_nested_time;
uint32_t Interrupt_nest;
uint32_t timer_overhead;
-rtems_isr Isr_handler(
- rtems_vector_number vector
-);
-
static void set_thread_executing( Thread_Control *thread )
{
_Per_CPU_Get_snapshot()->executing = thread;
@@ -107,6 +122,55 @@ rtems_task Init(
rtems_task_exit();
}
+/* The Isr_handler() and Isr_handler_inner() routines are structured
+ * so that there will be as little entry overhead as possible included
+ * in the interrupt entry time.
+ */
+
+static void Isr_handler_inner( void )
+{
+
+ /*enable_tracing();*/
+ Clear_tm27_intr();
+ switch ( Interrupt_nest ) {
+ case 0:
+ Interrupt_enter_time = end_time;
+ break;
+ case 1:
+ Interrupt_enter_time = end_time;
+ Interrupt_nest = 2;
+ Interrupt_occurred = 0;
+ Lower_tm27_intr();
+ benchmark_timer_initialize();
+ Cause_tm27_intr();
+ /* goes to a nested copy of Isr_handler */
+#if (MUST_WAIT_FOR_INTERRUPT == 1)
+ while ( Interrupt_occurred == 0 );
+#endif
+ Interrupt_return_nested_time = benchmark_timer_read();
+ break;
+ case 2:
+ Interrupt_enter_nested_time = end_time;
+ break;
+ }
+
+ benchmark_timer_initialize();
+}
+
+#ifdef TM27_USE_VECTOR_HANDLER
+static rtems_isr Isr_handler( rtems_vector_number arg )
+#else
+static void Isr_handler( void *arg )
+#endif
+{
+ (void) arg;
+
+ end_time = benchmark_timer_read();
+
+ Interrupt_occurred = 1;
+ Isr_handler_inner();
+}
+
rtems_task Task_1(
rtems_task_argument argument
)
@@ -283,50 +347,3 @@ rtems_task Task_2(
_Thread_Dispatch();
}
-
-/* The Isr_handler() and Isr_handler_inner() routines are structured
- * so that there will be as little entry overhead as possible included
- * in the interrupt entry time.
- */
-
-void Isr_handler_inner( void );
-
-rtems_isr Isr_handler(
- rtems_vector_number vector
-)
-{
- end_time = benchmark_timer_read();
-
- Interrupt_occurred = 1;
- Isr_handler_inner();
-}
-
-void Isr_handler_inner( void )
-{
-
- /*enable_tracing();*/
- Clear_tm27_intr();
- switch ( Interrupt_nest ) {
- case 0:
- Interrupt_enter_time = end_time;
- break;
- case 1:
- Interrupt_enter_time = end_time;
- Interrupt_nest = 2;
- Interrupt_occurred = 0;
- Lower_tm27_intr();
- benchmark_timer_initialize();
- Cause_tm27_intr();
- /* goes to a nested copy of Isr_handler */
-#if (MUST_WAIT_FOR_INTERRUPT == 1)
- while ( Interrupt_occurred == 0 );
-#endif
- Interrupt_return_nested_time = benchmark_timer_read();
- break;
- case 2:
- Interrupt_enter_nested_time = end_time;
- break;
- }
-
- benchmark_timer_initialize();
-}