2 ******************************************************************************
\r
3 * @file stm32f7xx_hal_def.h
\r
4 * @author MCD Application Team
\r
7 * @brief This file contains HAL common defines, enumeration, macros and
\r
8 * structures definitions.
\r
9 ******************************************************************************
\r
12 * <h2><center>© COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
\r
14 * Redistribution and use in source and binary forms, with or without modification,
\r
15 * are permitted provided that the following conditions are met:
\r
16 * 1. Redistributions of source code must retain the above copyright notice,
\r
17 * this list of conditions and the following disclaimer.
\r
18 * 2. Redistributions in binary form must reproduce the above copyright notice,
\r
19 * this list of conditions and the following disclaimer in the documentation
\r
20 * and/or other materials provided with the distribution.
\r
21 * 3. Neither the name of STMicroelectronics nor the names of its contributors
\r
22 * may be used to endorse or promote products derived from this software
\r
23 * without specific prior written permission.
\r
25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
\r
26 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
\r
27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
\r
28 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
\r
29 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
\r
30 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
\r
31 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
\r
32 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
\r
33 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
\r
34 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
\r
36 ******************************************************************************
\r
39 /* Define to prevent recursive inclusion -------------------------------------*/
\r
40 #ifndef __STM32F7xx_HAL_DEF
\r
41 #define __STM32F7xx_HAL_DEF
\r
47 /* Includes ------------------------------------------------------------------*/
\r
48 #include "stm32f7xx.h"
\r
49 #include "Legacy/stm32_hal_legacy.h"
\r
51 /* Exported types ------------------------------------------------------------*/
\r
54 * @brief HAL Status structures definition
\r
62 } HAL_StatusTypeDef;
\r
65 * @brief HAL Lock structures definition
\r
69 HAL_UNLOCKED = 0x00,
\r
73 /* Exported macro ------------------------------------------------------------*/
\r
74 #define HAL_MAX_DELAY 0xFFFFFFFF
\r
76 #define HAL_IS_BIT_SET(REG, BIT) (((REG) & (BIT)) != RESET)
\r
77 #define HAL_IS_BIT_CLR(REG, BIT) (((REG) & (BIT)) == RESET)
\r
79 #define __HAL_LINKDMA(__HANDLE__, __PPP_DMA_FIELD__, __DMA_HANDLE__) \
\r
81 (__HANDLE__)->__PPP_DMA_FIELD__ = &(__DMA_HANDLE__); \
\r
82 (__DMA_HANDLE__).Parent = (__HANDLE__); \
\r
85 #define UNUSED(x) ((void)(x))
\r
87 /** @brief Reset the Handle's State field.
\r
88 * @param __HANDLE__: specifies the Peripheral Handle.
\r
89 * @note This macro can be used for the following purpose:
\r
90 * - When the Handle is declared as local variable; before passing it as parameter
\r
91 * to HAL_PPP_Init() for the first time, it is mandatory to use this macro
\r
92 * to set to 0 the Handle's "State" field.
\r
93 * Otherwise, "State" field may have any random value and the first time the function
\r
94 * HAL_PPP_Init() is called, the low level hardware initialization will be missed
\r
95 * (i.e. HAL_PPP_MspInit() will not be executed).
\r
96 * - When there is a need to reconfigure the low level hardware: instead of calling
\r
97 * HAL_PPP_DeInit() then HAL_PPP_Init(), user can make a call to this macro then HAL_PPP_Init().
\r
98 * In this later function, when the Handle's "State" field is set to 0, it will execute the function
\r
99 * HAL_PPP_MspInit() which will reconfigure the low level hardware.
\r
102 #define __HAL_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = 0)
\r
104 #if (USE_RTOS == 1)
\r
105 /* Reserved for future use */
\r
106 #error
\93USE_RTOS should be 0 in the current HAL release
\94\r
108 #define __HAL_LOCK(__HANDLE__) \
\r
110 if((__HANDLE__)->Lock == HAL_LOCKED) \
\r
116 (__HANDLE__)->Lock = HAL_LOCKED; \
\r
120 #define __HAL_UNLOCK(__HANDLE__) \
\r
122 (__HANDLE__)->Lock = HAL_UNLOCKED; \
\r
124 #endif /* USE_RTOS */
\r
126 #if defined ( __GNUC__ )
\r
128 #define __weak __attribute__((weak))
\r
129 #endif /* __weak */
\r
131 #define __packed __attribute__((__packed__))
\r
132 #endif /* __packed */
\r
133 #endif /* __GNUC__ */
\r
136 /* Macro to get variable aligned on 4-bytes, for __ICCARM__ the directive "#pragma data_alignment=4" must be used instead */
\r
137 #if defined (__GNUC__) /* GNU Compiler */
\r
138 #ifndef __ALIGN_END
\r
139 #define __ALIGN_END __attribute__ ((aligned (4)))
\r
140 #endif /* __ALIGN_END */
\r
141 #ifndef __ALIGN_BEGIN
\r
142 #define __ALIGN_BEGIN
\r
143 #endif /* __ALIGN_BEGIN */
\r
145 #ifndef __ALIGN_END
\r
146 #define __ALIGN_END
\r
147 #endif /* __ALIGN_END */
\r
148 #ifndef __ALIGN_BEGIN
\r
149 #if defined (__CC_ARM) /* ARM Compiler */
\r
150 #define __ALIGN_BEGIN __align(4)
\r
151 #elif defined (__ICCARM__) /* IAR Compiler */
\r
152 #define __ALIGN_BEGIN
\r
153 #endif /* __CC_ARM */
\r
154 #endif /* __ALIGN_BEGIN */
\r
155 #endif /* __GNUC__ */
\r
159 * @brief __RAM_FUNC definition
\r
161 #if defined ( __CC_ARM )
\r
164 RAM functions are defined using the toolchain options.
\r
165 Functions that are executed in RAM should reside in a separate source module.
\r
166 Using the 'Options for File' dialog you can simply change the 'Code / Const'
\r
167 area of a module to a memory space in physical RAM.
\r
168 Available memory areas are declared in the 'Target' tab of the 'Options for Target'
\r
171 #define __RAM_FUNC HAL_StatusTypeDef
\r
173 #elif defined ( __ICCARM__ )
\r
176 RAM functions are defined using a specific toolchain keyword "__ramfunc".
\r
178 #define __RAM_FUNC __ramfunc HAL_StatusTypeDef
\r
180 #elif defined ( __GNUC__ )
\r
183 RAM functions are defined using a specific toolchain attribute
\r
184 "__attribute__((section(".RamFunc")))".
\r
186 #define __RAM_FUNC HAL_StatusTypeDef __attribute__((section(".RamFunc")))
\r
191 * @brief __NOINLINE definition
\r
193 #if defined ( __CC_ARM ) || defined ( __GNUC__ )
\r
194 /* ARM & GNUCompiler
\r
197 #define __NOINLINE __attribute__ ( (noinline) )
\r
199 #elif defined ( __ICCARM__ )
\r
203 #define __NOINLINE _Pragma("optimize = no_inline")
\r
211 #endif /* ___STM32F7xx_HAL_DEF */
\r
213 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
\r