]> git.gir.st - tmk_keyboard.git/blob - tool/mbed/mbed-sdk/libraries/mbed/targets/cmsis/TARGET_STM/TARGET_STM32F0/stm32f0xx_hal_def.h
Squashed 'tmk_core/' changes from 7967731..b9e0ea0
[tmk_keyboard.git] / tool / mbed / mbed-sdk / libraries / mbed / targets / cmsis / TARGET_STM / TARGET_STM32F0 / stm32f0xx_hal_def.h
1 /**
2 ******************************************************************************
3 * @file stm32f0xx_hal_def.h
4 * @author MCD Application Team
5 * @version V1.2.0
6 * @date 11-December-2014
7 * @brief This file contains HAL common defines, enumeration, macros and
8 * structures definitions.
9 ******************************************************************************
10 * @attention
11 *
12 * <h2><center>&copy; COPYRIGHT(c) 2014 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 __STM32F0xx_HAL_DEF
41 #define __STM32F0xx_HAL_DEF
42
43 #ifdef __cplusplus
44 extern "C" {
45 #endif
46
47 /* Includes ------------------------------------------------------------------*/
48 #include "stm32f0xx.h"
49
50 /* Exported types ------------------------------------------------------------*/
51
52 /**
53 * @brief HAL Status structures definition
54 */
55 typedef enum
56 {
57 HAL_OK = 0x00,
58 HAL_ERROR = 0x01,
59 HAL_BUSY = 0x02,
60 HAL_TIMEOUT = 0x03
61 } HAL_StatusTypeDef;
62
63 /**
64 * @brief HAL Lock structures definition
65 */
66 typedef enum
67 {
68 HAL_UNLOCKED = 0x00,
69 HAL_LOCKED = 0x01
70 } HAL_LockTypeDef;
71
72 /* Exported macro ------------------------------------------------------------*/
73 #ifndef NULL
74 #define NULL 0
75 #endif
76
77 #define HAL_MAX_DELAY 0xFFFFFFFF
78
79 #define HAL_IS_BIT_SET(REG, BIT) (((REG) & (BIT)) != RESET)
80 #define HAL_IS_BIT_CLR(REG, BIT) (((REG) & (BIT)) == RESET)
81
82 #define __HAL_LINKDMA(__HANDLE__, __PPP_DMA_FIELD_, __DMA_HANDLE_) \
83 do{ \
84 (__HANDLE__)->__PPP_DMA_FIELD_ = &(__DMA_HANDLE_); \
85 (__DMA_HANDLE_).Parent = (__HANDLE__); \
86 } while(0)
87
88 #define UNUSED(x) ((void)(x))
89
90 /** @brief Reset the Handle's State field.
91 * @param __HANDLE__: specifies the Peripheral Handle.
92 * @note This macro can be used for the following purpose:
93 * - When the Handle is declared as local variable; before passing it as parameter
94 * to HAL_PPP_Init() for the first time, it is mandatory to use this macro
95 * to set to 0 the Handle's "State" field.
96 * Otherwise, "State" field may have any random value and the first time the function
97 * HAL_PPP_Init() is called, the low level hardware initialization will be missed
98 * (i.e. HAL_PPP_MspInit() will not be executed).
99 * - When there is a need to reconfigure the low level hardware: instead of calling
100 * HAL_PPP_DeInit() then HAL_PPP_Init(), user can make a call to this macro then HAL_PPP_Init().
101 * In this later function, when the Handle's "State" field is set to 0, it will execute the function
102 * HAL_PPP_MspInit() which will reconfigure the low level hardware.
103 * @retval None
104 */
105 #define __HAL_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = 0)
106
107 #if (USE_RTOS == 1)
108 #error " USE_RTOS should be 0 in the current HAL release "
109 #else
110 #define __HAL_LOCK(__HANDLE__) \
111 do{ \
112 if((__HANDLE__)->Lock == HAL_LOCKED) \
113 { \
114 return HAL_BUSY; \
115 } \
116 else \
117 { \
118 (__HANDLE__)->Lock = HAL_LOCKED; \
119 } \
120 }while (0)
121
122 #define __HAL_UNLOCK(__HANDLE__) \
123 do{ \
124 (__HANDLE__)->Lock = HAL_UNLOCKED; \
125 }while (0)
126 #endif /* USE_RTOS */
127
128 #if defined ( __GNUC__ )
129 #ifndef __weak
130 #define __weak __attribute__((weak))
131 #endif /* __weak */
132 #ifndef __packed
133 #define __packed __attribute__((__packed__))
134 #endif /* __packed */
135 #endif /* __GNUC__ */
136
137
138 /* Macro to get variable aligned on 4-bytes, for __ICCARM__ the directive "#pragma data_alignment=4" must be used instead */
139 #if defined (__GNUC__) /* GNU Compiler */
140 #ifndef __ALIGN_END
141 #define __ALIGN_END __attribute__ ((aligned (4)))
142 #endif /* __ALIGN_END */
143 #ifndef __ALIGN_BEGIN
144 #define __ALIGN_BEGIN
145 #endif /* __ALIGN_BEGIN */
146 #else
147 #ifndef __ALIGN_END
148 #define __ALIGN_END
149 #endif /* __ALIGN_END */
150 #ifndef __ALIGN_BEGIN
151 #if defined (__CC_ARM) /* ARM Compiler */
152 #define __ALIGN_BEGIN __align(4)
153 #elif defined (__ICCARM__) /* IAR Compiler */
154 #define __ALIGN_BEGIN
155 #endif /* __CC_ARM */
156 #endif /* __ALIGN_BEGIN */
157 #endif /* __GNUC__ */
158
159 /**
160 * @brief __NOINLINE definition
161 */
162 #if defined ( __CC_ARM ) || defined ( __GNUC__ )
163 /* ARM & GNUCompiler
164 ----------------
165 */
166 #define __NOINLINE __attribute__ ( (noinline) )
167
168 #elif defined ( __ICCARM__ )
169 /* ICCARM Compiler
170 ---------------
171 */
172 #define __NOINLINE _Pragma("optimize = no_inline")
173
174 #endif
175
176 #ifdef __cplusplus
177 }
178 #endif
179
180 #endif /* ___STM32F0xx_HAL_DEF */
181
182 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
183
Imprint / Impressum