diff options
Diffstat (limited to 'lib/chibios/os/common/ext/ST/STM32L5xx/stm32l5xx.h')
-rw-r--r-- | lib/chibios/os/common/ext/ST/STM32L5xx/stm32l5xx.h | 180 |
1 files changed, 180 insertions, 0 deletions
diff --git a/lib/chibios/os/common/ext/ST/STM32L5xx/stm32l5xx.h b/lib/chibios/os/common/ext/ST/STM32L5xx/stm32l5xx.h new file mode 100644 index 000000000..f8415bf69 --- /dev/null +++ b/lib/chibios/os/common/ext/ST/STM32L5xx/stm32l5xx.h | |||
@@ -0,0 +1,180 @@ | |||
1 | /** | ||
2 | ****************************************************************************** | ||
3 | * @file stm32l5xx.h | ||
4 | * @author MCD Application Team | ||
5 | * @brief CMSIS STM32L5xx Device Peripheral Access Layer Header File. | ||
6 | * | ||
7 | * The file is the unique include file that the application programmer | ||
8 | * is using in the C source code, usually in main.c. This file contains: | ||
9 | * - Configuration section that allows to select: | ||
10 | * - The STM32L5xx device used in the target application | ||
11 | * - To use or not the peripheral�s drivers in application code(i.e. | ||
12 | * code will be based on direct access to peripheral�s registers | ||
13 | * rather than drivers API), this option is controlled by | ||
14 | * "#define USE_HAL_DRIVER" | ||
15 | * | ||
16 | ****************************************************************************** | ||
17 | * @attention | ||
18 | * | ||
19 | * <h2><center>© Copyright (c) 2019 STMicroelectronics. | ||
20 | * All rights reserved.</center></h2> | ||
21 | * | ||
22 | * This software component is licensed by ST under BSD 3-Clause license, | ||
23 | * the "License"; You may not use this file except in compliance with the | ||
24 | * License. You may obtain a copy of the License at: | ||
25 | * opensource.org/licenses/BSD-3-Clause | ||
26 | * | ||
27 | ****************************************************************************** | ||
28 | */ | ||
29 | |||
30 | /** @addtogroup CMSIS | ||
31 | * @{ | ||
32 | */ | ||
33 | |||
34 | /** @addtogroup stm32l5xx | ||
35 | * @{ | ||
36 | */ | ||
37 | |||
38 | #ifndef STM32L5xx_H | ||
39 | #define STM32L5xx_H | ||
40 | |||
41 | #ifdef __cplusplus | ||
42 | extern "C" { | ||
43 | #endif /* __cplusplus */ | ||
44 | |||
45 | /** @addtogroup Library_configuration_section | ||
46 | * @{ | ||
47 | */ | ||
48 | |||
49 | /** | ||
50 | * @brief STM32 Family | ||
51 | */ | ||
52 | #if !defined (STM32L5) | ||
53 | #define STM32L5 | ||
54 | #endif /* STM32L5 */ | ||
55 | |||
56 | /* Uncomment the line below according to the target STM32L5 device used in your | ||
57 | application | ||
58 | */ | ||
59 | |||
60 | #if !defined (STM32L552xx) && !defined (STM32L562xx) | ||
61 | /* #define STM32L552xx */ /*!< STM32L552xx Devices */ | ||
62 | /* #define STM32L562xx */ /*!< STM32L562xx Devices */ | ||
63 | #endif | ||
64 | |||
65 | /* Tip: To avoid modifying this file each time you need to switch between these | ||
66 | devices, you can define the device in your toolchain compiler preprocessor. | ||
67 | */ | ||
68 | #if !defined (USE_HAL_DRIVER) | ||
69 | /** | ||
70 | * @brief Comment the line below if you will not use the peripherals drivers. | ||
71 | In this case, these drivers will not be included and the application code will | ||
72 | be based on direct access to peripherals registers | ||
73 | */ | ||
74 | /*#define USE_HAL_DRIVER */ | ||
75 | #endif /* USE_HAL_DRIVER */ | ||
76 | |||
77 | /** | ||
78 | * @brief CMSIS Device version number | ||
79 | */ | ||
80 | #define __STM32L5_CMSIS_VERSION_MAIN (0x01U) /*!< [31:24] main version */ | ||
81 | #define __STM32L5_CMSIS_VERSION_SUB1 (0x00U) /*!< [23:16] sub1 version */ | ||
82 | #define __STM32L5_CMSIS_VERSION_SUB2 (0x00U) /*!< [15:8] sub2 version */ | ||
83 | #define __STM32L5_CMSIS_VERSION_RC (0x00U) /*!< [7:0] release candidate */ | ||
84 | #define __STM32L5_CMSIS_VERSION ((__STM32L5_CMSIS_VERSION_MAIN << 24U)\ | ||
85 | |(__STM32L5_CMSIS_VERSION_SUB1 << 16U)\ | ||
86 | |(__STM32L5_CMSIS_VERSION_SUB2 << 8U )\ | ||
87 | |(__STM32L5_CMSIS_VERSION_RC)) | ||
88 | |||
89 | /** | ||
90 | * @} | ||
91 | */ | ||
92 | |||
93 | /** @addtogroup Device_Included | ||
94 | * @{ | ||
95 | */ | ||
96 | |||
97 | #if defined(STM32L552xx) | ||
98 | #include "stm32l552xx.h" | ||
99 | #elif defined(STM32L562xx) | ||
100 | #include "stm32l562xx.h" | ||
101 | #else | ||
102 | #error "Please select first the target STM32L5xx device used in your application (in stm32l5xx.h file)" | ||
103 | #endif | ||
104 | |||
105 | /** | ||
106 | * @} | ||
107 | */ | ||
108 | |||
109 | /** @addtogroup Exported_types | ||
110 | * @{ | ||
111 | */ | ||
112 | typedef enum | ||
113 | { | ||
114 | RESET = 0, | ||
115 | SET = !RESET | ||
116 | } FlagStatus, ITStatus; | ||
117 | |||
118 | typedef enum | ||
119 | { | ||
120 | DISABLE = 0, | ||
121 | ENABLE = !DISABLE | ||
122 | } FunctionalState; | ||
123 | #define IS_FUNCTIONAL_STATE(STATE) (((STATE) == DISABLE) || ((STATE) == ENABLE)) | ||
124 | |||
125 | typedef enum | ||
126 | { | ||
127 | SUCCESS = 0, | ||
128 | ERROR = !SUCCESS | ||
129 | } ErrorStatus; | ||
130 | |||
131 | /** | ||
132 | * @} | ||
133 | */ | ||
134 | |||
135 | |||
136 | /** @addtogroup Exported_macros | ||
137 | * @{ | ||
138 | */ | ||
139 | #define SET_BIT(REG, BIT) ((REG) |= (BIT)) | ||
140 | |||
141 | #define CLEAR_BIT(REG, BIT) ((REG) &= ~(BIT)) | ||
142 | |||
143 | #define READ_BIT(REG, BIT) ((REG) & (BIT)) | ||
144 | |||
145 | #define CLEAR_REG(REG) ((REG) = (0x0)) | ||
146 | |||
147 | #define WRITE_REG(REG, VAL) ((REG) = (VAL)) | ||
148 | |||
149 | #define READ_REG(REG) ((REG)) | ||
150 | |||
151 | #define MODIFY_REG(REG, CLEARMASK, SETMASK) WRITE_REG((REG), (((READ_REG(REG)) & (~(CLEARMASK))) | (SETMASK))) | ||
152 | |||
153 | #define POSITION_VAL(VAL) (__CLZ(__RBIT(VAL))) | ||
154 | |||
155 | |||
156 | /** | ||
157 | * @} | ||
158 | */ | ||
159 | |||
160 | #if defined (USE_HAL_DRIVER) | ||
161 | #include "stm32l5xx_hal.h" | ||
162 | #endif /* USE_HAL_DRIVER */ | ||
163 | |||
164 | #ifdef __cplusplus | ||
165 | } | ||
166 | #endif /* __cplusplus */ | ||
167 | |||
168 | #endif /* STM32L5xx_H */ | ||
169 | /** | ||
170 | * @} | ||
171 | */ | ||
172 | |||
173 | /** | ||
174 | * @} | ||
175 | */ | ||
176 | |||
177 | |||
178 | |||
179 | |||
180 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ | ||