annotate Common/Drivers/STM32F4xx_HAL_DRIVER_v120/Src/stm32f4xx_hal_flash.c @ 94:c6d284ea265b kittz

reduce i2c speed and dutycycle for compass stability
author Dmitry Romanov <kitt@bk.ru>
date Mon, 26 Nov 2018 12:20:31 +0300
parents 5f11787b4f42
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2 ******************************************************************************
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3 * @file stm32f4xx_hal_flash.c
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4 * @author MCD Application Team
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
5 * @version V1.2.0
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
6 * @date 26-December-2014
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
7 * @brief FLASH HAL module driver.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
8 * This file provides firmware functions to manage the following
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
9 * functionalities of the internal FLASH memory:
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
10 * + Program operations functions
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
11 * + Memory Control functions
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
12 * + Peripheral Errors functions
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
13 *
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
14 @verbatim
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
15 ==============================================================================
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
16 ##### FLASH peripheral features #####
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
17 ==============================================================================
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
18
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
19 [..] The Flash memory interface manages CPU AHB I-Code and D-Code accesses
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
20 to the Flash memory. It implements the erase and program Flash memory operations
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
21 and the read and write protection mechanisms.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
22
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
23 [..] The Flash memory interface accelerates code execution with a system of instruction
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
24 prefetch and cache lines.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
25
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
26 [..] The FLASH main features are:
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
27 (+) Flash memory read operations
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
28 (+) Flash memory program/erase operations
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
29 (+) Read / write protections
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
30 (+) Prefetch on I-Code
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
31 (+) 64 cache lines of 128 bits on I-Code
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
32 (+) 8 cache lines of 128 bits on D-Code
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
33
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
34
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
35 ##### How to use this driver #####
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
36 ==============================================================================
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
37 [..]
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
38 This driver provides functions and macros to configure and program the FLASH
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
39 memory of all STM32F4xx devices.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
40
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
41 (#) FLASH Memory IO Programming functions:
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
42 (++) Lock and Unlock the FLASH interface using HAL_FLASH_Unlock() and
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
43 HAL_FLASH_Lock() functions
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
44 (++) Program functions: byte, half word, word and double word
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
45 (++) There Two modes of programming :
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
46 (+++) Polling mode using HAL_FLASH_Program() function
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
47 (+++) Interrupt mode using HAL_FLASH_Program_IT() function
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
48
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
49 (#) Interrupts and flags management functions :
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
50 (++) Handle FLASH interrupts by calling HAL_FLASH_IRQHandler()
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
51 (++) Wait for last FLASH operation according to its status
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
52 (++) Get error flag status by calling HAL_SetErrorCode()
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
53
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
54 [..]
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
55 In addition to these functions, this driver includes a set of macros allowing
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
56 to handle the following operations:
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
57 (+) Set the latency
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
58 (+) Enable/Disable the prefetch buffer
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
59 (+) Enable/Disable the Instruction cache and the Data cache
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
60 (+) Reset the Instruction cache and the Data cache
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
61 (+) Enable/Disable the FLASH interrupts
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
62 (+) Monitor the FLASH flags status
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
63
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
64 @endverbatim
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
65 ******************************************************************************
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
66 * @attention
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
67 *
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
68 * <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
69 *
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
70 * Redistribution and use in source and binary forms, with or without modification,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
71 * are permitted provided that the following conditions are met:
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
72 * 1. Redistributions of source code must retain the above copyright notice,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
73 * this list of conditions and the following disclaimer.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
74 * 2. Redistributions in binary form must reproduce the above copyright notice,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
75 * this list of conditions and the following disclaimer in the documentation
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
76 * and/or other materials provided with the distribution.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
77 * 3. Neither the name of STMicroelectronics nor the names of its contributors
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
78 * may be used to endorse or promote products derived from this software
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
79 * without specific prior written permission.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
80 *
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
81 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
82 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
83 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
84 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
85 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
86 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
87 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
88 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
89 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
90 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
91 *
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
92 ******************************************************************************
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
93 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
94
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
95 /* Includes ------------------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
96 #include "stm32f4xx_hal.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
97
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
98 /** @addtogroup STM32F4xx_HAL_Driver
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
99 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
100 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
101
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
102 /** @defgroup FLASH FLASH
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
103 * @brief FLASH HAL module driver
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
104 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
105 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
106
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
107 #ifdef HAL_FLASH_MODULE_ENABLED
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
108
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
109 /* Private typedef -----------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
110 /* Private define ------------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
111 /** @addtogroup FLASH_Private_Constants
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
112 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
113 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
114 #define SECTOR_MASK ((uint32_t)0xFFFFFF07)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
115 #define FLASH_TIMEOUT_VALUE ((uint32_t)50000)/* 50 s */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
116 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
117 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
118 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
119 /* Private macro -------------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
120 /* Private variables ---------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
121 /** @addtogroup FLASH_Private_Variables
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
122 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
123 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
124 /* Variable used for Erase sectors under interruption */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
125 FLASH_ProcessTypeDef pFlash;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
126 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
127 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
128 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
129
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
130 /* Private function prototypes -----------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
131 /** @addtogroup FLASH_Private_Functions
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
132 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
133 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
134 /* Program operations */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
135 static void FLASH_Program_DoubleWord(uint32_t Address, uint64_t Data);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
136 static void FLASH_Program_Word(uint32_t Address, uint32_t Data);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
137 static void FLASH_Program_HalfWord(uint32_t Address, uint16_t Data);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
138 static void FLASH_Program_Byte(uint32_t Address, uint8_t Data);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
139 static void FLASH_SetErrorCode(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
140
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
141 HAL_StatusTypeDef FLASH_WaitForLastOperation(uint32_t Timeout);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
142 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
143 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
144 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
145
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
146 /* Exported functions --------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
147 /** @defgroup FLASH_Exported_Functions FLASH Exported Functions
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
148 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
149 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
150
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
151 /** @defgroup FLASH_Exported_Functions_Group1 Programming operation functions
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
152 * @brief Programming operation functions
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
153 *
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
154 @verbatim
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
155 ===============================================================================
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
156 ##### Programming operation functions #####
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
157 ===============================================================================
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
158 [..]
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
159 This subsection provides a set of functions allowing to manage the FLASH
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
160 program operations.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
161
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
162 @endverbatim
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
163 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
164 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
165
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
166 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
167 * @brief Program byte, halfword, word or double word at a specified address
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
168 * @param TypeProgram: Indicate the way to program at a specified address.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
169 * This parameter can be a value of @ref FLASH_Type_Program
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
170 * @param Address: specifies the address to be programmed.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
171 * @param Data: specifies the data to be programmed
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
172 *
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
173 * @retval HAL_StatusTypeDef HAL Status
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
174 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
175 HAL_StatusTypeDef HAL_FLASH_Program(uint32_t TypeProgram, uint32_t Address, uint64_t Data)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
176 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
177 HAL_StatusTypeDef status = HAL_ERROR;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
178
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
179 /* Process Locked */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
180 __HAL_LOCK(&pFlash);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
181
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
182 /* Check the parameters */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
183 assert_param(IS_FLASH_TYPEPROGRAM(TypeProgram));
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
184
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
185 /* Wait for last operation to be completed */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
186 status = FLASH_WaitForLastOperation((uint32_t)FLASH_TIMEOUT_VALUE);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
187
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
188 if(status == HAL_OK)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
189 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
190 if(TypeProgram == FLASH_TYPEPROGRAM_BYTE)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
191 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
192 /*Program byte (8-bit) at a specified address.*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
193 FLASH_Program_Byte(Address, (uint8_t) Data);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
194 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
195 else if(TypeProgram == FLASH_TYPEPROGRAM_HALFWORD)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
196 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
197 /*Program halfword (16-bit) at a specified address.*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
198 FLASH_Program_HalfWord(Address, (uint16_t) Data);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
199 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
200 else if(TypeProgram == FLASH_TYPEPROGRAM_WORD)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
201 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
202 /*Program word (32-bit) at a specified address.*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
203 FLASH_Program_Word(Address, (uint32_t) Data);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
204 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
205 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
206 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
207 /*Program double word (64-bit) at a specified address.*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
208 FLASH_Program_DoubleWord(Address, Data);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
209 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
210
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
211 /* Wait for last operation to be completed */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
212 status = FLASH_WaitForLastOperation((uint32_t)FLASH_TIMEOUT_VALUE);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
213
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
214 /* If the program operation is completed, disable the PG Bit */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
215 FLASH->CR &= (~FLASH_CR_PG);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
216 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
217
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
218 /* Process Unlocked */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
219 __HAL_UNLOCK(&pFlash);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
220
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
221 return status;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
222 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
223
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
224 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
225 * @brief Program byte, halfword, word or double word at a specified address with interrupt enabled.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
226 * @param TypeProgram: Indicate the way to program at a specified address.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
227 * This parameter can be a value of @ref FLASH_Type_Program
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
228 * @param Address: specifies the address to be programmed.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
229 * @param Data: specifies the data to be programmed
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
230 *
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
231 * @retval HAL Status
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
232 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
233 HAL_StatusTypeDef HAL_FLASH_Program_IT(uint32_t TypeProgram, uint32_t Address, uint64_t Data)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
234 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
235 HAL_StatusTypeDef status = HAL_OK;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
236
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
237 /* Process Locked */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
238 __HAL_LOCK(&pFlash);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
239
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
240 /* Check the parameters */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
241 assert_param(IS_FLASH_TYPEPROGRAM(TypeProgram));
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
242
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
243 /* Enable End of FLASH Operation interrupt */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
244 __HAL_FLASH_ENABLE_IT(FLASH_IT_EOP);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
245
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
246 /* Enable Error source interrupt */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
247 __HAL_FLASH_ENABLE_IT(FLASH_IT_ERR);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
248
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
249 /* Clear pending flags (if any) */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
250 __HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_EOP | FLASH_FLAG_OPERR | FLASH_FLAG_WRPERR |\
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
251 FLASH_FLAG_PGAERR | FLASH_FLAG_PGPERR| FLASH_FLAG_PGSERR);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
252
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
253 pFlash.ProcedureOnGoing = FLASH_PROC_PROGRAM;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
254 pFlash.Address = Address;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
255
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
256 if(TypeProgram == FLASH_TYPEPROGRAM_BYTE)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
257 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
258 /*Program byte (8-bit) at a specified address.*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
259 FLASH_Program_Byte(Address, (uint8_t) Data);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
260 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
261 else if(TypeProgram == FLASH_TYPEPROGRAM_HALFWORD)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
262 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
263 /*Program halfword (16-bit) at a specified address.*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
264 FLASH_Program_HalfWord(Address, (uint16_t) Data);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
265 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
266 else if(TypeProgram == FLASH_TYPEPROGRAM_WORD)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
267 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
268 /*Program word (32-bit) at a specified address.*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
269 FLASH_Program_Word(Address, (uint32_t) Data);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
270 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
271 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
272 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
273 /*Program double word (64-bit) at a specified address.*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
274 FLASH_Program_DoubleWord(Address, Data);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
275 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
276
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
277 return status;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
278 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
279
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
280 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
281 * @brief This function handles FLASH interrupt request.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
282 * @retval None
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
283 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
284 void HAL_FLASH_IRQHandler(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
285 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
286 uint32_t temp;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
287
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
288 /* If the program operation is completed, disable the PG Bit */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
289 FLASH->CR &= (~FLASH_CR_PG);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
290
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
291 /* If the erase operation is completed, disable the SER Bit */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
292 FLASH->CR &= (~FLASH_CR_SER);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
293 FLASH->CR &= SECTOR_MASK;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
294
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
295 /* if the erase operation is completed, disable the MER Bit */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
296 FLASH->CR &= (~FLASH_MER_BIT);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
297
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
298 /* Check FLASH End of Operation flag */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
299 if(__HAL_FLASH_GET_FLAG(FLASH_FLAG_EOP) != RESET)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
300 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
301 if(pFlash.ProcedureOnGoing == FLASH_PROC_SECTERASE)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
302 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
303 /*Nb of sector to erased can be decreased*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
304 pFlash.NbSectorsToErase--;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
305
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
306 /* Check if there are still sectors to erase*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
307 if(pFlash.NbSectorsToErase != 0)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
308 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
309 temp = pFlash.Sector;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
310 /*Indicate user which sector has been erased*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
311 HAL_FLASH_EndOfOperationCallback(temp);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
312
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
313 /* Clear pending flags (if any) */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
314 __HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_EOP | FLASH_FLAG_OPERR | FLASH_FLAG_WRPERR |\
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
315 FLASH_FLAG_PGAERR | FLASH_FLAG_PGPERR| FLASH_FLAG_PGSERR);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
316
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
317 /*Increment sector number*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
318 temp = ++pFlash.Sector;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
319 FLASH_Erase_Sector(temp, pFlash.VoltageForErase);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
320 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
321 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
322 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
323 /*No more sectors to Erase, user callback can be called.*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
324 /*Reset Sector and stop Erase sectors procedure*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
325 pFlash.Sector = temp = 0xFFFFFFFF;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
326 pFlash.ProcedureOnGoing = FLASH_PROC_NONE;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
327 /* FLASH EOP interrupt user callback */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
328 HAL_FLASH_EndOfOperationCallback(temp);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
329 /* Clear FLASH End of Operation pending bit */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
330 __HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_EOP);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
331 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
332 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
333 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
334 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
335 if(pFlash.ProcedureOnGoing == FLASH_PROC_MASSERASE)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
336 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
337 /*MassErase ended. Return the selected bank*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
338 /* FLASH EOP interrupt user callback */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
339 HAL_FLASH_EndOfOperationCallback(pFlash.Bank);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
340 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
341 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
342 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
343 /*Program ended. Return the selected address*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
344 /* FLASH EOP interrupt user callback */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
345 HAL_FLASH_EndOfOperationCallback(pFlash.Address);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
346 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
347 pFlash.ProcedureOnGoing = FLASH_PROC_NONE;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
348 /* Clear FLASH End of Operation pending bit */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
349 __HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_EOP);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
350 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
351
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
352 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
353
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
354 /* Check FLASH operation error flags */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
355 if(__HAL_FLASH_GET_FLAG((FLASH_FLAG_OPERR | FLASH_FLAG_WRPERR | FLASH_FLAG_PGAERR | \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
356 FLASH_FLAG_PGPERR | FLASH_FLAG_PGSERR | FLASH_FLAG_RDERR)) != RESET)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
357 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
358 if(pFlash.ProcedureOnGoing == FLASH_PROC_SECTERASE)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
359 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
360 /*return the faulty sector*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
361 temp = pFlash.Sector;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
362 pFlash.Sector = 0xFFFFFFFF;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
363 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
364 else if(pFlash.ProcedureOnGoing == FLASH_PROC_MASSERASE)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
365 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
366 /*return the faulty bank*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
367 temp = pFlash.Bank;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
368 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
369 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
370 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
371 /*return the faulty address*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
372 temp = pFlash.Address;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
373 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
374
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
375 /*Save the Error code*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
376 FLASH_SetErrorCode();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
377
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
378 /* FLASH error interrupt user callback */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
379 HAL_FLASH_OperationErrorCallback(temp);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
380 /* Clear FLASH error pending bits */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
381 __HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_OPERR | FLASH_FLAG_WRPERR | FLASH_FLAG_PGAERR |\
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
382 FLASH_FLAG_PGPERR | FLASH_FLAG_PGSERR | FLASH_FLAG_RDERR);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
383
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
384 /*Stop the procedure ongoing*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
385 pFlash.ProcedureOnGoing = FLASH_PROC_NONE;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
386 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
387
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
388 if(pFlash.ProcedureOnGoing == FLASH_PROC_NONE)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
389 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
390 /* Disable End of FLASH Operation interrupt */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
391 __HAL_FLASH_DISABLE_IT(FLASH_IT_EOP);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
392
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
393 /* Disable Error source interrupt */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
394 __HAL_FLASH_DISABLE_IT(FLASH_IT_ERR);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
395
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
396 /* Process Unlocked */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
397 __HAL_UNLOCK(&pFlash);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
398 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
399
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
400 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
401
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
402 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
403 * @brief FLASH end of operation interrupt callback
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
404 * @param ReturnValue: The value saved in this parameter depends on the ongoing procedure
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
405 * Mass Erase: Bank number which has been requested to erase
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
406 * Sectors Erase: Sector which has been erased
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
407 * (if 0xFFFFFFFF, it means that all the selected sectors have been erased)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
408 * Program: Address which was selected for data program
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
409 * @retval None
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
410 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
411 __weak void HAL_FLASH_EndOfOperationCallback(uint32_t ReturnValue)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
412 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
413 /* NOTE : This function Should not be modified, when the callback is needed,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
414 the HAL_FLASH_EndOfOperationCallback could be implemented in the user file
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
415 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
416 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
417
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
418 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
419 * @brief FLASH operation error interrupt callback
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
420 * @param ReturnValue: The value saved in this parameter depends on the ongoing procedure
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
421 * Mass Erase: Bank number which has been requested to erase
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
422 * Sectors Erase: Sector number which returned an error
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
423 * Program: Address which was selected for data program
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
424 * @retval None
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
425 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
426 __weak void HAL_FLASH_OperationErrorCallback(uint32_t ReturnValue)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
427 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
428 /* NOTE : This function Should not be modified, when the callback is needed,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
429 the HAL_FLASH_OperationErrorCallback could be implemented in the user file
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
430 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
431 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
432
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
433 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
434 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
435 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
436
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
437 /** @defgroup FLASH_Exported_Functions_Group2 Peripheral Control functions
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
438 * @brief management functions
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
439 *
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
440 @verbatim
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
441 ===============================================================================
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
442 ##### Peripheral Control functions #####
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
443 ===============================================================================
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
444 [..]
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
445 This subsection provides a set of functions allowing to control the FLASH
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
446 memory operations.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
447
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
448 @endverbatim
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
449 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
450 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
451
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
452 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
453 * @brief Unlock the FLASH control register access
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
454 * @retval HAL Status
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
455 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
456 HAL_StatusTypeDef HAL_FLASH_Unlock(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
457 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
458 if((FLASH->CR & FLASH_CR_LOCK) != RESET)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
459 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
460 /* Authorize the FLASH Registers access */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
461 FLASH->KEYR = FLASH_KEY1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
462 FLASH->KEYR = FLASH_KEY2;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
463 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
464 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
465 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
466 return HAL_ERROR;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
467 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
468
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
469 return HAL_OK;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
470 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
471
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
472 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
473 * @brief Locks the FLASH control register access
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
474 * @retval HAL Status
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
475 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
476 HAL_StatusTypeDef HAL_FLASH_Lock(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
477 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
478 /* Set the LOCK Bit to lock the FLASH Registers access */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
479 FLASH->CR |= FLASH_CR_LOCK;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
480
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
481 return HAL_OK;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
482 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
483
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
484 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
485 * @brief Unlock the FLASH Option Control Registers access.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
486 * @retval HAL Status
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
487 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
488 HAL_StatusTypeDef HAL_FLASH_OB_Unlock(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
489 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
490 if((FLASH->OPTCR & FLASH_OPTCR_OPTLOCK) != RESET)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
491 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
492 /* Authorizes the Option Byte register programming */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
493 FLASH->OPTKEYR = FLASH_OPT_KEY1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
494 FLASH->OPTKEYR = FLASH_OPT_KEY2;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
495 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
496 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
497 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
498 return HAL_ERROR;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
499 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
500
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
501 return HAL_OK;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
502 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
503
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
504 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
505 * @brief Lock the FLASH Option Control Registers access.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
506 * @retval HAL Status
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
507 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
508 HAL_StatusTypeDef HAL_FLASH_OB_Lock(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
509 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
510 /* Set the OPTLOCK Bit to lock the FLASH Option Byte Registers access */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
511 FLASH->OPTCR |= FLASH_OPTCR_OPTLOCK;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
512
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
513 return HAL_OK;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
514 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
515
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
516 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
517 * @brief Launch the option byte loading.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
518 * @retval HAL Status
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
519 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
520 HAL_StatusTypeDef HAL_FLASH_OB_Launch(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
521 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
522 /* Set the OPTSTRT bit in OPTCR register */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
523 *(__IO uint8_t *)OPTCR_BYTE0_ADDRESS |= FLASH_OPTCR_OPTSTRT;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
524
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
525 /* Wait for last operation to be completed */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
526 return(FLASH_WaitForLastOperation((uint32_t)FLASH_TIMEOUT_VALUE));
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
527 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
528
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
529 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
530 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
531 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
532
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
533 /** @defgroup FLASH_Exported_Functions_Group3 Peripheral State and Errors functions
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
534 * @brief Peripheral Errors functions
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
535 *
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
536 @verbatim
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
537 ===============================================================================
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
538 ##### Peripheral Errors functions #####
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
539 ===============================================================================
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
540 [..]
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
541 This subsection permits to get in run-time Errors of the FLASH peripheral.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
542
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
543 @endverbatim
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
544 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
545 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
546
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
547 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
548 * @brief Get the specific FLASH error flag.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
549 * @retval FLASH_ErrorCode: The returned value can be a combination of:
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
550 * @arg HAL_FLASH_ERROR_RD: FLASH Read Protection error flag (PCROP)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
551 * @arg HAL_FLASH_ERROR_PGS: FLASH Programming Sequence error flag
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
552 * @arg HAL_FLASH_ERROR_PGP: FLASH Programming Parallelism error flag
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
553 * @arg HAL_FLASH_ERROR_PGA: FLASH Programming Alignment error flag
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
554 * @arg HAL_FLASH_ERROR_WRP: FLASH Write protected error flag
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
555 * @arg HAL_FLASH_ERROR_OPERATION: FLASH operation Error flag
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
556 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
557 uint32_t HAL_FLASH_GetError(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
558 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
559 return pFlash.ErrorCode;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
560 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
561
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
562 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
563 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
564 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
565
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
566 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
567 * @brief Wait for a FLASH operation to complete.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
568 * @param Timeout: maximum flash operationtimeout
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
569 * @retval HAL Status
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
570 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
571 HAL_StatusTypeDef FLASH_WaitForLastOperation(uint32_t Timeout)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
572 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
573 uint32_t tickstart = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
574
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
575 /* Clear Error Code */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
576 pFlash.ErrorCode = HAL_FLASH_ERROR_NONE;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
577
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
578 /* Wait for the FLASH operation to complete by polling on BUSY flag to be reset.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
579 Even if the FLASH operation fails, the BUSY flag will be reset and an error
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
580 flag will be set */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
581 /* Get tick */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
582 tickstart = HAL_GetTick();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
583
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
584 while(__HAL_FLASH_GET_FLAG(FLASH_FLAG_BSY) != RESET)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
585 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
586 if(Timeout != HAL_MAX_DELAY)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
587 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
588 if((Timeout == 0)||((HAL_GetTick() - tickstart ) > Timeout))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
589 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
590 return HAL_TIMEOUT;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
591 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
592 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
593 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
594
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
595 if(__HAL_FLASH_GET_FLAG((FLASH_FLAG_OPERR | FLASH_FLAG_WRPERR | FLASH_FLAG_PGAERR | \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
596 FLASH_FLAG_PGPERR | FLASH_FLAG_PGSERR | FLASH_FLAG_RDERR)) != RESET)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
597 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
598 /*Save the error code*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
599 FLASH_SetErrorCode();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
600 return HAL_ERROR;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
601 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
602
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
603 /* If there is an error flag set */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
604 return HAL_OK;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
605
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
606 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
607
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
608 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
609 * @brief Program a double word (64-bit) at a specified address.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
610 * @note This function must be used when the device voltage range is from
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
611 * 2.7V to 3.6V and an External Vpp is present.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
612 *
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
613 * @note If an erase and a program operations are requested simultaneously,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
614 * the erase operation is performed before the program one.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
615 *
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
616 * @param Address: specifies the address to be programmed.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
617 * @param Data: specifies the data to be programmed.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
618 * @retval None
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
619 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
620 static void FLASH_Program_DoubleWord(uint32_t Address, uint64_t Data)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
621 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
622 /* Check the parameters */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
623 assert_param(IS_FLASH_ADDRESS(Address));
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
624
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
625 /* If the previous operation is completed, proceed to program the new data */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
626 FLASH->CR &= CR_PSIZE_MASK;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
627 FLASH->CR |= FLASH_PSIZE_DOUBLE_WORD;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
628 FLASH->CR |= FLASH_CR_PG;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
629
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
630 *(__IO uint64_t*)Address = Data;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
631 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
632
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
633
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
634 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
635 * @brief Program word (32-bit) at a specified address.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
636 * @note This function must be used when the device voltage range is from
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
637 * 2.7V to 3.6V.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
638 *
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
639 * @note If an erase and a program operations are requested simultaneously,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
640 * the erase operation is performed before the program one.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
641 *
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
642 * @param Address: specifies the address to be programmed.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
643 * @param Data: specifies the data to be programmed.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
644 * @retval None
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
645 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
646 static void FLASH_Program_Word(uint32_t Address, uint32_t Data)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
647 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
648 /* Check the parameters */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
649 assert_param(IS_FLASH_ADDRESS(Address));
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
650
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
651 /* If the previous operation is completed, proceed to program the new data */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
652 FLASH->CR &= CR_PSIZE_MASK;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
653 FLASH->CR |= FLASH_PSIZE_WORD;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
654 FLASH->CR |= FLASH_CR_PG;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
655
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
656 *(__IO uint32_t*)Address = Data;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
657 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
658
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
659 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
660 * @brief Program a half-word (16-bit) at a specified address.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
661 * @note This function must be used when the device voltage range is from
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
662 * 2.7V to 3.6V.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
663 *
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
664 * @note If an erase and a program operations are requested simultaneously,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
665 * the erase operation is performed before the program one.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
666 *
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
667 * @param Address: specifies the address to be programmed.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
668 * @param Data: specifies the data to be programmed.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
669 * @retval None
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
670 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
671 static void FLASH_Program_HalfWord(uint32_t Address, uint16_t Data)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
672 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
673 /* Check the parameters */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
674 assert_param(IS_FLASH_ADDRESS(Address));
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
675
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
676 /* If the previous operation is completed, proceed to program the new data */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
677 FLASH->CR &= CR_PSIZE_MASK;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
678 FLASH->CR |= FLASH_PSIZE_HALF_WORD;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
679 FLASH->CR |= FLASH_CR_PG;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
680
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
681 *(__IO uint16_t*)Address = Data;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
682 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
683
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
684 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
685 * @brief Program byte (8-bit) at a specified address.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
686 * @note This function must be used when the device voltage range is from
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
687 * 2.7V to 3.6V.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
688 *
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
689 * @note If an erase and a program operations are requested simultaneously,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
690 * the erase operation is performed before the program one.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
691 *
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
692 * @param Address: specifies the address to be programmed.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
693 * @param Data: specifies the data to be programmed.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
694 * @retval None
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
695 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
696 static void FLASH_Program_Byte(uint32_t Address, uint8_t Data)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
697 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
698 /* Check the parameters */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
699 assert_param(IS_FLASH_ADDRESS(Address));
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
700
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
701 /* If the previous operation is completed, proceed to program the new data */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
702 FLASH->CR &= CR_PSIZE_MASK;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
703 FLASH->CR |= FLASH_PSIZE_BYTE;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
704 FLASH->CR |= FLASH_CR_PG;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
705
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
706 *(__IO uint8_t*)Address = Data;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
707 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
708
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
709 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
710 * @brief Set the specific FLASH error flag.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
711 * @retval None
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
712 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
713 static void FLASH_SetErrorCode(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
714 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
715 if(__HAL_FLASH_GET_FLAG(FLASH_FLAG_WRPERR) != RESET)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
716 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
717 pFlash.ErrorCode |= HAL_FLASH_ERROR_WRP;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
718 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
719
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
720 if(__HAL_FLASH_GET_FLAG(FLASH_FLAG_PGAERR) != RESET)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
721 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
722 pFlash.ErrorCode |= HAL_FLASH_ERROR_PGA;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
723 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
724
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
725 if(__HAL_FLASH_GET_FLAG(FLASH_FLAG_PGPERR) != RESET)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
726 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
727 pFlash.ErrorCode |= HAL_FLASH_ERROR_PGP;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
728 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
729
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
730 if(__HAL_FLASH_GET_FLAG(FLASH_FLAG_PGSERR) != RESET)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
731 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
732 pFlash.ErrorCode |= HAL_FLASH_ERROR_PGS;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
733 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
734
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
735 if(__HAL_FLASH_GET_FLAG(FLASH_FLAG_RDERR) != RESET)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
736 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
737 pFlash.ErrorCode |= HAL_FLASH_ERROR_RD;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
738 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
739
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
740 if(__HAL_FLASH_GET_FLAG(FLASH_FLAG_OPERR) != RESET)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
741 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
742 pFlash.ErrorCode |= HAL_FLASH_ERROR_OPERATION;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
743 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
744 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
745
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
746 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
747 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
748 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
749
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
750 #endif /* HAL_FLASH_MODULE_ENABLED */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
751
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
752 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
753 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
754 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
755
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
756 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
757 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
758 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
759
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
760 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/