]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/CORTEX_M7_STM32F7_STM32756G-EVAL_IAR_Keil/ST_Library/include/stm32f7xx_hal_def.h
Final V8.2.1 release ready for tagging:
[freertos] / FreeRTOS / Demo / CORTEX_M7_STM32F7_STM32756G-EVAL_IAR_Keil / ST_Library / include / stm32f7xx_hal_def.h
1 /**\r
2   ******************************************************************************\r
3   * @file    stm32f7xx_hal_def.h\r
4   * @author  MCD Application Team\r
5   * @version V1.0.0RC1\r
6   * @date    24-March-2015\r
7   * @brief   This file contains HAL common defines, enumeration, macros and \r
8   *          structures definitions. \r
9   ******************************************************************************\r
10   * @attention\r
11   *\r
12   * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>\r
13   *\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
24   *\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
35   *\r
36   ******************************************************************************\r
37   */\r
38 \r
39 /* Define to prevent recursive inclusion -------------------------------------*/\r
40 #ifndef __STM32F7xx_HAL_DEF\r
41 #define __STM32F7xx_HAL_DEF\r
42 \r
43 #ifdef __cplusplus\r
44  extern "C" {\r
45 #endif\r
46 \r
47 /* Includes ------------------------------------------------------------------*/\r
48 #include "stm32f7xx.h"\r
49 #include "Legacy/stm32_hal_legacy.h"\r
50 #include <stdio.h>\r
51 /* Exported types ------------------------------------------------------------*/\r
52 \r
53 /** \r
54   * @brief  HAL Status structures definition  \r
55   */  \r
56 typedef enum \r
57 {\r
58   HAL_OK       = 0x00,\r
59   HAL_ERROR    = 0x01,\r
60   HAL_BUSY     = 0x02,\r
61   HAL_TIMEOUT  = 0x03\r
62 } HAL_StatusTypeDef;\r
63 \r
64 /** \r
65   * @brief  HAL Lock structures definition  \r
66   */\r
67 typedef enum \r
68 {\r
69   HAL_UNLOCKED = 0x00,\r
70   HAL_LOCKED   = 0x01  \r
71 } HAL_LockTypeDef;\r
72 \r
73 /* Exported macro ------------------------------------------------------------*/\r
74 #define HAL_MAX_DELAY      0xFFFFFFFF\r
75 \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
78 \r
79 #define __HAL_LINKDMA(__HANDLE__, __PPP_DMA_FIELD__, __DMA_HANDLE__)               \\r
80                         do{                                                      \\r
81                               (__HANDLE__)->__PPP_DMA_FIELD__ = &(__DMA_HANDLE__); \\r
82                               (__DMA_HANDLE__).Parent = (__HANDLE__);             \\r
83                           } while(0)\r
84 \r
85 #define UNUSED(x) ((void)(x))\r
86 \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
100   * @retval None\r
101   */\r
102 #define __HAL_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = 0)\r
103 \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
107 #else\r
108   #define __HAL_LOCK(__HANDLE__)                                           \\r
109                                 do{                                        \\r
110                                     if((__HANDLE__)->Lock == HAL_LOCKED)   \\r
111                                     {                                      \\r
112                                        return HAL_BUSY;                    \\r
113                                     }                                      \\r
114                                     else                                   \\r
115                                     {                                      \\r
116                                        (__HANDLE__)->Lock = HAL_LOCKED;    \\r
117                                     }                                      \\r
118                                   }while (0)\r
119 \r
120   #define __HAL_UNLOCK(__HANDLE__)                                          \\r
121                                   do{                                       \\r
122                                       (__HANDLE__)->Lock = HAL_UNLOCKED;    \\r
123                                     }while (0)\r
124 #endif /* USE_RTOS */\r
125 \r
126 #if  defined ( __GNUC__ )\r
127   #ifndef __weak\r
128     #define __weak   __attribute__((weak))\r
129   #endif /* __weak */\r
130   #ifndef __packed\r
131     #define __packed __attribute__((__packed__))\r
132   #endif /* __packed */\r
133 #endif /* __GNUC__ */\r
134 \r
135 \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
144 #else\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
156 \r
157 \r
158 /** \r
159   * @brief  __RAM_FUNC definition\r
160   */ \r
161 #if defined ( __CC_ARM   )\r
162 /* ARM Compiler\r
163    ------------\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
169    dialog. \r
170 */\r
171 #define __RAM_FUNC HAL_StatusTypeDef \r
172 \r
173 #elif defined ( __ICCARM__ )\r
174 /* ICCARM Compiler\r
175    ---------------\r
176    RAM functions are defined using a specific toolchain keyword "__ramfunc". \r
177 */\r
178 #define __RAM_FUNC __ramfunc HAL_StatusTypeDef\r
179 \r
180 #elif defined   (  __GNUC__  )\r
181 /* GNU Compiler\r
182    ------------\r
183   RAM functions are defined using a specific toolchain attribute \r
184    "__attribute__((section(".RamFunc")))".\r
185 */\r
186 #define __RAM_FUNC HAL_StatusTypeDef  __attribute__((section(".RamFunc")))\r
187 \r
188 #endif\r
189 \r
190 /** \r
191   * @brief  __NOINLINE definition\r
192   */ \r
193 #if defined ( __CC_ARM   ) || defined   (  __GNUC__  )\r
194 /* ARM & GNUCompiler \r
195    ---------------- \r
196 */\r
197 #define __NOINLINE __attribute__ ( (noinline) )\r
198 \r
199 #elif defined ( __ICCARM__ )\r
200 /* ICCARM Compiler\r
201    ---------------\r
202 */\r
203 #define __NOINLINE _Pragma("optimize = no_inline")\r
204 \r
205 #endif\r
206 \r
207 #ifdef __cplusplus\r
208 }\r
209 #endif\r
210 \r
211 #endif /* ___STM32F7xx_HAL_DEF */\r
212 \r
213 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/\r