66 lines
1.6 KiB
C
66 lines
1.6 KiB
C
|
|
#ifndef __NORPARAS_H__
|
|
#define __NORPARAS_H__
|
|
|
|
#include "config.h"
|
|
|
|
// 管理参数的读写
|
|
|
|
// 参数在norflash里的存放
|
|
|
|
#ifndef MAX_PARA_BLOCK // 最大支持参数块
|
|
#define MAX_PARA_BLOCK (0)
|
|
#endif
|
|
|
|
#if (MAX_PARA_BLOCK > 16) // 最多支持16个参数块
|
|
#undef MAX_PARA_BLOCK
|
|
#define MAX_PARA_BLOCK 16
|
|
#endif
|
|
|
|
|
|
|
|
#define PARA_NUM_PER_BLK (64) // 64个参数项,每个参数占4字节,共256字节(一页)
|
|
|
|
#define PARA_STR_LEN (30) // 参数名称长度
|
|
|
|
#define PARA_VALID 0x55AA // 参数块有效标志,自定义
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
typedef struct
|
|
{
|
|
s32 buff[PARA_NUM_PER_BLK];
|
|
}NorParaBlock;
|
|
|
|
// 参数类型
|
|
#define PTYPE_S 0 // 有符号数
|
|
#define PTYPE_U 1 // 无符号数
|
|
#define PTYPE_B 2 // 位图
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
|
|
void InitNorParas(void); // 初始化
|
|
|
|
int GetNorParaEn(int bIdx); // 获取参数有效标志
|
|
|
|
int LoadNorParas(int bIdx); // 读取参数 bIdx:参数块ID
|
|
|
|
int SaveNorParas(int bIdx); // 保存参数
|
|
|
|
NorParaBlock * GetNorParaBlock(int bIdx); // 获取并返回参数块
|
|
|
|
void SetNorParaNameString(int bIdx, void * pName); // 设置参数名称
|
|
void SetNorParaList(int bIdx, void * pPara); // 设置参数列表
|
|
void LoadNorDefPara(int bIdx); // 加载默认参数
|
|
void CheckParaRange(int bIdx); // 参数范围检测(全部参数)
|
|
void CheckAParaRange(int bIdx, int id); // 参数范围检测(单个参数)
|
|
|
|
s32 GetANorPara(int bIdx, int id); //得到单个参数的数值
|
|
void SetANorPara(int bIdx, int id, s32 val); //设置单个参数的数值
|
|
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
#endif // __NORPARAS_H__
|