Mercurial > pub > halpp
comparison l476rg-hal-test/Drivers/CMSIS/Device/ST/STM32L4xx/Include/stm32l4xx.h @ 0:32a3b1785697
a rough draft of Hardware Abstraction Layer for C++
STM32L476RG drivers
author | cin |
---|---|
date | Thu, 12 Jan 2017 02:45:43 +0300 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:32a3b1785697 |
---|---|
1 /** | |
2 ****************************************************************************** | |
3 * @file stm32l4xx.h | |
4 * @author MCD Application Team | |
5 * @version V1.2.0RC2 | |
6 * @date 29-July-2016 | |
7 * @brief CMSIS STM32L4xx 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 STM32L4xx 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 stm32l4xx | |
53 * @{ | |
54 */ | |
55 | |
56 #ifndef __STM32L4xx_H | |
57 #define __STM32L4xx_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 (STM32L4) | |
71 #define STM32L4 | |
72 #endif /* STM32L4 */ | |
73 | |
74 /* Uncomment the line below according to the target STM32L4 device used in your | |
75 application | |
76 */ | |
77 | |
78 #if !defined (STM32L431xx) && !defined (STM32L432xx) && !defined (STM32L433xx) && !defined (STM32L442xx) && !defined (STM32L443xx) && \ | |
79 !defined (STM32L451xx) && !defined (STM32L452xx) && !defined (STM32L462xx) && \ | |
80 !defined (STM32L471xx) && !defined (STM32L475xx) && !defined (STM32L476xx) && !defined (STM32L485xx) && !defined (STM32L486xx) && \ | |
81 !defined (STM32L496xx) && !defined (STM32L4A6xx) | |
82 /* #define STM32L431xx */ /*!< STM32L431xx Devices */ | |
83 /* #define STM32L432xx */ /*!< STM32L432xx Devices */ | |
84 /* #define STM32L433xx */ /*!< STM32L433xx Devices */ | |
85 /* #define STM32L442xx */ /*!< STM32L442xx Devices */ | |
86 /* #define STM32L443xx */ /*!< STM32L443xx Devices */ | |
87 /* #define STM32L451xx */ /*!< STM32L451xx Devices */ | |
88 /* #define STM32L452xx */ /*!< STM32L452xx Devices */ | |
89 /* #define STM32L462xx */ /*!< STM32L462xx Devices */ | |
90 /* #define STM32L471xx */ /*!< STM32L471xx Devices */ | |
91 /* #define STM32L475xx */ /*!< STM32L475xx Devices */ | |
92 /* #define STM32L476xx */ /*!< STM32L476xx Devices */ | |
93 /* #define STM32L485xx */ /*!< STM32L485xx Devices */ | |
94 /* #define STM32L486xx */ /*!< STM32L486xx Devices */ | |
95 /* #define STM32L496xx */ /*!< STM32L496xx Devices */ | |
96 /* #define STM32L4A6xx */ /*!< STM32L4A6xx Devices */ | |
97 #endif | |
98 | |
99 /* Tip: To avoid modifying this file each time you need to switch between these | |
100 devices, you can define the device in your toolchain compiler preprocessor. | |
101 */ | |
102 #if !defined (USE_HAL_DRIVER) | |
103 /** | |
104 * @brief Comment the line below if you will not use the peripherals drivers. | |
105 In this case, these drivers will not be included and the application code will | |
106 be based on direct access to peripherals registers | |
107 */ | |
108 /*#define USE_HAL_DRIVER */ | |
109 #endif /* USE_HAL_DRIVER */ | |
110 | |
111 /** | |
112 * @brief CMSIS Device version number V1.2.0RC2 | |
113 */ | |
114 #define __STM32L4_CMSIS_VERSION_MAIN (0x01) /*!< [31:24] main version */ | |
115 #define __STM32L4_CMSIS_VERSION_SUB1 (0x02) /*!< [23:16] sub1 version */ | |
116 #define __STM32L4_CMSIS_VERSION_SUB2 (0x00) /*!< [15:8] sub2 version */ | |
117 #define __STM32L4_CMSIS_VERSION_RC (0x02) /*!< [7:0] release candidate */ | |
118 #define __STM32L4_CMSIS_VERSION ((__STM32L4_CMSIS_VERSION_MAIN << 24)\ | |
119 |(__STM32L4_CMSIS_VERSION_SUB1 << 16)\ | |
120 |(__STM32L4_CMSIS_VERSION_SUB2 << 8 )\ | |
121 |(__STM32L4_CMSIS_VERSION_RC)) | |
122 | |
123 /** | |
124 * @} | |
125 */ | |
126 | |
127 /** @addtogroup Device_Included | |
128 * @{ | |
129 */ | |
130 | |
131 #if defined(STM32L431xx) | |
132 #include "stm32l431xx.h" | |
133 #elif defined(STM32L432xx) | |
134 #include "stm32l432xx.h" | |
135 #elif defined(STM32L433xx) | |
136 #include "stm32l433xx.h" | |
137 #elif defined(STM32L442xx) | |
138 #include "stm32l442xx.h" | |
139 #elif defined(STM32L443xx) | |
140 #include "stm32l443xx.h" | |
141 #elif defined(STM32L451xx) | |
142 #include "stm32l451xx.h" | |
143 #elif defined(STM32L452xx) | |
144 #include "stm32l452xx.h" | |
145 #elif defined(STM32L462xx) | |
146 #include "stm32l462xx.h" | |
147 #elif defined(STM32L471xx) | |
148 #include "stm32l471xx.h" | |
149 #elif defined(STM32L475xx) | |
150 #include "stm32l475xx.h" | |
151 #elif defined(STM32L476xx) | |
152 #include "stm32l476xx.h" | |
153 #elif defined(STM32L485xx) | |
154 #include "stm32l485xx.h" | |
155 #elif defined(STM32L486xx) | |
156 #include "stm32l486xx.h" | |
157 #else | |
158 #error "Please select first the target STM32L4xx device used in your application (in stm32l4xx.h file)" | |
159 #endif | |
160 | |
161 /** | |
162 * @} | |
163 */ | |
164 | |
165 /** @addtogroup Exported_types | |
166 * @{ | |
167 */ | |
168 typedef enum | |
169 { | |
170 RESET = 0, | |
171 SET = !RESET | |
172 } FlagStatus, ITStatus; | |
173 | |
174 typedef enum | |
175 { | |
176 DISABLE = 0, | |
177 ENABLE = !DISABLE | |
178 } FunctionalState; | |
179 #define IS_FUNCTIONAL_STATE(STATE) (((STATE) == DISABLE) || ((STATE) == ENABLE)) | |
180 | |
181 typedef enum | |
182 { | |
183 ERROR = 0, | |
184 SUCCESS = !ERROR | |
185 } ErrorStatus; | |
186 | |
187 /** | |
188 * @} | |
189 */ | |
190 | |
191 | |
192 /** @addtogroup Exported_macros | |
193 * @{ | |
194 */ | |
195 #define SET_BIT(REG, BIT) ((REG) |= (BIT)) | |
196 | |
197 #define CLEAR_BIT(REG, BIT) ((REG) &= ~(BIT)) | |
198 | |
199 #define READ_BIT(REG, BIT) ((REG) & (BIT)) | |
200 | |
201 #define CLEAR_REG(REG) ((REG) = (0x0)) | |
202 | |
203 #define WRITE_REG(REG, VAL) ((REG) = (VAL)) | |
204 | |
205 #define READ_REG(REG) ((REG)) | |
206 | |
207 #define MODIFY_REG(REG, CLEARMASK, SETMASK) WRITE_REG((REG), (((READ_REG(REG)) & (~(CLEARMASK))) | (SETMASK))) | |
208 | |
209 #define POSITION_VAL(VAL) (__CLZ(__RBIT(VAL))) | |
210 | |
211 | |
212 /** | |
213 * @} | |
214 */ | |
215 | |
216 #if defined (USE_HAL_DRIVER) | |
217 #include "stm32l4xx_hal.h" | |
218 #endif /* USE_HAL_DRIVER */ | |
219 | |
220 #ifdef __cplusplus | |
221 } | |
222 #endif /* __cplusplus */ | |
223 | |
224 #endif /* __STM32L4xx_H */ | |
225 /** | |
226 * @} | |
227 */ | |
228 | |
229 /** | |
230 * @} | |
231 */ | |
232 | |
233 | |
234 | |
235 | |
236 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |