2 ******************************************************************************
3 * @file stm32f7xx_hal_def.h
4 * @author MCD Application Team
5 * @brief This file contains HAL common defines, enumeration, macros and
6 * structures definitions.
7 ******************************************************************************
10 * <h2><center>© Copyright (c) 2017 STMicroelectronics.
11 * All rights reserved.</center></h2>
13 * This software component is licensed by ST under BSD 3-Clause license,
14 * the "License"; You may not use this file except in compliance with the
15 * License. You may obtain a copy of the License at:
16 * opensource.org/licenses/BSD-3-Clause
18 ******************************************************************************
21 /* Define to prevent recursive inclusion -------------------------------------*/
22 #ifndef __STM32F7xx_HAL_DEF
23 #define __STM32F7xx_HAL_DEF
29 /* Includes ------------------------------------------------------------------*/
30 #include "stm32f7xx.h"
31 #include "Legacy/stm32_hal_legacy.h"
34 /* Exported types ------------------------------------------------------------*/
37 * @brief HAL Status structures definition
48 * @brief HAL Lock structures definition
56 /* Exported macro ------------------------------------------------------------*/
59 #define UNUSED(X) ((void)(X)) /* To avoid gcc/g++ warnings */
62 #define HAL_MAX_DELAY 0xFFFFFFFFU
64 #define HAL_IS_BIT_SET(REG, BIT) (((REG) & (BIT)) == (BIT))
65 #define HAL_IS_BIT_CLR(REG, BIT) (((REG) & (BIT)) == 0U)
67 #define __HAL_LINKDMA(__HANDLE__, __PPP_DMA_FIELD__, __DMA_HANDLE__) \
69 (__HANDLE__)->__PPP_DMA_FIELD__ = &(__DMA_HANDLE__); \
70 (__DMA_HANDLE__).Parent = (__HANDLE__); \
73 /** @brief Reset the Handle's State field.
74 * @param __HANDLE__ specifies the Peripheral Handle.
75 * @note This macro can be used for the following purpose:
76 * - When the Handle is declared as local variable; before passing it as parameter
77 * to HAL_PPP_Init() for the first time, it is mandatory to use this macro
78 * to set to 0 the Handle's "State" field.
79 * Otherwise, "State" field may have any random value and the first time the function
80 * HAL_PPP_Init() is called, the low level hardware initialization will be missed
81 * (i.e. HAL_PPP_MspInit() will not be executed).
82 * - When there is a need to reconfigure the low level hardware: instead of calling
83 * HAL_PPP_DeInit() then HAL_PPP_Init(), user can make a call to this macro then HAL_PPP_Init().
84 * In this later function, when the Handle's "State" field is set to 0, it will execute the function
85 * HAL_PPP_MspInit() which will reconfigure the low level hardware.
88 #define __HAL_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = 0U)
91 /* Reserved for future use */
92 #error "USE_RTOS should be 0 in the current HAL release"
94 #define __HAL_LOCK(__HANDLE__) \
96 if((__HANDLE__)->Lock == HAL_LOCKED) \
102 (__HANDLE__)->Lock = HAL_LOCKED; \
106 #define __HAL_UNLOCK(__HANDLE__) \
108 (__HANDLE__)->Lock = HAL_UNLOCKED; \
110 #endif /* USE_RTOS */
112 #if defined ( __GNUC__ ) && !defined (__CC_ARM) /* GNU Compiler */
114 #define __weak __attribute__((weak))
117 #define __packed __attribute__((__packed__))
118 #endif /* __packed */
119 #endif /* __GNUC__ */
122 /* Macro to get variable aligned on 4-bytes, for __ICCARM__ the directive "#pragma data_alignment=4" must be used instead */
123 #if defined ( __GNUC__ ) && !defined (__CC_ARM) /* GNU Compiler */
125 #define __ALIGN_END __attribute__ ((aligned (4)))
126 #endif /* __ALIGN_END */
127 #ifndef __ALIGN_BEGIN
128 #define __ALIGN_BEGIN
129 #endif /* __ALIGN_BEGIN */
133 #endif /* __ALIGN_END */
134 #ifndef __ALIGN_BEGIN
135 #if defined (__CC_ARM) /* ARM Compiler */
136 #define __ALIGN_BEGIN __align(4)
137 #elif defined (__ICCARM__) /* IAR Compiler */
138 #define __ALIGN_BEGIN
139 #endif /* __CC_ARM */
140 #endif /* __ALIGN_BEGIN */
141 #endif /* __GNUC__ */
143 /* Macro to get variable aligned on 32-bytes,needed for cache maintenance purpose */
144 #if defined (__GNUC__) /* GNU Compiler */
145 #define ALIGN_32BYTES(buf) buf __attribute__ ((aligned (32)))
146 #elif defined (__ICCARM__) /* IAR Compiler */
147 #define ALIGN_32BYTES(buf) _Pragma("data_alignment=32") buf
148 #elif defined (__CC_ARM) /* ARM Compiler */
149 #define ALIGN_32BYTES(buf) __align(32) buf
153 * @brief __RAM_FUNC definition
155 #if defined ( __CC_ARM )
158 RAM functions are defined using the toolchain options.
159 Functions that are executed in RAM should reside in a separate source module.
160 Using the 'Options for File' dialog you can simply change the 'Code / Const'
161 area of a module to a memory space in physical RAM.
162 Available memory areas are declared in the 'Target' tab of the 'Options for Target'
167 #elif defined ( __ICCARM__ )
170 RAM functions are defined using a specific toolchain keyword "__ramfunc".
172 #define __RAM_FUNC __ramfunc
174 #elif defined ( __GNUC__ )
177 RAM functions are defined using a specific toolchain attribute
178 "__attribute__((section(".RamFunc")))".
180 #define __RAM_FUNC __attribute__((section(".RamFunc")))
185 * @brief __NOINLINE definition
187 #if defined ( __CC_ARM ) || defined ( __GNUC__ )
191 #define __NOINLINE __attribute__ ( (noinline) )
193 #elif defined ( __ICCARM__ )
197 #define __NOINLINE _Pragma("optimize = no_inline")
205 #endif /* ___STM32F7xx_HAL_DEF */
207 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/