File indexing completed on 2025-05-11 08:23:35
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040 #ifndef STM32H7xx_H
0041 #define STM32H7xx_H
0042
0043 #ifdef __rtems__
0044 #include <bspopts.h>
0045 #endif
0046 #ifdef __cplusplus
0047 extern "C" {
0048 #endif
0049
0050
0051
0052
0053
0054
0055
0056
0057 #if !defined (STM32H7)
0058 #define STM32H7
0059 #endif
0060
0061
0062
0063
0064
0065
0066 #if !defined (STM32H743xx) && !defined (STM32H753xx) && !defined (STM32H750xx) && !defined (STM32H742xx) && \
0067 !defined (STM32H745xx) && !defined (STM32H745xG) && !defined (STM32H755xx) && !defined (STM32H747xx) && !defined (STM32H747xG)&& !defined (STM32H757xx) && \
0068 !defined (STM32H7A3xx) && !defined (STM32H7A3xxQ) && !defined (STM32H7B3xx) && !defined (STM32H7B3xxQ) && !defined (STM32H7B0xx) && !defined (STM32H7B0xxQ) && \
0069 !defined (STM32H735xx) && !defined (STM32H733xx) && !defined (STM32H730xx) && !defined (STM32H730xxQ) && !defined (STM32H725xx) && !defined (STM32H723xx)
0070
0071
0072
0073
0074
0075
0076
0077
0078
0079
0080
0081
0082
0083
0084
0085
0086
0087
0088
0089
0090
0091 #endif
0092
0093
0094
0095
0096
0097 #if defined(DUAL_CORE) && !defined(CORE_CM4) && !defined(CORE_CM7)
0098 #error "Dual core device, please select CORE_CM4 or CORE_CM7"
0099 #endif
0100
0101 #if !defined (USE_HAL_DRIVER)
0102
0103
0104
0105
0106
0107
0108 #endif
0109
0110
0111
0112
0113 #define __STM32H7xx_CMSIS_DEVICE_VERSION_MAIN (0x01)
0114 #define __STM32H7xx_CMSIS_DEVICE_VERSION_SUB1 (0x0A)
0115 #define __STM32H7xx_CMSIS_DEVICE_VERSION_SUB2 (0x04)
0116 #define __STM32H7xx_CMSIS_DEVICE_VERSION_RC (0x00)
0117 #define __STM32H7xx_CMSIS_DEVICE_VERSION ((__STM32H7xx_CMSIS_DEVICE_VERSION_MAIN << 24)\
0118 |(__STM32H7xx_CMSIS_DEVICE_VERSION_SUB1 << 16)\
0119 |(__STM32H7xx_CMSIS_DEVICE_VERSION_SUB2 << 8 )\
0120 |(__STM32H7xx_CMSIS_DEVICE_VERSION_RC))
0121
0122
0123
0124
0125
0126
0127
0128
0129
0130 #if defined(STM32H743xx)
0131 #include "stm32h743xx.h"
0132 #elif defined(STM32H753xx)
0133 #include "stm32h753xx.h"
0134 #elif defined(STM32H750xx)
0135 #include "stm32h750xx.h"
0136 #elif defined(STM32H742xx)
0137 #include "stm32h742xx.h"
0138 #elif defined(STM32H745xx)
0139 #include "stm32h745xx.h"
0140 #elif defined(STM32H745xG)
0141 #include "stm32h745xg.h"
0142 #elif defined(STM32H755xx)
0143 #include "stm32h755xx.h"
0144 #elif defined(STM32H747xx)
0145 #include "stm32h747xx.h"
0146 #elif defined(STM32H747xG)
0147 #include "stm32h747xg.h"
0148 #elif defined(STM32H757xx)
0149 #include "stm32h757xx.h"
0150 #elif defined(STM32H7B0xx)
0151 #include "stm32h7b0xx.h"
0152 #elif defined(STM32H7B0xxQ)
0153 #include "stm32h7b0xxq.h"
0154 #elif defined(STM32H7A3xx)
0155 #include "stm32h7a3xx.h"
0156 #elif defined(STM32H7B3xx)
0157 #include "stm32h7b3xx.h"
0158 #elif defined(STM32H7A3xxQ)
0159 #include "stm32h7a3xxq.h"
0160 #elif defined(STM32H7B3xxQ)
0161 #include "stm32h7b3xxq.h"
0162 #elif defined(STM32H735xx)
0163 #include "stm32h735xx.h"
0164 #elif defined(STM32H733xx)
0165 #include "stm32h733xx.h"
0166 #elif defined(STM32H730xx)
0167 #include "stm32h730xx.h"
0168 #elif defined(STM32H730xxQ)
0169 #include "stm32h730xxq.h"
0170 #elif defined(STM32H725xx)
0171 #include "stm32h725xx.h"
0172 #elif defined(STM32H723xx)
0173 #include "stm32h723xx.h"
0174 #else
0175 #error "Please select first the target STM32H7xx device used in your application (in stm32h7xx.h file)"
0176 #endif
0177
0178
0179
0180
0181
0182
0183
0184
0185 typedef enum
0186 {
0187 RESET = 0,
0188 SET = !RESET
0189 } FlagStatus, ITStatus;
0190
0191 typedef enum
0192 {
0193 DISABLE = 0,
0194 ENABLE = !DISABLE
0195 } FunctionalState;
0196 #define IS_FUNCTIONAL_STATE(STATE) (((STATE) == DISABLE) || ((STATE) == ENABLE))
0197
0198 typedef enum
0199 {
0200 SUCCESS = 0,
0201 ERROR = !SUCCESS
0202 } ErrorStatus;
0203
0204
0205
0206
0207
0208
0209
0210
0211
0212 #define SET_BIT(REG, BIT) ((REG) |= (BIT))
0213
0214 #define CLEAR_BIT(REG, BIT) ((REG) &= ~(BIT))
0215
0216 #define READ_BIT(REG, BIT) ((REG) & (BIT))
0217
0218 #define CLEAR_REG(REG) ((REG) = (0x0))
0219
0220 #define WRITE_REG(REG, VAL) ((REG) = (VAL))
0221
0222 #define READ_REG(REG) ((REG))
0223
0224 #define MODIFY_REG(REG, CLEARMASK, SETMASK) WRITE_REG((REG), (((READ_REG(REG)) & (~(CLEARMASK))) | (SETMASK)))
0225
0226 #define POSITION_VAL(VAL) (__CLZ(__RBIT(VAL)))
0227
0228
0229
0230 #define ATOMIC_SET_BIT(REG, BIT) \
0231 do { \
0232 uint32_t val; \
0233 do { \
0234 val = __LDREXW((__IO uint32_t *)&(REG)) | (BIT); \
0235 } while ((__STREXW(val,(__IO uint32_t *)&(REG))) != 0U); \
0236 } while(0)
0237
0238
0239 #define ATOMIC_CLEAR_BIT(REG, BIT) \
0240 do { \
0241 uint32_t val; \
0242 do { \
0243 val = __LDREXW((__IO uint32_t *)&(REG)) & ~(BIT); \
0244 } while ((__STREXW(val,(__IO uint32_t *)&(REG))) != 0U); \
0245 } while(0)
0246
0247
0248 #define ATOMIC_MODIFY_REG(REG, CLEARMSK, SETMASK) \
0249 do { \
0250 uint32_t val; \
0251 do { \
0252 val = (__LDREXW((__IO uint32_t *)&(REG)) & ~(CLEARMSK)) | (SETMASK); \
0253 } while ((__STREXW(val,(__IO uint32_t *)&(REG))) != 0U); \
0254 } while(0)
0255
0256
0257 #define ATOMIC_SETH_BIT(REG, BIT) \
0258 do { \
0259 uint16_t val; \
0260 do { \
0261 val = __LDREXH((__IO uint16_t *)&(REG)) | (BIT); \
0262 } while ((__STREXH(val,(__IO uint16_t *)&(REG))) != 0U); \
0263 } while(0)
0264
0265
0266 #define ATOMIC_CLEARH_BIT(REG, BIT) \
0267 do { \
0268 uint16_t val; \
0269 do { \
0270 val = __LDREXH((__IO uint16_t *)&(REG)) & ~(BIT); \
0271 } while ((__STREXH(val,(__IO uint16_t *)&(REG))) != 0U); \
0272 } while(0)
0273
0274
0275 #define ATOMIC_MODIFYH_REG(REG, CLEARMSK, SETMASK) \
0276 do { \
0277 uint16_t val; \
0278 do { \
0279 val = (__LDREXH((__IO uint16_t *)&(REG)) & ~(CLEARMSK)) | (SETMASK); \
0280 } while ((__STREXH(val,(__IO uint16_t *)&(REG))) != 0U); \
0281 } while(0)
0282
0283
0284
0285
0286
0287 #if defined (USE_HAL_DRIVER)
0288 #include "stm32h7xx_hal.h"
0289 #endif
0290
0291
0292 #ifdef __cplusplus
0293 }
0294 #endif
0295
0296 #endif
0297
0298
0299
0300
0301
0302
0303
0304
0305
0306
0307