1 /*****************************************************************************
2  * Copyright (c) 2022, Nations Technologies Inc.
3  *
4  * All rights reserved.
5  * ****************************************************************************
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions are met:
9  *
10  * - Redistributions of source code must retain the above copyright notice,
11  * this list of conditions and the disclaimer below.
12  *
13  * Nations' name may not be used to endorse or promote products derived from
14  * this software without specific prior written permission.
15  *
16  * DISCLAIMER: THIS SOFTWARE IS PROVIDED BY NATIONS "AS IS" AND ANY EXPRESS OR
17  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
18  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
19  * DISCLAIMED. IN NO EVENT SHALL NATIONS BE LIABLE FOR ANY DIRECT, INDIRECT,
20  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
21  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
22  * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
23  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
24  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
25  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26  * ****************************************************************************/
27 
28 /**
29  * @file n32l43x_flash.h
30  * @author Nations
31  * @version v1.2.0
32  *
33  * @copyright Copyright (c) 2022, Nations Technologies Inc. All rights reserved.
34  */
35 #ifndef __N32L43X_FLASH_H__
36 #define __N32L43X_FLASH_H__
37 
38 #ifdef __cplusplus
39 extern "C" {
40 #endif
41 
42 #include "n32l43x.h"
43 
44 /** @addtogroup N32L43x_StdPeriph_Driver
45  * @{
46  */
47 
48 /** @addtogroup FLASH
49  * @{
50  */
51 
52 /** @addtogroup FLASH_Exported_Types
53  * @{
54  */
55 
56 /**
57  * @brief  FLASH Status
58  */
59 
60 typedef enum
61 {
62     FLASH_BUSY = 1,
63     FLASH_RESERVED,
64     FLASH_ERR_PG,
65     FLASH_ERR_PV,
66     FLASH_ERR_WRP,
67     FLASH_COMPL,
68     FLASH_ERR_EV,
69     FLASH_ERR_RDP2,
70     FLASH_ERR_ADD,
71     FLASH_TIMEOUT
72 } FLASH_STS;
73 
74 /**
75  * @brief  FLASH_SMPSEL
76  */
77 
78 typedef enum
79 {
80     FLASH_SMP1 = 0,
81     FLASH_SMP2
82 } FLASH_SMPSEL;
83 
84 /**
85  * @brief  FLASH_HSICLOCK
86  */
87 
88 typedef enum
89 {
90     FLASH_HSICLOCK_ENABLE = 0,
91     FLASH_HSICLOCK_DISABLE
92 } FLASH_HSICLOCK;
93 
94 /**
95  * @}
96  */
97 
98 /** @addtogroup FLASH_Exported_Constants
99  * @{
100  */
101 
102 /** @addtogroup Flash_Latency
103  * @{
104  */
105 
106 #define FLASH_LATENCY_0 ((uint32_t)0x00000000) /*!< FLASH Zero Latency cycle */
107 #define FLASH_LATENCY_1 ((uint32_t)0x00000001) /*!< FLASH One Latency cycle */
108 #define FLASH_LATENCY_2 ((uint32_t)0x00000002) /*!< FLASH Two Latency cycles */
109 #define FLASH_LATENCY_3 ((uint32_t)0x00000003) /*!< FLASH Three Latency cycles */
110 #define IS_FLASH_LATENCY(LATENCY)                                                                                      \
111     (((LATENCY) == FLASH_LATENCY_0) || ((LATENCY) == FLASH_LATENCY_1) || ((LATENCY) == FLASH_LATENCY_2)                \
112      || ((LATENCY) == FLASH_LATENCY_3))
113 /**
114  * @}
115  */
116 
117 /** @addtogroup Prefetch_Buffer_Enable_Disable
118  * @{
119  */
120 
121 #define FLASH_PrefetchBuf_EN              ((uint32_t)0x00000010) /*!< FLASH Prefetch Buffer Enable */
122 #define FLASH_PrefetchBuf_DIS             ((uint32_t)0x00000000) /*!< FLASH Prefetch Buffer Disable */
123 #define IS_FLASH_PREFETCHBUF_STATE(STATE) (((STATE) == FLASH_PrefetchBuf_EN) || ((STATE) == FLASH_PrefetchBuf_DIS))
124 /**
125  * @}
126  */
127 
128 /** @addtogroup iCache_Enable_Disable
129  * @{
130  */
131 
132 #define FLASH_iCache_EN              ((uint32_t)0x00000080) /*!< FLASH iCache Enable */
133 #define FLASH_iCache_DIS             ((uint32_t)0x00000000) /*!< FLASH iCache Disable */
134 #define IS_FLASH_ICACHE_STATE(STATE) (((STATE) == FLASH_iCache_EN) || ((STATE) == FLASH_iCache_DIS))
135 /**
136  * @}
137  */
138 
139 /** @addtogroup Low Voltage Mode
140  * @{
141  */
142 
143 #define FLASH_LVM_EN              ((uint32_t)0x00000200) /*!< FLASH Low Voltage Mode Enable */
144 #define FLASH_LVM_DIS             ((uint32_t)0x00000000) /*!< FLASH Low Voltage Mode Disable */
145 #define IS_FLASH_LVM(STATE)       (((STATE) == FLASH_LVM_EN) || ((STATE) == FLASH_LVM_DIS))
146 /**
147  * @}
148  */
149 
150 /** @addtogroup FLASH Sleep Mode
151  * @{
152  */
153 
154 #define FLASH_SLM_EN              ((uint32_t)0x00000800) /*!< FLASH Sleep Mode Enable */
155 #define FLASH_SLM_DIS             ((uint32_t)0x00000000) /*!< FLASH Sleep Mode Disable */
156 #define IS_FLASH_SLM(STATE)       (((STATE) == FLASH_SLM_EN) || ((STATE) == FLASH_SLM_DIS))
157 /**
158  * @}
159  */
160 
161 /** @addtogroup SMPSEL_SMP1_SMP2
162  * @{
163  */
164 
165 #define FLASH_SMPSEL_SMP1            ((uint32_t)0x00000000) /*!< FLASH SMPSEL SMP1 */
166 #define FLASH_SMPSEL_SMP2            ((uint32_t)0x00000100) /*!< FLASH SMPSEL SMP2 */
167 #define IS_FLASH_SMPSEL_STATE(STATE) (((STATE) == FLASH_SMPSEL_SMP1) || ((STATE) == FLASH_SMPSEL_SMP2))
168 /**
169  * @}
170  */
171 
172 /* Values to be used with N32L43x devices */
173 #define FLASH_WRP_Pages0to1                                                                                           \
174     ((uint32_t)0x00000001) /*!< N32L43x devices:                                                                       \
175                                   Write protection of page 0 to 1 */
176 #define FLASH_WRP_Pages2to3                                                                                           \
177     ((uint32_t)0x00000002) /*!< N32L43x devices:                                                                       \
178                                   Write protection of page 2 to 3 */
179 #define FLASH_WRP_Pages4to5                                                                                           \
180     ((uint32_t)0x00000004) /*!< N32L43x devices:                                                                       \
181                                   Write protection of page 4 to 5 */
182 #define FLASH_WRP_Pages6to7                                                                                           \
183     ((uint32_t)0x00000008) /*!< N32L43x devices:                                                                       \
184                                   Write protection of page 6 to 7 */
185 #define FLASH_WRP_Pages8to9                                                                                           \
186     ((uint32_t)0x00000010) /*!< N32L43x devices:                                                                       \
187                                   Write protection of page 8 to 9 */
188 #define FLASH_WRP_Pages10to11                                                                                         \
189     ((uint32_t)0x00000020) /*!< N32L43x devices:                                                                       \
190                                   Write protection of page 10 to 11 */
191 #define FLASH_WRP_Pages12to13                                                                                         \
192     ((uint32_t)0x00000040) /*!< N32L43x devices:                                                                       \
193                                   Write protection of page 12 to 13 */
194 #define FLASH_WRP_Pages14to15                                                                                         \
195     ((uint32_t)0x00000080) /*!< N32L43x devices:                                                                       \
196                                   Write protection of page 14 to 15 */
197 #define FLASH_WRP_Pages16to17                                                                                         \
198     ((uint32_t)0x00000100) /*!< N32L43x devices:                                                                       \
199                                   Write protection of page 16 to 17 */
200 #define FLASH_WRP_Pages18to19                                                                                         \
201     ((uint32_t)0x00000200) /*!< N32L43x devices:                                                                       \
202                                   Write protection of page 18 to 19 */
203 #define FLASH_WRP_Pages20to21                                                                                         \
204     ((uint32_t)0x00000400) /*!< N32L43x devices:                                                                       \
205                                   Write protection of page 20 to 21 */
206 #define FLASH_WRP_Pages22to23                                                                                         \
207     ((uint32_t)0x00000800) /*!< N32L43x devices:                                                                       \
208                                   Write protection of page 22 to 23 */
209 #define FLASH_WRP_Pages24to25                                                                                         \
210     ((uint32_t)0x00001000) /*!< N32L43x devices:                                                                       \
211                                   Write protection of page 24 to 25 */
212 #define FLASH_WRP_Pages26to27                                                                                         \
213     ((uint32_t)0x00002000) /*!< N32L43x devices:                                                                       \
214                                   Write protection of page 26 to 27 */
215 #define FLASH_WRP_Pages28to29                                                                                         \
216     ((uint32_t)0x00004000) /*!< N32L43x devices:                                                                       \
217                                   Write protection of page 28 to 29 */
218 #define FLASH_WRP_Pages30to31                                                                                         \
219     ((uint32_t)0x00008000) /*!< N32L43x devices:                                                                       \
220                                   Write protection of page 30 to 31 */
221 #define FLASH_WRP_Pages32to33                                                                                         \
222     ((uint32_t)0x00010000) /*!< N32L43x devices:                                                                       \
223                                   Write protection of page 32 to 33 */
224 #define FLASH_WRP_Pages34to35                                                                                         \
225     ((uint32_t)0x00020000) /*!< N32L43x devices:                                                                       \
226                                   Write protection of page 34 to 35 */
227 #define FLASH_WRP_Pages36to37                                                                                         \
228     ((uint32_t)0x00040000) /*!< N32L43x devices:                                                                       \
229                                   Write protection of page 36 to 37 */
230 #define FLASH_WRP_Pages38to39                                                                                         \
231     ((uint32_t)0x00080000) /*!< N32L43x devices:                                                                       \
232                                   Write protection of page 38 to 39 */
233 #define FLASH_WRP_Pages40to41                                                                                         \
234     ((uint32_t)0x00100000) /*!< N32L43x devices:                                                                       \
235                                   Write protection of page 40 to 41 */
236 #define FLASH_WRP_Pages42to43                                                                                         \
237     ((uint32_t)0x00200000) /*!< N32L43x devices:                                                                       \
238                                   Write protection of page 42 to 43 */
239 #define FLASH_WRP_Pages44to45                                                                                         \
240     ((uint32_t)0x00400000) /*!< N32L43x devices:                                                                       \
241                                   Write protection of page 44 to 45 */
242 #define FLASH_WRP_Pages46to47                                                                                         \
243     ((uint32_t)0x00800000) /*!< N32L43x devices:                                                                       \
244                                   Write protection of page 46 to 47 */
245 #define FLASH_WRP_Pages48to49                                                                                         \
246     ((uint32_t)0x01000000) /*!< N32L43x devices:                                                                       \
247                                   Write protection of page 48 to 49 */
248 #define FLASH_WRP_Pages50to51                                                                                         \
249     ((uint32_t)0x02000000) /*!< N32L43x devices:                                                                       \
250                                   Write protection of page 50 to 51 */
251 #define FLASH_WRP_Pages52to53                                                                                         \
252     ((uint32_t)0x04000000) /*!< N32L43x devices:                                                                       \
253                                   Write protection of page 52 to 53 */
254 #define FLASH_WRP_Pages54to55                                                                                         \
255     ((uint32_t)0x08000000) /*!< N32L43x devices:                                                                       \
256                                   Write protection of page 54 to 55 */
257 #define FLASH_WRP_Pages56to57                                                                                         \
258     ((uint32_t)0x10000000) /*!< N32L43x devices:                                                                       \
259                                   Write protection of page 56 to 57 */
260 #define FLASH_WRP_Pages58to59                                                                                         \
261     ((uint32_t)0x20000000) /*!< N32L43x devices:                                                                       \
262                                   Write protection of page 58 to 59 */
263 #define FLASH_WRP_Pages60to61                                                                                         \
264     ((uint32_t)0x40000000) /*!< N32L43x devices:                                                                       \
265                                   Write protection of page 60 to 61 */
266 #define FLASH_WRP_Pages62to63                                                                                        \
267     ((uint32_t)0x80000000) /*!< N32L43x devices:
268                                   Write protection of page 62 to 63 */
269 
270 #define FLASH_WRP_AllPages ((uint32_t)0xFFFFFFFF) /*!< Write protection of all Pages */
271 
272 #define IS_FLASH_WRP_PAGE(PAGE) (1) //(((PAGE) <= FLASH_WRP_AllPages))
273 
274 #define IS_FLASH_ADDRESS(ADDRESS) (((ADDRESS) >= 0x08000000) && ((ADDRESS) < 0x0801FFFF))
275 
276 #define IS_OB_DATA_ADDRESS(ADDRESS) ((ADDRESS) == 0x1FFFF804)
277 
278 /**
279  * @}
280  */
281 
282 /** @addtogroup Option_Bytes_RDP1
283  * @{
284  */
285 
286 #define OB_RDP1_ENABLE            ((uint8_t)0x00) /*!< Enable RDP1 */
287 #define OB_RDP1_DISABLE           ((uint8_t)0xA5) /*!< DISABLE RDP1 */
288 #define IS_OB_RDP1_SOURCE(SOURCE) (((SOURCE) == OB_RDP1_ENABLE) || ((SOURCE) == OB_RDP1_DISABLE))
289 
290 /**
291  * @}
292  */
293 
294 /** @addtogroup Option_Bytes_IWatchdog
295  * @{
296  */
297 
298 #define OB_IWDG_SW                ((uint8_t)0x01) /*!< Software IWDG selected */
299 #define OB_IWDG_HW                ((uint8_t)0x00) /*!< Hardware IWDG selected */
300 #define IS_OB_IWDG_SOURCE(SOURCE) (((SOURCE) == OB_IWDG_SW) || ((SOURCE) == OB_IWDG_HW))
301 
302 /**
303  * @}
304  */
305 
306 /** @addtogroup Option_Bytes_nRST_STOP
307  * @{
308  */
309 
310 #define OB_STOP2_NORST             ((uint8_t)0x02) /*!< No reset generated when entering in STOP */
311 #define OB_STOP2_RST               ((uint8_t)0x00) /*!< Reset generated when entering in STOP */
312 #define IS_OB_STOP2_SOURCE(SOURCE) (((SOURCE) == OB_STOP2_NORST) || ((SOURCE) == OB_STOP2_RST))
313 
314 /**
315  * @}
316  */
317 
318 /** @addtogroup Option_Bytes_nRST_STDBY
319  * @{
320  */
321 
322 #define OB_STDBY_NORST             ((uint8_t)0x04) /*!< No reset generated when entering in STANDBY */
323 #define OB_STDBY_RST               ((uint8_t)0x00) /*!< Reset generated when entering in STANDBY */
324 #define IS_OB_STDBY_SOURCE(SOURCE) (((SOURCE) == OB_STDBY_NORST) || ((SOURCE) == OB_STDBY_RST))
325 
326 /**
327  * @}
328  */
329 
330 /** @addtogroup Option_Bytes_nRST_PD
331  * @{
332  */
333 
334 #define OB_PD_NORST                ((uint8_t)0x08) /*!< No reset generated when entering in PowerDown */
335 #define OB_PD_RST                  ((uint8_t)0x00) /*!< Reset generated when entering in PowerDown */
336 #define IS_OB_PD_SOURCE(SOURCE)    (((SOURCE) == OB_PD_NORST) || ((SOURCE) == OB_PD_RST))
337 
338 /**
339  * @}
340  */
341 
342 /** @addtogroup Option_Bytes_RDP2
343  * @{
344  */
345 
346 #define OB_RDP2_ENABLE            ((uint8_t)0x33) /*!< Enable RDP2 */
347 #define OB_RDP2_DISABLE           ((uint8_t)0x00) /*!< Disable RDP2 */
348 #define IS_OB_RDP2_SOURCE(SOURCE) (((SOURCE) == OB_RDP2_ENABLE) || ((SOURCE) == OB_RDP2_DISABLE))
349 
350 /**
351  * @}
352  */
353 
354 /** @addtogroup Option_Bytes_nBOOT0
355  * @{
356  */
357 
358 #define OB2_NBOOT0_SET                ((uint8_t)0x01) /*!< Set nBOOT0 */
359 #define OB2_NBOOT0_CLR                ((uint8_t)0x00) /*!< Clear nBOOT0 */
360 #define IS_OB2_NBOOT0_SOURCE(SOURCE)  (((SOURCE) == OB2_NBOOT0_SET) || ((SOURCE) == OB2_NBOOT0_CLR))
361 
362 /**
363  * @}
364  */
365 
366 /** @addtogroup Option_Bytes_nBOOT1
367  * @{
368  */
369 
370 #define OB2_NBOOT1_SET                ((uint8_t)0x02) /*!< Set nBOOT1 */
371 #define OB2_NBOOT1_CLR                ((uint8_t)0x00) /*!< Clear nBOOT1 */
372 #define IS_OB2_NBOOT1_SOURCE(SOURCE)  (((SOURCE) == OB2_NBOOT1_SET) || ((SOURCE) == OB2_NBOOT1_CLR))
373 
374 /**
375  * @}
376  */
377 
378 /** @addtogroup Option_Bytes_nSWBOOT0
379  * @{
380  */
381 
382 #define OB2_NSWBOOT0_SET                ((uint8_t)0x04) /*!< Set nSWBOOT0 */
383 #define OB2_NSWBOOT0_CLR                ((uint8_t)0x00) /*!< Clear nSWBOOT0 */
384 #define IS_OB2_NSWBOOT0_SOURCE(SOURCE)  (((SOURCE) == OB2_NSWBOOT0_SET) || ((SOURCE) == OB2_NSWBOOT0_CLR))
385 
386 /**
387  * @}
388  */
389 
390 /** @addtogroup Option_Bytes_BOR_LEV
391  * @{
392  */
393 
394 #define OB2_BOR_LEV0                    ((uint8_t)0x00) /*!< BOR_LEV[2:0] L0 */
395 #define OB2_BOR_LEV1                    ((uint8_t)0x10) /*!< BOR_LEV[2:0] L1 */
396 #define OB2_BOR_LEV2                    ((uint8_t)0x20) /*!< BOR_LEV[2:0] L2 */
397 #define OB2_BOR_LEV3                    ((uint8_t)0x30) /*!< BOR_LEV[2:0] L3 */
398 #define OB2_BOR_LEV4                    ((uint8_t)0x40) /*!< BOR_LEV[2:0] L4 */
399 #define OB2_BOR_LEV5                    ((uint8_t)0x50) /*!< BOR_LEV[2:0] L5 */
400 #define OB2_BOR_LEV6                    ((uint8_t)0x60) /*!< BOR_LEV[2:0] L6 */
401 #define OB2_BOR_LEV7                    ((uint8_t)0x70) /*!< BOR_LEV[2:0] L7 */
402 #define IS_OB2_BOR_LEV_SOURCE(SOURCE)   (((SOURCE) == OB2_BOR_LEV0) || ((SOURCE) == OB2_BOR_LEV1)  \
403                                      || ((SOURCE) == OB2_BOR_LEV2) || ((SOURCE) == OB2_BOR_LEV3)  \
404                                      || ((SOURCE) == OB2_BOR_LEV4) || ((SOURCE) == OB2_BOR_LEV5)  \
405                                      || ((SOURCE) == OB2_BOR_LEV6) || ((SOURCE) == OB2_BOR_LEV7))
406 
407 
408 /**
409  * @}
410  */
411 /** @addtogroup FLASH_Interrupts
412  * @{
413  */
414 #define FLASH_INT_ERRIE    ((uint32_t)0x00000400) /*!< PGERR WRPERR ERROR error interrupt source */
415 #define FLASH_INT_FERR     ((uint32_t)0x00000800) /*!< EVERR PVERR interrupt source */
416 #define FLASH_INT_EOP      ((uint32_t)0x00001000) /*!< End of FLASH Operation Interrupt source */
417 
418 #define IS_FLASH_INT(IT) ((((IT) & (uint32_t)0xFFFFE3FF) == 0x00000000) && (((IT) != 0x00000000)))
419 
420 /**
421  * @}
422  */
423 
424 /** @addtogroup FLASH_Flags
425  * @{
426  */
427 #define FLASH_FLAG_BUSY     ((uint32_t)0x00000001) /*!< FLASH Busy flag */
428 #define FLASH_FLAG_PGERR    ((uint32_t)0x00000004) /*!< FLASH Program error flag */
429 #define FLASH_FLAG_PVERR    ((uint32_t)0x00000008) /*!< FLASH Program Verify ERROR flag after program */
430 #define FLASH_FLAG_WRPERR   ((uint32_t)0x00000010) /*!< FLASH Write protected error flag */
431 #define FLASH_FLAG_EOP      ((uint32_t)0x00000020) /*!< FLASH End of Operation flag */
432 #define FLASH_FLAG_EVERR    ((uint32_t)0x00000040) /*!< FLASH Erase Verify ERROR flag after page erase */
433 #define FLASH_FLAG_OBERR    ((uint32_t)0x00000001) /*!< FLASH Option Byte error flag */
434 
435 #define IS_FLASH_CLEAR_FLAG(FLAG) ((((FLAG) & (uint32_t)0xFFFFFF83) == 0x00000000) && ((FLAG) != 0x00000000))
436 #define IS_FLASH_GET_FLAG(FLAG)                                                                                       \
437        (((FLAG) == FLASH_FLAG_BUSY)   || ((FLAG) == FLASH_FLAG_PGERR) || ((FLAG) == FLASH_FLAG_PVERR)                 \
438      || ((FLAG) == FLASH_FLAG_WRPERR) || ((FLAG) == FLASH_FLAG_EOP)   || ((FLAG) == FLASH_FLAG_EVERR)                 \
439      || ((FLAG) == FLASH_FLAG_OBERR))
440 
441 /**
442  * @}
443  */
444 
445 /** @addtogroup FLASH_STS_CLRFLAG
446  * @{
447  */
448 #define FLASH_STS_CLRFLAG   (FLASH_FLAG_PGERR | FLASH_FLAG_PVERR | FLASH_FLAG_WRPERR | FLASH_FLAG_EOP |FLASH_FLAG_EVERR)
449 
450 /**
451  * @}
452  */
453 
454 /** @addtogroup FLASH_Exported_Functions
455  * @{
456  */
457 
458 /*------------ Functions used for N32L43x devices -----*/
459 void FLASH_SetLatency(uint32_t FLASH_Latency);
460 void FLASH_PrefetchBufSet(uint32_t FLASH_PrefetchBuf);
461 void FLASH_iCacheRST(void);
462 void FLASH_iCacheCmd(uint32_t FLASH_iCache);
463 void FLASH_LowVoltageModeCmd(uint32_t FLASH_LVM);
464 FlagStatus FLASH_GetLowVoltageModeSTS(void);
465 void FLASH_FLASHSleepModeCmd(uint32_t FLASH_SLM);
466 FlagStatus FLASH_GetFLASHSleepModeSTS(void);
467 FLASH_HSICLOCK FLASH_ClockInit(void);
468 void FLASH_Unlock(void);
469 void FLASH_Lock(void);
470 FLASH_STS FLASH_EraseOnePage(uint32_t Page_Address);
471 FLASH_STS FLASH_MassErase(void);
472 FLASH_STS FLASH_EraseOB(void);
473 FLASH_STS FLASH_ProgramWord(uint32_t Address, uint32_t Data);
474 FLASH_STS FLASH_ProgramOBData(uint32_t Address, uint32_t Data);
475 FLASH_STS FLASH_EnWriteProtection(uint32_t FLASH_Pages);
476 FLASH_STS FLASH_ReadOutProtectionL1(FunctionalState Cmd);
477 FLASH_STS FLASH_ReadOutProtectionL2_ENABLE(void);
478 FLASH_STS FLASH_ConfigALLOptionByte(uint8_t OB_RDP1,    uint8_t OB_IWDG,    uint8_t OB_STOP2,
479                                     uint8_t OB_STDBY,   uint8_t OB_PD,      uint8_t OB_Data0,
480                                     uint8_t OB_Data1,   uint32_t WRP_Pages, uint8_t OB_RDP2,
481                                     uint8_t OB2_nBOOT0, uint8_t OB2_nBOOT1, uint8_t OB2_nSWBOOT0,
482                                     uint8_t OB2_BOR_LEV);
483 FLASH_STS FLASH_ConfigUserOB(uint8_t OB_IWDG, uint8_t OB_STOP2, uint8_t OB_STDBY, uint8_t OB_PD);
484 FLASH_STS FLASH_ConfigUserOB2(uint8_t OB2_nBOOT0, uint8_t OB2_nBOOT1, uint8_t OB2_nSWBOOT0, uint8_t OB2_BOR_LEV);
485 uint32_t FLASH_GetUserOB(void);
486 uint32_t FLASH_GetWriteProtectionOB(void);
487 FlagStatus FLASH_GetReadOutProtectionSTS(void);
488 FlagStatus FLASH_GetReadOutProtectionL2STS(void);
489 FlagStatus FLASH_GetPrefetchBufSTS(void);
490 void FLASH_SetSMPSELStatus(uint32_t FLASH_smpsel);
491 FLASH_SMPSEL FLASH_GetSMPSELStatus(void);
492 void FLASH_INTConfig(uint32_t FLASH_INT, FunctionalState Cmd);
493 FlagStatus FLASH_GetFlagSTS(uint32_t FLASH_FLAG);
494 void FLASH_ClearFlag(uint32_t FLASH_FLAG);
495 FLASH_STS FLASH_GetSTS(void);
496 FLASH_STS FLASH_WaitForLastOpt(uint32_t Timeout);
497 
498 #ifdef __cplusplus
499 }
500 #endif
501 
502 #endif /* __N32L43X_FLASH_H__ */
503 /**
504  * @}
505  */
506 
507 /**
508  * @}
509  */
510 
511 /**
512  * @}
513  */
514