[T106][ZXW-22]7520V3SCV2.01.01.02P42U09_VEC_V0.8_AP_VEC origin source commit
Change-Id: Ic6e05d89ecd62fc34f82b23dcf306c93764aec4b
diff --git a/ap/app/zte_mdl/Makefile b/ap/app/zte_mdl/Makefile
new file mode 100755
index 0000000..1d30806
--- /dev/null
+++ b/ap/app/zte_mdl/Makefile
@@ -0,0 +1,148 @@
+#*******************************************************************************
+# include ZTE application makefile
+#*******************************************************************************
+include $(zte_app_mak)
+#include ../net_team.mk
+include $(COMMON_MK)
+
+CPU_PUB_ROOT=$(TOPDIR_AP)/../pub
+##############USER COMIZE BEGIN################
+EXEC = zte_mdl
+EXEC1 = zte-rtc-clock
+EXEC2 = router_msg_proxy
+OBJS = zte_mdl.o \
+ $(patsubst %.c,%.o,$(wildcard ../zte_comm/at_ctl/src/atctrl/*.c ../zte_comm/at_ctl/src/atconfig/*.c ../zte_comm/at_ctl/src/phone/*.c ../zte_comm/at_ctl/src/phone/src/*.c)) \
+ ../zte_comm/rtc-service/rtc-service.o \
+ $(filter-out ../zte_comm/zte_mainctrl/router_msg_proxy.o,$(patsubst %.c,%.o,$(wildcard ../zte_comm/zte_mainctrl/*.c))) \
+ ../zte_comm/zte_hotplug/hotplug.o ../zte_comm/zte_hotplug/netdev_plug.o ../zte_comm/zte_hotplug/drv_plug.o ../zte_comm/zte_audio_ctrl/audio_res_ctrl.o \
+ $(patsubst %.c,%.o,$(wildcard ../zte_comm/zte_drv_ctrl/usb/*.c ../zte_comm/zte_drv_ctrl/serial/*.c)) \
+ ../zte_comm/sntp/sntp.o \
+ $(patsubst %.c,%.o,$(wildcard ../zte_comm/fota_dm/src/*.c ))
+
+ifeq ($(USE_VEHICLE_DC),yes)
+OBJS += ../zte_comm/nvserver/nvserver_rpc.o ../zte_comm/nvserver/sc_rpc.o ../zte_comm/nvserver/file.o
+else
+OBJS += ../zte_comm/nvserver/nvserver.o ../zte_comm/nvserver/nvupdate.o
+endif
+
+OBJS1 = ../zte_comm/rtc-service/zte-rtc-clock.o
+OBJS2 = ../zte_comm/zte_mainctrl/router_msg_proxy.o
+#aes
+CFLAGS += -I$(zte_lib_path)/libssl/install/include
+LDLIBS += -L$(zte_lib_path)/libssl/install/lib -lcrypto
+ifeq ($(USE_DSDS_VSIM),yes)
+LDLIBS += -L$(zte_lib_path)/libvsim -lght_vsim
+CFLAGS += -DUSE_DSDS_VSIM
+endif
+
+#*******************************************************************************
+# include path
+#*******************************************************************************
+CFLAGS += -I./
+CFLAGS += -I../include
+CFLAGS += -I../zte_comm/nvserver
+CFLAGS += -I$(LIB_DIR)/libnvram
+CFLAGS += -I$(APP_DIR)/include
+CFLAGS += -g -Werror=implicit-function-declaration
+
+CFLAGS += -I../zte_comm/zte_hotplug
+CFLAGS += -I../zte_comm/at_ctl/inc
+CFLAGS += -I../zte_comm/at_ctl/src/phone/inc
+CFLAGS += -I$(zte_app_path)/include
+CFLAGS += -I$(zte_lib_path)/libatext
+CFLAGS += -I$(zte_lib_path)/libsqlite
+CFLAGS += -I$(zte_lib_path)/libnvram
+CFLAGS += -I$(LINUX_DIR)
+CFLAGS += -I$(zte_lib_path)/libzcore/std/inc/zCore/bl
+CFLAGS += -I$(zte_lib_path)/libzcore/std/inc/zCore/gui
+CFLAGS += -I$(CPU_PUB_ROOT)/project/zx297520v3/include/nv
+CFLAGS += -O -Dlinux=1 -DHIGH_SPEED=1
+
+
+CFLAGS += -I$(zte_lib_path)/libsoftap
+#CFLAGS += -I.
+
+
+CFLAGS += -I$(zte_lib_path)/libsoft_timer
+
+
+
+
+CFLAGS += -I../zte_comm/fota_dm/inc
+#CFLAGS += -I../zte_comm/fota_dm/gs_lib
+CFLAGS += -I../zte_comm/fota_dm/rs_lib
+CFLAGS += -I$(zte_lib_path)/libzte_dmapp/inc
+
+ifeq ($(USE_FOTA_AB),yes)
+CFLAGS += -I$(LIB_DIR)/libupi_ab/inc
+endif
+
+#*******************************************************************************
+# library
+#*******************************************************************************
+LDLIBS += -lnvram_sc -L$(zte_lib_path)/libnvram -lpthread
+ifeq ($(LINUX_TYPE),uClinux)
+LDFLAGS += -Wl,--allow-multiple-definition,-elf2flt=-s131072
+endif
+
+
+LDLIBS += -lsoftap -L$(zte_lib_path)/libsoftap
+LDLIBS += -lsoft_timer_sc -L$(zte_lib_path)/libsoft_timer
+LDLIBS += -latutils -L$(zte_lib_path)/libatutils
+LDLIBS += -lsqlite -L$(zte_lib_path)/libsqlite
+LDLIBS += -latext -L$(zte_lib_path)/libatext
+LDLIBS += -lm
+#LDLIBS += -ltinyalsa -L$(zte_lib_path)/libtinyalsa
+LDLIBS += -lcpnv -L$(zte_lib_path)/libcpnv
+LDLIBS += -lamt -L$(zte_lib_path)/libamt
+LDLIBS += -lkey -L$(zte_lib_path)/libkey
+
+LDLIBS += -lcurl -L$(zte_lib_path)/libcurl/install/lib
+
+
+LDLIBS += -lztedmapp -L$(zte_lib_path)/libzte_dmapp
+#LIBSHARE_GS = ../zte_comm/fota_dm/gs_lib/libdmgr.so.1
+#LDLIBS += -L../zte_comm/fota_dm/gs_lib -ldmgr
+
+LIBSHARE_GS = ../zte_comm/fota_dm/rs_lib/librsdlsdk.so
+LDLIBS += -L../zte_comm/fota_dm/rs_lib -lrsdlsdk
+LDLIBS1 += -lnvram_sc -L$(zte_lib_path)/libnvram -lpthread
+LDLIBS1 += -lsoftap -L$(zte_lib_path)/libsoftap
+LDLIBS1 += -lsoft_timer_sc -L$(zte_lib_path)/libsoft_timer
+
+ifeq ($(USE_FOTA_AB),yes)
+LDLIBS += -lupi_ab -L$(LIB_DIR)/libupi_ab
+LDLIBS += -lcrypto -L$(LIB_DIR)/libssl/install/lib
+endif
+
+##############USER COMIZE END##################
+
+all: $(EXEC) $(EXEC1) $(EXEC2)
+ (cd ../zte_comm/fota_dm/gs_lib;rm libdmgr.so;ln -s libdmgr.so.1 libdmgr.so; cd ../../../zte_comm)
+
+$(EXEC): $(OBJS)
+ $(CC) $(LDFLAGS) -o $@ $(OBJS) -Wl,--start-group $(LDLIBS) -Wl,--end-group
+ @cp $@ $@.elf
+
+$(EXEC1): $(OBJS1)
+ $(CC) $(CFLAGS) -o $@ $(OBJS1) -Wl,--start-group $(LDLIBS1) -Wl,--end-group
+ @cp $@ $@.elf
+
+$(EXEC2): $(OBJS2)
+ $(CC) $(CFLAGS) -o $@ $(OBJS2) -Wl,--start-group $(LDLIBS1) -Wl,--end-group
+ @cp $@ $@.elf
+
+romfs:
+ $(ROMFSINST) /sbin/$(EXEC)
+ $(ROMFSINST) /sbin/$(EXEC1)
+ $(ROMFSINST) /sbin/$(EXEC2)
+ $(ROMFSINST) $(LIBSHARE_GS) /lib/
+
+clean:
+ -rm -f $(EXEC) *.elf *.gdb *.o
+ -rm -f $(EXEC1) *.elf *.gdb *.o
+ -rm -f $(EXEC2) *.elf *.gdb *.o
+ -find ../zte_comm/ -name \*.o -exec rm -rf {} \;
+ -find . -name \*.o -exec rm -rf {} \;
+
+
diff --git a/ap/app/zte_mdl/zte_mdl.c b/ap/app/zte_mdl/zte_mdl.c
new file mode 100755
index 0000000..cc43ce2
--- /dev/null
+++ b/ap/app/zte_mdl/zte_mdl.c
@@ -0,0 +1,145 @@
+#define _GNU_SOURCE /**/
+
+#include <string.h>
+#include <stdio.h>
+#include <stdarg.h>
+#include <stdlib.h>
+#include <time.h>
+#include <syslog.h>
+#include <unistd.h>
+#include <errno.h>
+#include <signal.h>
+#include <netdb.h>
+#include <sys/types.h>
+#include <sys/ioctl.h>
+#include <sys/socket.h>
+#include <sys/time.h>
+#include <sys/uio.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <sys/sysctl.h>
+#include <net/if.h>
+#include <poll.h>
+#include <stddef.h>
+#include <linux/if_packet.h>
+#include <netinet/ether.h>
+#include <netinet/if_ether.h>
+#include <arpa/inet.h>
+#include <pthread.h>
+#include <zte_mdl.h>
+
+void nvserver_entry(void)
+{
+ nvserver_main(0,NULL);
+ return;
+}
+
+void at_ctl_entry(char *arg)
+{
+ //printf("at_ctl_entry boot:%s\n", arg);
+ char *argv[2];
+ argv[0] = NULL;
+ argv[1] = arg;
+
+ at_ctl_main(2, argv);
+ return;
+}
+
+void rtc_service_entry(char *arg)
+{
+ rtc_service_main(0,NULL);
+ return;
+}
+
+void zte_mainctrl_entry(char *arg)
+{
+ zte_mainctrl_main(0,NULL);
+ return;
+}
+
+void zte_hotplug_entry(char *arg)
+{
+ zte_hotplug_main(0,NULL);
+ return;
+}
+
+void zte_audio_res_ctrl_entry(char *arg)
+{
+ zte_audio_res_ctrl_main(0,NULL);
+ return;
+}
+
+void zte_drv_serial_ctrl_entry(char *arg)
+{
+ zte_drv_serial_ctrl_main();
+ return;
+}
+
+void zte_drv_usb_ctrl_entry(char *arg)
+{
+ zte_drv_usb_ctrl_main(0,NULL);
+ return;
+}
+
+void sntp_entry(char *arg)
+{
+ sntp_main(0,NULL);
+ return;
+}
+void fota_dm_entry(char *arg)
+{
+ fota_dm_main(0,NULL);
+ //return; //kw 3
+}
+
+int main(int argc, char *argv[])
+{
+ /* nvserver */
+ pthread_t nvserver_thread_tid;
+ pthread_create(&nvserver_thread_tid, NULL, (void *)nvserver_entry, NULL);
+
+ /* zte_drv_serial_ctrl */
+ pthread_t zte_drv_serial_ctrl_thread_tid;
+ pthread_create(&zte_drv_serial_ctrl_thread_tid, NULL, (void *)zte_drv_serial_ctrl_entry, NULL);
+ /* zte_drv_usb_ctrl */
+ pthread_t zte_drv_usb_ctrl_thread_tid;
+ pthread_create(&zte_drv_usb_ctrl_thread_tid, NULL, (void *)zte_drv_usb_ctrl_entry, NULL);
+
+ if (0 != strcmp(argv[2], "amt")) { //³äµç»òÕý³£¿ª»úģʽ
+ /* zte_hotplug */
+ pthread_t zte_hotplug_thread_tid;
+ pthread_create(&zte_hotplug_thread_tid, NULL, (void *)zte_hotplug_entry, NULL);
+
+#if(PRODUCT_TYPE != PRODUCT_TH)
+ /* at_ctl */
+ pthread_t at_ctl_thread_tid;
+ pthread_create(&at_ctl_thread_tid, NULL, (void *)at_ctl_entry, argv[1]);
+ /* rtc_service */
+ pthread_t rtc_service_thread_tid;
+ pthread_create(&rtc_service_thread_tid, NULL, (void *)rtc_service_entry, NULL);
+ /* zte_mainctrl */
+ pthread_t zte_mainctrl_thread_tid;
+ pthread_create(&zte_mainctrl_thread_tid, NULL, (void *)zte_mainctrl_entry, NULL);
+#endif
+
+ /* zte_audio_res_ctrl */
+ pthread_t zte_audio_res_ctrl_thread_tid;
+ pthread_create(&zte_audio_res_ctrl_thread_tid, NULL, (void *)zte_audio_res_ctrl_entry, NULL);
+
+ /* sntp */
+ //pthread_t sntp_thread_tid;
+ //pthread_create(&sntp_thread_tid, NULL, (void *)sntp_entry, NULL);
+ /* zte_fota */
+ pthread_t fota_dm_thread_tid;
+ pthread_create(&fota_dm_thread_tid, NULL, (void *)fota_dm_entry, NULL);
+
+ }
+ while(1)
+ {
+ sleep(20);
+ //printf("zte app test -1 \n");
+ }
+
+ return 0;
+}
+
diff --git a/ap/app/zte_mdl/zte_mdl.h b/ap/app/zte_mdl/zte_mdl.h
new file mode 100755
index 0000000..db52330
--- /dev/null
+++ b/ap/app/zte_mdl/zte_mdl.h
@@ -0,0 +1,49 @@
+/*******************************************************************************
+* °æÈ¨ËùÓÐ (C)2016, ÖÐÐËͨѶ¹É·ÝÓÐÏÞ¹«Ë¾¡£
+*
+* ÎļþÃû³Æ: zte_mdl.h
+* Îļþ±êʶ: zte_mdl.h
+* ÄÚÈÝÕªÒª: mdlºÏ²¢Ó¦ÓÃÍ·Îļþ
+* ʹÓ÷½·¨: #include <zte_mdl.h>
+*
+*
+*******************************************************************************/
+#ifndef _ZTE_MDL_H
+#define _ZTE_MDL_H
+
+/*******************************************************************************
+* Í·Îļþ *
+*******************************************************************************/
+
+
+/*******************************************************************************
+* ºê¶¨Òå *
+*******************************************************************************/
+
+
+/*******************************************************************************
+* Êý¾ÝÀàÐͶ¨Òå *
+*******************************************************************************/
+
+
+/*******************************************************************************
+* È«¾Ö±äÁ¿ÉùÃ÷ *
+*******************************************************************************/
+
+
+/*******************************************************************************
+* È«¾Öº¯ÊýÉùÃ÷ *
+*******************************************************************************/
+int nvserver_main(int argc, char *argv[]);
+int at_ctl_main(int argc, char * argv[]);
+int rtc_service_main(int argc, char **argv);
+int zte_mainctrl_main(int argc, char * argv[]);
+int zte_hotplug_main(int argc, char * argv[]);
+int zte_audio_res_ctrl_main(int argc, char * argv[]);
+int zte_drv_serial_ctrl_main();
+int zte_drv_usb_ctrl_main(int argc, char* argv[]);
+int sntp_main(int argc, char * argv[]);
+int fota_dm_main(int argc, char**argv);
+
+#endif
+