WB32L003 Standard Peripherals Firmware Library

wb32l003_flash.h
Go to the documentation of this file.
1
10 /* Define to prevent recursive inclusion -------------------------------------*/
11 #ifndef __WB32L003_FLASH_H
12 #define __WB32L003_FLASH_H
13
14 #ifdef __cplusplus
15 extern "C" {
16 #endif
17
18 /* Includes ------------------------------------------------------------------*/
19 #include "wb32l003.h"
20
29 /* Exported types ------------------------------------------------------------*/
30
34 typedef enum
35 {
36 FLASH_BUSY = 1,
37 FLASH_ERROR_ERPC,
38 FLASH_ERROR_ERPROT,
39 FLASH_COMPLETE,
40 FLASH_TIMEOUT
41 } FLASH_Status;
42
43 /* Exported constants --------------------------------------------------------*/
44
49 #define FLASH_TIMEOUT_VALUE 50000U
50 #define FLASH_REGUNLOCK_KEY1 0x5A5AU
51 #define FLASH_REGUNLOCK_KEY2 0xA5A5U
52
64 #define FLASH_FLAG_BUSY FLASH_CR_BUSY
73 #define FLASH_IT_ALARM_ERASE_PROTADDR (FLASH_IFR_IF1 | FLASH_CR_IE_1)
74 #define FLASH_IT_ALARM_ERASE_PCADDR (FLASH_IFR_IF0 | FLASH_CR_IE_0)
83 #define FLASH_PAGE_SIZE 0x200U
84 #define FLASH_SIZE_32K 0x8000U
85 #define FLASH_SIZE_64K 0x10000U
86 #define FLASH_ALLPAGE_SELECTED 0xFFFFFFFFU
87
95 /* Exported macro ------------------------------------------------------------*/
96 /* Exported functions --------------------------------------------------------*/
97
98 void FLASH_OP_Unlock(uint32_t PageAddr);
99 void FLASH_OP_Lock(uint32_t PageAddr);
100 void FLASH_Unlock(void);
101 void FLASH_Lock(void);
102 void FLASH_ITConfig(uint32_t FLASH_IT, FunctionalState NewState);
103 void FLASH_ClearITPendingBit(uint32_t FLASH_IT);
104 FlagStatus FLASH_GetITStatus(uint32_t Flag);
105 FlagStatus FLASH_GetFlagStatus(uint32_t Flag);
106 FLASH_Status FLASH_WaitForLastOperation(uint32_t Timeout);
107 FLASH_Status FLASH_ProgramByte(uint32_t Addr, uint8_t Data);
108 FLASH_Status FLASH_ProgramHalfWord(uint32_t Addr, uint16_t Data);
109 FLASH_Status FLASH_ProgramWord(uint32_t Addr, uint32_t Data);
110 FLASH_Status FLASH_EraseChip(void);
111 FLASH_Status FLASH_ErasePage(uint32_t PageAddr);
112
121 #ifdef __cplusplus
122 }
123 #endif
124
125 #endif /*__WB32L003_FLASH_H */
FLASH_WaitForLastOperation
FLASH_Status FLASH_WaitForLastOperation(uint32_t Timeout)
Wait for a FLASH operation to complete.
Definition: wb32l003_flash.c:275
FLASH_ITConfig
void FLASH_ITConfig(uint32_t FLASH_IT, FunctionalState NewState)
Enables or disables the specified FLASH interrupts.
Definition: wb32l003_flash.c:194
FLASH_EraseChip
FLASH_Status FLASH_EraseChip(void)
Full erase of FLASH memory Bank.
Definition: wb32l003_flash.c:421
FLASH_ClearITPendingBit
void FLASH_ClearITPendingBit(uint32_t FLASH_IT)
Clear the specified FLASH interrupt flag.
Definition: wb32l003_flash.c:218
FLASH_OP_Lock
void FLASH_OP_Lock(uint32_t PageAddr)
Unlock the FLASH Page Erase/Write access.
Definition: wb32l003_flash.c:108
FLASH_Unlock
void FLASH_Unlock(void)
Unlock the FLASH controller register write-protect.
Definition: wb32l003_flash.c:149
FLASH_ErasePage
FLASH_Status FLASH_ErasePage(uint32_t PageAddr)
Erase the specified FLASH memory page.
Definition: wb32l003_flash.c:463
FLASH_ProgramWord
FLASH_Status FLASH_ProgramWord(uint32_t Addr, uint32_t Data)
Program a word (32-bit) at a specified address.
Definition: wb32l003_flash.c:380
FLASH_GetFlagStatus
FlagStatus FLASH_GetFlagStatus(uint32_t Flag)
Checks whether the specified FLASH flag is set or not.
Definition: wb32l003_flash.c:255
FLASH_ProgramHalfWord
FLASH_Status FLASH_ProgramHalfWord(uint32_t Addr, uint16_t Data)
Program a half-word (16-bit) at a specified address.
Definition: wb32l003_flash.c:338
FLASH_Lock
void FLASH_Lock(void)
Lock the FLASH controller register write-protect.
Definition: wb32l003_flash.c:170
FLASH_Status
FLASH_Status
FLASH Status.
Definition: wb32l003_flash.h:34
FLASH_OP_Unlock
void FLASH_OP_Unlock(uint32_t PageAddr)
Lock the FLASH Page Erase/Write access.
Definition: wb32l003_flash.c:66
FLASH_GetITStatus
FlagStatus FLASH_GetITStatus(uint32_t Flag)
Checks whether the specified FLASH interrupt has occurred or not.
Definition: wb32l003_flash.c:233
FLASH_ProgramByte
FLASH_Status FLASH_ProgramByte(uint32_t Addr, uint8_t Data)
Program a byte (8-bit) at a specified address.
Definition: wb32l003_flash.c:296