12345678910111213141516171819202122232425262728293031 |
- #ifndef __ST_FLASH_H__
- #define __ST_FLASH_H__
- #include <stm32f10x.h>
- //FLASH起始地址
- #define STM32_FLASH_BASE 0x08000000 //STM32 FLASH的起始地址
- //FLASH解锁键值
- #define FLASH_KEY1 0X45670123
- #define FLASH_KEY2 0XCDEF89AB
- #define __ST_FLASH_SIZE *((vu16*)(0x1FFFF7E0))
- //FLASH 扇区的起始地址
- #define ST_FLASH_SECTOR_0 ((u32)0x08000000) //扇区0起始地址, 24 Kbytes
- #define ST_FLASH_SECTOR_2 ((u32)0x08006000) //扇区1起始地址, 16 Kbytes
- #define ST_FLASH_SECTOR_3 ((u32)0x0800A000) //扇区2起始地址, 4 Kbytes
- #define ST_FLASH_SECTOR_5 ((u32)0x0800B000) //扇区3起始地址, 16 Kbytes
- void st_flash_unlock(void);
- void st_flash_lock(void);
- int st_flash_error_no(void);
- int st_flash_wait_done(int time);
- int st_flash_erase_secotr(uint8_t sector_no);
- int st_flash_write_flash_word(uint32_t faddr, uint32_t pdata);
- uint32_t st_flash_read_word(uint32_t faddr);
- uint8_t st_flash_addr_to_sector_no(uint32_t addr);
- void st_flash_read(uint32_t addr,uint32_t *buffer,uint32_t length);
- int st_flash_write(uint32_t addr,uint32_t *buffer,uint32_t length);
- #endif
|