123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- #ifndef __DRV_FLASH_H
- #define __DRV_FLASH_H
- #ifdef __cplusplus
- extern 'C'
- {
- #endif
- #ifdef __DRV_FLASH_H_GLOBAL
- #define __DRV_FLASH_H_EXTERN
- #else
- #define __DRV_FLASH_H_EXTERN extern
- #endif
- #include "stm32f4xx_flash.h"
- #define FMC_PAGE_SIZE ((uint16_t)0x800)
- #define FMC_PAGE_SIZE_U16 ((uint16_t)0x400)
- #define FMC_FLASH_BASE ((uint32_t)0x08000000)
- #define ADDR_FLASH_SECTOR_0 ((u32)0x08000000)
- #define ADDR_FLASH_SECTOR_1 ((u32)0x08004000)
- #define ADDR_FLASH_SECTOR_2 ((u32)0x08008000)
- #define ADDR_FLASH_SECTOR_3 ((u32)0x0800C000)
- #define ADDR_FLASH_SECTOR_4 ((u32)0x08010000)
- #define ADDR_FLASH_SECTOR_5 ((u32)0x08020000)
- #define ADDR_FLASH_SECTOR_6 ((u32)0x08040000)
- #define ADDR_FLASH_SECTOR_7 ((u32)0x08060000)
- #define ADDR_FLASH_SECTOR_8 ((u32)0x08080000)
- #define ADDR_FLASH_SECTOR_9 ((u32)0x080A0000)
- #define ADDR_FLASH_SECTOR_10 ((u32)0x080C0000)
- #define ADDR_FLASH_SECTOR_11 ((u32)0x080E0000)
- #define ADDR_FLASH_SECTOR_END ((u32)0x080FFFFF)
-
- void fmc_clear_flag_star(void);
- void fmc_clear_flag_end(void);
- uint8_t fmc_read_byte(uint32_t read_addr);
- uint16_t fmc_read_half_word(uint32_t read_addr);
- uint8_t fmc_read_n_half_word(uint32_t read_addr, uint16_t * buff, uint16_t count);
- uint8_t fmc_read_one_page(uint32_t read_addr, uint16_t * buff);
- uint8_t fmc_erase_pages(uint32_t erase_addr, uint16_t len);
- uint8_t fmc_write_n_half_word(uint32_t write_addr, uint16_t * buff, uint16_t len);
- uint16_t firmware_crc16_ccitt_false(uint16_t init_value, uint8_t * pbuff, uint32_t len);
- #ifdef __cplusplus
- };
- #endif
- #endif
|