diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2021-06-19 12:40:57 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2021-06-24 11:35:49 +0200 |
commit | cd5573c09def76d3d202349639da6ba05617b31b (patch) | |
tree | 17bc03ce550e178efe616958d2b0e5417fa5d441 /bsps/include | |
parent | smpcapture02: Fix use of BSP_INTERRUPT_VECTOR_MAX (diff) | |
download | rtems-cd5573c09def76d3d202349639da6ba05617b31b.tar.bz2 |
bsps/irq: Add BSP_INTERRUPT_VECTOR_COUNT
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.
Diffstat (limited to 'bsps/include')
-rw-r--r-- | bsps/include/bsp/irq-default.h | 1 | ||||
-rw-r--r-- | bsps/include/bsp/irq-generic.h | 8 |
2 files changed, 9 insertions, 0 deletions
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 |