[T106][ZXW-22]7520V3SCV2.01.01.02P42U09_VEC_V0.8_AP_VEC origin source commit
Change-Id: Ic6e05d89ecd62fc34f82b23dcf306c93764aec4b
diff --git a/ap/lib/libnvram/Makefile b/ap/lib/libnvram/Makefile
new file mode 100755
index 0000000..870f500
--- /dev/null
+++ b/ap/lib/libnvram/Makefile
@@ -0,0 +1,57 @@
+#*******************************************************************************
+# include ZTE library makefile
+#*******************************************************************************
+include $(COMMON_MK)
+
+##############USER COMIZE BEGIN################
+LIB_STATIC = libnvram.a
+LIB_SHARED = libnvram.so
+LIB_STATIC_SC = libnvram_sc.a
+LIB_SHARED_SC = libnvram_sc.so
+
+OBJS = nv_api.o cfg_api.o sys_infra.o
+OBJS2 = cfg_api_wrapper.o
+
+CFLAGS += -g
+#LDFLAGS += -lpthread
+##############USER COMIZE END##################
+
+CFLAGS += -I$(APP_DIR)/include
+CFLAGS += -fPIC
+LDFLAGS += -shared
+
+ifeq ($(MK_SDK_VERSION),yes)
+all:
+ echo "libnvram skip build in sdk version"
+else
+all: $(LIB_STATIC) $(LIB_SHARED) $(LIB_STATIC_SC) $(LIB_SHARED_SC)
+endif
+
+$(LIB_STATIC) : $(OBJS) $(OBJS2)
+ $(AR) rcs $@ $(OBJS) $(OBJS2)
+
+$(LIB_SHARED): $(OBJS) $(OBJS2)
+ $(CC) $(LDFLAGS) -o $@ $(OBJS) $(OBJS2)
+
+$(LIB_STATIC_SC) : $(OBJS)
+ $(AR) rcs $@ $(OBJS)
+
+$(LIB_SHARED_SC): $(OBJS)
+ $(CC) $(LDFLAGS) -o $@ $(OBJS)
+
+romfs:
+ifeq ($(LIBNVRAM_API_NEW),yes)
+ $(ROMFSINST) $(LIB_SHARED_SC) /lib/$(LIB_SHARED_SC)
+ cd $(ROOTFS_DIR)/lib && rm -f $(LIB_SHARED) && ln -s $(LIB_SHARED_SC) $(LIB_SHARED)
+else
+ $(ROMFSINST) $(LIB_SHARED) /lib/$(LIB_SHARED)
+ cd $(ROOTFS_DIR)/lib && rm -f $(LIB_SHARED_SC) && ln -s $(LIB_SHARED) $(LIB_SHARED_SC)
+endif
+
+clean:
+ifeq ($(MK_SDK_VERSION),yes)
+ echo "libupi_ab skip clean in sdk version"
+else
+ -$(RM) *.a *.o *.so
+endif
+
diff --git a/ap/lib/libnvram/libnvram.a b/ap/lib/libnvram/libnvram.a
new file mode 100644
index 0000000..915a5b9
--- /dev/null
+++ b/ap/lib/libnvram/libnvram.a
Binary files differ
diff --git a/ap/lib/libnvram/libnvram.so b/ap/lib/libnvram/libnvram.so
new file mode 100755
index 0000000..6393cff
--- /dev/null
+++ b/ap/lib/libnvram/libnvram.so
Binary files differ
diff --git a/ap/lib/libnvram/libnvram_sc.a b/ap/lib/libnvram/libnvram_sc.a
new file mode 100644
index 0000000..5c1bd74
--- /dev/null
+++ b/ap/lib/libnvram/libnvram_sc.a
Binary files differ
diff --git a/ap/lib/libnvram/libnvram_sc.so b/ap/lib/libnvram/libnvram_sc.so
new file mode 100755
index 0000000..9ae2821
--- /dev/null
+++ b/ap/lib/libnvram/libnvram_sc.so
Binary files differ
diff --git a/ap/lib/libnvram/nv_api.h b/ap/lib/libnvram/nv_api.h
new file mode 100755
index 0000000..53bebca
--- /dev/null
+++ b/ap/lib/libnvram/nv_api.h
@@ -0,0 +1,46 @@
+/*******************************************************************************
+* °æÈ¨ËùÓÐ (C)2016, ÖÐÐËͨѶ¹É·ÝÓÐÏÞ¹«Ë¾¡£
+*
+* ÎļþÃû³Æ: nv_api.h
+* Îļþ±êʶ: nv_api.h
+* ÄÚÈÝÕªÒª: nv½Ó¿ÚÉùÃ÷Í·Îļþ
+* ʹÓ÷½·¨: #include <nv_api.h>
+*
+* ÐÞ¸ÄÈÕÆÚ °æ±¾ºÅ Ð޸ıê¼Ç ÐÞ¸ÄÈË ÐÞ¸ÄÄÚÈÝ
+* ------------------------------------------------------------------------------
+* 2016/09/20 V1.0 Create ÍõÇæ ´´½¨
+*
+*******************************************************************************/
+#ifndef _NV_API_H
+#define _NV_API_H
+
+/*******************************************************************************
+* Í·Îļþ *
+*******************************************************************************/
+#include "nv_typedef.h"
+
+/*******************************************************************************
+* ºê¶¨Òå *
+*******************************************************************************/
+
+/*******************************************************************************
+* Êý¾ÝÀàÐͶ¨Òå *
+*******************************************************************************/
+
+/*******************************************************************************
+* È«¾Ö±äÁ¿ÉùÃ÷ *
+*******************************************************************************/
+
+/*******************************************************************************
+* È«¾Öº¯ÊýÉùÃ÷ *
+*******************************************************************************/
+int nv_get_item(char * file, char * key, char * buf, int len);
+int nv_set_item(char * file, char * key, char * value, int saveFlag);
+int nv_delete_item(char * file, char * key);
+int nv_clear(char * file);
+int nv_reset(char * file);
+int nv_show(char * file);
+int nv_commit(char * file);
+
+#endif
+
diff --git a/ap/lib/libnvram/nv_typedef.h b/ap/lib/libnvram/nv_typedef.h
new file mode 100755
index 0000000..127fe01
--- /dev/null
+++ b/ap/lib/libnvram/nv_typedef.h
@@ -0,0 +1,94 @@
+/*******************************************************************************
+* °æÈ¨ËùÓÐ (C)2016, ÖÐÐËͨѶ¹É·ÝÓÐÏÞ¹«Ë¾¡£
+*
+* ÎļþÃû³Æ: nv_typedef.h
+* Îļþ±êʶ: nv_typedef.h
+* ÄÚÈÝÕªÒª: nvͨÓÃÀàÐͶ¨ÒåÍ·Îļþ
+* ʹÓ÷½·¨: #include <nv_typedef.h>
+*
+* ÐÞ¸ÄÈÕÆÚ °æ±¾ºÅ Ð޸ıê¼Ç ÐÞ¸ÄÈË ÐÞ¸ÄÄÚÈÝ
+* ------------------------------------------------------------------------------
+* 2016/09/20 V1.0 Create ÍõÇæ ´´½¨
+*
+*******************************************************************************/
+#ifndef _NV_TYPEDEF_H
+#define _NV_TYPEDEF_H
+
+/*******************************************************************************
+* Í·Îļþ *
+*******************************************************************************/
+#include "softap_api.h"
+/*******************************************************************************
+* ºê¶¨Òå *
+*******************************************************************************/
+
+
+// ÐèÒªºÍÐͺŻúÈ·¶¨
+#define MSG_TYPE_NV 6
+
+#define NV_FS_SHOW "/etc_rw/nv/nvshow"
+#define NV_CHECK_SIZE 4
+
+#define NV_RT2860 "cfg"
+#define NV_RO "ro"
+#define NV_RTDEV "rtdev"
+#define NV_CERT "cert"
+#define NV_WAPI "wapi"
+
+/*******************************************************************************
+* Êý¾ÝÀàÐͶ¨Òå *
+*******************************************************************************/
+enum E_NV_MSG_TYPE
+{
+ MSG_GET = 0,
+ MSG_SET,
+ MSG_UNSET,
+ MSG_CLEAR,
+ MSG_RESET,
+ MSG_SHOW,
+ MSG_COMMIT
+};
+
+enum E_NV_RESULT
+{
+ RESULT_SUCCESS = 0,
+ RESULT_INVAL,
+ RESULT_MALLOC_FAIL,
+ RESULT_NO_ITEM,
+ RESULT_NO_FILE,
+ RESULT_FILE_OPEN_FAIL,
+ RESULT_FILE_WRITE_FAIL,
+ RESULT_FILE_READ_FAIL,
+ RESULT_FAIL
+};
+
+typedef struct
+{
+ long msgType;
+ long pid;
+ int msgIndex;
+ int nvType;
+ int saveflag;
+ char file[NV_MAX_FILE_LEN];
+ char key[NV_MAX_KEY_LEN];
+ char value[NV_MAX_VAL_LEN];
+}T_NV_MSG_INFO;
+
+typedef struct
+{
+ long msgType;
+ int msgIndex;
+ int result;
+ char value[NV_MAX_VAL_LEN];
+}T_NV_MSG_RESULT;
+
+/*******************************************************************************
+* È«¾Ö±äÁ¿ÉùÃ÷ *
+*******************************************************************************/
+
+/*******************************************************************************
+* È«¾Öº¯ÊýÉùÃ÷ *
+*******************************************************************************/
+
+#endif
+