STM CMSIS
stm32f4xx_hal_def.h
Go to the documentation of this file.
1 
39 /* Define to prevent recursive inclusion -------------------------------------*/
40 #ifndef __STM32F4xx_HAL_DEF
41 #define __STM32F4xx_HAL_DEF
42 
43 #ifdef __cplusplus
44  extern "C" {
45 #endif
46 
47 /* Includes ------------------------------------------------------------------*/
48 #include "stm32f4xx.h"
50 #include <stdio.h>
51 
52 /* Exported types ------------------------------------------------------------*/
53 
57 typedef enum
58 {
59  HAL_OK = 0x00U,
60  HAL_ERROR = 0x01U,
61  HAL_BUSY = 0x02U,
62  HAL_TIMEOUT = 0x03U
64 
68 typedef enum
69 {
70  HAL_UNLOCKED = 0x00U,
71  HAL_LOCKED = 0x01U
73 
74 /* Exported macro ------------------------------------------------------------*/
75 #define HAL_MAX_DELAY 0xFFFFFFFFU
76 
77 #define HAL_IS_BIT_SET(REG, BIT) (((REG) & (BIT)) != RESET)
78 #define HAL_IS_BIT_CLR(REG, BIT) (((REG) & (BIT)) == RESET)
79 
80 #define __HAL_LINKDMA(__HANDLE__, __PPP_DMA_FIELD__, __DMA_HANDLE__) \
81  do{ \
82  (__HANDLE__)->__PPP_DMA_FIELD__ = &(__DMA_HANDLE__); \
83  (__DMA_HANDLE__).Parent = (__HANDLE__); \
84  } while(0)
85 
86 #define UNUSED(x) ((void)(x))
87 
103 #define __HAL_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = 0U)
104 
105 #if (USE_RTOS == 1)
106  /* Reserved for future use */
107  #error "USE_RTOS should be 0 in the current HAL release"
108 #else
109  #define __HAL_LOCK(__HANDLE__) \
110  do{ \
111  if((__HANDLE__)->Lock == HAL_LOCKED) \
112  { \
113  return HAL_BUSY; \
114  } \
115  else \
116  { \
117  (__HANDLE__)->Lock = HAL_LOCKED; \
118  } \
119  }while (0)
120 
121  #define __HAL_UNLOCK(__HANDLE__) \
122  do{ \
123  (__HANDLE__)->Lock = HAL_UNLOCKED; \
124  }while (0)
125 #endif /* USE_RTOS */
126 
127 #if defined ( __GNUC__ )
128  #ifndef __weak
129  #define __weak __attribute__((weak))
130  #endif /* __weak */
131  #ifndef __packed
132  #define __packed __attribute__((__packed__))
133  #endif /* __packed */
134 #endif /* __GNUC__ */
135 
136 
137 /* Macro to get variable aligned on 4-bytes, for __ICCARM__ the directive "#pragma data_alignment=4" must be used instead */
138 #if defined (__GNUC__) /* GNU Compiler */
139  #ifndef __ALIGN_END
140  #define __ALIGN_END __attribute__ ((aligned (4)))
141  #endif /* __ALIGN_END */
142  #ifndef __ALIGN_BEGIN
143  #define __ALIGN_BEGIN
144  #endif /* __ALIGN_BEGIN */
145 #else
146  #ifndef __ALIGN_END
147  #define __ALIGN_END
148  #endif /* __ALIGN_END */
149  #ifndef __ALIGN_BEGIN
150  #if defined (__CC_ARM) /* ARM Compiler */
151  #define __ALIGN_BEGIN __align(4)
152  #elif defined (__ICCARM__) /* IAR Compiler */
153  #define __ALIGN_BEGIN
154  #endif /* __CC_ARM */
155  #endif /* __ALIGN_BEGIN */
156 #endif /* __GNUC__ */
157 
158 
162 #if defined ( __CC_ARM )
163 /* ARM Compiler
164  ------------
165  RAM functions are defined using the toolchain options.
166  Functions that are executed in RAM should reside in a separate source module.
167  Using the 'Options for File' dialog you can simply change the 'Code / Const'
168  area of a module to a memory space in physical RAM.
169  Available memory areas are declared in the 'Target' tab of the 'Options for Target'
170  dialog.
171 */
172 #define __RAM_FUNC HAL_StatusTypeDef
173 
174 #elif defined ( __ICCARM__ )
175 /* ICCARM Compiler
176  ---------------
177  RAM functions are defined using a specific toolchain keyword "__ramfunc".
178 */
179 #define __RAM_FUNC __ramfunc HAL_StatusTypeDef
180 
181 #elif defined ( __GNUC__ )
182 /* GNU Compiler
183  ------------
184  RAM functions are defined using a specific toolchain attribute
185  "__attribute__((section(".RamFunc")))".
186 */
187 #define __RAM_FUNC HAL_StatusTypeDef __attribute__((section(".RamFunc")))
188 
189 #endif
190 
194 #if defined ( __CC_ARM ) || defined ( __GNUC__ )
195 /* ARM & GNUCompiler
196  ----------------
197 */
198 #define __NOINLINE __attribute__ ( (noinline) )
199 
200 #elif defined ( __ICCARM__ )
201 /* ICCARM Compiler
202  ---------------
203 */
204 #define __NOINLINE _Pragma("optimize = no_inline")
205 
206 #endif
207 
208 #ifdef __cplusplus
209 }
210 #endif
211 
212 #endif /* ___STM32F4xx_HAL_DEF */
213 
214 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
This file contains aliases definition for the STM32Cube HAL constants macros and functions maintained...
CMSIS STM32F4xx Device Peripheral Access Layer Header File.
HAL_StatusTypeDef
HAL Status structures definition.
Definition: stm32f4xx_hal_def.h:57
HAL_LockTypeDef
HAL Lock structures definition.
Definition: stm32f4xx_hal_def.h:68