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

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

View File

@@ -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; \
\

View File

@@ -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; \
\

View File

@@ -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); \

View File

@@ -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; \

View File

@@ -25,9 +25,6 @@
#include <bsp/raspberrypi.h>
#include <rtems/timecounter.h>
/* This is defined in ../../../shared/dev/clock/clockimpl.h */
void Clock_isr(rtems_irq_hdl_param arg);
static struct timecounter raspberrypi_tc;
static uint32_t raspberrypi_clock_get_timecount(struct timecounter *tc)
@@ -54,27 +51,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,
clock_isr,
NULL
);
} else {
/* Remove interrupt handler */
sc = rtems_interrupt_handler_remove(
BCM2835_IRQ_ID_GPU_TIMER_M3,
(rtems_interrupt_handler) Clock_isr,
NULL
);
}
if ( sc != RTEMS_SUCCESSFUL ) {
rtems_fatal_error_occurred(0xdeadbeef);
}
@@ -94,7 +82,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()

View File

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

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"

View File

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

View File

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

View File

@@ -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()); \

View File

@@ -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); \

View File

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

View File

@@ -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) \

View File

@@ -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) \

View File

@@ -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) \

View File

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

View File

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

View File

@@ -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) \

View File

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

View File

@@ -31,8 +31,6 @@
bool benchmark_timer_find_average_overhead;
extern rtems_isr Clock_isr(void);
void benchmark_timer_initialize( void )
{
}

View File

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

View File

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

View File

@@ -27,7 +27,7 @@ void au1x00_clock_init(void);
#define CLOCK_VECTOR AU1X00_IRQ_TOY_MATCH2
#define Clock_driver_support_at_tick() \
#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); \

View File

@@ -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 { \

View File

@@ -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 { \

View File

@@ -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 ) \

View File

@@ -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)
/*

View File

@@ -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()

View File

@@ -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) \

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -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(); \

View File

@@ -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()

View File

@@ -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()

View File

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

View File

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