bsps: Avoid unused argument in clock interrupt

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.
This commit is contained in:
Sebastian Huber
2023-03-23 16:53:30 +01:00
parent d62f299b34
commit 1eed6f8bfc
42 changed files with 137 additions and 181 deletions

View File

@@ -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"

View File

@@ -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"