STM32_WGY/User/fmc_flash.h

41 lines
1.1 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*
*********************************************************************************************************
* 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