stm32_ota/SYSTEM/FLASH/flash.h

36 lines
1.7 KiB
C
Raw Normal View History

2023-12-15 06:28:06 +00:00
#ifndef __FLASH_H
#define __FLASH_H
#include "stm32f10x.h"
#include "syslib.h"
#if defined STM32F10X_HD //stm32f10<31><30>HD<48><44><EFBFBD><EFBFBD><EFBFBD><EFBFBD>mcu<63><75>FLASH<53><48><EFBFBD><EFBFBD>256ҳ<36><D2B3>ÿһҳΪ2Kbutes
#define FLASH_PAGE_SUM 256 //<2F>ڲ<EFBFBD>flash<73><68>ҳ<EFBFBD><D2B3>
#define FLASH_PAGE_SIZE 2048 //ÿһҳ<D2BB>Ĵ<EFBFBD>С<EFBFBD><D0A1>bytes<65><73>
#define FLASH_SIZE (FLASH_PAGE_SUM*FLASH_PAGE_SIZE) //<2F>ڲ<EFBFBD>flash<73><68><EFBFBD>ܴ<EFBFBD>С<EFBFBD><D0A1>bytes<65><73>
#elif defined STM32F10X_MD
#define FLASH_PAGE_SUM 256
#define FLASH_PAGE_SIZE 1024
#define FLASH_SIZE (FLASH_PAGE_SUM*FLASH_PAGE_SIZE)
#elif defined STM32F10X_LD
#define FLASH_PAGE_SUM 128
#define FLASH_PAGE_SIZE 1024
#define FLASH_SIZE (FLASH_PAGE_SUM*FLASH_PAGE_SIZE)
#endif
/*****************************************
*<EFBFBD>ڲ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
****************************************/
/*****************************************
*<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӿں<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
****************************************/
extern void Read_Flash_Byte(uint32_t readAddr, uint8_t *readBuf, uint16_t readLen) ; //<2F><>FLASH<53>ж<EFBFBD>ȡreadLen<65>ֽڳ<D6BD><DAB3>ȵ<EFBFBD><C8B5><EFBFBD><EFBFBD><EFBFBD>
extern void Read_Flash_HalfWord(u32 readAddr, u16 *readBuf, u16 readLen) ; //<2F><>FLASH<53>ж<EFBFBD>ȡreadLen<65><6E><EFBFBD>ӳ<EFBFBD><D3B3>ȵ<EFBFBD><C8B5><EFBFBD><EFBFBD><EFBFBD>
extern FLASH_Status Write_Flash_NoCheck(u32 WriteAddr, u16 *writeBuf, uint16_t writeLen) ; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>FLASH<53><48>û<EFBFBD>б<EFBFBD><D0B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>дwriteLen<65><6E><EFBFBD>ֳ<EFBFBD><D6B3>ȵ<EFBFBD><C8B5><EFBFBD><EFBFBD>ݵ<EFBFBD>Flash<73><68>
extern RunResult Write_Flash_OnePage(uint32_t writePageAddr, uint8_t *writeBuf, uint16_t writeLen) ; //дһҳ<D2BB><D2B3><EFBFBD>ȵ<EFBFBD><C8B5><EFBFBD><EFBFBD>ݵ<EFBFBD>FLASH<53><48>
extern RunResult Write_Flash(uint32_t writeAddr, uint8_t *writeBuf, uint16_t writeLen) ; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫд<D2AA><D0B4><EFBFBD><EFBFBD>ҳ<EFBFBD><D2B3>дwriteLen<65>ֽڳ<D6BD><DAB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݵ<EFBFBD>flash<73><68>ȥ
#endif