]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/CORTEX_MPU_M3_NUCLEO_L152RE_GCC/ST_Code/Drivers/STM32L1xx_HAL_Driver/Inc/stm32l1xx_hal_def.h
Add MPU demo project for Nulceo-L152RE which is Coretx-M3.
[freertos] / FreeRTOS / Demo / CORTEX_MPU_M3_NUCLEO_L152RE_GCC / ST_Code / Drivers / STM32L1xx_HAL_Driver / Inc / stm32l1xx_hal_def.h
1 /**\r
2   ******************************************************************************\r
3   * @file    stm32l1xx_hal_def.h\r
4   * @author  MCD Application Team\r
5   * @brief   This file contains HAL common defines, enumeration, macros and\r
6   *          structures definitions.\r
7   ******************************************************************************\r
8   * @attention\r
9   *\r
10   * <h2><center>&copy; Copyright (c) 2017 STMicroelectronics.\r
11   * All rights reserved.</center></h2>\r
12   *\r
13   * This software component is licensed by ST under BSD 3-Clause license,\r
14   * the "License"; You may not use this file except in compliance with the\r
15   * License. You may obtain a copy of the License at:\r
16   *                        opensource.org/licenses/BSD-3-Clause\r
17   *\r
18   ******************************************************************************\r
19   */\r
20 \r
21 /* Define to prevent recursive inclusion -------------------------------------*/\r
22 #ifndef __STM32L1xx_HAL_DEF\r
23 #define __STM32L1xx_HAL_DEF\r
24 \r
25 #ifdef __cplusplus\r
26  extern "C" {\r
27 #endif\r
28 \r
29 /* Includes ------------------------------------------------------------------*/\r
30 #include "stm32l1xx.h"\r
31 #include "Legacy/stm32_hal_legacy.h"\r
32 #include <stddef.h>\r
33 \r
34 /* Exported types ------------------------------------------------------------*/\r
35 \r
36 /**\r
37   * @brief  HAL Status structures definition\r
38   */\r
39 typedef enum\r
40 {\r
41   HAL_OK       = 0x00U,\r
42   HAL_ERROR    = 0x01U,\r
43   HAL_BUSY     = 0x02U,\r
44   HAL_TIMEOUT  = 0x03U\r
45 } HAL_StatusTypeDef;\r
46 \r
47 /**\r
48   * @brief  HAL Lock structures definition\r
49   */\r
50 typedef enum\r
51 {\r
52   HAL_UNLOCKED = 0x00U,\r
53   HAL_LOCKED   = 0x01U\r
54 } HAL_LockTypeDef;\r
55 \r
56 /* Exported macro ------------------------------------------------------------*/\r
57 \r
58 #define UNUSED(X) (void)X      /* To avoid gcc/g++ warnings */\r
59 \r
60 #define HAL_MAX_DELAY      0xFFFFFFFFU\r
61 \r
62 #define HAL_IS_BIT_SET(REG, BIT)         (((REG) & (BIT)) == (BIT))\r
63 #define HAL_IS_BIT_CLR(REG, BIT)         (((REG) & (BIT)) == 0U)\r
64 \r
65 #define __HAL_LINKDMA(__HANDLE__, __PPP_DMA_FIELD_, __DMA_HANDLE_)           \\r
66                         do{                                                  \\r
67                               (__HANDLE__)->__PPP_DMA_FIELD_ = &(__DMA_HANDLE_); \\r
68                               (__DMA_HANDLE_).Parent = (__HANDLE__);             \\r
69                           } while(0)\r
70 \r
71 /** @brief Reset the Handle's State field.\r
72   * @param __HANDLE__: specifies the Peripheral Handle.\r
73   * @note  This macro can be used for the following purpose:\r
74   *          - When the Handle is declared as local variable; before passing it as parameter\r
75   *            to HAL_PPP_Init() for the first time, it is mandatory to use this macro\r
76   *            to set to 0 the Handle's "State" field.\r
77   *            Otherwise, "State" field may have any random value and the first time the function\r
78   *            HAL_PPP_Init() is called, the low level hardware initialization will be missed\r
79   *            (i.e. HAL_PPP_MspInit() will not be executed).\r
80   *          - When there is a need to reconfigure the low level hardware: instead of calling\r
81   *            HAL_PPP_DeInit() then HAL_PPP_Init(), user can make a call to this macro then HAL_PPP_Init().\r
82   *            In this later function, when the Handle's "State" field is set to 0, it will execute the function\r
83   *            HAL_PPP_MspInit() which will reconfigure the low level hardware.\r
84   * @retval None\r
85   */\r
86 #define __HAL_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = 0U)\r
87 \r
88 #if (USE_RTOS == 1)\r
89 \r
90   /* Reserved for future use */\r
91   #error "USE_RTOS should be 0 in the current HAL release"\r
92 \r
93 #else\r
94   #define __HAL_LOCK(__HANDLE__)                                               \\r
95                                 do{                                            \\r
96                                     if((__HANDLE__)->Lock == HAL_LOCKED)       \\r
97                                     {                                          \\r
98                                        return HAL_BUSY;                        \\r
99                                     }                                          \\r
100                                     else                                       \\r
101                                     {                                          \\r
102                                        (__HANDLE__)->Lock = HAL_LOCKED;        \\r
103                                     }                                          \\r
104                                   }while (0)\r
105 \r
106   #define __HAL_UNLOCK(__HANDLE__)                                             \\r
107                                   do{                                          \\r
108                                       (__HANDLE__)->Lock = HAL_UNLOCKED;       \\r
109                                     }while (0)\r
110 #endif /* USE_RTOS */\r
111 \r
112 #if  defined ( __GNUC__ ) && !defined (__CC_ARM) /* GNU Compiler */\r
113   #ifndef __weak\r
114     #define __weak   __attribute__((weak))\r
115   #endif /* __weak */\r
116   #ifndef __packed\r
117     #define __packed __attribute__((__packed__))\r
118   #endif /* __packed */\r
119 #endif /* __GNUC__ */\r
120 \r
121 \r
122 /* Macro to get variable aligned on 4-bytes, for __ICCARM__ the directive "#pragma data_alignment=4" must be used instead */\r
123 #if defined   (__GNUC__) && !defined (__CC_ARM) /* GNU Compiler */\r
124   #ifndef __ALIGN_END\r
125     #define __ALIGN_END    __attribute__ ((aligned (4)))\r
126   #endif /* __ALIGN_END */\r
127   #ifndef __ALIGN_BEGIN\r
128     #define __ALIGN_BEGIN\r
129   #endif /* __ALIGN_BEGIN */\r
130 #else\r
131   #ifndef __ALIGN_END\r
132     #define __ALIGN_END\r
133   #endif /* __ALIGN_END */\r
134   #ifndef __ALIGN_BEGIN\r
135     #if defined   (__CC_ARM)      /* ARM Compiler */\r
136       #define __ALIGN_BEGIN    __align(4)\r
137     #elif defined (__ICCARM__)    /* IAR Compiler */\r
138       #define __ALIGN_BEGIN\r
139     #endif /* __CC_ARM */\r
140   #endif /* __ALIGN_BEGIN */\r
141 #endif /* __GNUC__ */\r
142 \r
143 /**\r
144   * @brief  __RAM_FUNC definition\r
145   */\r
146 #if defined ( __CC_ARM   )\r
147 /* ARM Compiler\r
148    ------------\r
149    RAM functions are defined using the toolchain options.\r
150    Functions that are executed in RAM should reside in a separate source module.\r
151    Using the 'Options for File' dialog you can simply change the 'Code / Const'\r
152    area of a module to a memory space in physical RAM.\r
153    Available memory areas are declared in the 'Target' tab of the 'Options for Target'\r
154    dialog.\r
155 */\r
156 #define __RAM_FUNC\r
157 \r
158 #elif defined ( __ICCARM__ )\r
159 /* ICCARM Compiler\r
160    ---------------\r
161    RAM functions are defined using a specific toolchain keyword "__ramfunc".\r
162 */\r
163 #define __RAM_FUNC __ramfunc\r
164 \r
165 #elif defined   (  __GNUC__  )\r
166 /* GNU Compiler\r
167    ------------\r
168   RAM functions are defined using a specific toolchain attribute\r
169    "__attribute__((section(".RamFunc")))".\r
170 */\r
171 #define __RAM_FUNC  __attribute__((section(".RamFunc")))\r
172 \r
173 #endif\r
174 \r
175 /**\r
176   * @brief  __NOINLINE definition\r
177   */\r
178 #if defined ( __CC_ARM   ) || defined   (  __GNUC__  )\r
179 /* ARM & GNUCompiler\r
180    ----------------\r
181 */\r
182 #define __NOINLINE __attribute__ ( (noinline) )\r
183 \r
184 #elif defined ( __ICCARM__ )\r
185 /* ICCARM Compiler\r
186    ---------------\r
187 */\r
188 #define __NOINLINE _Pragma("optimize = no_inline")\r
189 \r
190 #endif\r
191 \r
192 #ifdef __cplusplus\r
193 }\r
194 #endif\r
195 \r
196 #endif /* ___STM32L1xx_HAL_DEF */\r
197 \r
198 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/\r