41 lines
1.1 KiB
C
41 lines
1.1 KiB
C
/*
|
||
*********************************************************************************************************
|
||
* IAR Development Kits
|
||
* on the
|
||
*
|
||
* M451
|
||
*
|
||
* Filename : fmc_flash.h
|
||
* Version : V1.00
|
||
* Programmer(s) : Qian Xianghong
|
||
*********************************************************************************************************
|
||
*/
|
||
|
||
#ifndef USER_FMC_FLASH_PRESENT
|
||
#define USER_FMC_FLASH_PRESENT
|
||
|
||
#include "stm32l4xx_hal_flash.h"
|
||
#include "stm32l4xx_hal_flash_ex.h"
|
||
|
||
#include "type.h"
|
||
|
||
// Flash存储规划如下:
|
||
// 252~255K: 配置数据(2K+2K,双份存储)
|
||
|
||
// 配置数据起始地址:252K(大小为4K)
|
||
#define FLASH_CONFIG_BASE (FLASH_BASE + 0x3F000)
|
||
|
||
// Flash可擦除块大小
|
||
#define FLASH_ERASE_SIZE 2048
|
||
// 读Flash全局缓冲
|
||
extern uint8_t Flash_rdBuf[FLASH_ERASE_SIZE];
|
||
|
||
uint8_t Flash_BufferVerify(uint32_t Addr, uint8_t *buf, uint32_t nbytes);
|
||
void Flash_BufferRead(uint32_t Addr, uint8_t *buf, uint32_t nbytes);
|
||
void Flash_BufferWrite(uint32_t Addr, uint8_t *buf, uint32_t nbytes);
|
||
|
||
// 擦除一页
|
||
void Flash_ErasePage(uint32_t Addr);
|
||
|
||
#endif
|