[PATCH] tm27: Avoid function pointer casts

Sebastian Huber sebastian.huber at embedded-brains.de
Mon Jan 23 13:58:43 UTC 2023


Add TM27_USE_VECTOR_HANDLER to select the interrupt handler type used by
the <tm27.h> implementation.

Close #4820.
---
 bsps/arm/lpc32xx/include/tm27.h              |  4 +--
 bsps/bfin/TLL6527M/include/tm27.h            |  2 ++
 bsps/bfin/eZKit533/include/tm27.h            |  2 ++
 bsps/include/dev/irq/arm-gic-tm27.h          |  4 +--
 bsps/lm32/lm32_evr/include/tm27.h            |  2 ++
 bsps/m68k/av5282/include/tm27.h              |  2 ++
 bsps/m68k/csb360/include/tm27.h              |  2 ++
 bsps/m68k/gen68360/include/tm27.h            |  2 ++
 bsps/m68k/genmcf548x/include/tm27.h          |  2 ++
 bsps/m68k/mcf5206elite/include/tm27.h        |  2 ++
 bsps/m68k/mcf52235/include/tm27.h            |  2 ++
 bsps/m68k/mcf5225x/include/tm27.h            |  2 ++
 bsps/m68k/mcf5235/include/tm27.h             |  2 ++
 bsps/m68k/mcf5329/include/tm27.h             |  2 ++
 bsps/m68k/mvme147/include/tm27.h             |  2 ++
 bsps/m68k/mvme147s/include/tm27.h            |  2 ++
 bsps/m68k/mvme162/include/tm27.h             |  2 ++
 bsps/m68k/mvme167/include/tm27.h             |  2 ++
 bsps/m68k/uC5282/include/tm27.h              |  2 ++
 bsps/mips/csb350/include/tm27.h              |  2 +-
 bsps/mips/jmr3904/include/tm27.h             |  2 +-
 bsps/powerpc/gen5200/include/tm27.h          |  4 +--
 bsps/powerpc/gen83xx/include/tm27.h          |  6 ++---
 bsps/powerpc/motorola_powerpc/include/tm27.h |  4 +--
 bsps/powerpc/mpc8260ads/include/tm27.h       |  2 +-
 bsps/powerpc/mvme5500/include/tm27.h         |  4 +--
 bsps/powerpc/psim/include/tm27.h             |  4 +--
 bsps/powerpc/qoriq/include/tm27.h            |  6 ++---
 bsps/powerpc/ss555/include/tm27.h            |  2 +-
 bsps/riscv/riscv/include/tm27.h              |  6 ++---
 bsps/sh/gensh4/include/tm27.h                |  2 ++
 bsps/sparc/erc32/include/tm27.h              | 10 ++++----
 bsps/sparc/leon2/include/tm27.h              | 10 ++++----
 bsps/sparc/leon3/include/tm27.h              | 10 ++++----
 testsuites/rhealstone/rhilatency/ilatency.c  | 26 ++++++++++----------
 testsuites/tmtests/tm27/task1.c              | 14 +++++------
 testsuites/validation/tx-call-within-isr.c   | 10 +++++---
 37 files changed, 102 insertions(+), 64 deletions(-)

diff --git a/bsps/arm/lpc32xx/include/tm27.h b/bsps/arm/lpc32xx/include/tm27.h
index 3708909bb7..17b2b01fb0 100644
--- a/bsps/arm/lpc32xx/include/tm27.h
+++ b/bsps/arm/lpc32xx/include/tm27.h
@@ -51,7 +51,7 @@
 
 #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;
   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(
     &entry,
-    (rtems_interrupt_handler) handler,
+    handler,
     NULL,
     "tm27"
   );
diff --git a/bsps/bfin/TLL6527M/include/tm27.h b/bsps/bfin/TLL6527M/include/tm27.h
index 6a943fec1b..f192790a0f 100644
--- a/bsps/bfin/TLL6527M/include/tm27.h
+++ b/bsps/bfin/TLL6527M/include/tm27.h
@@ -34,6 +34,8 @@
 
 #define MUST_WAIT_FOR_INTERRUPT 0
 
+#define TM27_USE_VECTOR_HANDLER
+
 #define Install_tm27_vector(handler) \
 { \
   set_vector( handler, 0x06, 1 ); \
diff --git a/bsps/bfin/eZKit533/include/tm27.h b/bsps/bfin/eZKit533/include/tm27.h
index 834eee8229..3871908e62 100644
--- a/bsps/bfin/eZKit533/include/tm27.h
+++ b/bsps/bfin/eZKit533/include/tm27.h
@@ -32,6 +32,8 @@
 
 #define MUST_WAIT_FOR_INTERRUPT 0
 
+#define TM27_USE_VECTOR_HANDLER
+
 #define Install_tm27_vector(handler) \
 { \
   set_vector( handler, 0x06, 1 ); \
diff --git a/bsps/include/dev/irq/arm-gic-tm27.h b/bsps/include/dev/irq/arm-gic-tm27.h
index 466f40acaf..ff8744131e 100644
--- a/bsps/include/dev/irq/arm-gic-tm27.h
+++ b/bsps/include/dev/irq/arm-gic-tm27.h
@@ -59,13 +59,13 @@
 
 #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(
     ARM_GIC_TM27_IRQ_LOW,
     "tm27 low",
     RTEMS_INTERRUPT_UNIQUE,
-    (rtems_interrupt_handler) handler,
+    handler,
     NULL
   );
   assert(sc == RTEMS_SUCCESSFUL);
diff --git a/bsps/lm32/lm32_evr/include/tm27.h b/bsps/lm32/lm32_evr/include/tm27.h
index f62e62e73f..a4cdadecae 100644
--- a/bsps/lm32/lm32_evr/include/tm27.h
+++ b/bsps/lm32/lm32_evr/include/tm27.h
@@ -27,6 +27,8 @@
 
 #define MUST_WAIT_FOR_INTERRUPT 0
 
+#define TM27_USE_VECTOR_HANDLER
+
 #define Install_tm27_vector( handler ) set_vector( (handler), 0, 1 )
 
 #define Cause_tm27_intr() /* empty */
diff --git a/bsps/m68k/av5282/include/tm27.h b/bsps/m68k/av5282/include/tm27.h
index 1e1dc77e59..899cd6562c 100644
--- a/bsps/m68k/av5282/include/tm27.h
+++ b/bsps/m68k/av5282/include/tm27.h
@@ -26,6 +26,8 @@
 
 #define MUST_WAIT_FOR_INTERRUPT 0
 
+#define TM27_USE_VECTOR_HANDLER
+
 #define Install_tm27_vector( handler ) set_vector( (handler), 35, 1 )
 
 #define Cause_tm27_intr()	asm volatile ("trap #3");
diff --git a/bsps/m68k/csb360/include/tm27.h b/bsps/m68k/csb360/include/tm27.h
index 5f2fd8a383..27b96a5370 100644
--- a/bsps/m68k/csb360/include/tm27.h
+++ b/bsps/m68k/csb360/include/tm27.h
@@ -28,6 +28,8 @@
 
 #define MUST_WAIT_FOR_INTERRUPT 0
 
+#define TM27_USE_VECTOR_HANDLER
+
 #define Install_tm27_vector( handler ) set_vector( (handler), 34, 1 )
 
 #define Cause_tm27_intr()	asm volatile ("trap #2");
diff --git a/bsps/m68k/gen68360/include/tm27.h b/bsps/m68k/gen68360/include/tm27.h
index 5523a4a345..6134f15d68 100644
--- a/bsps/m68k/gen68360/include/tm27.h
+++ b/bsps/m68k/gen68360/include/tm27.h
@@ -29,6 +29,8 @@
 
 #define MUST_WAIT_FOR_INTERRUPT 0
 
+#define TM27_USE_VECTOR_HANDLER
+
 #define Install_tm27_vector( handler ) set_vector( (handler), 34, 1 )
 
 #define Cause_tm27_intr()	asm volatile ("trap #2");
diff --git a/bsps/m68k/genmcf548x/include/tm27.h b/bsps/m68k/genmcf548x/include/tm27.h
index ad51ee7915..6d793b1f17 100644
--- a/bsps/m68k/genmcf548x/include/tm27.h
+++ b/bsps/m68k/genmcf548x/include/tm27.h
@@ -26,6 +26,8 @@
 
 #define MUST_WAIT_FOR_INTERRUPT 0
 
+#define TM27_USE_VECTOR_HANDLER
+
 #define Install_tm27_vector( handler ) set_vector( (handler), 35, 1 )
 
 #define Cause_tm27_intr()	asm volatile ("trap #3");
diff --git a/bsps/m68k/mcf5206elite/include/tm27.h b/bsps/m68k/mcf5206elite/include/tm27.h
index 2abef68311..6190993f0c 100644
--- a/bsps/m68k/mcf5206elite/include/tm27.h
+++ b/bsps/m68k/mcf5206elite/include/tm27.h
@@ -24,6 +24,8 @@
 
 #define MUST_WAIT_FOR_INTERRUPT 0
 
+#define TM27_USE_VECTOR_HANDLER
+
 #define Install_tm27_vector( handler ) set_vector( (handler), 34, 1 )
 
 #define Cause_tm27_intr()	asm volatile ("trap #2");
diff --git a/bsps/m68k/mcf52235/include/tm27.h b/bsps/m68k/mcf52235/include/tm27.h
index b4b62ef721..12775fc953 100644
--- a/bsps/m68k/mcf52235/include/tm27.h
+++ b/bsps/m68k/mcf52235/include/tm27.h
@@ -24,6 +24,8 @@
 
 #define MUST_WAIT_FOR_INTERRUPT 0
 
+#define TM27_USE_VECTOR_HANDLER
+
 #define Install_tm27_vector( handler ) set_vector( (handler), 35, 1 )
 
 #define Cause_tm27_intr()	asm volatile ("trap #3");
diff --git a/bsps/m68k/mcf5225x/include/tm27.h b/bsps/m68k/mcf5225x/include/tm27.h
index fcf1c4f8aa..93dc07878b 100644
--- a/bsps/m68k/mcf5225x/include/tm27.h
+++ b/bsps/m68k/mcf5225x/include/tm27.h
@@ -24,6 +24,8 @@
 
 #define MUST_WAIT_FOR_INTERRUPT 0
 
+#define TM27_USE_VECTOR_HANDLER
+
 #define Install_tm27_vector( handler ) set_vector( (handler), 35, 1 )
 
 #define Cause_tm27_intr()	asm volatile ("trap #3");
diff --git a/bsps/m68k/mcf5235/include/tm27.h b/bsps/m68k/mcf5235/include/tm27.h
index 92a85c789a..ae6f34e7b8 100644
--- a/bsps/m68k/mcf5235/include/tm27.h
+++ b/bsps/m68k/mcf5235/include/tm27.h
@@ -24,6 +24,8 @@
 
 #define MUST_WAIT_FOR_INTERRUPT 0
 
+#define TM27_USE_VECTOR_HANDLER
+
 #define Install_tm27_vector( handler ) set_vector( (handler), 35, 1 )
 
 #define Cause_tm27_intr()	asm volatile ("trap #3");
diff --git a/bsps/m68k/mcf5329/include/tm27.h b/bsps/m68k/mcf5329/include/tm27.h
index 33376540ac..98e02cf170 100644
--- a/bsps/m68k/mcf5329/include/tm27.h
+++ b/bsps/m68k/mcf5329/include/tm27.h
@@ -24,6 +24,8 @@
 
 #define MUST_WAIT_FOR_INTERRUPT 0
 
+#define TM27_USE_VECTOR_HANDLER
+
 #define Install_tm27_vector( handler ) set_vector( (handler), 35, 1 )
 
 #define Cause_tm27_intr()	asm volatile ("trap #3");
diff --git a/bsps/m68k/mvme147/include/tm27.h b/bsps/m68k/mvme147/include/tm27.h
index 5b548a888a..17609a8375 100644
--- a/bsps/m68k/mvme147/include/tm27.h
+++ b/bsps/m68k/mvme147/include/tm27.h
@@ -25,6 +25,8 @@
 
 #define MUST_WAIT_FOR_INTERRUPT 0
 
+#define TM27_USE_VECTOR_HANDLER
+
 #define Install_tm27_vector( handler ) set_vector( (handler), \
 						   SOFT_1_VECTOR, 1 )
 
diff --git a/bsps/m68k/mvme147s/include/tm27.h b/bsps/m68k/mvme147s/include/tm27.h
index 48ae0f459a..0e9f993ee9 100644
--- a/bsps/m68k/mvme147s/include/tm27.h
+++ b/bsps/m68k/mvme147s/include/tm27.h
@@ -25,6 +25,8 @@
 
 #define MUST_WAIT_FOR_INTERRUPT 0
 
+#define TM27_USE_VECTOR_HANDLER
+
 #define Install_tm27_vector( handler ) set_vector( (handler), \
 						   SOFT_1_VECTOR, 1 )
 
diff --git a/bsps/m68k/mvme162/include/tm27.h b/bsps/m68k/mvme162/include/tm27.h
index 750408d009..6ff48d79e0 100644
--- a/bsps/m68k/mvme162/include/tm27.h
+++ b/bsps/m68k/mvme162/include/tm27.h
@@ -25,6 +25,8 @@
 
 #define MUST_WAIT_FOR_INTERRUPT 0
 
+#define TM27_USE_VECTOR_HANDLER
+
 #define Install_tm27_vector( handler ) \
             set_vector( (handler), VBR1 * 0x10 + 0x8, 1 ); \
             lcsr->intr_level[2] |= 3; \
diff --git a/bsps/m68k/mvme167/include/tm27.h b/bsps/m68k/mvme167/include/tm27.h
index 5b65311794..7f84ec3c0d 100644
--- a/bsps/m68k/mvme167/include/tm27.h
+++ b/bsps/m68k/mvme167/include/tm27.h
@@ -24,6 +24,8 @@
  */
 #define MUST_WAIT_FOR_INTERRUPT 0
 
+#define TM27_USE_VECTOR_HANDLER
+
 #define Install_tm27_vector( handler ) \
             set_vector( (handler), VBR1 * 0x10 + 0x8, 1 ); \
             lcsr->intr_level[2] |= 3; \
diff --git a/bsps/m68k/uC5282/include/tm27.h b/bsps/m68k/uC5282/include/tm27.h
index 6d8e2cc344..86a1920177 100644
--- a/bsps/m68k/uC5282/include/tm27.h
+++ b/bsps/m68k/uC5282/include/tm27.h
@@ -29,6 +29,8 @@
 
 #define MUST_WAIT_FOR_INTERRUPT 0
 
+#define TM27_USE_VECTOR_HANDLER
+
 #define Install_tm27_vector( handler ) set_vector( (handler), 35, 1 )
 
 #define Cause_tm27_intr()	asm volatile ("trap #3");
diff --git a/bsps/mips/csb350/include/tm27.h b/bsps/mips/csb350/include/tm27.h
index 3a8957d698..e3056877dd 100644
--- a/bsps/mips/csb350/include/tm27.h
+++ b/bsps/mips/csb350/include/tm27.h
@@ -28,7 +28,7 @@ int negate_sw_irw(uint32_t irqnum);
 
 #define Install_tm27_vector( handler ) \
    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() \
   do { \
diff --git a/bsps/mips/jmr3904/include/tm27.h b/bsps/mips/jmr3904/include/tm27.h
index f73ccdea40..b22caa7a8e 100644
--- a/bsps/mips/jmr3904/include/tm27.h
+++ b/bsps/mips/jmr3904/include/tm27.h
@@ -26,7 +26,7 @@
 #define Install_tm27_vector( handler ) \
    rtems_interrupt_handler_install( \
       TX3904_IRQ_TMR0, "benchmark", 0, \
-      (rtems_interrupt_handler)handler, NULL );
+      handler, NULL );
 
 #define Cause_tm27_intr() \
   do { \
diff --git a/bsps/powerpc/gen5200/include/tm27.h b/bsps/powerpc/gen5200/include/tm27.h
index 77dc566e49..d86e6c1d12 100644
--- a/bsps/powerpc/gen5200/include/tm27.h
+++ b/bsps/powerpc/gen5200/include/tm27.h
@@ -34,9 +34,9 @@ static rtems_irq_connect_data clockIrqData = {BSP_DECREMENTER,
                                               (rtems_irq_disable) 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)) {
     printk("Error installing clock interrupt handler!\n");
     bsp_fatal(MPC5200_FATAL_TM27_IRQ_INSTALL);
diff --git a/bsps/powerpc/gen83xx/include/tm27.h b/bsps/powerpc/gen83xx/include/tm27.h
index cb0c900066..37adc7df98 100644
--- a/bsps/powerpc/gen83xx/include/tm27.h
+++ b/bsps/powerpc/gen83xx/include/tm27.h
@@ -42,16 +42,16 @@
 
 #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)
 {
-	(*tm27_interrupt_handler)( 0);
+	(*tm27_interrupt_handler)( NULL);
 
 	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;
 
diff --git a/bsps/powerpc/motorola_powerpc/include/tm27.h b/bsps/powerpc/motorola_powerpc/include/tm27.h
index 15e66f2a81..ffdd55706b 100644
--- a/bsps/powerpc/motorola_powerpc/include/tm27.h
+++ b/bsps/powerpc/motorola_powerpc/include/tm27.h
@@ -39,9 +39,9 @@ static rtems_irq_connect_data clockIrqData =
  .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)) {
 	printk("Error installing clock interrupt handler!\n");
 	rtems_fatal_error_occurred(1);
diff --git a/bsps/powerpc/mpc8260ads/include/tm27.h b/bsps/powerpc/mpc8260ads/include/tm27.h
index b1eafc47aa..56abceacd5 100644
--- a/bsps/powerpc/mpc8260ads/include/tm27.h
+++ b/bsps/powerpc/mpc8260ads/include/tm27.h
@@ -29,7 +29,7 @@
    do { \
 	static rtems_irq_connect_data scIrqData = { \
 	  PPC_IRQ_SCALL, \
-	  (rtems_irq_hdl) handler, \
+	  handler, \
 	  NULL, \
 	  NULL, \
 	  NULL  \
diff --git a/bsps/powerpc/mvme5500/include/tm27.h b/bsps/powerpc/mvme5500/include/tm27.h
index 99686dc85d..ae687e319c 100644
--- a/bsps/powerpc/mvme5500/include/tm27.h
+++ b/bsps/powerpc/mvme5500/include/tm27.h
@@ -32,9 +32,9 @@ static rtems_irq_connect_data clockIrqData = {BSP_DECREMENTER,
                                               (rtems_irq_disable)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)) {
         printk("Error installing clock interrupt handler!\n");
         rtems_fatal_error_occurred(1);
diff --git a/bsps/powerpc/psim/include/tm27.h b/bsps/powerpc/psim/include/tm27.h
index c8781efe65..af472d1621 100644
--- a/bsps/powerpc/psim/include/tm27.h
+++ b/bsps/powerpc/psim/include/tm27.h
@@ -32,9 +32,9 @@ static rtems_irq_connect_data clockIrqData = {BSP_DECREMENTER,
                                               (rtems_irq_disable)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)) {
     printk("Error installing clock interrupt handler!\n");
     rtems_fatal_error_occurred(1);
diff --git a/bsps/powerpc/qoriq/include/tm27.h b/bsps/powerpc/qoriq/include/tm27.h
index 4ac769de90..a790fce0ba 100644
--- a/bsps/powerpc/qoriq/include/tm27.h
+++ b/bsps/powerpc/qoriq/include/tm27.h
@@ -53,7 +53,7 @@
 
 #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_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,
     "tm17 low",
     RTEMS_INTERRUPT_UNIQUE,
-    (rtems_interrupt_handler) handler,
+    handler,
     NULL
   );
   assert(sc == RTEMS_SUCCESSFUL);
@@ -75,7 +75,7 @@ static inline void Install_tm27_vector(void (*handler)(rtems_vector_number))
     high,
     "tm17 high",
     RTEMS_INTERRUPT_UNIQUE,
-    (rtems_interrupt_handler) handler,
+    handler,
     NULL
   );
   assert(sc == RTEMS_SUCCESSFUL);
diff --git a/bsps/powerpc/ss555/include/tm27.h b/bsps/powerpc/ss555/include/tm27.h
index 5106801744..37e5ce0a6c 100644
--- a/bsps/powerpc/ss555/include/tm27.h
+++ b/bsps/powerpc/ss555/include/tm27.h
@@ -32,7 +32,7 @@
   usiu.siel |= (1 << 17); 						\
   usiu.sipend |= (1 << 17); 						\
 									\
-  tm27IrqData.hdl = (rtems_irq_hdl)handler;				\
+  tm27IrqData.hdl = handler;						\
   BSP_install_rtems_irq_handler (&tm27IrqData);				\
 }
 
diff --git a/bsps/riscv/riscv/include/tm27.h b/bsps/riscv/riscv/include/tm27.h
index 1226fc8667..9fe6bcd255 100644
--- a/bsps/riscv/riscv/include/tm27.h
+++ b/bsps/riscv/riscv/include/tm27.h
@@ -52,9 +52,7 @@ static bool riscv_tm27_can_use_mtime;
 
 static rtems_interrupt_entry riscv_tm27_interrupt_entry;
 
-static inline void Install_tm27_vector(
-  void ( *handler )( rtems_vector_number )
-)
+static inline void Install_tm27_vector( rtems_interrupt_handler handler )
 {
   rtems_vector_number irq;
   bool                enabled;
@@ -71,7 +69,7 @@ static inline void Install_tm27_vector(
 
   rtems_interrupt_entry_initialize(
     &riscv_tm27_interrupt_entry,
-    (rtems_interrupt_handler) handler,
+    handler,
     NULL,
     "tm27"
   );
diff --git a/bsps/sh/gensh4/include/tm27.h b/bsps/sh/gensh4/include/tm27.h
index c26ec49272..978bf8505a 100644
--- a/bsps/sh/gensh4/include/tm27.h
+++ b/bsps/sh/gensh4/include/tm27.h
@@ -27,6 +27,8 @@
 #   error "..."
 #endif
 
+#define TM27_USE_VECTOR_HANDLER
+
 #define Install_tm27_vector( handler ) \
 { \
     rtems_isr_entry old_handler; \
diff --git a/bsps/sparc/erc32/include/tm27.h b/bsps/sparc/erc32/include/tm27.h
index 9063fbcc9f..90b885d876 100644
--- a/bsps/sparc/erc32/include/tm27.h
+++ b/bsps/sparc/erc32/include/tm27.h
@@ -59,6 +59,8 @@
 
 #define MUST_WAIT_FOR_INTERRUPT 1
 
+#define TM27_USE_VECTOR_HANDLER
+
 #define Install_tm27_vector( handler ) \
   set_vector( (handler), TEST_VECTOR, 1 );
 
@@ -80,22 +82,20 @@
 
 #define MUST_WAIT_FOR_INTERRUPT 1
 
-static inline void Install_tm27_vector(
-  void ( *handler )( rtems_vector_number )
-)
+static inline void Install_tm27_vector( rtems_interrupt_handler handler )
 {
   (void) rtems_interrupt_handler_install(
     TEST_INTERRUPT_SOURCE,
     "tm27 low",
     RTEMS_INTERRUPT_SHARED,
-    (rtems_interrupt_handler) handler,
+    handler,
     NULL
   );
   (void) rtems_interrupt_handler_install(
     TEST_INTERRUPT_SOURCE2,
     "tm27 high",
     RTEMS_INTERRUPT_SHARED,
-    (rtems_interrupt_handler) handler,
+    handler,
     NULL
   );
 }
diff --git a/bsps/sparc/leon2/include/tm27.h b/bsps/sparc/leon2/include/tm27.h
index 4e83707177..06e5151e73 100644
--- a/bsps/sparc/leon2/include/tm27.h
+++ b/bsps/sparc/leon2/include/tm27.h
@@ -59,6 +59,8 @@
 
 #define MUST_WAIT_FOR_INTERRUPT 1
 
+#define TM27_USE_VECTOR_HANDLER
+
 #define Install_tm27_vector( handler ) \
   set_vector( (handler), TEST_VECTOR, 1 );
 
@@ -79,22 +81,20 @@
 #define TEST_INTERRUPT_SOURCE2 LEON_INTERRUPT_EXTERNAL_1+1
 #define MUST_WAIT_FOR_INTERRUPT 1
 
-static inline void Install_tm27_vector(
-  void ( *handler )( rtems_vector_number )
-)
+static inline void Install_tm27_vector( rtems_interrupt_handler handler )
 {
   (void) rtems_interrupt_handler_install(
     TEST_INTERRUPT_SOURCE,
     "tm27 low",
     RTEMS_INTERRUPT_SHARED,
-    (rtems_interrupt_handler) handler,
+    handler,
     NULL
   );
   (void) rtems_interrupt_handler_install(
     TEST_INTERRUPT_SOURCE2,
     "tm27 high",
     RTEMS_INTERRUPT_SHARED,
-    (rtems_interrupt_handler) handler,
+    handler,
     NULL
   );
 }
diff --git a/bsps/sparc/leon3/include/tm27.h b/bsps/sparc/leon3/include/tm27.h
index 690bb003e9..f078b12dd1 100644
--- a/bsps/sparc/leon3/include/tm27.h
+++ b/bsps/sparc/leon3/include/tm27.h
@@ -66,6 +66,8 @@
 
 #define MUST_WAIT_FOR_INTERRUPT 1
 
+#define TM27_USE_VECTOR_HANDLER
+
 #define Install_tm27_vector( handler ) \
   set_vector( (handler), TEST_VECTOR, 1 );
 
@@ -88,9 +90,7 @@ extern uint32_t Interrupt_nest;
 #define TEST_INTERRUPT_SOURCE2 6
 #define MUST_WAIT_FOR_INTERRUPT 1
 
-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_low;
   static rtems_interrupt_entry entry_high;
@@ -108,7 +108,7 @@ static inline void Install_tm27_vector(
 
   rtems_interrupt_entry_initialize(
     &entry_low,
-    (rtems_interrupt_handler) handler,
+    handler,
     NULL,
     "tm27 low"
   );
@@ -119,7 +119,7 @@ static inline void Install_tm27_vector(
   );
   rtems_interrupt_entry_initialize(
     &entry_high,
-    (rtems_interrupt_handler) handler,
+    handler,
     NULL,
     "tm27 high"
   );
diff --git a/testsuites/rhealstone/rhilatency/ilatency.c b/testsuites/rhealstone/rhilatency/ilatency.c
index f4a450795f..2f6b185604 100644
--- a/testsuites/rhealstone/rhilatency/ilatency.c
+++ b/testsuites/rhealstone/rhilatency/ilatency.c
@@ -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();
-}
diff --git a/testsuites/tmtests/tm27/task1.c b/testsuites/tmtests/tm27/task1.c
index 54aca545b8..df2a677090 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;
@@ -310,10 +306,14 @@ rtems_task Task_2(
 
 void Isr_handler_inner( void );
 
-rtems_isr Isr_handler(
-  rtems_vector_number vector
-)
+#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;
diff --git a/testsuites/validation/tx-call-within-isr.c b/testsuites/validation/tx-call-within-isr.c
index 0767f96edf..91560b70b0 100644
--- a/testsuites/validation/tx-call-within-isr.c
+++ b/testsuites/validation/tx-call-within-isr.c
@@ -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;
   }
 }
-- 
2.35.3



More information about the devel mailing list