forked from Imagelibrary/rtems
tm27: Avoid function pointer casts
Add TM27_USE_VECTOR_HANDLER to select the interrupt handler type used by the <tm27.h> implementation. Close #4820.
This commit is contained in:
@@ -45,10 +45,6 @@ uint32_t Interrupt_nest;
|
||||
uint32_t timer_overhead;
|
||||
uint32_t Interrupt_enter_time;
|
||||
|
||||
rtems_isr Isr_handler(
|
||||
rtems_vector_number vector
|
||||
);
|
||||
|
||||
rtems_task Init(
|
||||
rtems_task_argument argument
|
||||
)
|
||||
@@ -91,6 +87,19 @@ rtems_task Init(
|
||||
rtems_task_exit();
|
||||
}
|
||||
|
||||
#ifdef TM27_USE_VECTOR_HANDLER
|
||||
static rtems_isr Isr_handler( rtems_vector_number arg )
|
||||
#else
|
||||
static void Isr_handler( void *arg )
|
||||
#endif
|
||||
{
|
||||
(void) arg;
|
||||
|
||||
/* See how long it took system to recognize interrupt */
|
||||
Interrupt_enter_time = benchmark_timer_read();
|
||||
Clear_tm27_intr();
|
||||
}
|
||||
|
||||
rtems_task Task_1(
|
||||
rtems_task_argument argument
|
||||
)
|
||||
@@ -114,12 +123,3 @@ rtems_task Task_1(
|
||||
TEST_END();
|
||||
rtems_test_exit( 0 );
|
||||
}
|
||||
|
||||
rtems_isr Isr_handler(
|
||||
rtems_vector_number vector
|
||||
)
|
||||
{
|
||||
/* See how long it took system to recognize interrupt */
|
||||
Interrupt_enter_time = benchmark_timer_read();
|
||||
Clear_tm27_intr();
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -76,11 +76,15 @@ void CallWithinISRClear( void )
|
||||
Clear_tm27_intr();
|
||||
}
|
||||
|
||||
static void CallWithinISRHandler( rtems_vector_number vector )
|
||||
#ifdef TM27_USE_VECTOR_HANDLER
|
||||
static rtems_isr CallWithinISRHandler( rtems_vector_number arg )
|
||||
#else
|
||||
static void CallWithinISRHandler( void *arg )
|
||||
#endif
|
||||
{
|
||||
CallWithinISRContext *ctx;
|
||||
|
||||
(void) vector;
|
||||
(void) arg;
|
||||
ctx = &CallWithinISRInstance;
|
||||
|
||||
CallWithinISRClear();
|
||||
@@ -148,7 +152,7 @@ static void CallWithinISRIsHandlerInstalled(
|
||||
(void) option;
|
||||
(void) handler_arg;
|
||||
|
||||
if ( handler == (rtems_interrupt_handler) CallWithinISRHandler ) {
|
||||
if ( handler == CallWithinISRHandler ) {
|
||||
*(bool *) arg = true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user