[PATCH] bsps: Avoid unused argument in clock interrupt

Gedare Bloom gedare at rtems.org
Thu Mar 21 19:45:33 UTC 2024


Generally this looks ok to me, but please update
https://docs.rtems.org/branches/master/bsp-howto/clock.html#initialization
https://docs.rtems.org/branches/master/bsp-howto/clock.html#support-at-tick
to explain how this arg works.

On Wed, Mar 20, 2024 at 8:29 AM Sebastian Huber
<sebastian.huber at embedded-brains.de> wrote:
>
> Pass the parameter of the clock interrupt handler to
> Clock_driver_support_at_tick() and Clock_driver_timecounter_tick().  This makes
> it possible to use the interrupt handler argument in clock drivers.
>
> Use the interrupt handler provided by Clock_driver_support_install_isr() to
> avoid local delarations of Clock_isr().
>
> Update #4862.
> ---
>  bsps/arm/beagle/clock/clock.c                 |  2 +-
>  bsps/arm/csb336/clock/clockdrv.c              |  2 +-
>  bsps/arm/csb337/clock/clock.c                 |  2 +-
>  bsps/arm/edb7312/clock/clockdrv.c             |  6 +--
>  bsps/arm/gumstix/clock/clock.c                |  2 +-
>  bsps/arm/raspberrypi/clock/clockdrv.c         | 27 +++++---------
>  bsps/arm/rtl22xx/clock/clockdrv.c             |  2 +-
>  bsps/arm/shared/clock/clock-a9mpcore.c        | 28 ++++++--------
>  bsps/arm/shared/clock/clock-nxp-lpc.c         | 17 ++++-----
>  bsps/arm/smdk2410/clock/clockdrv.c            |  2 +-
>  bsps/arm/tms570/clock/clock.c                 | 20 +++++-----
>  bsps/i386/pc386/clock/ckinit.c                |  2 +-
>  bsps/lm32/shared/clock/ckinit.c               |  2 +-
>  bsps/lm32/shared/milkymist_clock/ckinit.c     |  2 +-
>  bsps/m68k/av5282/clock/clock.c                |  2 +-
>  bsps/m68k/gen68360/clock/clock.c              |  2 +-
>  bsps/m68k/genmcf548x/clock/clock.c            |  2 +-
>  bsps/m68k/mcf52235/clock/clock.c              |  2 +-
>  bsps/m68k/mcf5225x/clock/clock.c              |  2 +-
>  bsps/m68k/mcf5235/clock/clock.c               |  2 +-
>  bsps/m68k/mcf5329/clock/clock.c               |  2 +-
>  bsps/m68k/mrm332/btimer/btimer.c              |  2 -
>  bsps/m68k/uC5282/clock/clock.c                |  2 +-
>  bsps/microblaze/microblaze_fpga/clock/clock.c |  8 ++--
>  bsps/mips/csb350/clock/clockdrv.c             |  4 +-
>  bsps/mips/rbtx4925/clock/clockdrv.c           |  2 +-
>  bsps/mips/rbtx4938/clock/clockdrv.c           |  2 +-
>  bsps/mips/shared/clock/clockdrv.c             |  2 +-
>  bsps/nios2/nios2_iss/clock/clock.c            |  2 +-
>  bsps/or1k/generic_or1k/clock/clockdrv.c       |  2 +-
>  bsps/powerpc/mpc55xxevb/clock/clock-config.c  | 24 ++++++------
>  bsps/powerpc/qoriq/clock/clock-config.c       | 14 +++----
>  bsps/riscv/griscv/clock/clockdrv.c            |  2 +-
>  bsps/riscv/riscv/clock/clockdrv.c             | 13 +++----
>  bsps/shared/dev/clock/arm-generic-timer.c     | 19 ++++------
>  bsps/shared/dev/clock/clockimpl.h             | 37 +++++++++----------
>  bsps/shared/dev/clock/xil-ttc.c               | 32 ++++++----------
>  bsps/shared/grlib/btimer/tlib_ckinit.c        |  4 +-
>  bsps/sparc/erc32/clock/ckinit.c               |  8 ++--
>  bsps/sparc/leon2/clock/ckinit.c               |  2 +-
>  bsps/sparc/leon3/clock/ckinit.c               |  2 +-
>  bsps/sparc64/shared/clock/ckinit.c            |  2 +-
>  42 files changed, 137 insertions(+), 178 deletions(-)
>
> diff --git a/bsps/arm/beagle/clock/clock.c b/bsps/arm/beagle/clock/clock.c
> index d42b051c98..a32dde86bf 100644
> --- a/bsps/arm/beagle/clock/clock.c
> +++ b/bsps/arm/beagle/clock/clock.c
> @@ -290,7 +290,7 @@ static void beagle_clock_handler_install(rtems_interrupt_handler isr)
>    clock_isr = isr;
>  }
>
> -#define Clock_driver_support_at_tick() beagle_clock_at_tick()
> +#define Clock_driver_support_at_tick(arg) beagle_clock_at_tick()
>  #define Clock_driver_support_initialize_hardware() beagle_clock_initialize()
>  #define Clock_driver_support_install_isr(isr) \
>    beagle_clock_handler_install(isr)
> diff --git a/bsps/arm/csb336/clock/clockdrv.c b/bsps/arm/csb336/clock/clockdrv.c
> index 58f98d87be..6af507a877 100644
> --- a/bsps/arm/csb336/clock/clockdrv.c
> +++ b/bsps/arm/csb336/clock/clockdrv.c
> @@ -38,7 +38,7 @@ rtems_irq_connect_data clock_isr_data = {
>   *    - clear the interrupt bit?
>   *    - restart the timer?
>   */
> -#define Clock_driver_support_at_tick()               \
> +#define Clock_driver_support_at_tick(arg)            \
>    do {                                               \
>      uint32_t reg;                                    \
>                                                       \
> diff --git a/bsps/arm/csb337/clock/clock.c b/bsps/arm/csb337/clock/clock.c
> index 69a3dafd81..ee05387baa 100644
> --- a/bsps/arm/csb337/clock/clock.c
> +++ b/bsps/arm/csb337/clock/clock.c
> @@ -94,7 +94,7 @@ static void Clock_driver_support_initialize_hardware(void)
>    ST_REG(ST_PIMR) = value;
>  }
>
> -#define Clock_driver_support_at_tick() \
> +#define Clock_driver_support_at_tick(arg) \
>    do { \
>      uint32_t st_str; \
>      \
> diff --git a/bsps/arm/edb7312/clock/clockdrv.c b/bsps/arm/edb7312/clock/clockdrv.c
> index 8c7cc4f26a..79289366da 100644
> --- a/bsps/arm/edb7312/clock/clockdrv.c
> +++ b/bsps/arm/edb7312/clock/clockdrv.c
> @@ -18,9 +18,7 @@
>    #define CLOCK_DRIVER_USE_FAST_IDLE 1
>  #endif
>
> -void Clock_isr(void * arg);
> -
> -#define Clock_driver_support_at_tick()                \
> +#define Clock_driver_support_at_tick(arg)             \
>    do {                                                \
>      *EP7312_TC1EOI = 0xffffffff;                      \
>    } while(0)
> @@ -32,7 +30,7 @@ void Clock_isr(void * arg);
>          BSP_TC1OI,                                     \
>          "Clock",                                       \
>          RTEMS_INTERRUPT_UNIQUE,                        \
> -        Clock_isr,                                     \
> +        _new,                                          \
>          NULL                                           \
>      );                                                 \
>      assert(status == RTEMS_SUCCESSFUL);                \
> diff --git a/bsps/arm/gumstix/clock/clock.c b/bsps/arm/gumstix/clock/clock.c
> index c844f50a37..1e8f1fcb3f 100644
> --- a/bsps/arm/gumstix/clock/clock.c
> +++ b/bsps/arm/gumstix/clock/clock.c
> @@ -99,7 +99,7 @@ static void Clock_driver_support_initialize_hardware(void)
>  #endif
>  }
>
> -#define Clock_driver_support_at_tick() \
> +#define Clock_driver_support_at_tick(arg) \
>    do { \
>      /* read the status to clear the int */ \
>      XSCALE_OS_TIMER_TSR = 0x1; \
> diff --git a/bsps/arm/raspberrypi/clock/clockdrv.c b/bsps/arm/raspberrypi/clock/clockdrv.c
> index 8d220d51ba..9fc2a46af8 100644
> --- a/bsps/arm/raspberrypi/clock/clockdrv.c
> +++ b/bsps/arm/raspberrypi/clock/clockdrv.c
> @@ -54,27 +54,18 @@ static void raspberrypi_clock_at_tick(void)
>  }
>
>  static void raspberrypi_clock_handler_install_isr(
> -  rtems_isr_entry clock_isr
> +  rtems_interrupt_handler clock_isr
>  )
>  {
>    rtems_status_code sc = RTEMS_SUCCESSFUL;
>
> -  if (clock_isr != NULL) {
> -    sc = rtems_interrupt_handler_install(
> -      BCM2835_IRQ_ID_GPU_TIMER_M3,
> -      "Clock",
> -      RTEMS_INTERRUPT_UNIQUE,
> -      (rtems_interrupt_handler) clock_isr,
> -      NULL
> -    );
> -  } else {
> -    /* Remove interrupt handler */
> -    sc = rtems_interrupt_handler_remove(
> -      BCM2835_IRQ_ID_GPU_TIMER_M3,
> -      (rtems_interrupt_handler) Clock_isr,
> -      NULL
> -    );
> -  }
> +  sc = rtems_interrupt_handler_install(
> +    BCM2835_IRQ_ID_GPU_TIMER_M3,
> +    "Clock",
> +    RTEMS_INTERRUPT_UNIQUE,
> +    clock_isr,
> +    NULL
> +  );
>    if ( sc != RTEMS_SUCCESSFUL ) {
>      rtems_fatal_error_occurred(0xdeadbeef);
>    }
> @@ -94,7 +85,7 @@ static void raspberrypi_clock_initialize_hardware(void)
>    rtems_timecounter_install(&raspberrypi_tc);
>  }
>
> -#define Clock_driver_support_at_tick() raspberrypi_clock_at_tick()
> +#define Clock_driver_support_at_tick(arg) raspberrypi_clock_at_tick()
>
>  #define Clock_driver_support_initialize_hardware() raspberrypi_clock_initialize_hardware()
>
> diff --git a/bsps/arm/rtl22xx/clock/clockdrv.c b/bsps/arm/rtl22xx/clock/clockdrv.c
> index 0e8fa274a7..53b6a763ee 100644
> --- a/bsps/arm/rtl22xx/clock/clockdrv.c
> +++ b/bsps/arm/rtl22xx/clock/clockdrv.c
> @@ -157,7 +157,7 @@ static int clock_isr_is_on(const rtems_irq_connect_data *irq)
>    return T0IR & 0x01;  /* MR0 mask */
>  }
>
> -#define Clock_driver_timecounter_tick() lpc22xx_tc_tick()
> +#define Clock_driver_timecounter_tick(arg) lpc22xx_tc_tick()
>
>  /* Make sure to include this, and only at the end of the file */
>  #include "../../../shared/dev/clock/clockimpl.h"
> diff --git a/bsps/arm/shared/clock/clock-a9mpcore.c b/bsps/arm/shared/clock/clock-a9mpcore.c
> index 9e0b3418d4..c393933c81 100644
> --- a/bsps/arm/shared/clock/clock-a9mpcore.c
> +++ b/bsps/arm/shared/clock/clock-a9mpcore.c
> @@ -47,33 +47,29 @@
>
>  static struct timecounter a9mpcore_tc;
>
> -/* This is defined in dev/clock/clockimpl.h */
> -void Clock_isr(void *arg);
> -
>  __attribute__ ((weak)) uint32_t a9mpcore_clock_periphclk(void)
>  {
>    /* default to the BSP option. */
>    return BSP_ARM_A9MPCORE_PERIPHCLK;
>  }
>
> -static void a9mpcore_clock_at_tick(void)
> +static void a9mpcore_clock_at_tick(volatile a9mpcore_gt *gt)
>  {
> -  volatile a9mpcore_gt *gt = A9MPCORE_GT;
> -
>    gt->irqst = A9MPCORE_GT_IRQST_EFLG;
>  }
>
> -static rtems_interrupt_entry a9mpcore_clock_interrupt_entry =
> -  RTEMS_INTERRUPT_ENTRY_INITIALIZER(
> -    (rtems_interrupt_handler) Clock_isr,
> -    NULL,
> -    "Clock"
> -  );
> +static rtems_interrupt_entry a9mpcore_clock_interrupt_entry;
>
> -static void a9mpcore_clock_handler_install(void)
> +static void a9mpcore_clock_handler_install(rtems_interrupt_handler handler)
>  {
>    rtems_status_code sc;
>
> +  rtems_interrupt_entry_initialize(
> +    &a9mpcore_clock_interrupt_entry,
> +    handler,
> +    RTEMS_DEVOLATILE(a9mpcore_gt *, A9MPCORE_GT),
> +    "Clock"
> +  );
>    sc = rtems_interrupt_entry_install(
>      A9MPCORE_IRQ_GT,
>      RTEMS_INTERRUPT_UNIQUE,
> @@ -193,14 +189,14 @@ CPU_Counter_ticks _CPU_Counter_read(void)
>    return gt->cntrlower;
>  }
>
> -#define Clock_driver_support_at_tick() \
> -  a9mpcore_clock_at_tick()
> +#define Clock_driver_support_at_tick(arg) \
> +  a9mpcore_clock_at_tick(arg)
>
>  #define Clock_driver_support_initialize_hardware() \
>    a9mpcore_clock_initialize()
>
>  #define Clock_driver_support_install_isr(isr) \
> -  a9mpcore_clock_handler_install()
> +  a9mpcore_clock_handler_install(isr)
>
>  /* Include shared source clock driver code */
>  #include "../../shared/dev/clock/clockimpl.h"
> diff --git a/bsps/arm/shared/clock/clock-nxp-lpc.c b/bsps/arm/shared/clock/clock-nxp-lpc.c
> index 86ece94b0e..77d6d423a2 100644
> --- a/bsps/arm/shared/clock/clock-nxp-lpc.c
> +++ b/bsps/arm/shared/clock/clock-nxp-lpc.c
> @@ -41,9 +41,6 @@
>
>  #ifdef ARM_MULTILIB_ARCH_V4
>
> -/* This is defined in ../../../shared/dev/clock/clockimpl.h */
> -void Clock_isr(rtems_irq_hdl_param arg);
> -
>  static volatile lpc_timer *const lpc_clock =
>    (volatile lpc_timer *) LPC_CLOCK_TIMER_BASE;
>
> @@ -57,12 +54,12 @@ static uint32_t lpc_clock_tc_get_timecount(struct timecounter *tc)
>    return lpc_timecounter->tc;
>  }
>
> -static void lpc_clock_at_tick(void)
> +static void lpc_clock_at_tick(volatile lpc_timer *regs)
>  {
> -  lpc_clock->ir = LPC_TIMER_IR_MR0;
> +  regs->ir = LPC_TIMER_IR_MR0;
>  }
>
> -static void lpc_clock_handler_install(void)
> +static void lpc_clock_handler_install(rtems_interrupt_handler handler)
>  {
>    rtems_status_code sc = RTEMS_SUCCESSFUL;
>
> @@ -70,8 +67,8 @@ static void lpc_clock_handler_install(void)
>      LPC_CLOCK_INTERRUPT,
>      "Clock",
>      RTEMS_INTERRUPT_UNIQUE,
> -    (rtems_interrupt_handler) Clock_isr,
> -    NULL
> +    handler,
> +    RTEMS_DEVOLATILE(lpc_timer *, lpc_clock)
>    );
>    if (sc != RTEMS_SUCCESSFUL) {
>      rtems_fatal_error_occurred(0xdeadbeef);
> @@ -118,10 +115,10 @@ static void lpc_clock_initialize(void)
>    rtems_timecounter_install(&lpc_clock_tc);
>  }
>
> -#define Clock_driver_support_at_tick() lpc_clock_at_tick()
> +#define Clock_driver_support_at_tick(arg) lpc_clock_at_tick(arg)
>  #define Clock_driver_support_initialize_hardware() lpc_clock_initialize()
>  #define Clock_driver_support_install_isr(isr) \
> -  lpc_clock_handler_install()
> +  lpc_clock_handler_install(isr)
>
>  /* Include shared source clock driver code */
>  #include "../../../shared/dev/clock/clockimpl.h"
> diff --git a/bsps/arm/smdk2410/clock/clockdrv.c b/bsps/arm/smdk2410/clock/clockdrv.c
> index 6e32b7daed..0d0a0fd006 100644
> --- a/bsps/arm/smdk2410/clock/clockdrv.c
> +++ b/bsps/arm/smdk2410/clock/clockdrv.c
> @@ -32,7 +32,7 @@ rtems_irq_connect_data clock_isr_data = {
>   *    - clear the interrupt bit?
>   *    - restart the timer?
>   */
> -#define Clock_driver_support_at_tick()                \
> +#define Clock_driver_support_at_tick(arg)             \
>    do {                                                \
>          ClearPending(BIT_TIMER4);                     \
>    } while(0)
> diff --git a/bsps/arm/tms570/clock/clock.c b/bsps/arm/tms570/clock/clock.c
> index 5e5965a680..2e71440857 100644
> --- a/bsps/arm/tms570/clock/clock.c
> +++ b/bsps/arm/tms570/clock/clock.c
> @@ -144,9 +144,9 @@ static void tms570_clock_driver_support_initialize_hardware( void )
>   *
>   * @retval Void
>   */
> -static void tms570_clock_driver_support_at_tick( void )
> +static void tms570_clock_driver_support_at_tick(volatile tms570_rti_t *rti)
>  {
> -  TMS570_RTI.INTFLAG = TMS570_RTI_INTFLAG_INT0;
> +  rti->INTFLAG = TMS570_RTI_INTFLAG_INT0;
>  }
>
>  /**
> @@ -158,7 +158,7 @@ static void tms570_clock_driver_support_at_tick( void )
>   * @retval Void
>   */
>  static void tms570_clock_driver_support_install_isr(
> -  rtems_isr_entry Clock_isr
> +  rtems_interrupt_handler handler
>  )
>  {
>    rtems_status_code sc = RTEMS_SUCCESSFUL;
> @@ -167,8 +167,8 @@ static void tms570_clock_driver_support_install_isr(
>      TMS570_IRQ_TIMER_0,
>      "Clock",
>      RTEMS_INTERRUPT_UNIQUE,
> -    (rtems_interrupt_handler) Clock_isr,
> -    NULL
> +    handler,
> +    RTEMS_DEVOLATILE(tms570_rti_t *, &TMS570_RTI)
>    );
>    if ( sc != RTEMS_SUCCESSFUL ) {
>      rtems_fatal_error_occurred(0xdeadbeef);
> @@ -177,14 +177,12 @@ static void tms570_clock_driver_support_install_isr(
>
>  #define Clock_driver_support_initialize_hardware \
>                          tms570_clock_driver_support_initialize_hardware
> -#define Clock_driver_support_at_tick \
> -                        tms570_clock_driver_support_at_tick
> +#define Clock_driver_support_at_tick(arg) \
> +                        tms570_clock_driver_support_at_tick(arg)
>  #define Clock_driver_support_initialize_hardware \
>                          tms570_clock_driver_support_initialize_hardware
>
> -#define Clock_driver_support_install_isr(Clock_isr) \
> -              tms570_clock_driver_support_install_isr( Clock_isr )
> -
> -void Clock_isr(void *arg); /* to supress warning */
> +#define Clock_driver_support_install_isr(handler) \
> +              tms570_clock_driver_support_install_isr(handler)
>
>  #include "../../../shared/dev/clock/clockimpl.h"
> diff --git a/bsps/i386/pc386/clock/ckinit.c b/bsps/i386/pc386/clock/ckinit.c
> index 3fdb0d5afe..d0519ee061 100644
> --- a/bsps/i386/pc386/clock/ckinit.c
> +++ b/bsps/i386/pc386/clock/ckinit.c
> @@ -87,7 +87,7 @@ extern volatile uint32_t Clock_driver_ticks;
>
>
>  #ifdef RTEMS_SMP
> -#define Clock_driver_support_at_tick() \
> +#define Clock_driver_support_at_tick(arg) \
>    do {                                                              \
>      Processor_mask targets;                                         \
>      _Processor_mask_Assign(&targets, _SMP_Get_online_processors()); \
> diff --git a/bsps/lm32/shared/clock/ckinit.c b/bsps/lm32/shared/clock/ckinit.c
> index f4bd395eb6..84220b2606 100644
> --- a/bsps/lm32/shared/clock/ckinit.c
> +++ b/bsps/lm32/shared/clock/ckinit.c
> @@ -59,7 +59,7 @@ static inline void clockwrite(unsigned int reg, int value)
>  #define CLOCK_VECTOR    ( TIMER0_IRQ )
>  #define CLOCK_IRQMASK   ( 1 << CLOCK_VECTOR )
>
> -#define Clock_driver_support_at_tick() \
> +#define Clock_driver_support_at_tick(arg) \
>    do { \
>      /* Clear overflow flag */ \
>      clockwrite(LM32_CLOCK_SR, 0); \
> diff --git a/bsps/lm32/shared/milkymist_clock/ckinit.c b/bsps/lm32/shared/milkymist_clock/ckinit.c
> index b10eb858c7..15b459eb74 100644
> --- a/bsps/lm32/shared/milkymist_clock/ckinit.c
> +++ b/bsps/lm32/shared/milkymist_clock/ckinit.c
> @@ -21,7 +21,7 @@
>  #define CLOCK_DRIVER_USE_FAST_IDLE 1
>  #endif
>
> -#define Clock_driver_support_at_tick() \
> +#define Clock_driver_support_at_tick(arg) \
>    do { \
>      lm32_interrupt_ack(1 << MM_IRQ_TIMER0); \
>    } while (0)
> diff --git a/bsps/m68k/av5282/clock/clock.c b/bsps/m68k/av5282/clock/clock.c
> index b1e169b4c9..1c4a6a0ba7 100644
> --- a/bsps/m68k/av5282/clock/clock.c
> +++ b/bsps/m68k/av5282/clock/clock.c
> @@ -14,7 +14,7 @@
>  /*
>   * Periodic interval timer interrupt handler
>   */
> -#define Clock_driver_support_at_tick()             \
> +#define Clock_driver_support_at_tick(arg)          \
>      do {                                           \
>          MCF5282_PIT3_PCSR |= MCF5282_PIT_PCSR_PIF; \
>      } while (0)                                    \
> diff --git a/bsps/m68k/gen68360/clock/clock.c b/bsps/m68k/gen68360/clock/clock.c
> index 966b20dae4..07da6a034d 100644
> --- a/bsps/m68k/gen68360/clock/clock.c
> +++ b/bsps/m68k/gen68360/clock/clock.c
> @@ -33,7 +33,7 @@ static unsigned long nsec;
>   *        Application code can override this by
>   *        setting M360DefaultWatchdogFeeder to zero.
>   */
> -#define Clock_driver_support_at_tick()  \
> +#define Clock_driver_support_at_tick(arg)  \
>      do {                                   \
>          nsec += pit_nsec_per_tick;         \
>          if (nsec >= rtems_nsec_per_tick)   \
> diff --git a/bsps/m68k/genmcf548x/clock/clock.c b/bsps/m68k/genmcf548x/clock/clock.c
> index 3bf08a06f9..fbb2c8592f 100644
> --- a/bsps/m68k/genmcf548x/clock/clock.c
> +++ b/bsps/m68k/genmcf548x/clock/clock.c
> @@ -62,7 +62,7 @@
>  /*
>   * Periodic interval timer interrupt handler
>   */
> -#define Clock_driver_support_at_tick()             \
> +#define Clock_driver_support_at_tick(arg)          \
>      do {                                           \
>          MCF548X_SLT_SSR0 = MCF548X_SLT_SSR_ST;     \
>      } while (0)                                    \
> diff --git a/bsps/m68k/mcf52235/clock/clock.c b/bsps/m68k/mcf52235/clock/clock.c
> index d5e1817536..eb28e5d328 100644
> --- a/bsps/m68k/mcf52235/clock/clock.c
> +++ b/bsps/m68k/mcf52235/clock/clock.c
> @@ -93,6 +93,6 @@ static void Clock_driver_support_initialize_hardware(void)
>    );
>  }
>
> -#define Clock_driver_timecounter_tick() mcf52235_tc_tick()
> +#define Clock_driver_timecounter_tick(arg) mcf52235_tc_tick()
>
>  #include "../../../shared/dev/clock/clockimpl.h"
> diff --git a/bsps/m68k/mcf5225x/clock/clock.c b/bsps/m68k/mcf5225x/clock/clock.c
> index 9a9c7cabe4..3cd76aa17a 100644
> --- a/bsps/m68k/mcf5225x/clock/clock.c
> +++ b/bsps/m68k/mcf5225x/clock/clock.c
> @@ -93,6 +93,6 @@ static void Clock_driver_support_initialize_hardware(void)
>    );
>  }
>
> -#define Clock_driver_timecounter_tick() mcf5225x_tc_tick()
> +#define Clock_driver_timecounter_tick(arg) mcf5225x_tc_tick()
>
>  #include "../../../shared/dev/clock/clockimpl.h"
> diff --git a/bsps/m68k/mcf5235/clock/clock.c b/bsps/m68k/mcf5235/clock/clock.c
> index 8b848de006..2aebd8385c 100644
> --- a/bsps/m68k/mcf5235/clock/clock.c
> +++ b/bsps/m68k/mcf5235/clock/clock.c
> @@ -14,7 +14,7 @@
>  /*
>   * Periodic interval timer interrupt handler
>   */
> -#define Clock_driver_support_at_tick()             \
> +#define Clock_driver_support_at_tick(arg)          \
>      do {                                           \
>          MCF5235_PIT_PCSR3 |= MCF5235_PIT_PCSR_PIF; \
>      } while (0)                                    \
> diff --git a/bsps/m68k/mcf5329/clock/clock.c b/bsps/m68k/mcf5329/clock/clock.c
> index 6ad46fe5a1..2833111572 100644
> --- a/bsps/m68k/mcf5329/clock/clock.c
> +++ b/bsps/m68k/mcf5329/clock/clock.c
> @@ -92,6 +92,6 @@ static void Clock_driver_support_initialize_hardware(void)
>    );
>  }
>
> -#define Clock_driver_timecounter_tick() mcf5329_tc_tick()
> +#define Clock_driver_timecounter_tick(arg) mcf5329_tc_tick()
>
>  #include "../../../shared/dev/clock/clockimpl.h"
> diff --git a/bsps/m68k/mrm332/btimer/btimer.c b/bsps/m68k/mrm332/btimer/btimer.c
> index 4aa3cd013e..138884dd32 100644
> --- a/bsps/m68k/mrm332/btimer/btimer.c
> +++ b/bsps/m68k/mrm332/btimer/btimer.c
> @@ -31,8 +31,6 @@
>
>  bool benchmark_timer_find_average_overhead;
>
> -extern rtems_isr Clock_isr(void);
> -
>  void benchmark_timer_initialize( void )
>  {
>  }
> diff --git a/bsps/m68k/uC5282/clock/clock.c b/bsps/m68k/uC5282/clock/clock.c
> index 59d67af296..f7bed25b8b 100644
> --- a/bsps/m68k/uC5282/clock/clock.c
> +++ b/bsps/m68k/uC5282/clock/clock.c
> @@ -150,6 +150,6 @@ int bsp_cpu_load_percentage(void)
>             0;
>  }
>
> -#define Clock_driver_timecounter_tick() uC5282_tc_tick()
> +#define Clock_driver_timecounter_tick(arg) uC5282_tc_tick()
>
>  #include "../../../shared/dev/clock/clockimpl.h"
> diff --git a/bsps/microblaze/microblaze_fpga/clock/clock.c b/bsps/microblaze/microblaze_fpga/clock/clock.c
> index 19e960022b..16acbaeebb 100644
> --- a/bsps/microblaze/microblaze_fpga/clock/clock.c
> +++ b/bsps/microblaze/microblaze_fpga/clock/clock.c
> @@ -118,10 +118,10 @@ static void microblaze_clock_at_tick( rtems_timecounter_simple *tc )
>    mblaze_timer->tcsr0 |= MICROBLAZE_TIMER_TCSR0_T0INT;
>  }
>
> -static void microblaze_tc_tick( void )
> +static void microblaze_tc_tick( rtems_timecounter_simple *tc )
>  {
>    rtems_timecounter_simple_downcounter_tick(
> -    &mblaze_tc,
> +    tc,
>      microblaze_tc_get,
>      microblaze_clock_at_tick
>    );
> @@ -142,7 +142,7 @@ static void microblaze_clock_handler_install( rtems_interrupt_handler isr )
>      "Clock",
>      RTEMS_INTERRUPT_UNIQUE,
>      isr,
> -    NULL
> +    &mblaze_tc
>    );
>
>    if ( sc != RTEMS_SUCCESSFUL ) {
> @@ -153,7 +153,7 @@ static void microblaze_clock_handler_install( rtems_interrupt_handler isr )
>  #define Clock_driver_support_initialize_hardware() microblaze_clock_initialize()
>  #define Clock_driver_support_install_isr( isr ) \
>    microblaze_clock_handler_install( isr )
> -#define Clock_driver_timecounter_tick() microblaze_tc_tick()
> +#define Clock_driver_timecounter_tick(arg) microblaze_tc_tick(arg)
>
>  /* Include shared source clock driver code */
>  #include "../../shared/dev/clock/clockimpl.h"
> diff --git a/bsps/mips/csb350/clock/clockdrv.c b/bsps/mips/csb350/clock/clockdrv.c
> index 3816bc1ef3..beb3e35221 100644
> --- a/bsps/mips/csb350/clock/clockdrv.c
> +++ b/bsps/mips/csb350/clock/clockdrv.c
> @@ -27,8 +27,8 @@ void au1x00_clock_init(void);
>
>  #define CLOCK_VECTOR AU1X00_IRQ_TOY_MATCH2
>
> -#define Clock_driver_support_at_tick()                        \
> -  do {                                                        \
> +#define Clock_driver_support_at_tick(arg) \
> +  do { \
>      while (AU1X00_SYS_CNTCTRL(AU1X00_SYS_ADDR) & AU1X00_SYS_CNTCTRL_TM0); \
>      last_match = AU1X00_SYS_TOYREAD(AU1X00_SYS_ADDR); \
>      AU1X00_SYS_TOYMATCH2(AU1X00_SYS_ADDR) = last_match + tick_interval; \
> diff --git a/bsps/mips/rbtx4925/clock/clockdrv.c b/bsps/mips/rbtx4925/clock/clockdrv.c
> index 7cbf41b963..0a71c8647f 100644
> --- a/bsps/mips/rbtx4925/clock/clockdrv.c
> +++ b/bsps/mips/rbtx4925/clock/clockdrv.c
> @@ -61,7 +61,7 @@
>    rtems_interrupt_handler_install( CLOCK_VECTOR, "clock", 0, _new, NULL )
>
>
> -#define Clock_driver_support_at_tick() \
> +#define Clock_driver_support_at_tick(arg) \
>    do { \
>         uint32_t interrupt_flag; \
>         do { \
> diff --git a/bsps/mips/rbtx4938/clock/clockdrv.c b/bsps/mips/rbtx4938/clock/clockdrv.c
> index 2515298d67..5d00979649 100644
> --- a/bsps/mips/rbtx4938/clock/clockdrv.c
> +++ b/bsps/mips/rbtx4938/clock/clockdrv.c
> @@ -89,7 +89,7 @@ void new_brk_esr(void)
>    } while(0)
>
>
> -#define Clock_driver_support_at_tick() \
> +#define Clock_driver_support_at_tick(arg) \
>    do { \
>         uint32_t interrupt_flag; \
>         do { \
> diff --git a/bsps/mips/shared/clock/clockdrv.c b/bsps/mips/shared/clock/clockdrv.c
> index ed420fb5eb..73c76e42d8 100644
> --- a/bsps/mips/shared/clock/clockdrv.c
> +++ b/bsps/mips/shared/clock/clockdrv.c
> @@ -44,7 +44,7 @@ extern uint32_t bsp_clicks_per_microsecond;
>  static uint32_t mips_timer_rate = 0;
>
>  /* refresh the internal CPU timer */
> -#define Clock_driver_support_at_tick() \
> +#define Clock_driver_support_at_tick(arg) \
>    mips_set_timer( mips_timer_rate );
>
>  #define Clock_driver_support_install_isr( _new ) \
> diff --git a/bsps/nios2/nios2_iss/clock/clock.c b/bsps/nios2/nios2_iss/clock/clock.c
> index 5b9b6bb1b5..e22cfcc686 100644
> --- a/bsps/nios2/nios2_iss/clock/clock.c
> +++ b/bsps/nios2/nios2_iss/clock/clock.c
> @@ -12,7 +12,7 @@
>  /*
>   * Periodic interval timer interrupt handler
>   */
> -#define Clock_driver_support_at_tick() \
> +#define Clock_driver_support_at_tick(arg) \
>    do { CLOCK_REGS->status = 0; } while(0)
>
>  /*
> diff --git a/bsps/or1k/generic_or1k/clock/clockdrv.c b/bsps/or1k/generic_or1k/clock/clockdrv.c
> index 44f220e057..4409b49ed4 100644
> --- a/bsps/or1k/generic_or1k/clock/clockdrv.c
> +++ b/bsps/or1k/generic_or1k/clock/clockdrv.c
> @@ -108,7 +108,7 @@ static void generic_or1k_clock_initialize(void)
>    rtems_timecounter_install(&or1ksim_tc);
>  }
>
> -#define Clock_driver_support_at_tick() generic_or1k_clock_at_tick()
> +#define Clock_driver_support_at_tick(arg) generic_or1k_clock_at_tick()
>
>  #define Clock_driver_support_initialize_hardware() generic_or1k_clock_initialize()
>
> diff --git a/bsps/powerpc/mpc55xxevb/clock/clock-config.c b/bsps/powerpc/mpc55xxevb/clock/clock-config.c
> index 9a666fc85a..d48367ae1e 100644
> --- a/bsps/powerpc/mpc55xxevb/clock/clock-config.c
> +++ b/bsps/powerpc/mpc55xxevb/clock/clock-config.c
> @@ -41,8 +41,6 @@
>
>  #include <rtems/timecounter.h>
>
> -void Clock_isr(void *arg);
> -
>  static rtems_timecounter_simple mpc55xx_tc;
>
>  #if defined(MPC55XX_CLOCK_EMIOS_CHANNEL)
> @@ -75,16 +73,16 @@ static void mpc55xx_tc_at_tick(rtems_timecounter_simple *tc)
>    EMIOS.CH [MPC55XX_CLOCK_EMIOS_CHANNEL].CSR.R = csr.R;
>  }
>
> -static void mpc55xx_tc_tick(void)
> +static void mpc55xx_tc_tick(rtems_timecounter_simple *tc)
>  {
>    rtems_timecounter_simple_upcounter_tick(
> -    &mpc55xx_tc,
> +    tc,
>      mpc55xx_tc_get,
>      mpc55xx_tc_at_tick
>    );
>  }
>
> -static void mpc55xx_clock_handler_install(rtems_isr_entry isr)
> +static void mpc55xx_clock_handler_install(rtems_interrupt_handler handler)
>  {
>    rtems_status_code sc = RTEMS_SUCCESSFUL;
>
> @@ -93,8 +91,8 @@ static void mpc55xx_clock_handler_install(rtems_isr_entry isr)
>      "clock",
>      RTEMS_INTERRUPT_UNIQUE,
>      MPC55XX_INTC_MIN_PRIORITY,
> -    (rtems_interrupt_handler) isr,
> -    NULL
> +    handler,
> +    &mpc55xx_tc
>    );
>    if (sc != RTEMS_SUCCESSFUL) {
>      bsp_fatal(MPC55XX_FATAL_CLOCK_EMIOS_IRQ_INSTALL);
> @@ -190,16 +188,16 @@ static void mpc55xx_tc_at_tick(rtems_timecounter_simple *tc)
>    channel->TFLG.R = tflg.R;
>  }
>
> -static void mpc55xx_tc_tick(void)
> +static void mpc55xx_tc_tick(rtems_timecounter_simple *tc)
>  {
>    rtems_timecounter_simple_downcounter_tick(
> -    &mpc55xx_tc,
> +    tc,
>      mpc55xx_tc_get,
>      mpc55xx_tc_at_tick
>    );
>  }
>
> -static void mpc55xx_clock_handler_install(rtems_isr_entry isr)
> +static void mpc55xx_clock_handler_install(rtems_interrupt_handler handler)
>  {
>    rtems_status_code sc = RTEMS_SUCCESSFUL;
>
> @@ -208,8 +206,8 @@ static void mpc55xx_clock_handler_install(rtems_isr_entry isr)
>      "clock",
>      RTEMS_INTERRUPT_UNIQUE,
>      MPC55XX_INTC_MIN_PRIORITY,
> -    (rtems_interrupt_handler) isr,
> -    NULL
> +    handler,
> +    &mpc55xx_tc
>    );
>    if (sc != RTEMS_SUCCESSFUL) {
>      bsp_fatal(MPC55XX_FATAL_CLOCK_PIT_IRQ_INSTALL);
> @@ -240,7 +238,7 @@ static void mpc55xx_clock_initialize(void)
>
>  #endif
>
> -#define Clock_driver_timecounter_tick() mpc55xx_tc_tick()
> +#define Clock_driver_timecounter_tick(arg) mpc55xx_tc_tick(arg)
>  #define Clock_driver_support_initialize_hardware() \
>    mpc55xx_clock_initialize()
>  #define Clock_driver_support_install_isr(isr) \
> diff --git a/bsps/powerpc/qoriq/clock/clock-config.c b/bsps/powerpc/qoriq/clock/clock-config.c
> index 746e9975ea..8ecc19ef0d 100644
> --- a/bsps/powerpc/qoriq/clock/clock-config.c
> +++ b/bsps/powerpc/qoriq/clock/clock-config.c
> @@ -42,15 +42,15 @@
>  #include <bsp/qoriq.h>
>  #include <bsp/irq.h>
>
> -/* This is defined in dev/clock/clockimpl.h */
> -static rtems_isr Clock_isr(void *arg);
> -
>  static struct timecounter qoriq_clock_tc;
>
>  #ifdef QORIQ_IS_HYPERVISOR_GUEST
>
>  #define CLOCK_DRIVER_USE_ONLY_BOOT_PROCESSOR
>
> +/* This is defined in dev/clock/clockimpl.h */
> +static rtems_isr Clock_isr(void *arg);
> +
>  void qoriq_decrementer_dispatch(void)
>  {
>    PPC_SET_SPECIAL_PURPOSE_REGISTER(BOOKE_TSR, BOOKE_TSR_DIS);
> @@ -102,7 +102,7 @@ static volatile qoriq_pic_global_timer *const qoriq_timecounter =
>
>  static rtems_interrupt_entry qoriq_clock_entry;
>
> -static void qoriq_clock_handler_install(void)
> +static void qoriq_clock_handler_install(rtems_interrupt_handler handler)
>  {
>    rtems_status_code sc = RTEMS_SUCCESSFUL;
>
> @@ -126,7 +126,7 @@ static void qoriq_clock_handler_install(void)
>
>    rtems_interrupt_entry_initialize(
>      &qoriq_clock_entry,
> -    Clock_isr,
> +    handler,
>      NULL,
>      "Clock"
>    );
> @@ -164,8 +164,8 @@ static void qoriq_clock_initialize(void)
>    rtems_timecounter_install(&qoriq_clock_tc);
>  }
>
> -#define Clock_driver_support_install_isr(clock_isr) \
> -  qoriq_clock_handler_install()
> +#define Clock_driver_support_install_isr(isr) \
> +  qoriq_clock_handler_install(isr)
>
>  #define Clock_driver_support_set_interrupt_affinity(online_processors) \
>    bsp_interrupt_set_affinity(CLOCK_INTERRUPT, online_processors)
> diff --git a/bsps/riscv/griscv/clock/clockdrv.c b/bsps/riscv/griscv/clock/clockdrv.c
> index ab82751e69..817cb331b6 100644
> --- a/bsps/riscv/griscv/clock/clockdrv.c
> +++ b/bsps/riscv/griscv/clock/clockdrv.c
> @@ -220,7 +220,7 @@ CPU_Counter_ticks _CPU_Counter_read( void )
>  #define Clock_driver_support_initialize_hardware() \
>    grlib_clock_initialize()
>
> -#define Clock_driver_timecounter_tick() grlib_tc_do_tick()
> +#define Clock_driver_timecounter_tick(arg) grlib_tc_do_tick()
>
>  #include "../../../shared/dev/clock/clockimpl.h"
>
> diff --git a/bsps/riscv/riscv/clock/clockdrv.c b/bsps/riscv/riscv/clock/clockdrv.c
> index ebbc9d77d9..d2f8f5da54 100644
> --- a/bsps/riscv/riscv/clock/clockdrv.c
> +++ b/bsps/riscv/riscv/clock/clockdrv.c
> @@ -47,9 +47,6 @@
>
>  #include <libfdt.h>
>
> -/* This is defined in dev/clock/clockimpl.h */
> -void Clock_isr(void *arg);
> -
>  typedef struct {
>    struct timecounter base;
>    volatile RISCV_CLINT_regs *clint;
> @@ -105,7 +102,7 @@ static void riscv_clock_at_tick(riscv_timecounter *tc)
>    riscv_clock_write_mtimecmp(mtimecmp, value);
>  }
>
> -static void riscv_clock_handler_install(void)
> +static void riscv_clock_handler_install(rtems_interrupt_handler handler)
>  {
>    rtems_status_code sc;
>
> @@ -113,8 +110,8 @@ static void riscv_clock_handler_install(void)
>      RISCV_INTERRUPT_VECTOR_TIMER,
>      "Clock",
>      RTEMS_INTERRUPT_UNIQUE,
> -    (rtems_interrupt_handler) Clock_isr,
> -    NULL
> +    handler,
> +    &riscv_clock_tc
>    );
>    if (sc != RTEMS_SUCCESSFUL) {
>      bsp_fatal(RISCV_FATAL_CLOCK_IRQ_INSTALL);
> @@ -242,11 +239,11 @@ RTEMS_SYSINIT_ITEM(
>    RTEMS_SYSINIT_ORDER_FIRST
>  );
>
> -#define Clock_driver_support_at_tick() riscv_clock_at_tick(&riscv_clock_tc)
> +#define Clock_driver_support_at_tick(arg) riscv_clock_at_tick(arg)
>
>  #define Clock_driver_support_initialize_hardware() riscv_clock_initialize()
>
>  #define Clock_driver_support_install_isr(isr) \
> -  riscv_clock_handler_install()
> +  riscv_clock_handler_install(isr)
>
>  #include "../../../shared/dev/clock/clockimpl.h"
> diff --git a/bsps/shared/dev/clock/arm-generic-timer.c b/bsps/shared/dev/clock/arm-generic-timer.c
> index 1188800170..ba159f6833 100644
> --- a/bsps/shared/dev/clock/arm-generic-timer.c
> +++ b/bsps/shared/dev/clock/arm-generic-timer.c
> @@ -54,15 +54,12 @@ typedef struct {
>
>  static arm_gt_clock_context arm_gt_clock_instance;
>
> -/* This is defined in dev/clock/clockimpl.h */
> -void Clock_isr(rtems_irq_hdl_param arg);
> -
> -static void arm_gt_clock_at_tick(void)
> +static void arm_gt_clock_at_tick(arm_gt_clock_context *ctx)
>  {
>    uint64_t cval;
>    uint32_t interval;
>
> -  interval = arm_gt_clock_instance.interval;
> +  interval = ctx->interval;
>    cval = arm_gt_clock_get_compare_value();
>    cval += interval;
>    arm_gt_clock_set_compare_value(cval);
> @@ -71,7 +68,7 @@ static void arm_gt_clock_at_tick(void)
>  #endif /* ARM_GENERIC_TIMER_UNMASK_AT_TICK */
>  }
>
> -static void arm_gt_clock_handler_install(void)
> +static void arm_gt_clock_handler_install(rtems_interrupt_handler handler)
>  {
>    rtems_status_code sc;
>
> @@ -79,8 +76,8 @@ static void arm_gt_clock_handler_install(void)
>      arm_gt_clock_instance.irq,
>      "Clock",
>      RTEMS_INTERRUPT_UNIQUE,
> -    (rtems_interrupt_handler) Clock_isr,
> -    NULL
> +    handler,
> +    &arm_gt_clock_instance
>    );
>    if (sc != RTEMS_SUCCESSFUL) {
>      bsp_fatal(BSP_ARM_FATAL_GENERIC_TIMER_CLOCK_IRQ_INSTALL);
> @@ -185,14 +182,14 @@ RTEMS_SYSINIT_ITEM(
>    RTEMS_SYSINIT_ORDER_FIRST
>  );
>
> -#define Clock_driver_support_at_tick() \
> -  arm_gt_clock_at_tick()
> +#define Clock_driver_support_at_tick(arg) \
> +  arm_gt_clock_at_tick(arg)
>
>  #define Clock_driver_support_initialize_hardware() \
>    arm_gt_clock_initialize()
>
>  #define Clock_driver_support_install_isr(isr) \
> -  arm_gt_clock_handler_install()
> +  arm_gt_clock_handler_install(isr)
>
>  /* Include shared source clock driver code */
>  #include "../../shared/dev/clock/clockimpl.h"
> diff --git a/bsps/shared/dev/clock/clockimpl.h b/bsps/shared/dev/clock/clockimpl.h
> index c58a6eb079..592046ec27 100644
> --- a/bsps/shared/dev/clock/clockimpl.h
> +++ b/bsps/shared/dev/clock/clockimpl.h
> @@ -63,6 +63,13 @@
>  #error "Fast Idle PLUS n ISRs per tick is not supported"
>  #endif
>
> +#if defined(BSP_FEATURE_IRQ_EXTENSION) || \
> +    (CPU_SIMPLE_VECTORED_INTERRUPTS != TRUE)
> +typedef void * Clock_isr_argument;
> +#else
> +typedef rtems_vector_number Clock_isr_argument;
> +#endif
> +
>  /**
>   * @brief Do nothing by default.
>   */
> @@ -81,7 +88,7 @@
>   * @brief Do nothing by default.
>   */
>  #ifndef Clock_driver_support_at_tick
> -  #define Clock_driver_support_at_tick()
> +  #define Clock_driver_support_at_tick( arg ) do { (void) arg; } while (0)
>  #endif
>
>  /**
> @@ -96,8 +103,9 @@
>   * instead of the default.
>   */
>  #ifndef Clock_driver_timecounter_tick
> -static void Clock_driver_timecounter_tick( void )
> +static void Clock_driver_timecounter_tick( Clock_isr_argument arg )
>  {
> +  (void) arg;
>  #if defined(CLOCK_DRIVER_USE_DUMMY_TIMECOUNTER)
>    rtems_clock_tick();
>  #elif defined(RTEMS_SMP) && defined(CLOCK_DRIVER_USE_ONLY_BOOT_PROCESSOR)
> @@ -159,20 +167,11 @@ static bool _Clock_Has_watchdogs(const Per_CPU_Control *cpu)
>   *
>   *  This is the clock tick interrupt handler.
>   *
> - *  @param vector Vector number.
> + *  @param arg is the clock interrupt handler argument.
>   */
> -#if defined(BSP_FEATURE_IRQ_EXTENSION) || \
> -    (CPU_SIMPLE_VECTORED_INTERRUPTS != TRUE)
> -void Clock_isr(void *arg);
> -void Clock_isr(void *arg)
> +void Clock_isr( Clock_isr_argument arg );
> +void Clock_isr( Clock_isr_argument arg )
>  {
> -#else
> -rtems_isr Clock_isr(rtems_vector_number vector);
> -rtems_isr Clock_isr(
> -  rtems_vector_number vector
> -)
> -{
> -#endif
>    /*
>     *  Accurate count of ISRs
>     */
> @@ -180,7 +179,7 @@ rtems_isr Clock_isr(
>
>    #if CLOCK_DRIVER_USE_FAST_IDLE
>      {
> -      Clock_driver_timecounter_tick();
> +      Clock_driver_timecounter_tick( arg );
>
>        if (_SMP_Get_processor_maximum() == 1) {
>          struct timecounter *tc;
> @@ -210,7 +209,7 @@ rtems_isr Clock_isr(
>          }
>        }
>
> -      Clock_driver_support_at_tick();
> +      Clock_driver_support_at_tick( arg );
>      }
>    #else
>      /*
> @@ -218,14 +217,14 @@ rtems_isr Clock_isr(
>       *
>       *  The counter/timer may or may not be set to automatically reload.
>       */
> -    Clock_driver_support_at_tick();
> +    Clock_driver_support_at_tick( arg );
>
>      #if CLOCK_DRIVER_ISRS_PER_TICK
>        /*
>         *  The driver is multiple ISRs per clock tick.
>         */
>        if ( !Clock_driver_isrs ) {
> -        Clock_driver_timecounter_tick();
> +        Clock_driver_timecounter_tick( arg );
>
>          Clock_driver_isrs = CLOCK_DRIVER_ISRS_PER_TICK_VALUE;
>        }
> @@ -234,7 +233,7 @@ rtems_isr Clock_isr(
>        /*
>         *  The driver is one ISR per clock tick.
>         */
> -      Clock_driver_timecounter_tick();
> +      Clock_driver_timecounter_tick( arg );
>      #endif
>    #endif
>  }
> diff --git a/bsps/shared/dev/clock/xil-ttc.c b/bsps/shared/dev/clock/xil-ttc.c
> index 5121773a6f..340c428a48 100644
> --- a/bsps/shared/dev/clock/xil-ttc.c
> +++ b/bsps/shared/dev/clock/xil-ttc.c
> @@ -157,7 +157,7 @@ static void zynqmp_ttc_clock_driver_support_initialize_hardware(void)
>   *
>   * @retval Void
>   */
> -static void zynqmp_ttc_clock_driver_support_at_tick( void )
> +static void zynqmp_ttc_clock_driver_support_at_tick(ttc_clock_context *tc)
>  {
>    uint32_t irq_flags;
>    uint32_t cval;
> @@ -181,49 +181,41 @@ static void zynqmp_ttc_clock_driver_support_at_tick( void )
>       */
>      now = XTtcPs_ReadReg(BSP_SELECTED_TTC_ADDR, XTTCPS_COUNT_VALUE_OFFSET);
>      delta = now - cval;
> -    if(delta > ttc_clock_instance.irq_match_interval) {
> +    if(delta > tc->irq_match_interval) {
>       cval = now;
> -     ttc_clock_instance.tick_miss++;
> +     tc->tick_miss++;
>      }
> -    cval += ttc_clock_instance.irq_match_interval;
> +    cval += tc->irq_match_interval;
>      XTtcPs_WriteReg(BSP_SELECTED_TTC_ADDR, XTTCPS_MATCH_0_OFFSET, cval);
>    }
>    /* Else, something is set up wrong, only match should be enabled */
>  }
>
> -/**
> - * @brief registers RTI interrupt handler
> - *
> - * @param[in] Clock_isr new ISR handler
> - * @param[in] Old_ticker old ISR handler (unused and type broken)
> - *
> - * @retval Void
> - */
>  static void zynqmp_ttc_clock_driver_support_install_isr(
> -  rtems_isr_entry Clock_isr
> +  rtems_interrupt_handler handler
>  )
>  {
> -  rtems_status_code sc = RTEMS_SUCCESSFUL;
> +  rtems_status_code sc;
>
>    sc = rtems_interrupt_handler_install(
>      BSP_SELECTED_TTC_IRQ,
>      "Clock",
>      RTEMS_INTERRUPT_UNIQUE,
> -    (rtems_interrupt_handler) Clock_isr,
> -    NULL
> +    handler,
> +    &ttc_clock_instance
>    );
>    if ( sc != RTEMS_SUCCESSFUL ) {
>      rtems_fatal_error_occurred(0xdeadbeef);
>    }
>  }
>
> -#define Clock_driver_support_at_tick \
> -  zynqmp_ttc_clock_driver_support_at_tick
> +#define Clock_driver_support_at_tick(arg) \
> +  zynqmp_ttc_clock_driver_support_at_tick(arg)
>
>  #define Clock_driver_support_initialize_hardware \
>    zynqmp_ttc_clock_driver_support_initialize_hardware
>
> -#define Clock_driver_support_install_isr(Clock_isr) \
> -  zynqmp_ttc_clock_driver_support_install_isr( Clock_isr )
> +#define Clock_driver_support_install_isr(isr) \
> +  zynqmp_ttc_clock_driver_support_install_isr(isr)
>
>  #include "../../../shared/dev/clock/clockimpl.h"
> diff --git a/bsps/shared/grlib/btimer/tlib_ckinit.c b/bsps/shared/grlib/btimer/tlib_ckinit.c
> index 8a5ee33842..e2179090fa 100644
> --- a/bsps/shared/grlib/btimer/tlib_ckinit.c
> +++ b/bsps/shared/grlib/btimer/tlib_ckinit.c
> @@ -433,10 +433,10 @@ static const struct ops ops_irqamp = {
>      } \
>    } while (0)
>
> -#define Clock_driver_timecounter_tick() \
> +#define Clock_driver_timecounter_tick(arg) \
>    tlib_clock_timecounter_tick()
>
> -#define Clock_driver_support_at_tick() \
> +#define Clock_driver_support_at_tick(arg) \
>    do { \
>      rtems_device_driver ret; \
>      ret = tlib_clock_at_tick(); \
> diff --git a/bsps/sparc/erc32/clock/ckinit.c b/bsps/sparc/erc32/clock/ckinit.c
> index e8cf7188eb..c0101c5839 100644
> --- a/bsps/sparc/erc32/clock/ckinit.c
> +++ b/bsps/sparc/erc32/clock/ckinit.c
> @@ -51,12 +51,10 @@ uint32_t _CPU_Counter_frequency( void )
>    return ERC32_REAL_TIME_CLOCK_FREQUENCY;
>  }
>
> -static void erc32_clock_at_tick( void )
> +static void erc32_clock_at_tick( SPARC_Counter *counter )
>  {
> -  SPARC_Counter *counter;
>    rtems_interrupt_level level;
>
> -  counter = &_SPARC_Counter;
>    rtems_interrupt_local_disable(level);
>
>    ERC32_Clear_interrupt( ERC32_INTERRUPT_REAL_TIME_CLOCK );
> @@ -110,7 +108,7 @@ RTEMS_SYSINIT_ITEM(
>      "Clock", \
>      RTEMS_INTERRUPT_SHARED, \
>      _new, \
> -    NULL \
> +    &_SPARC_Counter \
>    )
>
>  #define Clock_driver_support_set_interrupt_affinity( _online_processors ) \
> @@ -118,7 +116,7 @@ RTEMS_SYSINIT_ITEM(
>      (void) _online_processors; \
>    } while (0)
>
> -#define Clock_driver_support_at_tick() erc32_clock_at_tick()
> +#define Clock_driver_support_at_tick(arg) erc32_clock_at_tick(arg)
>
>  #define Clock_driver_support_initialize_hardware() erc32_clock_init()
>
> diff --git a/bsps/sparc/leon2/clock/ckinit.c b/bsps/sparc/leon2/clock/ckinit.c
> index 31f8bca7ba..3aad931218 100644
> --- a/bsps/sparc/leon2/clock/ckinit.c
> +++ b/bsps/sparc/leon2/clock/ckinit.c
> @@ -121,7 +121,7 @@ uint32_t _CPU_Counter_frequency( void )
>      NULL \
>    )
>
> -#define Clock_driver_support_at_tick() leon2_clock_at_tick()
> +#define Clock_driver_support_at_tick(arg) leon2_clock_at_tick()
>
>  #define Clock_driver_support_initialize_hardware() leon2_clock_init()
>
> diff --git a/bsps/sparc/leon3/clock/ckinit.c b/bsps/sparc/leon3/clock/ckinit.c
> index d530f260a8..f0307bf908 100644
> --- a/bsps/sparc/leon3/clock/ckinit.c
> +++ b/bsps/sparc/leon3/clock/ckinit.c
> @@ -202,7 +202,7 @@ static void leon3_clock_initialize(void)
>  #define Clock_driver_support_initialize_hardware() \
>    leon3_clock_initialize()
>
> -#define Clock_driver_timecounter_tick() leon3_tc_do_tick()
> +#define Clock_driver_timecounter_tick(arg) leon3_tc_do_tick()
>
>  #define BSP_FEATURE_IRQ_EXTENSION
>
> diff --git a/bsps/sparc64/shared/clock/ckinit.c b/bsps/sparc64/shared/clock/ckinit.c
> index 7c97ba3177..82ac3b1995 100644
> --- a/bsps/sparc64/shared/clock/ckinit.c
> +++ b/bsps/sparc64/shared/clock/ckinit.c
> @@ -63,7 +63,7 @@ static unsigned int get_Frequency(void)
>    return freq;
>  }
>
> -#define Clock_driver_support_at_tick() \
> +#define Clock_driver_support_at_tick(arg) \
>    Clock_driver_support_at_tick_helper()
>
>  static void Clock_driver_support_at_tick_helper(void)
> --
> 2.35.3
>
> _______________________________________________
> devel mailing list
> devel at rtems.org
> http://lists.rtems.org/mailman/listinfo/devel


More information about the devel mailing list