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