My Project
Loading...
Searching...
No Matches
stm32f3xx.h
Go to the documentation of this file.
1
37#ifndef __STM32F3xx_H
38#define __STM32F3xx_H
39
40#ifdef __cplusplus
41 extern "C" {
42#endif /* __cplusplus */
43
51#if !defined (STM32F3)
52#define STM32F3
53#endif /* STM32F3 */
54
55/* Uncomment the line below according to the target STM32 device used in your
56 application
57 */
58
59#if !defined (STM32F301x8) && !defined (STM32F302x8) && !defined (STM32F318xx) && \
60 !defined (STM32F302xC) && !defined (STM32F303xC) && !defined (STM32F358xx) && \
61 !defined (STM32F303x8) && !defined (STM32F334x8) && !defined (STM32F328xx) && \
62 !defined (STM32F302xE) && !defined (STM32F303xE) && !defined (STM32F398xx) && \
63 !defined (STM32F373xC) && !defined (STM32F378xx)
64
65 /* #define STM32F301x8 */
67 /* #define STM32F302x8 */
69 /* #define STM32F302xC */
71 /* #define STM32F302xE */
73 /* #define STM32F303x8 */
75 /* #define STM32F303xC */
77 /* #define STM32F303xE */
79 /* #define STM32F373xC */
82 /* #define STM32F334x8 */
85 /* #define STM32F318xx */
86 /* #define STM32F328xx */
87 /* #define STM32F358xx */
88 /* #define STM32F378xx */
89 /* #define STM32F398xx */
90#endif
91
92/* Tip: To avoid modifying this file each time you need to switch between these
93 devices, you can define the device in your toolchain compiler preprocessor.
94 */
95#if !defined (USE_HAL_DRIVER)
101 /*#define USE_HAL_DRIVER */
102#endif /* USE_HAL_DRIVER */
103
107#define __STM32F3_CMSIS_VERSION_MAIN (0x02)
108#define __STM32F3_CMSIS_VERSION_SUB1 (0x03)
109#define __STM32F3_CMSIS_VERSION_SUB2 (0x07)
110#define __STM32F3_CMSIS_VERSION_RC (0x00)
111#define __STM32F3_CMSIS_VERSION ((__STM32F3_CMSIS_VERSION_MAIN << 24)\
112 |(__STM32F3_CMSIS_VERSION_SUB1 << 16)\
113 |(__STM32F3_CMSIS_VERSION_SUB2 << 8 )\
114 |(__STM32F3_CMSIS_VERSION_RC))
115
124#if defined(STM32F301x8)
125 #include "stm32f301x8.h"
126#elif defined(STM32F302x8)
127 #include "stm32f302x8.h"
128#elif defined(STM32F302xC)
129 #include "stm32f302xc.h"
130#elif defined(STM32F302xE)
131 #include "stm32f302xe.h"
132#elif defined(STM32F303x8)
133 #include "stm32f303x8.h"
134#elif defined(STM32F303xC)
135 #include "stm32f303xc.h"
136#elif defined(STM32F303xE)
137 #include "stm32f303xe.h"
138#elif defined(STM32F373xC)
139 #include "stm32f373xc.h"
140#elif defined(STM32F334x8)
141 #include "stm32f334x8.h"
142#elif defined(STM32F318xx)
143 #include "stm32f318xx.h"
144#elif defined(STM32F328xx)
145 #include "stm32f328xx.h"
146#elif defined(STM32F358xx)
147 #include "stm32f358xx.h"
148#elif defined(STM32F378xx)
149 #include "stm32f378xx.h"
150#elif defined(STM32F398xx)
151 #include "stm32f398xx.h"
152#else
153 #error "Please select first the target STM32F3xx device used in your application (in stm32f3xx.h file)"
154#endif
155
163typedef enum
164{
165 RESET = 0U,
166 SET = !RESET
168
169typedef enum
170{
171 DISABLE = 0U,
172 ENABLE = !DISABLE
174#define IS_FUNCTIONAL_STATE(STATE) (((STATE) == DISABLE) || ((STATE) == ENABLE))
175
176typedef enum
177{
179 ERROR = !SUCCESS
181
190#define SET_BIT(REG, BIT) ((REG) |= (BIT))
191
192#define CLEAR_BIT(REG, BIT) ((REG) &= ~(BIT))
193
194#define READ_BIT(REG, BIT) ((REG) & (BIT))
195
196#define CLEAR_REG(REG) ((REG) = (0x0))
197
198#define WRITE_REG(REG, VAL) ((REG) = (VAL))
199
200#define READ_REG(REG) ((REG))
201
202#define MODIFY_REG(REG, CLEARMASK, SETMASK) WRITE_REG((REG), (((READ_REG(REG)) & (~(CLEARMASK))) | (SETMASK)))
203
204#define POSITION_VAL(VAL) (__CLZ(__RBIT(VAL)))
205
206/* Use of CMSIS compiler intrinsics for register exclusive access */
207/* Atomic 32-bit register access macro to set one or several bits */
208#define ATOMIC_SET_BIT(REG, BIT) \
209 do { \
210 uint32_t val; \
211 do { \
212 val = __LDREXW((__IO uint32_t *)&(REG)) | (BIT); \
213 } while ((__STREXW(val,(__IO uint32_t *)&(REG))) != 0U); \
214 } while(0)
215
216/* Atomic 32-bit register access macro to clear one or several bits */
217#define ATOMIC_CLEAR_BIT(REG, BIT) \
218 do { \
219 uint32_t val; \
220 do { \
221 val = __LDREXW((__IO uint32_t *)&(REG)) & ~(BIT); \
222 } while ((__STREXW(val,(__IO uint32_t *)&(REG))) != 0U); \
223 } while(0)
224
225/* Atomic 32-bit register access macro to clear and set one or several bits */
226#define ATOMIC_MODIFY_REG(REG, CLEARMSK, SETMASK) \
227 do { \
228 uint32_t val; \
229 do { \
230 val = (__LDREXW((__IO uint32_t *)&(REG)) & ~(CLEARMSK)) | (SETMASK); \
231 } while ((__STREXW(val,(__IO uint32_t *)&(REG))) != 0U); \
232 } while(0)
233
234/* Atomic 16-bit register access macro to set one or several bits */
235#define ATOMIC_SETH_BIT(REG, BIT) \
236 do { \
237 uint16_t val; \
238 do { \
239 val = __LDREXH((__IO uint16_t *)&(REG)) | (BIT); \
240 } while ((__STREXH(val,(__IO uint16_t *)&(REG))) != 0U); \
241 } while(0)
242
243/* Atomic 16-bit register access macro to clear one or several bits */
244#define ATOMIC_CLEARH_BIT(REG, BIT) \
245 do { \
246 uint16_t val; \
247 do { \
248 val = __LDREXH((__IO uint16_t *)&(REG)) & ~(BIT); \
249 } while ((__STREXH(val,(__IO uint16_t *)&(REG))) != 0U); \
250 } while(0)
251
252/* Atomic 16-bit register access macro to clear and set one or several bits */
253#define ATOMIC_MODIFYH_REG(REG, CLEARMSK, SETMASK) \
254 do { \
255 uint16_t val; \
256 do { \
257 val = (__LDREXH((__IO uint16_t *)&(REG)) & ~(CLEARMSK)) | (SETMASK); \
258 } while ((__STREXH(val,(__IO uint16_t *)&(REG))) != 0U); \
259 } while(0)
260
265#if defined (USE_HAL_DRIVER)
266 #include "stm32f3xx_hal.h"
267#endif /* USE_HAL_DRIVER */
268
269#ifdef __cplusplus
270}
271#endif /* __cplusplus */
272
273#endif /* __STM32F3xx_H */
enum FlagStatus ITStatus
ErrorStatus
Definition: stm32f3xx.h:177
FlagStatus
Definition: stm32f3xx.h:164
FunctionalState
Definition: stm32f3xx.h:170
@ ERROR
Definition: stm32f3xx.h:179
@ SUCCESS
Definition: stm32f3xx.h:178
@ RESET
Definition: stm32f3xx.h:165
@ SET
Definition: stm32f3xx.h:166
@ ENABLE
Definition: stm32f3xx.h:172
@ DISABLE
Definition: stm32f3xx.h:171
CMSIS STM32F303xE Devices Peripheral Access Layer Header File.
This file contains all the functions prototypes for the HAL module driver.