STAR
Cal STAR — firmware, DAQ server, and engine design
Loading...
Searching...
No Matches
stm32h7xx_hal_def.h
Go to the documentation of this file.
1/**
2 ******************************************************************************
3 * @file stm32h7xx_hal_def.h
4 * @author MCD Application Team
5 * @brief This file contains HAL common defines, enumeration, macros and
6 * structures definitions.
7 ******************************************************************************
8 * @attention
9 *
10 * Copyright (c) 2017 STMicroelectronics.
11 * All rights reserved.
12 *
13 * This software is licensed under terms that can be found in the LICENSE file
14 * in the root directory of this software component.
15 * If no LICENSE file comes with this software, it is provided AS-IS.
16 *
17 ******************************************************************************
18 */
19
20/* Define to prevent recursive inclusion -------------------------------------*/
21#ifndef STM32H7xx_HAL_DEF
22#define STM32H7xx_HAL_DEF
23
24#ifdef __cplusplus
25 extern "C" {
26#endif
27
28/* Includes ------------------------------------------------------------------*/
29#include "stm32h7xx.h"
31#include <stddef.h>
32#include <math.h>
33
34/* Exported types ------------------------------------------------------------*/
35
36/**
37 * @brief HAL Status structures definition
38 */
39typedef enum
40{
41 HAL_OK = 0x00,
42 HAL_ERROR = 0x01,
43 HAL_BUSY = 0x02,
46
47/**
48 * @brief HAL Lock structures definition
49 */
50typedef enum
51{
55
56/* Exported macro ------------------------------------------------------------*/
57
58#define HAL_MAX_DELAY 0xFFFFFFFFU
59
60#define HAL_IS_BIT_SET(REG, BIT) (((REG) & (BIT)) == (BIT))
61#define HAL_IS_BIT_CLR(REG, BIT) (((REG) & (BIT)) == 0U)
62
63#define __HAL_LINKDMA(__HANDLE__, __PPP_DMA_FIELD__, __DMA_HANDLE__) \
64 do{ \
65 (__HANDLE__)->__PPP_DMA_FIELD__ = &(__DMA_HANDLE__); \
66 (__DMA_HANDLE__).Parent = (__HANDLE__); \
67 } while(0)
68
69#if !defined(UNUSED)
70#define UNUSED(x) ((void)(x)) /* To avoid gcc/g++ warnings */
71#endif /* UNUSED */
72
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.
86 * @retval None
87 */
88#define __HAL_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = 0)
89
90#if (USE_RTOS == 1)
91 #error " USE_RTOS should be 0 in the current HAL release "
92#else
93 #define __HAL_LOCK(__HANDLE__) \
94 do{ \
95 if((__HANDLE__)->Lock == HAL_LOCKED) \
96 { \
97 return HAL_BUSY; \
98 } \
99 else \
100 { \
101 (__HANDLE__)->Lock = HAL_LOCKED; \
102 } \
103 }while (0)
104
105 #define __HAL_UNLOCK(__HANDLE__) \
106 do{ \
107 (__HANDLE__)->Lock = HAL_UNLOCKED; \
108 }while (0)
109#endif /* USE_RTOS */
110
111
112#if defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) /* ARM Compiler V6 */
113 #ifndef __weak
114 #define __weak __attribute__((weak))
115 #endif
116 #ifndef __packed
117 #define __packed __attribute__((packed))
118 #endif
119#elif defined ( __GNUC__ ) && !defined (__CC_ARM) /* GNU Compiler */
120 #ifndef __weak
121 #define __weak __attribute__((weak))
122 #endif /* __weak */
123 #ifndef __packed
124 #define __packed __attribute__((__packed__))
125 #endif /* __packed */
126#endif /* __GNUC__ */
127
128
129/* Macro to get variable aligned on 4-bytes, for __ICCARM__ the directive "#pragma data_alignment=4" must be used instead */
130#if defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) /* ARM Compiler V6 */
131 #ifndef __ALIGN_BEGIN
132 #define __ALIGN_BEGIN
133 #endif
134 #ifndef __ALIGN_END
135 #define __ALIGN_END __attribute__ ((aligned (4)))
136 #endif
137#elif defined ( __GNUC__ ) && !defined (__CC_ARM) /* GNU Compiler */
138 #ifndef __ALIGN_END
139 #define __ALIGN_END __attribute__ ((aligned (4)))
140 #endif /* __ALIGN_END */
141 #ifndef __ALIGN_BEGIN
142 #define __ALIGN_BEGIN
143 #endif /* __ALIGN_BEGIN */
144#else
145 #ifndef __ALIGN_END
146 #define __ALIGN_END
147 #endif /* __ALIGN_END */
148 #ifndef __ALIGN_BEGIN
149 #if defined (__CC_ARM) /* ARM Compiler V5 */
150 #define __ALIGN_BEGIN __align(4)
151 #elif defined (__ICCARM__) /* IAR Compiler */
152 #define __ALIGN_BEGIN
153 #endif /* __CC_ARM */
154 #endif /* __ALIGN_BEGIN */
155#endif /* __GNUC__ */
156
157/* Macro to get variable aligned on 32-bytes,needed for cache maintenance purpose */
158#if defined (__GNUC__) /* GNU Compiler */
159 #define ALIGN_32BYTES(buf) buf __attribute__ ((aligned (32)))
160#elif defined (__ICCARM__) /* IAR Compiler */
161 #define ALIGN_32BYTES(buf) _Pragma("data_alignment=32") buf
162#elif defined (__CC_ARM) /* ARM Compiler */
163 #define ALIGN_32BYTES(buf) __align(32) buf
164#endif
165
166/**
167 * @brief __RAM_FUNC definition
168 */
169#if defined ( __CC_ARM ) || (defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050))
170/* ARM Compiler V4/V5 and V6
171 --------------------------
172 RAM functions are defined using the toolchain options.
173 Functions that are executed in RAM should reside in a separate source module.
174 Using the 'Options for File' dialog you can simply change the 'Code / Const'
175 area of a module to a memory space in physical RAM.
176 Available memory areas are declared in the 'Target' tab of the 'Options for Target'
177 dialog.
178*/
179#define __RAM_FUNC
180
181#elif defined ( __ICCARM__ )
182/* ICCARM Compiler
183 ---------------
184 RAM functions are defined using a specific toolchain keyword "__ramfunc".
185*/
186#define __RAM_FUNC __ramfunc
187
188#elif defined ( __GNUC__ )
189/* GNU Compiler
190 ------------
191 RAM functions are defined using a specific toolchain attribute
192 "__attribute__((section(".RamFunc")))".
193*/
194#define __RAM_FUNC __attribute__((section(".RamFunc")))
195
196#endif
197
198/**
199 * @brief __NOINLINE definition
200 */
201#if defined ( __CC_ARM ) || (defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)) || defined ( __GNUC__ )
202/* ARM V4/V5 and V6 & GNU Compiler
203 -------------------------------
204*/
205#define __NOINLINE __attribute__ ( (noinline) )
206
207#elif defined ( __ICCARM__ )
208/* ICCARM Compiler
209 ---------------
210*/
211#define __NOINLINE _Pragma("optimize = no_inline")
212
213#endif
214
215
216#ifdef __cplusplus
217}
218#endif
219
220#endif /* STM32H7xx_HAL_DEF */
221
222
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.
@ HAL_TIMEOUT
@ HAL_ERROR
@ HAL_OK
@ HAL_BUSY
HAL_LockTypeDef
HAL Lock structures definition.
@ HAL_LOCKED
@ HAL_UNLOCKED