stm32l431_xl_current/App/Inc/inflash.h

37 lines
1.1 KiB
C
Raw Normal View History

2024-07-15 09:07:44 +00:00
#ifndef _INFLASH_H_
#define _INFLASH_H_
#include "comm_types.h"
/* 内部flash存储空间 */
/* page 51,one page 2k */
#define STM32_INFLASH_PAGE_SIZE 2048
#define STM32_INFLASH_BASE 0x8000000 /* STM32 FLASH内部起始地址 */
#define STM32_INFLASH_SAVE_ADDR_BEGIN (STM32_INFLASH_BASE+STM32_INFLASH_PAGE_SIZE*51)
#define STM32_INFLASH_SAVE_ADDR_END (STM32_INFLASH_BASE+STM32_INFLASH_PAGE_SIZE*52-1)
#define STM32_INFLASH_SAVE_PAGE 31
typedef enum{
FLAG_SAVE_INFLASH_HEAD = 0x55,
FLAG_SAVE_INFLASH_END = 0x16,
}FlagInFlashType_e;
#pragma pack(push,1)
typedef struct _config_info{
u_int8_t flag_head;
u_int8_t addr;
u_int8_t net_id;
u_int8_t mac_info_h;
u_int8_t mac_info_l;
2024-07-15 09:07:44 +00:00
u_int8_t flag_end;
}config_info;
#pragma pack(pop)
extern config_info g_stConfigInfo;
void InFlash_Erase_Pages(u_int16_t PageBeginNum, u_int16_t NbPages);
void InFlash_Write(u_int32_t addr, u_int64_t *pBuffer,u_int32_t NumToWrite);
void save_config_info(config_info save_config_info);
void delete_config_info();
BOOL read_config_info();
#endif //_INFLASH_H_