aboutsummaryrefslogtreecommitdiff
path: root/lib/chibios/os/hal/ports/STM32/LLD/EXTIv1/stm32_exti4.inc
diff options
context:
space:
mode:
Diffstat (limited to 'lib/chibios/os/hal/ports/STM32/LLD/EXTIv1/stm32_exti4.inc')
-rw-r--r--lib/chibios/os/hal/ports/STM32/LLD/EXTIv1/stm32_exti4.inc95
1 files changed, 95 insertions, 0 deletions
diff --git a/lib/chibios/os/hal/ports/STM32/LLD/EXTIv1/stm32_exti4.inc b/lib/chibios/os/hal/ports/STM32/LLD/EXTIv1/stm32_exti4.inc
new file mode 100644
index 000000000..a39e83d4c
--- /dev/null
+++ b/lib/chibios/os/hal/ports/STM32/LLD/EXTIv1/stm32_exti4.inc
@@ -0,0 +1,95 @@
1/*
2 ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
3
4 Licensed under the Apache License, Version 2.0 (the "License");
5 you may not use this file except in compliance with the License.
6 You may obtain a copy of the License at
7
8 http://www.apache.org/licenses/LICENSE-2.0
9
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
15*/
16
17/**
18 * @file EXTIv1/stm32_exti4.inc
19 * @brief Shared EXTI4 handler.
20 *
21 * @addtogroup STM32_EXTI4_HANDLER
22 * @{
23 */
24
25/*===========================================================================*/
26/* Driver local definitions. */
27/*===========================================================================*/
28
29/*===========================================================================*/
30/* Derived constants and error checks. */
31/*===========================================================================*/
32
33/* Priority settings checks.*/
34#if !defined(STM32_IRQ_EXTI4_PRIORITY)
35#error "STM32_IRQ_EXTI4_PRIORITY not defined in mcuconf.h"
36#endif
37
38#if !OSAL_IRQ_IS_VALID_PRIORITY(STM32_IRQ_EXTI4_PRIORITY)
39#error "Invalid IRQ priority assigned to STM32_IRQ_EXTI4_PRIORITY"
40#endif
41
42/*===========================================================================*/
43/* Driver exported variables. */
44/*===========================================================================*/
45
46/*===========================================================================*/
47/* Driver local variables. */
48/*===========================================================================*/
49
50/*===========================================================================*/
51/* Driver local functions. */
52/*===========================================================================*/
53
54static inline void exti4_irq_init(void) {
55#if (HAL_USE_PAL && (PAL_USE_WAIT || PAL_USE_CALLBACKS))
56 nvicEnableVector(STM32_EXTI4_NUMBER, STM32_IRQ_EXTI4_PRIORITY);
57#endif
58}
59
60static inline void exti4_irq_deinit(void) {
61#if (HAL_USE_PAL && (PAL_USE_WAIT || PAL_USE_CALLBACKS))
62 nvicDisableVector(STM32_EXTI4_NUMBER);
63#endif
64}
65
66/*===========================================================================*/
67/* Driver interrupt handlers. */
68/*===========================================================================*/
69
70#if (HAL_USE_PAL && (PAL_USE_WAIT || PAL_USE_CALLBACKS)) || defined(__DOXYGEN__)
71#if !defined(STM32_DISABLE_EXTI4_HANDLER)
72/**
73 * @brief EXTI[4] interrupt handler.
74 *
75 * @isr
76 */
77OSAL_IRQ_HANDLER(STM32_EXTI4_HANDLER) {
78 uint32_t pr;
79
80 OSAL_IRQ_PROLOGUE();
81
82 extiGetAndClearGroup1(1U << 4, pr);
83
84 exti_serve_irq(pr, 4);
85
86 OSAL_IRQ_EPILOGUE();
87}
88#endif
89#endif
90
91/*===========================================================================*/
92/* Driver exported functions. */
93/*===========================================================================*/
94
95/** @} */