rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
stm32f7xx_hal_def.h
Go to the documentation of this file.
1/**
2 ******************************************************************************
3 * @file stm32f7xx_hal_def.h
4 * @author MCD Application Team
5 * @version V1.2.0
6 * @date 30-December-2016
7 * @brief This file contains HAL common defines, enumeration, macros and
8 * structures definitions.
9 ******************************************************************************
10 * @attention
11 *
12 * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
13 *
14 * Redistribution and use in source and binary forms, with or without modification,
15 * are permitted provided that the following conditions are met:
16 * 1. Redistributions of source code must retain the above copyright notice,
17 * this list of conditions and the following disclaimer.
18 * 2. Redistributions in binary form must reproduce the above copyright notice,
19 * this list of conditions and the following disclaimer in the documentation
20 * and/or other materials provided with the distribution.
21 * 3. Neither the name of STMicroelectronics nor the names of its contributors
22 * may be used to endorse or promote products derived from this software
23 * without specific prior written permission.
24 *
25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
26 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
28 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
29 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
30 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
31 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
32 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
33 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
34 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35 *
36 ******************************************************************************
37 */
38
39/* Define to prevent recursive inclusion -------------------------------------*/
40#ifndef __STM32F7xx_HAL_DEF
41#define __STM32F7xx_HAL_DEF
42
43#ifdef __cplusplus
44 extern "C" {
45#endif
46
47/* Includes ------------------------------------------------------------------*/
48#include "stm32f7xx.h"
49//#include "Legacy/stm32_hal_legacy.h"
50#include <stdio.h>
51/* Exported types ------------------------------------------------------------*/
52
53/**
54 * @brief HAL Status structures definition
55 */
56typedef enum
57{
58 HAL_OK = 0x00U,
59 HAL_ERROR = 0x01U,
60 HAL_BUSY = 0x02U,
61 HAL_TIMEOUT = 0x03U
62} HAL_StatusTypeDef;
63
64/**
65 * @brief HAL Lock structures definition
66 */
67typedef enum
68{
70 HAL_LOCKED = 0x01
72
73/* Exported macro ------------------------------------------------------------*/
74#define HAL_MAX_DELAY 0xFFFFFFFFU
75
76#define HAL_IS_BIT_SET(REG, BIT) (((REG) & (BIT)) != RESET)
77#define HAL_IS_BIT_CLR(REG, BIT) (((REG) & (BIT)) == RESET)
78
79#define __HAL_LINKDMA(__HANDLE__, __PPP_DMA_FIELD__, __DMA_HANDLE__) \
80 do{ \
81 (__HANDLE__)->__PPP_DMA_FIELD__ = &(__DMA_HANDLE__); \
82 (__DMA_HANDLE__).Parent = (__HANDLE__); \
83 } while(0)
84
85//#define UNUSED(x) ((void)(x))
86
87/** @brief Reset the Handle's State field.
88 * @param __HANDLE__: specifies the Peripheral Handle.
89 * @note This macro can be used for the following purpose:
90 * - When the Handle is declared as local variable; before passing it as parameter
91 * to HAL_PPP_Init() for the first time, it is mandatory to use this macro
92 * to set to 0 the Handle's "State" field.
93 * Otherwise, "State" field may have any random value and the first time the function
94 * HAL_PPP_Init() is called, the low level hardware initialization will be missed
95 * (i.e. HAL_PPP_MspInit() will not be executed).
96 * - When there is a need to reconfigure the low level hardware: instead of calling
97 * HAL_PPP_DeInit() then HAL_PPP_Init(), user can make a call to this macro then HAL_PPP_Init().
98 * In this later function, when the Handle's "State" field is set to 0, it will execute the function
99 * HAL_PPP_MspInit() which will reconfigure the low level hardware.
100 * @retval None
101 */
102#define __HAL_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = 0U)
103
104#ifndef USE_RTOS
105#define USE_RTOS 0
106#endif
107
108#if (USE_RTOS == 1)
109 /* Reserved for future use */
110 #error "USE_RTOS should be 0 in the current HAL release"
111#else
112 #define __HAL_LOCK(__HANDLE__) \
113 do{ \
114 if((__HANDLE__)->Lock == HAL_LOCKED) \
115 { \
116 return HAL_BUSY; \
117 } \
118 else \
119 { \
120 (__HANDLE__)->Lock = HAL_LOCKED; \
121 } \
122 }while (0)
123
124 #define __HAL_UNLOCK(__HANDLE__) \
125 do{ \
126 (__HANDLE__)->Lock = HAL_UNLOCKED; \
127 }while (0)
128#endif /* USE_RTOS */
129
130#if defined ( __GNUC__ )
131 #ifndef __weak
132 #define __weak __attribute__((weak))
133 #endif /* __weak */
134 #ifndef __packed
135 #define __packed __attribute__((__packed__))
136 #endif /* __packed */
137#endif /* __GNUC__ */
138
139
140/* Macro to get variable aligned on 4-bytes, for __ICCARM__ the directive "#pragma data_alignment=4" must be used instead */
141#if defined (__GNUC__) /* GNU Compiler */
142 #ifndef __ALIGN_END
143 #define __ALIGN_END __attribute__ ((aligned (4)))
144 #endif /* __ALIGN_END */
145 #ifndef __ALIGN_BEGIN
146 #define __ALIGN_BEGIN
147 #endif /* __ALIGN_BEGIN */
148#else
149 #ifndef __ALIGN_END
150 #define __ALIGN_END
151 #endif /* __ALIGN_END */
152 #ifndef __ALIGN_BEGIN
153 #if defined (__CC_ARM) /* ARM Compiler */
154 #define __ALIGN_BEGIN __align(4)
155 #elif defined (__ICCARM__) /* IAR Compiler */
156 #define __ALIGN_BEGIN
157 #endif /* __CC_ARM */
158 #endif /* __ALIGN_BEGIN */
159#endif /* __GNUC__ */
160
161
162/**
163 * @brief __RAM_FUNC definition
164 */
165#if defined ( __CC_ARM )
166/* ARM Compiler
167 ------------
168 RAM functions are defined using the toolchain options.
169 Functions that are executed in RAM should reside in a separate source module.
170 Using the 'Options for File' dialog you can simply change the 'Code / Const'
171 area of a module to a memory space in physical RAM.
172 Available memory areas are declared in the 'Target' tab of the 'Options for Target'
173 dialog.
174*/
175#define __RAM_FUNC HAL_StatusTypeDef
176
177#elif defined ( __ICCARM__ )
178/* ICCARM Compiler
179 ---------------
180 RAM functions are defined using a specific toolchain keyword "__ramfunc".
181*/
182#define __RAM_FUNC __ramfunc HAL_StatusTypeDef
183
184#elif defined ( __GNUC__ )
185/* GNU Compiler
186 ------------
187 RAM functions are defined using a specific toolchain attribute
188 "__attribute__((section(".RamFunc")))".
189*/
190#define __RAM_FUNC HAL_StatusTypeDef __attribute__((section(".RamFunc")))
191
192#endif
193
194/**
195 * @brief __NOINLINE definition
196 */
197#if defined ( __CC_ARM ) || defined ( __GNUC__ )
198/* ARM & GNUCompiler
199 ----------------
200*/
201#define __NOINLINE __attribute__ ( (noinline) )
202
203#elif defined ( __ICCARM__ )
204/* ICCARM Compiler
205 ---------------
206*/
207#define __NOINLINE _Pragma("optimize = no_inline")
208
209#endif
210
211#ifdef __cplusplus
212}
213#endif
214
215#endif /* ___STM32F7xx_HAL_DEF */
216
217/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
HAL_LockTypeDef
HAL Lock structures definition.
@ HAL_LOCKED
@ HAL_UNLOCKED