mikroSDK Reference Manual
stm32h7xx_hal_def.h
Go to the documentation of this file.
1
21/* Define to prevent recursive inclusion -------------------------------------*/
22#ifndef STM32H7xx_HAL_DEF
23#define STM32H7xx_HAL_DEF
24
25#ifdef __cplusplus
26 extern "C" {
27#endif
28
29/* Includes ------------------------------------------------------------------*/
30#include "stm32h7xx.h"
32#include <stddef.h>
33#include <math.h>
34
35/* Exported types ------------------------------------------------------------*/
36
40typedef enum
41{
42 HAL_OK = 0x00,
43 HAL_ERROR = 0x01,
44 HAL_BUSY = 0x02,
45 HAL_TIMEOUT = 0x03
47
51typedef enum
52{
53 HAL_UNLOCKED = 0x00,
54 HAL_LOCKED = 0x01
56
57/* Exported macro ------------------------------------------------------------*/
58
59#define HAL_MAX_DELAY 0xFFFFFFFFU
60
61#define HAL_IS_BIT_SET(REG, BIT) (((REG) & (BIT)) == (BIT))
62#define HAL_IS_BIT_CLR(REG, BIT) (((REG) & (BIT)) == 0U)
63
64#define __HAL_LINKDMA(__HANDLE__, __PPP_DMA_FIELD__, __DMA_HANDLE__) \
65 do{ \
66 (__HANDLE__)->__PPP_DMA_FIELD__ = &(__DMA_HANDLE__); \
67 (__DMA_HANDLE__).Parent = (__HANDLE__); \
68 } while(0)
69
70#define UNUSED(x) ((void)(x))
71
87#define __HAL_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = 0)
88
89#if (USE_RTOS == 1)
90 #error " USE_RTOS should be 0 in the current HAL release "
91#else
92 #define __HAL_LOCK(__HANDLE__) \
93 do{ \
94 if((__HANDLE__)->Lock == HAL_LOCKED) \
95 { \
96 return HAL_BUSY; \
97 } \
98 else \
99 { \
100 (__HANDLE__)->Lock = HAL_LOCKED; \
101 } \
102 }while (0)
103
104 #define __HAL_UNLOCK(__HANDLE__) \
105 do{ \
106 (__HANDLE__)->Lock = HAL_UNLOCKED; \
107 }while (0)
108#endif /* USE_RTOS */
109
110
111#if defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) /* ARM Compiler V6 */
112 #ifndef __weak
113 #define __weak __attribute__((weak))
114 #endif
115 #ifndef __packed
116 #define __packed __attribute__((packed))
117 #endif
118#elif defined ( __GNUC__ ) && !defined (__CC_ARM) /* GNU Compiler */
119 #ifndef __weak
120 #define __weak __attribute__((weak))
121 #endif /* __weak */
122 #ifndef __packed
123 #define __packed __attribute__((__packed__))
124 #endif /* __packed */
125#endif /* __GNUC__ */
126
127
128/* Macro to get variable aligned on 4-bytes, for __ICCARM__ the directive "#pragma data_alignment=4" must be used instead */
129#if defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) /* ARM Compiler V6 */
130 #ifndef __ALIGN_BEGIN
131 #define __ALIGN_BEGIN
132 #endif
133 #ifndef __ALIGN_END
134 #define __ALIGN_END __attribute__ ((aligned (4)))
135 #endif
136#elif defined ( __GNUC__ ) && !defined (__CC_ARM) /* GNU Compiler */
137 #ifndef __ALIGN_END
138 #define __ALIGN_END __attribute__ ((aligned (4)))
139 #endif /* __ALIGN_END */
140 #ifndef __ALIGN_BEGIN
141 #define __ALIGN_BEGIN
142 #endif /* __ALIGN_BEGIN */
143#else
144 #ifndef __ALIGN_END
145 #define __ALIGN_END
146 #endif /* __ALIGN_END */
147 #ifndef __ALIGN_BEGIN
148 #if defined (__CC_ARM) /* ARM Compiler V5 */
149 #define __ALIGN_BEGIN __align(4)
150 #elif defined (__ICCARM__) /* IAR Compiler */
151 #define __ALIGN_BEGIN
152 #endif /* __CC_ARM */
153 #endif /* __ALIGN_BEGIN */
154#endif /* __GNUC__ */
155
156/* Macro to get variable aligned on 32-bytes,needed for cache maintenance purpose */
157#if defined (__GNUC__) /* GNU Compiler */
158 #define ALIGN_32BYTES(buf) buf __attribute__ ((aligned (32)))
159#elif defined (__ICCARM__) /* IAR Compiler */
160 #define ALIGN_32BYTES(buf) _Pragma("data_alignment=32") buf
161#elif defined (__CC_ARM) /* ARM Compiler */
162 #define ALIGN_32BYTES(buf) __align(32) buf
163#endif
164
168#if defined ( __CC_ARM ) || (defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050))
169/* ARM Compiler V4/V5 and V6
170 --------------------------
171 RAM functions are defined using the toolchain options.
172 Functions that are executed in RAM should reside in a separate source module.
173 Using the 'Options for File' dialog you can simply change the 'Code / Const'
174 area of a module to a memory space in physical RAM.
175 Available memory areas are declared in the 'Target' tab of the 'Options for Target'
176 dialog.
177*/
178#define __RAM_FUNC
179
180#elif defined ( __ICCARM__ )
181/* ICCARM Compiler
182 ---------------
183 RAM functions are defined using a specific toolchain keyword "__ramfunc".
184*/
185#define __RAM_FUNC __ramfunc
186
187#elif defined ( __GNUC__ )
188/* GNU Compiler
189 ------------
190 RAM functions are defined using a specific toolchain attribute
191 "__attribute__((section(".RamFunc")))".
192*/
193#define __RAM_FUNC __attribute__((section(".RamFunc")))
194
195#endif
196
200#if defined ( __CC_ARM ) || (defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)) || defined ( __GNUC__ )
201/* ARM V4/V5 and V6 & GNU Compiler
202 -------------------------------
203*/
204#define __NOINLINE __attribute__ ( (noinline) )
205
206#elif defined ( __ICCARM__ )
207/* ICCARM Compiler
208 ---------------
209*/
210#define __NOINLINE _Pragma("optimize = no_inline")
211
212#endif
213
214
215#ifdef __cplusplus
216}
217#endif
218
219#endif /* STM32H7xx_HAL_DEF */
220
221/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
This file contains aliases definition for the STM32Cube HAL constants macros and functions maintained...
CMSIS STM32H7xx Device Peripheral Access Layer Header File.
HAL_StatusTypeDef
HAL Status structures definition.
Definition stm32h7xx_hal_def.h:41
HAL_LockTypeDef
HAL Lock structures definition.
Definition stm32h7xx_hal_def.h:52