diff options
Diffstat (limited to 'lib/chibios/os/common/ext/ST/STM32L0xx/stm32l0xx.h')
-rw-r--r-- | lib/chibios/os/common/ext/ST/STM32L0xx/stm32l0xx.h | 241 |
1 files changed, 241 insertions, 0 deletions
diff --git a/lib/chibios/os/common/ext/ST/STM32L0xx/stm32l0xx.h b/lib/chibios/os/common/ext/ST/STM32L0xx/stm32l0xx.h new file mode 100644 index 000000000..ee94d8b08 --- /dev/null +++ b/lib/chibios/os/common/ext/ST/STM32L0xx/stm32l0xx.h | |||
@@ -0,0 +1,241 @@ | |||
1 | /** | ||
2 | ****************************************************************************** | ||
3 | * @file stm32l0xx.h | ||
4 | * @author MCD Application Team | ||
5 | * @brief CMSIS Cortex-M0+ Device Peripheral Access Layer Header File. | ||
6 | * This file contains all the peripheral register's definitions, bits | ||
7 | * definitions and memory mapping for STM32L0xx devices. | ||
8 | * | ||
9 | * The file is the unique include file that the application programmer | ||
10 | * is using in the C source code, usually in main.c. This file contains: | ||
11 | * - Configuration section that allows to select: | ||
12 | * - The device used in the target application | ||
13 | * - To use or not the peripheral's drivers in application code(i.e. | ||
14 | * code will be based on direct access to peripheral's registers | ||
15 | * rather than drivers API), this option is controlled by | ||
16 | * "#define USE_HAL_DRIVER" | ||
17 | * | ||
18 | ****************************************************************************** | ||
19 | * @attention | ||
20 | * | ||
21 | * <h2><center>© COPYRIGHT(c) 2016 STMicroelectronics</center></h2> | ||
22 | * | ||
23 | * Redistribution and use in source and binary forms, with or without modification, | ||
24 | * are permitted provided that the following conditions are met: | ||
25 | * 1. Redistributions of source code must retain the above copyright notice, | ||
26 | * this list of conditions and the following disclaimer. | ||
27 | * 2. Redistributions in binary form must reproduce the above copyright notice, | ||
28 | * this list of conditions and the following disclaimer in the documentation | ||
29 | * and/or other materials provided with the distribution. | ||
30 | * 3. Neither the name of STMicroelectronics nor the names of its contributors | ||
31 | * may be used to endorse or promote products derived from this software | ||
32 | * without specific prior written permission. | ||
33 | * | ||
34 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
35 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
36 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
37 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE | ||
38 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
39 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
40 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
41 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | ||
42 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
43 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
44 | * | ||
45 | ****************************************************************************** | ||
46 | */ | ||
47 | |||
48 | /** @addtogroup CMSIS | ||
49 | * @{ | ||
50 | */ | ||
51 | |||
52 | /** @addtogroup stm32l0xx | ||
53 | * @{ | ||
54 | */ | ||
55 | |||
56 | #ifndef __STM32L0xx_H | ||
57 | #define __STM32L0xx_H | ||
58 | |||
59 | #ifdef __cplusplus | ||
60 | extern "C" { | ||
61 | #endif /* __cplusplus */ | ||
62 | |||
63 | /** @addtogroup Library_configuration_section | ||
64 | * @{ | ||
65 | */ | ||
66 | |||
67 | /** | ||
68 | * @brief STM32 Family | ||
69 | */ | ||
70 | #if !defined (STM32L0) | ||
71 | #define STM32L0 | ||
72 | #endif /* STM32L0 */ | ||
73 | |||
74 | /* Uncomment the line below according to the target STM32 device used in your | ||
75 | application | ||
76 | */ | ||
77 | |||
78 | #if !defined (STM32L011xx) && !defined (STM32L021xx) && \ | ||
79 | !defined (STM32L031xx) && !defined (STM32L041xx) && \ | ||
80 | !defined (STM32L051xx) && !defined (STM32L052xx) && !defined (STM32L053xx) && \ | ||
81 | !defined (STM32L061xx) && !defined (STM32L062xx) && !defined (STM32L063xx) && \ | ||
82 | !defined (STM32L071xx) && !defined (STM32L072xx) && !defined (STM32L073xx) && \ | ||
83 | !defined (STM32L081xx) && !defined (STM32L082xx) && !defined (STM32L083xx) \ | ||
84 | /* #define STM32L011xx */ | ||
85 | /* #define STM32L021xx */ | ||
86 | /* #define STM32L031xx */ /*!< STM32L031C6, STM32L031E6, STM32L031F6, STM32L031G6, STM32L031K6 Devices */ | ||
87 | /* #define STM32L041xx */ /*!< STM32L041C6, STM32L041E6, STM32L041F6, STM32L041G6, STM32L041K6 Devices */ | ||
88 | /* #define STM32L051xx */ /*!< STM32L051K8, STM32L051C6, STM32L051C8, STM32L051R6, STM32L051R8 Devices */ | ||
89 | /* #define STM32L052xx */ /*!< STM32L052K6, STM32L052K8, STM32L052C6, STM32L052C8, STM32L052R6, STM32L052R8 Devices */ | ||
90 | /* #define STM32L053xx */ /*!< STM32L053C6, STM32L053C8, STM32L053R6, STM32L053R8 Devices */ | ||
91 | /* #define STM32L061xx */ /*!< */ | ||
92 | /* #define STM32L062xx */ /*!< STM32L062K8 */ | ||
93 | /* #define STM32L063xx */ /*!< STM32L063C8, STM32L063R8 */ | ||
94 | /* #define STM32L071xx */ /*!< */ | ||
95 | /* #define STM32L072xx */ /*!< */ | ||
96 | /* #define STM32L073xx */ /*!< STM32L073V8, STM32L073VB, STM32L073RB, STM32L073VZ, STM32L073RZ Devices */ | ||
97 | /* #define STM32L081xx */ /*!< */ | ||
98 | /* #define STM32L082xx */ /*!< */ | ||
99 | /* #define STM32L083xx */ /*!< */ | ||
100 | #endif | ||
101 | |||
102 | /* Tip: To avoid modifying this file each time you need to switch between these | ||
103 | devices, you can define the device in your toolchain compiler preprocessor. | ||
104 | */ | ||
105 | #if !defined (USE_HAL_DRIVER) | ||
106 | /** | ||
107 | * @brief Comment the line below if you will not use the peripherals drivers. | ||
108 | In this case, these drivers will not be included and the application code will | ||
109 | be based on direct access to peripherals registers | ||
110 | */ | ||
111 | /*#define USE_HAL_DRIVER */ | ||
112 | #endif /* USE_HAL_DRIVER */ | ||
113 | |||
114 | /** | ||
115 | * @brief CMSIS Device version number V1.7.1 | ||
116 | */ | ||
117 | #define __STM32L0xx_CMSIS_VERSION_MAIN (0x01) /*!< [31:24] main version */ | ||
118 | #define __STM32L0xx_CMSIS_VERSION_SUB1 (0x07) /*!< [23:16] sub1 version */ | ||
119 | #define __STM32L0xx_CMSIS_VERSION_SUB2 (0x02) /*!< [15:8] sub2 version */ | ||
120 | #define __STM32L0xx_CMSIS_VERSION_RC (0x00) /*!< [7:0] release candidate */ | ||
121 | #define __STM32L0xx_CMSIS_VERSION ((__STM32L0xx_CMSIS_VERSION_MAIN << 24)\ | ||
122 | |(__STM32L0xx_CMSIS_VERSION_SUB1 << 16)\ | ||
123 | |(__STM32L0xx_CMSIS_VERSION_SUB2 << 8 )\ | ||
124 | |(__STM32L0xx_CMSIS_VERSION_RC)) | ||
125 | |||
126 | /** | ||
127 | * @} | ||
128 | */ | ||
129 | |||
130 | /** @addtogroup Device_Included | ||
131 | * @{ | ||
132 | */ | ||
133 | #if defined(STM32L011xx) | ||
134 | #include "stm32l011xx.h" | ||
135 | #elif defined(STM32L021xx) | ||
136 | #include "stm32l021xx.h" | ||
137 | #elif defined(STM32L031xx) | ||
138 | #include "stm32l031xx.h" | ||
139 | #elif defined(STM32L041xx) | ||
140 | #include "stm32l041xx.h" | ||
141 | #elif defined(STM32L051xx) | ||
142 | #include "stm32l051xx.h" | ||
143 | #elif defined(STM32L052xx) | ||
144 | #include "stm32l052xx.h" | ||
145 | #elif defined(STM32L053xx) | ||
146 | #include "stm32l053xx.h" | ||
147 | #elif defined(STM32L062xx) | ||
148 | #include "stm32l062xx.h" | ||
149 | #elif defined(STM32L063xx) | ||
150 | #include "stm32l063xx.h" | ||
151 | #elif defined(STM32L061xx) | ||
152 | #include "stm32l061xx.h" | ||
153 | #elif defined(STM32L071xx) | ||
154 | #include "stm32l071xx.h" | ||
155 | #elif defined(STM32L072xx) | ||
156 | #include "stm32l072xx.h" | ||
157 | #elif defined(STM32L073xx) | ||
158 | #include "stm32l073xx.h" | ||
159 | #elif defined(STM32L082xx) | ||
160 | #include "stm32l082xx.h" | ||
161 | #elif defined(STM32L083xx) | ||
162 | #include "stm32l083xx.h" | ||
163 | #elif defined(STM32L081xx) | ||
164 | #include "stm32l081xx.h" | ||
165 | #else | ||
166 | #error "Please select first the target STM32L0xx device used in your application (in stm32l0xx.h file)" | ||
167 | #endif | ||
168 | |||
169 | /** | ||
170 | * @} | ||
171 | */ | ||
172 | |||
173 | /** @addtogroup Exported_types | ||
174 | * @{ | ||
175 | */ | ||
176 | typedef enum | ||
177 | { | ||
178 | RESET = 0, | ||
179 | SET = !RESET | ||
180 | } FlagStatus, ITStatus; | ||
181 | |||
182 | typedef enum | ||
183 | { | ||
184 | DISABLE = 0, | ||
185 | ENABLE = !DISABLE | ||
186 | } FunctionalState; | ||
187 | #define IS_FUNCTIONAL_STATE(STATE) (((STATE) == DISABLE) || ((STATE) == ENABLE)) | ||
188 | |||
189 | typedef enum | ||
190 | { | ||
191 | ERROR = 0, | ||
192 | SUCCESS = !ERROR | ||
193 | } ErrorStatus; | ||
194 | |||
195 | /** | ||
196 | * @} | ||
197 | */ | ||
198 | |||
199 | |||
200 | /** @addtogroup Exported_macro | ||
201 | * @{ | ||
202 | */ | ||
203 | #define SET_BIT(REG, BIT) ((REG) |= (BIT)) | ||
204 | |||
205 | #define CLEAR_BIT(REG, BIT) ((REG) &= ~(BIT)) | ||
206 | |||
207 | #define READ_BIT(REG, BIT) ((REG) & (BIT)) | ||
208 | |||
209 | #define CLEAR_REG(REG) ((REG) = (0x0)) | ||
210 | |||
211 | #define WRITE_REG(REG, VAL) ((REG) = (VAL)) | ||
212 | |||
213 | #define READ_REG(REG) ((REG)) | ||
214 | |||
215 | #define MODIFY_REG(REG, CLEARMASK, SETMASK) WRITE_REG((REG), (((READ_REG(REG)) & (~(CLEARMASK))) | (SETMASK))) | ||
216 | |||
217 | /** | ||
218 | * @} | ||
219 | */ | ||
220 | |||
221 | #if defined (USE_HAL_DRIVER) | ||
222 | #include "stm32l0xx_hal.h" | ||
223 | #endif /* USE_HAL_DRIVER */ | ||
224 | |||
225 | #ifdef __cplusplus | ||
226 | } | ||
227 | #endif /* __cplusplus */ | ||
228 | |||
229 | #endif /* __STM32L0xx_H */ | ||
230 | /** | ||
231 | * @} | ||
232 | */ | ||
233 | |||
234 | /** | ||
235 | * @} | ||
236 | */ | ||
237 | |||
238 | |||
239 | |||
240 | |||
241 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ | ||