[Feature][ZXW-88]merge P50 version

Only Configure: No
Affected branch: master
Affected module: unknown
Is it affected on both ZXIC and MTK: only ZXIC
Self-test: Yes
Doc Update: No

Change-Id: I34667719d9e0e7e29e8e4368848601cde0a48408
diff --git a/ap/app/zte_mdl/Makefile b/ap/app/zte_mdl/Makefile
index 9d99db3..00654ef 100755
--- a/ap/app/zte_mdl/Makefile
+++ b/ap/app/zte_mdl/Makefile
@@ -25,6 +25,127 @@
 OBJS += ../zte_comm/nvserver/nvserver.o  ../zte_comm/nvserver/nvupdate.o

 endif

 

+ifeq ($(USE_VEHICLE_DC_REF),yes)

+#wifi

+ifeq ($(CONFIG_WIFI_MODULE),realtek)

+CFLAGS	 +=	-D__REALTEK_8192_CHIP__

+ifeq ($(CONFIG_WIFI_RTL_WPA2),yes)

+tools_dir += ../zte_comm/wlan/realtek_tools_wpa2/auth  ../zte_comm/wlan/realtek_tools_wpa2/mini_upnp ../zte_comm/wlan/realtek_tools_wpa2/utility

+tools_dir += ../zte_comm/wlan/realtek_tools_wpa2/wsc ../zte_comm/wlan/realtek_tools_wpa2/wireless_tools.25

+else

+tools_dir += ../zte_comm/wlan/realtek_tools/auth  ../zte_comm/wlan/realtek_tools/mini_upnp ../zte_comm/wlan/realtek_tools/utility

+tools_dir += ../zte_comm/wlan/realtek_tools/wsc ../zte_comm/wlan/realtek_tools/wireless_tools.25

+endif

+else ifeq ($(CONFIG_WIFI_MODULE),rda5995)

+CFLAGS	 += -D__RDA_5995_CHIP__

+tools_dir += ../zte_comm/wlan/rda_tools

+else ifeq ($(CONFIG_WIFI_MODULE),esp8089)

+CFLAGS	 += -D__ESP_8089_CHIP__

+tools_dir += ../zte_comm/wlan/esp_tools/eagle_test   ../zte_comm/wlan/esp_tools/fcctest

+else ifeq ($(CONFIG_WIFI_MODULE),xr819)

+CFLAGS	 += -D__XR_819_CHIP__

+#tools_dir +=

+else ifeq ($(CONFIG_WIFI_MODULE),ssv6x5x)

+CFLAGS	 += -D__SSV_6X5X_CHIP__

+#tools_dir +=

+else ifeq ($(CONFIG_WIFI_MODULE),aic8800)

+CFLAGS	 += -D__AIC_8800DW_CHIP__

+tools_dir += ../zte_comm/wlan/aic_tools/rftest

+ifeq ($(CONFIG_WIFI_SINGLEAP), no)

+CFLAGS  +=  -D__MULTI_AP__

+endif

+endif

+

+$(warning  CONFIG_WIFI_FUNCTION=$(CONFIG_WIFI_FUNCTION))

+

+ifeq ($(findstring sta,$(CONFIG_WIFI_FUNCTION)), sta)

+WLAN_STA_FUNC=yes

+endif

+

+ifeq ($(findstring ap,$(CONFIG_WIFI_FUNCTION)), ap)

+WLAN_AP_FUNC=yes

+endif

+

+CFLAGS 	 += -D__QRCODE_WIFI__

+CFLAGS 	 += -D__USE_AES__

+

+ifeq ($(WLAN_STA_FUNC),yes)

+CFLAGS += -D__STA_FUNC__

+CFLAGS	 += -I$(zte_app_path)/wpa_supplicant-2.10/src/common

+LDLIBS   += -lwpa_client -L$(zte_app_path)/wpa_supplicant-2.10/wpa_supplicant

+endif

+

+ifeq ($(WLAN_AP_FUNC),yes)

+CFLAGS += -D__AP_FUNC__

+ifneq ($(WLAN_STA_FUNC),yes)

+CFLAGS	 += -I$(zte_app_path)/hostapd-2.10/src/common

+LDLIBS   += -lwpa_client -L$(zte_app_path)/hostapd-2.10/hostapd

+endif

+endif

+

+OBJS +=  ../zte_comm/wlan/src/wlan_main.o ../zte_comm/wlan/src/wifi_socket.o ../zte_comm/wlan/src/wlan_rtc_sleep.o ../zte_comm/wlan/src/wifi_drv_ko.o \

+		  ../zte_comm/wlan/src/wifi_sta_ctrl.o ../zte_comm/wlan/src/wifi_util.o  ../zte_comm/wlan/src/wlan_config_ssid.o   ../zte_comm/wlan/src/wlan_netlink.o ../zte_comm/wlan/src/Vector.o

+ifeq ($(CONFIG_WIFI_MODULE),realtek)

+OBJS +=  ../zte_comm/wlan/src/wifi_hal.o

+	ifeq ($(WLAN_STA_FUNC),yes)

+		OBJS +=  ../zte_comm/wlan/src/wlan-station.o

+	endif

+LDLIBS   += -lwlan_interface

+LDLIBS   += -L$(zte_lib_path)/libwlan_interface

+else ifeq ($(CONFIG_WIFI_MODULE),rda5995)

+	ifeq ($(WLAN_STA_FUNC),yes)

+		OBJS += ../zte_comm/wlan/src/wlan_sta_manager.o  ../zte_comm/wlan/src/wlan_sm.o 

+	endif

+	

+	ifeq ($(WLAN_AP_FUNC),yes)

+		OBJS += ../zte_comm/wlan/src/wifi_ap_ctrl.o

+LDLIBS   += -lwlan_interface

+LDLIBS   += -L$(zte_lib_path)/libwlan_interface

+	endif

+else ifeq ($(CONFIG_WIFI_MODULE),esp8089)

+	ifeq ($(WLAN_STA_FUNC),yes)

+		OBJS += ../zte_comm/wlan/src/wlan_sta_manager.o  ../zte_comm/wlan/src/wlan_sm.o 

+	endif

+	

+	ifeq ($(WLAN_AP_FUNC),yes)

+		OBJS += ../zte_comm/wlan/src/wifi_ap_ctrl.o

+LDLIBS   += -lwlan_interface

+LDLIBS   += -L$(zte_lib_path)/libwlan_interface		

+	endif

+else ifeq ($(CONFIG_WIFI_MODULE),xr819)

+	ifeq ($(WLAN_STA_FUNC),yes)

+		OBJS += ../zte_comm/wlan/src/wlan_sta_manager.o  ../zte_comm/wlan/src/wlan_sm.o 

+	endif

+	

+	ifeq ($(WLAN_AP_FUNC),yes)

+		OBJS += ../zte_comm/wlan/src/wifi_ap_ctrl.o

+LDLIBS   += -lwlan_interface

+LDLIBS   += -L$(zte_lib_path)/libwlan_interface		

+	endif

+else ifeq ($(CONFIG_WIFI_MODULE),ssv6x5x)

+	ifeq ($(WLAN_STA_FUNC),yes)

+		OBJS += ../zte_comm/wlan/src/wlan-station.o 

+	endif

+	

+	ifeq ($(WLAN_AP_FUNC),yes)

+		OBJS += ../zte_comm/wlan/src/wifi_ap_ctrl.o

+LDLIBS   += -lwlan_interface

+LDLIBS   += -L$(zte_lib_path)/libwlan_interface		

+	endif

+else ifeq ($(CONFIG_WIFI_MODULE),aic8800)

+	ifeq ($(WLAN_STA_FUNC),yes)

+		OBJS += ../zte_comm/wlan/src/wlan-station.o 

+	endif

+	

+	ifeq ($(WLAN_AP_FUNC),yes)

+		OBJS += ../zte_comm/wlan/src/wifi_ap_ctrl.o

+LDLIBS   += -lwlan_interface

+LDLIBS   += -L$(zte_lib_path)/libwlan_interface		

+	endif

+endif

+CFLAGS	 += -I../zte_comm/wlan/inc

+endif

+

 OBJS1 = ../zte_comm/rtc-service/zte-rtc-clock.o

 OBJS2 = ../zte_comm/zte_mainctrl/router_msg_proxy.o

 #aes

@@ -74,7 +195,7 @@
 CFLAGS 	+= -I$(zte_lib_path)/libzte_dmapp/inc

 

 ifeq ($(USE_FOTA_AB),yes)

-CFLAGS += -I$(LIB_DIR)/libupi_ab/inc

+CFLAGS += -I$(LIB_DIR)/libflags

 endif

 

 #*******************************************************************************

@@ -115,13 +236,15 @@
 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

+LDLIBS += -lflags  -L$(zte_lib_path)/libflags

 endif

 

 ##############USER COMIZE END##################

 

 all: $(EXEC) $(EXEC1) $(EXEC2)

+ifneq ($(tools_dir), )

+	for i in $(tools_dir) ; do $(MAKE) -C $$i || exit $?; done

+endif

 	(cd ../zte_comm/fota_dm/gs_lib;rm libdmgr.so;ln -s libdmgr.so.1  libdmgr.so; cd ../../../zte_comm)

 

 $(EXEC): $(OBJS)

@@ -141,6 +264,9 @@
 	$(ROMFSINST)  /sbin/$(EXEC1)

 	$(ROMFSINST)  /sbin/$(EXEC2)

 	$(ROMFSINST) $(LIBSHARE_GS) /lib/

+ifneq ($(tools_dir), )

+	for i in $(tools_dir) ; do $(MAKE) -C $$i romfs || exit $?; done

+endif

 

 clean:

 	-rm -f $(EXEC) *.elf *.gdb *.o

@@ -148,5 +274,8 @@
 	-rm -f $(EXEC2) *.elf *.gdb *.o

 	-find ../zte_comm/ -name \*.o -exec rm -rf {} \; 

 	-find . -name \*.o -exec rm -rf {} \;

+ifneq ($(tools_dir), )

+	for i in $(tools_dir) ; do $(MAKE) -C $$i clean || exit $?; done

+endif

 

 

diff --git a/ap/app/zte_mdl/zte_mdl.c b/ap/app/zte_mdl/zte_mdl.c
index 2beb93f..1142fb0 100755
--- a/ap/app/zte_mdl/zte_mdl.c
+++ b/ap/app/zte_mdl/zte_mdl.c
@@ -86,6 +86,11 @@
 	sntp_main(0,NULL);
 	return;
 }
+void wlan_entry(char *arg)
+{
+	wlan_main(0,NULL);
+	return;
+}
 void fota_dm_entry(char *arg)
 {
 	fota_dm_main(0,NULL);
@@ -122,6 +127,12 @@
 		pthread_create(&zte_mainctrl_thread_tid, NULL, (void *)zte_mainctrl_entry, NULL);
 #endif		
 
+#ifdef _USE_VEHICLE_DC_REF
+		/* wifi_manager */
+		pthread_t wlan_thread_tid;
+		pthread_create(&wlan_thread_tid, NULL, (void *)wlan_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);
diff --git a/ap/app/zte_mdl/zte_mdl.h b/ap/app/zte_mdl/zte_mdl.h
index db52330..6357432 100755
--- a/ap/app/zte_mdl/zte_mdl.h
+++ b/ap/app/zte_mdl/zte_mdl.h
@@ -43,6 +43,7 @@
 int zte_drv_serial_ctrl_main();
 int zte_drv_usb_ctrl_main(int argc, char* argv[]);
 int sntp_main(int argc, char * argv[]);
+int wlan_main (int argc, char *argv[]);
 int fota_dm_main(int argc, char**argv);
 
 #endif