Subversion Repositories EDIS_Ignition

Rev

Rev 2 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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