initial commit
This commit is contained in:
2
mw/storage/config.mk
Executable file
2
mw/storage/config.mk
Executable file
@@ -0,0 +1,2 @@
|
||||
CORE_SRCDIRS += $(MW_DIR)/storage
|
||||
FUSION_HEADERS += $(MW_DIR)/storage/*.h
|
||||
27
mw/storage/mw_storage.c
Executable file
27
mw/storage/mw_storage.c
Executable file
@@ -0,0 +1,27 @@
|
||||
#include "mw_storage.h"
|
||||
#include "list.h"
|
||||
#include "htime.h"
|
||||
#include "hthread.h"
|
||||
#include "hbase.h"
|
||||
#include "hlog.h"
|
||||
#include "hmutex.h"
|
||||
#include "hplatform.h"
|
||||
|
||||
|
||||
/*
|
||||
* 直接用mtd或操作flash分区, 加快启动速度
|
||||
**/
|
||||
uint32_t mw_storage_write(Mw_CfgStorage_Partition_e part, Mw_CfgStorage_Region_e region, char *data, uint32_t max_size){
|
||||
|
||||
hloge("%s part:%u, region:%u data:%p size:%u", __func__, part, region, data, max_size);
|
||||
return max_size;
|
||||
}
|
||||
|
||||
/*
|
||||
* 直接用mtd或操作flash分区, 加快启动速度
|
||||
**/
|
||||
// path can be file, return size has been read
|
||||
uint32_t mw_storage_read(Mw_CfgStorage_Partition_e part, Mw_CfgStorage_Region_e region, char *data, uint32_t max_size){
|
||||
hloge("%s part:%u, region:%u data:%p size:%u", __func__, part, region, data, max_size);
|
||||
return max_size;
|
||||
}
|
||||
42
mw/storage/mw_storage.h
Executable file
42
mw/storage/mw_storage.h
Executable file
@@ -0,0 +1,42 @@
|
||||
#ifndef __MW_STORAGE_H__
|
||||
#define __MW_STORAGE_H__
|
||||
#include "hal.h"
|
||||
|
||||
typedef enum
|
||||
{
|
||||
CFG_STORAGE_REGION_MAIN = 0, /* For current user settings */
|
||||
CFG_STORAGE_REGION_BACK, /* For backup */
|
||||
|
||||
CFG_STORAGE_REGION_NUM
|
||||
}Mw_CfgStorage_Region_e;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
CFG_STORAGE_PARTITION_SYS = 0, /* For system info setting */
|
||||
CFG_STORAGE_PARTITION_USER = 1, /* For user setting */
|
||||
|
||||
CFG_STORAGE_PARTITION_NUM
|
||||
}Mw_CfgStorage_Partition_e;
|
||||
|
||||
|
||||
/* For user */
|
||||
typedef uint32_t (*mw_read_cb)(Mw_CfgStorage_Partition_e part, Mw_CfgStorage_Region_e region, char *data, uint32_t max_size);
|
||||
typedef uint32_t (*mw_write_cb)(Mw_CfgStorage_Partition_e part, Mw_CfgStorage_Region_e region, char *data, uint32_t max_size);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 数据类型定义
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
/*flash init interface define,should be implement if needed*/
|
||||
|
||||
// path can be file, return size has been writed
|
||||
uint32_t mw_storage_write(Mw_CfgStorage_Partition_e part, Mw_CfgStorage_Region_e region, char *data, uint32_t max_size);
|
||||
|
||||
// path can be file, return size has been read
|
||||
uint32_t mw_storage_read(Mw_CfgStorage_Partition_e part, Mw_CfgStorage_Region_e region, char *data, uint32_t max_size);
|
||||
|
||||
|
||||
|
||||
#endif /* __MW_STORAGE_H__ */
|
||||
Reference in New Issue
Block a user