bsps: Remove uses of BSP-specific interrupt API

Update #3269.
This commit is contained in:
Sebastian Huber
2023-06-15 14:44:35 +02:00
parent 83305f5050
commit 4e3e9df1b4
8 changed files with 60 additions and 54 deletions

View File

@@ -69,12 +69,6 @@ extern "C" {
/* Maximum supported APBUARTs by BSP */ /* Maximum supported APBUARTs by BSP */
#define BSP_NUMBER_OF_TERMIOS_PORTS 8 #define BSP_NUMBER_OF_TERMIOS_PORTS 8
/* GRLIB driver functions */
extern void BSP_shared_interrupt_mask(int irq);
extern void BSP_shared_interrupt_clear(int irq);
extern void BSP_shared_interrupt_unmask(int irq);
/* /*
* Network driver configuration for greth * Network driver configuration for greth
*/ */

View File

@@ -41,7 +41,7 @@
#include <grlib/genirq.h> #include <grlib/genirq.h>
#include <bsp.h> #include <bsp.h>
#include <bsp/irq.h> #include <bsp/irq-generic.h>
#include <grlib/grlib_impl.h> #include <grlib/grlib_impl.h>
@@ -227,7 +227,10 @@ static int ambapp_grlib_int_clear
struct drvmgr_dev *dev, struct drvmgr_dev *dev,
int irq) int irq)
{ {
BSP_shared_interrupt_clear(irq); if (rtems_interrupt_clear(irq) != RTEMS_SUCCESSFUL) {
return DRVMGR_FAIL;
}
return DRVMGR_OK; return DRVMGR_OK;
} }
@@ -237,7 +240,10 @@ static int ambapp_grlib_int_mask
int irq int irq
) )
{ {
BSP_shared_interrupt_mask(irq); if (rtems_interrupt_vector_disable(irq) != RTEMS_SUCCESSFUL) {
return DRVMGR_FAIL;
}
return DRVMGR_OK; return DRVMGR_OK;
} }
@@ -247,7 +253,10 @@ static int ambapp_grlib_int_unmask
int irq int irq
) )
{ {
BSP_shared_interrupt_unmask(irq); if (rtems_interrupt_vector_enable(irq) != RTEMS_SUCCESSFUL) {
return DRVMGR_FAIL;
}
return DRVMGR_OK; return DRVMGR_OK;
} }

View File

@@ -142,7 +142,10 @@ static __inline__ int BSP_shared_interrupt_unregister
* Arguments * Arguments
* irq System IRQ number * irq System IRQ number
*/ */
extern void BSP_shared_interrupt_clear(int irq); static inline void BSP_shared_interrupt_clear( int irq )
{
(void) rtems_interrupt_clear( (rtems_vector_number) irq );
}
/* Enable Interrupt. This function will unmask the IRQ at the interrupt /* Enable Interrupt. This function will unmask the IRQ at the interrupt
* controller. This is normally done by _register(). Note that this will * controller. This is normally done by _register(). Note that this will
@@ -151,7 +154,10 @@ extern void BSP_shared_interrupt_clear(int irq);
* Arguments * Arguments
* irq System IRQ number * irq System IRQ number
*/ */
extern void BSP_shared_interrupt_unmask(int irq); static inline void BSP_shared_interrupt_unmask( int irq )
{
(void) rtems_interrupt_vector_enable( (rtems_vector_number) irq );
}
/* Disable Interrupt. This function will mask one IRQ at the interrupt /* Disable Interrupt. This function will mask one IRQ at the interrupt
* controller. This is normally done by _unregister(). Note that this will * controller. This is normally done by _unregister(). Note that this will
@@ -160,7 +166,10 @@ extern void BSP_shared_interrupt_unmask(int irq);
* Arguments * Arguments
* irq System IRQ number * irq System IRQ number
*/ */
extern void BSP_shared_interrupt_mask(int irq); static inline void BSP_shared_interrupt_mask( int irq )
{
(void) rtems_interrupt_vector_disable( (rtems_vector_number) irq );
}
/* /*
* Delay for the specified number of microseconds. * Delay for the specified number of microseconds.

View File

@@ -166,7 +166,10 @@ static __inline__ int BSP_shared_interrupt_unregister
* Arguments * Arguments
* irq System IRQ number * irq System IRQ number
*/ */
extern void BSP_shared_interrupt_clear(int irq); static inline void BSP_shared_interrupt_clear( int irq )
{
(void) rtems_interrupt_clear( (rtems_vector_number) irq );
}
/* Enable Interrupt. This function will unmask the IRQ at the interrupt /* Enable Interrupt. This function will unmask the IRQ at the interrupt
* controller. This is normally done by _register(). Note that this will * controller. This is normally done by _register(). Note that this will
@@ -175,7 +178,10 @@ extern void BSP_shared_interrupt_clear(int irq);
* Arguments * Arguments
* irq System IRQ number * irq System IRQ number
*/ */
extern void BSP_shared_interrupt_unmask(int irq); static inline void BSP_shared_interrupt_unmask( int irq )
{
(void) rtems_interrupt_vector_enable( (rtems_vector_number) irq );
}
/* Disable Interrupt. This function will mask one IRQ at the interrupt /* Disable Interrupt. This function will mask one IRQ at the interrupt
* controller. This is normally done by _unregister(). Note that this will * controller. This is normally done by _unregister(). Note that this will
@@ -184,7 +190,10 @@ extern void BSP_shared_interrupt_unmask(int irq);
* Arguments * Arguments
* irq System IRQ number * irq System IRQ number
*/ */
extern void BSP_shared_interrupt_mask(int irq); static inline void BSP_shared_interrupt_mask( int irq )
{
(void) rtems_interrupt_vector_disable( (rtems_vector_number) irq );
}
/* /*
* Delay method * Delay method

View File

@@ -185,7 +185,10 @@ static __inline__ int BSP_shared_interrupt_unregister
* Arguments * Arguments
* irq System IRQ number * irq System IRQ number
*/ */
extern void BSP_shared_interrupt_clear(int irq); static inline void BSP_shared_interrupt_clear( int irq )
{
(void) rtems_interrupt_clear( (rtems_vector_number) irq );
}
/* Enable Interrupt. This function will unmask the IRQ at the interrupt /* Enable Interrupt. This function will unmask the IRQ at the interrupt
* controller. This is normally done by _register(). Note that this will * controller. This is normally done by _register(). Note that this will
@@ -194,7 +197,10 @@ extern void BSP_shared_interrupt_clear(int irq);
* Arguments * Arguments
* irq System IRQ number * irq System IRQ number
*/ */
extern void BSP_shared_interrupt_unmask(int irq); static inline void BSP_shared_interrupt_unmask( int irq )
{
(void) rtems_interrupt_vector_enable( (rtems_vector_number) irq );
}
/* Disable Interrupt. This function will mask one IRQ at the interrupt /* Disable Interrupt. This function will mask one IRQ at the interrupt
* controller. This is normally done by _unregister(). Note that this will * controller. This is normally done by _unregister(). Note that this will
@@ -203,7 +209,10 @@ extern void BSP_shared_interrupt_unmask(int irq);
* Arguments * Arguments
* irq System IRQ number * irq System IRQ number
*/ */
extern void BSP_shared_interrupt_mask(int irq); static inline void BSP_shared_interrupt_mask( int irq )
{
(void) rtems_interrupt_vector_disable( (rtems_vector_number) irq );
}
#if defined(RTEMS_SMP) || defined(RTEMS_MULTIPROCESSING) #if defined(RTEMS_SMP) || defined(RTEMS_MULTIPROCESSING)
/* Irq used by the shared memory driver and for inter-processor interrupts. /* Irq used by the shared memory driver and for inter-processor interrupts.

View File

@@ -373,7 +373,7 @@ int leon2_amba_int_register
DBG("Registering IRQ %d to func 0x%x arg 0x%x\n", irq, (unsigned int)isr, (unsigned int)arg); DBG("Registering IRQ %d to func 0x%x arg 0x%x\n", irq, (unsigned int)isr, (unsigned int)arg);
return BSP_shared_interrupt_register(irq, info, isr, arg); return rtems_interrupt_handler_install(irq, info, RTEMS_INTERRUPT_SHARED, isr, arg);
} }
int leon2_amba_int_unregister int leon2_amba_int_unregister
@@ -392,7 +392,7 @@ int leon2_amba_int_unregister
DBG("Unregistering IRQ %d to func 0x%x arg 0x%x\n", irq, (unsigned int)handler, (unsigned int)arg); DBG("Unregistering IRQ %d to func 0x%x arg 0x%x\n", irq, (unsigned int)handler, (unsigned int)arg);
return BSP_shared_interrupt_unregister(irq, isr, arg); return rtems_interrupt_handler_remove(irq, isr, arg);
} }
int leon2_amba_int_clear int leon2_amba_int_clear
@@ -407,7 +407,9 @@ int leon2_amba_int_clear
if ( irq < 0 ) if ( irq < 0 )
return -1; return -1;
BSP_shared_interrupt_clear(irq); if (rtems_interrupt_clear(irq) != RTEMS_SUCCESSFUL) {
return DRVMGR_FAIL;
}
return DRVMGR_OK; return DRVMGR_OK;
} }
@@ -424,7 +426,9 @@ int leon2_amba_int_mask
if ( irq < 0 ) if ( irq < 0 )
return -1; return -1;
BSP_shared_interrupt_mask(irq); if (rtems_interrupt_vector_disable(irq) != RTEMS_SUCCESSFUL) {
return DRVMGR_FAIL;
}
return DRVMGR_OK; return DRVMGR_OK;
} }
@@ -441,7 +445,9 @@ int leon2_amba_int_unmask
if ( irq < 0 ) if ( irq < 0 )
return -1; return -1;
BSP_shared_interrupt_unmask(irq); if (rtems_interrupt_vector_enable(irq) != RTEMS_SUCCESSFUL) {
return DRVMGR_FAIL;
}
return DRVMGR_OK; return DRVMGR_OK;
} }

View File

@@ -32,19 +32,9 @@
static inline int bsp_irq_cpu(int irq) static inline int bsp_irq_cpu(int irq)
{ {
#if defined(RTEMS_SMP)
Processor_mask affinity;
(void) bsp_interrupt_get_affinity((rtems_vector_number) irq, &affinity);
return (int) _Processor_mask_Find_last_set(&affinity);
#elif defined(LEON3)
return _LEON3_Get_current_processor();
#else
return 0; return 0;
#endif
} }
#if !defined(LEON3)
bool bsp_interrupt_is_valid_vector(rtems_vector_number vector) bool bsp_interrupt_is_valid_vector(rtems_vector_number vector)
{ {
if (vector == 0) { if (vector == 0) {
@@ -150,22 +140,3 @@ rtems_status_code bsp_interrupt_vector_disable(rtems_vector_number vector)
BSP_Cpu_Mask_interrupt(vector, 0); BSP_Cpu_Mask_interrupt(vector, 0);
return RTEMS_SUCCESSFUL; return RTEMS_SUCCESSFUL;
} }
#endif
void BSP_shared_interrupt_mask(int irq)
{
BSP_Cpu_Mask_interrupt(irq, bsp_irq_cpu(irq));
}
void BSP_shared_interrupt_unmask(int irq)
{
BSP_Cpu_Unmask_interrupt(irq, bsp_irq_cpu(irq));
}
void BSP_shared_interrupt_clear(int irq)
{
/* We don't have to interrupt lock here, because the register is only
* written and self clearing
*/
BSP_Clear_interrupt(irq);
}

View File

@@ -52,7 +52,6 @@ source:
- bsps/sparc/leon3/start/setvec.c - bsps/sparc/leon3/start/setvec.c
- bsps/sparc/shared/gnatcommon.c - bsps/sparc/shared/gnatcommon.c
- bsps/sparc/shared/irq/bsp_isr_handler.c - bsps/sparc/shared/irq/bsp_isr_handler.c
- bsps/sparc/shared/irq/irq-shared.c
- bsps/sparc/shared/pci/gr_cpci_gr740.c - bsps/sparc/shared/pci/gr_cpci_gr740.c
- bsps/sparc/shared/pci/gr_leon4_n2x.c - bsps/sparc/shared/pci/gr_leon4_n2x.c
- bsps/sparc/shared/pci/pci_memreg_sparc_be.c - bsps/sparc/shared/pci/pci_memreg_sparc_be.c