| BlueNRG-1 Peripherals drivers APIs

- Main Page
- Modules
- Classes
- Files

- File List
- File Members

BlueNRG1_flash.h
Go to the documentation of this file.
1
23 /* Define to prevent recursive inclusion -------------------------------------*/
24 #ifndef BLUENRG1_FLASH_H
25 #define BLUENRG1_FLASH_H
26
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30
31 /* Includes ------------------------------------------------------------------*/
32 #include "BlueNRG1.h"
33
50 #define Flash_CMDDONE 0x01 /* Flash command done */
51 #define Flash_CMDSTART 0x02 /* Flash command start */
52 #define Flash_CMDERR 0x04 /* Flash command error */
53 #define Flash_ILLCMD 0x08 /* Flash illegal command written */
54 #define Flash_READOK 0x10 /* Flash mass read was OK */
55 #define Flash_FLNREADY 0x20 /* Flash not ready (sleep) */
56
57 #define IS_FLASH_FLAG(FLAG) ( ((FLAG) == Flash_CMDDONE) || \
58 ((FLAG) == Flash_CMDSTART) || \
59 ((FLAG) == Flash_CMDERR) || \
60 ((FLAG) == Flash_ILLCMD) || \
61 ((FLAG) == Flash_READOK) || \
62 ((FLAG) == Flash_FLNREADY) )
63
75 #define FLASH_START (_MEMORY_FLASH_BEGIN_)
76 #define FLASH_END (_MEMORY_FLASH_END_)
77
78 #define IS_FLASH_ADDRESS(ADDR) ( ((ADDR) >= FLASH_START) && ((ADDR) <= FLASH_END) )
79
80
81 #define N_PAGES 80
82 #define N_ROWS 8
83 #define N_WORDS_ROW 64
84 #define N_WORDS_PAGE 512
85 #define N_BYTES_WORD 4
86 #define N_BYTES_PAGE 2048
87
88 #define IS_PAGE_NUMBER(PAGE) ( (PAGE)<N_PAGES )
89 #define IS_ROW_NUMBER(ROW) ( (ROW)<N_ROWS )
90 #define IS_WORD_NUMBER(WORD) ( (WORD)<N_WORDS_PAGE )
91
92 #define FLASH_REMAP_RAM 0x02
93 #define FLASH_PREMAP_MAIN 0x08
94
95
105 #define FLASH_ERASE 0x11
106 #define FLASH_MASSERASE 0x22
107 #define FLASH_WRITE 0x33
108 #define FLASH_MASSWRITE 0x44
109 #define FLASH_MASSREAD 0x55
110 #define FLASH_SLEEP 0xAA
111 #define FLASH_WAKEUP 0xBB
112 #define FLASH_BURSTWRITE 0xCC
113
114 #define IS_FLASH_CMD(CMD) ( ((CMD)==FLASH_ERASE) || ((CMD)==FLASH_MASSERASE) \
115 ((CMD)==FLASH_WRITE) || ((CMD)==FLASH_MASSWRITE) \
116 ((CMD)==FLASH_MASSREAD) || ((CMD)==FLASH_BURSTWRITE) \
117 ((CMD)==FLASH_SLEEP) || ((CMD)==FLASH_WAKEUP) )
118
139 void FLASH_ErasePage(uint16_t PageNumber);
140 void FLASH_EraseAllFlash(void);
141 uint32_t FLASH_ReadWord(uint32_t Address);
142 void FLASH_ProgramWord(uint32_t Address, uint32_t Data);
143 void FLASH_ProgramWordBurst(uint32_t Address, uint32_t* Data);
144 void FLASH_WaitCmdDone(void);
145 uint16_t FLASH_NextFreeFlashAddress(void);
146 void FLASH_ITConfig(uint8_t FlashFlag, FunctionalState NewState);
147 void FLASH_ClearITPendingBit(uint8_t FlashFlag);
148 FlagStatus FLASH_GetFlagStatus(uint8_t FlashFlag);
149 void FLASH_ClearFlag(uint8_t FlashFlag);
150
164 #ifdef __cplusplus
165 }
166 #endif
167
168 #endif /* BLUENRG1_FLASH_H */
169
170 /******************* (C) COPYRIGHT 2016 STMicroelectronics *****END OF FILE****/
FLASH_ErasePage
void FLASH_ErasePage(uint16_t PageNumber)
Erases a specified flash page.
Definition: BlueNRG1_flash.c:85
FLASH_NextFreeFlashAddress
uint16_t FLASH_NextFreeFlashAddress(void)
Wait loop for CMDDONE status.
Definition: BlueNRG1_flash.c:227
FLASH_ProgramWord
void FLASH_ProgramWord(uint32_t Address, uint32_t Data)
Flash write 32 bits.
Definition: BlueNRG1_flash.c:143
FLASH_GetFlagStatus
FlagStatus FLASH_GetFlagStatus(uint8_t FlashFlag)
Checks whether the specified FLASH raw flag is set or not.
Definition: BlueNRG1_flash.c:293
FLASH_ClearFlag
void FLASH_ClearFlag(uint8_t FlashFlag)
Clears the specific flash pending flags.
Definition: BlueNRG1_flash.c:317
FLASH_EraseAllFlash
void FLASH_EraseAllFlash(void)
Erases all main Flash.
Definition: BlueNRG1_flash.c:113
FLASH_ITConfig
void FLASH_ITConfig(uint8_t FlashFlag, FunctionalState NewState)
Enables or disables the specified flash interrupts.
Definition: BlueNRG1_flash.c:246
FLASH_ReadWord
uint32_t FLASH_ReadWord(uint32_t Address)
Flash read 32 bits.
Definition: BlueNRG1_flash.c:130
FLASH_WaitCmdDone
void FLASH_WaitCmdDone(void)
Wait loop for CMDDONE status.
Definition: BlueNRG1_flash.c:203
FLASH_ClearITPendingBit
void FLASH_ClearITPendingBit(uint8_t FlashFlag)
Clears the specific flash pending IT bit.
Definition: BlueNRG1_flash.c:272
FLASH_ProgramWordBurst
void FLASH_ProgramWordBurst(uint32_t Address, uint32_t *Data)
Flash write 32 bits.
Definition: BlueNRG1_flash.c:172