diff options
Diffstat (limited to 'lib/chibios/os/hal/ports/STM32/LLD/EXTIv1/stm32_exti21.inc')
-rw-r--r-- | lib/chibios/os/hal/ports/STM32/LLD/EXTIv1/stm32_exti21.inc | 100 |
1 files changed, 100 insertions, 0 deletions
diff --git a/lib/chibios/os/hal/ports/STM32/LLD/EXTIv1/stm32_exti21.inc b/lib/chibios/os/hal/ports/STM32/LLD/EXTIv1/stm32_exti21.inc new file mode 100644 index 000000000..350091bc5 --- /dev/null +++ b/lib/chibios/os/hal/ports/STM32/LLD/EXTIv1/stm32_exti21.inc | |||
@@ -0,0 +1,100 @@ | |||
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_exti21.inc | ||
19 | * @brief Shared EXTI21 handler. | ||
20 | * | ||
21 | * @addtogroup STM32_EXTI21_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_EXTI21_PRIORITY) | ||
35 | #error "STM32_IRQ_EXTI21_PRIORITY not defined in mcuconf.h" | ||
36 | #endif | ||
37 | |||
38 | #if !OSAL_IRQ_IS_VALID_PRIORITY(STM32_IRQ_EXTI21_PRIORITY) | ||
39 | #error "Invalid IRQ priority assigned to STM32_IRQ_EXTI21_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 | |||
54 | static inline void exti21_irq_init(void) { | ||
55 | #if defined(STM32_EXTI21_IS_USED) | ||
56 | nvicEnableVector(STM32_EXTI21_NUMBER, STM32_IRQ_EXTI21_PRIORITY); | ||
57 | #endif | ||
58 | } | ||
59 | |||
60 | static inline void exti21_irq_deinit(void) { | ||
61 | #if defined(STM32_EXTI21_IS_USED) | ||
62 | nvicDisableVector(STM32_EXTI21_NUMBER); | ||
63 | #endif | ||
64 | } | ||
65 | |||
66 | /*===========================================================================*/ | ||
67 | /* Driver interrupt handlers. */ | ||
68 | /*===========================================================================*/ | ||
69 | |||
70 | #if defined(STM32_EXTI21_IS_USED) || defined(__DOXYGEN__) | ||
71 | #if !defined(STM32_DISABLE_EXTI21_HANDLER) | ||
72 | /** | ||
73 | * @brief EXTI[21] interrupt handler. | ||
74 | * | ||
75 | * @isr | ||
76 | */ | ||
77 | OSAL_IRQ_HANDLER(STM32_EXTI21_HANDLER) { | ||
78 | uint32_t pr; | ||
79 | |||
80 | OSAL_IRQ_PROLOGUE(); | ||
81 | |||
82 | extiGetAndClearGroup1(1U << 21, pr); | ||
83 | |||
84 | /* Could be unused.*/ | ||
85 | (void)pr; | ||
86 | |||
87 | #if defined(STM32_EXTI21_ISR) | ||
88 | STM32_EXTI21_ISR(pr, 21); | ||
89 | #endif | ||
90 | |||
91 | OSAL_IRQ_EPILOGUE(); | ||
92 | } | ||
93 | #endif | ||
94 | #endif | ||
95 | |||
96 | /*===========================================================================*/ | ||
97 | /* Driver exported functions. */ | ||
98 | /*===========================================================================*/ | ||
99 | |||
100 | /** @} */ | ||