aboutsummaryrefslogtreecommitdiff
path: root/lib/chibios/os/hal/ports/STM32/LLD/USARTv2/stm32_uart8.inc
diff options
context:
space:
mode:
Diffstat (limited to 'lib/chibios/os/hal/ports/STM32/LLD/USARTv2/stm32_uart8.inc')
-rw-r--r--lib/chibios/os/hal/ports/STM32/LLD/USARTv2/stm32_uart8.inc121
1 files changed, 121 insertions, 0 deletions
diff --git a/lib/chibios/os/hal/ports/STM32/LLD/USARTv2/stm32_uart8.inc b/lib/chibios/os/hal/ports/STM32/LLD/USARTv2/stm32_uart8.inc
new file mode 100644
index 000000000..89584318b
--- /dev/null
+++ b/lib/chibios/os/hal/ports/STM32/LLD/USARTv2/stm32_uart8.inc
@@ -0,0 +1,121 @@
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 USARTv2/stm32_uart8.inc
19 * @brief Shared UART8 handler.
20 *
21 * @addtogroup STM32_UART8_HANDLER
22 * @{
23 */
24
25/*===========================================================================*/
26/* Driver local definitions. */
27/*===========================================================================*/
28
29/*===========================================================================*/
30/* Derived constants and error checks. */
31/*===========================================================================*/
32
33/* Registry checks for robustness.*/
34#if !defined(STM32_HAS_UART8)
35#error "STM32_HAS_UART8 not defined in registry"
36#endif
37
38#if STM32_HAS_UART8
39
40/* Priority settings checks.*/
41#if !defined(STM32_IRQ_UART8_PRIORITY)
42#error "STM32_IRQ_UART8_PRIORITY not defined in mcuconf.h"
43#endif
44
45#if !OSAL_IRQ_IS_VALID_PRIORITY(STM32_IRQ_UART8_PRIORITY)
46#error "Invalid IRQ priority assigned to STM32_IRQ_UART8_PRIORITY"
47#endif
48
49#endif /* STM32_HAS_UART8 */
50
51/* Other checks.*/
52#if (HAL_USE_SERIAL && STM32_SERIAL_USE_UART8) && \
53 (HAL_USE_UART && STM32_UART_USE_UART8)
54#error "UART8 used by multiple drivers"
55#endif
56
57#if (HAL_USE_SERIAL && STM32_SERIAL_USE_UART8) || \
58 (HAL_USE_UART && STM32_UART_USE_UART8)
59#define STM32_UART8_IS_USED TRUE
60#else
61#define STM32_UART8_IS_USED FALSE
62#endif
63
64/*===========================================================================*/
65/* Driver exported variables. */
66/*===========================================================================*/
67
68/*===========================================================================*/
69/* Driver local variables. */
70/*===========================================================================*/
71
72/*===========================================================================*/
73/* Driver local functions. */
74/*===========================================================================*/
75
76static inline void uart8_irq_init(void) {
77#if STM32_UART8_IS_USED
78 nvicEnableVector(STM32_UART8_NUMBER, STM32_IRQ_UART8_PRIORITY);
79#endif
80}
81
82static inline void uart8_irq_deinit(void) {
83#if STM32_UART8_IS_USED
84 nvicDisableVector(STM32_UART8_NUMBER);
85#endif
86}
87
88/*===========================================================================*/
89/* Driver interrupt handlers. */
90/*===========================================================================*/
91
92#if STM32_UART8_IS_USED || defined(__DOXYGEN__)
93/**
94 * @brief UART8 interrupt handler.
95 *
96 * @isr
97 */
98OSAL_IRQ_HANDLER(STM32_UART8_HANDLER) {
99
100 OSAL_IRQ_PROLOGUE();
101
102#if HAL_USE_SERIAL
103#if STM32_SERIAL_USE_UART8
104 sd_lld_serve_interrupt(&SD8);
105#endif
106#endif
107#if HAL_USE_UART
108#if STM32_UART_USE_UART8
109 uart_lld_serve_interrupt(&UARTD8);
110#endif
111#endif
112
113 OSAL_IRQ_EPILOGUE();
114}
115#endif
116
117/*===========================================================================*/
118/* Driver exported functions. */
119/*===========================================================================*/
120
121/** @} */