]> git.gir.st - tmk_keyboard.git/blob - tool/mbed/mbed-sdk/libraries/mbed/targets/cmsis/TARGET_STM/TARGET_STM32L1/TARGET_NUCLEO_L152RE/stm32l1xx.h
Squashed 'tmk_core/' changes from 7967731..b9e0ea0
[tmk_keyboard.git] / tool / mbed / mbed-sdk / libraries / mbed / targets / cmsis / TARGET_STM / TARGET_STM32L1 / TARGET_NUCLEO_L152RE / stm32l1xx.h
1 /**
2 ******************************************************************************
3 * @file stm32l1xx.h
4 * @author MCD Application Team
5 * @version V2.0.0
6 * @date 5-September-2014
7 * @brief CMSIS STM32L1xx Device Peripheral Access Layer Header File.
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 STM32L1xx device used in the target application
13 * - To use or not the peripheral\92s drivers in application code(i.e.
14 * code will be based on direct access to peripheral\92s registers
15 * rather than drivers API), this option is controlled by
16 * "#define USE_HAL_DRIVER"
17 *
18 ******************************************************************************
19 * @attention
20 *
21 * <h2><center>&copy; COPYRIGHT(c) 2014 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 stm32l1xx
53 * @{
54 */
55
56 #ifndef __STM32L1XX_H
57 #define __STM32L1XX_H
58
59 #ifdef __cplusplus
60 extern "C" {
61 #endif /* __cplusplus */
62
63 /** @addtogroup Library_configuration_section
64 * @{
65 */
66
67 /* Uncomment the line below according to the target STM32L device used in your
68 application
69 */
70
71 #if !defined (STM32L100xB) && !defined (STM32L100xBA) && !defined (STM32L100xC) && \
72 !defined (STM32L151xB) && !defined (STM32L151xBA) && !defined (STM32L151xC) && !defined (STM32L151xCA) && !defined (STM32L151xD) && !defined (STM32L151xE) && \
73 !defined (STM32L152xB) && !defined (STM32L152xBA) && !defined (STM32L152xC) && !defined (STM32L152xCA) && !defined (STM32L152xD) && !defined (STM32L152xE) && \
74 !defined (STM32L162xC) && !defined (STM32L162xCA) && !defined (STM32L162xD) && !defined (STM32L162xE)
75 /* #define STM32L100xB */ /*!< STM32L100C6, STM32L100R and STM32L100RB Devices */
76 /* #define STM32L100xBA */ /*!< STM32L100C6-A, STM32L100R8-A and STM32L100RB-A Devices */
77 /* #define STM32L100xC */ /*!< STM32L100RC Devices */
78 /* #define STM32L151xB */ /*!< STM32L151C6, STM32L151R6, STM32L151C8, STM32L151R8, STM32L151V8, STM32L151CB, STM32L151RB and STM32L151VB */
79 /* #define STM32L151xBA */ /*!< STM32L151C6-A, STM32L151R6-A, STM32L151C8-A, STM32L151R8-A, STM32L151V8-A, STM32L151CB-A, STM32L151RB-A and STM32L151VB-A */
80 /* #define STM32L151xC */ /*!< STM32L151CC, STM32L151UC, STM32L151RC and STM32L151VC */
81 /* #define STM32L151xCA */ /*!< STM32L151RC-A, STM32L151VC-A, STM32L151QC and STM32L151ZC */
82 /* #define STM32L151xD */ /*!< STM32L151QD, STM32L151RD, STM32L151VD & STM32L151ZD */
83 /* #define STM32L151xE */ /*!< STM32L151QE, STM32L151RE, STM32L151VE and STM32L151ZE */
84 /* #define STM32L152xB */ /*!< STM32L152C6, STM32L152R6, STM32L152C8, STM32L152R8, STM32L152V8, STM32L152CB, STM32L152RB and STM32L152VB */
85 /* #define STM32L152xBA */ /*!< STM32L152C6-A, STM32L152R6-A, STM32L152C8-A, STM32L152R8-A, STM32L152V8-A, STM32L152CB-A, STM32L152RB-A and STM32L152VB-A */
86 /* #define STM32L152xC */ /*!< STM32L152CC, STM32L152UC, STM32L152RC and STM32L152VC */
87 /* #define STM32L152xCA */ /*!< STM32L152RC-A, STM32L152VC-A, STM32L152QC and STM32L152ZC */
88 /* #define STM32L152xD */ /*!< STM32L152QD, STM32L152RD, STM32L152VD and STM32L152ZD */
89 #define STM32L152xE /*!< STM32L152QE, STM32L152RE, STM32L152VE and STM32L152ZE */
90 /* #define STM32L162xC */ /*!< STM32L162RC and STM32L162VC */
91 /* #define STM32L162xCA */ /*!< STM32L162RC-A, STM32L162VC-A, STM32L162QC and STM32L162ZC */
92 /* #define STM32L162xD */ /*!< STM32L162QD, STM32L162RD, STM32L162VD and STM32L162ZD */
93 /* #define STM32L162xE */ /*!< STM32L162RE, STM32L162VE and STM32L162ZE */
94 #endif
95
96 /* Tip: To avoid modifying this file each time you need to switch between these
97 devices, you can define the device in your toolchain compiler preprocessor.
98 */
99
100 #if !defined (USE_HAL_DRIVER)
101 /**
102 * @brief Comment the line below if you will not use the peripherals drivers.
103 In this case, these drivers will not be included and the application code will
104 be based on direct access to peripherals registers
105 */
106 #define USE_HAL_DRIVER
107 #endif /* USE_HAL_DRIVER */
108
109 /**
110 * @brief CMSIS Device version number V2.0.0
111 */
112 #define __STM32L1xx_CMSIS_DEVICE_VERSION_MAIN (0x02) /*!< [31:24] main version */
113 #define __STM32L1xx_CMSIS_DEVICE_VERSION_SUB1 (0x00) /*!< [23:16] sub1 version */
114 #define __STM32L1xx_CMSIS_DEVICE_VERSION_SUB2 (0x00) /*!< [15:8] sub2 version */
115 #define __STM32L1xx_CMSIS_DEVICE_VERSION_RC (0x00) /*!< [7:0] release candidate */
116 #define __STM32L1xx_CMSIS_DEVICE_VERSION ((__CMSIS_DEVICE_VERSION_MAIN << 24)\
117 |(__CMSIS_DEVICE_HAL_VERSION_SUB1 << 16)\
118 |(__CMSIS_DEVICE_HAL_VERSION_SUB2 << 8 )\
119 |(__CMSIS_DEVICE_HAL_VERSION_RC))
120
121 /**
122 * @}
123 */
124
125 /** @addtogroup Device_Included
126 * @{
127 */
128
129 #if defined(STM32L100xB)
130 #include "stm32l100xb.h"
131 #elif defined(STM32L100xBA)
132 #include "stm32l100xba.h"
133 #elif defined(STM32L100xC)
134 #include "stm32l100xc.h"
135 #elif defined(STM32L151xB)
136 #include "stm32l151xb.h"
137 #elif defined(STM32L151xBA)
138 #include "stm32l151xba.h"
139 #elif defined(STM32L151xC)
140 #include "stm32l151xc.h"
141 #elif defined(STM32L151xCA)
142 #include "stm32l151xca.h"
143 #elif defined(STM32L151xD)
144 #include "stm32l151xd.h"
145 #elif defined(STM32L151xE)
146 #include "stm32l151xe.h"
147 #elif defined(STM32L152xB)
148 #include "stm32l152xb.h"
149 #elif defined(STM32L152xBA)
150 #include "stm32l152xba.h"
151 #elif defined(STM32L152xC)
152 #include "stm32l152xc.h"
153 #elif defined(STM32L152xCA)
154 #include "stm32l152xca.h"
155 #elif defined(STM32L152xD)
156 #include "stm32l152xd.h"
157 #elif defined(STM32L152xE)
158 #include "stm32l152xe.h"
159 #elif defined(STM32L162xC)
160 #include "stm32l162xc.h"
161 #elif defined(STM32L162xCA)
162 #include "stm32l162xca.h"
163 #elif defined(STM32L162xD)
164 #include "stm32l162xd.h"
165 #elif defined(STM32L162xE)
166 #include "stm32l162xe.h"
167 #else
168 #error "Please select first the target STM32L1xx device used in your application (in stm32l1xx.h file)"
169 #endif
170
171 /**
172 * @}
173 */
174
175 /** @addtogroup Exported_types
176 * @{
177 */
178 typedef enum
179 {
180 RESET = 0,
181 SET = !RESET
182 } FlagStatus, ITStatus;
183
184 typedef enum
185 {
186 DISABLE = 0,
187 ENABLE = !DISABLE
188 } FunctionalState;
189 #define IS_FUNCTIONAL_STATE(STATE) (((STATE) == DISABLE) || ((STATE) == ENABLE))
190
191 typedef enum
192 {
193 ERROR = 0,
194 SUCCESS = !ERROR
195 } ErrorStatus;
196
197 /**
198 * @}
199 */
200
201
202 /** @addtogroup Exported_macros
203 * @{
204 */
205 #define SET_BIT(REG, BIT) ((REG) |= (BIT))
206
207 #define CLEAR_BIT(REG, BIT) ((REG) &= ~(BIT))
208
209 #define READ_BIT(REG, BIT) ((REG) & (BIT))
210
211 #define CLEAR_REG(REG) ((REG) = (0x0))
212
213 #define WRITE_REG(REG, VAL) ((REG) = (VAL))
214
215 #define READ_REG(REG) ((REG))
216
217 #define MODIFY_REG(REG, CLEARMASK, SETMASK) WRITE_REG((REG), (((READ_REG(REG)) & (~(CLEARMASK))) | (SETMASK)))
218
219 #define POSITION_VAL(VAL) (__CLZ(__RBIT(VAL)))
220
221
222 /**
223 * @}
224 */
225
226 #if defined (USE_HAL_DRIVER)
227 #include "stm32l1xx_hal.h"
228 #endif /* USE_HAL_DRIVER */
229
230
231 #ifdef __cplusplus
232 }
233 #endif /* __cplusplus */
234
235 #endif /* __STM32L1xx_H */
236 /**
237 * @}
238 */
239
240 /**
241 * @}
242 */
243
244
245
246
247 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
Imprint / Impressum