| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- /**
- ******************************************************************************
- * @file FLASH.h
- * @author
- * @brief Header for flash.c module
- ******************************************************************************
- *
- ******************************************************************************
- */
- /* Define to prevent recursive inclusion -------------------------------------*/
- #ifndef __FLASH_H
- #define __FLASH_H
- /* Includes ------------------------------------------------------------------*/
- #include "bsp.h"
- /* Exported types ------------------------------------------------------------*/
- /* Exported macro ------------------------------------------------------------*/
- /* Base address of the Flash sectors */
- #define ADDR_FLASH_SECTOR_0 ((uint32_t)0x08000000) /* Base @ of Sector 0, 16 Kbytes */
- #define ADDR_FLASH_SECTOR_1 ((uint32_t)0x08004000) /* Base @ of Sector 1, 16 Kbytes */
- #define ADDR_FLASH_SECTOR_2 ((uint32_t)0x08008000) /* Base @ of Sector 2, 16 Kbytes */
- #define ADDR_FLASH_SECTOR_3 ((uint32_t)0x0800C000) /* Base @ of Sector 3, 16 Kbytes */
- #define ADDR_FLASH_SECTOR_4 ((uint32_t)0x08010000) /* Base @ of Sector 4, 64 Kbytes */
- #define ADDR_FLASH_SECTOR_5 ((uint32_t)0x08020000) /* Base @ of Sector 5, 128 Kbytes */
- #define ADDR_FLASH_SECTOR_6 ((uint32_t)0x08040000) /* Base @ of Sector 6, 128 Kbytes */
- #define ADDR_FLASH_SECTOR_7 ((uint32_t)0x08060000) /* Base @ of Sector 7, 128 Kbytes */
- #define ADDR_FLASH_SECTOR_8 ((uint32_t)0x08080000) /* Base @ of Sector 8, 128 Kbytes */
- #define ADDR_FLASH_SECTOR_9 ((uint32_t)0x080A0000) /* Base @ of Sector 9, 128 Kbytes */
- #define ADDR_FLASH_SECTOR_10 ((uint32_t)0x080C0000) /* Base @ of Sector 10, 128 Kbytes */
- #define ADDR_FLASH_SECTOR_11 ((uint32_t)0x080E0000) /* Base @ of Sector 11, 128 Kbytes */
- /* Exported constants --------------------------------------------------------*/
- #define FLASH_USER_START_ADDR ADDR_FLASH_SECTOR_11 /* Start @ of user Flash area */
- #define FLASH_USER_PAGE_SIZE 0x20000
- #define FLASH_USER_END_ADDR ADDR_FLASH_SECTOR_11 + FLASH_USER_PAGE_SIZE -1 /* End @ of user Flash area : sector start address + sector size -1 */
- #define FLASH_BUFFER_SIZE 0x0800
- #define DATA1_32 ((uint32_t)0x12345678)
- #define DATA2_32 ((uint32_t)0x87654321)
- #define FLASH_SETTING_ADDRESS(x) ((x)+FLASH_USER_START_ADDR)
- /* Exported functions ------------------------------------------------------- */
- //int ProgramFlashPage(uint32_t startaddress, uint32_t endaddress, uint32_t data);
- int ProgramFlashPage(uint32_t startAddress, const uint8_t* data, uint32_t len);
- int EraseFlashProgram(uint32_t startaddress, uint32_t length);
- int WriteData2FlashProgram(uint32_t startaddress, const uint8_t* data, uint32_t length);
- int FinishFlashProgram(uint32_t startaddress, uint32_t length);
- void SetFlashWriteProtect(void);
- void ClearFlashWriteProtect(void);
- void SetFlashReadProtect(void);
- void SetBORLevel(void);
- #endif /* __FLASH_H */
- /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|