Rev 2 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2 | Rev 6 | ||
---|---|---|---|
Line 26... | Line 26... | ||
26 | extern "C" { |
26 | extern "C" { |
27 | #endif |
27 | #endif |
28 | 28 | ||
29 | /* Includes ------------------------------------------------------------------*/ |
29 | /* Includes ------------------------------------------------------------------*/ |
30 | #include "stm32f0xx.h" |
30 | #include "stm32f0xx.h" |
31 | #if defined(USE_HAL_LEGACY) |
- | |
32 | #include "Legacy/stm32_hal_legacy.h" |
31 | #include "Legacy/stm32_hal_legacy.h" |
33 | #endif |
- | |
34 | #include <stddef.h> |
32 | #include <stddef.h> |
35 | 33 | ||
36 | /* Exported types ------------------------------------------------------------*/ |
34 | /* Exported types ------------------------------------------------------------*/ |
37 | 35 | ||
38 | /** |
36 | /** |
Line 55... | Line 53... | ||
55 | HAL_LOCKED = 0x01U |
53 | HAL_LOCKED = 0x01U |
56 | } HAL_LockTypeDef; |
54 | } HAL_LockTypeDef; |
57 | 55 | ||
58 | /* Exported macro ------------------------------------------------------------*/ |
56 | /* Exported macro ------------------------------------------------------------*/ |
59 | 57 | ||
- | 58 | #define UNUSED(X) (void)X /* To avoid gcc/g++ warnings */ |
|
- | 59 | ||
60 | #define HAL_MAX_DELAY 0xFFFFFFFFU |
60 | #define HAL_MAX_DELAY 0xFFFFFFFFU |
61 | 61 | ||
62 | #define HAL_IS_BIT_SET(REG, BIT) (((REG) & (BIT)) == (BIT)) |
62 | #define HAL_IS_BIT_SET(REG, BIT) (((REG) & (BIT)) == (BIT)) |
63 | #define HAL_IS_BIT_CLR(REG, BIT) (((REG) & (BIT)) == 0U) |
63 | #define HAL_IS_BIT_CLR(REG, BIT) (((REG) & (BIT)) == 0U) |
64 | 64 | ||
65 | #define __HAL_LINKDMA(__HANDLE__, __PPP_DMA_FIELD_, __DMA_HANDLE_) \ |
65 | #define __HAL_LINKDMA(__HANDLE__, __PPP_DMA_FIELD__, __DMA_HANDLE__) \ |
66 | do{ \ |
66 | do{ \ |
67 | (__HANDLE__)->__PPP_DMA_FIELD_ = &(__DMA_HANDLE_); \ |
67 | (__HANDLE__)->__PPP_DMA_FIELD__ = &(__DMA_HANDLE__); \ |
68 | (__DMA_HANDLE_).Parent = (__HANDLE__); \ |
68 | (__DMA_HANDLE__).Parent = (__HANDLE__); \ |
69 | } while(0) |
69 | } while(0U) |
70 | - | ||
71 | #define UNUSED(X) (void)X /* To avoid gcc/g++ warnings */ |
- | |
72 | 70 | ||
73 | /** @brief Reset the Handle's State field. |
71 | /** @brief Reset the Handle's State field. |
74 | * @param __HANDLE__ specifies the Peripheral Handle. |
72 | * @param __HANDLE__ specifies the Peripheral Handle. |
75 | * @note This macro can be used for the following purpose: |
73 | * @note This macro can be used for the following purpose: |
76 | * - When the Handle is declared as local variable; before passing it as parameter |
74 | * - When the Handle is declared as local variable; before passing it as parameter |
Line 83... | Line 81... | ||
83 | * HAL_PPP_DeInit() then HAL_PPP_Init(), user can make a call to this macro then HAL_PPP_Init(). |
81 | * 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 |
82 | * 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. |
83 | * HAL_PPP_MspInit() which will reconfigure the low level hardware. |
86 | * @retval None |
84 | * @retval None |
87 | */ |
85 | */ |
88 | #define __HAL_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = 0) |
86 | #define __HAL_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = 0U) |
89 | 87 | ||
90 | #if (USE_RTOS == 1) |
88 | #if (USE_RTOS == 1U) |
- | 89 | /* Reserved for future use */ |
|
91 | #error " USE_RTOS should be 0 in the current HAL release " |
90 | #error " USE_RTOS should be 0 in the current HAL release " |
92 | #else |
91 | #else |
93 | #define __HAL_LOCK(__HANDLE__) \ |
92 | #define __HAL_LOCK(__HANDLE__) \ |
94 | do{ \ |
93 | do{ \ |
95 | if((__HANDLE__)->Lock == HAL_LOCKED) \ |
94 | if((__HANDLE__)->Lock == HAL_LOCKED) \ |
Line 98... | Line 97... | ||
98 | } \ |
97 | } \ |
99 | else \ |
98 | else \ |
100 | { \ |
99 | { \ |
101 | (__HANDLE__)->Lock = HAL_LOCKED; \ |
100 | (__HANDLE__)->Lock = HAL_LOCKED; \ |
102 | } \ |
101 | } \ |
103 | }while (0) |
102 | }while (0U) |
104 | 103 | ||
105 | #define __HAL_UNLOCK(__HANDLE__) \ |
104 | #define __HAL_UNLOCK(__HANDLE__) \ |
106 | do{ \ |
105 | do{ \ |
107 | (__HANDLE__)->Lock = HAL_UNLOCKED; \ |
106 | (__HANDLE__)->Lock = HAL_UNLOCKED; \ |
108 | }while (0) |
107 | }while (0U) |
109 | #endif /* USE_RTOS */ |
108 | #endif /* USE_RTOS */ |
110 | 109 | ||
- | 110 | #if defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) /* ARM Compiler V6 */ |
|
- | 111 | #ifndef __weak |
|
- | 112 | #define __weak __attribute__((weak)) |
|
- | 113 | #endif |
|
111 | #if defined ( __GNUC__ ) |
114 | #ifndef __packed |
- | 115 | #define __packed __attribute__((packed)) |
|
- | 116 | #endif |
|
- | 117 | #elif defined ( __GNUC__ ) && !defined (__CC_ARM) /* GNU Compiler */ |
|
112 | #ifndef __weak |
118 | #ifndef __weak |
113 | #define __weak __attribute__((weak)) |
119 | #define __weak __attribute__((weak)) |
114 | #endif /* __weak */ |
120 | #endif /* __weak */ |
115 | #ifndef __packed |
121 | #ifndef __packed |
116 | #define __packed __attribute__((__packed__)) |
122 | #define __packed __attribute__((__packed__)) |
117 | #endif /* __packed */ |
123 | #endif /* __packed */ |
118 | #endif /* __GNUC__ */ |
124 | #endif /* __GNUC__ */ |
119 | 125 | ||
120 | 126 | ||
121 | /* Macro to get variable aligned on 4-bytes, for __ICCARM__ the directive "#pragma data_alignment=4" must be used instead */ |
127 | /* Macro to get variable aligned on 4-bytes, for __ICCARM__ the directive "#pragma data_alignment=4" must be used instead */ |
- | 128 | #if defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) /* ARM Compiler V6 */ |
|
- | 129 | #ifndef __ALIGN_BEGIN |
|
- | 130 | #define __ALIGN_BEGIN |
|
- | 131 | #endif |
|
- | 132 | #ifndef __ALIGN_END |
|
- | 133 | #define __ALIGN_END __attribute__ ((aligned (4))) |
|
- | 134 | #endif |
|
122 | #if defined (__GNUC__) /* GNU Compiler */ |
135 | #elif defined ( __GNUC__ ) && !defined (__CC_ARM) /* GNU Compiler */ |
123 | #ifndef __ALIGN_END |
136 | #ifndef __ALIGN_END |
124 | #define __ALIGN_END __attribute__ ((aligned (4))) |
137 | #define __ALIGN_END __attribute__ ((aligned (4))) |
125 | #endif /* __ALIGN_END */ |
138 | #endif /* __ALIGN_END */ |
126 | #ifndef __ALIGN_BEGIN |
139 | #ifndef __ALIGN_BEGIN |
127 | #define __ALIGN_BEGIN |
140 | #define __ALIGN_BEGIN |
Line 129... | Line 142... | ||
129 | #else |
142 | #else |
130 | #ifndef __ALIGN_END |
143 | #ifndef __ALIGN_END |
131 | #define __ALIGN_END |
144 | #define __ALIGN_END |
132 | #endif /* __ALIGN_END */ |
145 | #endif /* __ALIGN_END */ |
133 | #ifndef __ALIGN_BEGIN |
146 | #ifndef __ALIGN_BEGIN |
134 | #if defined (__CC_ARM) /* ARM Compiler */ |
147 | #if defined (__CC_ARM) /* ARM Compiler V5*/ |
135 | #define __ALIGN_BEGIN __align(4) |
148 | #define __ALIGN_BEGIN __align(4) |
136 | #elif defined (__ICCARM__) /* IAR Compiler */ |
149 | #elif defined (__ICCARM__) /* IAR Compiler */ |
137 | #define __ALIGN_BEGIN |
150 | #define __ALIGN_BEGIN |
138 | #endif /* __CC_ARM */ |
151 | #endif /* __CC_ARM */ |
139 | #endif /* __ALIGN_BEGIN */ |
152 | #endif /* __ALIGN_BEGIN */ |
140 | #endif /* __GNUC__ */ |
153 | #endif /* __GNUC__ */ |
141 | 154 | ||
142 | /** |
155 | /** |
143 | * @brief __NOINLINE definition |
156 | * @brief __NOINLINE definition |
144 | */ |
157 | */ |
145 | #if defined ( __CC_ARM ) || defined ( __GNUC__ ) |
158 | #if defined ( __CC_ARM ) || (defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)) || defined ( __GNUC__ ) |
146 | /* ARM & GNUCompiler |
159 | /* ARM V4/V5 and V6 & GNU Compiler |
147 | ---------------- |
160 | ------------------------------- |
148 | */ |
161 | */ |
149 | #define __NOINLINE __attribute__ ( (noinline) ) |
162 | #define __NOINLINE __attribute__ ( (noinline) ) |
150 | 163 | ||
151 | #elif defined ( __ICCARM__ ) |
164 | #elif defined ( __ICCARM__ ) |
152 | /* ICCARM Compiler |
165 | /* ICCARM Compiler |
Line 161... | Line 174... | ||
161 | #endif |
174 | #endif |
162 | 175 | ||
163 | #endif /* ___STM32F0xx_HAL_DEF */ |
176 | #endif /* ___STM32F0xx_HAL_DEF */ |
164 | 177 | ||
165 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |
178 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |
166 | - |