Files
chrg/apps/chrg/applications/bsp/chrg_fal.h
T
2025-11-18 00:40:02 +08:00

71 lines
2.5 KiB
C

/****************************************************************************
文件名称 : chrg_fal.h
完成日期 :
当前版本号 : V1.0
主要功能 : 提供参数读/写FLASH接口。
版本历史 : 创建原始版本
说明 :
******************************************************************************/
#ifndef __CHRG_FAL_H__
#define __CHRG_FAL_H__
#include <rtthread.h>
#ifdef FAL_PART_HAS_TABLE_CFG
// 以下定义与 fal_cfg.h 中 FAL_PART_TABLE 同步。
#define PART_BOOT "boot"
#define PART_PARAM "param"
#define PART_LOG "log"
#define PART_APPLICATION "app"
#define PART_DOWNLOAD "download"
#define PART_FACTORY "factory"
/*****************************************************************
函数名称: chrg_fal_read
函数描述: 从 FALSH 分区读取数据
输入参数: *name: 分区名 offset: 偏移地址 length: 数据长度 *buf:数据缓冲区
输出参数: -
返回说明: 0: 正确 <0: 异常错误
其它说明: -
*****************************************************************/
extern int chrg_fal_read (const char *name, rt_uint32_t offset, rt_size_t length, rt_uint8_t *buf);
/*****************************************************************
函数名称: chrg_fal_write
函数描述: 将数据写入 FALSH 分区
输入参数: *name: 分区名 offset: 偏移地址 length: 数据长度 *buf:数据缓冲区
输出参数: -
返回说明: 0: 正确 <0: 异常错误
其它说明: -
*****************************************************************/
extern int chrg_fal_write (const char *name, rt_uint32_t offset, rt_size_t length, rt_uint8_t *buf);
/*****************************************************************
函数名称: chrg_fal_erase
函数描述: 从 FALSH 分区擦除数据
输入参数: *name: 分区名 offset: 偏移地址 length: 数据长度
输出参数: -
返回说明: 0: 正确 <0: 异常错误
其它说明: -
*****************************************************************/
extern int chrg_fal_erase (const char *name, rt_uint32_t offset, rt_size_t length);
/*****************************************************************
函数名称: chrg_fal_erase_part
函数描述: 擦除整个分区数据
输入参数: *name: 分区名 offset: 起始地址 length: 数据长度
输出参数: -
返回说明: 0: 正确 <0: 异常错误
其它说明: -
*****************************************************************/
extern int chrg_fal_erase_all (const char *name);
#endif
#endif