source: trunk/firmware_v2/Drivers/CMSIS/Device/ST/STM32C0xx/Include/stm32c0xx.h

Last change on this file was 17, checked in by f.jahn, 4 months ago
File size: 6.9 KB
Line 
1/**
2 ******************************************************************************
3 * @file stm32c0xx.h
4 * @author MCD Application Team
5 * @brief CMSIS STM32C0xx 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 STM32C0xx 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) 2022 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
29/** @addtogroup CMSIS
30 * @{
31 */
32
33/** @addtogroup stm32c0xx
34 * @{
35 */
36
37#ifndef STM32C0xx_H
38#define STM32C0xx_H
39
40#ifdef __cplusplus
41 extern "C" {
42#endif /* __cplusplus */
43
44/** @addtogroup Library_configuration_section
45 * @{
46 */
47
48/**
49 * @brief STM32 Family
50 */
51#if !defined (STM32C0)
52#define STM32C0
53#endif /* STM32C0 */
54
55/* Uncomment the line below according to the target STM32C0 device used in your
56 application
57 */
58
59#if !defined (STM32C011xx) && !defined (STM32C031xx) \
60 && !defined (STM32C051xx) && !defined (STM32C071xx) \
61 && !defined (STM32C091xx) && !defined (STM32C092xx)
62 /* #define STM32C011xx */ /*!< STM32C011xx Devices */
63 /* #define STM32C031xx */ /*!< STM32C031xx Devices */
64 /* #define STM32C051xx */ /*!< STM32C051xx Devices */
65 /* #define STM32C071xx */ /*!< STM32C071xx Devices */
66 /* #define STM32C091xx */ /*!< STM32C091xx Devices */
67 /* #define STM32C092xx */ /*!< STM32C092xx Devices */
68#endif
69
70/* Tip: To avoid modifying this file each time you need to switch between these
71 devices, you can define the device in your toolchain compiler preprocessor.
72 */
73#if !defined (USE_HAL_DRIVER)
74/**
75 * @brief Comment the line below if you will not use the peripherals drivers.
76 In this case, these drivers will not be included and the application code will
77 be based on direct access to peripherals registers
78 */
79 /*#define USE_HAL_DRIVER */
80#endif /* USE_HAL_DRIVER */
81
82/**
83 * @brief CMSIS Device version number V1.0.0
84 */
85#define __STM32C0_CMSIS_VERSION_MAIN (0x01U) /*!< [31:24] main version */
86#define __STM32C0_CMSIS_VERSION_SUB1 (0x04U) /*!< [23:16] sub1 version */
87#define __STM32C0_CMSIS_VERSION_SUB2 (0x00U) /*!< [15:8] sub2 version */
88#define __STM32C0_CMSIS_VERSION_RC (0x00U) /*!< [7:0] release candidate */
89#define __STM32C0_CMSIS_VERSION ((__STM32C0_CMSIS_VERSION_MAIN << 24)\
90 |(__STM32C0_CMSIS_VERSION_SUB1 << 16)\
91 |(__STM32C0_CMSIS_VERSION_SUB2 << 8 )\
92 |(__STM32C0_CMSIS_VERSION_RC))
93
94/**
95 * @}
96 */
97
98/** @addtogroup Device_Included
99 * @{
100 */
101
102#if defined(STM32C011xx)
103 #include "stm32c011xx.h"
104#elif defined(STM32C031xx)
105 #include "stm32c031xx.h"
106#elif defined(STM32C051xx)
107 #include "stm32c051xx.h"
108#elif defined(STM32C071xx)
109 #include "stm32c071xx.h"
110#elif defined(STM32C091xx)
111 #include "stm32c091xx.h"
112#elif defined(STM32C092xx)
113 #include "stm32c092xx.h"
114#else
115 #error "Please select first the target STM32C0xx device used in your application (in stm32c0xx.h file)"
116#endif
117
118/**
119 * @}
120 */
121
122/** @addtogroup Exported_types
123 * @{
124 */
125typedef enum
126{
127 RESET = 0,
128 SET = !RESET
129} FlagStatus, ITStatus;
130
131typedef enum
132{
133 DISABLE = 0,
134 ENABLE = !DISABLE
135} FunctionalState;
136#define IS_FUNCTIONAL_STATE(STATE) (((STATE) == DISABLE) || ((STATE) == ENABLE))
137
138typedef enum
139{
140 SUCCESS = 0,
141 ERROR = !SUCCESS
142} ErrorStatus;
143
144/**
145 * @}
146 */
147
148/** @addtogroup Exported_macros
149 * @{
150 */
151#define SET_BIT(REG, BIT) ((REG) |= (BIT))
152
153#define CLEAR_BIT(REG, BIT) ((REG) &= ~(BIT))
154
155#define READ_BIT(REG, BIT) ((REG) & (BIT))
156
157#define CLEAR_REG(REG) ((REG) = (0x0))
158
159#define WRITE_REG(REG, VAL) ((REG) = (VAL))
160
161#define READ_REG(REG) ((REG))
162
163#define MODIFY_REG(REG, CLEARMASK, SETMASK) WRITE_REG((REG), (((READ_REG(REG)) & (~(CLEARMASK))) | (SETMASK)))
164
165/* Use of interrupt control for register exclusive access */
166/* Atomic 32-bit register access macro to set one or several bits */
167#define ATOMIC_SET_BIT(REG, BIT) \
168 do { \
169 uint32_t primask; \
170 primask = __get_PRIMASK(); \
171 __set_PRIMASK(1); \
172 SET_BIT((REG), (BIT)); \
173 __set_PRIMASK(primask); \
174 } while(0)
175
176/* Atomic 32-bit register access macro to clear one or several bits */
177#define ATOMIC_CLEAR_BIT(REG, BIT) \
178 do { \
179 uint32_t primask; \
180 primask = __get_PRIMASK(); \
181 __set_PRIMASK(1); \
182 CLEAR_BIT((REG), (BIT)); \
183 __set_PRIMASK(primask); \
184 } while(0)
185
186/* Atomic 32-bit register access macro to clear and set one or several bits */
187#define ATOMIC_MODIFY_REG(REG, CLEARMSK, SETMASK) \
188 do { \
189 uint32_t primask; \
190 primask = __get_PRIMASK(); \
191 __set_PRIMASK(1); \
192 MODIFY_REG((REG), (CLEARMSK), (SETMASK)); \
193 __set_PRIMASK(primask); \
194 } while(0)
195
196/* Atomic 16-bit register access macro to set one or several bits */
197#define ATOMIC_SETH_BIT(REG, BIT) ATOMIC_SET_BIT(REG, BIT) \
198
199/* Atomic 16-bit register access macro to clear one or several bits */
200#define ATOMIC_CLEARH_BIT(REG, BIT) ATOMIC_CLEAR_BIT(REG, BIT) \
201
202/* Atomic 16-bit register access macro to clear and set one or several bits */
203#define ATOMIC_MODIFYH_REG(REG, CLEARMSK, SETMASK) ATOMIC_MODIFY_REG(REG, CLEARMSK, SETMASK) \
204
205#define POSITION_VAL(VAL) (__CLZ(__RBIT(VAL)))
206/**
207 * @}
208 */
209
210#if defined (USE_HAL_DRIVER)
211 #include "stm32c0xx_hal.h"
212#endif /* USE_HAL_DRIVER */
213
214#ifdef __cplusplus
215}
216#endif /* __cplusplus */
217
218#endif /* STM32C0xx_H */
219/**
220 * @}
221 */
222
223/**
224 * @}
225 */
226
Note: See TracBrowser for help on using the repository browser.