diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2023-01-23 14:56:31 +0100 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2023-01-24 09:56:53 +0100 |
commit | 10ee41a8a37ac5e8d3537cb1c7d98b647903b97c (patch) | |
tree | 1cc4168c02e2b963109393582af0cbb522dc5eda /testsuites/tmtests/tm27 | |
parent | score: Clarify code block (diff) | |
download | rtems-10ee41a8a37ac5e8d3537cb1c7d98b647903b97c.tar.bz2 |
tm27: Avoid function pointer casts
Add TM27_USE_VECTOR_HANDLER to select the interrupt handler type used by
the <tm27.h> implementation.
Close #4820.
Diffstat (limited to 'testsuites/tmtests/tm27')
-rw-r--r-- | testsuites/tmtests/tm27/task1.c | 100 |
1 files changed, 49 insertions, 51 deletions
diff --git a/testsuites/tmtests/tm27/task1.c b/testsuites/tmtests/tm27/task1.c index 54aca545b8..7f2ce6663c 100644 --- a/testsuites/tmtests/tm27/task1.c +++ b/testsuites/tmtests/tm27/task1.c @@ -62,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; @@ -126,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 ) @@ -302,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(); -} |