mikroSDK Reference Manual
stm32f1xx_hal_def.h
Go to the documentation of this file.
1
21/* Define to prevent recursive inclusion -------------------------------------*/
22#ifndef __STM32F1xx_HAL_DEF
23#define __STM32F1xx_HAL_DEF
24
25#ifdef __cplusplus
26extern "C" {
27#endif
28
29/* Includes ------------------------------------------------------------------*/
30#include "stm32f1xx.h"
32#include <stddef.h>
33
34/* Exported types ------------------------------------------------------------*/
35
39typedef enum
40{
41 HAL_OK = 0x00U,
42 HAL_ERROR = 0x01U,
43 HAL_BUSY = 0x02U,
44 HAL_TIMEOUT = 0x03U
46
50typedef enum
51{
52 HAL_UNLOCKED = 0x00U,
53 HAL_LOCKED = 0x01U
55
56/* Exported macro ------------------------------------------------------------*/
57#define HAL_MAX_DELAY 0xFFFFFFFFU
58
59#define HAL_IS_BIT_SET(REG, BIT) (((REG) & (BIT)) != 0U)
60#define HAL_IS_BIT_CLR(REG, BIT) (((REG) & (BIT)) == 0U)
61
62#define __HAL_LINKDMA(__HANDLE__, __PPP_DMA_FIELD__, __DMA_HANDLE__) \
63 do{ \
64 (__HANDLE__)->__PPP_DMA_FIELD__ = &(__DMA_HANDLE__); \
65 (__DMA_HANDLE__).Parent = (__HANDLE__); \
66 } while(0U)
67
68#define UNUSED(X) (void)X /* To avoid gcc/g++ warnings */
69
85#define __HAL_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = 0U)
86
87#if (USE_RTOS == 1U)
88/* Reserved for future use */
89#error "USE_RTOS should be 0 in the current HAL release"
90#else
91#define __HAL_LOCK(__HANDLE__) \
92 do{ \
93 if((__HANDLE__)->Lock == HAL_LOCKED) \
94 { \
95 return HAL_BUSY; \
96 } \
97 else \
98 { \
99 (__HANDLE__)->Lock = HAL_LOCKED; \
100 } \
101 }while (0U)
102
103#define __HAL_UNLOCK(__HANDLE__) \
104 do{ \
105 (__HANDLE__)->Lock = HAL_UNLOCKED; \
106 }while (0U)
107#endif /* USE_RTOS */
108
109#if defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) /* ARM Compiler V6 */
110#ifndef __weak
111#define __weak __attribute__((weak))
112#endif
113#ifndef __packed
114#define __packed __attribute__((packed))
115#endif
116#elif defined ( __GNUC__ ) && !defined (__CC_ARM) /* GNU Compiler */
117#ifndef __weak
118#define __weak __attribute__((weak))
119#endif /* __weak */
120#ifndef __packed
121#define __packed __attribute__((__packed__))
122#endif /* __packed */
123#endif /* __GNUC__ */
124
125
126/* Macro to get variable aligned on 4-bytes, for __ICCARM__ the directive "#pragma data_alignment=4" must be used instead */
127#if defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) /* ARM Compiler V6 */
128#ifndef __ALIGN_BEGIN
129#define __ALIGN_BEGIN
130#endif
131#ifndef __ALIGN_END
132#define __ALIGN_END __attribute__ ((aligned (4)))
133#endif
134#elif defined ( __GNUC__ ) && !defined (__CC_ARM) /* GNU Compiler */
135#ifndef __ALIGN_END
136#define __ALIGN_END __attribute__ ((aligned (4)))
137#endif /* __ALIGN_END */
138#ifndef __ALIGN_BEGIN
139#define __ALIGN_BEGIN
140#endif /* __ALIGN_BEGIN */
141#else
142#ifndef __ALIGN_END
143#define __ALIGN_END
144#endif /* __ALIGN_END */
145#ifndef __ALIGN_BEGIN
146#if defined (__CC_ARM) /* ARM Compiler V5*/
147#define __ALIGN_BEGIN __align(4)
148#elif defined (__ICCARM__) /* IAR Compiler */
149#define __ALIGN_BEGIN
150#endif /* __CC_ARM */
151#endif /* __ALIGN_BEGIN */
152#endif /* __GNUC__ */
153
154
158#if defined ( __CC_ARM ) || (defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050))
159/* ARM Compiler V4/V5 and V6
160 --------------------------
161 RAM functions are defined using the toolchain options.
162 Functions that are executed in RAM should reside in a separate source module.
163 Using the 'Options for File' dialog you can simply change the 'Code / Const'
164 area of a module to a memory space in physical RAM.
165 Available memory areas are declared in the 'Target' tab of the 'Options for Target'
166 dialog.
167*/
168#define __RAM_FUNC
169
170#elif defined ( __ICCARM__ )
171/* ICCARM Compiler
172 ---------------
173 RAM functions are defined using a specific toolchain keyword "__ramfunc".
174*/
175#define __RAM_FUNC __ramfunc
176
177#elif defined ( __GNUC__ )
178/* GNU Compiler
179 ------------
180 RAM functions are defined using a specific toolchain attribute
181 "__attribute__((section(".RamFunc")))".
182*/
183#define __RAM_FUNC __attribute__((section(".RamFunc")))
184
185#endif
186
190#if defined ( __CC_ARM ) || (defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)) || defined ( __GNUC__ )
191/* ARM V4/V5 and V6 & GNU Compiler
192 -------------------------------
193*/
194#define __NOINLINE __attribute__ ( (noinline) )
195
196#elif defined ( __ICCARM__ )
197/* ICCARM Compiler
198 ---------------
199*/
200#define __NOINLINE _Pragma("optimize = no_inline")
201
202#endif
203
204#ifdef __cplusplus
205}
206#endif
207
208#endif /* ___STM32F1xx_HAL_DEF */
209
210/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
This file contains aliases definition for the STM32Cube HAL constants macros and functions maintained...
CMSIS STM32F1xx Device Peripheral Access Layer Header File.
HAL_StatusTypeDef
HAL Status structures definition.
Definition stm32f1xx_hal_def.h:40
HAL_LockTypeDef
HAL Lock structures definition.
Definition stm32f1xx_hal_def.h:51