[PATCH v2 07/12] bsps/irq: Add BSP_INTERRUPT_VECTOR_COUNT

Sebastian Huber sebastian.huber at embedded-brains.de
Sat Jun 19 14:04:43 UTC 2021


Assert BSP_INTERRUPT_VECTOR_MAX + 1 == BSP_INTERRUPT_VECTOR_COUNT.

After building all BSPs with this patch, BSP_INTERRUPT_VECTOR_MAX can be
removed and replaced by BSP_INTERRUPT_VECTOR_COUNT.  The
BSP_INTERRUPT_VECTOR_COUNT allows a default implementation which supports no
interrupt vector at all.  Using COUNT instead of MAX may avoid some
interpretation issues, for example is the maximum value a valid vector number
or not.

Update #3269.
---
 bsps/aarch64/a53/include/bsp/irq.h              | 1 +
 bsps/aarch64/a72/include/bsp/irq.h              | 1 +
 bsps/aarch64/xilinx-zynqmp/include/bsp/irq.h    | 1 +
 bsps/arm/altera-cyclone-v/include/bsp/irq.h     | 2 ++
 bsps/arm/atsam/include/bsp/irq.h                | 1 +
 bsps/arm/beagle/include/bsp/irq.h               | 1 +
 bsps/arm/csb336/include/bsp/irq.h               | 1 +
 bsps/arm/csb337/include/bsp/irq.h               | 1 +
 bsps/arm/edb7312/include/bsp/irq.h              | 1 +
 bsps/arm/fvp/include/bsp/irq.h                  | 2 ++
 bsps/arm/gumstix/include/bsp/irq.h              | 1 +
 bsps/arm/imx/include/bsp/irq.h                  | 1 +
 bsps/arm/imxrt/include/bsp/irq.h                | 1 +
 bsps/arm/lm3s69xx/include/bsp/irq.h             | 1 +
 bsps/arm/lpc176x/include/bsp/irq.h              | 1 +
 bsps/arm/lpc24xx/include/bsp/irq.h              | 2 ++
 bsps/arm/lpc32xx/include/bsp/irq.h              | 1 +
 bsps/arm/raspberrypi/include/bsp/irq.h          | 2 ++
 bsps/arm/realview-pbx-a9/include/bsp/irq.h      | 1 +
 bsps/arm/rtl22xx/include/bsp/irq.h              | 1 +
 bsps/arm/smdk2410/include/bsp/irq.h             | 1 +
 bsps/arm/stm32f4/include/bsp/irq.h              | 1 +
 bsps/arm/stm32h7/include/bsp/irq.h              | 1 +
 bsps/arm/tms570/include/bsp/irq.h               | 1 +
 bsps/arm/xen/include/bsp/irq.h                  | 1 +
 bsps/arm/xilinx-zynq/include/bsp/irq.h          | 1 +
 bsps/arm/xilinx-zynqmp/include/bsp/irq.h        | 1 +
 bsps/i386/include/bsp/irq.h                     | 1 +
 bsps/include/bsp/irq-default.h                  | 1 +
 bsps/include/bsp/irq-generic.h                  | 8 ++++++++
 bsps/lm32/include/bsp/irq.h                     | 1 +
 bsps/m68k/genmcf548x/include/bsp/irq.h          | 1 +
 bsps/mips/csb350/include/bsp/irq.h              | 1 +
 bsps/mips/hurricane/include/bsp/irq.h           | 1 +
 bsps/mips/jmr3904/include/bsp/irq.h             | 1 +
 bsps/mips/malta/include/bsp/irq.h               | 1 +
 bsps/mips/rbtx4925/include/bsp/irq.h            | 1 +
 bsps/mips/rbtx4938/include/bsp/irq.h            | 1 +
 bsps/powerpc/gen5200/include/bsp/irq.h          | 1 +
 bsps/powerpc/gen83xx/include/bsp/irq.h          | 1 +
 bsps/powerpc/motorola_powerpc/include/bsp/irq.h | 1 +
 bsps/powerpc/mpc55xxevb/include/bsp/irq.h       | 1 +
 bsps/powerpc/mpc8260ads/include/bsp/irq.h       | 1 +
 bsps/powerpc/psim/include/bsp/irq.h             | 1 +
 bsps/powerpc/qemuppc/include/bsp/irq.h          | 1 +
 bsps/powerpc/qoriq/include/bsp/irq.h            | 2 ++
 bsps/powerpc/t32mppc/include/bsp/irq.h          | 1 +
 bsps/powerpc/tqm8xx/include/bsp/irq.h           | 1 +
 bsps/powerpc/virtex/include/bsp/irq.h           | 1 +
 bsps/riscv/griscv/include/bsp/irq.h             | 1 +
 bsps/riscv/riscv/include/bsp/irq.h              | 1 +
 bsps/sparc/erc32/include/bsp/irq.h              | 1 +
 bsps/sparc/leon2/include/bsp/irq.h              | 1 +
 bsps/sparc/leon3/include/bsp/irq.h              | 1 +
 bsps/x86_64/include/bsp/irq.h                   | 1 +
 55 files changed, 67 insertions(+)

diff --git a/bsps/aarch64/a53/include/bsp/irq.h b/bsps/aarch64/a53/include/bsp/irq.h
index e1aebf5a22..2816c9abd8 100644
--- a/bsps/aarch64/a53/include/bsp/irq.h
+++ b/bsps/aarch64/a53/include/bsp/irq.h
@@ -49,6 +49,7 @@ extern "C" {
 #endif /* __cplusplus */
 
 #define BSP_INTERRUPT_VECTOR_MAX 1023
+#define BSP_INTERRUPT_VECTOR_COUNT 1024
 
 /* Interrupts vectors */
 #define BSP_TIMER_VIRT_PPI 27
diff --git a/bsps/aarch64/a72/include/bsp/irq.h b/bsps/aarch64/a72/include/bsp/irq.h
index 71076ed82a..e96cde7216 100644
--- a/bsps/aarch64/a72/include/bsp/irq.h
+++ b/bsps/aarch64/a72/include/bsp/irq.h
@@ -49,6 +49,7 @@ extern "C" {
 #endif /* __cplusplus */
 
 #define BSP_INTERRUPT_VECTOR_MAX 1023
+#define BSP_INTERRUPT_VECTOR_COUNT 1024
 
 /* Interrupts vectors */
 #define BSP_TIMER_VIRT_PPI 27
diff --git a/bsps/aarch64/xilinx-zynqmp/include/bsp/irq.h b/bsps/aarch64/xilinx-zynqmp/include/bsp/irq.h
index f12a4536b5..7974b0b4eb 100644
--- a/bsps/aarch64/xilinx-zynqmp/include/bsp/irq.h
+++ b/bsps/aarch64/xilinx-zynqmp/include/bsp/irq.h
@@ -49,6 +49,7 @@ extern "C" {
 #endif /* __cplusplus */
 
 #define BSP_INTERRUPT_VECTOR_MAX 1023
+#define BSP_INTERRUPT_VECTOR_COUNT 1024
 
 /* Interrupts vectors */
 #define BSP_TIMER_VIRT_PPI 27
diff --git a/bsps/arm/altera-cyclone-v/include/bsp/irq.h b/bsps/arm/altera-cyclone-v/include/bsp/irq.h
index d5470f9b4e..e9837ae9e3 100644
--- a/bsps/arm/altera-cyclone-v/include/bsp/irq.h
+++ b/bsps/arm/altera-cyclone-v/include/bsp/irq.h
@@ -48,6 +48,8 @@ extern "C" {
 
 /* Use interrupt IDs as defined in alt_interrupt_common.h */
 #define BSP_INTERRUPT_VECTOR_MAX ALT_INT_INTERRUPT_RAM_ECC_UNCORRECTED_IRQ
+#define BSP_INTERRUPT_VECTOR_COUNT \
+  (ALT_INT_INTERRUPT_RAM_ECC_UNCORRECTED_IRQ + 1)
 
 /** @} */
 
diff --git a/bsps/arm/atsam/include/bsp/irq.h b/bsps/arm/atsam/include/bsp/irq.h
index b6eac75042..e7a4add25a 100644
--- a/bsps/arm/atsam/include/bsp/irq.h
+++ b/bsps/arm/atsam/include/bsp/irq.h
@@ -24,5 +24,6 @@
 #endif
 
 #define BSP_INTERRUPT_VECTOR_MAX 64
+#define BSP_INTERRUPT_VECTOR_COUNT 65
 
 #endif /* LIBBSP_ARM_ATSAM_ESV_70_IRQ_H */
diff --git a/bsps/arm/beagle/include/bsp/irq.h b/bsps/arm/beagle/include/bsp/irq.h
index 9ecd6bc31e..fc583fe8bb 100644
--- a/bsps/arm/beagle/include/bsp/irq.h
+++ b/bsps/arm/beagle/include/bsp/irq.h
@@ -16,6 +16,7 @@
 #include <rtems/irq-extension.h>
 
 #define BSP_INTERRUPT_VECTOR_MAX 127
+#define BSP_INTERRUPT_VECTOR_COUNT 128
 
 #endif /* ASM */
 
diff --git a/bsps/arm/csb336/include/bsp/irq.h b/bsps/arm/csb336/include/bsp/irq.h
index b9978242eb..f082c7c34e 100644
--- a/bsps/arm/csb336/include/bsp/irq.h
+++ b/bsps/arm/csb336/include/bsp/irq.h
@@ -89,5 +89,6 @@
 #define BSP_MAX_INT              64
 
 #define BSP_INTERRUPT_VECTOR_MAX (BSP_MAX_INT - 1)
+#define BSP_INTERRUPT_VECTOR_COUNT BSP_MAX_INT
 
 #endif /* __IRQ_H__ */
diff --git a/bsps/arm/csb337/include/bsp/irq.h b/bsps/arm/csb337/include/bsp/irq.h
index 7d967b0ae0..2dfbff8eac 100644
--- a/bsps/arm/csb337/include/bsp/irq.h
+++ b/bsps/arm/csb337/include/bsp/irq.h
@@ -73,5 +73,6 @@
 #define AT91RM9200_MAX_INT       32
 
 #define BSP_INTERRUPT_VECTOR_MAX (AT91RM9200_MAX_INT - 1)
+#define BSP_INTERRUPT_VECTOR_COUNT AT91RM9200_MAX_INT
 
 #endif /* __IRQ_H__ */
diff --git a/bsps/arm/edb7312/include/bsp/irq.h b/bsps/arm/edb7312/include/bsp/irq.h
index ba167083d3..d0c0c7dd9f 100644
--- a/bsps/arm/edb7312/include/bsp/irq.h
+++ b/bsps/arm/edb7312/include/bsp/irq.h
@@ -84,6 +84,7 @@
 /** @} */
 
 #define BSP_INTERRUPT_VECTOR_MAX (BSP_MAX_INT - 1)
+#define BSP_INTERRUPT_VECTOR_COUNT BSP_MAX_INT
 
 /** @} */
 
diff --git a/bsps/arm/fvp/include/bsp/irq.h b/bsps/arm/fvp/include/bsp/irq.h
index d28f7a6db3..ba558c5122 100644
--- a/bsps/arm/fvp/include/bsp/irq.h
+++ b/bsps/arm/fvp/include/bsp/irq.h
@@ -41,5 +41,7 @@
 #include <bspopts.h>
 
 #define BSP_INTERRUPT_VECTOR_MAX (32 + BSP_ARM_SHARED_PERIPHERAL_INTERRUPT_COUNT)
+#define BSP_INTERRUPT_VECTOR_COUNT \
+  (32 + BSP_ARM_SHARED_PERIPHERAL_INTERRUPT_COUNT + 1)
 
 #endif /* LIBBSP_ARM_FVP_IRQ_H */
diff --git a/bsps/arm/gumstix/include/bsp/irq.h b/bsps/arm/gumstix/include/bsp/irq.h
index f7d0ca72d5..b69f559e74 100644
--- a/bsps/arm/gumstix/include/bsp/irq.h
+++ b/bsps/arm/gumstix/include/bsp/irq.h
@@ -21,6 +21,7 @@
 #include <pxa255.h>
 
 #define BSP_INTERRUPT_VECTOR_MAX (PRIMARY_IRQS - 1)
+#define BSP_INTERRUPT_VECTOR_COUNT PRIMARY_IRQS
 
 #endif /* __asm__ */
 
diff --git a/bsps/arm/imx/include/bsp/irq.h b/bsps/arm/imx/include/bsp/irq.h
index 249b416387..26b0f348d5 100644
--- a/bsps/arm/imx/include/bsp/irq.h
+++ b/bsps/arm/imx/include/bsp/irq.h
@@ -27,6 +27,7 @@ extern "C" {
 #endif /* __cplusplus */
 
 #define BSP_INTERRUPT_VECTOR_MAX 159
+#define BSP_INTERRUPT_VECTOR_COUNT 160
 #define BSP_INTERRUPT_VECTOR_INVALID (UINT32_MAX)
 
 #ifdef __cplusplus
diff --git a/bsps/arm/imxrt/include/bsp/irq.h b/bsps/arm/imxrt/include/bsp/irq.h
index 5e7fba0d33..0732136570 100644
--- a/bsps/arm/imxrt/include/bsp/irq.h
+++ b/bsps/arm/imxrt/include/bsp/irq.h
@@ -44,6 +44,7 @@ extern "C" {
 #endif /* __cplusplus */
 
 #define BSP_INTERRUPT_VECTOR_MAX 159
+#define BSP_INTERRUPT_VECTOR_COUNT 160
 #define BSP_INTERRUPT_VECTOR_INVALID (UINT32_MAX)
 
 #ifdef __cplusplus
diff --git a/bsps/arm/lm3s69xx/include/bsp/irq.h b/bsps/arm/lm3s69xx/include/bsp/irq.h
index 25df016b16..bf98b4e785 100644
--- a/bsps/arm/lm3s69xx/include/bsp/irq.h
+++ b/bsps/arm/lm3s69xx/include/bsp/irq.h
@@ -102,5 +102,6 @@
 
 /* NOTE: for lm3s6965 - 43 */
 #define BSP_INTERRUPT_VECTOR_MAX 47
+#define BSP_INTERRUPT_VECTOR_COUNT 48
 
 #endif /* LIBBSP_ARM_LM3S69XX_IRQ_H */
diff --git a/bsps/arm/lpc176x/include/bsp/irq.h b/bsps/arm/lpc176x/include/bsp/irq.h
index 4757e19a62..f108d90366 100644
--- a/bsps/arm/lpc176x/include/bsp/irq.h
+++ b/bsps/arm/lpc176x/include/bsp/irq.h
@@ -69,6 +69,7 @@
 #define LPC176X_IRQ_EEPROM 40U
 
 #define BSP_INTERRUPT_VECTOR_MAX 40
+#define BSP_INTERRUPT_VECTOR_COUNT 41
 
 #define LPC176X_IRQ_PRIORITY_VALUE_MIN 0U
 
diff --git a/bsps/arm/lpc24xx/include/bsp/irq.h b/bsps/arm/lpc24xx/include/bsp/irq.h
index 7bbbf44f49..92afe7d904 100644
--- a/bsps/arm/lpc24xx/include/bsp/irq.h
+++ b/bsps/arm/lpc24xx/include/bsp/irq.h
@@ -70,6 +70,7 @@
   #define LPC24XX_IRQ_I2S 31
 
   #define BSP_INTERRUPT_VECTOR_MAX 31
+  #define BSP_INTERRUPT_VECTOR_COUNT 32
 #else
   #define LPC24XX_IRQ_WDT 0
   #define LPC24XX_IRQ_TIMER_0 1
@@ -113,6 +114,7 @@
   #define LPC24XX_IRQ_EEPROM 40
 
   #define BSP_INTERRUPT_VECTOR_MAX 40
+  #define BSP_INTERRUPT_VECTOR_COUNT 41
 #endif
 
 #define LPC24XX_IRQ_PRIORITY_VALUE_MIN 0
diff --git a/bsps/arm/lpc32xx/include/bsp/irq.h b/bsps/arm/lpc32xx/include/bsp/irq.h
index 1b1ff8db78..d6f7e3144e 100644
--- a/bsps/arm/lpc32xx/include/bsp/irq.h
+++ b/bsps/arm/lpc32xx/include/bsp/irq.h
@@ -140,6 +140,7 @@ extern "C" {
 #define LPC32XX_IRQ_PRIORITY_LOWEST LPC32XX_IRQ_PRIORITY_VALUE_MAX
 
 #define BSP_INTERRUPT_VECTOR_MAX LPC32XX_IRQ_SYSCLK
+#define BSP_INTERRUPT_VECTOR_COUNT (LPC32XX_IRQ_SYSCLK + 1)
 
 #define LPC32XX_IRQ_COUNT (BSP_INTERRUPT_VECTOR_MAX + 1)
 
diff --git a/bsps/arm/raspberrypi/include/bsp/irq.h b/bsps/arm/raspberrypi/include/bsp/irq.h
index 87b6da2963..889d76341c 100644
--- a/bsps/arm/raspberrypi/include/bsp/irq.h
+++ b/bsps/arm/raspberrypi/include/bsp/irq.h
@@ -34,6 +34,7 @@
  */
 
 #define BCM2835_INTC_TOTAL_IRQ       64 + 8
+#define BCM2835_INTC_TOTAL_IRQ       (64 + 8)
 
 #define BCM2835_IRQ_SET1_MIN         0
 #define BCM2835_IRQ_SET2_MIN         32
@@ -70,6 +71,7 @@
 #define BCM2835_IRQ_ID_ILL_ACCESS_0  71
 
 #define BSP_INTERRUPT_VECTOR_MAX    (BCM2835_INTC_TOTAL_IRQ - 1)
+#define BSP_INTERRUPT_VECTOR_COUNT    BCM2835_INTC_TOTAL_IRQ
 #define BSP_INTERRUPT_VECTOR_INVALID (UINT32_MAX)
 
 #define BSP_IRQ_COUNT               (BCM2835_INTC_TOTAL_IRQ)
diff --git a/bsps/arm/realview-pbx-a9/include/bsp/irq.h b/bsps/arm/realview-pbx-a9/include/bsp/irq.h
index 1d7a6b68c8..8226e162d8 100644
--- a/bsps/arm/realview-pbx-a9/include/bsp/irq.h
+++ b/bsps/arm/realview-pbx-a9/include/bsp/irq.h
@@ -91,6 +91,7 @@ extern "C" {
 #define RVPBXA9_IRQ_P_NINT_7 89
 
 #define BSP_INTERRUPT_VECTOR_MAX 89
+#define BSP_INTERRUPT_VECTOR_COUNT 90
 
 #ifdef __cplusplus
 }
diff --git a/bsps/arm/rtl22xx/include/bsp/irq.h b/bsps/arm/rtl22xx/include/bsp/irq.h
index ee7f603cf9..7b7a7c73a7 100644
--- a/bsps/arm/rtl22xx/include/bsp/irq.h
+++ b/bsps/arm/rtl22xx/include/bsp/irq.h
@@ -54,6 +54,7 @@
 #define BSP_MAX_INT              28
 
 #define BSP_INTERRUPT_VECTOR_MAX (BSP_MAX_INT - 1)
+#define BSP_INTERRUPT_VECTOR_COUNT BSP_MAX_INT
 
 #define UNDEFINED_INSTRUCTION_VECTOR_ADDR   (*(u_long *)0x00000004L)
 #define SOFTWARE_INTERRUPT_VECTOR_ADDR      (*(u_long *)0x00000008L)
diff --git a/bsps/arm/smdk2410/include/bsp/irq.h b/bsps/arm/smdk2410/include/bsp/irq.h
index ca846920ff..08a3e9162c 100644
--- a/bsps/arm/smdk2410/include/bsp/irq.h
+++ b/bsps/arm/smdk2410/include/bsp/irq.h
@@ -91,6 +91,7 @@
 #endif
 
 #define BSP_INTERRUPT_VECTOR_MAX (BSP_MAX_INT - 1)
+#define BSP_INTERRUPT_VECTOR_COUNT BSP_MAX_INT
 
 #endif /* _IRQ_H_ */
 /* end of include file */
diff --git a/bsps/arm/stm32f4/include/bsp/irq.h b/bsps/arm/stm32f4/include/bsp/irq.h
index 3c047d3da7..7ca6eee7c1 100644
--- a/bsps/arm/stm32f4/include/bsp/irq.h
+++ b/bsps/arm/stm32f4/include/bsp/irq.h
@@ -134,6 +134,7 @@ extern "C" {
 #define STM32F4_IRQ_PRIORITY_LOWEST STM32F4_IRQ_PRIORITY_VALUE_MAX
 
 #define BSP_INTERRUPT_VECTOR_MAX 81
+#define BSP_INTERRUPT_VECTOR_COUNT 82
 
 /** @} */
 
diff --git a/bsps/arm/stm32h7/include/bsp/irq.h b/bsps/arm/stm32h7/include/bsp/irq.h
index 609c1a2ac2..a06e052393 100644
--- a/bsps/arm/stm32h7/include/bsp/irq.h
+++ b/bsps/arm/stm32h7/include/bsp/irq.h
@@ -37,5 +37,6 @@
 #endif /* ASM */
 
 #define BSP_INTERRUPT_VECTOR_MAX 239
+#define BSP_INTERRUPT_VECTOR_COUNT 240
 
 #endif /* LIBBSP_ARM_STM32H7_IRQ_H */
diff --git a/bsps/arm/tms570/include/bsp/irq.h b/bsps/arm/tms570/include/bsp/irq.h
index 2f412604bb..10ab11630f 100644
--- a/bsps/arm/tms570/include/bsp/irq.h
+++ b/bsps/arm/tms570/include/bsp/irq.h
@@ -113,6 +113,7 @@
 #define TMS570_IRQ_HWAG1_INT_REQ_L 88
 #define TMS570_IRQ_HWAG2_INT_REQ_L 89
 #define BSP_INTERRUPT_VECTOR_MAX 94
+#define BSP_INTERRUPT_VECTOR_COUNT 95
 
 #define TMS570_IRQ_PRIORITY_VALUE_MIN 0U
 #define TMS570_IRQ_PRIORITY_VALUE_MAX 0U
diff --git a/bsps/arm/xen/include/bsp/irq.h b/bsps/arm/xen/include/bsp/irq.h
index a29917d31b..264095e052 100644
--- a/bsps/arm/xen/include/bsp/irq.h
+++ b/bsps/arm/xen/include/bsp/irq.h
@@ -41,6 +41,7 @@ extern "C" {
 #endif /* __cplusplus */
 
 #define BSP_INTERRUPT_VECTOR_MAX 1023
+#define BSP_INTERRUPT_VECTOR_COUNT 1024
 
 /* Xen guest interrupts */
 #define GUEST_TIMER_VIRT_PPI 27
diff --git a/bsps/arm/xilinx-zynq/include/bsp/irq.h b/bsps/arm/xilinx-zynq/include/bsp/irq.h
index 099edcd034..f2c57eb1dd 100644
--- a/bsps/arm/xilinx-zynq/include/bsp/irq.h
+++ b/bsps/arm/xilinx-zynq/include/bsp/irq.h
@@ -115,6 +115,7 @@ extern "C" {
 #define ZYNQ_IRQ_PARITY 92
 
 #define BSP_INTERRUPT_VECTOR_MAX 92
+#define BSP_INTERRUPT_VECTOR_COUNT 93
 
 /** @} */
 
diff --git a/bsps/arm/xilinx-zynqmp/include/bsp/irq.h b/bsps/arm/xilinx-zynqmp/include/bsp/irq.h
index 7ad1a01d90..a4d676b9ed 100644
--- a/bsps/arm/xilinx-zynqmp/include/bsp/irq.h
+++ b/bsps/arm/xilinx-zynqmp/include/bsp/irq.h
@@ -68,6 +68,7 @@ extern "C" {
 #define ZYNQMP_IRQ_UART_1 54
 
 #define BSP_INTERRUPT_VECTOR_MAX 187
+#define BSP_INTERRUPT_VECTOR_COUNT 188
 
 /** @} */
 
diff --git a/bsps/i386/include/bsp/irq.h b/bsps/i386/include/bsp/irq.h
index 6e2f7cbb2c..be11b5c496 100644
--- a/bsps/i386/include/bsp/irq.h
+++ b/bsps/i386/include/bsp/irq.h
@@ -80,6 +80,7 @@ extern "C" {
 #define BSP_SMP_IPI   		16 /* not part of the ATPIC */
 
 #define BSP_INTERRUPT_VECTOR_MAX BSP_IRQ_VECTOR_MAX_OFFSET
+#define BSP_INTERRUPT_VECTOR_COUNT BSP_IRQ_VECTOR_NUMBER
 
 /** @brief
  * Type definition for RTEMS managed interrupts
diff --git a/bsps/include/bsp/irq-default.h b/bsps/include/bsp/irq-default.h
index c72782e993..aedd80caf1 100644
--- a/bsps/include/bsp/irq-default.h
+++ b/bsps/include/bsp/irq-default.h
@@ -48,6 +48,7 @@ extern "C" {
  * @brief Default maximum interrupt vector.
  */
 #define BSP_INTERRUPT_VECTOR_MAX 0
+#define BSP_INTERRUPT_VECTOR_COUNT 1
 
 /** @} */
 
diff --git a/bsps/include/bsp/irq-generic.h b/bsps/include/bsp/irq-generic.h
index a423f19192..31010d1c08 100644
--- a/bsps/include/bsp/irq-generic.h
+++ b/bsps/include/bsp/irq-generic.h
@@ -62,6 +62,14 @@ extern "C" {
   #error "BSP_INTERRUPT_VECTOR_MAX shall be defined"
 #endif
 
+#if !defined(BSP_INTERRUPT_VECTOR_COUNT)
+  #error "BSP_INTERRUPT_VECTOR_COUNT shall be defined"
+#endif
+
+#if BSP_INTERRUPT_VECTOR_MAX + 1 != BSP_INTERRUPT_VECTOR_COUNT
+  #error "BSP_INTERRUPT_VECTOR_COUNT is not equal to BSP_INTERRUPT_VECTOR_MAX + 1"
+#endif
+
 #if defined(BSP_INTERRUPT_USE_INDEX_TABLE) && !defined(BSP_INTERRUPT_HANDLER_TABLE_SIZE)
   #error "if you define BSP_INTERRUPT_USE_INDEX_TABLE, you have to define BSP_INTERRUPT_HANDLER_TABLE_SIZE etc. as well"
 #endif
diff --git a/bsps/lm32/include/bsp/irq.h b/bsps/lm32/include/bsp/irq.h
index 19ba56e161..92fe327d20 100644
--- a/bsps/lm32/include/bsp/irq.h
+++ b/bsps/lm32/include/bsp/irq.h
@@ -36,6 +36,7 @@
  * @brief Maximum vector number.
  */
 #define BSP_INTERRUPT_VECTOR_MAX 31
+#define BSP_INTERRUPT_VECTOR_COUNT 32
 
 /** @} */
 
diff --git a/bsps/m68k/genmcf548x/include/bsp/irq.h b/bsps/m68k/genmcf548x/include/bsp/irq.h
index b3a6285a21..bfa97a3b3b 100644
--- a/bsps/m68k/genmcf548x/include/bsp/irq.h
+++ b/bsps/m68k/genmcf548x/include/bsp/irq.h
@@ -90,5 +90,6 @@
 #define MCF548X_IRQ_GPT0 62
 
 #define BSP_INTERRUPT_VECTOR_MAX 63
+#define BSP_INTERRUPT_VECTOR_COUNT 64
 
 #endif /* LIBBSP_M68K_MCF548X_IRQ_H */
diff --git a/bsps/mips/csb350/include/bsp/irq.h b/bsps/mips/csb350/include/bsp/irq.h
index b1d3f86aa7..10c59b3879 100644
--- a/bsps/mips/csb350/include/bsp/irq.h
+++ b/bsps/mips/csb350/include/bsp/irq.h
@@ -116,6 +116,7 @@
 #define AU1X00_MAXIMUM_VECTORS        (MIPS_INTERRUPT_BASE + 72)
 
 #define BSP_INTERRUPT_VECTOR_MAX      AU1X00_MAXIMUM_VECTORS 
+#define BSP_INTERRUPT_VECTOR_COUNT    (AU1X00_MAXIMUM_VECTORS + 1)
 
 /** @} */
 
diff --git a/bsps/mips/hurricane/include/bsp/irq.h b/bsps/mips/hurricane/include/bsp/irq.h
index 4264a0e84d..47e6df6738 100644
--- a/bsps/mips/hurricane/include/bsp/irq.h
+++ b/bsps/mips/hurricane/include/bsp/irq.h
@@ -33,6 +33,7 @@
 
 #define RM5231_MAXIMUM_VECTORS      (MIPS_INTERRUPT_BASE+8)
 #define BSP_INTERRUPT_VECTOR_MAX    RM5231_MAXIMUM_VECTORS
+#define BSP_INTERRUPT_VECTOR_COUNT  (RM5231_MAXIMUM_VECTORS + 1)
 
 /** @} */
 
diff --git a/bsps/mips/jmr3904/include/bsp/irq.h b/bsps/mips/jmr3904/include/bsp/irq.h
index a40f26dc7a..c591a57add 100644
--- a/bsps/mips/jmr3904/include/bsp/irq.h
+++ b/bsps/mips/jmr3904/include/bsp/irq.h
@@ -60,6 +60,7 @@
   #define TX3904_MAXIMUM_VECTORS MIPS_INTERRUPT_BASE+19
 
 #define BSP_INTERRUPT_VECTOR_MAX TX3904_MAXIMUM_VECTORS
+#define BSP_INTERRUPT_VECTOR_COUNT (TX3904_MAXIMUM_VECTORS + 1)
 
 /** @} */
 
diff --git a/bsps/mips/malta/include/bsp/irq.h b/bsps/mips/malta/include/bsp/irq.h
index 25cb186873..6fc7f54b80 100644
--- a/bsps/mips/malta/include/bsp/irq.h
+++ b/bsps/mips/malta/include/bsp/irq.h
@@ -80,6 +80,7 @@
 #
 
 #define BSP_INTERRUPT_VECTOR_MAX   MALTA_PCI_ADP_LAST
+#define BSP_INTERRUPT_VECTOR_COUNT   (MALTA_PCI_ADP_LAST + 1)
 
 /*
  * Redefine interrupts with more descriptive names.
diff --git a/bsps/mips/rbtx4925/include/bsp/irq.h b/bsps/mips/rbtx4925/include/bsp/irq.h
index db28e65989..4fec677926 100644
--- a/bsps/mips/rbtx4925/include/bsp/irq.h
+++ b/bsps/mips/rbtx4925/include/bsp/irq.h
@@ -73,6 +73,7 @@
 #define TX4925_MAXIMUM_VECTORS MIPS_INTERRUPT_BASE+34
 
 #define BSP_INTERRUPT_VECTOR_MAX TX4925_MAXIMUM_VECTORS
+#define BSP_INTERRUPT_VECTOR_COUNT (TX4925_MAXIMUM_VECTORS + 1)
 
 /** @} */
 
diff --git a/bsps/mips/rbtx4938/include/bsp/irq.h b/bsps/mips/rbtx4938/include/bsp/irq.h
index 03ecacda73..cc06397762 100644
--- a/bsps/mips/rbtx4938/include/bsp/irq.h
+++ b/bsps/mips/rbtx4938/include/bsp/irq.h
@@ -73,6 +73,7 @@
 #define TX4938_MAXIMUM_VECTORS MIPS_INTERRUPT_BASE+34
 
 #define BSP_INTERRUPT_VECTOR_MAX TX4938_MAXIMUM_VECTORS
+#define BSP_INTERRUPT_VECTOR_COUNT (TX4938_MAXIMUM_VECTORS + 1)
 
 /** @} */
 
diff --git a/bsps/powerpc/gen5200/include/bsp/irq.h b/bsps/powerpc/gen5200/include/bsp/irq.h
index 63d39cb3df..58c6e5ad01 100644
--- a/bsps/powerpc/gen5200/include/bsp/irq.h
+++ b/bsps/powerpc/gen5200/include/bsp/irq.h
@@ -204,6 +204,7 @@ typedef enum {
 #define BSP_PERIODIC_TIMER                    BSP_SIU_IRQ_TMR6
 
 #define BSP_INTERRUPT_VECTOR_MAX BSP_MAX_OFFSET
+#define BSP_INTERRUPT_VECTOR_COUNT (BSP_MAX_OFFSET + 1)
 
 #endif
 
diff --git a/bsps/powerpc/gen83xx/include/bsp/irq.h b/bsps/powerpc/gen83xx/include/bsp/irq.h
index 42bd2980fe..3a015d2bd6 100644
--- a/bsps/powerpc/gen83xx/include/bsp/irq.h
+++ b/bsps/powerpc/gen83xx/include/bsp/irq.h
@@ -163,6 +163,7 @@ extern "C" {
   } rtems_irq_symbolic_name;
 
 #define BSP_INTERRUPT_VECTOR_MAX BSP_MAX_OFFSET
+#define BSP_INTERRUPT_VECTOR_COUNT (BSP_MAX_OFFSET + 1)
 
 rtems_status_code mpc83xx_ipic_set_mask( rtems_vector_number vector, rtems_vector_number mask_vector, bool mask);
 
diff --git a/bsps/powerpc/motorola_powerpc/include/bsp/irq.h b/bsps/powerpc/motorola_powerpc/include/bsp/irq.h
index 3fcdf916c2..b6831bd2fa 100644
--- a/bsps/powerpc/motorola_powerpc/include/bsp/irq.h
+++ b/bsps/powerpc/motorola_powerpc/include/bsp/irq.h
@@ -116,6 +116,7 @@ extern "C" {
 #define BSP_LOWEST_OFFSET		(BSP_ISA_IRQ_LOWEST_OFFSET)
 #define BSP_MAX_OFFSET			(BSP_MISC_IRQ_MAX_OFFSET)
 #define BSP_INTERRUPT_VECTOR_MAX	(BSP_MAX_OFFSET)
+#define BSP_INTERRUPT_VECTOR_COUNT	(BSP_MAX_OFFSET + 1)
 /*
  * Some ISA IRQ symbolic name definition
  */
diff --git a/bsps/powerpc/mpc55xxevb/include/bsp/irq.h b/bsps/powerpc/mpc55xxevb/include/bsp/irq.h
index e0b3c3eaf8..2b21ff637d 100644
--- a/bsps/powerpc/mpc55xxevb/include/bsp/irq.h
+++ b/bsps/powerpc/mpc55xxevb/include/bsp/irq.h
@@ -478,6 +478,7 @@ rtems_status_code mpc55xx_intc_clear_software_irq(rtems_vector_number vector);
  */
 
 #define BSP_INTERRUPT_VECTOR_MAX MPC55XX_IRQ_MAX
+#define BSP_INTERRUPT_VECTOR_COUNT (MPC55XX_IRQ_MAX + 1)
 
 #ifdef BSP_INTERRUPT_HANDLER_TABLE_SIZE
   #define BSP_INTERRUPT_USE_INDEX_TABLE
diff --git a/bsps/powerpc/mpc8260ads/include/bsp/irq.h b/bsps/powerpc/mpc8260ads/include/bsp/irq.h
index 12890d998e..38e47db842 100644
--- a/bsps/powerpc/mpc8260ads/include/bsp/irq.h
+++ b/bsps/powerpc/mpc8260ads/include/bsp/irq.h
@@ -142,6 +142,7 @@ extern volatile unsigned int ppc_cached_irq_mask;
 #define BSP_PERIODIC_TIMER		(BSP_DECREMENTER)
 
 #define BSP_INTERRUPT_VECTOR_MAX BSP_MAX_OFFSET
+#define BSP_INTERRUPT_VECTOR_COUNT (BSP_MAX_OFFSET + 1)
 
 #define CPM_INTERRUPT
 
diff --git a/bsps/powerpc/psim/include/bsp/irq.h b/bsps/powerpc/psim/include/bsp/irq.h
index 248cfb5579..f5ce672a47 100644
--- a/bsps/powerpc/psim/include/bsp/irq.h
+++ b/bsps/powerpc/psim/include/bsp/irq.h
@@ -58,6 +58,7 @@
 #include <bsp/irq_supp.h>
 
 #define BSP_INTERRUPT_VECTOR_MAX BSP_MAX_OFFSET
+#define BSP_INTERRUPT_VECTOR_COUNT BSP_IRQ_NUMBER
 
 #ifdef __cplusplus
 extern "C" {
diff --git a/bsps/powerpc/qemuppc/include/bsp/irq.h b/bsps/powerpc/qemuppc/include/bsp/irq.h
index 1fd8b53a11..9388add2a4 100644
--- a/bsps/powerpc/qemuppc/include/bsp/irq.h
+++ b/bsps/powerpc/qemuppc/include/bsp/irq.h
@@ -57,6 +57,7 @@
 #define BSP_DECREMENTER			(BSP_PROCESSOR_IRQ_LOWEST_OFFSET)
 
 #define BSP_INTERRUPT_VECTOR_MAX BSP_MAX_OFFSET
+#define BSP_INTERRUPT_VECTOR_COUNT BSP_IRQ_NUMBER
 
 /* #include <bsp/irq_supp.h> */
 
diff --git a/bsps/powerpc/qoriq/include/bsp/irq.h b/bsps/powerpc/qoriq/include/bsp/irq.h
index 09a4279399..9dbfa86191 100644
--- a/bsps/powerpc/qoriq/include/bsp/irq.h
+++ b/bsps/powerpc/qoriq/include/bsp/irq.h
@@ -35,6 +35,7 @@ extern "C" {
 #ifdef QORIQ_IS_HYPERVISOR_GUEST
 
 #define BSP_INTERRUPT_VECTOR_MAX 1023
+#define BSP_INTERRUPT_VECTOR_COUNT 1024
 
 #else /* !QORIQ_IS_HYPERVISOR_GUEST */
 
@@ -351,6 +352,7 @@ extern "C" {
 #define QORIQ_IRQ_GT_B_3 (QORIQ_IRQ_GT_BASE + 7)
 
 #define BSP_INTERRUPT_VECTOR_MAX QORIQ_IRQ_GT_B_3
+#define BSP_INTERRUPT_VECTOR_COUNT (QORIQ_IRQ_GT_B_3 + 1)
 
 /** @} */
 
diff --git a/bsps/powerpc/t32mppc/include/bsp/irq.h b/bsps/powerpc/t32mppc/include/bsp/irq.h
index 7ac3b1f676..81f93f3323 100644
--- a/bsps/powerpc/t32mppc/include/bsp/irq.h
+++ b/bsps/powerpc/t32mppc/include/bsp/irq.h
@@ -25,6 +25,7 @@ extern "C" {
 #endif /* __cplusplus */
 
 #define BSP_INTERRUPT_VECTOR_MAX 0
+#define BSP_INTERRUPT_VECTOR_COUNT 1
 
 RTEMS_INLINE_ROUTINE void bsp_interrupt_set_affinity(
   rtems_vector_number   vector,
diff --git a/bsps/powerpc/tqm8xx/include/bsp/irq.h b/bsps/powerpc/tqm8xx/include/bsp/irq.h
index 3a5010d602..9704b5e7d3 100644
--- a/bsps/powerpc/tqm8xx/include/bsp/irq.h
+++ b/bsps/powerpc/tqm8xx/include/bsp/irq.h
@@ -147,6 +147,7 @@ extern "C" {
 #define BSP_FAST_ETHERNET_CTRL	BSP_SIU_INT_IRQ_3
 
 #define BSP_INTERRUPT_VECTOR_MAX BSP_MAX_OFFSET
+#define BSP_INTERRUPT_VECTOR_COUNT (BSP_MAX_OFFSET + 1)
 
 extern int BSP_irq_enabled_at_cpm(const rtems_irq_number irqLine);
 
diff --git a/bsps/powerpc/virtex/include/bsp/irq.h b/bsps/powerpc/virtex/include/bsp/irq.h
index 02fe972404..57a5ecbde3 100644
--- a/bsps/powerpc/virtex/include/bsp/irq.h
+++ b/bsps/powerpc/virtex/include/bsp/irq.h
@@ -62,6 +62,7 @@
            || BSP_IS_OPBINTC_IRQ(irqnum))
 
 #define BSP_INTERRUPT_VECTOR_MAX BSP_PROCESSOR_IRQ_MAX_OFFSET
+#define BSP_INTERRUPT_VECTOR_COUNT (BSP_PROCESSOR_IRQ_MAX_OFFSET + 1)
 
 #ifndef ASM
 #ifdef __cplusplus
diff --git a/bsps/riscv/griscv/include/bsp/irq.h b/bsps/riscv/griscv/include/bsp/irq.h
index 2100e6f7d3..520425d2ba 100644
--- a/bsps/riscv/griscv/include/bsp/irq.h
+++ b/bsps/riscv/griscv/include/bsp/irq.h
@@ -55,6 +55,7 @@
 #define RISCV_INTERRUPT_VECTOR_EXTERNAL_TO_INDEX(x) ((x) - 2)
 
 #define BSP_INTERRUPT_VECTOR_MAX RISCV_INTERRUPT_VECTOR_EXTERNAL(RISCV_MAXIMUM_EXTERNAL_INTERRUPTS - 1)
+#define BSP_INTERRUPT_VECTOR_COUNT RISCV_INTERRUPT_VECTOR_EXTERNAL(RISCV_MAXIMUM_EXTERNAL_INTERRUPTS)
 
 void bsp_interrupt_set_affinity(
   rtems_vector_number vector,
diff --git a/bsps/riscv/riscv/include/bsp/irq.h b/bsps/riscv/riscv/include/bsp/irq.h
index a902570155..1c7cec5a02 100644
--- a/bsps/riscv/riscv/include/bsp/irq.h
+++ b/bsps/riscv/riscv/include/bsp/irq.h
@@ -55,6 +55,7 @@
 #define RISCV_INTERRUPT_VECTOR_EXTERNAL_TO_INDEX(x) ((x) - 2)
 
 #define BSP_INTERRUPT_VECTOR_MAX RISCV_INTERRUPT_VECTOR_EXTERNAL(RISCV_MAXIMUM_EXTERNAL_INTERRUPTS - 1)
+#define BSP_INTERRUPT_VECTOR_COUNT RISCV_INTERRUPT_VECTOR_EXTERNAL(RISCV_MAXIMUM_EXTERNAL_INTERRUPTS)
 
 void bsp_interrupt_set_affinity(
   rtems_vector_number vector,
diff --git a/bsps/sparc/erc32/include/bsp/irq.h b/bsps/sparc/erc32/include/bsp/irq.h
index ad3a65fcc1..eace63e5dd 100644
--- a/bsps/sparc/erc32/include/bsp/irq.h
+++ b/bsps/sparc/erc32/include/bsp/irq.h
@@ -22,6 +22,7 @@
 
 #define BSP_INTERRUPT_VECTOR_MAX_STD 15 /* Standard IRQ controller */
 #define BSP_INTERRUPT_VECTOR_MAX BSP_INTERRUPT_VECTOR_MAX_STD
+#define BSP_INTERRUPT_VECTOR_COUNT (BSP_INTERRUPT_VECTOR_MAX_STD + 1)
 
 /* No extra check is needed */
 #undef BSP_INTERRUPT_CUSTOM_VALID_VECTOR
diff --git a/bsps/sparc/leon2/include/bsp/irq.h b/bsps/sparc/leon2/include/bsp/irq.h
index 287530e275..1a56105ca0 100644
--- a/bsps/sparc/leon2/include/bsp/irq.h
+++ b/bsps/sparc/leon2/include/bsp/irq.h
@@ -20,6 +20,7 @@
 
 #define BSP_INTERRUPT_VECTOR_MAX_STD 15 /* Standard IRQ controller */
 #define BSP_INTERRUPT_VECTOR_MAX BSP_INTERRUPT_VECTOR_MAX_STD
+#define BSP_INTERRUPT_VECTOR_COUNT (BSP_INTERRUPT_VECTOR_MAX_STD + 1)
 
 /* No extra check is needed */
 #undef BSP_INTERRUPT_CUSTOM_VALID_VECTOR
diff --git a/bsps/sparc/leon3/include/bsp/irq.h b/bsps/sparc/leon3/include/bsp/irq.h
index 77f9fc2528..908fef5d79 100644
--- a/bsps/sparc/leon3/include/bsp/irq.h
+++ b/bsps/sparc/leon3/include/bsp/irq.h
@@ -25,6 +25,7 @@
 #define BSP_INTERRUPT_VECTOR_MAX_EXT 31 /* Extended IRQ controller */
 
 #define BSP_INTERRUPT_VECTOR_MAX BSP_INTERRUPT_VECTOR_MAX_EXT
+#define BSP_INTERRUPT_VECTOR_COUNT (BSP_INTERRUPT_VECTOR_MAX_EXT + 1)
 
 /* The check is different depending on IRQ controller, runtime detected */
 #define BSP_INTERRUPT_CUSTOM_VALID_VECTOR
diff --git a/bsps/x86_64/include/bsp/irq.h b/bsps/x86_64/include/bsp/irq.h
index 312c831962..d8dd588859 100644
--- a/bsps/x86_64/include/bsp/irq.h
+++ b/bsps/x86_64/include/bsp/irq.h
@@ -40,6 +40,7 @@
 
 #define BSP_IRQ_VECTOR_NUMBER     34
 #define BSP_INTERRUPT_VECTOR_MAX  BSP_IRQ_VECTOR_NUMBER
+#define BSP_INTERRUPT_VECTOR_COUNT (BSP_IRQ_VECTOR_NUMBER + 1)
 
 #endif /* !ASM */
 #endif /* LIBBSP_GENERIC_RISCV_IRQ_H */
-- 
2.26.2



More information about the devel mailing list