From 50116fa76f383a3f819c5e4104fb9e6d02ae2cc7 Mon Sep 17 00:00:00 2001 From: Giovanni Di Sirio Date: Sun, 29 Dec 2019 15:40:04 +0000 Subject: [PATCH] More EXTI handlers, few comment fixes. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@13229 27425a3e-05d8-49a3-a47f-9c15f0e5edd8 --- .../ports/STM32/LLD/EXTIv1/stm32_exti0_1.inc | 2 +- os/hal/ports/STM32/LLD/EXTIv1/stm32_exti1.inc | 2 +- .../STM32/LLD/EXTIv1/stm32_exti10_15.inc | 2 +- .../STM32/LLD/EXTIv1/stm32_exti16-40_41.inc | 101 ++++++++++++++++++ .../ports/STM32/LLD/EXTIv1/stm32_exti16.inc | 2 +- .../ports/STM32/LLD/EXTIv1/stm32_exti17.inc | 2 +- .../ports/STM32/LLD/EXTIv1/stm32_exti18.inc | 2 +- .../ports/STM32/LLD/EXTIv1/stm32_exti19.inc | 2 +- os/hal/ports/STM32/LLD/EXTIv1/stm32_exti2.inc | 2 +- .../ports/STM32/LLD/EXTIv1/stm32_exti20.inc | 2 +- .../ports/STM32/LLD/EXTIv1/stm32_exti21.inc | 2 +- .../ports/STM32/LLD/EXTIv1/stm32_exti22.inc | 2 +- .../ports/STM32/LLD/EXTIv1/stm32_exti23.inc | 2 +- .../ports/STM32/LLD/EXTIv1/stm32_exti2_3.inc | 2 +- os/hal/ports/STM32/LLD/EXTIv1/stm32_exti3.inc | 2 +- .../ports/STM32/LLD/EXTIv1/stm32_exti33.inc | 97 +++++++++++++++++ os/hal/ports/STM32/LLD/EXTIv1/stm32_exti4.inc | 2 +- .../ports/STM32/LLD/EXTIv1/stm32_exti4_15.inc | 2 +- .../ports/STM32/LLD/EXTIv1/stm32_exti5_9.inc | 2 +- 19 files changed, 215 insertions(+), 17 deletions(-) create mode 100644 os/hal/ports/STM32/LLD/EXTIv1/stm32_exti16-40_41.inc create mode 100644 os/hal/ports/STM32/LLD/EXTIv1/stm32_exti33.inc diff --git a/os/hal/ports/STM32/LLD/EXTIv1/stm32_exti0_1.inc b/os/hal/ports/STM32/LLD/EXTIv1/stm32_exti0_1.inc index d9b3126fe..d20141b4a 100644 --- a/os/hal/ports/STM32/LLD/EXTIv1/stm32_exti0_1.inc +++ b/os/hal/ports/STM32/LLD/EXTIv1/stm32_exti0_1.inc @@ -70,7 +70,7 @@ static inline void exti0_1_irq_deinit(void) { #if (HAL_USE_PAL && (PAL_USE_WAIT || PAL_USE_CALLBACKS)) || defined(__DOXYGEN__) #if !defined(STM32_DISABLE_EXTI0_1_HANDLER) /** - * @brief EXTI[0] interrupt handler. + * @brief EXTI[0], EXTI[1] interrupt handler. * * @isr */ diff --git a/os/hal/ports/STM32/LLD/EXTIv1/stm32_exti1.inc b/os/hal/ports/STM32/LLD/EXTIv1/stm32_exti1.inc index 6f9a9f567..c7a9de1d5 100644 --- a/os/hal/ports/STM32/LLD/EXTIv1/stm32_exti1.inc +++ b/os/hal/ports/STM32/LLD/EXTIv1/stm32_exti1.inc @@ -70,7 +70,7 @@ static inline void exti1_irq_deinit(void) { #if (HAL_USE_PAL && (PAL_USE_WAIT || PAL_USE_CALLBACKS)) || defined(__DOXYGEN__) #if !defined(STM32_DISABLE_EXTI1_HANDLER) /** - * @brief EXTI[0] interrupt handler. + * @brief EXTI[1] interrupt handler. * * @isr */ diff --git a/os/hal/ports/STM32/LLD/EXTIv1/stm32_exti10_15.inc b/os/hal/ports/STM32/LLD/EXTIv1/stm32_exti10_15.inc index 10b6b3913..3288dc969 100644 --- a/os/hal/ports/STM32/LLD/EXTIv1/stm32_exti10_15.inc +++ b/os/hal/ports/STM32/LLD/EXTIv1/stm32_exti10_15.inc @@ -70,7 +70,7 @@ static inline void exti10_15_irq_deinit(void) { #if (HAL_USE_PAL && (PAL_USE_WAIT || PAL_USE_CALLBACKS)) || defined(__DOXYGEN__) #if !defined(STM32_DISABLE_EXTI10_15_HANDLER) /** - * @brief EXTI[0] interrupt handler. + * @brief EXTI[10]..EXTI[15] interrupt handler. * * @isr */ diff --git a/os/hal/ports/STM32/LLD/EXTIv1/stm32_exti16-40_41.inc b/os/hal/ports/STM32/LLD/EXTIv1/stm32_exti16-40_41.inc new file mode 100644 index 000000000..9c5bc041c --- /dev/null +++ b/os/hal/ports/STM32/LLD/EXTIv1/stm32_exti16-40_41.inc @@ -0,0 +1,101 @@ +/* + ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +/** + * @file EXTIv1/stm32_exti16-40_41.inc + * @brief Shared EXTI16-40_41 handler. + * + * @addtogroup STM32_EXTI164041_HANDLER + * @{ + */ + +/*===========================================================================*/ +/* Driver local definitions. */ +/*===========================================================================*/ + +/*===========================================================================*/ +/* Derived constants and error checks. */ +/*===========================================================================*/ + +/* Priority settings checks.*/ +#if !defined(STM32_IRQ_EXTI164041_PRIORITY) +#error "STM32_IRQ_EXTI164041_PRIORITY not defined in mcuconf.h" +#endif + +#if !OSAL_IRQ_IS_VALID_PRIORITY(STM32_IRQ_EXTI164041_PRIORITY) +#error "Invalid IRQ priority assigned to STM32_IRQ_EXTI164041_PRIORITY" +#endif + +/*===========================================================================*/ +/* Driver exported variables. */ +/*===========================================================================*/ + +/*===========================================================================*/ +/* Driver local variables. */ +/*===========================================================================*/ + +/*===========================================================================*/ +/* Driver local functions. */ +/*===========================================================================*/ + +static inline void exti10_exti40_41_irq_init(void) { +#if defined(STM32_EXTI16_IS_USED) || defined(STM32_EXTI40_IS_USED) || \ + defined(STM32_EXTI41_IS_USED) + nvicEnableVector(STM32_EXTI164041_NUMBER, STM32_IRQ_EXTI10_15_PRIORITY); +#endif +} + +static inline void exti10_exti40_41_irq_deinit(void) { +#if defined(STM32_EXTI16_IS_USED) || defined(STM32_EXTI40_IS_USED) || \ + defined(STM32_EXTI41_IS_USED) + nvicDisableVector(STM32_EXTI164041_NUMBER); +#endif +} + +/*===========================================================================*/ +/* Driver interrupt handlers. */ +/*===========================================================================*/ + +#if defined(STM32_EXTI16_IS_USED) || defined(STM32_EXTI40_IS_USED) || \ + defined(STM32_EXTI41_IS_USED) || defined(__DOXYGEN__) +#if !defined(STM32_DISABLE_EXTI164041_HANDLER) +/** + * @brief EXTI[16], EXTI[40], EXTI[41] interrupt handler. + * + * @isr + */ +OSAL_IRQ_HANDLER(STM32_EXTI164041_HANDLER) { + uint32_t pr1, pr2; + + OSAL_IRQ_PROLOGUE(); + + extiGetAndClearGroup1(1U << 16); + extiGetAndClearGroup2((1U << (40 - 32)) | (1U << (41 - 32)), pr2); + + exti_serve_irq(pr1, 16); + exti_serve_irq(pr2, (40 - 32)); + exti_serve_irq(pr2, (41 - 32)); + + OSAL_IRQ_EPILOGUE(); +} +#endif +#endif + +/*===========================================================================*/ +/* Driver exported functions. */ +/*===========================================================================*/ + +/** @} */ diff --git a/os/hal/ports/STM32/LLD/EXTIv1/stm32_exti16.inc b/os/hal/ports/STM32/LLD/EXTIv1/stm32_exti16.inc index 39e96d62b..bfc68f7ba 100644 --- a/os/hal/ports/STM32/LLD/EXTIv1/stm32_exti16.inc +++ b/os/hal/ports/STM32/LLD/EXTIv1/stm32_exti16.inc @@ -70,7 +70,7 @@ static inline void exti16_irq_deinit(void) { #if defined(STM32_EXTI16_IS_USED) || defined(__DOXYGEN__) #if !defined(STM32_DISABLE_EXTI16_HANDLER) /** - * @brief EXTI[0] interrupt handler. + * @brief EXTI[16] interrupt handler. * * @isr */ diff --git a/os/hal/ports/STM32/LLD/EXTIv1/stm32_exti17.inc b/os/hal/ports/STM32/LLD/EXTIv1/stm32_exti17.inc index aaead941b..0d51715e4 100644 --- a/os/hal/ports/STM32/LLD/EXTIv1/stm32_exti17.inc +++ b/os/hal/ports/STM32/LLD/EXTIv1/stm32_exti17.inc @@ -70,7 +70,7 @@ static inline void exti17_irq_deinit(void) { #if defined(STM32_EXTI17_IS_USED) || defined(__DOXYGEN__) #if !defined(STM32_DISABLE_EXTI17_HANDLER) /** - * @brief EXTI[0] interrupt handler. + * @brief EXTI[17] interrupt handler. * * @isr */ diff --git a/os/hal/ports/STM32/LLD/EXTIv1/stm32_exti18.inc b/os/hal/ports/STM32/LLD/EXTIv1/stm32_exti18.inc index 91bdeadd5..4892e774a 100644 --- a/os/hal/ports/STM32/LLD/EXTIv1/stm32_exti18.inc +++ b/os/hal/ports/STM32/LLD/EXTIv1/stm32_exti18.inc @@ -70,7 +70,7 @@ static inline void exti18_irq_deinit(void) { #if defined(STM32_EXTI18_IS_USED) || defined(__DOXYGEN__) #if !defined(STM32_DISABLE_EXTI18_HANDLER) /** - * @brief EXTI[0] interrupt handler. + * @brief EXTI[18] interrupt handler. * * @isr */ diff --git a/os/hal/ports/STM32/LLD/EXTIv1/stm32_exti19.inc b/os/hal/ports/STM32/LLD/EXTIv1/stm32_exti19.inc index 1a91dfd41..4c3823e1a 100644 --- a/os/hal/ports/STM32/LLD/EXTIv1/stm32_exti19.inc +++ b/os/hal/ports/STM32/LLD/EXTIv1/stm32_exti19.inc @@ -70,7 +70,7 @@ static inline void exti19_irq_deinit(void) { #if defined(STM32_EXTI19_IS_USED) || defined(__DOXYGEN__) #if !defined(STM32_DISABLE_EXTI19_HANDLER) /** - * @brief EXTI[0] interrupt handler. + * @brief EXTI[19] interrupt handler. * * @isr */ diff --git a/os/hal/ports/STM32/LLD/EXTIv1/stm32_exti2.inc b/os/hal/ports/STM32/LLD/EXTIv1/stm32_exti2.inc index 1936e1b22..82e3142da 100644 --- a/os/hal/ports/STM32/LLD/EXTIv1/stm32_exti2.inc +++ b/os/hal/ports/STM32/LLD/EXTIv1/stm32_exti2.inc @@ -70,7 +70,7 @@ static inline void exti2_irq_deinit(void) { #if (HAL_USE_PAL && (PAL_USE_WAIT || PAL_USE_CALLBACKS)) || defined(__DOXYGEN__) #if !defined(STM32_DISABLE_EXTI2_HANDLER) /** - * @brief EXTI[0] interrupt handler. + * @brief EXTI[2] interrupt handler. * * @isr */ diff --git a/os/hal/ports/STM32/LLD/EXTIv1/stm32_exti20.inc b/os/hal/ports/STM32/LLD/EXTIv1/stm32_exti20.inc index 1609f75e1..d0fea0e70 100644 --- a/os/hal/ports/STM32/LLD/EXTIv1/stm32_exti20.inc +++ b/os/hal/ports/STM32/LLD/EXTIv1/stm32_exti20.inc @@ -70,7 +70,7 @@ static inline void exti20_irq_deinit(void) { #if defined(STM32_EXTI20_IS_USED) || defined(__DOXYGEN__) #if !defined(STM32_DISABLE_EXTI20_HANDLER) /** - * @brief EXTI[0] interrupt handler. + * @brief EXTI[20] interrupt handler. * * @isr */ diff --git a/os/hal/ports/STM32/LLD/EXTIv1/stm32_exti21.inc b/os/hal/ports/STM32/LLD/EXTIv1/stm32_exti21.inc index 9702e78b6..ebe359b4f 100644 --- a/os/hal/ports/STM32/LLD/EXTIv1/stm32_exti21.inc +++ b/os/hal/ports/STM32/LLD/EXTIv1/stm32_exti21.inc @@ -70,7 +70,7 @@ static inline void exti21_irq_deinit(void) { #if defined(STM32_EXTI21_IS_USED) || defined(__DOXYGEN__) #if !defined(STM32_DISABLE_EXTI21_HANDLER) /** - * @brief EXTI[0] interrupt handler. + * @brief EXTI[21] interrupt handler. * * @isr */ diff --git a/os/hal/ports/STM32/LLD/EXTIv1/stm32_exti22.inc b/os/hal/ports/STM32/LLD/EXTIv1/stm32_exti22.inc index daed8f5c3..849ea0a50 100644 --- a/os/hal/ports/STM32/LLD/EXTIv1/stm32_exti22.inc +++ b/os/hal/ports/STM32/LLD/EXTIv1/stm32_exti22.inc @@ -70,7 +70,7 @@ static inline void exti22_irq_deinit(void) { #if defined(STM32_EXTI22_IS_USED) || defined(__DOXYGEN__) #if !defined(STM32_DISABLE_EXTI22_HANDLER) /** - * @brief EXTI[0] interrupt handler. + * @brief EXTI[22] interrupt handler. * * @isr */ diff --git a/os/hal/ports/STM32/LLD/EXTIv1/stm32_exti23.inc b/os/hal/ports/STM32/LLD/EXTIv1/stm32_exti23.inc index ac5aecaf9..ee4d4bcd8 100644 --- a/os/hal/ports/STM32/LLD/EXTIv1/stm32_exti23.inc +++ b/os/hal/ports/STM32/LLD/EXTIv1/stm32_exti23.inc @@ -70,7 +70,7 @@ static inline void exti23_irq_deinit(void) { #if defined(STM32_EXTI23_IS_USED) || defined(__DOXYGEN__) #if !defined(STM32_DISABLE_EXTI23_HANDLER) /** - * @brief EXTI[0] interrupt handler. + * @brief EXTI[23] interrupt handler. * * @isr */ diff --git a/os/hal/ports/STM32/LLD/EXTIv1/stm32_exti2_3.inc b/os/hal/ports/STM32/LLD/EXTIv1/stm32_exti2_3.inc index 75c23290e..5c8ed9aed 100644 --- a/os/hal/ports/STM32/LLD/EXTIv1/stm32_exti2_3.inc +++ b/os/hal/ports/STM32/LLD/EXTIv1/stm32_exti2_3.inc @@ -70,7 +70,7 @@ static inline void exti2_3_irq_deinit(void) { #if (HAL_USE_PAL && (PAL_USE_WAIT || PAL_USE_CALLBACKS)) || defined(__DOXYGEN__) #if !defined(STM32_DISABLE_EXTI2_3_HANDLER) /** - * @brief EXTI[0] interrupt handler. + * @brief EXTI[2], EXTI[3] interrupt handler. * * @isr */ diff --git a/os/hal/ports/STM32/LLD/EXTIv1/stm32_exti3.inc b/os/hal/ports/STM32/LLD/EXTIv1/stm32_exti3.inc index 6211c3de5..9c9be73b3 100644 --- a/os/hal/ports/STM32/LLD/EXTIv1/stm32_exti3.inc +++ b/os/hal/ports/STM32/LLD/EXTIv1/stm32_exti3.inc @@ -70,7 +70,7 @@ static inline void exti3_irq_deinit(void) { #if (HAL_USE_PAL && (PAL_USE_WAIT || PAL_USE_CALLBACKS)) || defined(__DOXYGEN__) #if !defined(STM32_DISABLE_EXTI3_HANDLER) /** - * @brief EXTI[0] interrupt handler. + * @brief EXTI[3] interrupt handler. * * @isr */ diff --git a/os/hal/ports/STM32/LLD/EXTIv1/stm32_exti33.inc b/os/hal/ports/STM32/LLD/EXTIv1/stm32_exti33.inc new file mode 100644 index 000000000..c5fcecea9 --- /dev/null +++ b/os/hal/ports/STM32/LLD/EXTIv1/stm32_exti33.inc @@ -0,0 +1,97 @@ +/* + ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +/** + * @file EXTIv1/stm32_exti33.inc + * @brief Shared EXTI33 handler. + * + * @addtogroup STM32_EXTI33_HANDLER + * @{ + */ + +/*===========================================================================*/ +/* Driver local definitions. */ +/*===========================================================================*/ + +/*===========================================================================*/ +/* Derived constants and error checks. */ +/*===========================================================================*/ + +/* Priority settings checks.*/ +#if !defined(STM32_IRQ_EXTI33_PRIORITY) +#error "STM32_IRQ_EXTI33_PRIORITY not defined in mcuconf.h" +#endif + +#if !OSAL_IRQ_IS_VALID_PRIORITY(STM32_IRQ_EXTI33_PRIORITY) +#error "Invalid IRQ priority assigned to STM32_IRQ_EXTI33_PRIORITY" +#endif + +/*===========================================================================*/ +/* Driver exported variables. */ +/*===========================================================================*/ + +/*===========================================================================*/ +/* Driver local variables. */ +/*===========================================================================*/ + +/*===========================================================================*/ +/* Driver local functions. */ +/*===========================================================================*/ + +static inline void exti33_irq_init(void) { +#if defined(STM32_EXTI33_IS_USED) + nvicEnableVector(STM32_EXTI33_NUMBER, STM32_IRQ_EXTI33_PRIORITY); +#endif +} + +static inline void exti33_irq_deinit(void) { +#if defined(STM32_EXTI33_IS_USED) + nvicDisableVector(STM32_EXTI33_NUMBER); +#endif +} + +/*===========================================================================*/ +/* Driver interrupt handlers. */ +/*===========================================================================*/ + +#if defined(STM32_EXTI33_IS_USED) || defined(__DOXYGEN__) +#if !defined(STM32_DISABLE_EXTI33_HANDLER) +/** + * @brief EXTI[33] interrupt handler. + * + * @isr + */ +OSAL_IRQ_HANDLER(STM32_EXTI33_HANDLER) { + uint32_t pr; + + OSAL_IRQ_PROLOGUE(); + + extiGetAndClearGroup2(1U << (33 - 32), pr); + +#if defined(STM32_EXTI33_ISR) + STM32_EXTI33_ISR(pr, (33 - 32)); +#endif + + OSAL_IRQ_EPILOGUE(); +} +#endif +#endif + +/*===========================================================================*/ +/* Driver exported functions. */ +/*===========================================================================*/ + +/** @} */ diff --git a/os/hal/ports/STM32/LLD/EXTIv1/stm32_exti4.inc b/os/hal/ports/STM32/LLD/EXTIv1/stm32_exti4.inc index 467e32ff4..68c4b60c7 100644 --- a/os/hal/ports/STM32/LLD/EXTIv1/stm32_exti4.inc +++ b/os/hal/ports/STM32/LLD/EXTIv1/stm32_exti4.inc @@ -70,7 +70,7 @@ static inline void exti4_irq_deinit(void) { #if (HAL_USE_PAL && (PAL_USE_WAIT || PAL_USE_CALLBACKS)) || defined(__DOXYGEN__) #if !defined(STM32_DISABLE_EXTI4_HANDLER) /** - * @brief EXTI[0] interrupt handler. + * @brief EXTI[4] interrupt handler. * * @isr */ diff --git a/os/hal/ports/STM32/LLD/EXTIv1/stm32_exti4_15.inc b/os/hal/ports/STM32/LLD/EXTIv1/stm32_exti4_15.inc index 32f3dd733..ddb6663de 100644 --- a/os/hal/ports/STM32/LLD/EXTIv1/stm32_exti4_15.inc +++ b/os/hal/ports/STM32/LLD/EXTIv1/stm32_exti4_15.inc @@ -70,7 +70,7 @@ static inline void exti4_15_irq_deinit(void) { #if (HAL_USE_PAL && (PAL_USE_WAIT || PAL_USE_CALLBACKS)) || defined(__DOXYGEN__) #if !defined(STM32_DISABLE_EXTI4_15_HANDLER) /** - * @brief EXTI[0] interrupt handler. + * @brief EXTI[4]..EXTI[15] interrupt handler. * * @isr */ diff --git a/os/hal/ports/STM32/LLD/EXTIv1/stm32_exti5_9.inc b/os/hal/ports/STM32/LLD/EXTIv1/stm32_exti5_9.inc index f036e41c1..9a52fa6cf 100644 --- a/os/hal/ports/STM32/LLD/EXTIv1/stm32_exti5_9.inc +++ b/os/hal/ports/STM32/LLD/EXTIv1/stm32_exti5_9.inc @@ -70,7 +70,7 @@ static inline void exti5_9_irq_deinit(void) { #if (HAL_USE_PAL && (PAL_USE_WAIT || PAL_USE_CALLBACKS)) || defined(__DOXYGEN__) #if !defined(STM32_DISABLE_EXTI5_9_HANDLER) /** - * @brief EXTI[0] interrupt handler. + * @brief EXTI[5]..EXTI[9] interrupt handler. * * @isr */