]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/CORTEX_MPU_STM32L4_Discovery_GCC_IAR_Keil/ST_Code/Drivers/CMSIS/Device/ST/STM32L4xx/Include/stm32l4xx.h
Rename STM32Cube to GCC for STM32L4 Discovery projects as GCC is
[freertos] / FreeRTOS / Demo / CORTEX_MPU_STM32L4_Discovery_GCC_IAR_Keil / ST_Code / Drivers / CMSIS / Device / ST / STM32L4xx / Include / stm32l4xx.h
1 /**\r
2   ******************************************************************************\r
3   * @file    stm32l4xx.h\r
4   * @author  MCD Application Team\r
5   * @brief   CMSIS STM32L4xx Device Peripheral Access Layer Header File.\r
6   *\r
7   *          The file is the unique include file that the application programmer\r
8   *          is using in the C source code, usually in main.c. This file contains:\r
9   *           - Configuration section that allows to select:\r
10   *              - The STM32L4xx device used in the target application\r
11   *              - To use or not the peripheral\92s drivers in application code(i.e.\r
12   *                code will be based on direct access to peripheral\92s registers\r
13   *                rather than drivers API), this option is controlled by\r
14   *                "#define USE_HAL_DRIVER"\r
15   *\r
16   ******************************************************************************\r
17   * @attention\r
18   *\r
19   * <h2><center>&copy; Copyright (c) 2017 STMicroelectronics.\r
20   * All rights reserved.</center></h2>\r
21   *\r
22   * This software component is licensed by ST under BSD 3-Clause license,\r
23   * the "License"; You may not use this file except in compliance with the\r
24   * License. You may obtain a copy of the License at:\r
25   *                        opensource.org/licenses/BSD-3-Clause\r
26   *\r
27   ******************************************************************************\r
28   */\r
29 \r
30 /** @addtogroup CMSIS\r
31   * @{\r
32   */\r
33 \r
34 /** @addtogroup stm32l4xx\r
35   * @{\r
36   */\r
37 \r
38 #ifndef __STM32L4xx_H\r
39 #define __STM32L4xx_H\r
40 \r
41 #ifdef __cplusplus\r
42  extern "C" {\r
43 #endif /* __cplusplus */\r
44 \r
45 /** @addtogroup Library_configuration_section\r
46   * @{\r
47   */\r
48 \r
49 /**\r
50   * @brief STM32 Family\r
51   */\r
52 #if !defined (STM32L4)\r
53 #define STM32L4\r
54 #endif /* STM32L4 */\r
55 \r
56 /* Uncomment the line below according to the target STM32L4 device used in your\r
57    application\r
58   */\r
59 \r
60 #if !defined (STM32L412xx) && !defined (STM32L422xx) && \\r
61     !defined (STM32L431xx) && !defined (STM32L432xx) && !defined (STM32L433xx) && !defined (STM32L442xx) && !defined (STM32L443xx) && \\r
62     !defined (STM32L451xx) && !defined (STM32L452xx) && !defined (STM32L462xx) && \\r
63     !defined (STM32L471xx) && !defined (STM32L475xx) && !defined (STM32L476xx) && !defined (STM32L485xx) && !defined (STM32L486xx) && \\r
64     !defined (STM32L496xx) && !defined (STM32L4A6xx) && \\r
65     !defined (STM32L4R5xx) && !defined (STM32L4R7xx) && !defined (STM32L4R9xx) && !defined (STM32L4S5xx) && !defined (STM32L4S7xx) && !defined (STM32L4S9xx)\r
66   /* #define STM32L412xx */   /*!< STM32L412xx Devices */\r
67   /* #define STM32L422xx */   /*!< STM32L422xx Devices */\r
68   /* #define STM32L431xx */   /*!< STM32L431xx Devices */\r
69   /* #define STM32L432xx */   /*!< STM32L432xx Devices */\r
70   /* #define STM32L433xx */   /*!< STM32L433xx Devices */\r
71   /* #define STM32L442xx */   /*!< STM32L442xx Devices */\r
72   /* #define STM32L443xx */   /*!< STM32L443xx Devices */\r
73   /* #define STM32L451xx */   /*!< STM32L451xx Devices */\r
74   /* #define STM32L452xx */   /*!< STM32L452xx Devices */\r
75   /* #define STM32L462xx */   /*!< STM32L462xx Devices */\r
76   /* #define STM32L471xx */   /*!< STM32L471xx Devices */\r
77   /* #define STM32L475xx */   /*!< STM32L475xx Devices */\r
78   /* #define STM32L476xx */   /*!< STM32L476xx Devices */\r
79   /* #define STM32L485xx */   /*!< STM32L485xx Devices */\r
80   /* #define STM32L486xx */   /*!< STM32L486xx Devices */\r
81   /* #define STM32L496xx */   /*!< STM32L496xx Devices */\r
82   /* #define STM32L4A6xx */   /*!< STM32L4A6xx Devices */\r
83   /* #define STM32L4R5xx */   /*!< STM32L4R5xx Devices */\r
84   /* #define STM32L4R7xx */   /*!< STM32L4R7xx Devices */\r
85   /* #define STM32L4R9xx */   /*!< STM32L4R9xx Devices */\r
86   /* #define STM32L4S5xx */   /*!< STM32L4S5xx Devices */\r
87   /* #define STM32L4S7xx */   /*!< STM32L4S7xx Devices */\r
88   /* #define STM32L4S9xx */   /*!< STM32L4S9xx Devices */\r
89 #endif\r
90 \r
91 /*  Tip: To avoid modifying this file each time you need to switch between these\r
92         devices, you can define the device in your toolchain compiler preprocessor.\r
93   */\r
94 #if !defined  (USE_HAL_DRIVER)\r
95 /**\r
96  * @brief Comment the line below if you will not use the peripherals drivers.\r
97    In this case, these drivers will not be included and the application code will\r
98    be based on direct access to peripherals registers\r
99    */\r
100   /*#define USE_HAL_DRIVER */\r
101 #endif /* USE_HAL_DRIVER */\r
102 \r
103 /**\r
104   * @brief CMSIS Device version number\r
105   */\r
106 #define __STM32L4_CMSIS_VERSION_MAIN   (0x01) /*!< [31:24] main version */\r
107 #define __STM32L4_CMSIS_VERSION_SUB1   (0x05) /*!< [23:16] sub1 version */\r
108 #define __STM32L4_CMSIS_VERSION_SUB2   (0x01) /*!< [15:8]  sub2 version */\r
109 #define __STM32L4_CMSIS_VERSION_RC     (0x00) /*!< [7:0]  release candidate */\r
110 #define __STM32L4_CMSIS_VERSION        ((__STM32L4_CMSIS_VERSION_MAIN << 24)\\r
111                                        |(__STM32L4_CMSIS_VERSION_SUB1 << 16)\\r
112                                        |(__STM32L4_CMSIS_VERSION_SUB2 << 8 )\\r
113                                        |(__STM32L4_CMSIS_VERSION_RC))\r
114 \r
115 /**\r
116   * @}\r
117   */\r
118 \r
119 /** @addtogroup Device_Included\r
120   * @{\r
121   */\r
122 \r
123 #if defined(STM32L412xx)\r
124   #include "stm32l412xx.h"\r
125 #elif defined(STM32L422xx)\r
126   #include "stm32l422xx.h"\r
127 #elif defined(STM32L431xx)\r
128   #include "stm32l431xx.h"\r
129 #elif defined(STM32L432xx)\r
130   #include "stm32l432xx.h"\r
131 #elif defined(STM32L433xx)\r
132   #include "stm32l433xx.h"\r
133 #elif defined(STM32L442xx)\r
134   #include "stm32l442xx.h"\r
135 #elif defined(STM32L443xx)\r
136   #include "stm32l443xx.h"\r
137 #elif defined(STM32L451xx)\r
138   #include "stm32l451xx.h"\r
139 #elif defined(STM32L452xx)\r
140   #include "stm32l452xx.h"\r
141 #elif defined(STM32L462xx)\r
142   #include "stm32l462xx.h"\r
143 #elif defined(STM32L471xx)\r
144   #include "stm32l471xx.h"\r
145 #elif defined(STM32L475xx)\r
146   #include "stm32l475xx.h"\r
147 #elif defined(STM32L476xx)\r
148   #include "stm32l476xx.h"\r
149 #elif defined(STM32L485xx)\r
150   #include "stm32l485xx.h"\r
151 #elif defined(STM32L486xx)\r
152   #include "stm32l486xx.h"\r
153 #elif defined(STM32L496xx)\r
154   #include "stm32l496xx.h"\r
155 #elif defined(STM32L4A6xx)\r
156   #include "stm32l4a6xx.h"\r
157 #elif defined(STM32L4R5xx)\r
158   #include "stm32l4r5xx.h"\r
159 #elif defined(STM32L4R7xx)\r
160   #include "stm32l4r7xx.h"\r
161 #elif defined(STM32L4R9xx)\r
162   #include "stm32l4r9xx.h"\r
163 #elif defined(STM32L4S5xx)\r
164   #include "stm32l4s5xx.h"\r
165 #elif defined(STM32L4S7xx)\r
166   #include "stm32l4s7xx.h"\r
167 #elif defined(STM32L4S9xx)\r
168   #include "stm32l4s9xx.h"\r
169 #else\r
170  #error "Please select first the target STM32L4xx device used in your application (in stm32l4xx.h file)"\r
171 #endif\r
172 \r
173 /**\r
174   * @}\r
175   */\r
176 \r
177 /** @addtogroup Exported_types\r
178   * @{\r
179   */\r
180 typedef enum\r
181 {\r
182   RESET = 0,\r
183   SET = !RESET\r
184 } FlagStatus, ITStatus;\r
185 \r
186 typedef enum\r
187 {\r
188   DISABLE = 0,\r
189   ENABLE = !DISABLE\r
190 } FunctionalState;\r
191 #define IS_FUNCTIONAL_STATE(STATE) (((STATE) == DISABLE) || ((STATE) == ENABLE))\r
192 \r
193 typedef enum\r
194 {\r
195   SUCCESS = 0,\r
196   ERROR = !SUCCESS\r
197 } ErrorStatus;\r
198 \r
199 /**\r
200   * @}\r
201   */\r
202 \r
203 \r
204 /** @addtogroup Exported_macros\r
205   * @{\r
206   */\r
207 #define SET_BIT(REG, BIT)     ((REG) |= (BIT))\r
208 \r
209 #define CLEAR_BIT(REG, BIT)   ((REG) &= ~(BIT))\r
210 \r
211 #define READ_BIT(REG, BIT)    ((REG) & (BIT))\r
212 \r
213 #define CLEAR_REG(REG)        ((REG) = (0x0))\r
214 \r
215 #define WRITE_REG(REG, VAL)   ((REG) = (VAL))\r
216 \r
217 #define READ_REG(REG)         ((REG))\r
218 \r
219 #define MODIFY_REG(REG, CLEARMASK, SETMASK)  WRITE_REG((REG), (((READ_REG(REG)) & (~(CLEARMASK))) | (SETMASK)))\r
220 \r
221 #define POSITION_VAL(VAL)     (__CLZ(__RBIT(VAL)))\r
222 \r
223 \r
224 /**\r
225   * @}\r
226   */\r
227 \r
228 #if defined (USE_HAL_DRIVER)\r
229  #include "stm32l4xx_hal.h"\r
230 #endif /* USE_HAL_DRIVER */\r
231 \r
232 #ifdef __cplusplus\r
233 }\r
234 #endif /* __cplusplus */\r
235 \r
236 #endif /* __STM32L4xx_H */\r
237 /**\r
238   * @}\r
239   */\r
240 \r
241 /**\r
242   * @}\r
243   */\r
244 \r
245 \r
246 \r
247 \r
248 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/\r