1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
33
34
35
38
39
45
46
49
50
54
55
56
57
58
59
60
61
62
63
64
65
66
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
92
93
110
111
112
118
119
125
126
127
128
129
130
136
137
143
144
154
155
156
157
160
161
162
163
164
165
166
167
168
169
170
171
172
173
179
180
187
188
189
192
193
198
199
204
205
206
207
208
209
210
211
212
/* ... */
#ifndef __STM32F4xx_HAL_DEF
#define __STM32F4xx_HAL_DEF
#ifdef __cplusplus
extern "C" {
#endif
#include "stm32f4xx.h"
#include "Legacy/stm32_hal_legacy.h"
#include <stddef.h>
Includes
/* ... */
typedef enum
{
HAL_OK = 0x00U,
HAL_ERROR = 0x01U,
HAL_BUSY = 0x02U,
HAL_TIMEOUT = 0x03U
...} HAL_StatusTypeDef;
/* ... */
typedef enum
{
HAL_UNLOCKED = 0x00U,
HAL_LOCKED = 0x01U
...} HAL_LockTypeDef;
Exported types
#if !defined(UNUSED)
#define UNUSED(X) (void)X
#endif
#define HAL_MAX_DELAY 0xFFFFFFFFU
#define HAL_IS_BIT_SET(REG, BIT) (((REG) & (BIT)) == (BIT))
#define HAL_IS_BIT_CLR(REG, BIT) (((REG) & (BIT)) == 0U)
#define __HAL_LINKDMA(__HANDLE__, __PPP_DMA_FIELD__, __DMA_HANDLE__) \
do{ \
(__HANDLE__)->__PPP_DMA_FIELD__ = &(__DMA_HANDLE__); \
(__DMA_HANDLE__).Parent = (__HANDLE__); \
...} while(0U)...
/* ... */
#define __HAL_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = 0U)
5 defines
#if (USE_RTOS == 1U)
#error "USE_RTOS should be 0 in the current HAL release"/* ... */
#else
#define __HAL_LOCK(__HANDLE__) \
do{ \
if((__HANDLE__)->Lock == HAL_LOCKED) \
{ \
return HAL_BUSY; \
...} \
else \
{ \
(__HANDLE__)->Lock = HAL_LOCKED; \
...} \
...}while (0U)...
#define __HAL_UNLOCK(__HANDLE__) \
do{ \
(__HANDLE__)->Lock = HAL_UNLOCKED; \
...}while (0U)...
/* ... */#endif
#if defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
#ifndef __weak
#define __weak __attribute__((weak))
#endif
#ifndef __packed
#define __packed __attribute__((packed))
#endif/* ... */
#elif defined ( __GNUC__ ) && !defined (__CC_ARM)
#ifndef __weak
#define __weak __attribute__((weak))
#endif
#ifndef __packed
#define __packed __attribute__((__packed__))
#endif /* ... */
#endif
#if defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
#ifndef __ALIGN_BEGIN
#define __ALIGN_BEGIN
#endif
#ifndef __ALIGN_END
#define __ALIGN_END __attribute__ ((aligned (4)))
#endif/* ... */
#elif defined ( __GNUC__ ) && !defined (__CC_ARM)
#ifndef __ALIGN_END
#define __ALIGN_END __attribute__ ((aligned (4)))
#endif
#ifndef __ALIGN_BEGIN
#define __ALIGN_BEGIN
#endif /* ... */
#else
#ifndef __ALIGN_END
#define __ALIGN_END
#endif
#ifndef __ALIGN_BEGIN
#if defined (__CC_ARM)
#define __ALIGN_BEGIN __align(4)
#elif defined (__ICCARM__)
#define __ALIGN_BEGIN
#endif /* ... */
#endif /* ... */
#endif
/* ... */
#if defined ( __CC_ARM ) || (defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050))
/* ... */
#define __RAM_FUNC
/* ... */
#elif defined ( __ICCARM__ )
/* ... */
#define __RAM_FUNC __ramfunc
/* ... */
#elif defined ( __GNUC__ )
/* ... */
#define __RAM_FUNC __attribute__((section(".RamFunc")))
/* ... */
#endif
/* ... */
#if defined ( __CC_ARM ) || (defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)) || defined ( __GNUC__ )
/* ... */
#define __NOINLINE __attribute__ ( (noinline) )
/* ... */
#elif defined ( __ICCARM__ )
/* ... */
#define __NOINLINE _Pragma("optimize = no_inline")
/* ... */
#endif
#ifdef __cplusplus
}extern "C" { ... }
#endif
/* ... */
#endif