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:
Sebastian Huber
2023-01-23 14:56:31 +01:00
parent 9ecb73f368
commit 10ee41a8a3
37 changed files with 144 additions and 108 deletions

View File

@@ -51,7 +51,7 @@
#define LPC32XX_TM27_IRQ LPC32XX_IRQ_TIMER_2 #define LPC32XX_TM27_IRQ LPC32XX_IRQ_TIMER_2
static inline void Install_tm27_vector(void (*handler)(rtems_vector_number)) static inline void Install_tm27_vector( rtems_interrupt_handler handler )
{ {
static rtems_interrupt_entry entry; static rtems_interrupt_entry entry;
volatile lpc_timer *timer = LPC32XX_TM27_TIMER; volatile lpc_timer *timer = LPC32XX_TM27_TIMER;
@@ -70,7 +70,7 @@ static inline void Install_tm27_vector(void (*handler)(rtems_vector_number))
rtems_interrupt_entry_initialize( rtems_interrupt_entry_initialize(
&entry, &entry,
(rtems_interrupt_handler) handler, handler,
NULL, NULL,
"tm27" "tm27"
); );

View File

@@ -34,6 +34,8 @@
#define MUST_WAIT_FOR_INTERRUPT 0 #define MUST_WAIT_FOR_INTERRUPT 0
#define TM27_USE_VECTOR_HANDLER
#define Install_tm27_vector(handler) \ #define Install_tm27_vector(handler) \
{ \ { \
set_vector( handler, 0x06, 1 ); \ set_vector( handler, 0x06, 1 ); \

View File

@@ -32,6 +32,8 @@
#define MUST_WAIT_FOR_INTERRUPT 0 #define MUST_WAIT_FOR_INTERRUPT 0
#define TM27_USE_VECTOR_HANDLER
#define Install_tm27_vector(handler) \ #define Install_tm27_vector(handler) \
{ \ { \
set_vector( handler, 0x06, 1 ); \ set_vector( handler, 0x06, 1 ); \

View File

@@ -59,13 +59,13 @@
#define ARM_GIC_TM27_PRIO_HIGH 0x00 #define ARM_GIC_TM27_PRIO_HIGH 0x00
static inline void Install_tm27_vector(void (*handler)(rtems_vector_number)) static inline void Install_tm27_vector( rtems_interrupt_handler handler )
{ {
rtems_status_code sc = rtems_interrupt_handler_install( rtems_status_code sc = rtems_interrupt_handler_install(
ARM_GIC_TM27_IRQ_LOW, ARM_GIC_TM27_IRQ_LOW,
"tm27 low", "tm27 low",
RTEMS_INTERRUPT_UNIQUE, RTEMS_INTERRUPT_UNIQUE,
(rtems_interrupt_handler) handler, handler,
NULL NULL
); );
assert(sc == RTEMS_SUCCESSFUL); assert(sc == RTEMS_SUCCESSFUL);

View File

@@ -27,6 +27,8 @@
#define MUST_WAIT_FOR_INTERRUPT 0 #define MUST_WAIT_FOR_INTERRUPT 0
#define TM27_USE_VECTOR_HANDLER
#define Install_tm27_vector( handler ) set_vector( (handler), 0, 1 ) #define Install_tm27_vector( handler ) set_vector( (handler), 0, 1 )
#define Cause_tm27_intr() /* empty */ #define Cause_tm27_intr() /* empty */

View File

@@ -26,6 +26,8 @@
#define MUST_WAIT_FOR_INTERRUPT 0 #define MUST_WAIT_FOR_INTERRUPT 0
#define TM27_USE_VECTOR_HANDLER
#define Install_tm27_vector( handler ) set_vector( (handler), 35, 1 ) #define Install_tm27_vector( handler ) set_vector( (handler), 35, 1 )
#define Cause_tm27_intr() asm volatile ("trap #3"); #define Cause_tm27_intr() asm volatile ("trap #3");

View File

@@ -28,6 +28,8 @@
#define MUST_WAIT_FOR_INTERRUPT 0 #define MUST_WAIT_FOR_INTERRUPT 0
#define TM27_USE_VECTOR_HANDLER
#define Install_tm27_vector( handler ) set_vector( (handler), 34, 1 ) #define Install_tm27_vector( handler ) set_vector( (handler), 34, 1 )
#define Cause_tm27_intr() asm volatile ("trap #2"); #define Cause_tm27_intr() asm volatile ("trap #2");

View File

@@ -29,6 +29,8 @@
#define MUST_WAIT_FOR_INTERRUPT 0 #define MUST_WAIT_FOR_INTERRUPT 0
#define TM27_USE_VECTOR_HANDLER
#define Install_tm27_vector( handler ) set_vector( (handler), 34, 1 ) #define Install_tm27_vector( handler ) set_vector( (handler), 34, 1 )
#define Cause_tm27_intr() asm volatile ("trap #2"); #define Cause_tm27_intr() asm volatile ("trap #2");

View File

@@ -26,6 +26,8 @@
#define MUST_WAIT_FOR_INTERRUPT 0 #define MUST_WAIT_FOR_INTERRUPT 0
#define TM27_USE_VECTOR_HANDLER
#define Install_tm27_vector( handler ) set_vector( (handler), 35, 1 ) #define Install_tm27_vector( handler ) set_vector( (handler), 35, 1 )
#define Cause_tm27_intr() asm volatile ("trap #3"); #define Cause_tm27_intr() asm volatile ("trap #3");

View File

@@ -24,6 +24,8 @@
#define MUST_WAIT_FOR_INTERRUPT 0 #define MUST_WAIT_FOR_INTERRUPT 0
#define TM27_USE_VECTOR_HANDLER
#define Install_tm27_vector( handler ) set_vector( (handler), 34, 1 ) #define Install_tm27_vector( handler ) set_vector( (handler), 34, 1 )
#define Cause_tm27_intr() asm volatile ("trap #2"); #define Cause_tm27_intr() asm volatile ("trap #2");

View File

@@ -24,6 +24,8 @@
#define MUST_WAIT_FOR_INTERRUPT 0 #define MUST_WAIT_FOR_INTERRUPT 0
#define TM27_USE_VECTOR_HANDLER
#define Install_tm27_vector( handler ) set_vector( (handler), 35, 1 ) #define Install_tm27_vector( handler ) set_vector( (handler), 35, 1 )
#define Cause_tm27_intr() asm volatile ("trap #3"); #define Cause_tm27_intr() asm volatile ("trap #3");

View File

@@ -24,6 +24,8 @@
#define MUST_WAIT_FOR_INTERRUPT 0 #define MUST_WAIT_FOR_INTERRUPT 0
#define TM27_USE_VECTOR_HANDLER
#define Install_tm27_vector( handler ) set_vector( (handler), 35, 1 ) #define Install_tm27_vector( handler ) set_vector( (handler), 35, 1 )
#define Cause_tm27_intr() asm volatile ("trap #3"); #define Cause_tm27_intr() asm volatile ("trap #3");

View File

@@ -24,6 +24,8 @@
#define MUST_WAIT_FOR_INTERRUPT 0 #define MUST_WAIT_FOR_INTERRUPT 0
#define TM27_USE_VECTOR_HANDLER
#define Install_tm27_vector( handler ) set_vector( (handler), 35, 1 ) #define Install_tm27_vector( handler ) set_vector( (handler), 35, 1 )
#define Cause_tm27_intr() asm volatile ("trap #3"); #define Cause_tm27_intr() asm volatile ("trap #3");

View File

@@ -24,6 +24,8 @@
#define MUST_WAIT_FOR_INTERRUPT 0 #define MUST_WAIT_FOR_INTERRUPT 0
#define TM27_USE_VECTOR_HANDLER
#define Install_tm27_vector( handler ) set_vector( (handler), 35, 1 ) #define Install_tm27_vector( handler ) set_vector( (handler), 35, 1 )
#define Cause_tm27_intr() asm volatile ("trap #3"); #define Cause_tm27_intr() asm volatile ("trap #3");

View File

@@ -25,6 +25,8 @@
#define MUST_WAIT_FOR_INTERRUPT 0 #define MUST_WAIT_FOR_INTERRUPT 0
#define TM27_USE_VECTOR_HANDLER
#define Install_tm27_vector( handler ) set_vector( (handler), \ #define Install_tm27_vector( handler ) set_vector( (handler), \
SOFT_1_VECTOR, 1 ) SOFT_1_VECTOR, 1 )

View File

@@ -25,6 +25,8 @@
#define MUST_WAIT_FOR_INTERRUPT 0 #define MUST_WAIT_FOR_INTERRUPT 0
#define TM27_USE_VECTOR_HANDLER
#define Install_tm27_vector( handler ) set_vector( (handler), \ #define Install_tm27_vector( handler ) set_vector( (handler), \
SOFT_1_VECTOR, 1 ) SOFT_1_VECTOR, 1 )

View File

@@ -25,6 +25,8 @@
#define MUST_WAIT_FOR_INTERRUPT 0 #define MUST_WAIT_FOR_INTERRUPT 0
#define TM27_USE_VECTOR_HANDLER
#define Install_tm27_vector( handler ) \ #define Install_tm27_vector( handler ) \
set_vector( (handler), VBR1 * 0x10 + 0x8, 1 ); \ set_vector( (handler), VBR1 * 0x10 + 0x8, 1 ); \
lcsr->intr_level[2] |= 3; \ lcsr->intr_level[2] |= 3; \

View File

@@ -24,6 +24,8 @@
*/ */
#define MUST_WAIT_FOR_INTERRUPT 0 #define MUST_WAIT_FOR_INTERRUPT 0
#define TM27_USE_VECTOR_HANDLER
#define Install_tm27_vector( handler ) \ #define Install_tm27_vector( handler ) \
set_vector( (handler), VBR1 * 0x10 + 0x8, 1 ); \ set_vector( (handler), VBR1 * 0x10 + 0x8, 1 ); \
lcsr->intr_level[2] |= 3; \ lcsr->intr_level[2] |= 3; \

View File

@@ -29,6 +29,8 @@
#define MUST_WAIT_FOR_INTERRUPT 0 #define MUST_WAIT_FOR_INTERRUPT 0
#define TM27_USE_VECTOR_HANDLER
#define Install_tm27_vector( handler ) set_vector( (handler), 35, 1 ) #define Install_tm27_vector( handler ) set_vector( (handler), 35, 1 )
#define Cause_tm27_intr() asm volatile ("trap #3"); #define Cause_tm27_intr() asm volatile ("trap #3");

View File

@@ -28,7 +28,7 @@ int negate_sw_irw(uint32_t irqnum);
#define Install_tm27_vector( handler ) \ #define Install_tm27_vector( handler ) \
rtems_interrupt_handler_install( \ rtems_interrupt_handler_install( \
AU1X00_IRQ_SW0, "benchmark", 0, (rtems_interrupt_handler)handler, NULL ); AU1X00_IRQ_SW0, "benchmark", 0, handler, NULL );
#define Cause_tm27_intr() \ #define Cause_tm27_intr() \
do { \ do { \

View File

@@ -26,7 +26,7 @@
#define Install_tm27_vector( handler ) \ #define Install_tm27_vector( handler ) \
rtems_interrupt_handler_install( \ rtems_interrupt_handler_install( \
TX3904_IRQ_TMR0, "benchmark", 0, \ TX3904_IRQ_TMR0, "benchmark", 0, \
(rtems_interrupt_handler)handler, NULL ); handler, NULL );
#define Cause_tm27_intr() \ #define Cause_tm27_intr() \
do { \ do { \

View File

@@ -34,9 +34,9 @@ static rtems_irq_connect_data clockIrqData = {BSP_DECREMENTER,
(rtems_irq_disable) nullFunc, (rtems_irq_disable) nullFunc,
(rtems_irq_is_enabled) nullFunc}; (rtems_irq_is_enabled) nullFunc};
static inline void Install_tm27_vector(void (*_handler)(void)) static inline void Install_tm27_vector( rtems_interrupt_handler handler )
{ {
clockIrqData.hdl = _handler; clockIrqData.hdl = handler;
if (!BSP_install_rtems_irq_handler (&clockIrqData)) { if (!BSP_install_rtems_irq_handler (&clockIrqData)) {
printk("Error installing clock interrupt handler!\n"); printk("Error installing clock interrupt handler!\n");
bsp_fatal(MPC5200_FATAL_TM27_IRQ_INSTALL); bsp_fatal(MPC5200_FATAL_TM27_IRQ_INSTALL);

View File

@@ -42,16 +42,16 @@
#define MUST_WAIT_FOR_INTERRUPT 1 #define MUST_WAIT_FOR_INTERRUPT 1
static void (*tm27_interrupt_handler)(rtems_vector_number); static rtems_interrupt_handler tm27_interrupt_handler;
static int tm27_exception_handler( BSP_Exception_frame *frame, unsigned number) static int tm27_exception_handler( BSP_Exception_frame *frame, unsigned number)
{ {
(*tm27_interrupt_handler)( 0); (*tm27_interrupt_handler)( NULL);
return 0; return 0;
} }
static void Install_tm27_vector( void (*handler)(rtems_vector_number)) static inline void Install_tm27_vector( rtems_interrupt_handler handler )
{ {
int rv = 0; int rv = 0;

View File

@@ -39,9 +39,9 @@ static rtems_irq_connect_data clockIrqData =
.isOn = null_irq_is_enabled .isOn = null_irq_is_enabled
}; };
static void Install_tm27_vector(rtems_isr (*_handler)(rtems_vector_number)) static inline void Install_tm27_vector( rtems_interrupt_handler handler )
{ {
clockIrqData.hdl = (rtems_irq_hdl) _handler; clockIrqData.hdl = handler;
if (!BSP_install_rtems_irq_handler (&clockIrqData)) { if (!BSP_install_rtems_irq_handler (&clockIrqData)) {
printk("Error installing clock interrupt handler!\n"); printk("Error installing clock interrupt handler!\n");
rtems_fatal_error_occurred(1); rtems_fatal_error_occurred(1);

View File

@@ -29,7 +29,7 @@
do { \ do { \
static rtems_irq_connect_data scIrqData = { \ static rtems_irq_connect_data scIrqData = { \
PPC_IRQ_SCALL, \ PPC_IRQ_SCALL, \
(rtems_irq_hdl) handler, \ handler, \
NULL, \ NULL, \
NULL, \ NULL, \
NULL \ NULL \

View File

@@ -32,9 +32,9 @@ static rtems_irq_connect_data clockIrqData = {BSP_DECREMENTER,
(rtems_irq_disable)nullFunc, (rtems_irq_disable)nullFunc,
(rtems_irq_is_enabled) nullFunc}; (rtems_irq_is_enabled) nullFunc};
static inline void Install_tm27_vector(void (*_handler)()) static inline void Install_tm27_vector( rtems_interrupt_handler handler )
{ {
clockIrqData.hdl = _handler; clockIrqData.hdl = handler;
if (!BSP_install_rtems_irq_handler (&clockIrqData)) { if (!BSP_install_rtems_irq_handler (&clockIrqData)) {
printk("Error installing clock interrupt handler!\n"); printk("Error installing clock interrupt handler!\n");
rtems_fatal_error_occurred(1); rtems_fatal_error_occurred(1);

View File

@@ -32,9 +32,9 @@ static rtems_irq_connect_data clockIrqData = {BSP_DECREMENTER,
(rtems_irq_disable)nullFunc, (rtems_irq_disable)nullFunc,
(rtems_irq_is_enabled) nullFunc}; (rtems_irq_is_enabled) nullFunc};
static inline void Install_tm27_vector(void (*_handler)()) static inline void Install_tm27_vector( rtems_interrupt_handler handler )
{ {
clockIrqData.hdl = _handler; clockIrqData.hdl = handler;
if (!BSP_install_rtems_irq_handler (&clockIrqData)) { if (!BSP_install_rtems_irq_handler (&clockIrqData)) {
printk("Error installing clock interrupt handler!\n"); printk("Error installing clock interrupt handler!\n");
rtems_fatal_error_occurred(1); rtems_fatal_error_occurred(1);

View File

@@ -53,7 +53,7 @@
#define IPI_INDEX_HIGH 2 #define IPI_INDEX_HIGH 2
static inline void Install_tm27_vector(void (*handler)(rtems_vector_number)) static inline void Install_tm27_vector( rtems_interrupt_handler handler )
{ {
rtems_status_code sc; rtems_status_code sc;
rtems_vector_number low = QORIQ_IRQ_IPI_0 + IPI_INDEX_LOW; rtems_vector_number low = QORIQ_IRQ_IPI_0 + IPI_INDEX_LOW;
@@ -63,7 +63,7 @@ static inline void Install_tm27_vector(void (*handler)(rtems_vector_number))
low, low,
"tm17 low", "tm17 low",
RTEMS_INTERRUPT_UNIQUE, RTEMS_INTERRUPT_UNIQUE,
(rtems_interrupt_handler) handler, handler,
NULL NULL
); );
assert(sc == RTEMS_SUCCESSFUL); assert(sc == RTEMS_SUCCESSFUL);
@@ -75,7 +75,7 @@ static inline void Install_tm27_vector(void (*handler)(rtems_vector_number))
high, high,
"tm17 high", "tm17 high",
RTEMS_INTERRUPT_UNIQUE, RTEMS_INTERRUPT_UNIQUE,
(rtems_interrupt_handler) handler, handler,
NULL NULL
); );
assert(sc == RTEMS_SUCCESSFUL); assert(sc == RTEMS_SUCCESSFUL);

View File

@@ -32,7 +32,7 @@
usiu.siel |= (1 << 17); \ usiu.siel |= (1 << 17); \
usiu.sipend |= (1 << 17); \ usiu.sipend |= (1 << 17); \
\ \
tm27IrqData.hdl = (rtems_irq_hdl)handler; \ tm27IrqData.hdl = handler; \
BSP_install_rtems_irq_handler (&tm27IrqData); \ BSP_install_rtems_irq_handler (&tm27IrqData); \
} }

View File

@@ -52,9 +52,7 @@ static bool riscv_tm27_can_use_mtime;
static rtems_interrupt_entry riscv_tm27_interrupt_entry; static rtems_interrupt_entry riscv_tm27_interrupt_entry;
static inline void Install_tm27_vector( static inline void Install_tm27_vector( rtems_interrupt_handler handler )
void ( *handler )( rtems_vector_number )
)
{ {
rtems_vector_number irq; rtems_vector_number irq;
bool enabled; bool enabled;
@@ -71,7 +69,7 @@ static inline void Install_tm27_vector(
rtems_interrupt_entry_initialize( rtems_interrupt_entry_initialize(
&riscv_tm27_interrupt_entry, &riscv_tm27_interrupt_entry,
(rtems_interrupt_handler) handler, handler,
NULL, NULL,
"tm27" "tm27"
); );

View File

@@ -27,6 +27,8 @@
# error "..." # error "..."
#endif #endif
#define TM27_USE_VECTOR_HANDLER
#define Install_tm27_vector( handler ) \ #define Install_tm27_vector( handler ) \
{ \ { \
rtems_isr_entry old_handler; \ rtems_isr_entry old_handler; \

View File

@@ -59,6 +59,8 @@
#define MUST_WAIT_FOR_INTERRUPT 1 #define MUST_WAIT_FOR_INTERRUPT 1
#define TM27_USE_VECTOR_HANDLER
#define Install_tm27_vector( handler ) \ #define Install_tm27_vector( handler ) \
set_vector( (handler), TEST_VECTOR, 1 ); set_vector( (handler), TEST_VECTOR, 1 );
@@ -80,22 +82,20 @@
#define MUST_WAIT_FOR_INTERRUPT 1 #define MUST_WAIT_FOR_INTERRUPT 1
static inline void Install_tm27_vector( static inline void Install_tm27_vector( rtems_interrupt_handler handler )
void ( *handler )( rtems_vector_number )
)
{ {
(void) rtems_interrupt_handler_install( (void) rtems_interrupt_handler_install(
TEST_INTERRUPT_SOURCE, TEST_INTERRUPT_SOURCE,
"tm27 low", "tm27 low",
RTEMS_INTERRUPT_SHARED, RTEMS_INTERRUPT_SHARED,
(rtems_interrupt_handler) handler, handler,
NULL NULL
); );
(void) rtems_interrupt_handler_install( (void) rtems_interrupt_handler_install(
TEST_INTERRUPT_SOURCE2, TEST_INTERRUPT_SOURCE2,
"tm27 high", "tm27 high",
RTEMS_INTERRUPT_SHARED, RTEMS_INTERRUPT_SHARED,
(rtems_interrupt_handler) handler, handler,
NULL NULL
); );
} }

View File

@@ -59,6 +59,8 @@
#define MUST_WAIT_FOR_INTERRUPT 1 #define MUST_WAIT_FOR_INTERRUPT 1
#define TM27_USE_VECTOR_HANDLER
#define Install_tm27_vector( handler ) \ #define Install_tm27_vector( handler ) \
set_vector( (handler), TEST_VECTOR, 1 ); set_vector( (handler), TEST_VECTOR, 1 );
@@ -79,22 +81,20 @@
#define TEST_INTERRUPT_SOURCE2 LEON_INTERRUPT_EXTERNAL_1+1 #define TEST_INTERRUPT_SOURCE2 LEON_INTERRUPT_EXTERNAL_1+1
#define MUST_WAIT_FOR_INTERRUPT 1 #define MUST_WAIT_FOR_INTERRUPT 1
static inline void Install_tm27_vector( static inline void Install_tm27_vector( rtems_interrupt_handler handler )
void ( *handler )( rtems_vector_number )
)
{ {
(void) rtems_interrupt_handler_install( (void) rtems_interrupt_handler_install(
TEST_INTERRUPT_SOURCE, TEST_INTERRUPT_SOURCE,
"tm27 low", "tm27 low",
RTEMS_INTERRUPT_SHARED, RTEMS_INTERRUPT_SHARED,
(rtems_interrupt_handler) handler, handler,
NULL NULL
); );
(void) rtems_interrupt_handler_install( (void) rtems_interrupt_handler_install(
TEST_INTERRUPT_SOURCE2, TEST_INTERRUPT_SOURCE2,
"tm27 high", "tm27 high",
RTEMS_INTERRUPT_SHARED, RTEMS_INTERRUPT_SHARED,
(rtems_interrupt_handler) handler, handler,
NULL NULL
); );
} }

View File

@@ -66,6 +66,8 @@
#define MUST_WAIT_FOR_INTERRUPT 1 #define MUST_WAIT_FOR_INTERRUPT 1
#define TM27_USE_VECTOR_HANDLER
#define Install_tm27_vector( handler ) \ #define Install_tm27_vector( handler ) \
set_vector( (handler), TEST_VECTOR, 1 ); set_vector( (handler), TEST_VECTOR, 1 );
@@ -88,9 +90,7 @@ extern uint32_t Interrupt_nest;
#define TEST_INTERRUPT_SOURCE2 6 #define TEST_INTERRUPT_SOURCE2 6
#define MUST_WAIT_FOR_INTERRUPT 1 #define MUST_WAIT_FOR_INTERRUPT 1
static inline void Install_tm27_vector( static inline void Install_tm27_vector( rtems_interrupt_handler handler )
void ( *handler )( rtems_vector_number )
)
{ {
static rtems_interrupt_entry entry_low; static rtems_interrupt_entry entry_low;
static rtems_interrupt_entry entry_high; static rtems_interrupt_entry entry_high;
@@ -108,7 +108,7 @@ static inline void Install_tm27_vector(
rtems_interrupt_entry_initialize( rtems_interrupt_entry_initialize(
&entry_low, &entry_low,
(rtems_interrupt_handler) handler, handler,
NULL, NULL,
"tm27 low" "tm27 low"
); );
@@ -119,7 +119,7 @@ static inline void Install_tm27_vector(
); );
rtems_interrupt_entry_initialize( rtems_interrupt_entry_initialize(
&entry_high, &entry_high,
(rtems_interrupt_handler) handler, handler,
NULL, NULL,
"tm27 high" "tm27 high"
); );

View File

@@ -45,10 +45,6 @@ uint32_t Interrupt_nest;
uint32_t timer_overhead; uint32_t timer_overhead;
uint32_t Interrupt_enter_time; uint32_t Interrupt_enter_time;
rtems_isr Isr_handler(
rtems_vector_number vector
);
rtems_task Init( rtems_task Init(
rtems_task_argument argument rtems_task_argument argument
) )
@@ -91,6 +87,19 @@ rtems_task Init(
rtems_task_exit(); 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 Task_1(
rtems_task_argument argument rtems_task_argument argument
) )
@@ -114,12 +123,3 @@ rtems_task Task_1(
TEST_END(); TEST_END();
rtems_test_exit( 0 ); 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();
}

View File

@@ -62,10 +62,6 @@ volatile uint32_t Interrupt_return_time, Interrupt_return_nested_time;
uint32_t Interrupt_nest; uint32_t Interrupt_nest;
uint32_t timer_overhead; uint32_t timer_overhead;
rtems_isr Isr_handler(
rtems_vector_number vector
);
static void set_thread_executing( Thread_Control *thread ) static void set_thread_executing( Thread_Control *thread )
{ {
_Per_CPU_Get_snapshot()->executing = thread; _Per_CPU_Get_snapshot()->executing = thread;
@@ -126,6 +122,55 @@ rtems_task Init(
rtems_task_exit(); 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 Task_1(
rtems_task_argument argument rtems_task_argument argument
) )
@@ -302,50 +347,3 @@ rtems_task Task_2(
_Thread_Dispatch(); _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();
}

View File

@@ -76,11 +76,15 @@ void CallWithinISRClear( void )
Clear_tm27_intr(); 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; CallWithinISRContext *ctx;
(void) vector; (void) arg;
ctx = &CallWithinISRInstance; ctx = &CallWithinISRInstance;
CallWithinISRClear(); CallWithinISRClear();
@@ -148,7 +152,7 @@ static void CallWithinISRIsHandlerInstalled(
(void) option; (void) option;
(void) handler_arg; (void) handler_arg;
if ( handler == (rtems_interrupt_handler) CallWithinISRHandler ) { if ( handler == CallWithinISRHandler ) {
*(bool *) arg = true; *(bool *) arg = true;
} }
} }