source: trunk/firmware/FSBL/SES/STM32N6xx/Device/Include/stm32n6xx.h@ 37

Last change on this file since 37 was 16, checked in by Zed, 5 weeks ago
File size: 7.1 KB
Line 
1/**
2 ******************************************************************************
3 * @file stm32n6xx.h
4 * @author MCD Application Team
5 * @brief CMSIS STM32N6xx 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 STM32N6xx device used in the target application
11 *
12 ******************************************************************************
13 * @attention
14 *
15 * Copyright (c) 2023 STMicroelectronics.
16 * All rights reserved.
17 *
18 * This software is licensed under terms that can be found in the LICENSE file
19 * in the root directory of this software component.
20 * If no LICENSE file comes with this software, it is provided AS-IS.
21 *
22 ******************************************************************************
23 */
24
25/** @addtogroup CMSIS
26 * @{
27 */
28
29/** @addtogroup STM32N6xx
30 * @{
31 */
32
33#ifndef STM32N6xx_H
34#define STM32N6xx_H
35
36#ifdef __cplusplus
37extern "C" {
38#endif /* __cplusplus */
39
40/** @addtogroup Library_configuration_section
41 * @{
42 */
43
44/**
45 * @brief STM32 Family
46 */
47#if !defined (STM32N6)
48#define STM32N6
49#endif /* STM32N6 */
50
51/* Uncomment the line below according to the target STM32N6 device used in your
52 application
53 */
54
55#if !defined (STM32N647xx) && !defined (STM32N657xx) && !defined (STM32N645xx) && !defined (STM32N655xx)
56 /* #define STM32N647xx */ /*!< STM32N647xx Devices */
57 /* #define STM32N657xx */ /*!< STM32N657xx Devices */
58 /* #define STM32N645xx */ /*!< STM32N645xx Devices */
59 /* #define STM32N655xx */ /*!< STM32N655xx Devices */
60#endif
61
62/* Tip: To avoid modifying this file each time you need to switch between these
63 devices, you can define the device in your toolchain compiler preprocessor.
64 */
65
66/**
67 * @brief CMSIS Device version number
68 */
69#define __STM32N6_CMSIS_VERSION_MAIN (0x01U) /*!< [31:24] main version */
70#define __STM32N6_CMSIS_VERSION_SUB1 (0x03U) /*!< [23:16] sub1 version */
71#define __STM32N6_CMSIS_VERSION_SUB2 (0x00U) /*!< [15:8] sub2 version */
72#define __STM32N6_CMSIS_VERSION_RC (0x00U) /*!< [7:0] release candidate */
73#define __STM32N6_CMSIS_VERSION ((__STM32N6_CMSIS_VERSION_MAIN << 24U)\
74 |(__STM32N6_CMSIS_VERSION_SUB1 << 16U)\
75 |(__STM32N6_CMSIS_VERSION_SUB2 << 8U )\
76 |(__STM32N6_CMSIS_VERSION_RC))
77
78/**
79 * @}
80 */
81
82/** @addtogroup Device_Included
83 * @{
84 */
85
86#if defined(STM32N657xx)
87 #include "stm32n657xx.h"
88#elif defined(STM32N655xx)
89 #include "stm32n655xx.h"
90#elif defined(STM32N647xx)
91 #include "stm32n647xx.h"
92#elif defined(STM32N645xx)
93 #include "stm32n645xx.h"
94#else
95 #error "Please select first the target STM32N6xx device used in your application (in stm32n6xx.h file)"
96#endif
97
98/**
99 * @}
100 */
101
102/** @addtogroup Exported_types
103 * @{
104 */
105typedef enum
106{
107 RESET = 0,
108 SET = !RESET
109} FlagStatus, ITStatus;
110
111typedef enum
112{
113 DISABLE = 0,
114 ENABLE = !DISABLE
115} FunctionalState;
116#define IS_FUNCTIONAL_STATE(STATE) (((STATE) == DISABLE) || ((STATE) == ENABLE))
117
118typedef enum
119{
120 SUCCESS = 0,
121 ERROR = !SUCCESS
122} ErrorStatus;
123
124/**
125 * @}
126 */
127
128
129/** @addtogroup Exported_macros
130 * @{
131 */
132#define SET_BIT(REG, BIT) ((REG) |= (BIT))
133
134#define CLEAR_BIT(REG, BIT) ((REG) &= ~(BIT))
135
136#define READ_BIT(REG, BIT) ((REG) & (BIT))
137
138#define CLEAR_REG(REG) ((REG) = (0x0))
139
140#define WRITE_REG(REG, VAL) ((REG) = (VAL))
141
142#define READ_REG(REG) ((REG))
143
144#define MODIFY_REG(REG, CLEARMASK, SETMASK) WRITE_REG((REG), (((READ_REG(REG)) & (~(CLEARMASK))) | (SETMASK)))
145
146/* Use of CMSIS compiler intrinsics for register exclusive access */
147/* Atomic 32-bit register access macro to set one or several bits */
148#define ATOMIC_SET_BIT(REG, BIT) \
149 do { \
150 uint32_t val; \
151 do { \
152 val = __LDREXW((__IO uint32_t *)&(REG)) | (BIT); \
153 } while ((__STREXW(val,(__IO uint32_t *)&(REG))) != 0U); \
154 } while(0)
155
156/* Atomic 32-bit register access macro to clear one or several bits */
157#define ATOMIC_CLEAR_BIT(REG, BIT) \
158 do { \
159 uint32_t val; \
160 do { \
161 val = __LDREXW((__IO uint32_t *)&(REG)) & ~(BIT); \
162 } while ((__STREXW(val,(__IO uint32_t *)&(REG))) != 0U); \
163 } while(0)
164
165/* Atomic 32-bit register access macro to clear and set one or several bits */
166#define ATOMIC_MODIFY_REG(REG, CLEARMSK, SETMASK) \
167 do { \
168 uint32_t val; \
169 do { \
170 val = (__LDREXW((__IO uint32_t *)&(REG)) & ~(CLEARMSK)) | (SETMASK); \
171 } while ((__STREXW(val,(__IO uint32_t *)&(REG))) != 0U); \
172 } while(0)
173
174/* Atomic 16-bit register access macro to set one or several bits */
175#define ATOMIC_SETH_BIT(REG, BIT) \
176 do { \
177 uint16_t val; \
178 do { \
179 val = __LDREXH((__IO uint16_t *)&(REG)) | (BIT); \
180 } while ((__STREXH(val,(__IO uint16_t *)&(REG))) != 0U); \
181 } while(0)
182
183/* Atomic 16-bit register access macro to clear one or several bits */
184#define ATOMIC_CLEARH_BIT(REG, BIT) \
185 do { \
186 uint16_t val; \
187 do { \
188 val = __LDREXH((__IO uint16_t *)&(REG)) & ~(BIT); \
189 } while ((__STREXH(val,(__IO uint16_t *)&(REG))) != 0U); \
190 } while(0)
191
192/* Atomic 16-bit register access macro to clear and set one or several bits */
193#define ATOMIC_MODIFYH_REG(REG, CLEARMSK, SETMASK) \
194 do { \
195 uint16_t val; \
196 do { \
197 val = (__LDREXH((__IO uint16_t *)&(REG)) & ~(CLEARMSK)) | (SETMASK); \
198 } while ((__STREXH(val,(__IO uint16_t *)&(REG))) != 0U); \
199 } while(0)
200
201#define POSITION_VAL(VAL) (__CLZ(__RBIT(VAL)))
202
203/**
204 * @}
205 */
206
207#if defined (USE_HAL_DRIVER)
208 #include "stm32n6xx_hal.h"
209#endif /* USE_HAL_DRIVER */
210
211#ifdef __cplusplus
212}
213#endif /* __cplusplus */
214
215#endif /* STM32N6xx_H */
216
217/**
218 * @}
219 */
220
221/**
222 * @}
223 */
224
Note: See TracBrowser for help on using the repository browser.