source: trunk/firmware/CubeMX/Drivers/CMSIS/Device/ST/STM32G0xx/Include/stm32g0xx.h

Last change on this file was 1, checked in by f.jahn, 3 years ago
File size: 8.1 KB
Line 
1/**
2 ******************************************************************************
3 * @file stm32g0xx.h
4 * @author MCD Application Team
5 * @brief CMSIS STM32G0xx Device Peripheral Access Layer Header File.
6 *
7 * The file is the unique include file that the application programmer
8 * is using in the C source code, usually in main.c. This file contains:
9 * - Configuration section that allows to select:
10 * - The STM32G0xx device used in the target application
11 * - To use or not the peripherals drivers in application code(i.e.
12 * code will be based on direct access to peripherals registers
13 * rather than drivers API), this option is controlled by
14 * "#define USE_HAL_DRIVER"
15 *
16 ******************************************************************************
17 * @attention
18 *
19 * Copyright (c) 2018-2021 STMicroelectronics.
20 * All rights reserved.
21 *
22 * This software is licensed under terms that can be found in the LICENSE file
23 * in the root directory of this software component.
24 * If no LICENSE file comes with this software, it is provided AS-IS.
25 *
26 ******************************************************************************
27 */
28/** @addtogroup CMSIS
29 * @{
30 */
31
32/** @addtogroup stm32g0xx
33 * @{
34 */
35
36#ifndef STM32G0xx_H
37#define STM32G0xx_H
38
39#ifdef __cplusplus
40 extern "C" {
41#endif /* __cplusplus */
42
43/** @addtogroup Library_configuration_section
44 * @{
45 */
46
47/**
48 * @brief STM32 Family
49 */
50#if !defined (STM32G0)
51#define STM32G0
52#endif /* STM32G0 */
53
54/* Uncomment the line below according to the target STM32G0 device used in your
55 application
56 */
57
58#if !defined (STM32G071xx) && !defined (STM32G081xx) && !defined (STM32G070xx) \
59 && !defined (STM32G030xx) && !defined (STM32G031xx) && !defined (STM32G041xx) \
60 && !defined (STM32G0B0xx) && !defined (STM32G0B1xx) && !defined (STM32G0C1xx) \
61 && !defined (STM32G050xx) && !defined (STM32G051xx) && !defined (STM32G061xx)
62 /* #define STM32G0B0xx */ /*!< STM32G0B0xx Devices */
63 /* #define STM32G0B1xx */ /*!< STM32G0B1xx Devices */
64 /* #define STM32G0C1xx */ /*!< STM32G0C1xx Devices */
65 /* #define STM32G070xx */ /*!< STM32G070xx Devices */
66 /* #define STM32G071xx */ /*!< STM32G071xx Devices */
67 /* #define STM32G081xx */ /*!< STM32G081xx Devices */
68 /* #define STM32G050xx */ /*!< STM32G050xx Devices */
69 /* #define STM32G051xx */ /*!< STM32G051xx Devices */
70 /* #define STM32G061xx */ /*!< STM32G061xx Devices */
71 /* #define STM32G030xx */ /*!< STM32G030xx Devices */
72 /* #define STM32G031xx */ /*!< STM32G031xx Devices */
73 /* #define STM32G041xx */ /*!< STM32G041xx Devices */
74#endif
75
76/* Tip: To avoid modifying this file each time you need to switch between these
77 devices, you can define the device in your toolchain compiler preprocessor.
78 */
79#if !defined (USE_HAL_DRIVER)
80/**
81 * @brief Comment the line below if you will not use the peripherals drivers.
82 In this case, these drivers will not be included and the application code will
83 be based on direct access to peripherals registers
84 */
85 /*#define USE_HAL_DRIVER */
86#endif /* USE_HAL_DRIVER */
87
88/**
89 * @brief CMSIS Device version number $VERSION$
90 */
91#define __STM32G0_CMSIS_VERSION_MAIN (0x01U) /*!< [31:24] main version */
92#define __STM32G0_CMSIS_VERSION_SUB1 (0x04U) /*!< [23:16] sub1 version */
93#define __STM32G0_CMSIS_VERSION_SUB2 (0x01U) /*!< [15:8] sub2 version */
94#define __STM32G0_CMSIS_VERSION_RC (0x00U) /*!< [7:0] release candidate */
95#define __STM32G0_CMSIS_VERSION ((__STM32G0_CMSIS_VERSION_MAIN << 24)\
96 |(__STM32G0_CMSIS_VERSION_SUB1 << 16)\
97 |(__STM32G0_CMSIS_VERSION_SUB2 << 8 )\
98 |(__STM32G0_CMSIS_VERSION_RC))
99
100/**
101 * @}
102 */
103
104/** @addtogroup Device_Included
105 * @{
106 */
107
108#if defined(STM32G0B1xx)
109 #include "stm32g0b1xx.h"
110#elif defined(STM32G0C1xx)
111 #include "stm32g0c1xx.h"
112#elif defined(STM32G0B0xx)
113 #include "stm32g0b0xx.h"
114#elif defined(STM32G071xx)
115 #include "stm32g071xx.h"
116#elif defined(STM32G081xx)
117 #include "stm32g081xx.h"
118#elif defined(STM32G070xx)
119 #include "stm32g070xx.h"
120#elif defined(STM32G031xx)
121 #include "stm32g031xx.h"
122#elif defined(STM32G041xx)
123 #include "stm32g041xx.h"
124#elif defined(STM32G030xx)
125 #include "stm32g030xx.h"
126#elif defined(STM32G051xx)
127 #include "stm32g051xx.h"
128#elif defined(STM32G061xx)
129 #include "stm32g061xx.h"
130#elif defined(STM32G050xx)
131 #include "stm32g050xx.h"
132#else
133 #error "Please select first the target STM32G0xx device used in your application (in stm32g0xx.h file)"
134#endif
135
136/**
137 * @}
138 */
139
140/** @addtogroup Exported_types
141 * @{
142 */
143typedef enum
144{
145 RESET = 0,
146 SET = !RESET
147} FlagStatus, ITStatus;
148
149typedef enum
150{
151 DISABLE = 0,
152 ENABLE = !DISABLE
153} FunctionalState;
154#define IS_FUNCTIONAL_STATE(STATE) (((STATE) == DISABLE) || ((STATE) == ENABLE))
155
156typedef enum
157{
158 SUCCESS = 0,
159 ERROR = !SUCCESS
160} ErrorStatus;
161
162/**
163 * @}
164 */
165
166
167/** @addtogroup Exported_macros
168 * @{
169 */
170#define SET_BIT(REG, BIT) ((REG) |= (BIT))
171
172#define CLEAR_BIT(REG, BIT) ((REG) &= ~(BIT))
173
174#define READ_BIT(REG, BIT) ((REG) & (BIT))
175
176#define CLEAR_REG(REG) ((REG) = (0x0))
177
178#define WRITE_REG(REG, VAL) ((REG) = (VAL))
179
180#define READ_REG(REG) ((REG))
181
182#define MODIFY_REG(REG, CLEARMASK, SETMASK) WRITE_REG((REG), (((READ_REG(REG)) & (~(CLEARMASK))) | (SETMASK)))
183
184/* Use of interrupt control for register exclusive access */
185/* Atomic 32-bit register access macro to set one or several bits */
186#define ATOMIC_SET_BIT(REG, BIT) \
187 do { \
188 uint32_t primask; \
189 primask = __get_PRIMASK(); \
190 __set_PRIMASK(1); \
191 SET_BIT((REG), (BIT)); \
192 __set_PRIMASK(primask); \
193 } while(0)
194
195/* Atomic 32-bit register access macro to clear one or several bits */
196#define ATOMIC_CLEAR_BIT(REG, BIT) \
197 do { \
198 uint32_t primask; \
199 primask = __get_PRIMASK(); \
200 __set_PRIMASK(1); \
201 CLEAR_BIT((REG), (BIT)); \
202 __set_PRIMASK(primask); \
203 } while(0)
204
205/* Atomic 32-bit register access macro to clear and set one or several bits */
206#define ATOMIC_MODIFY_REG(REG, CLEARMSK, SETMASK) \
207 do { \
208 uint32_t primask; \
209 primask = __get_PRIMASK(); \
210 __set_PRIMASK(1); \
211 MODIFY_REG((REG), (CLEARMSK), (SETMASK)); \
212 __set_PRIMASK(primask); \
213 } while(0)
214
215/* Atomic 16-bit register access macro to set one or several bits */
216#define ATOMIC_SETH_BIT(REG, BIT) ATOMIC_SET_BIT(REG, BIT) \
217
218/* Atomic 16-bit register access macro to clear one or several bits */
219#define ATOMIC_CLEARH_BIT(REG, BIT) ATOMIC_CLEAR_BIT(REG, BIT) \
220
221/* Atomic 16-bit register access macro to clear and set one or several bits */
222#define ATOMIC_MODIFYH_REG(REG, CLEARMSK, SETMASK) ATOMIC_MODIFY_REG(REG, CLEARMSK, SETMASK) \
223
224/*#define POSITION_VAL(VAL) (__CLZ(__RBIT(VAL)))*/
225/**
226 * @}
227 */
228
229#if defined (USE_HAL_DRIVER)
230 #include "stm32g0xx_hal.h"
231#endif /* USE_HAL_DRIVER */
232
233#ifdef __cplusplus
234}
235#endif /* __cplusplus */
236
237#endif /* STM32G0xx_H */
238/**
239 * @}
240 */
241
242/**
243 * @}
244 */
245
246
247
248
249/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
Note: See TracBrowser for help on using the repository browser.