diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2021-07-19 16:29:59 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2023-07-14 12:21:33 +0200 |
commit | 32ff60293b835888557603973730b5cf2a8ec77c (patch) | |
tree | e0207c26cf1b9fe38935ca7c827632974717c90d /bsps/sparc/leon3/include/bsp | |
parent | bsp/leon3: Untangle interrupt controller support (diff) | |
download | rtems-32ff60293b835888557603973730b5cf2a8ec77c.tar.bz2 |
bsp/leon3: Move and simplify bsp_irq_fixup()
Diffstat (limited to 'bsps/sparc/leon3/include/bsp')
-rw-r--r-- | bsps/sparc/leon3/include/bsp/irq.h | 1 | ||||
-rw-r--r-- | bsps/sparc/leon3/include/bsp/irqimpl.h | 31 |
2 files changed, 31 insertions, 1 deletions
diff --git a/bsps/sparc/leon3/include/bsp/irq.h b/bsps/sparc/leon3/include/bsp/irq.h index a7054030e2..ef0f6245f9 100644 --- a/bsps/sparc/leon3/include/bsp/irq.h +++ b/bsps/sparc/leon3/include/bsp/irq.h @@ -37,7 +37,6 @@ #ifndef LIBBSP_LEON3_IRQ_CONFIG_H #define LIBBSP_LEON3_IRQ_CONFIG_H -#include <leon.h> #include <rtems/score/processormask.h> #define BSP_INTERRUPT_VECTOR_MAX_STD 15 /* Standard IRQ controller */ diff --git a/bsps/sparc/leon3/include/bsp/irqimpl.h b/bsps/sparc/leon3/include/bsp/irqimpl.h index 77619c99b9..60b198bd02 100644 --- a/bsps/sparc/leon3/include/bsp/irqimpl.h +++ b/bsps/sparc/leon3/include/bsp/irqimpl.h @@ -68,12 +68,43 @@ extern volatile struct irqmp_regs *LEON3_IrqCtrl_Regs; extern struct ambapp_dev *LEON3_IrqCtrl_Adev; /** + * @brief This object provides the interrupt number used to multiplex extended + * interrupts or is zero if no extended interrupts are available. + * + * This object should be read-only after initialization. + */ +extern uint32_t LEON3_IrqCtrl_EIrq; + +/** * @brief Initializes the interrupt controller for the boot processor. * * @param[in, out] regs is the IRQ(A)MP register block address. */ void leon3_ext_irq_init( volatile struct irqmp_regs *regs ); +/** + * @brief Acknowledges and maps extended interrupts if this feature is + * available and the interrupt for extended interrupts is present. + * + * @param irq is the standard interrupt number. + */ +static inline uint32_t bsp_irq_fixup( uint32_t irq ) +{ + uint32_t eirq; + + if ( irq != LEON3_IrqCtrl_EIrq ) { + return irq; + } + + eirq = LEON3_IrqCtrl_Regs->intid[ _LEON3_Get_current_processor() ] & 0x1f; + + if ( eirq < 16 ) { + return irq; + } + + return eirq; +} + /** @} */ #ifdef __cplusplus |