Subversion Repositories DashDisplay

Rev

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

Rev 61 Rev 77
Line 1... Line 1...
1
/**
1
/**
2
  ******************************************************************************
2
  ******************************************************************************
3
  * @file    stm32l1xx_hal_flash.h
3
  * @file    stm32l1xx_hal_flash.h
4
  * @author  MCD Application Team
4
  * @author  MCD Application Team
5
  * @brief   Header file of Flash HAL module.
5
  * @brief   Header file of Flash HAL module.
6
  ******************************************************************************
6
  ******************************************************************************
7
  * @attention
7
  * @attention
8
  *
8
  *
9
  * <h2><center>&copy; Copyright (c) 2017 STMicroelectronics.
9
  * Copyright (c) 2017 STMicroelectronics.
10
  * All rights reserved.</center></h2>
10
  * All rights reserved.
11
  *
11
  *
12
  * This software component is licensed by ST under BSD 3-Clause license,
12
  * This software is licensed under terms that can be found in the LICENSE file in
13
  * the "License"; You may not use this file except in compliance with the
13
  * the root directory of this software component.
14
  * License. You may obtain a copy of the License at:
14
  * If no LICENSE file comes with this software, it is provided AS-IS.
15
  *                        opensource.org/licenses/BSD-3-Clause
15
  ******************************************************************************
16
  *
16
  */
17
  ******************************************************************************
17
 
18
  */
18
/* Define to prevent recursive inclusion -------------------------------------*/
19
 
19
#ifndef __STM32L1xx_HAL_FLASH_H
20
/* Define to prevent recursive inclusion -------------------------------------*/
20
#define __STM32L1xx_HAL_FLASH_H
21
#ifndef __STM32L1xx_HAL_FLASH_H
21
 
22
#define __STM32L1xx_HAL_FLASH_H
22
#ifdef __cplusplus
23
 
23
 extern "C" {
24
#ifdef __cplusplus
24
#endif
25
 extern "C" {
25
 
26
#endif
26
/* Includes ------------------------------------------------------------------*/
27
 
27
#include "stm32l1xx_hal_def.h"
28
/* Includes ------------------------------------------------------------------*/
28
   
29
#include "stm32l1xx_hal_def.h"
29
/** @addtogroup STM32L1xx_HAL_Driver
30
   
30
  * @{
31
/** @addtogroup STM32L1xx_HAL_Driver
31
  */
32
  * @{
32
 
33
  */
33
/** @addtogroup FLASH
34
 
34
  * @{
35
/** @addtogroup FLASH
35
  */
36
  * @{
36
 
37
  */
37
/** @addtogroup FLASH_Private_Constants
38
 
38
  * @{
39
/** @addtogroup FLASH_Private_Constants
39
  */
40
  * @{
40
#define FLASH_TIMEOUT_VALUE      (50000U) /* 50 s */
41
  */
41
/**
42
#define FLASH_TIMEOUT_VALUE      (50000U) /* 50 s */
42
  * @}
43
/**
43
  */
44
  * @}
44
 
45
  */
45
/** @addtogroup FLASH_Private_Macros
46
 
46
  * @{
47
/** @addtogroup FLASH_Private_Macros
47
  */
48
  * @{
48
 
49
  */
49
#define IS_FLASH_TYPEPROGRAM(_VALUE_)   ((_VALUE_) == FLASH_TYPEPROGRAM_WORD)
50
 
50
 
51
#define IS_FLASH_TYPEPROGRAM(_VALUE_)   ((_VALUE_) == FLASH_TYPEPROGRAM_WORD)
51
#define IS_FLASH_LATENCY(__LATENCY__) (((__LATENCY__) == FLASH_LATENCY_0) || \
52
 
52
                                       ((__LATENCY__) == FLASH_LATENCY_1))
53
#define IS_FLASH_LATENCY(__LATENCY__) (((__LATENCY__) == FLASH_LATENCY_0) || \
53
 
54
                                       ((__LATENCY__) == FLASH_LATENCY_1))
54
/**
55
 
55
  * @}
56
/**
56
  */  
57
  * @}
57
 
58
  */  
58
/* Exported types ------------------------------------------------------------*/
59
 
59
/** @defgroup FLASH_Exported_Types FLASH Exported Types
60
/* Exported types ------------------------------------------------------------*/
60
  * @{
61
/** @defgroup FLASH_Exported_Types FLASH Exported Types
61
  */  
62
  * @{
62
 
63
  */  
63
/**
64
 
64
  * @brief  FLASH Procedure structure definition
65
/**
65
  */
66
  * @brief  FLASH Procedure structure definition
66
typedef enum
67
  */
67
{
68
typedef enum
68
  FLASH_PROC_NONE              = 0U,
69
{
69
  FLASH_PROC_PAGEERASE         = 1U,
70
  FLASH_PROC_NONE              = 0U,
70
  FLASH_PROC_PROGRAM           = 2U,
71
  FLASH_PROC_PAGEERASE         = 1U,
71
} FLASH_ProcedureTypeDef;
72
  FLASH_PROC_PROGRAM           = 2U,
72
 
73
} FLASH_ProcedureTypeDef;
73
/**
74
 
74
  * @brief  FLASH handle Structure definition  
75
/**
75
  */
76
  * @brief  FLASH handle Structure definition  
76
typedef struct
77
  */
77
{
78
typedef struct
78
  __IO FLASH_ProcedureTypeDef ProcedureOnGoing; /*!< Internal variable to indicate which procedure is ongoing or not in IT context */
79
{
79
 
80
  __IO FLASH_ProcedureTypeDef ProcedureOnGoing; /*!< Internal variable to indicate which procedure is ongoing or not in IT context */
80
  __IO uint32_t               NbPagesToErase;   /*!< Internal variable to save the remaining sectors to erase in IT context*/
81
 
81
 
82
  __IO uint32_t               NbPagesToErase;   /*!< Internal variable to save the remaining sectors to erase in IT context*/
82
  __IO uint32_t               Address;          /*!< Internal variable to save address selected for program or erase */
83
 
83
 
84
  __IO uint32_t               Address;          /*!< Internal variable to save address selected for program or erase */
84
  __IO uint32_t               Page;             /*!< Internal variable to define the current page which is erasing */
85
 
85
 
86
  __IO uint32_t               Page;             /*!< Internal variable to define the current page which is erasing */
86
  HAL_LockTypeDef             Lock;             /*!< FLASH locking object                */
87
 
87
 
88
  HAL_LockTypeDef             Lock;             /*!< FLASH locking object                */
88
  __IO uint32_t               ErrorCode;        /*!< FLASH error code                    
89
 
89
                                                     This parameter can be a value of @ref FLASH_Error_Codes  */
90
  __IO uint32_t               ErrorCode;        /*!< FLASH error code                    
90
} FLASH_ProcessTypeDef;
91
                                                     This parameter can be a value of @ref FLASH_Error_Codes  */
91
 
92
} FLASH_ProcessTypeDef;
92
/**
93
 
93
  * @}
94
/**
94
  */
95
  * @}
95
 
96
  */
96
/* Exported constants --------------------------------------------------------*/
97
 
97
/** @defgroup FLASH_Exported_Constants FLASH Exported Constants
98
/* Exported constants --------------------------------------------------------*/
98
  * @{
99
/** @defgroup FLASH_Exported_Constants FLASH Exported Constants
99
  */  
100
  * @{
100
 
101
  */  
101
/** @defgroup FLASH_Error_Codes FLASH Error Codes
102
 
102
  * @{
103
/** @defgroup FLASH_Error_Codes FLASH Error Codes
103
  */
104
  * @{
104
 
105
  */
105
#define HAL_FLASH_ERROR_NONE      0x00U  /*!< No error */
106
 
106
#define HAL_FLASH_ERROR_PGA       0x01U  /*!< Programming alignment error */
107
#define HAL_FLASH_ERROR_NONE      0x00U  /*!< No error */
107
#define HAL_FLASH_ERROR_WRP       0x02U  /*!< Write protection error */
108
#define HAL_FLASH_ERROR_PGA       0x01U  /*!< Programming alignment error */
108
#define HAL_FLASH_ERROR_OPTV      0x04U  /*!< Option validity error */
109
#define HAL_FLASH_ERROR_WRP       0x02U  /*!< Write protection error */
109
#define HAL_FLASH_ERROR_SIZE      0x08U  /*!<  */
110
#define HAL_FLASH_ERROR_OPTV      0x04U  /*!< Option validity error */
110
#define HAL_FLASH_ERROR_RD        0x10U  /*!< Read protected error */
111
#define HAL_FLASH_ERROR_SIZE      0x08U  /*!<  */
111
#define HAL_FLASH_ERROR_OPTVUSR   0x20U  /*!< Option UserValidity Error. */
112
#define HAL_FLASH_ERROR_RD        0x10U  /*!< Read protected error */
112
#define HAL_FLASH_ERROR_OPERATION 0x40U  /*!< Not used */
113
#define HAL_FLASH_ERROR_OPTVUSR   0x20U  /*!< Option UserValidity Error. */
113
 
114
#define HAL_FLASH_ERROR_OPERATION 0x40U  /*!< Not used */
114
/**
115
 
115
  * @}
116
/**
116
  */
117
  * @}
117
 
118
  */
118
/** @defgroup FLASH_Page_Size FLASH size information
119
 
119
  * @{
120
/** @defgroup FLASH_Page_Size FLASH size information
120
  */
121
  * @{
121
 
122
  */
122
#if defined (FLASH_CUT1) || defined (FLASH_CUT2)
123
 
123
#define FLASH_SIZE_RAW    (uint32_t)(*((uint32_t *)FLASHSIZE_BASE)&0xFFU)
124
#if defined (FLASH_CUT1) || defined (FLASH_CUT2)
124
#else /*FLASH_CUT3 || FLASH_CUT4 || FLASH_CUT5 || FLASH_CUT6*/
125
#define FLASH_SIZE                      (uint32_t)((*((uint32_t *)FLASHSIZE_BASE)&0xFFU) * 1024U)
125
#define FLASH_SIZE_RAW    (uint32_t)(*((uint32_t *)FLASHSIZE_BASE)&0xFFFFU)
126
#else /*FLASH_CUT3 || FLASH_CUT4 || FLASH_CUT5 || FLASH_CUT6*/
126
#endif
127
#define FLASH_SIZE                      (uint32_t)((*((uint32_t *)FLASHSIZE_BASE)&0xFFFFU) * 1024U)
127
#define FLASH_SIZE        (((FLASH_SIZE_RAW) == 0 ? 384 : ((FLASH_SIZE_RAW) == 1 ? 256 : (FLASH_SIZE_RAW))) * 1024)
128
#endif
128
#define FLASH_PAGE_SIZE           (256U)  /*!< FLASH Page Size in bytes */
129
#define FLASH_PAGE_SIZE           (256U)  /*!< FLASH Page Size in bytes */
129
 
130
 
130
/**
131
/**
131
  * @}
132
  * @}
132
  */
133
  */
133
 
134
 
134
/** @defgroup FLASH_Type_Program FLASH Type Program
135
/** @defgroup FLASH_Type_Program FLASH Type Program
135
  * @{
136
  * @{
136
  */
137
  */
137
#define FLASH_TYPEPROGRAM_WORD       (0x02U)  /*!<Program a word (32-bit) at a specified address.*/
138
#define FLASH_TYPEPROGRAM_WORD       (0x02U)  /*!<Program a word (32-bit) at a specified address.*/
138
 
139
 
139
/**
140
/**
140
  * @}
141
  * @}
141
  */
142
  */
142
 
143
 
143
/** @defgroup FLASH_Latency FLASH Latency
144
/** @defgroup FLASH_Latency FLASH Latency
144
  * @{
145
  * @{
145
  */
146
  */
146
#define FLASH_LATENCY_0            (0x00000000U)    /*!< FLASH Zero Latency cycle */
147
#define FLASH_LATENCY_0            (0x00000000U)    /*!< FLASH Zero Latency cycle */
147
#define FLASH_LATENCY_1            FLASH_ACR_LATENCY         /*!< FLASH One Latency cycle */
148
#define FLASH_LATENCY_1            FLASH_ACR_LATENCY         /*!< FLASH One Latency cycle */
148
 
149
 
149
/**
150
/**
150
  * @}
151
  * @}
151
  */
152
  */
152
 
153
 
153
/** @defgroup FLASH_Interrupts FLASH Interrupts
154
/** @defgroup FLASH_Interrupts FLASH Interrupts
154
  * @{
155
  * @{
155
  */
156
  */
156
 
157
 
157
#define FLASH_IT_EOP               FLASH_PECR_EOPIE  /*!< End of programming interrupt source */
158
#define FLASH_IT_EOP               FLASH_PECR_EOPIE  /*!< End of programming interrupt source */
158
#define FLASH_IT_ERR               FLASH_PECR_ERRIE  /*!< Error interrupt source */
159
#define FLASH_IT_ERR               FLASH_PECR_ERRIE  /*!< Error interrupt source */
159
/**
160
/**
160
  * @}
161
  * @}
161
  */
162
  */
162
 
163
 
163
/** @defgroup FLASH_Flags FLASH Flags
164
/** @defgroup FLASH_Flags FLASH Flags
164
  * @{
165
  * @{
165
  */
166
  */
166
 
167
 
167
#define FLASH_FLAG_BSY             FLASH_SR_BSY        /*!< FLASH Busy flag */
168
#define FLASH_FLAG_BSY             FLASH_SR_BSY        /*!< FLASH Busy flag */
168
#define FLASH_FLAG_EOP             FLASH_SR_EOP        /*!< FLASH End of Programming flag */
169
#define FLASH_FLAG_EOP             FLASH_SR_EOP        /*!< FLASH End of Programming flag */
169
#define FLASH_FLAG_ENDHV           FLASH_SR_ENDHV      /*!< FLASH End of High Voltage flag */
170
#define FLASH_FLAG_ENDHV           FLASH_SR_ENDHV      /*!< FLASH End of High Voltage flag */
170
#define FLASH_FLAG_READY           FLASH_SR_READY      /*!< FLASH Ready flag after low power mode */
171
#define FLASH_FLAG_READY           FLASH_SR_READY      /*!< FLASH Ready flag after low power mode */
171
#define FLASH_FLAG_WRPERR          FLASH_SR_WRPERR     /*!< FLASH Write protected error flag */
172
#define FLASH_FLAG_WRPERR          FLASH_SR_WRPERR     /*!< FLASH Write protected error flag */
172
#define FLASH_FLAG_PGAERR          FLASH_SR_PGAERR     /*!< FLASH Programming Alignment error flag */
173
#define FLASH_FLAG_PGAERR          FLASH_SR_PGAERR     /*!< FLASH Programming Alignment error flag */
173
#define FLASH_FLAG_SIZERR          FLASH_SR_SIZERR     /*!< FLASH Size error flag  */
174
#define FLASH_FLAG_SIZERR          FLASH_SR_SIZERR     /*!< FLASH Size error flag  */
174
#define FLASH_FLAG_OPTVERR         FLASH_SR_OPTVERR    /*!< FLASH Option Validity error flag  */
175
#define FLASH_FLAG_OPTVERR         FLASH_SR_OPTVERR    /*!< FLASH Option Validity error flag  */
175
/* Cat2 & Cat3*/
176
/* Cat2 & Cat3*/
176
#if defined(FLASH_SR_RDERR)
177
#if defined(FLASH_SR_RDERR)
177
#define FLASH_FLAG_RDERR           FLASH_SR_RDERR    /*!< Read protected error flag  */
178
#define FLASH_FLAG_RDERR           FLASH_SR_RDERR    /*!< Read protected error flag  */
178
#endif /* FLASH_SR_RDERR */
179
#endif /* FLASH_SR_RDERR */
179
/* Cat3, Cat4 & Cat5*/
180
/* Cat3, Cat4 & Cat5*/
180
#if defined(FLASH_SR_OPTVERRUSR)
181
#if defined(FLASH_SR_OPTVERRUSR)
181
#define FLASH_FLAG_OPTVERRUSR      FLASH_SR_OPTVERRUSR /*!< FLASH Option User Validity error flag  */
182
#define FLASH_FLAG_OPTVERRUSR      FLASH_SR_OPTVERRUSR /*!< FLASH Option User Validity error flag  */
182
#endif /* FLASH_SR_OPTVERRUSR */
183
#endif /* FLASH_SR_OPTVERRUSR */
183
 
184
 
184
/**
185
/**
185
  * @}
186
  * @}
186
  */
187
  */
187
 
188
 
188
/** @defgroup FLASH_Keys FLASH Keys
189
/** @defgroup FLASH_Keys FLASH Keys
189
  * @{
190
  * @{
190
  */
191
  */
191
 
192
 
192
#define FLASH_PDKEY1               (0x04152637U) /*!< Flash power down key1 */
193
#define FLASH_PDKEY1               (0x04152637U) /*!< Flash power down key1 */
193
#define FLASH_PDKEY2               (0xFAFBFCFDU) /*!< Flash power down key2: used with FLASH_PDKEY1 
194
#define FLASH_PDKEY2               (0xFAFBFCFDU) /*!< Flash power down key2: used with FLASH_PDKEY1 
194
                                                              to unlock the RUN_PD bit in FLASH_ACR */
195
                                                              to unlock the RUN_PD bit in FLASH_ACR */
195
 
196
 
196
#define FLASH_PEKEY1               (0x89ABCDEFU) /*!< Flash program erase key1 */
197
#define FLASH_PEKEY1               (0x89ABCDEFU) /*!< Flash program erase key1 */
197
#define FLASH_PEKEY2               (0x02030405U) /*!< Flash program erase key: used with FLASH_PEKEY2
198
#define FLASH_PEKEY2               (0x02030405U) /*!< Flash program erase key: used with FLASH_PEKEY2
198
                                                               to unlock the write access to the FLASH_PECR register and
199
                                                               to unlock the write access to the FLASH_PECR register and
199
                                                               data EEPROM */
200
                                                               data EEPROM */
200
 
201
 
201
#define FLASH_PRGKEY1              (0x8C9DAEBFU) /*!< Flash program memory key1 */
202
#define FLASH_PRGKEY1              (0x8C9DAEBFU) /*!< Flash program memory key1 */
202
#define FLASH_PRGKEY2              (0x13141516U) /*!< Flash program memory key2: used with FLASH_PRGKEY2
203
#define FLASH_PRGKEY2              (0x13141516U) /*!< Flash program memory key2: used with FLASH_PRGKEY2
203
                                                               to unlock the program memory */
204
                                                               to unlock the program memory */
204
 
205
 
205
#define FLASH_OPTKEY1              (0xFBEAD9C8U) /*!< Flash option key1 */
206
#define FLASH_OPTKEY1              (0xFBEAD9C8U) /*!< Flash option key1 */
206
#define FLASH_OPTKEY2              (0x24252627U) /*!< Flash option key2: used with FLASH_OPTKEY1 to
207
#define FLASH_OPTKEY2              (0x24252627U) /*!< Flash option key2: used with FLASH_OPTKEY1 to
207
                                                              unlock the write access to the option byte block */
208
                                                              unlock the write access to the option byte block */
208
/**
209
/**
209
  * @}
210
  * @}
210
  */
211
  */
211
/**
212
/**
212
  * @}
213
  * @}
213
  */  
214
  */  
214
 
215
 
215
/* Exported macro ------------------------------------------------------------*/
216
/* Exported macro ------------------------------------------------------------*/
216
 
217
 
217
/** @defgroup FLASH_Exported_Macros FLASH Exported Macros
218
/** @defgroup FLASH_Exported_Macros FLASH Exported Macros
218
 *  @brief macros to control FLASH features
219
 *  @brief macros to control FLASH features
219
 *  @{
220
 *  @{
220
 */
221
 */
221
 
222
 
222
 
223
 
223
/** @defgroup FLASH_Interrupt FLASH Interrupts
224
/** @defgroup FLASH_Interrupt FLASH Interrupts
224
 *  @brief macros to handle FLASH interrupts
225
 *  @brief macros to handle FLASH interrupts
225
 * @{
226
 * @{
226
 */
227
 */
227
 
228
 
228
/**
229
/**
229
  * @brief  Enable the specified FLASH interrupt.
230
  * @brief  Enable the specified FLASH interrupt.
230
  * @param  __INTERRUPT__  FLASH interrupt
231
  * @param  __INTERRUPT__  FLASH interrupt
231
  *         This parameter can be any combination of the following values:
232
  *         This parameter can be any combination of the following values:
232
  *     @arg @ref FLASH_IT_EOP End of FLASH Operation Interrupt
233
  *     @arg @ref FLASH_IT_EOP End of FLASH Operation Interrupt
233
  *     @arg @ref FLASH_IT_ERR Error Interrupt    
234
  *     @arg @ref FLASH_IT_ERR Error Interrupt    
234
  * @retval none
235
  * @retval none
235
  */  
236
  */  
236
#define __HAL_FLASH_ENABLE_IT(__INTERRUPT__)  SET_BIT((FLASH->PECR), (__INTERRUPT__))
237
#define __HAL_FLASH_ENABLE_IT(__INTERRUPT__)  SET_BIT((FLASH->PECR), (__INTERRUPT__))
237
 
238
 
238
/**
239
/**
239
  * @brief  Disable the specified FLASH interrupt.
240
  * @brief  Disable the specified FLASH interrupt.
240
  * @param  __INTERRUPT__  FLASH interrupt
241
  * @param  __INTERRUPT__  FLASH interrupt
241
  *         This parameter can be any combination of the following values:
242
  *         This parameter can be any combination of the following values:
242
  *     @arg @ref FLASH_IT_EOP End of FLASH Operation Interrupt
243
  *     @arg @ref FLASH_IT_EOP End of FLASH Operation Interrupt
243
  *     @arg @ref FLASH_IT_ERR Error Interrupt    
244
  *     @arg @ref FLASH_IT_ERR Error Interrupt    
244
  * @retval none
245
  * @retval none
245
  */  
246
  */  
246
#define __HAL_FLASH_DISABLE_IT(__INTERRUPT__)  CLEAR_BIT((FLASH->PECR), (uint32_t)(__INTERRUPT__))
247
#define __HAL_FLASH_DISABLE_IT(__INTERRUPT__)  CLEAR_BIT((FLASH->PECR), (uint32_t)(__INTERRUPT__))
247
 
248
 
248
/**
249
/**
249
  * @brief  Get the specified FLASH flag status.
250
  * @brief  Get the specified FLASH flag status.
250
  * @param  __FLAG__ specifies the FLASH flag to check.
251
  * @param  __FLAG__ specifies the FLASH flag to check.
251
  *          This parameter can be one of the following values:
252
  *          This parameter can be one of the following values:
252
  *            @arg @ref FLASH_FLAG_BSY         FLASH Busy flag
253
  *            @arg @ref FLASH_FLAG_BSY         FLASH Busy flag
253
  *            @arg @ref FLASH_FLAG_EOP         FLASH End of Operation flag
254
  *            @arg @ref FLASH_FLAG_EOP         FLASH End of Operation flag
254
  *            @arg @ref FLASH_FLAG_ENDHV       FLASH End of High Voltage flag
255
  *            @arg @ref FLASH_FLAG_ENDHV       FLASH End of High Voltage flag
255
  *            @arg @ref FLASH_FLAG_READY       FLASH Ready flag after low power mode
256
  *            @arg @ref FLASH_FLAG_READY       FLASH Ready flag after low power mode
256
  *            @arg @ref FLASH_FLAG_PGAERR      FLASH Programming Alignment error flag
257
  *            @arg @ref FLASH_FLAG_PGAERR      FLASH Programming Alignment error flag
257
  *            @arg @ref FLASH_FLAG_SIZERR      FLASH Size error flag
258
  *            @arg @ref FLASH_FLAG_SIZERR      FLASH Size error flag
258
  *            @arg @ref FLASH_FLAG_OPTVERR     FLASH Option validity error error flag
259
  *            @arg @ref FLASH_FLAG_OPTVERR     FLASH Option validity error error flag
259
@if STM32L100xB
260
@if STM32L100xB
260
@elif STM32L100xBA
261
@elif STM32L100xBA
261
  *            @arg @ref FLASH_FLAG_RDERR       FLASH Read Protection error flag (PCROP)
262
  *            @arg @ref FLASH_FLAG_RDERR       FLASH Read Protection error flag (PCROP)
262
@elif STM32L151xB
263
@elif STM32L151xB
263
@elif STM32L151xBA
264
@elif STM32L151xBA
264
  *            @arg @ref FLASH_FLAG_RDERR       FLASH Read Protection error flag (PCROP)
265
  *            @arg @ref FLASH_FLAG_RDERR       FLASH Read Protection error flag (PCROP)
265
@elif STM32L152xB
266
@elif STM32L152xB
266
@elif STM32L152xBA
267
@elif STM32L152xBA
267
  *            @arg @ref FLASH_FLAG_RDERR       FLASH Read Protection error flag (PCROP)
268
  *            @arg @ref FLASH_FLAG_RDERR       FLASH Read Protection error flag (PCROP)
268
@elif STM32L100xC
269
@elif STM32L100xC
269
  *            @arg @ref FLASH_FLAG_RDERR       FLASH Read Protection error flag (PCROP)
270
  *            @arg @ref FLASH_FLAG_RDERR       FLASH Read Protection error flag (PCROP)
270
  *            @arg @ref FLASH_FLAG_OPTVERRUSR  FLASH Option User validity error
271
  *            @arg @ref FLASH_FLAG_OPTVERRUSR  FLASH Option User validity error
271
@elif STM32L151xC
272
@elif STM32L151xC
272
  *            @arg @ref FLASH_FLAG_RDERR       FLASH Read Protection error flag (PCROP)
273
  *            @arg @ref FLASH_FLAG_RDERR       FLASH Read Protection error flag (PCROP)
273
  *            @arg @ref FLASH_FLAG_OPTVERRUSR  FLASH Option User validity error
274
  *            @arg @ref FLASH_FLAG_OPTVERRUSR  FLASH Option User validity error
274
@elif STM32L152xC
275
@elif STM32L152xC
275
  *            @arg @ref FLASH_FLAG_RDERR       FLASH Read Protection error flag (PCROP)
276
  *            @arg @ref FLASH_FLAG_RDERR       FLASH Read Protection error flag (PCROP)
276
  *            @arg @ref FLASH_FLAG_OPTVERRUSR  FLASH Option User validity error
277
  *            @arg @ref FLASH_FLAG_OPTVERRUSR  FLASH Option User validity error
277
@elif STM32L162xC
278
@elif STM32L162xC
278
  *            @arg @ref FLASH_FLAG_RDERR       FLASH Read Protection error flag (PCROP)
279
  *            @arg @ref FLASH_FLAG_RDERR       FLASH Read Protection error flag (PCROP)
279
  *            @arg @ref FLASH_FLAG_OPTVERRUSR  FLASH Option User validity error
280
  *            @arg @ref FLASH_FLAG_OPTVERRUSR  FLASH Option User validity error
280
@else
281
@else
281
  *            @arg @ref FLASH_FLAG_OPTVERRUSR  FLASH Option User validity error
282
  *            @arg @ref FLASH_FLAG_OPTVERRUSR  FLASH Option User validity error
282
@endif
283
@endif
283
  *            @arg @ref FLASH_FLAG_WRPERR      FLASH Write protected error flag
284
  *            @arg @ref FLASH_FLAG_WRPERR      FLASH Write protected error flag
284
  * @retval The new state of __FLAG__ (SET or RESET).
285
  * @retval The new state of __FLAG__ (SET or RESET).
285
  */
286
  */
286
#define __HAL_FLASH_GET_FLAG(__FLAG__)   (((FLASH->SR) & (__FLAG__)) == (__FLAG__))
287
#define __HAL_FLASH_GET_FLAG(__FLAG__)   (((FLASH->SR) & (__FLAG__)) == (__FLAG__))
287
 
288
 
288
/**
289
/**
289
  * @brief  Clear the specified FLASH flag.
290
  * @brief  Clear the specified FLASH flag.
290
  * @param  __FLAG__ specifies the FLASH flags to clear.
291
  * @param  __FLAG__ specifies the FLASH flags to clear.
291
  *          This parameter can be any combination of the following values:
292
  *          This parameter can be any combination of the following values:
292
  *            @arg @ref FLASH_FLAG_EOP         FLASH End of Operation flag
293
  *            @arg @ref FLASH_FLAG_EOP         FLASH End of Operation flag
293
  *            @arg @ref FLASH_FLAG_PGAERR      FLASH Programming Alignment error flag
294
  *            @arg @ref FLASH_FLAG_PGAERR      FLASH Programming Alignment error flag
294
  *            @arg @ref FLASH_FLAG_SIZERR      FLASH Size error flag
295
  *            @arg @ref FLASH_FLAG_SIZERR      FLASH Size error flag
295
  *            @arg @ref FLASH_FLAG_OPTVERR     FLASH Option validity error error flag
296
  *            @arg @ref FLASH_FLAG_OPTVERR     FLASH Option validity error error flag
296
@if STM32L100xB
297
@if STM32L100xB
297
@elif STM32L100xBA
298
@elif STM32L100xBA
298
  *            @arg @ref FLASH_FLAG_RDERR       FLASH Read Protection error flag (PCROP)
299
  *            @arg @ref FLASH_FLAG_RDERR       FLASH Read Protection error flag (PCROP)
299
@elif STM32L151xB
300
@elif STM32L151xB
300
@elif STM32L151xBA
301
@elif STM32L151xBA
301
  *            @arg @ref FLASH_FLAG_RDERR       FLASH Read Protection error flag (PCROP)
302
  *            @arg @ref FLASH_FLAG_RDERR       FLASH Read Protection error flag (PCROP)
302
@elif STM32L152xB
303
@elif STM32L152xB
303
@elif STM32L152xBA
304
@elif STM32L152xBA
304
  *            @arg @ref FLASH_FLAG_RDERR       FLASH Read Protection error flag (PCROP)
305
  *            @arg @ref FLASH_FLAG_RDERR       FLASH Read Protection error flag (PCROP)
305
@elif STM32L100xC
306
@elif STM32L100xC
306
  *            @arg @ref FLASH_FLAG_RDERR       FLASH Read Protection error flag (PCROP)
307
  *            @arg @ref FLASH_FLAG_RDERR       FLASH Read Protection error flag (PCROP)
307
  *            @arg @ref FLASH_FLAG_OPTVERRUSR  FLASH Option User validity error
308
  *            @arg @ref FLASH_FLAG_OPTVERRUSR  FLASH Option User validity error
308
@elif STM32L151xC
309
@elif STM32L151xC
309
  *            @arg @ref FLASH_FLAG_RDERR       FLASH Read Protection error flag (PCROP)
310
  *            @arg @ref FLASH_FLAG_RDERR       FLASH Read Protection error flag (PCROP)
310
  *            @arg @ref FLASH_FLAG_OPTVERRUSR  FLASH Option User validity error
311
  *            @arg @ref FLASH_FLAG_OPTVERRUSR  FLASH Option User validity error
311
@elif STM32L152xC
312
@elif STM32L152xC
312
  *            @arg @ref FLASH_FLAG_RDERR       FLASH Read Protection error flag (PCROP)
313
  *            @arg @ref FLASH_FLAG_RDERR       FLASH Read Protection error flag (PCROP)
313
  *            @arg @ref FLASH_FLAG_OPTVERRUSR  FLASH Option User validity error
314
  *            @arg @ref FLASH_FLAG_OPTVERRUSR  FLASH Option User validity error
314
@elif STM32L162xC
315
@elif STM32L162xC
315
  *            @arg @ref FLASH_FLAG_RDERR       FLASH Read Protection error flag (PCROP)
316
  *            @arg @ref FLASH_FLAG_RDERR       FLASH Read Protection error flag (PCROP)
316
  *            @arg @ref FLASH_FLAG_OPTVERRUSR  FLASH Option User validity error
317
  *            @arg @ref FLASH_FLAG_OPTVERRUSR  FLASH Option User validity error
317
@else
318
@else
318
  *            @arg @ref FLASH_FLAG_OPTVERRUSR  FLASH Option User validity error
319
  *            @arg @ref FLASH_FLAG_OPTVERRUSR  FLASH Option User validity error
319
@endif
320
@endif
320
  *            @arg @ref FLASH_FLAG_WRPERR      FLASH Write protected error flag
321
  *            @arg @ref FLASH_FLAG_WRPERR      FLASH Write protected error flag
321
  * @retval none
322
  * @retval none
322
  */
323
  */
323
#define __HAL_FLASH_CLEAR_FLAG(__FLAG__)   ((FLASH->SR) = (__FLAG__))
324
#define __HAL_FLASH_CLEAR_FLAG(__FLAG__)   ((FLASH->SR) = (__FLAG__))
324
 
325
 
325
/**
326
/**
326
  * @}
327
  * @}
327
  */
328
  */
328
 
329
 
329
/**
330
/**
330
  * @}
331
  * @}
331
  */
332
  */
332
 
333
 
333
/* Include FLASH HAL Extended module */
334
/* Include FLASH HAL Extended module */
334
#include "stm32l1xx_hal_flash_ex.h"  
335
#include "stm32l1xx_hal_flash_ex.h"  
335
#include "stm32l1xx_hal_flash_ramfunc.h"  
336
#include "stm32l1xx_hal_flash_ramfunc.h"  
336
 
337
 
337
/* Exported functions --------------------------------------------------------*/
338
/* Exported functions --------------------------------------------------------*/
338
/** @addtogroup FLASH_Exported_Functions
339
/** @addtogroup FLASH_Exported_Functions
339
  * @{
340
  * @{
340
  */
341
  */
341
 
342
 
342
/** @addtogroup FLASH_Exported_Functions_Group1
343
/** @addtogroup FLASH_Exported_Functions_Group1
343
  * @{
344
  * @{
344
  */
345
  */
345
/* IO operation functions *****************************************************/
346
/* IO operation functions *****************************************************/
346
HAL_StatusTypeDef HAL_FLASH_Program(uint32_t TypeProgram, uint32_t Address, uint32_t Data);
347
HAL_StatusTypeDef HAL_FLASH_Program(uint32_t TypeProgram, uint32_t Address, uint32_t Data);
347
HAL_StatusTypeDef HAL_FLASH_Program_IT(uint32_t TypeProgram, uint32_t Address, uint32_t Data);
348
HAL_StatusTypeDef HAL_FLASH_Program_IT(uint32_t TypeProgram, uint32_t Address, uint32_t Data);
348
 
349
 
349
/* FLASH IRQ handler function */
350
/* FLASH IRQ handler function */
350
void       HAL_FLASH_IRQHandler(void);
351
void       HAL_FLASH_IRQHandler(void);
351
/* Callbacks in non blocking modes */
352
/* Callbacks in non blocking modes */
352
void       HAL_FLASH_EndOfOperationCallback(uint32_t ReturnValue);
353
void       HAL_FLASH_EndOfOperationCallback(uint32_t ReturnValue);
353
void       HAL_FLASH_OperationErrorCallback(uint32_t ReturnValue);
354
void       HAL_FLASH_OperationErrorCallback(uint32_t ReturnValue);
354
 
355
 
355
/**
356
/**
356
  * @}
357
  * @}
357
  */
358
  */
358
 
359
 
359
/** @addtogroup FLASH_Exported_Functions_Group2
360
/** @addtogroup FLASH_Exported_Functions_Group2
360
  * @{
361
  * @{
361
  */
362
  */
362
/* Peripheral Control functions ***********************************************/
363
/* Peripheral Control functions ***********************************************/
363
HAL_StatusTypeDef HAL_FLASH_Unlock(void);
364
HAL_StatusTypeDef HAL_FLASH_Unlock(void);
364
HAL_StatusTypeDef HAL_FLASH_Lock(void);
365
HAL_StatusTypeDef HAL_FLASH_Lock(void);
365
HAL_StatusTypeDef HAL_FLASH_OB_Unlock(void);
366
HAL_StatusTypeDef HAL_FLASH_OB_Unlock(void);
366
HAL_StatusTypeDef HAL_FLASH_OB_Lock(void);
367
HAL_StatusTypeDef HAL_FLASH_OB_Lock(void);
367
HAL_StatusTypeDef HAL_FLASH_OB_Launch(void);
368
HAL_StatusTypeDef HAL_FLASH_OB_Launch(void);
368
 
369
 
369
/**
370
/**
370
  * @}
371
  * @}
371
  */
372
  */
372
 
373
 
373
/** @addtogroup FLASH_Exported_Functions_Group3
374
/** @addtogroup FLASH_Exported_Functions_Group3
374
  * @{
375
  * @{
375
  */
376
  */
376
/* Peripheral State and Error functions ***************************************/
377
/* Peripheral State and Error functions ***************************************/
377
uint32_t HAL_FLASH_GetError(void);
378
uint32_t HAL_FLASH_GetError(void);
378
 
379
 
379
/**
380
/**
380
  * @}
381
  * @}
381
  */
382
  */
382
 
383
 
383
/**
384
/**
384
  * @}
385
  * @}
385
  */
386
  */
386
 
387
 
387
/* Private function -------------------------------------------------*/
388
/* Private function -------------------------------------------------*/
388
/** @addtogroup FLASH_Private_Functions
389
/** @addtogroup FLASH_Private_Functions
389
 * @{
390
 * @{
390
 */
391
 */
391
HAL_StatusTypeDef       FLASH_WaitForLastOperation(uint32_t Timeout);
392
HAL_StatusTypeDef       FLASH_WaitForLastOperation(uint32_t Timeout);
392
 
393
 
393
/**
394
/**
394
  * @}
395
  * @}
395
  */
396
  */
396
 
397
 
397
/**
398
/**
398
  * @}
399
  * @}
399
  */
400
  */
400
 
401
 
401
/**
402
/**
402
  * @}
403
  * @}
403
  */
404
  */
404
 
405
 
405
#ifdef __cplusplus
406
#ifdef __cplusplus
406
}
407
}
407
#endif
408
#endif
408
 
409
 
409
#endif /* __STM32L1xx_HAL_FLASH_H */
410
#endif /* __STM32L1xx_HAL_FLASH_H */
410
 
411
 
411
 
412
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
-
 
413
 
-