[Feature][ZXW-285]merge P56U05 version

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

Change-Id: Ied657102425a179a89ef41847170152e8a5d437c
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/conf/distro/vehicle_dc_4Gb.conf b/cap/zx297520v3/sources/meta-zxic-custom/conf/distro/vehicle_dc_4Gb.conf
index b99813f..bd1da84 100755
--- a/cap/zx297520v3/sources/meta-zxic-custom/conf/distro/vehicle_dc_4Gb.conf
+++ b/cap/zx297520v3/sources/meta-zxic-custom/conf/distro/vehicle_dc_4Gb.conf
@@ -14,6 +14,7 @@
 PREFERRED_PROVIDER_virtual/kernel  = "linux-zxic"
 PREFERRED_VERSION_linux-zxic      = "5.10.156"
 PREFERRED_VERSION_busybox      = "1.33.1"
+#PREFERRED_VERSION_openssl      = "1.1.1l"
 
 TCLIBC = "glibc"
 VIRTUAL-RUNTIME_dev_manager   = "busybox-mdev"
@@ -138,6 +139,9 @@
 CONFIG_TEL_API_SUPPORT = "BL"
 
 CUSTOM_MACRO  		+= "${@bb.utils.contains('CONFIG_TEL_API_SUPPORT', 'BL', '-D_USE_BL', '', d)}"
+#多媒体编解码库支持类型"FFMPEG","NONE"
+CONFIG_MSMSVR_CODEC_TYPE = "NONE"
+CUSTOM_MACRO  		+= "${@bb.utils.contains('CONFIG_MSMSVR_CODEC_TYPE', 'FFMPEG', '-D_USE_FFMPEG', '', d)}"
 
 # app and libs 配置
 #normal的版本应用及库
@@ -252,6 +256,7 @@
 	vo-amrwbenc \
 	ffmpeg \
 	"
+meta_app_open += "${@bb.utils.contains('CONFIG_MSMSVR_CODEC_TYPE', 'FFMPEG', 'fdk-aac-master opencore-amr vo-amrwbenc ffmpeg', '', d)}"
 
 #normal的版本应用及库
 zxic_app += "\
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/conf/distro/vehicle_dc_ref.conf b/cap/zx297520v3/sources/meta-zxic-custom/conf/distro/vehicle_dc_ref.conf
index 79b141c..5c79bd2 100755
--- a/cap/zx297520v3/sources/meta-zxic-custom/conf/distro/vehicle_dc_ref.conf
+++ b/cap/zx297520v3/sources/meta-zxic-custom/conf/distro/vehicle_dc_ref.conf
@@ -14,6 +14,7 @@
 PREFERRED_PROVIDER_virtual/kernel  = "linux-zxic"
 PREFERRED_VERSION_linux-zxic      = "5.10.156"
 PREFERRED_VERSION_busybox      = "1.33.1"
+#PREFERRED_VERSION_openssl      = "1.1.1l"
 
 TCLIBC = "glibc"
 VIRTUAL-RUNTIME_dev_manager   = "busybox-mdev"
@@ -157,6 +158,10 @@
 DISTRO_FEATURES += " vehicle_dc_ref "
 CUSTOM_MACRO += "${@bb.utils.contains('DISTRO_FEATURES', 'vehicle_dc_ref', '-D_USE_VEHICLE_DC_REF', '', d)}"
 
+#多媒体编解码库支持类型"FFMPEG","NONE"
+CONFIG_MSMSVR_CODEC_TYPE = "NONE"
+CUSTOM_MACRO  		+= "${@bb.utils.contains('CONFIG_MSMSVR_CODEC_TYPE', 'FFMPEG', '-D_USE_FFMPEG', '', d)}"
+
 # app and libs 配置
 #normal的版本应用及库
 zxic_lib += "\
@@ -180,6 +185,7 @@
 	libbinder \
 	libflags \
 	libmsmsvr \
+	libscrtc \
         liblynq-uci \
         liblynq-shm \
         liblynq-log \
@@ -278,6 +284,7 @@
 	service-test \
 	i2cslavetest \
 	fota-auto-sync \
+	softap-demo \
 	lynq-ril-service \
 	lynq-sdk-ready \
         lynq-led-demo \
@@ -341,6 +348,7 @@
 	python3 \
 	lrzsz \
 	"
+meta_app_open += "${@bb.utils.contains('CONFIG_MSMSVR_CODEC_TYPE', 'FFMPEG', 'fdk-aac-master opencore-amr vo-amrwbenc ffmpeg', '', d)}"
 
 #normal的版本应用及库
 zxic_app += "\
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/mdl/fs/normal/rootfs/etc_ro/default/default_parameter_sys b/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/mdl/fs/normal/rootfs/etc_ro/default/default_parameter_sys
index 1c83464..aa28c29 100755
--- a/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/mdl/fs/normal/rootfs/etc_ro/default/default_parameter_sys
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/mdl/fs/normal/rootfs/etc_ro/default/default_parameter_sys
@@ -408,11 +408,12 @@
 G_IMS_CMGF=0
 ECALL_MTTEST=0
 POWER_CONTROL=0
-NOT_KEEP_TCP_CONN=0
+NOT_KEEP_TCP_CONN=1
 T3396_SUPPORT=0
 T3396_CAUSE_REASON=8,27,32,33
 T3396_DURATION=720
 T3396_COUNTS=3
 ECALL_T2_TIMER=3600
 NGECALL_FORTEST=0
+CUSTOMER_FLAG=0
 #for volte end
\ No newline at end of file
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc/fs/normal/rootfs/etc_ro/default/default_parameter_sys b/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc/fs/normal/rootfs/etc_ro/default/default_parameter_sys
index f592b7f..636cedd 100755
--- a/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc/fs/normal/rootfs/etc_ro/default/default_parameter_sys
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc/fs/normal/rootfs/etc_ro/default/default_parameter_sys
@@ -430,13 +430,14 @@
 G_IMS_CMGF=0
 ECALL_MTTEST=0
 POWER_CONTROL=0
-NOT_KEEP_TCP_CONN=0
+NOT_KEEP_TCP_CONN=1
 T3396_SUPPORT=0
 T3396_CAUSE_REASON=8,27,32,33
 T3396_DURATION=720
 T3396_COUNTS=3
 ECALL_T2_TIMER=3600
 NGECALL_FORTEST=0
+CUSTOMER_FLAG=0
 #for volte end
 DEBUG_INFO_DISABLE=0
 DEBUG_INFO_FILE_PATH=/mnt/userdata
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc/fs/normal/rootfs/etc_ro/default/default_parameter_user b/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc/fs/normal/rootfs/etc_ro/default/default_parameter_user
index 8248a6e..7839262 100755
--- a/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc/fs/normal/rootfs/etc_ro/default/default_parameter_user
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc/fs/normal/rootfs/etc_ro/default/default_parameter_user
@@ -107,6 +107,7 @@
 ethwan_priority=3
 fast_usb=usblan0
 fastnat_level=2
+fastbr_level=1
 IPPortFilterEnable=0
 IPPortFilterRules_0=
 IPPortFilterRules_1=
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_4Gb/fs/normal/rootfs/etc/init.d/first.sh b/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_4Gb/fs/normal/rootfs/etc/init.d/first.sh
index ef09932..da06b17 100755
--- a/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_4Gb/fs/normal/rootfs/etc/init.d/first.sh
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_4Gb/fs/normal/rootfs/etc/init.d/first.sh
@@ -59,4 +59,5 @@
 ifconfig lo 127.0.0.1 up
 
 echo 2 > /proc/sys/kernel/randomize_va_space
+echo 2 > /proc/sys/kernel/kptr_restrict
 
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_4Gb/fs/normal/rootfs/etc_ro/default/default_parameter_sys b/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_4Gb/fs/normal/rootfs/etc_ro/default/default_parameter_sys
index 7cecd03..57c1ad7 100755
--- a/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_4Gb/fs/normal/rootfs/etc_ro/default/default_parameter_sys
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_4Gb/fs/normal/rootfs/etc_ro/default/default_parameter_sys
@@ -430,13 +430,14 @@
 G_IMS_CMGF=0
 ECALL_MTTEST=0
 POWER_CONTROL=0
-NOT_KEEP_TCP_CONN=0
+NOT_KEEP_TCP_CONN=1
 T3396_SUPPORT=0
 T3396_CAUSE_REASON=8,27,32,33
 T3396_DURATION=720
 T3396_COUNTS=3
 ECALL_T2_TIMER=3600
 NGECALL_FORTEST=0
+CUSTOMER_FLAG=0
 #for volte end
 DEBUG_INFO_DISABLE=0
 DEBUG_INFO_FILE_PATH=/mnt/userdata
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_4Gb/fs/normal/rootfs/etc_ro/default/default_parameter_user b/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_4Gb/fs/normal/rootfs/etc_ro/default/default_parameter_user
index 954b3a0..dc03706 100755
--- a/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_4Gb/fs/normal/rootfs/etc_ro/default/default_parameter_user
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_4Gb/fs/normal/rootfs/etc_ro/default/default_parameter_user
@@ -107,6 +107,7 @@
 ethwan_priority=3
 fast_usb=usblan0
 fastnat_level=2
+fastbr_level=1
 IPPortFilterEnable=0
 IPPortFilterRules_0=
 IPPortFilterRules_1=
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_4Gb/fs/normal/rootfs/sbin/oem_zxic_verify_3 b/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_4Gb/fs/normal/rootfs/sbin/oem_zxic_verify_3
new file mode 100755
index 0000000..3c43ccf
--- /dev/null
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_4Gb/fs/normal/rootfs/sbin/oem_zxic_verify_3
Binary files differ
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_4Gb/fs/normal/rootfs/sbin/ubi_mount.sh b/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_4Gb/fs/normal/rootfs/sbin/ubi_mount.sh
index b2b967f..9e79e6a 100755
--- a/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_4Gb/fs/normal/rootfs/sbin/ubi_mount.sh
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_4Gb/fs/normal/rootfs/sbin/ubi_mount.sh
@@ -17,14 +17,17 @@
   fs_type=$4
 fi
 
+secboot=$(cat /proc/cmdline | grep "pubkeyhash=")
+sestatus=$(sestatus | grep "SELinux status" | awk '{print $NF}')
+
 if [ x"$UBI_MNT_OPT" = x"" ]; then
   UBI_MNT_OPT=rw,noatime
 fi
 if [ x"$fs_type" = x"squashfs" ]; then
-  if [ -d "/etc/selinux" ];then
-	UBI_MNT_OPT=ro,defcontext=system_u:object_r:default_t:s0
+  if [ x"$sestatus" = x"enabled" ]; then
+    UBI_MNT_OPT=ro,defcontext=system_u:object_r:default_t:s0
   else
-	UBI_MNT_OPT=ro
+    UBI_MNT_OPT=ro
   fi
 fi
 echo "mount_point:$mount_point"
@@ -100,10 +103,14 @@
 fi
 
 if [ $fs_type = "squashfs" ]; then
-  if [ -f /etc_ro/dm-verity ]; then
+  if [[ "$secboot" != "" ]]; then
     zxic_parse_squashfs_verity /dev/$g_ubiblock_dev /tmp/sign /tmp/raw_table /tmp/hash_tree_offset
     #openssl dgst -sha256 -verify  /etc_ro/dm-verity-pub.pem  -signature /tmp/sign /tmp/raw_table
-    oem_zxic_verify -s /tmp/sign -f /tmp/raw_table
+    if [ -f /usr/lib/libcrypto.so.3 ]; then
+      oem_zxic_verify_3 -s /tmp/sign -f /tmp/raw_table
+    else
+      oem_zxic_verify -s /tmp/sign -f /tmp/raw_table
+    fi
     if [ $? -ne 0 ]; then
       echo "dm-verity sign verify fail"
       exit 1
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_ref/fs/normal/rootfs/etc/init.d/first.sh b/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_ref/fs/normal/rootfs/etc/init.d/first.sh
index 977f4c5..b3dc7dd 100755
--- a/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_ref/fs/normal/rootfs/etc/init.d/first.sh
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_ref/fs/normal/rootfs/etc/init.d/first.sh
@@ -63,4 +63,5 @@
 ifconfig lo 127.0.0.1 up
 
 echo 2 > /proc/sys/kernel/randomize_va_space
+echo 2 > /proc/sys/kernel/kptr_restrict
 
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_ref/fs/normal/rootfs/etc_ro/default/default_parameter_sys b/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_ref/fs/normal/rootfs/etc_ro/default/default_parameter_sys
index 6bf0dba..a304f5f 100755
--- a/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_ref/fs/normal/rootfs/etc_ro/default/default_parameter_sys
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_ref/fs/normal/rootfs/etc_ro/default/default_parameter_sys
@@ -440,13 +440,14 @@
 G_IMS_CMGF=0
 ECALL_MTTEST=0
 POWER_CONTROL=0
-NOT_KEEP_TCP_CONN=0
+NOT_KEEP_TCP_CONN=1
 T3396_SUPPORT=0
 T3396_CAUSE_REASON=8,27,32,33
 T3396_DURATION=720
 T3396_COUNTS=3
 ECALL_T2_TIMER=3600
 NGECALL_FORTEST=0
+CUSTOMER_FLAG=0
 #for volte end
 DEBUG_INFO_DISABLE=0
 DEBUG_INFO_FILE_PATH=/mnt/userdata
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_ref/fs/normal/rootfs/etc_ro/default/default_parameter_user b/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_ref/fs/normal/rootfs/etc_ro/default/default_parameter_user
index af42ce7..90a1d43 100755
--- a/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_ref/fs/normal/rootfs/etc_ro/default/default_parameter_user
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_ref/fs/normal/rootfs/etc_ro/default/default_parameter_user
@@ -109,6 +109,7 @@
 ethwan_priority=3
 fast_usb=usblan0
 fastnat_level=2
+fastbr_level=1
 IPPortFilterEnable=0
 IPPortFilterRules_0=
 IPPortFilterRules_1=
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_ref/fs/normal/rootfs/sbin/oem_zxic_verify_3 b/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_ref/fs/normal/rootfs/sbin/oem_zxic_verify_3
new file mode 100755
index 0000000..3c43ccf
--- /dev/null
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_ref/fs/normal/rootfs/sbin/oem_zxic_verify_3
Binary files differ
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_ref/fs/normal/rootfs/sbin/ubi_mount.sh b/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_ref/fs/normal/rootfs/sbin/ubi_mount.sh
index a1c329d..9e79e6a 100755
--- a/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_ref/fs/normal/rootfs/sbin/ubi_mount.sh
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_ref/fs/normal/rootfs/sbin/ubi_mount.sh
@@ -106,7 +106,11 @@
   if [[ "$secboot" != "" ]]; then
     zxic_parse_squashfs_verity /dev/$g_ubiblock_dev /tmp/sign /tmp/raw_table /tmp/hash_tree_offset
     #openssl dgst -sha256 -verify  /etc_ro/dm-verity-pub.pem  -signature /tmp/sign /tmp/raw_table
-    oem_zxic_verify -s /tmp/sign -f /tmp/raw_table
+    if [ -f /usr/lib/libcrypto.so.3 ]; then
+      oem_zxic_verify_3 -s /tmp/sign -f /tmp/raw_table
+    else
+      oem_zxic_verify -s /tmp/sign -f /tmp/raw_table
+    fi
     if [ $? -ne 0 ]; then
       echo "dm-verity sign verify fail"
       exit 1
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_systemd/fs/normal/rootfs/etc_ro/default/default_parameter_sys b/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_systemd/fs/normal/rootfs/etc_ro/default/default_parameter_sys
index 7cecd03..57c1ad7 100755
--- a/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_systemd/fs/normal/rootfs/etc_ro/default/default_parameter_sys
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_systemd/fs/normal/rootfs/etc_ro/default/default_parameter_sys
@@ -430,13 +430,14 @@
 G_IMS_CMGF=0
 ECALL_MTTEST=0
 POWER_CONTROL=0
-NOT_KEEP_TCP_CONN=0
+NOT_KEEP_TCP_CONN=1
 T3396_SUPPORT=0
 T3396_CAUSE_REASON=8,27,32,33
 T3396_DURATION=720
 T3396_COUNTS=3
 ECALL_T2_TIMER=3600
 NGECALL_FORTEST=0
+CUSTOMER_FLAG=0
 #for volte end
 DEBUG_INFO_DISABLE=0
 DEBUG_INFO_FILE_PATH=/mnt/userdata
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_systemd/fs/normal/rootfs/etc_ro/default/default_parameter_user b/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_systemd/fs/normal/rootfs/etc_ro/default/default_parameter_user
index d1d4125..3fbb096 100755
--- a/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_systemd/fs/normal/rootfs/etc_ro/default/default_parameter_user
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_systemd/fs/normal/rootfs/etc_ro/default/default_parameter_user
@@ -107,6 +107,7 @@
 ethwan_priority=3
 fast_usb=usblan0
 fastnat_level=2
+fastbr_level=1
 IPPortFilterEnable=0
 IPPortFilterRules_0=
 IPPortFilterRules_1=
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_systemd/fs/normal/rootfs/sbin/oem_zxic_verify_3 b/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_systemd/fs/normal/rootfs/sbin/oem_zxic_verify_3
new file mode 100755
index 0000000..3c43ccf
--- /dev/null
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_systemd/fs/normal/rootfs/sbin/oem_zxic_verify_3
Binary files differ
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_systemd/fs/normal/rootfs/sbin/ubi_mount.sh b/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_systemd/fs/normal/rootfs/sbin/ubi_mount.sh
index b2b967f..9e79e6a 100755
--- a/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_systemd/fs/normal/rootfs/sbin/ubi_mount.sh
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_systemd/fs/normal/rootfs/sbin/ubi_mount.sh
@@ -17,14 +17,17 @@
   fs_type=$4
 fi
 
+secboot=$(cat /proc/cmdline | grep "pubkeyhash=")
+sestatus=$(sestatus | grep "SELinux status" | awk '{print $NF}')
+
 if [ x"$UBI_MNT_OPT" = x"" ]; then
   UBI_MNT_OPT=rw,noatime
 fi
 if [ x"$fs_type" = x"squashfs" ]; then
-  if [ -d "/etc/selinux" ];then
-	UBI_MNT_OPT=ro,defcontext=system_u:object_r:default_t:s0
+  if [ x"$sestatus" = x"enabled" ]; then
+    UBI_MNT_OPT=ro,defcontext=system_u:object_r:default_t:s0
   else
-	UBI_MNT_OPT=ro
+    UBI_MNT_OPT=ro
   fi
 fi
 echo "mount_point:$mount_point"
@@ -100,10 +103,14 @@
 fi
 
 if [ $fs_type = "squashfs" ]; then
-  if [ -f /etc_ro/dm-verity ]; then
+  if [[ "$secboot" != "" ]]; then
     zxic_parse_squashfs_verity /dev/$g_ubiblock_dev /tmp/sign /tmp/raw_table /tmp/hash_tree_offset
     #openssl dgst -sha256 -verify  /etc_ro/dm-verity-pub.pem  -signature /tmp/sign /tmp/raw_table
-    oem_zxic_verify -s /tmp/sign -f /tmp/raw_table
+    if [ -f /usr/lib/libcrypto.so.3 ]; then
+      oem_zxic_verify_3 -s /tmp/sign -f /tmp/raw_table
+    else
+      oem_zxic_verify -s /tmp/sign -f /tmp/raw_table
+    fi
     if [ $? -ne 0 ]; then
       echo "dm-verity sign verify fail"
       exit 1
diff --git a/cap/zx297520v3/sources/meta-zxic/recipes-app/adctest/adctest.bb b/cap/zx297520v3/sources/meta-zxic/recipes-app/adctest/adctest.bb
index 48e68f8..6575494 100755
--- a/cap/zx297520v3/sources/meta-zxic/recipes-app/adctest/adctest.bb
+++ b/cap/zx297520v3/sources/meta-zxic/recipes-app/adctest/adctest.bb
@@ -1,6 +1,6 @@
 DESCRIPTION = "adctest"
 
-DEPENDS     = "libbsp"
+DEPENDS     = "libnvram libbsp"
 SECTION     = "app"
 LICENSE     = "zte"
 PV = "1.0.0"
diff --git a/cap/zx297520v3/sources/meta-zxic/recipes-app/bsp-test/bsp-test.bb b/cap/zx297520v3/sources/meta-zxic/recipes-app/bsp-test/bsp-test.bb
old mode 100644
new mode 100755
index e11b648..8ff57ae
--- a/cap/zx297520v3/sources/meta-zxic/recipes-app/bsp-test/bsp-test.bb
+++ b/cap/zx297520v3/sources/meta-zxic/recipes-app/bsp-test/bsp-test.bb
@@ -1,5 +1,5 @@
 DESCRIPTION = "bsp_test"
-DEPENDS     = "libbsp"
+DEPENDS     = "libnvram libbsp"
 SECTION     = "app"
 LICENSE     = "zte"
 PV = "1.0.0"
diff --git a/cap/zx297520v3/sources/meta-zxic/recipes-app/crc-api/crc-api.bb b/cap/zx297520v3/sources/meta-zxic/recipes-app/crc-api/crc-api.bb
index 394ba90..2a0278c 100755
--- a/cap/zx297520v3/sources/meta-zxic/recipes-app/crc-api/crc-api.bb
+++ b/cap/zx297520v3/sources/meta-zxic/recipes-app/crc-api/crc-api.bb
@@ -1,6 +1,6 @@
 DESCRIPTION = "crc-api"
 
-DEPENDS     = "libbsp"
+DEPENDS     = "libnvram libbsp"
 SECTION     = "app"
 LICENSE     = "zte"
 PV = "1.0.0"
diff --git a/cap/zx297520v3/sources/meta-zxic/recipes-app/ethtest/ethtest.bb b/cap/zx297520v3/sources/meta-zxic/recipes-app/ethtest/ethtest.bb
old mode 100644
new mode 100755
index 64930c6..1f0fe73
--- a/cap/zx297520v3/sources/meta-zxic/recipes-app/ethtest/ethtest.bb
+++ b/cap/zx297520v3/sources/meta-zxic/recipes-app/ethtest/ethtest.bb
@@ -1,6 +1,6 @@
 DESCRIPTION = "ethtest"
 
-DEPENDS     = "libbsp"
+DEPENDS     = "libnvram libbsp"
 SECTION     = "app"
 LICENSE     = "zte"
 PV = "1.0.0"
diff --git a/cap/zx297520v3/sources/meta-zxic/recipes-app/i2cslavetest/i2cslavetest.bb b/cap/zx297520v3/sources/meta-zxic/recipes-app/i2cslavetest/i2cslavetest.bb
index 9161b90..0720d04 100755
--- a/cap/zx297520v3/sources/meta-zxic/recipes-app/i2cslavetest/i2cslavetest.bb
+++ b/cap/zx297520v3/sources/meta-zxic/recipes-app/i2cslavetest/i2cslavetest.bb
@@ -1,6 +1,6 @@
 DESCRIPTION = "i2cslavetest"
 
-DEPENDS     = "libbsp"
+DEPENDS     = "libnvram libbsp"
 SECTION     = "app"
 LICENSE     = "zte"
 PV = "1.0.0"
diff --git a/cap/zx297520v3/sources/meta-zxic/recipes-app/i2ctest/i2ctest.bb b/cap/zx297520v3/sources/meta-zxic/recipes-app/i2ctest/i2ctest.bb
old mode 100644
new mode 100755
index 3a2c18b..3cf6b95
--- a/cap/zx297520v3/sources/meta-zxic/recipes-app/i2ctest/i2ctest.bb
+++ b/cap/zx297520v3/sources/meta-zxic/recipes-app/i2ctest/i2ctest.bb
@@ -1,6 +1,6 @@
 DESCRIPTION = "i2ctest"
 
-DEPENDS     = "libbsp"
+DEPENDS     = "libnvram libbsp"
 SECTION     = "app"
 LICENSE     = "zte"
 PV = "1.0.0"
diff --git a/cap/zx297520v3/sources/meta-zxic/recipes-app/libbsp/libbsp.bb b/cap/zx297520v3/sources/meta-zxic/recipes-app/libbsp/libbsp.bb
index 51336a8..e12662d 100755
--- a/cap/zx297520v3/sources/meta-zxic/recipes-app/libbsp/libbsp.bb
+++ b/cap/zx297520v3/sources/meta-zxic/recipes-app/libbsp/libbsp.bb
@@ -12,6 +12,12 @@
            file://libbsp \
           "
 
+
+DEPENDS = "libnvram"
+DEPENDS += " \
+    ${@bb.utils.contains('DISTRO_FEATURES', 'volte', 'libvoice', '', d)} \
+    "
+
 S       = "${WORKDIR}"
 #引用公用头文件和编译选项。
 include ${BSPDIR}/sources/meta-zxic/conf/app_com.inc
diff --git a/cap/zx297520v3/sources/meta-zxic/recipes-app/libmsmsvr/libmsmsvr.bb b/cap/zx297520v3/sources/meta-zxic/recipes-app/libmsmsvr/libmsmsvr.bb
index e593884..614759c 100755
--- a/cap/zx297520v3/sources/meta-zxic/recipes-app/libmsmsvr/libmsmsvr.bb
+++ b/cap/zx297520v3/sources/meta-zxic/recipes-app/libmsmsvr/libmsmsvr.bb
@@ -1,11 +1,13 @@
 DESCRIPTION = "libmsmsvr"
-DEPENDS     = "libtinyalsa ffmpeg"
+DEPENDS     = "libtinyalsa"
 SECTION     = "lib"
 LICENSE     = "zte"
 PV          = "1.0.0"
 PR          = "r0"
 LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/zte;md5=c075689d1d1e06d4ab5bbe53623a6808"
 
+DEPENDS += "${@bb.utils.contains('CONFIG_MSMSVR_CODEC_TYPE', 'FFMPEG', 'ffmpeg', '', d)}"
+
 #配置code路径信息。
 FILESEXTRAPATHS_prepend :="${APP-OPEN-PATH}/platform:"
 SRC_URI = " \
diff --git a/cap/zx297520v3/sources/meta-zxic/recipes-app/msm-svr/msm-svr.bb b/cap/zx297520v3/sources/meta-zxic/recipes-app/msm-svr/msm-svr.bb
index fc04350..3d6ef12 100755
--- a/cap/zx297520v3/sources/meta-zxic/recipes-app/msm-svr/msm-svr.bb
+++ b/cap/zx297520v3/sources/meta-zxic/recipes-app/msm-svr/msm-svr.bb
@@ -5,7 +5,7 @@
 PV = "1.0.0"
 PR = "r0"
 
-DEPENDS += "fdk-aac-master opencore-amr vo-amrwbenc ffmpeg"
+DEPENDS += "${@bb.utils.contains('CONFIG_MSMSVR_CODEC_TYPE', 'FFMPEG', 'fdk-aac-master opencore-amr vo-amrwbenc ffmpeg', '', d)}"
 CLASS_COM = " \
     ${@bb.utils.contains('DISTRO_FEATURES', 'procd', 'openwrt openwrt-services', '', d)} \
     ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd', '', d)} \
@@ -29,7 +29,7 @@
 
 #编译
 do_compile() {
-	make -C msm_svr
+	make -C msm_svr CONFIG_MSMSVR_CODEC_TYPE=${CONFIG_MSMSVR_CODEC_TYPE}
 }
 
 #库文件的安装
diff --git a/cap/zx297520v3/sources/meta-zxic/recipes-app/player-demo/player-demo.bb b/cap/zx297520v3/sources/meta-zxic/recipes-app/player-demo/player-demo.bb
index 9dfff33..4ae8c08 100755
--- a/cap/zx297520v3/sources/meta-zxic/recipes-app/player-demo/player-demo.bb
+++ b/cap/zx297520v3/sources/meta-zxic/recipes-app/player-demo/player-demo.bb
@@ -1,5 +1,5 @@
 DESCRIPTION = "player_demo"
-DEPENDS     = "libmedia libscipc"
+DEPENDS     = "libmedia libscipc libsofttimer libsoftap libnvram"
 SECTION     = "app"
 LICENSE     = "zte"
 PV = "1.0.0"
@@ -63,4 +63,4 @@
 SYSTEMD_SERVICE_${PN}     = "player_demo.service"
 SYSTEMD_AUTO_ENABLE_${PN} = "disable"
 
-RDEPENDS_${PN} = " libmedia libscipc"
+RDEPENDS_${PN} = " libmedia libscipc libsofttimer libsoftap libnvram"
diff --git a/cap/zx297520v3/sources/meta-zxic/recipes-app/softap-demo/softap-demo.bb b/cap/zx297520v3/sources/meta-zxic/recipes-app/softap-demo/softap-demo.bb
new file mode 100755
index 0000000..b519bca
--- /dev/null
+++ b/cap/zx297520v3/sources/meta-zxic/recipes-app/softap-demo/softap-demo.bb
@@ -0,0 +1,64 @@
+DESCRIPTION = "softap_demo"
+DEPENDS     = "libsoftap libatutils libsofttimer libnvram"
+SECTION     = "app"
+LICENSE     = "zte"
+PV = "1.0.0"
+PR = "r0"
+
+CLASS_COM = " \
+    ${@bb.utils.contains('DISTRO_FEATURES', 'procd', 'openwrt openwrt-services', '', d)} \
+    ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd', '', d)} \
+"
+inherit ${CLASS_COM}
+
+#配置code路径信息。
+FILESEXTRAPATHS_prepend :="${APP-OPEN-PATH}:"
+SRC_URI = " \
+          file://test/softap_demo \		  
+		  ${@bb.utils.contains("DISTRO_FEATURES", "procd", "file://softap_demo.init","", d)} \
+		  ${@bb.utils.contains("DISTRO_FEATURES", "systemd", "file://softap_demo.service","", d)} \
+          "
+LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/zte;md5=c075689d1d1e06d4ab5bbe53623a6808"
+S = "${WORKDIR}"
+S_SRC_PATH = "${S}/test/softap_demo"
+#引用公用头文件和编译选项。
+include ${BSPDIR}/sources/meta-zxic/conf/app_com.inc
+
+#inherit autotools pkgconfig systemd
+
+do_compile() {
+	make -C ${S_SRC_PATH}
+}
+
+do_install () {
+	install -d ${D}${bindir}/
+	install -m 0755 ${S_SRC_PATH}/softap_demo ${D}${bindir}/
+	
+	if ${@bb.utils.contains('DISTRO_FEATURES','procd','true','false',d)}; then
+		install -Dm 0755 ${WORKDIR}/softap_demo.init ${D}${sysconfdir}/init.d/softap_demo
+	fi
+
+	if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then
+		install -d ${D}${systemd_unitdir}/system
+		install -m 0644 ${WORKDIR}/softap_demo.service ${D}${systemd_unitdir}/system
+	fi
+	
+	#install elfs
+	install -d ${ELFS-PATH}/
+	install -m 0755 ${S_SRC_PATH}/softap_demo ${ELFS-PATH}/	
+}
+
+do_cleanlibs () {
+	rm -fr ${ELFS-PATH}/softap_demo
+}
+
+addtask  cleanlibs after do_clean  before do_cleansstate
+
+FILES_${PN} = "\
+    ${bindir}/ \
+    ${@bb.utils.contains("DISTRO_FEATURES", "procd", "${sysconfdir}/init.d/softap_demo","", d)} \
+    "
+SYSTEMD_SERVICE_${PN}     = "softap_demo.service"
+SYSTEMD_AUTO_ENABLE_${PN} = "disable"
+
+RDEPENDS_${PN} = " libsoftap libatutils libsofttimer libnvram"
diff --git a/cap/zx297520v3/sources/meta-zxic/recipes-app/softap-demo/softap-demo/softap_demo.init b/cap/zx297520v3/sources/meta-zxic/recipes-app/softap-demo/softap-demo/softap_demo.init
new file mode 100755
index 0000000..b7d0655
--- /dev/null
+++ b/cap/zx297520v3/sources/meta-zxic/recipes-app/softap-demo/softap-demo/softap_demo.init
@@ -0,0 +1,21 @@
+#!/bin/sh /etc/rc.common
+
+START=18
+STOP=85
+USE_PROCD=1
+
+logger -t softap_demo
+
+start_service() {
+	procd_open_instance
+	procd_set_param command /usr/bin/softap_demo
+	procd_set_param stdout 1  # forward stdout of the command to logd
+	procd_set_param stderr 1  # same for stderr
+	procd_set_param respawn
+	procd_close_instance
+}
+
+stop_service() 
+{
+	echo "add clean code"
+}
diff --git a/cap/zx297520v3/sources/meta-zxic/recipes-app/softap-demo/softap-demo/softap_demo.service b/cap/zx297520v3/sources/meta-zxic/recipes-app/softap-demo/softap-demo/softap_demo.service
new file mode 100755
index 0000000..8356947
--- /dev/null
+++ b/cap/zx297520v3/sources/meta-zxic/recipes-app/softap-demo/softap-demo/softap_demo.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=The softap_demo service
+
+[Service]
+Type=simple
+ExecStart=/usr/bin/softap_demo
+Restart=always
+
+[Install]
+WantedBy=basic.target
+
diff --git a/cap/zx297520v3/sources/meta-zxic/recipes-app/spitest/spitest.bb b/cap/zx297520v3/sources/meta-zxic/recipes-app/spitest/spitest.bb
index 8e0fd39..a92b230 100755
--- a/cap/zx297520v3/sources/meta-zxic/recipes-app/spitest/spitest.bb
+++ b/cap/zx297520v3/sources/meta-zxic/recipes-app/spitest/spitest.bb
@@ -1,6 +1,6 @@
 DESCRIPTION = "spitest"
 #nv依赖libnvram库
-DEPENDS    += "libbsp"
+DEPENDS    += "libnvram libbsp"
 SECTION     = "spitest"
 LICENSE     = "zte"
 PV = "1.0.0"
diff --git a/cap/zx297520v3/sources/meta-zxic/recipes-app/uarttest/uarttest.bb b/cap/zx297520v3/sources/meta-zxic/recipes-app/uarttest/uarttest.bb
index 3153ce4..dfe0dcf 100755
--- a/cap/zx297520v3/sources/meta-zxic/recipes-app/uarttest/uarttest.bb
+++ b/cap/zx297520v3/sources/meta-zxic/recipes-app/uarttest/uarttest.bb
@@ -1,6 +1,6 @@
 DESCRIPTION = "uarttest"

 

-DEPENDS     = "libbsp"

+DEPENDS     = "libnvram libbsp"

 SECTION     = "app"

 LICENSE     = "zte"

 PV = "1.0.0"

diff --git a/cap/zx297520v3/sources/meta-zxic/recipes-app/y2038-tests/y2038-tests.bb b/cap/zx297520v3/sources/meta-zxic/recipes-app/y2038-tests/y2038-tests.bb
new file mode 100755
index 0000000..ebc0c90
--- /dev/null
+++ b/cap/zx297520v3/sources/meta-zxic/recipes-app/y2038-tests/y2038-tests.bb
@@ -0,0 +1,52 @@
+DESCRIPTION = "y2038-tests"

+

+DEPENDS     = ""

+SECTION     = "app"

+LICENSE     = "zte"

+PV = "1.0.0"

+PR = "r0"

+

+CLASS_COM = " \

+    ${@bb.utils.contains('DISTRO_FEATURES', 'procd', 'openwrt openwrt-services', '', d)} \

+    ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd', '', d)} \

+"

+inherit ${CLASS_COM}

+

+FILESEXTRAPATHS_prepend :="${APP-OPEN-PATH}/test:"

+SRC_URI = " \

+    file://y2038-tests \

+    "

+

+LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/zte;md5=c075689d1d1e06d4ab5bbe53623a6808"

+S = "${WORKDIR}"

+

+include ${BSPDIR}/sources/meta-zxic/conf/app_com.inc

+include ${BSPDIR}/sources/meta-zxic/conf/pub.inc

+CFLAGS_append = "${ZXIC_EXTRA_CFLAGS}"

+

+do_compile() {

+	make -C y2038-tests

+}

+

+

+do_install() {

+	install -d ${D}${bindir}/

+	install -m 0777 ${S}/y2038-tests/test_n2038 ${D}${bindir}/

+	install -m 0777 ${S}/y2038-tests/test_y2038 ${D}${bindir}/

+

+	#install elfs

+	install -d ${ELFS-PATH}/

+	install -m 0755 ${S}/y2038-tests/test_n2038 ${ELFS-PATH}/

+	install -m 0755 ${S}/y2038-tests/test_y2038 ${ELFS-PATH}/

+}

+

+do_cleanlibs () {

+	rm -fr ${ELFS-PATH}/test_n2038

+	rm -fr ${ELFS-PATH}/test_y2038

+}

+

+addtask  cleanlibs after do_clean  before do_cleansstate

+

+FILES_${PN} = "\

+    ${bindir}/ \

+    "

diff --git a/cap/zx297520v3/sources/meta-zxic/recipes-kernel/linux/files/zx297520v3/linux-5_10-vehicle_dc-normal-defconfig b/cap/zx297520v3/sources/meta-zxic/recipes-kernel/linux/files/zx297520v3/linux-5_10-vehicle_dc-normal-defconfig
index c8727c1..928650f 100755
--- a/cap/zx297520v3/sources/meta-zxic/recipes-kernel/linux/files/zx297520v3/linux-5_10-vehicle_dc-normal-defconfig
+++ b/cap/zx297520v3/sources/meta-zxic/recipes-kernel/linux/files/zx297520v3/linux-5_10-vehicle_dc-normal-defconfig
@@ -1390,7 +1390,6 @@
 # CONFIG_VITESSE_PHY is not set
 # CONFIG_XILINX_GMII2RGMII is not set
 # CONFIG_MICREL_KS8995MA is not set
-CONFIG_JLSEMI_PHY=y
 CONFIG_MDIO_DEVICE=y
 CONFIG_MDIO_BUS=y
 CONFIG_OF_MDIO=y
diff --git a/cap/zx297520v3/sources/meta-zxic/recipes-support/dnsmasq/dnsmasq/CVE-2023-28450.patch b/cap/zx297520v3/sources/meta-zxic/recipes-support/dnsmasq/dnsmasq/CVE-2023-28450.patch
new file mode 100755
index 0000000..704f59f
--- /dev/null
+++ b/cap/zx297520v3/sources/meta-zxic/recipes-support/dnsmasq/dnsmasq/CVE-2023-28450.patch
@@ -0,0 +1,41 @@
+From 4be6cd5e821aa622c7bd4af87618b7518871b3f2 Mon Sep 17 00:00:00 2001
+From: =?utf-8?q?=E5=91=A8=E5=9B=BD=E5=9D=A1=200318000136?=
+ <zhou.guopo@sanechips.com.cn>
+Date: Mon, 29 Apr 2024 09:08:26 +0800
+Subject: [PATCH] CVE-2023-28450
+
+---
+ man/dnsmasq.8 | 3 ++-
+ src/config.h  | 2 +-
+ 2 files changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/man/dnsmasq.8 b/man/dnsmasq.8
+index 2495ed1..5c7e4d3 100644
+--- a/man/dnsmasq.8
++++ b/man/dnsmasq.8
+@@ -183,7 +183,8 @@ to zero completely disables DNS function, leaving only DHCP and/or TFTP.
+ .TP
+ .B \-P, --edns-packet-max=<size>
+ Specify the largest EDNS.0 UDP packet which is supported by the DNS
+-forwarder. Defaults to 4096, which is the RFC5625-recommended size.
++forwarder. Defaults to 1232, which is the recommended size following the
++DNS flag day in 2020. Only increase if you know what you are doing.
+ .TP
+ .B \-Q, --query-port=<query_port>
+ Send outbound DNS queries from, and listen for their replies on, the
+diff --git a/src/config.h b/src/config.h
+index 1e7b30f..37b374e 100644
+--- a/src/config.h
++++ b/src/config.h
+@@ -19,7 +19,7 @@
+ #define CHILD_LIFETIME 150 /* secs 'till terminated (RFC1035 suggests > 120s) */
+ #define TCP_MAX_QUERIES 100 /* Maximum number of queries per incoming TCP connection */
+ #define TCP_BACKLOG 32  /* kernel backlog limit for TCP connections */
+-#define EDNS_PKTSZ 4096 /* default max EDNS.0 UDP packet from RFC5625 */
++#define EDNS_PKTSZ 1232 /* default max EDNS.0 UDP packet from from  /dnsflagday.net/2020 */
+ #define SAFE_PKTSZ 1232 /* "go anywhere" UDP packet size, see https://dnsflagday.net/2020/ */
+ #define KEYBLOCK_LEN 40 /* choose to minimise fragmentation when storing DNSSEC keys */
+ #define DNSSEC_WORK 50 /* Max number of queries to validate one question */
+-- 
+2.17.1
+
diff --git a/cap/zx297520v3/sources/meta-zxic/recipes-support/dnsmasq/dnsmasq_2.88.bb b/cap/zx297520v3/sources/meta-zxic/recipes-support/dnsmasq/dnsmasq_2.88.bb
old mode 100644
new mode 100755
index f17001d..ffcccd3
--- a/cap/zx297520v3/sources/meta-zxic/recipes-support/dnsmasq/dnsmasq_2.88.bb
+++ b/cap/zx297520v3/sources/meta-zxic/recipes-support/dnsmasq/dnsmasq_2.88.bb
@@ -4,5 +4,6 @@
 SRC_URI[dnsmasq-2.88.sha256sum] = "da9d26aa3f3fc15f3b58b94edbb9ddf744cbce487194ea480bd8e7381b3ca028"
 SRC_URI += " \
     file://lua.patch \
+    file://CVE-2023-28450.patch \
 "
 
diff --git a/cap/zx297520v3/sources/meta-zxic/recipes-support/openssl/files/environment.d-openssl.sh b/cap/zx297520v3/sources/meta-zxic/recipes-support/openssl/files/environment.d-openssl.sh
new file mode 100755
index 0000000..6f23490
--- /dev/null
+++ b/cap/zx297520v3/sources/meta-zxic/recipes-support/openssl/files/environment.d-openssl.sh
@@ -0,0 +1,5 @@
+export OPENSSL_CONF="$OECORE_NATIVE_SYSROOT/usr/lib/ssl/openssl.cnf"
+export SSL_CERT_DIR="$OECORE_NATIVE_SYSROOT/usr/lib/ssl/certs"
+export SSL_CERT_FILE="$OECORE_NATIVE_SYSROOT/usr/lib/ssl/certs/ca-certificates.crt"
+export OPENSSL_MODULES="$OECORE_NATIVE_SYSROOT/usr/lib/ossl-modules/"
+export OPENSSL_ENGINES="$OECORE_NATIVE_SYSROOT/usr/lib/engines-3"
diff --git a/cap/zx297520v3/sources/meta-zxic/recipes-support/openssl/openssl/0001-Configure-do-not-tweak-mips-cflags.patch b/cap/zx297520v3/sources/meta-zxic/recipes-support/openssl/openssl/0001-Configure-do-not-tweak-mips-cflags.patch
new file mode 100755
index 0000000..af43547
--- /dev/null
+++ b/cap/zx297520v3/sources/meta-zxic/recipes-support/openssl/openssl/0001-Configure-do-not-tweak-mips-cflags.patch
@@ -0,0 +1,36 @@
+From 326909baf81a638d51fa8be1d8227518784f5cc4 Mon Sep 17 00:00:00 2001
+From: Alexander Kanavin <alex@linutronix.de>
+Date: Tue, 14 Sep 2021 12:18:25 +0200
+Subject: [PATCH] Configure: do not tweak mips cflags
+
+This conflicts with mips machine definitons from yocto,
+e.g.
+| Error: -mips3 conflicts with the other architecture options, which imply -mips64r2
+
+Upstream-Status: Inappropriate [oe-core specific]
+Signed-off-by: Alexander Kanavin <alex@linutronix.de>
+---
+ Configure | 10 ----------
+ 1 file changed, 10 deletions(-)
+
+Index: openssl-3.0.4/Configure
+===================================================================
+--- openssl-3.0.4.orig/Configure
++++ openssl-3.0.4/Configure
+@@ -1423,16 +1423,6 @@ if ($target =~ /^mingw/ && `$config{CC}
+         push @{$config{shared_ldflag}}, "-mno-cygwin";
+         }
+ 
+-if ($target =~ /linux.*-mips/ && !$disabled{asm}
+-        && !grep { $_ =~ /-m(ips|arch=)/ } (@{$config{CFLAGS}})) {
+-        # minimally required architecture flags for assembly modules
+-        my $value;
+-        $value = '-mips2' if ($target =~ /mips32/);
+-        $value = '-mips3' if ($target =~ /mips64/);
+-        unshift @{$config{cflags}}, $value;
+-        unshift @{$config{cxxflags}}, $value if $config{CXX};
+-}
+-
+ # If threads aren't disabled, check how possible they are
+ unless ($disabled{threads}) {
+     if ($auto_threads) {
diff --git a/cap/zx297520v3/sources/meta-zxic/recipes-support/openssl/openssl/0001-buildinfo-strip-sysroot-and-debug-prefix-map-from-co.patch b/cap/zx297520v3/sources/meta-zxic/recipes-support/openssl/openssl/0001-buildinfo-strip-sysroot-and-debug-prefix-map-from-co.patch
new file mode 100755
index 0000000..bafdbaa
--- /dev/null
+++ b/cap/zx297520v3/sources/meta-zxic/recipes-support/openssl/openssl/0001-buildinfo-strip-sysroot-and-debug-prefix-map-from-co.patch
@@ -0,0 +1,78 @@
+From 5985253f2c9025d7c127443a3a9938946f80c2a1 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Martin=20Hundeb=C3=B8ll?= <martin@geanix.com>
+Date: Tue, 6 Nov 2018 14:50:47 +0100
+Subject: [PATCH] buildinfo: strip sysroot and debug-prefix-map from compiler
+ info
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+The openssl build system generates buildinf.h containing the full
+compiler command line used to compile objects. This breaks
+reproducibility, as the compile command is baked into libcrypto, where
+it is used when running `openssl version -f`.
+
+Add stripped build variables for the compiler and cflags lines, and use
+those when generating buildinfo.h.
+
+This is based on a similar patch for older openssl versions:
+https://patchwork.openembedded.org/patch/147229/
+
+Upstream-Status: Inappropriate [OE specific]
+Signed-off-by: Martin Hundebøll <martin@geanix.com>
+
+Update to fix buildpaths qa issue for '-fmacro-prefix-map'.
+
+Signed-off-by: Kai Kang <kai.kang@windriver.com>
+
+Update to fix buildpaths qa issue for '-ffile-prefix-map'.
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+
+---
+ Configurations/unix-Makefile.tmpl | 12 +++++++++++-
+ crypto/build.info                 |  2 +-
+ 2 files changed, 12 insertions(+), 2 deletions(-)
+
+Index: openssl-3.0.4/Configurations/unix-Makefile.tmpl
+===================================================================
+--- openssl-3.0.4.orig/Configurations/unix-Makefile.tmpl
++++ openssl-3.0.4/Configurations/unix-Makefile.tmpl
+@@ -472,13 +472,23 @@ BIN_LDFLAGS={- join(' ', $target{bin_lfl
+                          '$(CNF_LDFLAGS)', '$(LDFLAGS)') -}
+ BIN_EX_LIBS=$(CNF_EX_LIBS) $(EX_LIBS)
+ 
+-# CPPFLAGS_Q is used for one thing only: to build up buildinf.h
++# *_Q variables are used for one thing only: to build up buildinf.h
+ CPPFLAGS_Q={- $cppflags1 =~ s|([\\"])|\\$1|g;
+               $cppflags2 =~ s|([\\"])|\\$1|g;
+               $lib_cppflags =~ s|([\\"])|\\$1|g;
+               join(' ', $lib_cppflags || (), $cppflags2 || (),
+                         $cppflags1 || ()) -}
+ 
++CFLAGS_Q={- for (@{$config{CFLAGS}}) {
++              s|-fdebug-prefix-map=[^ ]+|-fdebug-prefix-map=|g;
++              s|-fmacro-prefix-map=[^ ]+|-fmacro-prefix-map=|g;
++              s|-ffile-prefix-map=[^ ]+|-ffile-prefix-map=|g;
++            }
++            join(' ', @{$config{CFLAGS}}) -}
++
++CC_Q={- $config{CC} =~ s|--sysroot=[^ ]+|--sysroot=recipe-sysroot|g;
++        join(' ', $config{CC}) -}
++
+ PERLASM_SCHEME= {- $target{perlasm_scheme} -}
+ 
+ # For x86 assembler: Set PROCESSOR to 386 if you want to support
+Index: openssl-3.0.4/crypto/build.info
+===================================================================
+--- openssl-3.0.4.orig/crypto/build.info
++++ openssl-3.0.4/crypto/build.info
+@@ -109,7 +109,7 @@ DEFINE[../libcrypto]=$UPLINKDEF
+ 
+ DEPEND[info.o]=buildinf.h
+ DEPEND[cversion.o]=buildinf.h
+-GENERATE[buildinf.h]=../util/mkbuildinf.pl "$(CC) $(LIB_CFLAGS) $(CPPFLAGS_Q)" "$(PLATFORM)"
++GENERATE[buildinf.h]=../util/mkbuildinf.pl "$(CC_Q) $(CFLAGS_Q) $(CPPFLAGS_Q)" "$(PLATFORM)"
+ 
+ GENERATE[uplink-x86.S]=../ms/uplink-x86.pl
+ GENERATE[uplink-x86_64.s]=../ms/uplink-x86_64.pl
diff --git a/cap/zx297520v3/sources/meta-zxic/recipes-support/openssl/openssl/CVE-2024-2511.patch b/cap/zx297520v3/sources/meta-zxic/recipes-support/openssl/openssl/CVE-2024-2511.patch
new file mode 100755
index 0000000..8aea686
--- /dev/null
+++ b/cap/zx297520v3/sources/meta-zxic/recipes-support/openssl/openssl/CVE-2024-2511.patch
@@ -0,0 +1,122 @@
+From b52867a9f618bb955bed2a3ce3db4d4f97ed8e5d Mon Sep 17 00:00:00 2001
+From: Matt Caswell <matt@openssl.org>
+Date: Tue, 5 Mar 2024 15:43:53 +0000
+Subject: [PATCH] Fix unconstrained session cache growth in TLSv1.3
+
+In TLSv1.3 we create a new session object for each ticket that we send.
+We do this by duplicating the original session. If SSL_OP_NO_TICKET is in
+use then the new session will be added to the session cache. However, if
+early data is not in use (and therefore anti-replay protection is being
+used), then multiple threads could be resuming from the same session
+simultaneously. If this happens and a problem occurs on one of the threads,
+then the original session object could be marked as not_resumable. When we
+duplicate the session object this not_resumable status gets copied into the
+new session object. The new session object is then added to the session
+cache even though it is not_resumable.
+
+Subsequently, another bug means that the session_id_length is set to 0 for
+sessions that are marked as not_resumable - even though that session is
+still in the cache. Once this happens the session can never be removed from
+the cache. When that object gets to be the session cache tail object the
+cache never shrinks again and grows indefinitely.
+
+CVE-2024-2511
+
+Reviewed-by: Neil Horman <nhorman@openssl.org>
+Reviewed-by: Tomas Mraz <tomas@openssl.org>
+(Merged from https://github.com/openssl/openssl/pull/24044)
+
+(cherry picked from commit 7e4d731b1c07201ad9374c1cd9ac5263bdf35bce)
+
+CVE: CVE-2024-2511
+Upstream-Status: Backport [https://github.com/openssl/openssl/commit/b52867a9f618bb955bed2a3ce3db4d4f97ed8e5d]
+Signed-off-by: Peter Marko <peter.marko@siemens.com>
+---
+ ssl/ssl_lib.c            |  5 +++--
+ ssl/ssl_sess.c           | 28 ++++++++++++++++++++++------
+ ssl/statem/statem_srvr.c |  5 ++---
+ 3 files changed, 27 insertions(+), 11 deletions(-)
+
+diff --git a/ssl/ssl_lib.c b/ssl/ssl_lib.c
+index 2c8479eb5fc69..eed649c6fdee9 100644
+--- a/ssl/ssl_lib.c
++++ b/ssl/ssl_lib.c
+@@ -3736,9 +3736,10 @@ void ssl_update_cache(SSL *s, int mode)
+ 
+     /*
+      * If the session_id_length is 0, we are not supposed to cache it, and it
+-     * would be rather hard to do anyway :-)
++     * would be rather hard to do anyway :-). Also if the session has already
++     * been marked as not_resumable we should not cache it for later reuse.
+      */
+-    if (s->session->session_id_length == 0)
++    if (s->session->session_id_length == 0 || s->session->not_resumable)
+         return;
+ 
+     /*
+diff --git a/ssl/ssl_sess.c b/ssl/ssl_sess.c
+index d836b33ed0e81..75adbd9e52b40 100644
+--- a/ssl/ssl_sess.c
++++ b/ssl/ssl_sess.c
+@@ -152,16 +152,11 @@ SSL_SESSION *SSL_SESSION_new(void)
+     return ss;
+ }
+ 
+-SSL_SESSION *SSL_SESSION_dup(const SSL_SESSION *src)
+-{
+-    return ssl_session_dup(src, 1);
+-}
+-
+ /*
+  * Create a new SSL_SESSION and duplicate the contents of |src| into it. If
+  * ticket == 0 then no ticket information is duplicated, otherwise it is.
+  */
+-SSL_SESSION *ssl_session_dup(const SSL_SESSION *src, int ticket)
++static SSL_SESSION *ssl_session_dup_intern(const SSL_SESSION *src, int ticket)
+ {
+     SSL_SESSION *dest;
+ 
+@@ -285,6 +280,27 @@ SSL_SESSION *ssl_session_dup(const SSL_SESSION *src, int ticket)
+     return NULL;
+ }
+ 
++SSL_SESSION *SSL_SESSION_dup(const SSL_SESSION *src)
++{
++    return ssl_session_dup_intern(src, 1);
++}
++
++/*
++ * Used internally when duplicating a session which might be already shared.
++ * We will have resumed the original session. Subsequently we might have marked
++ * it as non-resumable (e.g. in another thread) - but this copy should be ok to
++ * resume from.
++ */
++SSL_SESSION *ssl_session_dup(const SSL_SESSION *src, int ticket)
++{
++    SSL_SESSION *sess = ssl_session_dup_intern(src, ticket);
++
++    if (sess != NULL)
++        sess->not_resumable = 0;
++
++    return sess;
++}
++
+ const unsigned char *SSL_SESSION_get_id(const SSL_SESSION *s, unsigned int *len)
+ {
+     if (len)
+diff --git a/ssl/statem/statem_srvr.c b/ssl/statem/statem_srvr.c
+index a9e67f9d32a77..6c942e6bcec29 100644
+--- a/ssl/statem/statem_srvr.c
++++ b/ssl/statem/statem_srvr.c
+@@ -2338,9 +2338,8 @@ int tls_construct_server_hello(SSL *s, WPACKET *pkt)
+      * so the following won't overwrite an ID that we're supposed
+      * to send back.
+      */
+-    if (s->session->not_resumable ||
+-        (!(s->ctx->session_cache_mode & SSL_SESS_CACHE_SERVER)
+-         && !s->hit))
++    if (!(s->ctx->session_cache_mode & SSL_SESS_CACHE_SERVER)
++            && !s->hit)
+         s->session->session_id_length = 0;
+ 
+     if (usetls13) {
diff --git a/cap/zx297520v3/sources/meta-zxic/recipes-support/openssl/openssl/afalg.patch b/cap/zx297520v3/sources/meta-zxic/recipes-support/openssl/openssl/afalg.patch
new file mode 100755
index 0000000..cf77e87
--- /dev/null
+++ b/cap/zx297520v3/sources/meta-zxic/recipes-support/openssl/openssl/afalg.patch
@@ -0,0 +1,31 @@
+Don't refuse to build afalgeng if cross-compiling or the host kernel is too old.
+
+Upstream-Status: Submitted [hhttps://github.com/openssl/openssl/pull/7688]
+Signed-off-by: Ross Burton <ross.burton@intel.com>
+
+Index: openssl-3.0.4/Configure
+===================================================================
+--- openssl-3.0.4.orig/Configure
++++ openssl-3.0.4/Configure
+@@ -1681,20 +1681,7 @@ $config{CFLAGS} = [ map { $_ eq '--ossl-
+ unless ($disabled{afalgeng}) {
+     $config{afalgeng}="";
+     if (grep { $_ eq 'afalgeng' } @{$target{enable}}) {
+-        my $minver = 4*10000 + 1*100 + 0;
+-        if ($config{CROSS_COMPILE} eq "") {
+-            my $verstr = `uname -r`;
+-            my ($ma, $mi1, $mi2) = split("\\.", $verstr);
+-            ($mi2) = $mi2 =~ /(\d+)/;
+-            my $ver = $ma*10000 + $mi1*100 + $mi2;
+-            if ($ver < $minver) {
+-                disable('too-old-kernel', 'afalgeng');
+-            } else {
+-                push @{$config{engdirs}}, "afalg";
+-            }
+-        } else {
+-            disable('cross-compiling', 'afalgeng');
+-        }
++        push @{$config{engdirs}}, "afalg";
+     } else {
+         disable('not-linux', 'afalgeng');
+     }
diff --git a/cap/zx297520v3/sources/meta-zxic/recipes-support/openssl/openssl/run-ptest b/cap/zx297520v3/sources/meta-zxic/recipes-support/openssl/openssl/run-ptest
new file mode 100755
index 0000000..8dff791
--- /dev/null
+++ b/cap/zx297520v3/sources/meta-zxic/recipes-support/openssl/openssl/run-ptest
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+set -e
+
+# Optional arguments are 'list' to lists all tests, or the test name (base name
+# ie test_evp, not 03_test_evp.t).
+
+export TOP=.
+# OPENSSL_ENGINES is relative from the test binaries
+export OPENSSL_ENGINES=../engines
+
+perl ./test/run_tests.pl $* | sed -u -r -e '/(.*) \.*.ok/ s/^/PASS: /g' -r -e '/Dubious(.*)/ s/^/FAIL: /g' -e '/(.*) \.*.skipped: (.*)/ s/^/SKIP: /g'
diff --git a/cap/zx297520v3/sources/meta-zxic/recipes-support/openssl/openssl%.bbappend b/cap/zx297520v3/sources/meta-zxic/recipes-support/openssl/openssl_1.1.1%.bbappend
old mode 100644
new mode 100755
similarity index 97%
rename from cap/zx297520v3/sources/meta-zxic/recipes-support/openssl/openssl%.bbappend
rename to cap/zx297520v3/sources/meta-zxic/recipes-support/openssl/openssl_1.1.1%.bbappend
index fc1a393..ec95ab5
--- a/cap/zx297520v3/sources/meta-zxic/recipes-support/openssl/openssl%.bbappend
+++ b/cap/zx297520v3/sources/meta-zxic/recipes-support/openssl/openssl_1.1.1%.bbappend
@@ -1,2 +1,3 @@
 
 EXTRA_OECONF_append = " no-zlib no-zlib-dynamic "
+
diff --git a/cap/zx297520v3/sources/meta-zxic/recipes-support/openssl/openssl_3.0.13.bb b/cap/zx297520v3/sources/meta-zxic/recipes-support/openssl/openssl_3.0.13.bb
new file mode 100755
index 0000000..98ecc63
--- /dev/null
+++ b/cap/zx297520v3/sources/meta-zxic/recipes-support/openssl/openssl_3.0.13.bb
@@ -0,0 +1,264 @@
+SUMMARY = "Secure Socket Layer"
+DESCRIPTION = "Secure Socket Layer (SSL) binary and related cryptographic tools."
+HOMEPAGE = "http://www.openssl.org/"
+BUGTRACKER = "http://www.openssl.org/news/vulnerabilities.html"
+SECTION = "libs/network"
+
+LICENSE = "Apache-2.0"
+LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=c75985e733726beaba57bc5253e96d04"
+
+SRC_URI = "http://www.openssl.org/source/openssl-${PV}.tar.gz \
+           file://run-ptest \
+           file://0001-buildinfo-strip-sysroot-and-debug-prefix-map-from-co.patch \
+           file://afalg.patch \
+           file://0001-Configure-do-not-tweak-mips-cflags.patch \
+           file://CVE-2024-2511.patch \
+           "
+
+SRC_URI:append:class-nativesdk = " \
+           file://environment.d-openssl.sh \
+           "
+
+SRC_URI[sha256sum] = "88525753f79d3bec27d2fa7c66aa0b92b3aa9498dafd93d7cfa4b3780cdae313"
+
+inherit lib_package multilib_header multilib_script ptest perlnative
+MULTILIB_SCRIPTS = "${PN}-bin:${bindir}/c_rehash"
+
+PACKAGECONFIG ?= ""
+PACKAGECONFIG:class-native = ""
+PACKAGECONFIG:class-nativesdk = ""
+
+PACKAGECONFIG[cryptodev-linux] = "enable-devcryptoeng,disable-devcryptoeng,cryptodev-linux,,cryptodev-module"
+PACKAGECONFIG[no-tls1] = "no-tls1"
+PACKAGECONFIG[no-tls1_1] = "no-tls1_1"
+
+B = "${WORKDIR}/build"
+do_configure[cleandirs] = "${B}"
+
+#| ./libcrypto.so: undefined reference to `getcontext'
+#| ./libcrypto.so: undefined reference to `setcontext'
+#| ./libcrypto.so: undefined reference to `makecontext'
+EXTRA_OECONF:append:libc-musl = " no-async"
+EXTRA_OECONF:append:libc-musl:powerpc64 = " no-asm"
+
+EXTRA_OECONF:append = " no-zlib no-zlib-dynamic "
+
+# adding devrandom prevents openssl from using getrandom() which is not available on older glibc versions
+# (native versions can be built with newer glibc, but then relocated onto a system with older glibc)
+EXTRA_OECONF:class-native = "--with-rand-seed=os,devrandom"
+EXTRA_OECONF:class-nativesdk = "--with-rand-seed=os,devrandom"
+
+# Relying on hardcoded built-in paths causes openssl-native to not be relocateable from sstate.
+CFLAGS:append:class-native = " -DOPENSSLDIR=/not/builtin -DENGINESDIR=/not/builtin"
+CFLAGS:append:class-nativesdk = " -DOPENSSLDIR=/not/builtin -DENGINESDIR=/not/builtin"
+
+# This allows disabling deprecated or undesirable crypto algorithms.
+# The default is to trust upstream choices.
+DEPRECATED_CRYPTO_FLAGS ?= ""
+
+do_configure () {
+	# When we upgrade glibc but not uninative we see obtuse failures in openssl. Make
+	# the issue really clear that perl isn't functional due to symbol mismatch issues.
+	cat <<- EOF > ${WORKDIR}/perltest
+	#!/usr/bin/env perl
+	use POSIX;
+	EOF
+	chmod a+x ${WORKDIR}/perltest
+	${WORKDIR}/perltest
+
+	os=${HOST_OS}
+	case $os in
+	linux-gnueabi |\
+	linux-gnuspe |\
+	linux-musleabi |\
+	linux-muslspe |\
+	linux-musl )
+		os=linux
+		;;
+	*)
+		;;
+	esac
+	target="$os-${HOST_ARCH}"
+	case $target in
+	linux-arc | linux-microblaze*)
+		target=linux-latomic
+		;;
+	linux-arm*)
+		target=linux-armv4
+		;;
+	linux-aarch64*)
+		target=linux-aarch64
+		;;
+	linux-i?86 | linux-viac3)
+		target=linux-x86
+		;;
+	linux-gnux32-x86_64 | linux-muslx32-x86_64 )
+		target=linux-x32
+		;;
+	linux-gnu64-x86_64)
+		target=linux-x86_64
+		;;
+	linux-mips | linux-mipsel)
+		# specifying TARGET_CC_ARCH prevents openssl from (incorrectly) adding target architecture flags
+		target="linux-mips32 ${TARGET_CC_ARCH}"
+		;;
+	linux-gnun32-mips*)
+		target=linux-mips64
+		;;
+	linux-*-mips64 | linux-mips64 | linux-*-mips64el | linux-mips64el)
+		target=linux64-mips64
+		;;
+	linux-nios2* | linux-sh3 | linux-sh4 | linux-arc*)
+		target=linux-generic32
+		;;
+	linux-powerpc)
+		target=linux-ppc
+		;;
+	linux-powerpc64)
+		target=linux-ppc64
+		;;
+	linux-powerpc64le)
+		target=linux-ppc64le
+		;;
+	linux-riscv32)
+		target=linux-generic32
+		;;
+	linux-riscv64)
+		target=linux-generic64
+		;;
+	linux-sparc | linux-supersparc)
+		target=linux-sparcv9
+		;;
+	mingw32-x86_64)
+		target=mingw64
+		;;
+	esac
+
+	useprefix=${prefix}
+	if [ "x$useprefix" = "x" ]; then
+		useprefix=/
+	fi
+	# WARNING: do not set compiler/linker flags (-I/-D etc.) in EXTRA_OECONF, as they will fully replace the
+	# environment variables set by bitbake. Adjust the environment variables instead.
+	PERLEXTERNAL="$(realpath ${S}/external/perl/Text-Template-*/lib)"
+	test -d "$PERLEXTERNAL" || bberror "PERLEXTERNAL '$PERLEXTERNAL' not found!"
+	HASHBANGPERL="/usr/bin/env perl" PERL=perl PERL5LIB="$PERLEXTERNAL" \
+	perl ${S}/Configure ${EXTRA_OECONF} ${PACKAGECONFIG_CONFARGS} ${DEPRECATED_CRYPTO_FLAGS} --prefix=$useprefix --openssldir=${libdir}/ssl-3 --libdir=${libdir} $target
+	perl ${B}/configdata.pm --dump
+}
+
+do_install () {
+	oe_runmake DESTDIR="${D}" MANDIR="${mandir}" MANSUFFIX=ssl install
+
+	oe_multilib_header openssl/opensslconf.h
+	oe_multilib_header openssl/configuration.h
+
+	# Create SSL structure for packages such as ca-certificates which
+	# contain hard-coded paths to /etc/ssl. Debian does the same.
+	install -d ${D}${sysconfdir}/ssl
+	mv ${D}${libdir}/ssl-3/certs \
+	   ${D}${libdir}/ssl-3/private \
+	   ${D}${libdir}/ssl-3/openssl.cnf \
+	   ${D}${sysconfdir}/ssl/
+
+	# Although absolute symlinks would be OK for the target, they become
+	# invalid if native or nativesdk are relocated from sstate.
+	ln -sf ${@oe.path.relative('${libdir}/ssl-3', '${sysconfdir}/ssl/certs')} ${D}${libdir}/ssl-3/certs
+	ln -sf ${@oe.path.relative('${libdir}/ssl-3', '${sysconfdir}/ssl/private')} ${D}${libdir}/ssl-3/private
+	ln -sf ${@oe.path.relative('${libdir}/ssl-3', '${sysconfdir}/ssl/openssl.cnf')} ${D}${libdir}/ssl-3/openssl.cnf
+}
+
+do_install:append:class-native () {
+	create_wrapper ${D}${bindir}/openssl \
+	    OPENSSL_CONF=${libdir}/ssl-3/openssl.cnf \
+	    SSL_CERT_DIR=${libdir}/ssl-3/certs \
+	    SSL_CERT_FILE=${libdir}/ssl-3/cert.pem \
+	    OPENSSL_ENGINES=${libdir}/engines-3 \
+	    OPENSSL_MODULES=${libdir}/ossl-modules
+}
+
+do_install:append:class-nativesdk () {
+	mkdir -p ${D}${SDKPATHNATIVE}/environment-setup.d
+	install -m 644 ${WORKDIR}/environment.d-openssl.sh ${D}${SDKPATHNATIVE}/environment-setup.d/openssl.sh
+	sed 's|/usr/lib/ssl/|/usr/lib/ssl-3/|g' -i ${D}${SDKPATHNATIVE}/environment-setup.d/openssl.sh
+}
+
+PTEST_BUILD_HOST_FILES += "configdata.pm"
+PTEST_BUILD_HOST_PATTERN = "perl_version ="
+do_install_ptest () {
+	install -d ${D}${PTEST_PATH}/test
+	install -m755 ${B}/test/p_test.so ${D}${PTEST_PATH}/test
+	install -m755 ${B}/test/p_minimal.so ${D}${PTEST_PATH}/test
+	install -m755 ${B}/test/provider_internal_test.cnf ${D}${PTEST_PATH}/test
+
+	# Prune the build tree
+	rm -f ${B}/fuzz/*.* ${B}/test/*.*
+
+	cp ${S}/Configure ${B}/configdata.pm ${D}${PTEST_PATH}
+	sed 's|${S}|${PTEST_PATH}|g' -i ${D}${PTEST_PATH}/configdata.pm
+	cp -r ${S}/external ${B}/test ${S}/test ${B}/fuzz ${S}/util ${B}/util ${D}${PTEST_PATH}
+
+	# For test_shlibload
+	ln -s ${libdir}/libcrypto.so.1.1 ${D}${PTEST_PATH}/
+	ln -s ${libdir}/libssl.so.1.1 ${D}${PTEST_PATH}/
+
+	install -d ${D}${PTEST_PATH}/apps
+	ln -s ${bindir}/openssl ${D}${PTEST_PATH}/apps
+	install -m644 ${S}/apps/*.pem ${S}/apps/*.srl ${S}/apps/openssl.cnf ${D}${PTEST_PATH}/apps
+	install -m755 ${B}/apps/CA.pl ${D}${PTEST_PATH}/apps
+
+	install -d ${D}${PTEST_PATH}/engines
+	install -m755 ${B}/engines/dasync.so ${D}${PTEST_PATH}/engines
+	install -m755 ${B}/engines/loader_attic.so ${D}${PTEST_PATH}/engines
+	install -m755 ${B}/engines/ossltest.so ${D}${PTEST_PATH}/engines
+
+	install -d ${D}${PTEST_PATH}/providers
+	install -m755 ${B}/providers/legacy.so ${D}${PTEST_PATH}/providers
+
+	install -d ${D}${PTEST_PATH}/Configurations
+	cp -rf ${S}/Configurations/* ${D}${PTEST_PATH}/Configurations/
+
+	# seems to be needed with perl 5.32.1
+	install -d ${D}${PTEST_PATH}/util/perl/recipes
+	cp ${D}${PTEST_PATH}/test/recipes/tconversion.pl ${D}${PTEST_PATH}/util/perl/recipes/
+
+	sed 's|${S}|${PTEST_PATH}|g' -i ${D}${PTEST_PATH}/util/wrap.pl
+}
+
+# Add the openssl.cnf file to the openssl-conf package. Make the libcrypto
+# package RRECOMMENDS on this package. This will enable the configuration
+# file to be installed for both the openssl-bin package and the libcrypto
+# package since the openssl-bin package depends on the libcrypto package.
+
+PACKAGES =+ "libcrypto libssl openssl-conf ${PN}-engines ${PN}-misc ${PN}-ossl-module-legacy"
+
+FILES:libcrypto = "${libdir}/libcrypto${SOLIBS}"
+FILES:libssl = "${libdir}/libssl${SOLIBS}"
+FILES:openssl-conf = "${sysconfdir}/ssl/openssl.cnf \
+                      ${libdir}/ssl-3/openssl.cnf* \
+                      "
+FILES:${PN}-engines = "${libdir}/engines-3"
+# ${prefix} comes from what we pass into --prefix at configure time (which is used for INSTALLTOP)
+FILES:${PN}-engines:append:mingw32:class-nativesdk = " ${prefix}${libdir}/engines-3"
+FILES:${PN}-misc = "${libdir}/ssl-3/misc ${bindir}/c_rehash"
+FILES:${PN}-ossl-module-legacy = "${libdir}/ossl-modules/legacy.so"
+FILES:${PN} =+ "${libdir}/ssl-3/* ${libdir}/ossl-modules/"
+FILES:${PN}:append:class-nativesdk = " ${SDKPATHNATIVE}/environment-setup.d/openssl.sh"
+
+CONFFILES:openssl-conf = "${sysconfdir}/ssl/openssl.cnf"
+
+RRECOMMENDS:libcrypto += "openssl-conf ${PN}-ossl-module-legacy"
+RDEPENDS:${PN}-misc = "perl"
+RDEPENDS:${PN}-ptest += "openssl-bin perl perl-modules bash sed"
+
+RDEPENDS:${PN}-bin += "openssl-conf"
+
+BBCLASSEXTEND = "native nativesdk"
+
+CVE_PRODUCT = "openssl:openssl"
+
+CVE_VERSION_SUFFIX = "alphabetical"
+
+# Only affects OpenSSL >= 1.1.1 in combination with Apache < 2.4.37
+# Apache in meta-webserver is already recent enough
+CVE_CHECK_IGNORE += "CVE-2019-0190"
diff --git a/cap/zx297520v3/zxic_code/zxic_binary/zxic_app_release/glibc/include/upi_ab/zxic_fota_ab_upgrade.h b/cap/zx297520v3/zxic_code/zxic_binary/zxic_app_release/glibc/include/upi_ab/zxic_fota_ab_upgrade.h
index 161eb00..3eb124e 100755
--- a/cap/zx297520v3/zxic_code/zxic_binary/zxic_app_release/glibc/include/upi_ab/zxic_fota_ab_upgrade.h
+++ b/cap/zx297520v3/zxic_code/zxic_binary/zxic_app_release/glibc/include/upi_ab/zxic_fota_ab_upgrade.h
@@ -388,5 +388,19 @@
 int zxic_dual_set_package_info(int offset, unsigned int package_len);
 
 
+/*******************************************************************************
+ * º¯ÊýÃû:	zxic_dual_set_upgrade_status
+ * ¹¦ÄÜÃèÊö: ÉèÖÃÉý¼¶×´Ì¬
+ * ÊäÈë²ÎÊý:
+ *	 upgrade_status Éý¼¶×´Ì¬
+ * Êä³ö²ÎÊý: ÎÞ
+ * ·µ»ØÖµ:
+ *	 Z_FOTA_SUCCESS ÉèÖóɹ¦
+ *	 Z_FOTA_FAIL 	ÉèÖÃʧ°Ü
+ * ×¢Òâ:
+ ******************************************************************************/
+int zxic_dual_set_upgrade_status(int upgrade_status);
+
+
 #endif // ZXIC_FOTA_AB_UPGRADE_H
 
diff --git a/cap/zx297520v3/zxic_code/zxic_binary/zxic_app_release/glibc/lib/libupi_ab.a b/cap/zx297520v3/zxic_code/zxic_binary/zxic_app_release/glibc/lib/libupi_ab.a
index f0e2ffb..654eecd 100755
--- a/cap/zx297520v3/zxic_code/zxic_binary/zxic_app_release/glibc/lib/libupi_ab.a
+++ b/cap/zx297520v3/zxic_code/zxic_binary/zxic_app_release/glibc/lib/libupi_ab.a
Binary files differ
diff --git a/cap/zx297520v3/zxic_code/zxic_binary/zxic_app_release/glibc/lib/libupi_ab.so b/cap/zx297520v3/zxic_code/zxic_binary/zxic_app_release/glibc/lib/libupi_ab.so
index 105fa29..ae09444 100755
--- a/cap/zx297520v3/zxic_code/zxic_binary/zxic_app_release/glibc/lib/libupi_ab.so
+++ b/cap/zx297520v3/zxic_code/zxic_binary/zxic_app_release/glibc/lib/libupi_ab.so
Binary files differ
diff --git a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/arch/arm/boot/dts/zx297520v3-pinctrl.dtsi b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/arch/arm/boot/dts/zx297520v3-pinctrl.dtsi
index 94783bb..cbe1753 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/arch/arm/boot/dts/zx297520v3-pinctrl.dtsi
+++ b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/arch/arm/boot/dts/zx297520v3-pinctrl.dtsi
@@ -188,10 +188,13 @@
 	uart1_active: uart1_active {
 		pins = "UART1_RXD", "UART1_TXD";
 		function = "UART1";
+		bias-disabled;
 	};
 	uart1_sleep: uart1_sleep {
-		pins = "EXT_INT10", "EXT_INT11";
+		pins = "UART1_RXD", "UART1_TXD";
 		function = "BGPIO";
+		bias-disabled;
+		input-enable;
 	};
 	uart2_active: uart2_active {
 		pins = "EXT_INT10", "EXT_INT11";
diff --git a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/arch/arm/boot/dts/zx297520v3-vehicle_dc.dts b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/arch/arm/boot/dts/zx297520v3-vehicle_dc.dts
index cf0f609..b8209cf 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/arch/arm/boot/dts/zx297520v3-vehicle_dc.dts
+++ b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/arch/arm/boot/dts/zx297520v3-vehicle_dc.dts
@@ -134,8 +134,8 @@
 //	status = "okay";
 };
 &gmac {
-    pinctrl-names = "state0";
-	pinctrl-0 = <&ext_int13_pins>;
+//   pinctrl-names = "state0";
+//	pinctrl-0 = <&ext_int13_pins>;
     gpios = <&bgpio 124 GPIO_ACTIVE_HIGH>;
     
     port-nums = <6>;
diff --git a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/arch/arm/boot/dts/zx297520v3.dtsi b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/arch/arm/boot/dts/zx297520v3.dtsi
index 92e4177..7c188f0 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/arch/arm/boot/dts/zx297520v3.dtsi
+++ b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/arch/arm/boot/dts/zx297520v3.dtsi
@@ -623,6 +623,7 @@
 			bus-width=<4>;
 			//non-removable;
 			cap-mmc-highspeed;
+			//cap-mmc-hw-reset;
 			keep-power-in-suspend;
 			fifo-watermark-aligned;
 			status = "okay";			
@@ -665,6 +666,7 @@
 				enable_dma = <1>;
 				enable_trans_gap = <0>;
 				trans_gap_num = <0>;
+				setup-immediately = <0>;
 			};		
 			/*spi_test:test@0{
 				compatible = "linux,spi-test";
@@ -713,6 +715,7 @@
 				enable_dma = <1>;
 				enable_trans_gap = <0>;
 				trans_gap_num = <0>;
+				setup-immediately = <0>;
 			};
 		};
 		
diff --git a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/i2c/busses/i2c_private.h b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/i2c/busses/i2c_private.h
index bd09cb8..644895a 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/i2c/busses/i2c_private.h
+++ b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/i2c/busses/i2c_private.h
@@ -88,6 +88,9 @@
     STATE_STOP,

 };

 

+#define ZX29_I2C0 0

+#define ZX29_I2C1 1

+

 #ifdef CONFIG_I2C_ZX29_SLAVE

 enum zx29_i2c_mode {

     MODE_MASTER,

diff --git a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/mtd/ubi/build.c b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/mtd/ubi/build.c
index 59bb042..223b940 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/mtd/ubi/build.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/mtd/ubi/build.c
@@ -894,6 +894,13 @@
 		return -EINVAL;
 	}
 
+	/* UBI cannot work on flashes with zero erasesize. */
+	if (!mtd->erasesize) {
+		pr_err("ubi: refuse attaching mtd%d - zero erasesize flash is not supported\n",
+			mtd->index);
+		return -EINVAL;
+	}
+
 	if (ubi_num == UBI_DEV_NUM_AUTO) {
 		/* Search for an empty slot in the @ubi_devices array */
 		for (ubi_num = 0; ubi_num < UBI_MAX_DEVICES; ubi_num++)
diff --git a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/mtd/ubi/io.c b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/mtd/ubi/io.c
old mode 100644
new mode 100755
index 14d890b..ada5554
--- a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/mtd/ubi/io.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/mtd/ubi/io.c
@@ -453,7 +453,7 @@
 	loff_t addr;
 	uint32_t data = 0;
 	struct ubi_ec_hdr ec_hdr;
-	struct ubi_vid_io_buf vidb;
+	struct ubi_vid_io_buf *vidb;
 
 	/*
 	 * Note, we cannot generally define VID header buffers on stack,
@@ -472,6 +472,10 @@
 	 * corrupted and will try to preserve it, and print scary warnings.
 	 */
 	addr = (loff_t)pnum * ubi->peb_size;
+	vidb = ubi_alloc_vid_buf(ubi, GFP_NOFS);
+	if (!vidb)
+		return -ENOMEM;
+
 	err = ubi_io_read_ec_hdr(ubi, pnum, &ec_hdr, 0);
 	if (err != UBI_IO_BAD_HDR_EBADMSG && err != UBI_IO_BAD_HDR &&
 	    err != UBI_IO_FF){
@@ -480,10 +484,10 @@
 			goto error;
 	}
 
-	ubi_init_vid_buf(ubi, &vidb, &vid_hdr);
-	ubi_assert(&vid_hdr == ubi_get_vid_hdr(&vidb));
+	//ubi_init_vid_buf(ubi, &vidb, &vid_hdr);
+	//ubi_assert(&vid_hdr == ubi_get_vid_hdr(&vidb));
 
-	err = ubi_io_read_vid_hdr(ubi, pnum, &vidb, 0);
+	err = ubi_io_read_vid_hdr(ubi, pnum, vidb, 0);
 	if (err != UBI_IO_BAD_HDR_EBADMSG && err != UBI_IO_BAD_HDR &&
 	    err != UBI_IO_FF){
 		addr += ubi->vid_hdr_aloffset;
@@ -491,6 +495,7 @@
 		if (err)
 			goto error;
 	}
+	ubi_free_vid_buf(vidb);
 	return 0;
 
 error:
@@ -501,6 +506,7 @@
 	 */
 	ubi_err(ubi, "cannot invalidate PEB %d, write returned %d", pnum, err);
 	ubi_dump_flash(ubi, pnum, 0, ubi->peb_size);
+	ubi_free_vid_buf(vidb);
 	return -EIO;
 }
 
@@ -535,11 +541,11 @@
 		return -EROFS;
 	}
 
-	if (ubi->nor_flash) {
+	//if (ubi->nor_flash) {
 		err = nor_erase_prepare(ubi, pnum);
 		if (err)
 			return err;
-	}
+	//}
 
 	if (torture) {
 		ret = torture_peb(ubi, pnum);
diff --git a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/net/ethernet/zte/zx29_gmac.c b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/net/ethernet/zte/zx29_gmac.c
old mode 100644
new mode 100755
index 5dc69f5..668d9d9
--- a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/net/ethernet/zte/zx29_gmac.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/net/ethernet/zte/zx29_gmac.c
@@ -613,6 +613,8 @@
 {

 	volatile unsigned *gmac = (unsigned *)ndev->base_addr;

 	unsigned int i = 0, j = 0, mac_rst = 0;

+	unsigned long long mac_time_start = 0;

+	unsigned long long mac_time_end = 0;

 

 	mac_provide_clock();

 #ifdef __DEAD_LOOP_POLL__

@@ -620,22 +622,25 @@
 	mac_set_gmii_mode();

 	mac_wait_reset_finished();

 #else

+	mac_time_start = local_clock();

 	for (i = 0; i < MAC_RESET_NUM; i++) {

 		mac_reset();

 		mac_set_mii_mode();

 		for (j = 0; j < MAC_WAIT_TIME; j++) {

-			printk(".");

+//			printk(".");

 			if (!((MAC(0x1000)) & 1)) {

-				printk("ok\n");

+				mac_time_end = local_clock();

+				printk("ok:time:%llu ns\n", mac_time_end - mac_time_start);

 				mac_rst = 1;

 				goto mac_reset_option;

 			}

 			udelay(100);

 		}

 	}

+    mac_time_end = local_clock();

 mac_reset_option:

 	if(!mac_rst)								

-		printk("gmac reset failed!\n");

+		printk("gmac reset failed!time:%llu us\n", mac_time_end - mac_time_start);

 #endif

 	while(mac_mii_is_busy());

 }

diff --git a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/net/ethernet/zte/zx29_gmac.h b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/net/ethernet/zte/zx29_gmac.h
index d2abe1e..e16cf69 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/net/ethernet/zte/zx29_gmac.h
+++ b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/net/ethernet/zte/zx29_gmac.h
@@ -35,8 +35,12 @@
 

 #define GMAC_BUF_LEN        (GMAC_RX_BUF_LEN + GMAC_TX_BUF_LEN)

 

-#define MAC_RESET_NUM               3 											//次数

-#define MAC_WAIT_TIME               10000 										//0.1ms //时间为毫秒ms

+//#define MAC_RESET_NUM               3 											//次数

+//#define MAC_WAIT_TIME               10000 										//0.1ms //时间为毫秒ms

+//to reduce time when error happened

+#define MAC_RESET_NUM               2 											//次数

+#define MAC_WAIT_TIME               500 										//0.1ms //时间为毫秒ms

+

 #define PHY_CLOCK			  		5											// 时钟为 2,uboot中使用时钟3 0x03

 #define PHY_RESET					(1 << 15)									// PHY 复位

 #define DMA_OWNER 					(1 << 31)									// 描述符所有权归DMA

diff --git a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/net/phy/jlsemi/jl3xxx.c b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/net/phy/jlsemi/jl3xxx.c
index 8ba2f09..a542c1f 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/net/phy/jlsemi/jl3xxx.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/net/phy/jlsemi/jl3xxx.c
@@ -109,11 +109,15 @@
 	unsigned int tmp = 0;
 	int i = 0;
 
-	while(!jl_get_link(phydev)){
-		printk("[%s] link is down\n", __func__);
-		msleep(5);
+	while((!jl_get_link(phydev)) && (i < 4)){
+		i++;
+		msleep(20);
 	}
-	printk("[%s] link is up\n", __func__);
+
+	if (i == 4)
+		printk("[%s] link may not up\n", __func__);
+	else
+	    printk("[%s] link is up\n", __func__);
   	
     wt(phydev, 0x1f, 0x9f, 0x000d); //cl45 1f.0x9f,0xD,phyaddr 0x1f
 
diff --git a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/spi/spi-zx29.c b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/spi/spi-zx29.c
index c8f3374..546be32 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/spi/spi-zx29.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/spi/spi-zx29.c
@@ -1993,7 +1993,7 @@
 };
 
 /*
-*    spi ʹ\D3\C3GPIOģʽ\B6\C1ȡLCD \B5\C4ID Begin
+*    spi ʹÓÃGPIOģʽ¶ÁÈ¡LCD µÄID Begin
 */
 static void spi_set_gpio_function(int dev_id)
 {
@@ -2252,6 +2252,9 @@
 	ktime_t k_time_start = 0;
 	ktime_t k_time_end = 0;
 	ktime_t diff_ns = 0;
+
+	if(false == zx29spi->master->slave)
+		pm_stay_awake(&zx29spi->pdev->dev);
 	regval = readl((SPI_COM_CTRL_OFFSET+zx29spi->virtbase)) & (~SPI_COM_CTRL_MASK_SSPE);
 	writel(regval, (SPI_COM_CTRL_OFFSET+zx29spi->virtbase));
 	
@@ -2274,6 +2277,9 @@
 	if(diff_ns >= 10000000) {
 		dev_info(&zx29spi->pdev->dev, " zx29_setup_to_regs failed! diff_ns=%lld \n",diff_ns);
 	}
+
+	if(false == zx29spi->master->slave)
+		pm_relax(&zx29spi->pdev->dev);
 	
 }
 /**
@@ -2459,7 +2465,11 @@
 		SPI_WRITE_BITS(chip->com_ctrl, SPI_SLAVE_MODE, SPI_COM_CTRL_MASK_MS, 2);
 		zx29_setup_to_regs(chip,zx29spi);
 	}
-		
+	
+	if(zx29spi->mode == ZX29_SSP_MASTER_TYPE) {
+		if(spi->setup_immediately == 1)
+			zx29_setup_to_regs(chip,zx29spi);
+	}	
 	return status;
  err_config_params:
 	spi_set_ctldata(spi, NULL);
diff --git a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/spi/spidev.c b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/spi/spidev.c
index 059475b..53ea041 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/spi/spidev.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/spi/spidev.c
@@ -2153,6 +2153,15 @@
 		dev_info(&spi->dev,"trans_gap_num = 0x%x",val);
 	}
 
+	if (device_property_read_u32(&spi->dev, "setup-immediately",&val)) {
+		spi->setup_immediately = 0;
+		dev_err(&spi->dev,"setup-immediately get failed");
+	}
+	else {
+		spi->setup_immediately = val;
+		dev_info(&spi->dev,"setup-immediately = 0x%x",val);
+	}
+
 	/* If we can allocate a minor number, hook up this device.
 	 * Reusing minors is fine so long as udev or mdev is working.
 	 */
diff --git a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/tty/serial/zx29_uart.c b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/tty/serial/zx29_uart.c
index d4878c6..60629b6 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/tty/serial/zx29_uart.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/tty/serial/zx29_uart.c
@@ -124,12 +124,30 @@
 	bool			queued;
 	atomic_t		count;
 };
+#define UART_DMA_CYCLE_RX_CONFIG_COUNT 5
+struct zx29_dma_cycle_data{
+	int id;
+	int flg_enter_th;
+	int flg_enter_to;
+	char flg_overrun;
+	char flg_pe;
+	char flg_be;
+	char flg_fe;
+	char from_resume;
+	unsigned long cnt_callback_total;
+	unsigned long cnt_th_total;
+	int cnt_callback;
+	int cnt_th;
+	struct zx29_sgbuf sgbuf[UART_DMA_CYCLE_RX_CONFIG_COUNT];
+	dma_channel_def rxdef[UART_DMA_CYCLE_RX_CONFIG_COUNT];
+};
+struct zx29_dma_cycle_data uart_dma_cycle[5];
 #endif
 
 
 
 #define UART_NUM 5
-int g_uart_overrun = 0;
+int g_uart_overrun[5];
 ktime_t g_hr_interval; 
 
 
@@ -227,6 +245,7 @@
 	struct hrtimer rx_dma_hrtimer;
 	struct task_struct	*dma_compl_th;
 	struct	semaphore    sema;
+	struct	semaphore sema_cyclic;
 	bool port_close;
 	bool work_state;
 	size_t pre_pending;
@@ -295,6 +314,7 @@
 static bool zx29_dma_tx_irq(struct zx29_uart_port *zup);
 static int zx29_uart_dma_tx_chars(struct zx29_uart_port *zup);
 void uart_dma_rx_callback(void *data);
+void uart_dma_rx_callback_use_dma_cyclic(void * data);
 static void zx29_uart_dma_rx_chars(struct zx29_uart_port *zup,
 											//u32 pending, bool use_buf_b, 
 											u32 pending, struct zx29_sgbuf *sgbuf, 
@@ -303,6 +323,7 @@
 static inline bool zx29_dma_rx_available(struct zx29_uart_port *zup);
 static inline bool zx29_dma_rx_running(struct zx29_uart_port *zup);
 static int zx29_dma_rx_trigger_dma(struct zx29_uart_port *zup);
+static int zx29_dma_rx_trigger_dma_use_dma_cyclic(struct zx29_uart_port *zup);
 
 static void zx29_uart_rx_dma_chars(struct zx29_uart_port *zup, unsigned long *flags);
 dma_peripheral_id uart_get_rx_dma_peripheral_id(struct zx29_uart_port *zup);
@@ -312,6 +333,7 @@
 static inline bool zx29_dma_rx_work_scheduled(struct zx29_uart_port *zup);
 
 static void zx29_uart_rt_dma(struct zx29_uart_port *zup, unsigned long *flags);
+static void uart_dma_cycle_deinit(struct zx29_uart_port *zup);
 #endif
 #endif
 
@@ -622,7 +644,7 @@
 	arr_ps2cap = (char *)buf;
 	process_ps2cap_rpmsg(arr_ps2cap);
 }
-static void echo_to_change_ohter_uart(uint32_t val)
+static void echo_to_change_other_uart(uint32_t val)
 {
 	int ret;
 	if(val > ENABLE_TOGGLE)
@@ -662,7 +684,7 @@
 	if(flag == ENABLE_TOGGLE){
 		g_cap_uart_toggle = 1;
 		forbid_current_cons_uart();
-		echo_to_change_ohter_uart(flag);
+		echo_to_change_other_uart(flag);
 	}else if(flag == DISABLE_TOGGLE){
 		g_cap_uart_toggle = 0;
 		g_core_id_occupy_uart = SYMB_CAP_CORE_ID;
@@ -953,6 +975,53 @@
 }
 
 #if CONFIG_SERIAL_ZX29_DMA
+int dma_complete_thread_use_dma_cyclic(void *ptr)
+{
+	unsigned long flags;
+	struct zx29_uart_port *zup = (struct zx29_uart_port *)ptr;
+	size_t pending;
+	int dma_count = 0;
+	struct device *dev = NULL;
+	dev = zup->dmarx.chan->device->dev;
+	int uart_id = zup->port.line;
+	while(down_interruptible(&zup->sema_cyclic) == 0)
+	{	
+		if(zup->port_close || !uart_dma_cycle[uart_id].sgbuf[uart_dma_cycle[uart_id].flg_enter_th].dma_addr)
+			break;
+		spin_lock_irqsave(&zup->port.lock, flags);
+		uart_dma_cycle[uart_id].cnt_th_total++;
+		uart_dma_cycle[uart_id].cnt_th++;
+		zup->sg2tty = &uart_dma_cycle[uart_id].sgbuf[uart_dma_cycle[uart_id].flg_enter_th];
+		zup->sg2tty_len = 4096;
+		pending = zup->sg2tty_len;
+		if(uart_dma_cycle[uart_id].flg_be || uart_dma_cycle[uart_id].flg_fe|| uart_dma_cycle[uart_id].flg_pe){
+			printk("error in uart%d: fe %u ,be %u pe %u.\n",zup->port.line,zup->port.icount.frame,
+				zup->port.icount.brk,zup->port.icount.parity);
+			uart_dma_cycle[uart_id].flg_be = 0;
+			uart_dma_cycle[uart_id].flg_fe = 0;
+			uart_dma_cycle[uart_id].flg_pe = 0;
+		}
+		dma_sync_sg_for_cpu(dev, &zup->sg2tty->sg, 1, DMA_FROM_DEVICE);
+		spin_unlock_irqrestore(&zup->port.lock, flags);
+		dma_count = tty_insert_flip_string(&zup->port.state->port,
+						   zup->sg2tty->buf, pending);
+		tty_flip_buffer_push(&zup->port.state->port);
+		spin_lock_irqsave(&zup->port.lock, flags);		
+		dma_sync_sg_for_device(dev, &zup->sg2tty->sg, 1, DMA_FROM_DEVICE);
+		zup->sg2tty = NULL;
+		zup->sg2tty_len = 0;
+		zup->port.icount.rx += dma_count;
+		if (dma_count < pending)
+			dev_info(zup->port.dev,
+				 "couldn't insert all characters (TTY is full?)\n");
+		uart_dma_cycle[uart_id].flg_enter_th = (uart_dma_cycle[uart_id].flg_enter_th+1)%UART_DMA_CYCLE_RX_CONFIG_COUNT;
+		uart_dma_cycle[uart_id].cnt_callback--;
+		if(!hrtimer_active(&zup->rx_dma_hrtimer))
+			hrtimer_restart(&zup->rx_dma_hrtimer);
+		spin_unlock_irqrestore(&zup->port.lock, flags);
+	}
+	return 0;
+}
 int dma_complete_thread(void *ptr)
 {
 	unsigned long flags;
@@ -983,6 +1052,7 @@
 
 			test_uart_static(zup->port.line, NULL, 0, 10);
 			//uart_mod_timer(zup, &flags);
+			if(!hrtimer_active(&zup->rx_dma_hrtimer))
 			hrtimer_forward_now(&zup->rx_dma_hrtimer, g_hr_interval);
 		}	
 		/* Pick everything from the DMA first */
@@ -1509,12 +1579,47 @@
 	
 	return 0;
 }
+static int zx29_dma_rx_trigger_dma_use_dma_cyclic(struct zx29_uart_port *zup)
+{
+	struct dma_chan *rxchan = zup->dmarx.chan;
+	struct zx29_dmarx_data *dmarx = &zup->dmarx;
+	struct dma_async_tx_descriptor *desc;
+	dma_peripheral_id rx_id = uart_get_rx_dma_peripheral_id(zup);
+	int uart_id = zup->port.line;
+	if (!rxchan)
+	{
+		printk("[%s][%d]\n",__func__,__LINE__);
+		return -EIO;
+	}
+	dmaengine_slave_config(rxchan, (struct dma_slave_config*)&uart_dma_cycle[uart_id].rxdef);
+	desc = rxchan->device->device_prep_dma_cyclic(rxchan,NULL,(ZX29_DMA_BUFFER_SIZE *5) , ZX29_DMA_BUFFER_SIZE,0,0);
+	if (!desc) {
+		printk(KERN_INFO "!!ERROR DESC !!![%s][%d]Port:[%d]\n",__func__,__LINE__,zup->port.line);
+		zup->dmarx.running = false;
+		dmaengine_terminate_all(rxchan);
+		return -EBUSY;
+	}
+	desc->callback = uart_dma_rx_callback_use_dma_cyclic;
+	desc->callback_param = zup;
+	wmb();
+	dmarx->cookie = dmaengine_submit(desc);
+	dma_async_issue_pending(rxchan);
+	zup->dmacr |= UART_RXDMAE;
+	UART_PUT_DMACR(&zup->port, zup->dmacr);
+	uart_dma_cycle[uart_id].flg_enter_th = 0;
+	zup->dmarx.running = true;
+	zup->dmarx.used = true;
+	zup->imr &= ~(UART_RXIM | UART_RTIM);
+	UART_PUT_IMSC(&zup->port,zup->imr);
+	return 0;
+}
 
 void uart_dma_rx_callback(void *data)
 {
 	unsigned long flags;
 
 	struct zx29_uart_port *zup = (struct zx29_uart_port *)data;
+	int uart_id = zup->port.line;
 	struct zx29_dmarx_data *dmarx = &zup->dmarx;
 	struct dma_chan *rxchan = dmarx->chan;
 	struct device *dev = NULL;
@@ -1531,7 +1636,7 @@
 	if(ris_status & (UART_OEIS | UART_BEIS | UART_PEIS | UART_FEIS)){
 		if(ris_status & UART_OEIS){ 			   
 			zup->port.icount.overrun++;
-			g_uart_overrun = 4;
+			g_uart_overrun[uart_id] = 4;
 			test_uart_static(zup->port.line, NULL, 0, 20);	
 			//if(!uart_console(&zup->port))
 			//	BUG_ON(1);
@@ -1580,6 +1685,39 @@
 	up(&zup->sema);
 }
 
+void uart_dma_rx_callback_use_dma_cyclic(void *data)
+{	
+	unsigned long flags;
+	struct zx29_uart_port *zup = (struct zx29_uart_port *)data;
+	unsigned int ris_status;
+	int uart_id = zup->port.line;
+	spin_lock_irqsave(&zup->port.lock, flags);
+	uart_dma_cycle[uart_id].cnt_callback_total++;
+	uart_dma_cycle[uart_id].cnt_callback++;
+	ris_status = UART_GET_RIS(&zup->port);
+	if(ris_status & (UART_OEIS | UART_BEIS | UART_PEIS | UART_FEIS)){
+		if(ris_status & UART_OEIS){ 			   
+			zup->port.icount.overrun++;
+			uart_dma_cycle[uart_id].flg_overrun = 1;
+		}
+		if(ris_status & UART_BEIS){
+			uart_dma_cycle[uart_id].flg_be = 1;
+			zup->port.icount.brk++; 
+		}		 
+		if(ris_status & UART_PEIS){	
+			uart_dma_cycle[uart_id].flg_pe = 1;
+			zup->port.icount.parity++;	
+		}
+		if(ris_status & UART_FEIS){
+			uart_dma_cycle[uart_id].flg_fe = 1;
+			zup->port.icount.frame++;
+		}
+		UART_PUT_ICR(&zup->port, (UART_OEIS | UART_BEIS | UART_PEIS | UART_FEIS));
+	}	
+	spin_unlock_irqrestore(&zup->port.lock, flags);
+	test_uart_static(zup->port.line, NULL, 0, 26);
+	up(&zup->sema_cyclic);
+}
 static inline void zx29_dma_rx_stop(struct zx29_uart_port *zup)
 {
 	dma_peripheral_id rx_id = uart_get_rx_dma_peripheral_id(zup);
@@ -1643,8 +1781,13 @@
 	if (zup->using_rx_dma) {
 		//dmaengine_terminate_all(zup->dmarx.chan);
 		/* Clean up the RX DMA */
+		if(!zup->uart_power_mode){
 		zx29_sgbuf_free(zup->dmarx.chan, &zup->dmarx.sgbuf_a, DMA_FROM_DEVICE);
 		zx29_sgbuf_free(zup->dmarx.chan, &zup->dmarx.sgbuf_b, DMA_FROM_DEVICE);
+		}else if(zup->uart_power_mode == 1){
+			uart_dma_cycle_deinit(zup);
+		}else
+			printk("uart%d dma shutdown fail.\n",zup->port.line);
 		zup->using_rx_dma = false;
 		zup->dmarx.used = false;
 		zup->dmarx.running = false;
@@ -1892,6 +2035,44 @@
 	spin_lock(&zup->port.lock);
 	}
 }
+static void zx29_uart_deal_dma_fifo_rx_chars_cyclic(struct zx29_uart_port *zup,
+											u32 pending, struct zx29_sgbuf *sgbuf,
+											unsigned long *flags, char *fifo_buf, int fifo_len)
+{
+	struct tty_struct *tty = zup->port.state->port.tty;
+	struct device *dev = zup->dmarx.chan->device->dev;
+	int dma_count = 0;
+	int fifo_count = 0;
+	u32 fifotaken = 0; /* only used for vdbg() */
+	if ((pending) && (pending != 4096)) {
+		dma_sync_sg_for_cpu(dev, &sgbuf->sg, 1, DMA_FROM_DEVICE);
+		spin_unlock_irqrestore(&zup->port.lock, *flags);
+		dma_count = tty_insert_flip_string(&zup->port.state->port,
+						   sgbuf->buf, pending);
+		test_uart_static(zup->port.line, sgbuf->buf, pending, 6);
+		spin_lock_irqsave(&zup->port.lock, *flags);	 	
+		dma_sync_sg_for_device(dev, &sgbuf->sg, 1, DMA_FROM_DEVICE);
+		zup->port.icount.rx += dma_count;
+		if (dma_count < pending)
+			dev_info(zup->port.dev,
+				 "couldn't insert all characters (TTY is full?)\n");
+	}
+	 	if(fifo_len){
+		spin_unlock_irqrestore(&zup->port.lock, *flags);
+			fifo_count = tty_insert_flip_string(&zup->port.state->port,
+							   fifo_buf, fifo_len);
+			fifo_buf[0] = '\0';
+			fifo_buf[1] = '\0';
+			fifo_buf[2] = '\0';
+		spin_lock_irqsave(&zup->port.lock, *flags);	 
+		}
+		zup->port.icount.rx += fifo_count;
+	if(((pending) && (pending != 4096)) || (fifo_len > 0)){
+		spin_unlock(&zup->port.lock);
+		tty_flip_buffer_push(&zup->port.state->port);
+		spin_lock(&zup->port.lock);	
+	}
+}
 
 static void zx29_uart_deal_dma_fifo_rx_chars(struct zx29_uart_port *zup,
 											u32 pending, struct zx29_sgbuf *sgbuf,
@@ -1911,6 +2092,7 @@
 		test_uart_static(zup->port.line, sgbuf->buf, pending, 6);
 	spin_lock_irqsave(&zup->port.lock, *flags);	 	
 		dma_sync_sg_for_device(dev, &sgbuf->sg, 1, DMA_FROM_DEVICE);
+		spin_unlock_irqrestore(&zup->port.lock, *flags);
 		zup->port.icount.rx += dma_count;
 		if (dma_count < pending)
 			dev_info(zup->port.dev,
@@ -1921,7 +2103,7 @@
 		//printk("qq >> fifo len %d.\n",fifo_len);
 		fifo_count = tty_insert_flip_string(&zup->port.state->port,
 						   fifo_buf, fifo_len);
-		test_uart_static(zup->port.line, fifo_buf, fifo_count, 18);
+		//printk("qq >>fifo count %d,buf is %x %x %x .\n",fifo_count, fifo_buf[0],fifo_buf[1],fifo_buf[2]);
 		fifo_buf[0] = '\0';
 		fifo_buf[1] = '\0';
 		fifo_buf[2] = '\0';
@@ -1929,10 +2111,10 @@
 	}
 	
 	zup->port.icount.rx += fifo_count;
+	test_uart_static(zup->port.line, fifo_buf, fifo_count, 18);
 	if(pending > 0  || (fifo_len > 0)){
-		spin_unlock(&zup->port.lock);
 		tty_flip_buffer_push(&zup->port.state->port);
-		spin_lock(&zup->port.lock);
+		spin_lock_irqsave(&zup->port.lock, *flags);	 
 	}
 }
 
@@ -2160,9 +2342,9 @@
 #endif	
 
 }
-char g_fifo_residue_buf[4] = {'\0','\0','\0','\0'};
-char g_fifo_residue_all[20] = {0};
-unsigned char g_fifo_cnt = 0;
+char g_fifo_residue_buf[5][4];
+char g_fifo_residue_all[5][20];
+unsigned char g_fifo_cnt[5];
 static void zx29_uart_rx_dma_timeout(struct timer_list *t)
 {
 	struct zx29_uart_port *zup = from_timer(zup, t, rx_dma_timer);
@@ -2176,7 +2358,7 @@
 
 	unsigned long flags;
 	struct zx29_sgbuf *sgbuf = NULL;
-
+	int uart_id = zup->port.line;
 	if(!zx29_dma_rx_running(zup))
 		//printk("---uart_rx_dma_timeout enter, dma stopped\n");
 		return;
@@ -2214,7 +2396,7 @@
 		if(ris_status & (UART_OEIS | UART_BEIS | UART_PEIS | UART_FEIS)){
 			if(ris_status & UART_OEIS){ 			   
 				zup->port.icount.overrun++;
-				g_uart_overrun = 1;
+				g_uart_overrun[uart_id] = 1;
 				test_uart_static(zup->port.line, NULL, 0, 19);	
 				//if(!uart_console(&zup->port))
 				//	BUG_ON(1);
@@ -2245,16 +2427,16 @@
 		for(i= 0;i < 3;i++){
 			fr = UART_GET_FR(&zup->port);
 			if((fr & UART_FR_RXFE) == 0){
-				g_fifo_residue_buf[i] = UART_GET_CHAR(&zup->port) |	UART_DUMMY_DR_RX;
-				g_fifo_residue_all[g_fifo_cnt++] = g_fifo_residue_buf[i];
-				if(g_fifo_cnt >= 20)	g_fifo_cnt = 0;
+				g_fifo_residue_buf[uart_id][i] = UART_GET_CHAR(&zup->port) |	UART_DUMMY_DR_RX;
+				g_fifo_residue_all[uart_id][g_fifo_cnt[uart_id]++] = g_fifo_residue_buf[uart_id][i];
+				if(g_fifo_cnt[uart_id] >= 20)	g_fifo_cnt[uart_id] = 0;
 			}	
 			else
 				break;
 		}	
 		if(i){
-			g_fifo_residue_all[g_fifo_cnt++]=i;
-			if(g_fifo_cnt >= 20)	g_fifo_cnt = 0;
+			g_fifo_residue_all[uart_id][g_fifo_cnt[uart_id]++]=i;
+			if(g_fifo_cnt[uart_id] >= 20)	g_fifo_cnt[uart_id] = 0;
 		}
 
 		//zup->sg2tty = sgbuf;
@@ -2274,7 +2456,7 @@
 			}
 				if(pending || (i > 0)){
 					test_uart_static(zup->port.line, NULL, 0, 13);
-					zx29_uart_deal_dma_fifo_rx_chars(zup, pending, sgbuf, &flags, g_fifo_residue_buf,i);
+					zx29_uart_deal_dma_fifo_rx_chars(zup, pending, sgbuf, &flags, g_fifo_residue_buf[uart_id],i);
 				}						
 			
 		}else{
@@ -2313,7 +2495,7 @@
 		raw_spin_unlock_irqrestore(&zup->port.lock, flags);
 		zup->pre_pending = pending;
 		mod_timer(&(zup->rx_dma_timer), jiffies + RX_DMA_TIMEOUT);
-		test_uart_static(zup->port.line, NULL, zup->pre_pending, 22);
+		//uart_mod_timer(zup, &flags);
 	}
 			
 
@@ -2327,6 +2509,7 @@
 	uint32_t ris_status = 0;
 	int cancel_timer = 0;
 	int sg_idx = (dmarx->use_buf_b ? 1 : 0);
+	int uart_id = zup->port.line;
 	unsigned long flags;
 	struct zx29_sgbuf *sgbuf = NULL;
 	if(!zx29_dma_rx_running(zup))
@@ -2362,7 +2545,7 @@
 		if(ris_status & (UART_OEIS | UART_BEIS | UART_PEIS | UART_FEIS)){
 			if(ris_status & UART_OEIS){ 			   
 				zup->port.icount.overrun++;
-				g_uart_overrun = 1;
+				g_uart_overrun[uart_id] = 1;
 				test_uart_static(zup->port.line, NULL, 0, 19);	
 			}
 			if(ris_status & UART_BEIS) 			 
@@ -2389,16 +2572,16 @@
 		for(i= 0;i < 3;i++){
 			fr = UART_GET_FR(&zup->port);
 			if((fr & UART_FR_RXFE) == 0){
-				g_fifo_residue_buf[i] = UART_GET_CHAR(&zup->port) |	UART_DUMMY_DR_RX;
-				g_fifo_residue_all[g_fifo_cnt++] = g_fifo_residue_buf[i];
-				if(g_fifo_cnt >= 20)	g_fifo_cnt = 0;
+				g_fifo_residue_buf[uart_id][i] = UART_GET_CHAR(&zup->port) |	UART_DUMMY_DR_RX;
+				g_fifo_residue_all[uart_id][g_fifo_cnt[uart_id]++] = g_fifo_residue_buf[uart_id][i];
+				if(g_fifo_cnt[uart_id] >= 20)	g_fifo_cnt[uart_id] = 0;
 			}	
 			else
 				break;
 		}	
 		if(i){
-			g_fifo_residue_all[g_fifo_cnt++]=i;
-			if(g_fifo_cnt >= 20)	g_fifo_cnt = 0;
+			g_fifo_residue_all[uart_id][g_fifo_cnt[uart_id]++]=i;
+			if(g_fifo_cnt[uart_id] >= 20)	g_fifo_cnt[uart_id] = 0;
 		}
 			if(zup->sleep_state == 0){		
 				if (zx29_dma_rx_trigger_dma(zup)) {
@@ -2414,7 +2597,7 @@
 			}
 				if(pending || (i > 0)){
 					test_uart_static(zup->port.line, NULL, 0, 13);
-					zx29_uart_deal_dma_fifo_rx_chars(zup, pending, sgbuf, &flags, g_fifo_residue_buf,i);
+					zx29_uart_deal_dma_fifo_rx_chars(zup, pending, sgbuf, &flags, g_fifo_residue_buf[uart_id],i);
 				}						
 		}else{
 			if(pending || (( fr & UART_FR_RXFE)  == 0)){
@@ -2454,6 +2637,137 @@
 		return HRTIMER_RESTART;
 	}
 }
+enum  hrtimer_restart zx29_uart_rx_dma_hrtimeout_cyclic(struct hrtimer *t)
+{
+	struct zx29_uart_port *zup = from_timer(zup, t, rx_dma_hrtimer);
+	struct zx29_dmarx_data *dmarx = &zup->dmarx;
+	struct dma_chan *rxchan = dmarx->chan;
+	size_t pending, tmp_len;
+	uint32_t ris_status = 0;
+	unsigned long flags;
+	struct zx29_sgbuf *sgbuf = NULL;
+	int uart_id = zup->port.line;
+	if(!zx29_dma_rx_running(zup))
+		return HRTIMER_NORESTART;
+	if(uart_dma_cycle[uart_id].cnt_callback > 0){
+		return HRTIMER_NORESTART;
+	}
+	
+	spin_lock_irqsave(&zup->port.lock, flags);	
+	sgbuf = &uart_dma_cycle[uart_id].sgbuf[uart_dma_cycle[uart_id].flg_enter_th];
+	if(zup->port_close || (sgbuf == NULL)){
+		spin_unlock_irqrestore(&zup->port.lock, flags);
+		return HRTIMER_RESTART;
+	}
+	if(zup->sema_cyclic.count > 0){
+		printk("uart has th not deal.\n");
+		spin_unlock_irqrestore(&zup->port.lock, flags);
+		return HRTIMER_RESTART;
+	}
+	if((zup->sg2tty)){//dma not complete now, later check again
+		printk("dmath_cyclic not end.\n");
+		spin_unlock_irqrestore(&zup->port.lock, flags);
+		test_uart_static(zup->port.line, NULL, 0, 14);
+		hrtimer_forward_now(&zup->rx_dma_hrtimer, g_hr_interval);
+		return HRTIMER_RESTART;
+	}
+	if(zup->enter_suspend){
+		spin_unlock_irqrestore(&zup->port.lock, flags);
+		test_uart_static(zup->port.line, NULL, 0, 15);
+		hrtimer_forward_now(&zup->rx_dma_hrtimer, g_hr_interval);
+		return HRTIMER_RESTART;
+	}
+	dma_peripheral_id rx_id = uart_get_rx_dma_peripheral_id(zup);
+	pending = sgbuf->sg.length - zx29_dma_get_transfer_num(rx_id);
+	if(((pending == zup->pre_pending) && pending) || uart_dma_cycle[uart_id].from_resume){
+		uart_dma_cycle[uart_id].from_resume = 0;
+#if 0
+	if(uart_dma_cycle[uart_id].flg_enter_th == 0)
+		uart_dma_cycle[uart_id].flg_enter_to = 4;
+	else
+		uart_dma_cycle[uart_id].flg_enter_to = uart_dma_cycle[uart_id].flg_enter_th - 1;
+	struct zx29_sgbuf *sgbuf_tmp = NULL;
+	sgbuf_tmp = &uart_dma_cycle[uart_id].sgbuf[uart_dma_cycle[uart_id].flg_enter_to];
+	test_uart_static(zup->port.line, NULL, 0, 61);
+	if (sgbuf->sg.dma_address != (zx29_dma_cur_dst(rx_id)&0xfffff000)){
+		if(sgbuf_tmp->sg.dma_address != ((zx29_dma_cur_dst(rx_id)&0xfffff000)-0x1000)){
+			printk("uart lose dma isr enter self resume.\n");
+				up(&zup->sema_cyclic);
+			spin_unlock_irqrestore(&zup->port.lock, flags);
+			return;
+		}
+	}
+	#endif		
+		int fr = UART_GET_FR(&zup->port);
+		if((fr  & UART_FR_RXBUSY)){
+			hrtimer_forward_now(&zup->rx_dma_hrtimer, g_hr_interval);	
+			test_uart_static(zup->port.line, NULL, 0, 12);	
+			goto deal_end;
+		}	
+		ris_status = UART_GET_RIS(&zup->port);
+		if(ris_status & (UART_OEIS | UART_BEIS | UART_PEIS | UART_FEIS)){
+			if(ris_status & UART_OEIS){ 			   
+				zup->port.icount.overrun++;
+				uart_dma_cycle[uart_id].flg_overrun = 1;
+			}
+			if(ris_status & UART_BEIS)
+				zup->port.icount.brk++;
+			if(ris_status & UART_PEIS)
+				zup->port.icount.parity++;
+			if(ris_status & UART_FEIS)
+				zup->port.icount.frame++;
+			UART_PUT_ICR(&zup->port, (UART_OEIS | UART_BEIS | UART_PEIS | UART_FEIS));
+			printk("error in uart%d: fe %u ,be %u pe %u.\n",zup->port.line,zup->port.icount.frame,
+				zup->port.icount.brk,zup->port.icount.parity);
+		}
+		zup->dmacr &= ~UART_RXDMAE;
+		UART_PUT_DMACR(&zup->port,zup->dmacr);
+		dmaengine_terminate_all(rxchan);
+		test_uart_static(zup->port.line, NULL, 0, 60);
+		zup->dmarx.running = false;
+		zup->dmarx.used = false;
+		wmb();		
+		int i = 0;
+		for(i= 0;i < 3;i++){
+			fr = UART_GET_FR(&zup->port);
+			if((fr & UART_FR_RXFE) == 0){
+				g_fifo_residue_buf[uart_id][i] = UART_GET_CHAR(&zup->port) |	UART_DUMMY_DR_RX;
+				g_fifo_residue_all[uart_id][g_fifo_cnt[uart_id]++] = g_fifo_residue_buf[uart_id][i];
+				if(g_fifo_cnt[uart_id] >= 20)	g_fifo_cnt[uart_id] = 0;
+			}	
+			else
+				break;
+		}	
+		if(i){
+			g_fifo_residue_all[uart_id][g_fifo_cnt[uart_id]++]=i;
+			if(g_fifo_cnt[uart_id] >= 20)	g_fifo_cnt[uart_id] = 0;
+		}
+		if (zx29_dma_rx_trigger_dma_use_dma_cyclic(zup)) {
+			printk("rx_dma_chars RXDMA start fail\n");
+			zup->imr |= UART_RXIM;
+			UART_PUT_IMSC(&zup->port,zup->imr);
+		}else{
+			hrtimer_forward_now(&zup->rx_dma_hrtimer, g_hr_interval);
+			zup->pre_pending = 0;
+			zup->dmarx.used = true;
+			zup->work_state = true;
+		}
+		if((pending && (pending != 4096)) || (i > 0)){
+			zx29_uart_deal_dma_fifo_rx_chars_cyclic(zup, pending, sgbuf, &flags, g_fifo_residue_buf[uart_id],i);
+		}	
+		uart_dma_cycle[uart_id].cnt_th = 0;
+		uart_dma_cycle[uart_id].cnt_callback=0;
+deal_end:		
+		spin_unlock_irqrestore(&zup->port.lock, flags);
+		return HRTIMER_RESTART;
+	}else{
+		spin_unlock_irqrestore(&zup->port.lock, flags);
+		zup->pre_pending = pending;
+		hrtimer_forward_now(&zup->rx_dma_hrtimer, g_hr_interval);
+		test_uart_static(zup->port.line, NULL, zup->pre_pending, 22);
+		return HRTIMER_RESTART;
+	}
+}
 #endif
 
 
@@ -2489,7 +2803,7 @@
 	unsigned long flags;
 	unsigned int status,ris, pass_counter = 256;
 	int handled = 0;
-
+	int uart_id = zup->port.line;
 	spin_lock_irqsave(&zup->port.lock, flags);
 	status = UART_GET_MIS(port) & zup->imr;
 	ris = UART_GET_RIS(port);
@@ -2507,7 +2821,7 @@
 #if CONFIG_SERIAL_ZX29_DMA
 					if(ris & UART_OEIS){ 			   
 						zup->port.icount.overrun++;
-						g_uart_overrun = 8;
+						g_uart_overrun[uart_id] = 8;
 						test_uart_static(zup->port.line, NULL, 0, 21);	
 						//if(!uart_console(&zup->port))
 						//	BUG_ON(1);
@@ -2676,6 +2990,51 @@
 #endif
 }
 
+static int uart_dma_cycle_init(struct zx29_uart_port *zup)
+{
+	int ret;
+	int uart_id = zup->port.line;
+	uart_dma_cycle[uart_id].id = zup->port.line;
+	int i,j;
+	for(i=0;i<UART_DMA_CYCLE_RX_CONFIG_COUNT;i++){
+		ret = zx29_sgbuf_init(zup->dmarx.chan, &uart_dma_cycle[uart_id].sgbuf[i],DMA_FROM_DEVICE);
+		if(ret){
+			printk( "init uart_dma_cycle sgbuf failed,uart: %d,ret:%d\n", zup->port.line, ret);
+			for(j=0;j<i;j++){
+				zx29_sgbuf_free(zup->dmarx.chan, &uart_dma_cycle[uart_id].sgbuf[j],DMA_FROM_DEVICE);
+			}
+			return -1;
+		}
+	}
+	for(i=0;i<UART_DMA_CYCLE_RX_CONFIG_COUNT;i++){
+		if(zup->port.line == UART0)
+			uart_dma_cycle[uart_id].rxdef[i].src_addr	= ZX_UART0_BASE+zx29_UART_DR;
+		else if(zup->port.line == UART1)
+			uart_dma_cycle[uart_id].rxdef[i].src_addr	= ZX_UART1_BASE+zx29_UART_DR;
+		else{
+			uart_dma_cycle[uart_id].rxdef[i].src_addr	= ZX_UART2_BASE+zx29_UART_DR;
+		}
+		uart_dma_cycle[uart_id].rxdef[i].dest_addr = (unsigned int)(uart_dma_cycle[uart_id].sgbuf[i].dma_addr);
+		uart_dma_cycle[uart_id].rxdef[i].dma_control.tran_mode = TRAN_PERI_TO_MEM;
+		uart_dma_cycle[uart_id].rxdef[i].dma_control.src_burst_len	= DMA_BURST_LEN_4;
+		uart_dma_cycle[uart_id].rxdef[i].count		= ZX29_DMA_BUFFER_SIZE;
+		uart_dma_cycle[uart_id].rxdef[i].dma_control.src_burst_size	= DMA_BURST_SIZE_8BIT;
+		uart_dma_cycle[uart_id].rxdef[i].dma_control.dest_burst_size = DMA_BURST_SIZE_8BIT;
+		uart_dma_cycle[uart_id].rxdef[i].dma_control.dest_burst_len	= DMA_BURST_LEN_4;
+		uart_dma_cycle[uart_id].rxdef[i].dma_control.irq_mode		= DMA_ALL_IRQ_ENABLE;
+		uart_dma_cycle[uart_id].rxdef[i].link_addr		= 1;	
+	}	
+	return 0;
+}
+static void uart_dma_cycle_deinit(struct zx29_uart_port *zup)
+{
+	int i;
+	int uart_id = zup->port.line;
+	for(i=0;i<UART_DMA_CYCLE_RX_CONFIG_COUNT;i++){
+		zx29_sgbuf_free(zup->dmarx.chan, &uart_dma_cycle[uart_id].sgbuf[i],DMA_FROM_DEVICE);
+	}
+	memset(uart_dma_cycle[uart_id].rxdef, 0, sizeof(uart_dma_cycle[uart_id].rxdef));
+}
 static void uart_dma_startup(struct zx29_uart_port *zup)
 {
 	int ret = 0;
@@ -2697,6 +3056,8 @@
 	zup->port.fifosize = 16;//ZX29_DMA_BUFFER_SIZE;
 	zup->using_tx_dma = true;
 
+	if(!zup->uart_power_mode)
+	{
 	if (!zup->dmarx.chan)
 	{
 		printk(KERN_INFO "[%s][%d]uart_%d rx_chan is error\n",__func__,__LINE__, zup->port.line);
@@ -2757,6 +3118,47 @@
 				dev_dbg(zup->port.dev, "could not trigger initial "
 					"RX DMA job, fall back to interrupt mode\n");
 			}else{
+						mod_timer(&(zup->rx_dma_timer), jiffies + RX_DMA_TIMEOUT);
+						zup->pre_pending = 0;
+						zup->work_state = true;
+					}
+				}
+			}
+	}
+	else if(zup->uart_power_mode == 1)
+	{
+		ret = uart_dma_cycle_init(zup);
+		if(ret){
+			printk("uart%d dma cycle init failed,ret %d.\n",zup->port.line,ret);
+			return;
+		}
+		zup->using_rx_dma = true;
+		zup->sg2tty = NULL;
+		zup->sg2tty_len = 0;	
+		zup->curr_sg = NULL;
+#if RX_DMA_WORK
+		hrtimer_init(&zup->rx_dma_hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
+		zup->rx_dma_hrtimer.function = zx29_uart_rx_dma_hrtimeout_cyclic; 
+		g_hr_interval = ktime_set(0, 1500000);
+		zup->dmarx.running = false;
+		zup->dmarx.used = false;
+		zup->dmarx.use_buf_b = false;
+		zup->dmarx.rx_index = 0;
+		zup->pre_pending = 0;
+		zup->work_state = false;
+		sema_init(&zup->sema_cyclic, 0);
+		zup->dma_compl_th = kthread_run(dma_complete_thread_use_dma_cyclic, zup, "uart_dma_th_cyc");
+		BUG_ON(IS_ERR(zup->dma_compl_th));
+#endif
+		printk("uart_dma_startup, port:%d, ret:%d\n", zup->port.line,ret );
+		zup->dmacr &= ~UART_DMAONERR;
+		UART_PUT_DMACR(&zup->port, zup->dmacr);
+		if(zup->uart_power_mode){
+			if (zup->using_rx_dma) {		
+				if (zx29_dma_rx_trigger_dma_use_dma_cyclic(zup)){
+					dev_dbg(zup->port.dev, "could not trigger initial "
+						"RX DMA job, fall back to interrupt mode\n");
+				}else{
 				hrtimer_start(&zup->rx_dma_hrtimer, g_hr_interval, HRTIMER_MODE_REL);
 				//mod_timer(&(zup->rx_dma_timer), jiffies + RX_DMA_TIMEOUT);
 				zup->pre_pending = 0;
@@ -2764,7 +3166,8 @@
 			}
 		}
 	}
-
+	}else
+		printk("uart%d power mode set error,dma dont startup.\n",zup->port.line);
 }
 
 
@@ -3064,7 +3467,7 @@
 	tasklet_kill(&zup->write_wakeup);
 #if RX_DMA_WORK
 	if(zx29_dma_rx_work_scheduled(zup)){
-		//ret = del_timer_sync(&(zup->rx_dma_timer));
+		ret = del_timer_sync(&(zup->rx_dma_timer));
 		ret = hrtimer_cancel(&zup->rx_dma_hrtimer);
 		zup->work_state = 0;
 	}
@@ -3748,12 +4151,12 @@
 	unsigned int flags;
 	if (!zup)
 		return -EINVAL;
+	if(zup->port.line == UART1)
+		return 0;
 #if 1
 		pinctrl_pm_select_sleep_state(dev);
 #endif
 	
-	if(zup->port.line == UART1)
-		return 0;	
 	printk("zx29_uart%d suspend.\n",zup->port.line);
 
 	raw_spin_lock_irqsave(&zup->port.lock, flags);
@@ -3774,7 +4177,12 @@
 #endif
 	//pcu_int_clear(PCU_UART0_RXD_INT);
 	if(zup->irq_state && (zup->rxd_int_depth == 0)){
+		struct irq_data *data_rxd;
+		data_rxd= irq_get_irq_data(zup->rxd_irq);
+		if(data_rxd){
+			if(irqd_irq_disabled(data_rxd))
 		enable_irq(zup->rxd_irq);
+			}
 		zup->rxd_int_depth = 1;
 	}
 
@@ -3784,31 +4192,24 @@
 static int zx29_uart_resume(struct device *dev)
 {
 	struct zx29_uart_port *zup = dev_get_drvdata(dev);
-
+	
 	if (!zup)
 		return -EINVAL;
-	
-	//wz.wang@20240408 modify for ZXW-266 start
+	int uart_id = zup->port.line;
 	if(zup->port.line == UART1)
-		return 0;	
-	//wz.wang@20240408 modify for ZXW-266 end
-	printk("zx29_uart_resume\n");
-	//pcu_int_clear(PCU_UART0_RXD_INT);
-	//if(zup->rxd_int_depth){
-	//	disable_irq(zup->rxd_irq);
-	//	zup->rxd_int_depth--;
-	//}
-	//return uart_resume_port(&amba_reg, &uap->port);
-//xf.li@20240327 modify for T106BUG-567 start
+		return 0;
 #if 1
-		pinctrl_pm_select_default_state(dev);
+	pinctrl_pm_select_default_state(dev);
 #endif
-//xf.li@20240327 modify for T106BUG-567 end
-//wz.wang@20240408 modify for ZXW-266 start
+	
+	printk("zx29_uart%d resume.\n",zup->port.line);	
+	
 	zup->enter_suspend = 0;
-//wz.wang@20240408 modify for ZXW-266 end
-	return 0;
+	uart_dma_cycle[uart_id].from_resume = 1;
+		return 0;	
 }
+
+
 #endif
 
 static SIMPLE_DEV_PM_OPS(zx29_uart_dev_pm_ops, zx29_uart_suspend, zx29_uart_resume);
diff --git a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/usb/gadget/usb_netlink.c b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/usb/gadget/usb_netlink.c
index 6c90e8f..e0d7b15 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/usb/gadget/usb_netlink.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/usb/gadget/usb_netlink.c
@@ -24,13 +24,16 @@
 

 

 wait_queue_head_t usb_netlink_wq;

+struct mutex	   link_store_mutex;

 

 static unsigned int charger_plug = 1;//0;

 

 	struct wakeup_source *usbnetlink_ws;

 
 struct work_struct usb_plug_work;

-unsigned int hotplug_flag = 1;

+unsigned int hotplug_flag = 0;

+

+unsigned int force_plug = 1;

 

 

 unsigned int force_net = 0;

@@ -74,6 +77,7 @@
 #define USB_ECM_SLEEP_ENABLE "ecm_sleep"

 #define USB_RNDIS_PACKET_NUM "pktNum"

 #define USB_ADB_SWITCH "adb_switch"

+#define USB_FORCE_PLUG "force_plug"

 

 

 

@@ -103,6 +107,12 @@
 };

 

 

+static struct attribute hotplug_attr =

+{

+        .name = "hotplug",

+        .mode = S_IRUGO|S_IWUSR,

+};

+

 static struct attribute ramdump_flag_attr =

 {

         .name = "ramdumpFlag",

@@ -171,9 +181,16 @@
 		.mode = S_IRUGO|S_IWUSR,

 };

 

+static struct attribute usb_force_plug_attr =

+{

+		.name = "force_plug",

+		.mode = S_IRUGO|S_IWUSR,

+};

+

 static struct attribute *usb_status_attrs[] =

 {

 	&usbstate_attr,

+	&hotplug_attr,

 	&net_name_attr,

 	&usb_speed_attr,

 	&usb_simulate_plug_attr,

@@ -185,6 +202,7 @@
 	&usb_switch_mode_attr,

 	&usb_dl_open_attr,

 	&usb_currcfg_attr,

+	&usb_force_plug_attr,

        NULL,

 };

 

@@ -211,6 +229,50 @@
 

 EXPORT_SYMBOL_GPL(get_panic_flag);

 

+/*

+ * this function used for tell ap core  plugout usb while system going to sleep

+ * and also the ap core disable usb plug interrupt and can not wakeup system

+ */

+void usb_netlink_force_sleep_usb(void)

+{

+	if(usbnetlink_ws){

+		__pm_stay_awake(usbnetlink_ws);

+	}

+	mutex_lock(&link_store_mutex);

+	force_plug = 0;

+	usb_rpmsg_config_cmd(USB_RPMSG_FORCE_SLEEP, NULL, 0);			

+	usb_schedule_work();

+

+	mutex_unlock(&link_store_mutex);

+

+	if(usbnetlink_ws){

+		__pm_relax(usbnetlink_ws);

+	}	

+

+}

+EXPORT_SYMBOL_GPL(usb_netlink_force_sleep_usb);

+

+/*

+ * this function used for tell ap core check& plugin usb while system wakeup

+ * ap core will enable the usb plug interrupt and check usb plugin or not

+ */

+void usb_netlink_force_wakeup_usb(void)

+{

+	if(usbnetlink_ws){

+		__pm_stay_awake(usbnetlink_ws);

+	}

+	mutex_lock(&link_store_mutex);

+	force_plug = 1;

+	usb_rpmsg_config_cmd(USB_RPMSG_FORCE_WAKEUP, NULL, 0);			

+	usb_schedule_work();

+

+	mutex_unlock(&link_store_mutex);

+

+	if(usbnetlink_ws){

+		__pm_relax(usbnetlink_ws);

+	}

+}

+EXPORT_SYMBOL_GPL(usb_netlink_force_wakeup_usb);

 void usb_netlink_notify(void)

 {

 	

@@ -249,11 +311,17 @@
 }

 void usb_schedule_notify_plug_work(usb_notify_event plug_type)

 {

-	hotplug_flag = (plug_type == USB_DEVICE_PLUGIN) ?  1 : 0;

 	schedule_work(&usb_plug_work);

 }
 EXPORT_SYMBOL_GPL(usb_schedule_work);

 

+

+void usb_set_plug_state(usb_notify_event plug_type)

+{    

+	hotplug_flag = (plug_type == USB_DEVICE_PLUGIN) ?  1 : 0;

+}

+EXPORT_SYMBOL_GPL(usb_set_plug_state);

+

 void usb_send_simplug2ap(void)

 {

 	printk("usb_send_simplug2ap\n");

@@ -380,7 +448,10 @@
 			}				

 	  		sprintf(buf, "%s\n",usb_get_resp_data());

 			//printk("---DL state:%s\n", buf);

-	}

+	}else if(!strcmp(attr->name,USB_FORCE_PLUG)){    	

+		sprintf(buf, "%d\n", force_plug);

+		goto SHOW_END;

+       }

  done:    

  	atomic_set(&resp_done,0);

 	usb_clean_mem();

@@ -401,7 +472,9 @@
 	if(usbnetlink_ws){

 		//__pm_wakeup_event(usbnetlink_ws, 3000);

 		__pm_stay_awake(usbnetlink_ws);

-	}	

+	}

+		mutex_lock(&link_store_mutex);

+

 	value = simple_strtoul(buf, NULL, 10);

 	if(!strcmp(attr->name,USB_STATE)){

 		//usbPoll_test();

@@ -422,6 +495,9 @@
 			usb_rpmsg_config_cmd(USB_RPMSG_FORCE_ECM, NULL, 0);		

 		}

 		usb_schedule_work();

+	}else if(!strcmp(attr->name,HOT_PLUG)){

+		//set_panic =value;

+		printk("hotplug is read only, do nothing\n");

 	}else if(!strcmp(attr->name,SET_PANIC)){

 		set_panic =value;

 	}else if(!strcmp(attr->name,USB_ECM_SLEEP_ENABLE)){

@@ -437,18 +513,20 @@
 		usb_schedule_work();

 		

 	}else if(!strcmp(attr->name, USB_RNDIS_PACKET_NUM)){

-       if(value >10 || value <1)

-       {

-            printk("[%s-%d],parame error:%d\n",__func__,__LINE__,value);

-       }

-       else

-       {

-            multi_packet_num = value ;

-       }

+		if(value >10 || value <1)

+		{

+		    printk("[%s-%d],parame error:%d\n",__func__,__LINE__,value);

+		}

+		else

+		{

+		    multi_packet_num = value ;

+		}

 	   

     }else if(!strcmp(attr->name,USB_ADB_SWITCH)){

-		//usb_ecm_sleep_en =value;

-		//generic_usb_set_sleep_range(value);

+		if(hotplug_flag == 0){

+			printk("usb disconnect, do nothing\n");

+			goto DONE;

+		}

 		if((value != ADB_SWITCH_TO_AP) && (value != ADB_SWITCH_TO_CAP)){

 			printk("[%s-%d],parame error:%d\n",__func__,__LINE__,value);

 		}

@@ -466,6 +544,11 @@
 

 		usb_schedule_work();		

 	}else if(!strcmp(attr->name, USB_SWITCH_MODE)){

+

+		if(hotplug_flag == 0){

+			printk("usb disconnect, do nothing\n");

+			goto DONE;

+		}	

 		switch(value){

 			case USB_MODE_DEBUG:

 				usb_rpmsg_config_cmd(USB_RPMSG_SWITCH_DEBUG_MODE, NULL, 0);

@@ -500,8 +583,15 @@
 		usb_schedule_work();

 		//for this cmd will write a block, and need long time, so we will wait here to ensure save

 		msleep(1000);

+    }else if(!strcmp(attr->name,USB_FORCE_PLUG)){    

+    		force_plug = value;

+		usb_rpmsg_config_cmd(((value != 0) ? USB_RPMSG_FORCE_WAKEUP : USB_RPMSG_FORCE_SLEEP), NULL, 0);		

+		

+		usb_schedule_work();		

     }

-DONE:	

+DONE:		

+	mutex_unlock(&link_store_mutex);

+	

 	if(usbnetlink_ws){

 		//__pm_wakeup_event(usbnetlink_ws, 3000);

 		__pm_relax(usbnetlink_ws);

@@ -605,7 +695,8 @@
 	if(usbnetlink_ws  == NULL){

 		printk("kset_usb_init wakeup_source_create fail\n");

 		

-	}	

+	}

+	mutex_init(&link_store_mutex);

    return ret;

 }

 

diff --git a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/usb/gadget/usb_rpmsg_client.c b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/usb/gadget/usb_rpmsg_client.c
index bba4141..106be64 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/usb/gadget/usb_rpmsg_client.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/usb/gadget/usb_rpmsg_client.c
@@ -56,6 +56,7 @@
 extern void usb_netlink_wakup(void);
 extern void adb_schedule_inform_work(int inform_type);
 extern void usb_schedule_notify_plug_work(int plug_type);
+extern void usb_set_plug_state(usb_notify_event plug_type);
 
 
 
@@ -116,6 +117,7 @@
 			break;
 		case USB_RPMSG_USB_PLUG_IN:
 			printk("-----receive usb plug in msg\n");
+			usb_set_plug_state(USB_DEVICE_PLUGIN);
 #if USB_PLUG_WAKE_SOURCE
 			if(usbplug_ws){
 				__pm_stay_awake(usbplug_ws);
@@ -126,6 +128,7 @@
 			break;
 		case USB_RPMSG_USB_PLUG_OUT:
 			printk("-----receive usb plug out msg\n");
+			usb_set_plug_state(USB_DEVICE_PLUGOUT);
 #if USB_PLUG_WAKE_SOURCE
 			if(usbplug_ws){
 				__pm_relax(usbplug_ws);	
diff --git a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/fs/ubifs/recovery.c b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/fs/ubifs/recovery.c
old mode 100644
new mode 100755
index f116f7b..c498a8a
--- a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/fs/ubifs/recovery.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/fs/ubifs/recovery.c
@@ -912,7 +912,7 @@
 static int recover_head(struct ubifs_info *c, int lnum, int offs, void *sbuf)
 {
 	int len = c->max_write_size, err;
-
+	bool forceclean = true;
 	if (offs + len > c->leb_size)
 		len = c->leb_size - offs;
 
@@ -921,7 +921,7 @@
 
 	/* Read at the head location and check it is empty flash */
 	err = ubifs_leb_read(c, lnum, sbuf, offs, len, 1);
-	if (err || !is_empty(sbuf, len)) {
+	if (err || !is_empty(sbuf, len) || forceclean) {
 		dbg_rcvry("cleaning head at %d:%d", lnum, offs);
 		if (offs == 0)
 			return ubifs_leb_unmap(c, lnum);
diff --git a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/include/linux/android_notify.h b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/include/linux/android_notify.h
index 1b88b98..569c17b 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/include/linux/android_notify.h
+++ b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/include/linux/android_notify.h
@@ -88,6 +88,8 @@
 	USB_RPMSG_SIMULATE_PLUG,

 	USB_RPMSG_USB_PLUG_IN,

 	USB_RPMSG_USB_PLUG_OUT,

+	USB_RPMSG_FORCE_SLEEP,

+	USB_RPMSG_FORCE_WAKEUP,

 	USB_RPMSG_NOTIFY_MAX,

 }e_usb_rpmsg_cmd_type;

 
diff --git a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/include/linux/spi/spi.h b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/include/linux/spi/spi.h
old mode 100644
new mode 100755
index 9a7620e..e308466
--- a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/include/linux/spi/spi.h
+++ b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/include/linux/spi/spi.h
@@ -209,6 +209,7 @@
 	u8		dma_used;
 	u8 		trans_gaped;
 	u8 		trans_gap_num;
+	u8      setup_immediately;
 };
 
 static inline struct spi_device *to_spi_device(struct device *dev)
diff --git a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/include/net/ipv6.h b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/include/net/ipv6.h
old mode 100644
new mode 100755
index 89ce8a5..9f4e031
--- a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/include/net/ipv6.h
+++ b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/include/net/ipv6.h
@@ -663,12 +663,17 @@
 /* more secured version of ipv6_addr_hash() */
 static inline u32 __ipv6_addr_jhash(const struct in6_addr *a, const u32 initval)
 {
+#if 0
 	u32 v = (__force u32)a->s6_addr32[0] ^ (__force u32)a->s6_addr32[1];
 
 	return jhash_3words(v,
-			    (__force u32)a->s6_addr32[2],
-			    (__force u32)a->s6_addr32[3],
-			    initval);
+						(__force u32)a->s6_addr32[2],
+						(__force u32)a->s6_addr32[3],
+						initval);
+#else/* CVE-2023-1206 */
+	return jhash2((__force const u32 *)a->s6_addr32, 
+					ARRAY_SIZE(a->s6_addr32), initval);
+#endif
 }
 
 static inline bool ipv6_addr_loopback(const struct in6_addr *a)
diff --git a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/lib/flags_utils/flags_utils.c b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/lib/flags_utils/flags_utils.c
index 3e70a51..ed4bb2b 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/lib/flags_utils/flags_utils.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/lib/flags_utils/flags_utils.c
@@ -386,10 +386,11 @@
  * 					 Global function implementations						   *

  ******************************************************************************/

 int flags_get(T_FLAGS_INFO *p_flags_info)

-{

-    T_FLAGS_INFO main_flag = {0};

-    T_FLAGS_INFO backup_flag = {0};

-    T_FLAGS_INFO p_flags_info_tmp = {0};

+{	

+    T_FLAGS_INFO *main_flag = NULL;

+    T_FLAGS_INFO *backup_flag = NULL;

+    T_FLAGS_INFO *p_flags_info_tmp = NULL;

+

 	char delta_F[IMG_NAME_LEN] = {0};

 

     int main_index = 0;

@@ -404,92 +405,170 @@
 	if (NULL == p_flags_info)

 	{

 		flags_err("invalid param NULL");

-		return -1;

+		goto err;

 	}

 

-    if (get_flags_info(&main_flag, &main_index, &backup_flag, &backup_index) != 0)

+	main_flag = (T_FLAGS_INFO *)kmalloc(sizeof(T_FLAGS_INFO), GFP_KERNEL);

+	if (NULL == main_flag)

+	{

+		flags_err("main_flag malloc fail");

+		goto err;

+	}

+	

+	backup_flag = (T_FLAGS_INFO *)kmalloc(sizeof(T_FLAGS_INFO), GFP_KERNEL);

+	if (NULL == backup_flag)

+	{

+		flags_err("backup_flag malloc fail");

+		goto err;

+	}

+

+	p_flags_info_tmp = (T_FLAGS_INFO *)kmalloc(sizeof(T_FLAGS_INFO), GFP_KERNEL);

+	if (NULL == p_flags_info_tmp)

+	{

+		flags_err("p_flags_info_tmp malloc fail");

+		goto err;

+	}

+

+	memset(main_flag, 0, sizeof(T_FLAGS_INFO));

+	memset(backup_flag, 0, sizeof(T_FLAGS_INFO));

+	memset(p_flags_info_tmp, 0, sizeof(T_FLAGS_INFO));

+

+    if (get_flags_info(main_flag, &main_index, backup_flag, &backup_index) != 0)

     {

     	flags_err("get flags info fail");

-        return -1;

+		goto err;

     }

 	

-	flags_info("main_flag crc32=%u, crc32_1=%u", main_flag.crc32, main_flag.crc32_1);

-	flags_info("backup_flag crc32=%u, crc32_1=%u", backup_flag.crc32, backup_flag.crc32_1);

+	flags_info("main_flag crc32=%u, crc32_1=%u", main_flag->crc32, main_flag->crc32_1);

+	flags_info("backup_flag crc32=%u, crc32_1=%u", backup_flag->crc32, backup_flag->crc32_1);

 

 	memset(delta_F, 0xFF, IMG_NAME_LEN);

 

-	if ((0 == memcmp(main_flag.img_size[0].name, delta_F, IMG_NAME_LEN)) && (0 == memcmp(backup_flag.img_size[0].name, delta_F, IMG_NAME_LEN)))

+	if ((0 == memcmp(main_flag->img_size[0].name, delta_F, IMG_NAME_LEN)) && (0 == memcmp(backup_flag->img_size[0].name, delta_F, IMG_NAME_LEN)))

 	{		

-		memset(&p_flags_info_tmp, 0, sizeof(T_FLAGS_INFO));

-		memcpy(&p_flags_info_tmp, &main_flag, offsetof(T_FLAGS_INFO, img_size));

+		memset(p_flags_info_tmp, 0, sizeof(T_FLAGS_INFO));

+		memcpy(p_flags_info_tmp, main_flag, offsetof(T_FLAGS_INFO, img_size));

 

-		p_flags_info_tmp.crc32_1 = crc32_le(0, (unsigned char const *)(&p_flags_info_tmp), sizeof(T_FLAGS_INFO));

-		flags_info("fix old, set crc32_1=%u", p_flags_info_tmp.crc32_1);

+		p_flags_info_tmp->crc32_1 = crc32_le(0, (unsigned char const *)(p_flags_info_tmp), sizeof(T_FLAGS_INFO));

+		flags_info("fix old, set crc32_1=%u", p_flags_info_tmp->crc32_1);

 		

-		if (set_flags_info(&p_flags_info_tmp, &main_index, &backup_index) != 0)

+		if (set_flags_info(p_flags_info_tmp, &main_index, &backup_index) != 0)

 		{

 			flags_err("fix old, set flags info fail");

-			return -1;

+			goto err;

 		}

 		

-		copy_flags_info(p_flags_info, &main_flag);

-		return 0;

+		copy_flags_info(p_flags_info, main_flag);

+		goto succ;

 	}

 

-	crc32_main = main_flag.crc32_1;

-	crc32_backup = backup_flag.crc32_1;

+	crc32_main = main_flag->crc32_1;

+	crc32_backup = backup_flag->crc32_1;

 

-	main_flag.crc32_1 = 0;

-	backup_flag.crc32_1 = 0;

+	main_flag->crc32_1 = 0;

+	backup_flag->crc32_1 = 0;

 		

-	crc32_le_main = crc32_le(0, (unsigned char const *)(&main_flag), sizeof(main_flag));

+	crc32_le_main = crc32_le(0, (unsigned char const *)(main_flag), sizeof(T_FLAGS_INFO));

 	flags_info("crc32_le_main crc32=%u", crc32_le_main);

 	

-	crc32_le_backup = crc32_le(0, (unsigned char const *)(&backup_flag), sizeof(backup_flag));

+	crc32_le_backup = crc32_le(0, (unsigned char const *)(backup_flag), sizeof(T_FLAGS_INFO));

 	flags_info("crc32_le_backup crc32=%u", crc32_le_backup);

 

     if (crc32_main == crc32_le_main)

     {

-        copy_flags_info(p_flags_info, &main_flag);

+        copy_flags_info(p_flags_info, main_flag);

 		

-        return 0;

+		goto succ;

     }

 	

     if (crc32_backup == crc32_le_backup)

     {

-        copy_flags_info(p_flags_info, &backup_flag);

+        copy_flags_info(p_flags_info, backup_flag);

 		

-        return 0;

+		goto succ;

     }

 

     flags_err("do not find valid flags info");

-    return -1;

+

+err:

+	if (main_flag != NULL)

+	{

+		kfree(main_flag);

+	}

+

+	if (backup_flag != NULL)

+	{

+		kfree(backup_flag);

+	}

+

+	if (p_flags_info_tmp != NULL)

+	{

+		kfree(p_flags_info_tmp);

+	}

+

+	return -1;

+

+succ:

+	if (main_flag != NULL)

+	{

+		kfree(main_flag);

+	}

+

+	if (backup_flag != NULL)

+	{

+		kfree(backup_flag);

+	}

+

+	if (p_flags_info_tmp != NULL)

+	{

+		kfree(p_flags_info_tmp);

+	}

+

+	return 0;

 }

 EXPORT_SYMBOL(flags_get);

 

 int flags_set(T_FLAGS_INFO *p_flags_info)

 {

-	T_FLAGS_INFO main_flag = {0};

-    T_FLAGS_INFO backup_flag = {0};

+    T_FLAGS_INFO *main_flag = NULL;

+    T_FLAGS_INFO *backup_flag = NULL;

+

     int main_index = 0;

     int backup_index = 1;

 	

 	if (NULL == p_flags_info)

 	{

 		flags_err("invalid param NULL");

-		return -1;

+		goto err;

 	}

 

+	main_flag = (T_FLAGS_INFO *)kmalloc(sizeof(T_FLAGS_INFO), GFP_KERNEL);

+	if (NULL == main_flag)

+	{

+		flags_err("main_flag malloc fail");

+		goto err;

+	}

+	

+	backup_flag = (T_FLAGS_INFO *)kmalloc(sizeof(T_FLAGS_INFO), GFP_KERNEL);

+	if (NULL == backup_flag)

+	{

+		flags_err("backup_flag malloc fail");

+		goto err;

+	}

+

+	memset(main_flag, 0, sizeof(T_FLAGS_INFO));

+	memset(backup_flag, 0, sizeof(T_FLAGS_INFO));

+

 	if ((FLAGS_MAGIC != p_flags_info->magic_start) || (FLAGS_MAGIC != p_flags_info->magic_end))

 	{

 		flags_err("invalid magic");

-		return -1;

+		goto err;

 	}

 	

-    if (get_flags_info(&main_flag, &main_index, &backup_flag, &backup_index) != 0)

+    if (get_flags_info(main_flag, &main_index, backup_flag, &backup_index) != 0)

     {

     	flags_err("get flags info fail");

-        return -1;

+		goto err;

     }

 	

 	p_flags_info->crc32 = 0;

@@ -503,46 +582,80 @@
     if (set_flags_info(p_flags_info, &main_index, &backup_index) != 0)

     {

         flags_err("set ubifs status fail");

-        return -1;

+		goto err;

     }

 

+succ:

+	if (main_flag != NULL)

+	{

+		kfree(main_flag);

+	}

+

+	if (backup_flag != NULL)

+	{

+		kfree(backup_flag);

+	}

+

 	return 0;

+

+err:

+	if (main_flag != NULL)

+	{

+		kfree(main_flag);

+	}

+

+	if (backup_flag != NULL)

+	{

+		kfree(backup_flag);

+	}

+

+	return -1;

 }

 EXPORT_SYMBOL(flags_set);

 

 

 int flags_sys_switch(void)

 {

-	T_FLAGS_INFO flags_info = {0};

+	T_FLAGS_INFO *flags_info = NULL;

 	int ret = -1;

 

-	ret = flags_get(&flags_info);

+	flags_info = (T_FLAGS_INFO *)kmalloc(sizeof(T_FLAGS_INFO), GFP_KERNEL);

+	if (NULL == flags_info)

+	{

+		flags_err("main_flag malloc fail");

+		return -1;

+	}

+

+	memset(flags_info, 0, sizeof(T_FLAGS_INFO));

+	ret = flags_get(flags_info);

 	if (ret < 0)

 	{

 		flags_err("flags switch flags_get fail\n");

+		kfree(flags_info);

 		return ret;

 	}

 

-	if (flags_info.boot_fota_flag.boot_to == DUAL_SYSTEM)

+	if (flags_info->boot_fota_flag.boot_to == DUAL_SYSTEM)

 	{

-		flags_info.boot_fota_flag.boot_to = DUAL_SYSTEM2;  //A->B

-		flags_info.boot_fota_flag.system.status = DUALSYSTEM_STATUS_UNBOOTABLE;

+		flags_info->boot_fota_flag.boot_to = DUAL_SYSTEM2;  //A->B

+		flags_info->boot_fota_flag.system.status = DUALSYSTEM_STATUS_UNBOOTABLE;

 		//flags_info("flags switch system A to system B\n");

 	}

 	else

 	{

-		flags_info.boot_fota_flag.boot_to = DUAL_SYSTEM;   //B->A

-		flags_info.boot_fota_flag.system2.status = DUALSYSTEM_STATUS_UNBOOTABLE;

+		flags_info->boot_fota_flag.boot_to = DUAL_SYSTEM;   //B->A

+		flags_info->boot_fota_flag.system2.status = DUALSYSTEM_STATUS_UNBOOTABLE;

 		//flags_info("flags switch system B to system A\n");

 	}

-	flags_info.boot_fota_flag.fota_status = 1;   //nvserver update flag

-	ret = flags_set(&flags_info);

+	flags_info->boot_fota_flag.fota_status = 1;   //nvserver update flag

+	ret = flags_set(flags_info);

 	if (ret < 0)

 	{

 		flags_err("flags switch flags_set fail\n");

+		kfree(flags_info);

 		return ret;

 	}

-	

+	kfree(flags_info);

 	return ret;

 }

 EXPORT_SYMBOL(flags_sys_switch);

diff --git a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/lib/kobject.c b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/lib/kobject.c
old mode 100644
new mode 100755
index ea53b30..617a25e
--- a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/lib/kobject.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/lib/kobject.c
@@ -144,7 +144,7 @@
 	return length;
 }
 
-static void fill_kobj_path(struct kobject *kobj, char *path, int length)
+static int fill_kobj_path(struct kobject *kobj, char *path, int length)
 {
 	struct kobject *parent;
 
@@ -153,12 +153,16 @@
 		int cur = strlen(kobject_name(parent));
 		/* back up enough to print this name with '/' */
 		length -= cur;
+		if (length <= 0)
+			return -EINVAL;
 		memcpy(path + length, kobject_name(parent), cur);
 		*(path + --length) = '/';
 	}
 
 	pr_debug("kobject: '%s' (%p): %s: path = '%s'\n", kobject_name(kobj),
 		 kobj, __func__, path);
+
+	return 0;
 }
 
 /**
@@ -173,13 +177,17 @@
 	char *path;
 	int len;
 
+retry:
 	len = get_kobj_path_length(kobj);
 	if (len == 0)
 		return NULL;
 	path = kzalloc(len, gfp_mask);
 	if (!path)
 		return NULL;
-	fill_kobj_path(kobj, path, len);
+	if (fill_kobj_path(kobj, path, len)) {
+		kfree(path);
+		goto retry;
+	}
 
 	return path;
 }
diff --git a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/net/bridge/br_fdb.c b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/net/bridge/br_fdb.c
index 58b6e27..65a6054 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/net/bridge/br_fdb.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/net/bridge/br_fdb.c
@@ -1345,6 +1345,10 @@
 			(((fdb->dst->flags & BR_HAIRPIN_MODE) || skb->dev != fdb->dst->dev) &&fdb->dst->state == BR_STATE_FORWARDING)) 
 		{
 			fast_tcpdump(skb);
+			if(fastnat_level == FAST_NET_DEVICE){
+				skb->dev->stats.rx_packets++;
+				skb->dev->stats.rx_bytes += skb->len;
+			}
 			skb->dev = fdb->dst->dev;
 			skb->isFastbr = 1;
 			fdb->updated = jiffies;
@@ -1360,6 +1364,7 @@
 			(skb->dev == fdb->dst->dev) && fdb->dst->state == BR_STATE_FORWARDING)
 		{
 			skbinfo_add(NULL,SKB_LOOP);
+			skb->dev->stats.rx_dropped++;
 			//print_sun(SUN_ERR,"fast_br loop data discarded, dev:%s \n", skb->dev->name);
 			kfree_skb(skb);
 			return 1;
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/at_ctl/src/phone/phone_adapt.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/at_ctl/src/phone/phone_adapt.c
index 5bf1504..13ee324 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/at_ctl/src/phone/phone_adapt.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/at_ctl/src/phone/phone_adapt.c
@@ -51,7 +51,7 @@
 int phone_info_act(char *at_paras ,int is_query_report);

 int zvoicechnl_info_act(char *at_paras, int is_query_report);

 int imsdtmf_info_act(char *at_paras, int is_query_report);

-

+int zt10dereg_info_act(char *at_paras, int is_query_report);

 T_CI_CMD_ID atiCmdIdGet(UINT32 ChannelId);

 int atctlSendMsgToTapi(VOID *pMsg);

 extern SINT32 AT_Generate_At_Cmd_Line(SINT32 psId, CHAR *pstrAtCmdLine, ZBL_CHANNEL_MSG_INFO *pMsg);

@@ -386,7 +386,7 @@
 	register_inform_func("ZECALLCAPA",	phone_info_act);

 	register_inform_func("ZECALLNUM",	phone_info_act);

 	register_inform_func("ZECALLTIMER",	phone_info_act);

-	register_inform_func("ZT10DEREG",	phone_info_act);

+	register_inform_func("ZT10DEREG",	zt10dereg_info_act);

 	//SMS  ´ýÍêÉÆ£¬ PHONEµÄPDUÐèÒªÌØÊâ´¦Àí

 	register_inform_func("CSMS",	phone_info_act);

 	register_inform_func("CGSMS",	phone_info_act);

@@ -1271,6 +1271,20 @@
 	return AT_END;

 }

 

+int zt10dereg_info_act(char *at_paras, int is_query_report)

+{

+	ZBL_CHANNEL_MSG_INFO *pMsg = zblMallocChannelMsg(0);

+

+	if(NULLPTR == pMsg)

+    {

+        zblAssert(0);

+        return -1;

+    }

+	pMsg->msgId = ATI_CC_ZT10DEREG_IND;

+	pMsg->msgSize = 0;	

+	atctlSendMsgToTapi((VOID*)pMsg);

+	return AT_END;

+}

 

 /*½âÂ뺯ÊýParse_Zpbic_ResÖÐʹÓÃzblMallocChannelMsgÉêÇëµÄÊý¾ÝµØÖ·×÷ΪMSG_BUFµÄÄÚÈÝ

 ͨ¹ýipc_send_message·¢ËÍ£¬ÓɽÓÊÕ·½Í¨¹ýzblFreeChannelMsg½øÐÐÊÍ·Å*/

diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/fota_upi_ab/src/main.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/fota_upi_ab/src/main.c
index 5763567..9516f1a 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/fota_upi_ab/src/main.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/fota_upi_ab/src/main.c
@@ -84,9 +84,10 @@
 static int execute_command_config_package_path(char * option_para);
 static int execute_command_config_log_path(char * option_para);
 static int execute_command_set_package_info(char * option_para);
+static int execute_command_set_upgrade_status(char * option_para);
 
 
-static char * g_short_string = "u:cgb:sio:t:qr:hvypne:a:l:f:";
+static char * g_short_string = "u:cgb:sio:t:qr:hvypne:a:l:f:d:";
 
 static struct option g_long_options[] =
 {
@@ -109,6 +110,7 @@
     {"config-package-path",		required_argument,		NULL,	'a'},
     {"config-log-path",		required_argument,		NULL,	'l'},
     {"set-package-info",		required_argument,		NULL,	'f'},
+    {"set-upgrade-status",		required_argument,		NULL,	'd'},
     {0, 0, 0, 0}
 };
 
@@ -132,7 +134,8 @@
     {'e',		execute_command_set_sync_status},
     {'a',		execute_command_config_package_path},
     {'l',		execute_command_config_log_path},
-    {'f',		execute_command_set_package_info}
+    {'f',		execute_command_set_package_info},
+    {'d',		execute_command_set_upgrade_status}
 };
 
 
@@ -160,7 +163,8 @@
            "  -e,  --set-sync-status       set sync status \n"
            "  -a,  --config-package-path   config package path \n"
            "  -l,  --config-log-path       config log path \n"
-           "  -f,  --set-package-info      set package info \n");
+           "  -f,  --set-package-info      set package info \n"
+           "  -d,  --set-upgrade-status    set upgrade status \n");
 }
 
 
@@ -530,6 +534,32 @@
 }
 
 
+static int execute_command_set_upgrade_status(char * option_para)
+{
+    int ret = -1;
+
+    if (NULL == option_para)
+    {
+        usage();
+        printf("Command input invalid value! null option parameters! \n");
+
+        return ret;
+    }
+
+    ret = zxic_dual_set_upgrade_status(atoi(option_para));
+    if (0 != ret)
+    {
+        printf("set upgrade status fail\n");
+
+        return ret;
+    }
+
+    ret = 0;
+
+    return ret;
+}
+
+
 /**
  * @brief	Ð´ËøÎļþ
  * @param	filepath:	Îļþ·¾¶
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/include/softap_api.h b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/include/softap_api.h
index 1dcda07..e3e53fa 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/include/softap_api.h
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/include/softap_api.h
@@ -412,4 +412,20 @@
 */
 int platform_wake_lock_timeout(const char* lock_name, unsigned long long msec);
 
+/**
+* @brief ÉèÖõ͹¦ºÄģʽ½Ó¿Ú
+* @param mode(IN)		:µÍ¹¦ºÄģʽ¡£0-Í˳öϨ»ðģʽ£»1-½øÈëϨ»ðģʽ£»ÆäËüÖµÎÞЧ
+* @return ²Ù×÷³É¹¦·µ»Ø0£¬²Ù×÷ʧ°Ü·µ»Ø·Ç0
+* @note 
+*/
+int platform_set_lowpower_mode(unsigned int mode);
+/**
+* @brief »ñÈ¡µÍ¹¦ºÄģʽ½Ó¿Ú
+* @param mode(OUT)		:Êä³öµÍ¹¦ºÄģʽ¡£1-½øÈëϨ»ðģʽ£»0-Í˳öϨ»ðģʽ£»
+* @return ²Ù×÷³É¹¦·µ»Ø0£¬²Ù×÷ʧ°Ü·µ»Ø·Ç0
+* @note 
+*/
+int platform_get_lowpower_mode(unsigned int *mode);
+
+
 #endif
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/include/wifi_inter_msg.h b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/include/wifi_inter_msg.h
index 74c49bd..c80b0fd 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/include/wifi_inter_msg.h
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/include/wifi_inter_msg.h
@@ -135,6 +135,7 @@
 	int result;

 	int status;

 	char ifname[32];

+	char bssid[18];

 } scwifi_ap_enable_res_t;

 

 //¶ÔÄÚÍ·Îļþ

@@ -181,6 +182,12 @@
 	int err_code;

 } scwifi_serv_err_t;

 

+typedef struct

+{

+    int freq;

+    int ch;

+} scwifi_freq_ch_t;

+

 /*******************************************************************************

  *                       Global variable declarations                          *

  ******************************************************************************/

diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/include/wifi_msg.h b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/include/wifi_msg.h
index a1f3773..4cab875 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/include/wifi_msg.h
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/include/wifi_msg.h
@@ -394,6 +394,10 @@
 	short    connect_status;
 	short    channel;
 	short    signal;
+#ifdef USE_CAP_SUPPORT
+	//short    ch_freq;
+	signed char    signal_db;
+#endif
 } scan_result_t;
 
 
@@ -612,7 +616,7 @@
 	int pre_status; //½öcap×ÔÐи³Öµ
 	int status;
 	char ifname[32];
-	//char bssid[18];
+	char bssid[18]; //½öcap×ÔÐи³Öµ
 } wlan_ap_status_t;
 
 //sc_wifi_sta_connect_status_t
@@ -694,12 +698,12 @@
 {
 	char bssid[18];//mac
 	char essid[33];
-	//int signal;
+	signed char signal; //dbm
 	unsigned char signal_level; //0-5, max 5
-	//int frequency;
-	unsigned char channel; //1-13
+	unsigned char channel; //1-13, 36...
 	unsigned char auth;
 	unsigned char cipher;
+	//int frequency; //Hz
 } wlan_sta_scan_info_t;
 
 //sc_wifi_sta_scan_list_t
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/libatext/ext_normal_func.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/libatext/ext_normal_func.c
index 4667c75..05e7ad0 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/libatext/ext_normal_func.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/libatext/ext_normal_func.c
@@ -583,6 +583,45 @@
     return AT_END;

 }

 

+int netonly_req(int at_fd, char *at_paras,void ** res_msg, int *res_msglen)

+{

+	int ret = 0;

+	char*  at_str = NULL;

+	int32_t user_cmd = 0;

+		

+	if(at_paras==NULL)

+		softap_assert("netonly_req:at_paras is null");

+	

+	at_str = at_paras;

+	printf("netonly_req:: at_str:%s\n", at_str);

+	get_at_cmd_param_int(at_str, &user_cmd, &at_str);

+	printf("netonly_req:: user_cmd:%d\n", user_cmd);

+	

+	if((user_cmd != 1) ){

+		printf("netonly_req:: invaild user_cmd == %d\n", user_cmd);

+		*res_msg = at_err_build(ATERR_PARAM_INVALID);	

+		goto AT_RESULT;

+	}

+	

+	sc_cfg_set("usb_vnic_user", "on");

+	sc_cfg_set("usb_devices_user", "");

+	

+	sc_cfg_save();

+	//write this attr, 

+	ret = ext_writefile(USB_ATTR_SIMULATE_PLUG,  "1" , 1);

+	if(ret < 0){

+		 printf("netonly_req:set attr fail \n");

+		*res_msg = at_err_build(ATERR_PARAM_INVALID);	

+		 goto AT_RESULT;

+	}	

+AT_OK:	

+	*res_msg = at_ok_build();	

+	

+AT_RESULT:	

+	*res_msglen = strlen(*res_msg);

+

+    return AT_END;

+}

 

 int ziprSet_req(int at_fd, char *at_paras,void ** res_msg, int *res_msglen)

 {

@@ -715,6 +754,7 @@
 	register_serv_func2("adbswitch=",0,0,0,adbswitchSet_req,NULL);

 	register_serv_func2("netset=",0,0,0,netSet_req,NULL);	

 	register_serv_func2("adbset=",0,0,0,adbSet_req,NULL);

+	register_serv_func2("netonly=",0,0,0,netonly_req,NULL);

 

 

 	//¹Ì¶¨²¨ÌØÂÊÉèÖúͲéѯÃüÁî

diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/libatutils/at_utils.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/libatutils/at_utils.c
index 22ab5cb..f88960a 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/libatutils/at_utils.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/libatutils/at_utils.c
@@ -1054,3 +1054,51 @@
 	return sum;

 }

 

+int platform_set_lowpower_mode(unsigned int mode)

+{

+	int ret = 0;

+

+	/*Í˳öϨ»ðģʽ*/

+	if(0 == mode) {

+		ret = get_modem_info("AT+ZLOWPWR=0\r\n", NULL, NULL);

+		if(ret){

+			slog(NET_PRINT, SLOG_ERR, "platform_set_lowpower_mode AT+ZLOWPWR=0 err=%d\n", ret);

+		}

+	}

+	/*½øÈëϨ»ðģʽ*/

+	else if(1 == mode) {

+		ret = get_modem_info("AT+ZLOWPWR=1\r\n", NULL, NULL);

+		if(ret){

+			slog(NET_PRINT, SLOG_ERR, "platform_set_lowpower_mode AT+ZLOWPWR=1 err=%d\n", ret);

+		}

+	}

+	/*ÎÞЧֵ*/

+	else {

+		slog(NET_PRINT, SLOG_ERR, "platform_set_lowpower_mode bad param\n");

+	}

+

+	return ret;

+}

+

+int platform_get_lowpower_mode(unsigned int *mode)

+{

+	int ret = -1;

+	char value[32] = {0};

+	void *p[] = {value};

+

+	if(NULL == mode) {

+		slog(NET_PRINT, SLOG_ERR, "platform_get_lowpower_mode bad param\n");

+		return -1;

+	}

+	ret = get_modem_info("AT+ZLOWPWR?\r\n", "%s", (void**)p);

+	if(ret) {

+		slog(NET_PRINT, SLOG_ERR, "platform_get_lowpower_mode AT+ZLOWPWR? err=%d\n", ret);

+		return ret;

+	}

+	

+	*mode = atoi(value);

+

+	return 0;

+}

+

+

diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/libmsmsvr/platadapt/msp/inc/adapt/zmsp_codec.h b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/libmsmsvr/platadapt/msp/inc/adapt/zmsp_codec.h
index 543abed..ee7e311 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/libmsmsvr/platadapt/msp/inc/adapt/zmsp_codec.h
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/libmsmsvr/platadapt/msp/inc/adapt/zmsp_codec.h
@@ -304,8 +304,9 @@
  */

 SINT32 zMspCom_CloseMediaRecorder(UINT32 uiRecorder);

 

-

-

+#ifndef _USE_FFMPEG

+SINT32 zMspCom_DecodeNextFrame2(UINT32 uiMedia, T_MediaFrame **pFrame, VOID* buf, SINT32 len);

+#endif

 /**************************************************************

  *                       ¶àýÌåÊÊÅä²ã                         *

  **************************************************************/

diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/libmsmsvr/platadapt/msp/inc/adapt/zte_net_media_codec.h b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/libmsmsvr/platadapt/msp/inc/adapt/zte_net_media_codec.h
index c7f6972..20dfe89 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/libmsmsvr/platadapt/msp/inc/adapt/zte_net_media_codec.h
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/libmsmsvr/platadapt/msp/inc/adapt/zte_net_media_codec.h
@@ -1,3 +1,4 @@
+#ifdef _USE_FFMPEG
 #include <fcntl.h>
 #include <stdio.h>
 #include <unistd.h>
@@ -197,5 +198,5 @@
  * @retval:
  */
 int net_media_decode_audio(struct codec_info *codecInfo, struct frame_info **mediaInfo);
-
+#endif /*_USE_FFMPEG*/
 
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/libmsmsvr/platadapt/msp/src/zmsp_codec.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/libmsmsvr/platadapt/msp/src/zmsp_codec.c
index 3513237..61baa9b 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/libmsmsvr/platadapt/msp/src/zmsp_codec.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/libmsmsvr/platadapt/msp/src/zmsp_codec.c
@@ -48,6 +48,10 @@
 # include <stdio.h>

 #endif

 

+#include "oss_api.h"

+

+#ifdef _USE_FFMPEG 

+

 /* FFMPEG ýÌåÎļþ½âÎö, ÒôƵÊÓÆµ±à½âÂëÍ·Îļþ */

 #include <libavutil/log.h>

 #include <libavutil/imgutils.h>

@@ -56,8 +60,6 @@
 #include <libavformat/avformat.h>

 #include <libavcodec/avcodec.h>

 

-#include "oss_api.h"

-

 /**************************************************************************

  *                         ºê¶¨Òå                                         *

  **************************************************************************/

@@ -1023,8 +1025,14 @@
     {

     case AVMEDIA_TYPE_AUDIO:

     {

-        int buffer_size = av_samples_get_buffer_size(

-                              NULL, pCodecCtx->channels, pCodecCtx->frame_size, pCodecCtx->sample_fmt, 0);

+    	int buffer_size;

+		

+    	if(AV_CODEC_ID_PCM_S16LE == pCodecCtx->codec->id) {

+			pCodecCtx->frame_size = ((pCodecCtx->sample_rate/1000)*1024)/4;	        

+    	}

+		buffer_size = av_samples_get_buffer_size(

+	                              NULL, pCodecCtx->channels, pCodecCtx->frame_size, pCodecCtx->sample_fmt, 0);

+		

         if(buffer_size < 0)

         {

             ZTE_Trace(ZTE_MSM, 0, "[zMspPrepareAVBuffer]: Couldn't get audio sample buffer size");

@@ -3518,4 +3526,284 @@
 

     return 0;

 }

+#else /*_USE_FFMPEG*/

 

+#ifdef _GCC_CHECK_PRINT_FORMAT_

+extern UINT32 ZTE_Trace(UINT32 nModNo, UINT8 nPrintLevel, const char *pFormat, ...)

+__attribute__((format(printf, 3, 4)));

+#else

+extern UINT32 ZTE_Trace(UINT32 nModNo, UINT8 nPrintLevel, const char *pFormat, ...);

+#endif

+

+typedef struct _T_MediaRecorder

+{

+    T_MediaRecorderParam  tMediaRecorderParam;   /* Â¼ÖÆ²ÎÊý, ¼û@T_MediaRecorderParam¶¨Òå */      

+    FILE        *pFilp;             /* Â¼ÖÆÎļþ´ò¿ªµÄ¾ä±ú */   

+} T_MediaRecorder;

+

+typedef struct _T_MediaParserAndDecoder

+{

+    T_MediaInfo       tMediaInfo;       /* ýÌåÎļþÒôÊÓÆµÐÅÏ¢ */   

+	int64_t           iDecodedSamples;  /* ÒôƵÒѽâÂëµÄ²ÉÑùÊý, µ±Ã»ÓÐPTS, ×÷PTS */

+	FILE             *pFilp;            /* ýÌåÎļþ´ò¿ªµÄ¾ä±ú */

+    CHAR              sFileName[256];   /* ýÌåÎļþ·¾¶ */

+

+	T_MediaFrame 	 *pMediaFrame;

+} T_MediaParserAndDecoder;

+

+

+extern int zMsp_OpenInitInput_Wav(FILE *file, T_MediaInfo *pmediainfo);

+extern int zMsp_ReadNextFrame_Wav(FILE *file, T_MediaInfo *pmediainfo, T_MediaFrame *pFrame);

+extern int zMsp_SeekFrame_Wav(FILE *file, T_MediaInfo *pmediainfo, unsigned int iSeekTs);

+extern int zMsp_OpenInitOutput_Wav(FILE *file, T_MediaRecorderParam *pParam);

+extern int zMsp_WriteNextFrame_Wav(FILE *file, T_MediaRecorderParam *pParam, unsigned char *pAudioData, int iAudioDataSize);

+extern int zMsp_WriteEnd_Wav(FILE *file);

+

+SINT32 zMspCom_CloseMediaRecorder(UINT32 uiRecorder)

+{

+    T_MediaRecorder *pRecorder = (T_MediaRecorder *) uiRecorder;

+

+    if(!pRecorder || !pRecorder->pFilp) return -1;

+

+	ZTE_Trace(ZTE_MSM, 0, "[zMspCom_CloseMediaRecorder]: Try to close a media recorder, "

+              "file: %s", pRecorder->tMediaRecorderParam.sFileName);

+	

+	if(0 != zMsp_WriteEnd_Wav(pRecorder->pFilp)) {

+		ZTE_Trace(ZTE_MSM, 0, "[zMspCom_CloseMediaRecorder] zMsp_WriteEnd_Wav fail.");

+	}

+	tp_fclose(pRecorder->pFilp);

+	free(pRecorder);

+

+	return 0;

+}

+

+UINT32 zMspCom_OpenMediaRecorder(T_MediaRecorderParam *pParam, SINT32 *pIAudioFrameSize)

+{

+    T_MediaRecorder *pRecorder = NULL;

+

+	/* check the media recorder params */

+    if(!pParam || !pIAudioFrameSize) return 0;

+

+    ZTE_Trace(ZTE_MSM, 0, "[zMspCom_OpenMediaRecorder]: MediaRecorder(%s) Params: \n"

+              "VIDEO: Present(%d), (%ux%u)@(%u)fps, (%u)bps, pix-fmt(%d), codec(%d)\n"

+              "AUDIO: Present(%d), rate(%u), chnl(%u), sample-fmt(%d), codec(%d)\n",

+              pParam->sFileName,

+              pParam->bVideoPresent, pParam->uiWidth, pParam->uiHeight, pParam->uiFrameRate,

+              pParam->uiVideoBitrate, pParam->ePixelFmt, pParam->eVideoCodecType,

+              pParam->bAudioPresent, pParam->eSamplingRate, pParam->uiChannels,

+              pParam->eSampleFmt, pParam->eAudioCodecType);

+ 

+    /* Audio codec, ONLY support Wav */

+    if(!pParam->bAudioPresent || pParam->eAudioCodecType != AUDIO_CODEC_WAV)

+    {

+        ZTE_Trace(ZTE_MSM, 0, "[zMspCom_OpenMediaRecorder]: Audio codec(%d) is "

+                  "not support, ONLY support WAV",

+                  pParam->eAudioCodecType);

+        return 0;

+    }

+

+    /* check media record filename(filepath) and filetype */

+    if(pParam->sFileName[0] == '\0')

+    {

+        ZTE_Trace(ZTE_MSM, 0, "[zMspCom_OpenMediaRecorder]: Record filepath is null!!!");

+        return 0; /* 0 is NULL */

+    }

+								 

+	/* New a MediaRecorder Handler */

+    if((pRecorder = (T_MediaRecorder *)malloc(sizeof(T_MediaRecorder))) == NULL)

+    {

+        ZTE_Trace(ZTE_MSM, 0, "[zMspCom_OpenMediaRecorder]: malloc for MediaRecorder failed");

+        return 0;

+    }

+

+    memset(pRecorder, 0, sizeof(T_MediaRecorder));

+	/* copy(save) the media record params */

+    memcpy(&pRecorder->tMediaRecorderParam, pParam, sizeof(T_MediaRecorderParam));

+	

+	pRecorder->pFilp = tp_fopen(pRecorder->tMediaRecorderParam.sFileName, "wb");

+    if(!pRecorder->pFilp)

+    {

+        ZTE_Trace(ZTE_MSM, 0, "[zMspCom_OpenMediaRecorder]: tp_fopen media record "

+                  "file(%s) failed", pRecorder->tMediaRecorderParam.sFileName);

+		free(pRecorder);

+		

+        return 0;

+    }

+	

+	if(0 != zMsp_OpenInitOutput_Wav(pRecorder->pFilp, &(pRecorder->tMediaRecorderParam)))

+	{

+		tp_fclose(pRecorder->pFilp);

+		free(pRecorder);

+		return 0;

+	}

+

+	*pIAudioFrameSize = ((zMspCom_MspRate2ManRate(pParam->eSamplingRate) / 1000) *1024) / 4;

+	

+	return (UINT32)pRecorder;

+}

+

+SINT32 zMspCom_EncodeAndWriteAudioFrame(UINT32 uiRecorder, UINT8 *pAudioData, SINT32 iAudioDataSize)

+{

+    T_MediaRecorder *pRecorder = (T_MediaRecorder *) uiRecorder;

+

+    if(!pRecorder || !pAudioData || iAudioDataSize <= 0) return -1;

+    if(!pRecorder->tMediaRecorderParam.bAudioPresent) return -1;

+

+	if(0 > zMsp_WriteNextFrame_Wav(pRecorder->pFilp, &(pRecorder->tMediaRecorderParam), (unsigned char *)pAudioData, iAudioDataSize)) {

+		return -1;

+	}

+

+	return 0;

+}

+

+SINT32 zMspCom_DecodeNextFrame(UINT32 uiMedia, T_MediaFrame **pFrame)

+{

+	return -1;

+}

+

+SINT32 zMspCom_DecodeNextFrame2(UINT32 uiMedia, T_MediaFrame **pFrame, VOID* buf, SINT32 len)

+{	

+	SINT32 iRet = 0;

+

+    T_MediaFrame *pMediaFrame = NULL;

+    T_MediaParserAndDecoder *pMedia = (T_MediaParserAndDecoder *) uiMedia;

+	int64_t pts = 0, duration = 0;

+    UINT32 sample_rate;

+

+	if(0 == uiMedia || NULL == pFrame) {

+		return -1;

+	}

+

+	pMediaFrame = pMedia->pMediaFrame;

+	memset(pMediaFrame, 0, sizeof(T_MediaFrame));

+	

+	pMediaFrame->pData = buf;

+	pMediaFrame->iDataSize = len;

+	pMediaFrame->eFrameType = MEDIA_FRAME_AUDIO;

+	

+	iRet = zMsp_ReadNextFrame_Wav(pMedia->pFilp, &(pMedia->tMediaInfo), pMediaFrame);

+	if(0 > iRet) {

+		free(pMediaFrame);

+		return -1;

+	}

+

+    sample_rate = zMspCom_MspRate2ManRate(pMedia->tMediaInfo.eSamplingRate);

+

+	if(MSP_AUDIO_SAMPLE_FMT_S32 == pMedia->tMediaInfo.eSampleFmt) {

+		pts = (int64_t)(pMedia->iDecodedSamples * 1.0 * 1000 / (sample_rate * pMedia->tMediaInfo.uiChannels * 4));

+	}

+	else {

+		pts = (int64_t)(pMedia->iDecodedSamples * 1.0 * 1000 / (sample_rate * pMedia->tMediaInfo.uiChannels * 2));

+	}

+    

+	pMediaFrame->uiPts = (UINT32)pts;

+

+    duration = (int64_t)(pMediaFrame->iDataSize) * 1.0 * 1000 / sample_rate;

+	pMediaFrame->uiDuration = (UINT32)duration;

+

+	pMedia->iDecodedSamples += pMedia->tMediaInfo.uiAudioFrameSize;

+

+	*pFrame = pMediaFrame;

+	ZTE_Trace(ZTE_MSM, 0xFF, "[zMspCom_DecodeNextFrame2]: exit");

+    return iRet; /* 0 is suc decode */

+}

+/* uiSeekTime SeekÖ¸¶¨µÄʱ¼ä, µ¥Î»ºÁÃë */

+SINT32 zMspCom_SeekFrame(UINT32 uiMedia, UINT32 uiSeekTime)

+{

+	T_MediaParserAndDecoder *pMedia = (T_MediaParserAndDecoder *) uiMedia;

+

+	if(!pMedia) return -1;

+	

+	pMedia->iDecodedSamples = zMsp_SeekFrame_Wav(pMedia->pFilp, &(pMedia->tMediaInfo), uiSeekTime);

+	 

+	ZTE_Trace(ZTE_MSM, 0xFF, "[zMspCom_SeekFrame]: exit");

+	return 0;

+}

+

+UINT32 zMspCom_OpenMediaParserDecoder(const char *pMediaFile, T_MediaInfo **pMediaInfo)

+{

+	FILE *pInFilp = NULL;

+	const char *pFileType = NULL;

+	T_MediaParserAndDecoder *pMedia = NULL;

+	

+	/* check the input parameters */

+    if(!pMediaFile || !pMediaInfo) return 0;  /* 0 is null */

+

+	if(!(pFileType = strrchr(pMediaFile, '.')))

+    {

+        ZTE_Trace(ZTE_MSM, 0, "[zMspCom_OpenMediaParserDecoder]: file(%s) unknown filetype!!",

+                  pMediaFile);

+        return 0;

+    }

+	

+    if((strncasecmp(pFileType, ".wav", 4) != 0))

+    {

+        ZTE_Trace(ZTE_MSM, 0, "[zMspCom_OpenMediaParserDecoder]: %s(%s) audio no support decoder.", pFileType,pMediaFile);

+        return 0;

+    }

+			

+	 /* open the input media file */

+    if(!(pInFilp = tp_fopen(pMediaFile, "rb")))

+    {

+        ZTE_Trace(ZTE_MSM, 0, "[zMspCom_OpenMediaParserDecoder]: open the input file(%s) failed",

+                  pMediaFile);

+        return 0; /* 0 is null */

+    }

+

+	pMedia = (T_MediaParserAndDecoder *)malloc(sizeof(T_MediaParserAndDecoder));

+	memset(pMedia, 0, sizeof(T_MediaParserAndDecoder));

+	snprintf(pMedia->sFileName, 256, "%s", pMediaFile);

+    /* record(save) input av user ioctx (infilp, buffer, size) */

+    pMedia->pFilp      = pInFilp;

+

+	if(zMsp_OpenInitInput_Wav(pInFilp, &(pMedia->tMediaInfo)) != 0)

+    {

+        ZTE_Trace(ZTE_MSM, 0, "[zMspCom_OpenMediaParserDecoder]: zMsp_OpenInitInput_Wav(%s) fail",

+                  pMediaFile);

+		

+		tp_fclose(pInFilp);

+		free(pMedia);				

+        return 0;

+    }

+

+	pMedia->pMediaFrame = (T_MediaFrame *)malloc(sizeof(T_MediaFrame));

+	if(NULL == pMedia->pMediaFrame) {

+		tp_fclose(pInFilp);

+		free(pMedia);				

+        return 0;

+	}

+

+	*pMediaInfo = &(pMedia->tMediaInfo);

+	

+	return (UINT32) pMedia;

+}

+

+SINT32 zMspCom_CloseMediaParserDecoder(UINT32 uiMedia)

+{

+	T_MediaParserAndDecoder *pMedia = (T_MediaParserAndDecoder *) uiMedia;

+

+    if(!pMedia) return -1;

+	

+	ZTE_Trace(ZTE_MSM, 0, "[zMspCom_CloseMediaParserDecoder]: Try to close media(%p), "

+              "file: %s", pMedia, pMedia->sFileName);

+	

+	if(pMedia->pFilp) 

+		tp_fclose(pMedia->pFilp);

+	if(pMedia->pMediaFrame)

+		free(pMedia->pMediaFrame);	

+

+    free(pMedia);

+	

+	return 0;

+}

+

+VOID zMspCom_UnrefFrame(T_MediaFrame *pFrame)

+{

+    if(!pFrame) return;

+

+    pFrame->pData = NULL;

+    pFrame->iDataSize = 0;

+    pFrame->uFlags = 0;

+}

+

+#endif /*_USE_FFMPEG*/

diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/libmsmsvr/platadapt/msp/src/zmsp_codec_wav.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/libmsmsvr/platadapt/msp/src/zmsp_codec_wav.c
new file mode 100755
index 0000000..f41ddda
--- /dev/null
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/libmsmsvr/platadapt/msp/src/zmsp_codec_wav.c
@@ -0,0 +1,375 @@
+#ifndef _USE_FFMPEG

+#include <stdio.h>

+#include <stdlib.h>

+#include <stdint.h>

+#include <string.h>

+#include <signal.h>

+#include <sys/time.h>

+#include <stddef.h>

+#include <limits.h>

+#include <errno.h>

+

+#include "zmsp_codec.h"

+#include "zmsp_types.h"

+#include "zmsp_com.h"

+

+#define ID_RIFF 0x46464952

+#define ID_WAVE 0x45564157

+#define ID_FMT  0x20746d66

+#define ID_DATA 0x61746164

+

+#define WAVE_FORMAT_PCM		(0x0001) //PCM/·ÇѹËõ¸ñʽ,´ËʱWAVÎļþÖв»°üº¬Fact chunk

+#define WAVE_FORMAT_ADPCM	(0x0002) //Microsoft ADPCM,´ËʱWAVÎļþÖаüº¬Fact chunk

+#define WAVE_FORMAT_FLOAT	(0x0003) //IEEE float,32bit

+#define WAVE_FORMAT_ALAW	(0x0006) //ITU G.711 a-law,´ËʱWAVÎļþÖаüº¬Fact chunk

+#define WAVE_FORMAT_MULAW	(0x0007) //ITU G.711 u-law,´ËʱWAVÎļþÖаüº¬Fact chunk

+

+#define FFALIGN(x, a) (((x)+(a)-1)&~((a)-1))

+

+struct riff_wave_header {

+    uint32_t riff_id;

+    uint32_t riff_sz;

+    uint32_t wave_id;

+};

+

+struct chunk_header {

+    uint32_t id;

+    uint32_t sz;

+};

+

+struct chunk_fmt {

+    uint16_t audio_format;

+    uint16_t num_channels;

+    uint32_t sample_rate;

+    uint32_t byte_rate;

+    uint16_t block_align;

+    uint16_t bits_per_sample;

+};

+

+struct wav_data {

+	uint32_t data_id;

+    uint32_t data_sz;

+};

+

+struct wav_header {

+	struct riff_wave_header st_riff_wave_header;

+    struct chunk_header st_chunk_header;

+    struct chunk_fmt st_chunk_fmt;

+	struct wav_data st_wav_data;

+};

+

+static uint32_t wav_bytes_writed = 0;

+static struct wav_header wav_header_write;

+

+static char *sample_fmt_name[] = {

+	"U8",

+	"S16",

+	"S32",

+	"FLT",

+	"S16P"

+};

+

+extern UINT32 ZTE_Trace(UINT32 nModNo, UINT8 nPrintLevel, const char *pFormat, ...);

+

+static uint16_t zMsp_SampleBit(MSP_AUDIO_SAMPLE_FMT_TYPE_E fmt)

+{

+	if (MSP_AUDIO_SAMPLE_FMT_S32 == fmt) {

+        return 32;

+	}

+    else if (MSP_AUDIO_SAMPLE_FMT_S16 == fmt) {

+        return 16;

+    }

+	else if (MSP_AUDIO_SAMPLE_FMT_U8 == fmt) {

+        return 8;

+    }

+	else {

+		return 16;

+	}

+}

+

+static MSP_AUDIO_SAMPLE_FMT_TYPE_E zMsp_SamplFmtType(uint16_t bits_per_sample)

+{

+	if (bits_per_sample == 32) {

+        //PCM_FORMAT_S32_LE

+        return MSP_AUDIO_SAMPLE_FMT_S32;

+	}

+    else if (bits_per_sample == 16) {

+        //PCM_FORMAT_S16_LE

+        return MSP_AUDIO_SAMPLE_FMT_S16;

+    }

+	else if (bits_per_sample == 8) {

+        return MSP_AUDIO_SAMPLE_FMT_U8;

+    }

+	else {

+		return MSP_AUDIO_SAMPLE_FMT_NONE;

+	}

+}

+

+static int zMsp_SamplesGetBuffer_Size(int nb_channels, int nb_samples,

+                               MSP_AUDIO_SAMPLE_FMT_TYPE_E sample_fmt, int align, int bits)

+{

+    int line_size;	

+    int sample_size = bits >> 3;

+

+    /* validate parameter ranges */

+    if (!sample_size || nb_samples <= 0 || nb_channels <= 0)

+        return -1;

+

+    /* auto-select alignment if not specified */

+    if (!align) {

+        if (nb_samples > INT_MAX - 31)

+            return -1;

+        align = 1;

+        nb_samples = FFALIGN(nb_samples, 32);

+    }

+

+    /* check for integer overflow */

+    if (nb_channels > INT_MAX / align ||

+        (int64_t)nb_channels * nb_samples > (INT_MAX - (align * nb_channels)) / sample_size)

+        return -1;

+

+    line_size = FFALIGN(nb_samples * sample_size * nb_channels, align);

+

+    return line_size;

+}

+

+int zMsp_OpenInitInput_Wav(FILE *file, T_MediaInfo *pmediainfo)

+{

+	struct riff_wave_header st_riff_wave_header;

+    struct chunk_header st_chunk_header;

+    struct chunk_fmt st_chunk_fmt;

+	int more_chunks = 1;

+	unsigned int file_length = 0;

+	int64_t duration = 0;

+

+	if(NULL == file || NULL == pmediainfo) {

+		return -1;

+	}

+	

+	fseek(file,SEEK_SET,SEEK_END);

+    file_length = ftell(file);

+	

+	fseek(file,0,SEEK_SET);	

+	if(0 > fread(&st_riff_wave_header, sizeof(st_riff_wave_header), 1, file)) {

+		ZTE_Trace(ZTE_MSM, 0, "Err:%s fread riff_wave_header fail,errno %d.", __FUNCTION__, errno);

+		return -1;

+	}

+    if ((st_riff_wave_header.riff_id != ID_RIFF) ||

+        (st_riff_wave_header.wave_id != ID_WAVE)) {

+        ZTE_Trace(ZTE_MSM, 0, "Err: It isn't a riff/wave file. riff_id=0x%x wave_id=0x%x \n", 

+			st_riff_wave_header.riff_id, st_riff_wave_header.wave_id);

+        

+        return -1;

+    }

+

+    do {

+        if(0 > fread(&st_chunk_header, sizeof(st_chunk_header), 1, file)) {

+			ZTE_Trace(ZTE_MSM, 0, "Err:%s fread chunk_header fail,errno %d.", __FUNCTION__, errno);

+			return -1;

+        }

+

+        switch (st_chunk_header.id) {

+        case ID_FMT:

+            if(0 > fread(&st_chunk_fmt, sizeof(st_chunk_fmt), 1, file)) {

+				ZTE_Trace(ZTE_MSM, 0, "Err:%s fread chunk_fmt fail,errno %d.", __FUNCTION__, errno);

+				return -1;

+	        }

+            /* If the format header is larger, skip the rest */

+            if (st_chunk_header.sz > sizeof(st_chunk_fmt))

+                fseek(file, st_chunk_header.sz - sizeof(st_chunk_fmt), SEEK_CUR);

+            break;

+        case ID_DATA:

+            /* Stop looking for chunks */

+            more_chunks = 0;

+            break;

+        default:

+            /* Unknown chunk, skip bytes */

+            fseek(file, st_chunk_header.sz, SEEK_CUR);

+        }

+    } while (more_chunks);

+

+	/*Only support PCM format*/

+	if(WAVE_FORMAT_PCM != st_chunk_fmt.audio_format) {

+		ZTE_Trace(ZTE_MSM, 0, "Err:%s audio_format(%d) isn't support.", __FUNCTION__, st_chunk_fmt.audio_format);

+		return -1;

+	}

+	pmediainfo->bVideoPresent = FALSE;

+	pmediainfo->bAudioPresent = TRUE;

+	pmediainfo->eAudioCodecType = AUDIO_CODEC_WAV;

+	pmediainfo->eSamplingRate = zMspCom_ManRate2MspRate(st_chunk_fmt.sample_rate);

+	pmediainfo->uiChannels = st_chunk_fmt.num_channels;

+	pmediainfo->uiAudioBitrate = st_chunk_fmt.byte_rate;

+	/*only s16 and s32*/

+	pmediainfo->eSampleFmt = zMsp_SamplFmtType(st_chunk_fmt.bits_per_sample);

+	if(MSP_AUDIO_SAMPLE_FMT_NONE == pmediainfo->eSampleFmt) {

+		ZTE_Trace(ZTE_MSM, 0, "Err:%s bits_per_sample(%d) isn't support.", __FUNCTION__, st_chunk_fmt.bits_per_sample);

+		return -1;

+	}

+	/* may wave file, use 250ms per frame*/

+	pmediainfo->uiAudioFrameSize = zMsp_SamplesGetBuffer_Size( 

+                          st_chunk_fmt.num_channels, 

+                          ((st_chunk_fmt.sample_rate/1000)*1024)/4, 

+                          pmediainfo->eSampleFmt, 

+                          0, 

+                          st_chunk_fmt.bits_per_sample);

+	

+	duration = (int64_t)file_length * 1000 / (st_chunk_fmt.sample_rate * st_chunk_fmt.num_channels * (st_chunk_fmt.bits_per_sample >> 3));

+	pmediainfo->uiAudioDuration = (UINT32)duration;

+

+	ZTE_Trace(ZTE_MSM, 0, "%s: format(%d) channels(%d) sample_rate(%d) byte_rate(%d) block_align(%d) bits_per_sample(%d)", __FUNCTION__,

+				st_chunk_fmt.audio_format,

+				st_chunk_fmt.num_channels,

+				st_chunk_fmt.sample_rate,

+				st_chunk_fmt.byte_rate,

+				st_chunk_fmt.block_align,

+				st_chunk_fmt.bits_per_sample);

+	

+	ZTE_Trace(ZTE_MSM, 0, "%s: file_length(%u B) eSampleFmt(%s) uiAudioFrameSize(%u B) uiAudioDuration(%u ms)", __FUNCTION__,

+				file_length,

+				sample_fmt_name[pmediainfo->eSampleFmt],

+				pmediainfo->uiAudioFrameSize,

+				pmediainfo->uiAudioDuration);

+	

+	return 0;

+}

+

+int zMsp_ReadNextFrame_Wav(FILE *file, T_MediaInfo *pmediainfo, T_MediaFrame *pFrame)

+{

+	int len;

+	if(NULL == pFrame) {

+		return -1;

+	}	

+	

+	len = fread(pFrame->pData, 1, pFrame->iDataSize, file);

+	if(0 > len) {

+		ZTE_Trace(ZTE_MSM, 0, "Err:%s fread data fail,errno %d.", __FUNCTION__, errno);

+		return -1;

+	}

+	ZTE_Trace(ZTE_MSM, 0xFF, "%s %d %d\n", __FUNCTION__, len, pFrame->iDataSize);

+

+	if(len < pFrame->iDataSize) {

+		pFrame->iDataSize = len;

+		pFrame->uFlags |= MEDIA_LAST_FRAME_FLAG;

+		ZTE_Trace(ZTE_MSM, 0, "%s the file fread end.\n", __FUNCTION__);

+		return 1;

+	}

+

+	return 0;

+}

+

+int zMsp_SeekFrame_Wav(FILE *file, T_MediaInfo *pmediainfo, unsigned int iSeekTs)

+{

+	int64_t seekSize = sizeof(struct wav_header);

+	uint32_t sample_rate;

+	uint16_t bits_per_sample;

+

+	if(0 == iSeekTs) {

+		return 0;

+	}	

+	

+	iSeekTs = iSeekTs < pmediainfo->uiAudioDuration ? iSeekTs : pmediainfo->uiAudioDuration;

+

+	sample_rate = zMspCom_MspRate2ManRate(pmediainfo->eSamplingRate);	

+	bits_per_sample = zMsp_SampleBit(pmediainfo->eSampleFmt);

+	

+	seekSize += (int64_t)((iSeekTs * sample_rate / 1000) * pmediainfo->uiChannels * (bits_per_sample >> 3));

+	seekSize = FFALIGN(seekSize, 8);

+		

+	if(0 != fseek(file, seekSize , SEEK_SET)) {

+		ZTE_Trace(ZTE_MSM, 0, "Err:%s fseek(%ld) fail,errno %d.", __FUNCTION__, seekSize, errno);

+		return 0;

+	}

+	

+	return seekSize;

+}

+

+int zMsp_OpenInitOutput_Wav(FILE *file, T_MediaRecorderParam *pParam)

+{

+	struct wav_header *pheader = &wav_header_write;

+

+	if(NULL == file || NULL == pParam) {

+		return -1;

+	}

+	memset(pheader, 0, sizeof(struct wav_header));

+	pheader->st_riff_wave_header.riff_id = ID_RIFF;

+    pheader->st_riff_wave_header.riff_sz = 0;

+    pheader->st_riff_wave_header.wave_id = ID_WAVE;

+    pheader->st_chunk_header.id = ID_FMT;

+    pheader->st_chunk_header.sz = 16;

+    pheader->st_chunk_fmt.audio_format = WAVE_FORMAT_PCM;

+    pheader->st_chunk_fmt.num_channels = pParam->uiChannels;

+    pheader->st_chunk_fmt.sample_rate = zMspCom_MspRate2ManRate(pParam->eSamplingRate);

+	if(-1 == pheader->st_chunk_fmt.sample_rate) {

+		return -1;

+	}

+

+	pheader->st_chunk_fmt.bits_per_sample = zMsp_SampleBit(pParam->eSampleFmt);

+    pheader->st_chunk_fmt.byte_rate = (pheader->st_chunk_fmt.bits_per_sample / 8) * \

+		pheader->st_chunk_fmt.num_channels * pheader->st_chunk_fmt.sample_rate;

+    pheader->st_chunk_fmt.block_align = pheader->st_chunk_fmt.num_channels * (pheader->st_chunk_fmt.bits_per_sample / 8);

+    pheader->st_wav_data.data_id = ID_DATA;

+	pheader->st_wav_data.data_sz = 0; 

+

+	/* leave enough room for header */

+    fseek(file, sizeof(struct wav_header), SEEK_SET);

+

+	wav_bytes_writed = 0;

+	

+	return 0;

+}

+

+int zMsp_WriteNextFrame_Wav(FILE *file, T_MediaRecorderParam *pParam, unsigned char *pAudioData, int iAudioDataSize)

+{

+	int ret;

+	

+	if(NULL == file || NULL == pParam || !pAudioData || iAudioDataSize <= 0) {

+		return -1;

+	}

+

+	ret = fwrite((void *)pAudioData, 1, iAudioDataSize, file);

+	if (ret != iAudioDataSize) {

+        ZTE_Trace(ZTE_MSM, 0, "Err:%s fwrite data fail(%d - %d),errno %d.", __FUNCTION__, ret, iAudioDataSize, errno);

+        return -1;

+    }

+	wav_bytes_writed += iAudioDataSize;

+	

+	return 0;

+}

+

+int zMsp_WriteEnd_Wav(FILE *file)

+{

+	struct wav_header *pheader = &wav_header_write;

+	unsigned int frames;

+	int ret;

+

+	if(NULL == file) {

+		return -1;

+	}

+	frames = wav_bytes_writed / (pheader->st_chunk_fmt.num_channels * (pheader->st_chunk_fmt.bits_per_sample >> 3));

+	

+	/* write header now all information is known */

+    pheader->st_wav_data.data_sz = frames * pheader->st_chunk_fmt.block_align;

+    pheader->st_riff_wave_header.riff_sz = pheader->st_wav_data.data_sz + sizeof(struct wav_header) - 8;

+

+	fseek(file, 0, SEEK_SET);

+

+	ret = fwrite((void *)pheader, 1, sizeof(struct wav_header), file);

+    if(ret != sizeof(struct wav_header)) {

+		ZTE_Trace(ZTE_MSM, 0, "Err:%s fwrite data fail(%d - %d),errno %d.", __FUNCTION__, ret, sizeof(struct wav_header), errno);

+        return -1;

+    }

+

+	ZTE_Trace(ZTE_MSM, 0, "%s: format(%d) channels(%d) sample_rate(%d) byte_rate(%d) block_align(%d) bits_per_sample(%d)", __FUNCTION__,

+				pheader->st_chunk_fmt.audio_format,

+				pheader->st_chunk_fmt.num_channels,

+				pheader->st_chunk_fmt.sample_rate,

+				pheader->st_chunk_fmt.byte_rate,

+				pheader->st_chunk_fmt.block_align,

+				pheader->st_chunk_fmt.bits_per_sample);

+	ZTE_Trace(ZTE_MSM, 0, "%s: data_sz(%u B) riff_sz(%u B)", __FUNCTION__,

+				pheader->st_wav_data.data_sz,

+				pheader->st_riff_wave_header.riff_sz);

+	

+	return 0;

+}

+#endif

diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/libmsmsvr/platadapt/msp/src/zte_audio.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/libmsmsvr/platadapt/msp/src/zte_audio.c
index 8a45875..f69eb57 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/libmsmsvr/platadapt/msp/src/zte_audio.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/libmsmsvr/platadapt/msp/src/zte_audio.c
@@ -2229,7 +2229,9 @@
     }

     else     // for net codec

     {

+    	#ifdef _USE_FFMPEG

         iRet = net_media_seek_frame(g_AudioControlParam.uiDemuxerDecoder, g_AudioPlayParam.iStartOffset);

+		#endif

         if(iRet != 0)

         {

             return AUDIO_OP_ERROR;

@@ -3551,6 +3553,7 @@
     }

     else     // for net media proc

     {

+    	#ifdef _USE_FFMPEG

         UINT32	msg	= 0;

         zOss_Printf(104, 1, "Audio_ControlThreadEntry zMspCom_OpenMediaParserDecoder(%s) start\n",

                     g_AudioPlayParam.filepath);

@@ -3583,6 +3586,7 @@
         }

         /* ÊÍ·Åͬ²½ÐźÅÁ¿ */

         tp_os_sema_put(g_AudioControlParam.pControlSem);

+		#endif

     }

 

 }

@@ -3602,7 +3606,11 @@
 

         while(0 == ret)

         {

+#ifdef _USE_FFMPEG

             ret = zMspCom_DecodeNextFrame(handle, &frame);

+#else

+			ret = zMspCom_DecodeNextFrame2(handle, &frame, buf, len);

+#endif			

             if(1 == ret)

             {

                 return AUDIO_OP_DATAEND;

@@ -3630,7 +3638,9 @@
 #endif			

 			ZTE_Trace(ZTE_MSM, 0xFF, "[zMsp_DecodeAudioFrame]: %d %d %d",frame->iDataSize, g_AudioFileInfo->uiAudioFrameSize, len);

             size = len < frame->iDataSize ? len : frame->iDataSize;

+#ifdef _USE_FFMPEG			

             memcpy(buf, frame->pData, size);

+#endif

             *usedLen = size;

             *decodeTime = frame->uiPts;

             zMspCom_UnrefFrame(frame);

@@ -3650,6 +3660,7 @@
     }

     else     // for net meida dcode now ... 

     {

+    	#ifdef _USE_FFMPEG

         int ret = 0;

         int size = 0;

         static int emptyFrameNum = 0;

@@ -3713,7 +3724,7 @@
             return ret;

         }

 

-

+		#endif

     }

     return AUDIO_OP_ERROR;

 }

@@ -3744,6 +3755,7 @@
  */

 static void audio_state_info_init(struct audio_state *is, struct codec_info *codecInfo)

 {

+#ifdef _USE_FFMPEG

     is->ic = codecInfo->avFormatCtx;

     is->audio_stream = codecInfo->audioIndex;

     is->audio_duration = codecInfo->audioDurationTotal;

@@ -3768,7 +3780,7 @@
     codecInfo->private = (void*) (is);

     log_debug("get audio state info: ic(%p), audio_stream(%d), audio_duration(%d), audio_st(%p),"

               "packet_num(%d), \n", is->ic, is->audio_stream,is->audio_duration, is->audio_st, (is->audioq).nb_packets);

-

+#endif

 }

 

 

@@ -3807,6 +3819,7 @@
  */

 static VOID Audio_Download_ThreadLoop(VOID)

 {

+#ifdef _USE_FFMPEG 

     int ret = 0;

     AVPacket pkt1, *pkt = &pkt1;

     struct codec_info *codeInfo = NULL;

@@ -3901,6 +3914,7 @@
     tp_os_sema_put(g_AudioControlParam.pDownLoadSem);

     log_debug("audio download thread end ...\n");

     return;

+#endif	

 }

 

 

@@ -3914,6 +3928,7 @@
  */

 static VOID Audio_Download_ThreadEntry(VOID *pParams)

 {

+#ifdef _USE_FFMPEG 

     UINT32 uiMsg = 0;

     SINT32 oflags = 0;

 

@@ -3938,5 +3953,6 @@
         uiMsg = 0;

     }

     return;

+#endif	

 }

 

diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/libmsmsvr/platadapt/msp/src/zte_audio_mutex_cond.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/libmsmsvr/platadapt/msp/src/zte_audio_mutex_cond.c
index e35a6b0..b29f7be 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/libmsmsvr/platadapt/msp/src/zte_audio_mutex_cond.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/libmsmsvr/platadapt/msp/src/zte_audio_mutex_cond.c
@@ -299,7 +299,7 @@
     }

     return iRetVal;

 }

-

+#ifdef _USE_FFMPEG 

 /**

  * @brief: put a packet into queue

  * @param:

@@ -359,7 +359,12 @@
 

     return ret;

 }

-

+#else

+int packet_queue_put(struct packet_queue *q)

+{

+	return 0;

+}

+#endif

 /**

  * @brief: put null packet into queue

  * @param:

@@ -369,6 +374,7 @@
  */

 int packet_queue_put_nullpacket(struct packet_queue *q, int stream_index)

 {

+#ifdef _USE_FFMPEG 

     if(!q)

     {

         softap_assert("queue put param is null \n");

@@ -381,6 +387,9 @@
     pkt->stream_index = stream_index;

 

     return packet_queue_put(q, pkt);

+#else

+	return -1;

+#endif

 }

 

 /**

@@ -395,7 +404,11 @@
     if(!q)

     {

         softap_assert("queue parma is null\n");

+		#ifdef _USE_FFMPEG 

         return AVERROR(EINVAL);

+		#else

+		return EINVAL;

+		#endif

     }

 

     memset(q, 0, sizeof(struct packet_queue));

@@ -403,14 +416,22 @@
     if(!q->mutex)

     {

         log_err("SDL_CreateMutex():\n");

+		#ifdef _USE_FFMPEG 

         return AVERROR(ENOMEM);

+		#else

+		return ENOMEM;

+		#endif

     }

 

     q->cond = audio_create_cond();

     if(!q->cond)

     {

         log_err("SDL_CreateCond():\n");

+		#ifdef _USE_FFMPEG 

         return AVERROR(ENOMEM);

+		#else

+		return ENOMEM;

+		#endif

     }

 

     q->abort_request = 1;

@@ -427,6 +448,7 @@
  */

 void packet_queue_flush(struct packet_queue *q)

 {

+#ifdef _USE_FFMPEG 

     struct av_packet_list *pkt = NULL;

     struct av_packet_list *pkt1 = NULL;

 

@@ -448,6 +470,7 @@
     q->size = 0;

     q->duration = 0;

     audio_mutex_unlock(q->mutex);

+#endif	

 }

 

 /**

@@ -518,6 +541,7 @@
  * @retval:

  * @note: return < 0 if aborted, 0 if no packet and > 0 if packet.

  */

+#ifdef _USE_FFMPEG  

 int packet_queue_get(struct packet_queue *q, AVPacket *pkt, int block, int *serial)

 {

     int ret = 0;

@@ -568,7 +592,12 @@
 

     return ret;

 }

-

+#else

+int packet_queue_get(struct packet_queue *q, int block, int *serial)

+{

+	return -1;

+}

+#endif

 /**

  * @brief: enough packet or not

  * @param:

@@ -576,6 +605,7 @@
  * @retval:

  * @note:

  */

+#ifdef _USE_FFMPEG   

 int stream_has_enough_packets(AVStream *st, int stream_id, struct packet_queue *queue)

 {

     if(!queue)

@@ -585,4 +615,9 @@
     }

     return queue->abort_request || queue->nb_packets > AUDIO_MAX_FRAMES;

 }

-

+#else

+int stream_has_enough_packets(int stream_id, struct packet_queue *queue)

+{

+	return 0;

+}

+#endif

diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/libmsmsvr/platadapt/msp/src/zte_audio_mutex_cond.h b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/libmsmsvr/platadapt/msp/src/zte_audio_mutex_cond.h
index 603627f..f4da44d 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/libmsmsvr/platadapt/msp/src/zte_audio_mutex_cond.h
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/libmsmsvr/platadapt/msp/src/zte_audio_mutex_cond.h
@@ -21,14 +21,16 @@
 #include <unistd.h>

 #include <errno.h>

 #include <pthread.h>

-

+#ifdef _USE_FFMPEG

 #include <libavutil/log.h>

 #include <libavutil/imgutils.h>

 #include <libavutil/samplefmt.h>

 #include <libavutil/timestamp.h>

 #include <libavformat/avformat.h>

 #include <libavcodec/avcodec.h>

-

+#else

+#include <bits/stdint-intn.h>

+#endif

 

 /*******************************************************************************

  *                             Macro definitions                               *

@@ -63,7 +65,9 @@
  * @note:

  */

 struct av_packet_list {

+#ifdef _USE_FFMPEG

     AVPacket pkt;

+#endif

     struct av_packet_list *next;

     int serial;

 };

@@ -84,7 +88,9 @@
     int serial;

     struct audio_cond *cond;

     struct audio_mutex *mutex;

+#ifdef _USE_FFMPEG	

     AVPacket flush_pkt;

+#endif

 };

 

 /**

@@ -98,12 +104,16 @@
  * @param :

  */

 struct audio_state {

+#ifdef _USE_FFMPEG

     AVInputFormat *iformat;

+#endif

     int abort_request;

     int seek_flags;

     int64_t seek_pos;

+#ifdef _USE_FFMPEG	

     AVFormatContext *ic;

     AVStream  *audio_st;

+#endif	

     int audio_stream;

     int audio_duration;

 

@@ -216,8 +226,11 @@
  * @retval:

  * @note:

  */

+#ifdef _USE_FFMPEG 

 int packet_queue_put(struct packet_queue *q, AVPacket *pkt);

-

+#else

+int packet_queue_put(struct packet_queue *q);

+#endif

 /**

  * @brief: put a packet of null  into queue

  * @param:

@@ -278,7 +291,11 @@
  * @retval:

  * @note: return < 0 if aborted, 0 if no packet and > 0 if packet

  */

+#ifdef _USE_FFMPEG 

 int packet_queue_get(struct packet_queue *q, AVPacket *pkt, int block, int *serial);

+#else

+int packet_queue_get(struct packet_queue *q, int block, int *serial);

+#endif

 /**

  * @brief:

  * @param:

@@ -286,7 +303,10 @@
  * @retval:

  * @note:

  */

+#ifdef _USE_FFMPEG 

 int stream_has_enough_packets(AVStream *st, int stream_id, struct packet_queue *queue);

-

+#else

+int stream_has_enough_packets(int stream_id, struct packet_queue *queue);

+#endif

 #endif

 

diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/libmsmsvr/platadapt/msp/src/zte_audiorec.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/libmsmsvr/platadapt/msp/src/zte_audiorec.c
index 56afc76..d390fed 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/libmsmsvr/platadapt/msp/src/zte_audiorec.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/libmsmsvr/platadapt/msp/src/zte_audiorec.c
@@ -348,7 +348,8 @@
 {

     SINT32 iRet = -1;

 

-    if(g_tAudioRecState != AUDIO_REC_STATE_END) {

+    if(g_tAudioRecState != AUDIO_REC_STATE_END &&

+		g_tAudioRecState != AUDIO_REC_STATE_ERROR) {

 		if(DRECORDER_SUCCESS != REC_StopRecord(handle)) {

 	        zMspCom_Print();

 

@@ -467,7 +468,7 @@
     /* ¼ì²éÎļþ±£´æÏß³ÌÊÇ·ñ´¦Àí³ö´í */

     if(g_iRecErrCode != REC_SUCCESS) {

         g_iRecErrCode = REC_SUCCESS;

-

+		g_tAudioRecState = AUDIO_REC_STATE_ERROR;//20240330

         return NULL;

     }

     ZTE_Trace(104, 0, "REC_StartRecord: pGrabThread EV_REC_START_SYN eAudioCodecID");

@@ -482,7 +483,7 @@
     /* ¼ì²éÊý¾Ý²É¼¯Ïß³ÌÊÇ·ñ´¦Àí³ö´í */

     if(g_iRecErrCode != REC_SUCCESS) {

         g_iRecErrCode = REC_SUCCESS;

-

+		g_tAudioRecState = AUDIO_REC_STATE_ERROR;//20240330

         return NULL;

     }

 

@@ -919,8 +920,8 @@
 

         /* 4. ±¾µØÂ¼Òô²ÎÊý: ¼ÒôµÄBUFFER SIZE(²É¼¯Ö¡³¤) */

         SINT32 iRecordBufsize = uiFrameLen << 1; //TODO, S16µ¥ÉùµÀ, S16Ë«ÉùµÀ len<<2

-        if(g_tRecConInfo.eAudioCodecID == AUDIO_CODEC_PCM16K ||

-			g_tRecConInfo.eAudioCodecID == AUDIO_CODEC_WAV) { //202308 for sc_audio

+        if(g_tRecConInfo.eAudioCodecID == AUDIO_CODEC_PCM16K /*||

+			g_tRecConInfo.eAudioCodecID == AUDIO_CODEC_WAV*/) { //202308 for sc_audio

             g_tRecConInfo.uiFrameLen = 320;

             iRecordBufsize = 640;  /* ×Öת»»Îª×Ö½Ú */

             if(tp_fexist(g_tRecordParam.rec_filename))

@@ -1198,6 +1199,9 @@
     g_tRecConInfo.pRecParam->bAudioPresent      = TRUE;

     g_tRecConInfo.pRecParam->eSamplingRate      = eSamplerate;

     //g_tRecConInfo.pRecParam->uiChannels         = 1;

+    if(MSP_AUDIO_CHANNEL_NONE == g_tRecConInfo.pRecParam->uiChannels) {

+		g_tRecConInfo.pRecParam->uiChannels = MSP_AUDIO_CHANNEL_MONO;

+    }

     g_tRecConInfo.pRecParam->eSampleFmt         = MSP_AUDIO_SAMPLE_FMT_S16; /* FIXED */

     g_tRecConInfo.pRecParam->eAudioCodecType    = eMediaAType;

     g_tRecConInfo.pRecParam->pFreeAudioDataFunc = NULL;

@@ -1561,6 +1565,12 @@
     SINT32   iRet         = -1;

     UINT32   uiOutDataLen = 0;     /* ±àÂëºóµÄÊý¾Ý³¤¶È */

 

+	/*·ÇÂ¼ÖÆ×´Ì¬£¬½ûÖ¹²É¼¯Êý¾Ý*/

+	if(AUDIO_REC_STATE_PLAY != g_tAudioRecState) {

+		ZTE_Trace(104, 0, "Rec_DataGrabProcGrabMsg g_tAudioRecState=%d",g_tAudioRecState);

+		return;

+	}

+	

     /* »ñÈ¡±àÂëºóµÄÊý¾Ý */

     iRet = Rec_GrabData(g_tRecConInfo.bRecCc, &pOutData, &uiOutDataLen);

     if(iRet != REC_SUCCESS) {

@@ -1849,8 +1859,8 @@
     }

 

     /* ±àÂë²É¼¯µÄPCMÊý¾Ý²¢Ð´ÈëÎļþ */

-    if(g_tRecConInfo.eAudioCodecID == AUDIO_CODEC_PCM16K ||

-		g_tRecConInfo.eAudioCodecID == AUDIO_CODEC_WAV) { //202308 for sc_audio

+    if(g_tRecConInfo.eAudioCodecID == AUDIO_CODEC_PCM16K /*||

+		g_tRecConInfo.eAudioCodecID == AUDIO_CODEC_WAV*/) { //202308 for sc_audio

 

         if(pcmfp) {

             tp_fwrite(pData, 1, uiDataLen, pcmfp);

diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/libmsmsvr/platadapt/msp/src/zte_net_media_codec.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/libmsmsvr/platadapt/msp/src/zte_net_media_codec.c
index 87b989f..88578ae 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/libmsmsvr/platadapt/msp/src/zte_net_media_codec.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/libmsmsvr/platadapt/msp/src/zte_net_media_codec.c
@@ -14,6 +14,7 @@
 /*******************************************************************************
  *                           Include header files                              *
  ******************************************************************************/
+#ifdef _USE_FFMPEG 
 #include <fcntl.h>
 #include <sys/ioctl.h>
 #include <stdio.h>
@@ -867,5 +868,5 @@
     }
     return ERR_CODE_SUCCESS;
 }
-
+#endif /*_USE_FFMPEG*/
 
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/libmsmsvr/platadapt/msp/src/zte_video.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/libmsmsvr/platadapt/msp/src/zte_video.c
index 1a200ec..3b930ac 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/libmsmsvr/platadapt/msp/src/zte_video.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/libmsmsvr/platadapt/msp/src/zte_video.c
@@ -36,12 +36,6 @@
 

 #include "zte_audio_public.h"

 

-#include "libavutil/imgutils.h"

-#include "libavutil/samplefmt.h"

-#include "libavutil/timestamp.h"

-#include "libavformat/avformat.h"

-#include "libavutil/error.h"

-

 #include "video_scale.h"

 #include "zmsp_codec.h"

 #include "msm_os_mem.h"

@@ -58,6 +52,13 @@
 

 #include "softap_api.h"

 

+#ifdef _USE_FFMPEG

+#include "libavutil/imgutils.h"

+#include "libavutil/samplefmt.h"

+#include "libavutil/timestamp.h"

+#include "libavformat/avformat.h"

+#include "libavutil/error.h"

+

 //#include "tlsf.h"

 //#pragma GCC push_options

 //#pragma GCC optimize ("O0")

@@ -7365,4 +7366,18 @@
 {

     return  g_VideoAudioPlayParam.bMute;

 }

+#else /*_USE_FFMPEG*/

+SINT32   zxvideo_SetMute(BOOL mute)

+{

+	return 0;

+}

+BOOL   zxVideo_GetMute()

+{

+	return TRUE;

+}

+SINT32   zxvideo_SetVol(MSP_AUDIO_PLAY_VOL_TYPE_E vol)

+{

+	return 0;

+}

 

+#endif /*_USE_FFMPEG*/

diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/libmsmsvr/platadapt/osa/misc_if.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/libmsmsvr/platadapt/osa/misc_if.c
index 6f46feb..74cfe42 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/libmsmsvr/platadapt/osa/misc_if.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/libmsmsvr/platadapt/osa/misc_if.c
@@ -109,7 +109,7 @@
 	vsnprintf(log_buf, 255, pFormat, arg);

 	va_end(arg);

 

-	printf("%s\n",log_buf);

+	printf("[libmsmsvr] %s\n",log_buf);

 

 	return 0;

 }

diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/libsoftap/audio_res_request_api.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/libsoftap/audio_res_request_api.c
index 5323e90..85757ac 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/libsoftap/audio_res_request_api.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/libsoftap/audio_res_request_api.c
@@ -326,6 +326,8 @@
 		goto exit;
 	}
 
+	pthread_detach(paudiores->threadid);
+	
 	handle = (long)paudiores;
 	slog(AUDIO_CTRL, SLOG_NORMAL, "audiores_req_and_listen: type(%d)\n ", type);
 	return handle;
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/libtelsvr/include/zbl_ati_cc_msg.h b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/libtelsvr/include/zbl_ati_cc_msg.h
index 3177aca..5201333 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/libtelsvr/include/zbl_ati_cc_msg.h
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/libtelsvr/include/zbl_ati_cc_msg.h
@@ -100,6 +100,7 @@
 #define ATI_CC_ZECALLTIMER_REQ             (MSG_ID_PSA_AT_SS_BASE + 0x4D)

 #define ATI_CC_ZECALLTIMER_CNF             (MSG_ID_PSA_AT_SS_BASE + 0x4E)

 

+#define ATI_CC_ZT10DEREG_IND             (MSG_ID_PSA_AT_SS_BASE + 0x4F)

 

 /**************************************************************************

  *                         Êý¾ÝÀàÐÍ                                       *

diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/libvoice/include/voice_ipc.h b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/libvoice/include/voice_ipc.h
index b88249c..43d9795 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/libvoice/include/voice_ipc.h
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/libvoice/include/voice_ipc.h
@@ -31,12 +31,17 @@
     IPC_CAP_ALSA_VOICE_OPEN = 14,

     IPC_CAP_ALSA_VOICE_CLOSE = 15,

     IPC_UPDATE_VOICE_NVRW = 16,

+    IPC_SET_RX_VOICE_VOL_GAIN = 17,

+    IPC_GET_RX_VOICE_VOL_GAIN = 18,

+    IPC_SET_TX_VOICE_VOL_GAIN = 19,

+    IPC_GET_TX_VOICE_VOL_GAIN = 20,

 

     IPC_VOICE_FUNC_MAX

 };

 

+//0x90D0~0x90FF, 48

 enum  voice_msg_cmd{

-    MSG_CMD_SET_VOICE_DEVICE_MODE = MSG_CMD_VOICE_BASE + 0x0, //37070

+    MSG_CMD_SET_VOICE_DEVICE_MODE = MSG_CMD_VOICE_BASE + 0x0,

     MSG_CMD_GET_VOICE_DEVICE_MODE,

     MSG_CMD_SET_RX_VOICE_VOL,

     MSG_CMD_GET_RX_VOICE_VOL,

@@ -49,7 +54,11 @@
     MSG_CMD_SET_LOOPBACK_ENABLE_STATE,

     MSG_CMD_GET_LOOPBACK_ENABLE_STATE,

     MSG_CMD_AP_ALSA_VOICE_OPEN,

-    MSG_CMD_AP_ALSA_VOICE_CLOSE

+    MSG_CMD_AP_ALSA_VOICE_CLOSE,

+    MSG_CMD_SET_RX_VOICE_VOL_GAIN,

+    MSG_CMD_GET_RX_VOICE_VOL_GAIN,

+    MSG_CMD_SET_TX_VOICE_VOL_GAIN,

+    MSG_CMD_GET_TX_VOICE_VOL_GAIN

 };

 

 typedef struct{

@@ -64,6 +73,10 @@
 int msg_get_voice_device_mode(void);

 int msg_set_rx_voice_vol(int vol);

 int msg_get_rx_voice_vol(void);

+int msg_set_rx_voice_vol_gain(int gain);

+int msg_get_rx_voice_vol_gain(void);

+int msg_set_tx_voice_vol_gain(int gain);

+int msg_get_tx_voice_vol_gain(void);

 int msg_set_tx_voice_vol(int vol);

 int msg_get_tx_voice_vol(void);

 int msg_set_tx_voice_mute_state(int mute);

@@ -89,6 +102,10 @@
 int ipc_get_voice_device_mode(int *p_dev_mode);

 int ipc_set_rx_voice_vol(int vol);

 int ipc_get_rx_voice_vol(int *p_vol);

+int ipc_set_rx_voice_vol_gain(int gain);

+int ipc_get_rx_voice_vol_gain(int *p_gain);

+int ipc_set_tx_voice_vol_gain(int gain);

+int ipc_get_tx_voice_vol_gain(int *p_gain);

 int ipc_set_tx_voice_vol(int vol);

 int ipc_get_tx_voice_vol(int *p_vol);

 int ipc_set_tx_voice_mute_state(int mute);

diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/libvoice/voice_ipc.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/libvoice/voice_ipc.c
index 03a9350..95fcd3d 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/libvoice/voice_ipc.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/libvoice/voice_ipc.c
@@ -168,6 +168,52 @@
     return ret;

 }

 

+int msg_set_rx_voice_vol_gain(int gain)

+{

+    int ret = 0;

+    int module_id = MODULE_ID_VOICE_CLIENT;

+    int dst_id = MODULE_ID_VOICE_SERVER;

+    int msg_cmd = MSG_CMD_SET_RX_VOICE_VOL_GAIN;

+    ret = msg_send_and_recv(module_id, dst_id, msg_cmd, &gain);

+

+    return ret;

+}

+

+int msg_get_rx_voice_vol_gain(void)

+{

+    int ret = 0;

+    int module_id = MODULE_ID_VOICE_CLIENT;

+    int dst_id = MODULE_ID_VOICE_SERVER;

+    int msg_cmd = MSG_CMD_GET_RX_VOICE_VOL_GAIN;

+

+    ret = msg_send_and_recv(module_id, dst_id, msg_cmd, NULL);

+

+    return ret;

+}

+

+int msg_set_tx_voice_vol_gain(int gain)

+{

+    int ret = 0;

+    int module_id = MODULE_ID_VOICE_CLIENT;

+    int dst_id = MODULE_ID_VOICE_SERVER;

+    int msg_cmd = MSG_CMD_SET_TX_VOICE_VOL_GAIN;

+    ret = msg_send_and_recv(module_id, dst_id, msg_cmd, &gain);

+

+    return ret;

+}

+

+int msg_get_tx_voice_vol_gain(void)

+{

+    int ret = 0;

+    int module_id = MODULE_ID_VOICE_CLIENT;

+    int dst_id = MODULE_ID_VOICE_SERVER;

+    int msg_cmd = MSG_CMD_GET_TX_VOICE_VOL_GAIN;

+

+    ret = msg_send_and_recv(module_id, dst_id, msg_cmd, NULL);

+

+    return ret;

+}

+

 int msg_set_tx_voice_vol(int vol)

 {

     int ret = 0;

@@ -398,6 +444,102 @@
     return ret;

 }

 

+int ipc_set_rx_voice_vol_gain(int gain)

+{

+    int ret = 0;

+    int func_id = IPC_SET_RX_VOICE_VOL_GAIN;

+    voice_ctrl_recvmsg[func_id].func_id = VOICE_WAIT_MSG_FROM_AP;

+    

+    ret = Voice_Ctrl_Rpmsg_Send(func_id, &gain);

+    

+    if (0 >= ret){

+		printf("%s: Voice_Ctrl_Rpmsg_Send error, return %d!\n", __func__, ret);

+		return VOICEIPC_ERROR;

+	}

+    printf("%s: Voice_Ctrl_Rpmsg_Send success, write_len=%d!\n", __func__, ret);

+

+    while(func_id != voice_ctrl_recvmsg[func_id].func_id){

+        usleep(1);

+    }

+

+    memcpy(&ret, voice_ctrl_recvmsg[func_id].param, voice_ctrl_recvmsg[func_id].param_len);

+    printf("%s: ipc receive success, ret=%d!\n", __func__, ret);

+

+    return ret;

+}

+

+int ipc_get_rx_voice_vol_gain(int *p_gain)

+{

+    int ret = 0;

+    int func_id = IPC_GET_RX_VOICE_VOL_GAIN;

+    voice_ctrl_recvmsg[func_id].func_id = VOICE_WAIT_MSG_FROM_AP;

+    

+    ret = Voice_Ctrl_Rpmsg_Send(func_id, p_gain);

+    

+    if (0 >= ret){

+		printf("%s: Voice_Ctrl_Rpmsg_Send error, return %d!\n", __func__, ret);

+		return VOICEIPC_ERROR;

+	}

+    printf("%s: Voice_Ctrl_Rpmsg_Send success, write_len=%d!\n", __func__, ret);

+

+    while(func_id != voice_ctrl_recvmsg[func_id].func_id){

+        usleep(1);

+    }

+

+    memcpy(&ret, voice_ctrl_recvmsg[func_id].param, voice_ctrl_recvmsg[func_id].param_len);

+    printf("%s: ipc receive success, ret=%d!\n", __func__, ret);

+

+    return ret;

+}

+

+int ipc_set_tx_voice_vol_gain(int gain)

+{

+    int ret = 0;

+    int func_id = IPC_SET_TX_VOICE_VOL_GAIN;

+    voice_ctrl_recvmsg[func_id].func_id = VOICE_WAIT_MSG_FROM_AP;

+    

+    ret = Voice_Ctrl_Rpmsg_Send(func_id, &gain);

+    

+    if (0 >= ret){

+		printf("%s: Voice_Ctrl_Rpmsg_Send error, return %d!\n", __func__, ret);

+		return VOICEIPC_ERROR;

+	}

+    printf("%s: Voice_Ctrl_Rpmsg_Send success, write_len=%d!\n", __func__, ret);

+

+    while(func_id != voice_ctrl_recvmsg[func_id].func_id){

+        usleep(1);

+    }

+

+    memcpy(&ret, voice_ctrl_recvmsg[func_id].param, voice_ctrl_recvmsg[func_id].param_len);

+    printf("%s: ipc receive success, ret=%d!\n", __func__, ret);

+

+    return ret;

+}

+

+int ipc_get_tx_voice_vol_gain(int *p_gain)

+{

+    int ret = 0;

+    int func_id = IPC_GET_TX_VOICE_VOL_GAIN;

+    voice_ctrl_recvmsg[func_id].func_id = VOICE_WAIT_MSG_FROM_AP;

+    

+    ret = Voice_Ctrl_Rpmsg_Send(func_id, p_gain);

+    

+    if (0 >= ret){

+		printf("%s: Voice_Ctrl_Rpmsg_Send error, return %d!\n", __func__, ret);

+		return VOICEIPC_ERROR;

+	}

+    printf("%s: Voice_Ctrl_Rpmsg_Send success, write_len=%d!\n", __func__, ret);

+

+    while(func_id != voice_ctrl_recvmsg[func_id].func_id){

+        usleep(1);

+    }

+

+    memcpy(&ret, voice_ctrl_recvmsg[func_id].param, voice_ctrl_recvmsg[func_id].param_len);

+    printf("%s: ipc receive success, ret=%d!\n", __func__, ret);

+

+    return ret;

+}

+

 int ipc_set_tx_voice_vol(int vol)

 {

     int ret = 0;

diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/msm_svr/Makefile b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/msm_svr/Makefile
index f90f4c6..c9f5223 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/msm_svr/Makefile
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/msm_svr/Makefile
@@ -27,6 +27,7 @@
 LDLIBS += -lmsmsvr -L$(zte_lib_path)/libmsmsvr/lib/libmsmsvr.a
 LDLIBS += -lmedia -L$(zte_lib_path)/libmedia
 
+ifeq ($(CONFIG_MSMSVR_CODEC_TYPE), FFMPEG)
 LDLIBS += -lavcodec
 LDLIBS += -lavformat
 LDLIBS += -lavutil
@@ -34,6 +35,7 @@
 LDLIBS += -lopencore-amrwb
 LDLIBS += -lvo-amrwbenc
 LDLIBS += -lfdk-aac
+endif
 ##############USER COMIZE END##################
 
 #*******************************************************************************
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/msm_svr/audio/msm_audio.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/msm_svr/audio/msm_audio.c
index b828206..9377293 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/msm_svr/audio/msm_audio.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/msm_svr/audio/msm_audio.c
@@ -92,10 +92,29 @@
 	if(NULL == pmsmaudio_ctx || 

 		0 == pmsmaudio_ctx->audiochn_count ||

 		AUDIORES_HANDLE_BAD == pmsmaudio_ctx->audiores_handle) {

+		if(NULL != pmsmaudio_ctx) {

+			slog(MSMSVR_PRINT, SLOG_NORMAL, "audiochn_count=%d handle=0x%x\n", pmsmaudio_ctx->audiochn_count, pmsmaudio_ctx->audiores_handle);

+			if(REL_AUDIO_REQ == msgtype) {		

+				audiores_release(pmsmaudio_ctx->audiores_handle);

+			}

+			else if(IDLE_AUDIO_INFO == msgtype) {

+				audiores_request(pmsmaudio_ctx->audiores_handle);

+			}

+		}

+		else {

+			slog(MSMSVR_PRINT, SLOG_NORMAL, "pmsmaudio_ctx is NULL.\n");

+		}

 		return 0;

 	}

 

 	if(!audiochn_valid_check(pmsmaudio_ctx)) {

+		slog(MSMSVR_PRINT, SLOG_DEBUG, "audiochn_valid_check return FALSE!!!\n");

+		if(REL_AUDIO_REQ == msgtype) {		

+			audiores_release(pmsmaudio_ctx->audiores_handle);

+		}

+		else if(IDLE_AUDIO_INFO == msgtype) {

+			audiores_request(pmsmaudio_ctx->audiores_handle);

+		}

 		return 0;

 	}

 	

diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/msm_svr/audio/msm_audio_capture.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/msm_svr/audio/msm_audio_capture.c
index 2a43c25..c1445b3 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/msm_svr/audio/msm_audio_capture.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/msm_svr/audio/msm_audio_capture.c
@@ -29,10 +29,13 @@
 	}

 		

 	if(NULL != pfiletype &&

-		(strstr(pfiletype, ".pcm") ||

-		strstr(pfiletype, ".wav") ||

-		strstr(pfiletype, ".amr") ||

-		strstr(pfiletype, ".aac"))) {

+		(strstr(pfiletype, ".pcm")

+		|| strstr(pfiletype, ".wav") 

+#ifdef _USE_FFMPEG			

+		|| strstr(pfiletype, ".amr") 

+		|| strstr(pfiletype, ".aac")

+#endif		

+		)) {

 		return TRUE;

 	}

 

@@ -46,11 +49,12 @@
 			return MM_AUDIO_FILE_TYPE_PCM;

 		case SCAUDIO_STREAM_FORMAT_WAV:

 			return MM_AUDIO_FILE_TYPE_WAV;

+#ifdef _USE_FFMPEG			

 		case SCAUDIO_STREAM_FORMAT_AMR:

 		case SCAUDIO_STREAM_FORMAT_AMRNB:

 		case SCAUDIO_STREAM_FORMAT_AMRWB:

 			return MM_AUDIO_FILE_TYPE_AMR;

-		

+#endif		

 		default:

 			return MM_AUDIO_FILE_TYPE_UNKNOWN;

 	}

diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/msm_svr/audio/msm_audio_playback.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/msm_svr/audio/msm_audio_playback.c
index 28a33e1..59a47f9 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/msm_svr/audio/msm_audio_playback.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/msm_svr/audio/msm_audio_playback.c
@@ -29,11 +29,14 @@
 	}

 		

 	if(NULL != pfiletype &&

-		(strstr(pfiletype, "pcm") ||

-		strstr(pfiletype, "wav") ||

-		strstr(pfiletype, "amr") ||

-		strstr(pfiletype, "aac") ||

-		strstr(pfiletype, "mp3"))) {

+		(strstr(pfiletype, "pcm")

+		|| strstr(pfiletype, "wav")

+#ifdef _USE_FFMPEG

+		|| strstr(pfiletype, "amr")

+		|| strstr(pfiletype, "aac")

+		|| strstr(pfiletype, "mp3")

+#endif		

+		)) {

 		return TRUE;

 	}

 

@@ -585,7 +588,7 @@
 		goto exit;

 	}

 

-	if(MM_RET_SUCCESS != svrcall_mm_volume_set(pcontrl_info->audiohandle, MM_VOLUME_LEVEL5)) {

+	if(MM_RET_SUCCESS != svrcall_mm_volume_set(pcontrl_info->audiohandle, MM_VOLUME_LEVEL2)) {

 		slog(MSMSVR_PRINT, SLOG_ERR, "msm_audio_playback_play_request svrcall_mm_volume_set fail!\n");

 	}

 

diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/nv-rpc-daemon/main.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/nv-rpc-daemon/main.c
index 451abfd..eaf4468 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/nv-rpc-daemon/main.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/nv-rpc-daemon/main.c
@@ -49,7 +49,7 @@
  *                                   ºê¶¨Òå                                     *
  *******************************************************************************/
 #define RPC_RPMSG_DEV "/dev/armps_rpmsgch8"
-#define RPC_DAEMON_PRIORITY   50
+#define RPC_DAEMON_PRIORITY   30
 
 /*******************************************************************************
  *                                Êý¾ÝÀàÐͶ¨Òå                                  *
@@ -68,7 +68,7 @@
  *******************************************************************************/
 static long g_pid;
 static long g_ap_pid_backup;
-static int  nv_debug_switch = true;//jb.qi add for nv wakeup debug on 20231220
+static int  nv_debug_switch = false;
 
 /*******************************************************************************
  *                                ¾Ö²¿º¯ÊýʵÏÖ                                  *
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/nvserver/nvserver.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/nvserver/nvserver.c
index 0773483..dddd8d9 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/nvserver/nvserver.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/nvserver/nvserver.c
@@ -51,7 +51,7 @@
 /*******************************************************************************
 *                                   ºê¶¨Òå                                     *
 *******************************************************************************/
-#define NVSERVER_DAEMON_PRIORITY  51
+#define NVSERVER_DAEMON_PRIORITY  31
 #define DATA_SAVE_MTD_NAME   "capuserdata"
 
 /*******************************************************************************
@@ -265,7 +265,6 @@
 
 //    prctl(PR_SET_NAME, "nvserver", 0, 0, 0);
     wake_nvserver_lock();
-    nvserver_set_priority();
 
     memset( &rcvBuf, 0, sizeof(rcvBuf));
     memset( &sndBuf, 0, sizeof(sndBuf));
@@ -297,6 +296,7 @@
     
     nvInit();
     sd_notify(0, "READY=1");
+    nvserver_set_priority();
     // ÏûÏ¢½»»¥
     while(1)
     {
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/voiceipc_mainctrl/voiceipc_mainctrl.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/voiceipc_mainctrl/voiceipc_mainctrl.c
index e7a0910..8ca4e70 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/voiceipc_mainctrl/voiceipc_mainctrl.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/voiceipc_mainctrl/voiceipc_mainctrl.c
@@ -165,7 +165,41 @@
                 printf("%s: send message error(%d)!\n", __func__, ret);

             }

 			break;

-        default:

+        case MSG_CMD_SET_RX_VOICE_VOL_GAIN:

+            p_value = (int *)msg.aucDataBuf;

+            ret = ipc_set_rx_voice_vol_gain(*p_value);

+            //dst_id = MODULE_ID_SET_RX_VOICE_VOL;

+            ret = ipc_send_message(module_id, dst_id, msg.usMsgCmd, sizeof(int), (unsigned char *)(&ret), 0);

+            if(0 != ret){

+                printf("%s: send message error(%d)!\n", __func__, ret);

+            }

+			break;

+        case MSG_CMD_GET_RX_VOICE_VOL_GAIN:

+            ret = ipc_get_rx_voice_vol_gain(p_value);

+            //dst_id = MODULE_ID_GET_RX_VOICE_VOL;

+            ret = ipc_send_message(module_id, dst_id, msg.usMsgCmd, sizeof(int), (unsigned char *)(&ret), 0);

+            if(0 != ret){

+                printf("%s: send message error(%d)!\n", __func__, ret);

+            }

+		break;

+        case MSG_CMD_SET_TX_VOICE_VOL_GAIN:

+            p_value = (int *)msg.aucDataBuf;

+            ret = ipc_set_tx_voice_vol_gain(*p_value);

+            //dst_id = MODULE_ID_SET_RX_VOICE_VOL;

+            ret = ipc_send_message(module_id, dst_id, msg.usMsgCmd, sizeof(int), (unsigned char *)(&ret), 0);

+            if(0 != ret){

+                printf("%s: send message error(%d)!\n", __func__, ret);

+            }

+			break;

+        case MSG_CMD_GET_TX_VOICE_VOL_GAIN:

+            ret = ipc_get_tx_voice_vol_gain(p_value);

+            //dst_id = MODULE_ID_GET_RX_VOICE_VOL;

+            ret = ipc_send_message(module_id, dst_id, msg.usMsgCmd, sizeof(int), (unsigned char *)(&ret), 0);

+            if(0 != ret){

+                printf("%s: send message error(%d)!\n", __func__, ret);

+            }

+		break;

+    default:

             ret = -1;

             ret = ipc_send_message(module_id, dst_id, msg.usMsgCmd, sizeof(int), (unsigned char *)(&ret), 0);

             if(0 != ret){

diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/wlan_proxy/wlan_proxy.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/wlan_proxy/wlan_proxy.c
index 438d531..45cba58 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/wlan_proxy/wlan_proxy.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/wlan_proxy/wlan_proxy.c
@@ -290,6 +290,13 @@
 		slog(WIFI_PRINT, SLOG_ERR, "wifi ipcmsg no memory!\n");
 		return NULL;
 	}
+	
+	if (g_support_5g != 1 && pdata_info->work_mode == IN_WIFI_WORK_MODE_AP1) {
+		slog(WIFI_PRINT, SLOG_ERR, "not support 5g band!\n");
+		comm_res.result = SC_ERR_NOT_SUPPORT;
+		wifi_ipcmsg_set(pmsg->fd_cli, pmsg->msg_rsp, (void *)&comm_res, sizeof(comm_res), pmsg_rsp);
+		return pmsg_rsp;
+	}
 
 	if (g_ap_enable == SC_WIFI_ENABLE) {
 		slog(WIFI_PRINT, SLOG_ERR, "cant set at ap runtime!\n");
@@ -691,6 +698,7 @@
 	data_res.result = SC_ERR_SUCCESS;
 	data_res.status = g_wifi_ap_status[idx].status;
 	strncpy(data_res.ifname, g_wifi_ap_status[idx].ifname, sizeof(data_res.ifname) - 1);
+	strncpy(data_res.bssid, g_wifi_ap_status[idx].bssid, sizeof(data_res.bssid) - 1);
 
 	wifi_ipcmsg_set(pmsg->fd_cli, pmsg->msg_rsp, (void *)&data_res, sizeof(data_res), pmsg_rsp);
 
@@ -1217,6 +1225,7 @@
 	wlan_ap_status_t *ap_status = (wlan_ap_status_t *)pmsg->aucDataBuf;
 	sc_ipc_msg *pmsg_ind = NULL;
 	int idx = ap_status->idx;
+	char wifi_mac[18] = {0};
 
 	if (idx <= IN_WIFI_AP_INDEX_MIN || idx >= IN_WIFI_AP_INDEX_MAX) {
 		slog(WIFI_PRINT, SLOG_ERR, "wifi_ap_status_ind error idx:%d.\n", idx);
@@ -1228,6 +1237,9 @@
 	g_wifi_ap_status[idx].status = ap_status->status;
 	strncpy(g_wifi_ap_status[idx].ifname, ap_status->ifname, sizeof(g_wifi_ap_status[idx].ifname) - 1);
 	
+	sc_cfg_get ("wifi_mac", wifi_mac, sizeof(wifi_mac));
+	strncpy(g_wifi_ap_status[idx].bssid, wifi_mac, sizeof(wifi_mac) - 1);
+	
 	if (list_empty(&cli_msgkey_list)) {
 		slog(WIFI_PRINT, SLOG_ERR, "wifi_ap_status_ind no client.\n");
 		return NULL;
@@ -1239,7 +1251,7 @@
 		return NULL;
 	}
 	slog(WIFI_PRINT, SLOG_ERR, "wifi_ap_enable_status_ind %d, %s, %d\n", ap_status->idx, ap_status->ifname, ap_status->status);
-	wifi_ipcmsg_set(0, SCWIFI_CMD_AP_STATUS_IND, (void *)ap_status, sizeof(wlan_ap_status_t), pmsg_ind);
+	wifi_ipcmsg_set(0, SCWIFI_CMD_AP_STATUS_IND, (void *)&g_wifi_ap_status[idx], sizeof(wlan_ap_status_t), pmsg_ind);
 
 	return pmsg_ind;
 }
@@ -1325,8 +1337,9 @@
 	slog(WIFI_PRINT, SLOG_ERR, "scan_result:%d\n", status->cnt);
 	if (status->cnt > 0) {
 		for (i = 0; i < status->cnt; i++) {
-			slog(WIFI_PRINT, SLOG_ERR, "ap[%d]:%s,%d,%d,%d,%s,%d\n", i, status->info[i].essid, status->info[i].auth, 
-				status->info[i].cipher, status->info[i].channel, status->info[i].bssid, status->info[i].signal_level);
+			slog(WIFI_PRINT, SLOG_ERR, "ap[%d]:%s,%d,%d,%d,%s,%d,%d\n", i, status->info[i].essid, status->info[i].auth, 
+				status->info[i].cipher, status->info[i].channel, status->info[i].bssid, status->info[i].signal_level, 
+				status->info[i].signal);
 		}
 	}
 	
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/zxic_debug/zxic_debug.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/zxic_debug/zxic_debug.c
index a6907a6..c1ce4cd 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/zxic_debug/zxic_debug.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/zxic_debug/zxic_debug.c
@@ -412,9 +412,9 @@
 	if(strlen(file_size_total))
 	{
 		g_file_size_total = atoi(file_size_total) * DEBUG_INFO_DEFAULT_TOTAL_FILE_SIZE;
-		if(g_file_size_total > DEBUG_INFO_DEFAULT_TOTAL_FILE_SIZE)
+		if(g_file_size_total > DEBUG_INFO_TOTAL_FILE_SIZE_MAX)
 		{
-			g_file_size_total = DEBUG_INFO_DEFAULT_TOTAL_FILE_SIZE;
+			g_file_size_total = DEBUG_INFO_TOTAL_FILE_SIZE_MAX;
 		}
 	}
 
@@ -630,6 +630,7 @@
 			// 回绕到另一个文件,从头开始读
 			index = 0;
 			printf("[zxic_debug]: save to next file %s begin...\n", g_save_file_path[file_id]);
+			tab_data.index = index;
 		}
 		else if (index < 0)
 		{
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/libbsp/sc_eth.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/libbsp/sc_eth.c
index 1038b49..15c9e8c 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/libbsp/sc_eth.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/libbsp/sc_eth.c
@@ -154,7 +154,7 @@
         info->link = SC_ETH_LINK_UP;

         

 

-	return 0;

+    return 0;

 }

 

 int sc_eth_enable(void)

@@ -162,6 +162,7 @@
 //    printf("[%s]\n", __func__);

     struct ifreq ifr;

     int fd = -1;

+    int ret = 0;

 

     memset(&ifr, 0x00, sizeof(struct ifreq));

     strcpy(ifr.ifr_name, "eth0");

@@ -172,7 +173,9 @@
         return -1;

     }

 

-    return ioctl(fd, SIOCENABLEPHY, &ifr);

+    ret = ioctl(fd, SIOCENABLEPHY, &ifr);

+    close(fd);

+    return ret;

 

 }

 

@@ -181,6 +184,7 @@
 //    printf("[%s]\n", __func__);

     struct ifreq ifr;

     int fd = -1;

+    int ret = 0;

 

     memset(&ifr, 0x00, sizeof(struct ifreq));

     strcpy(ifr.ifr_name, "eth0");

@@ -191,7 +195,9 @@
         return -1;

     }

 

-    return ioctl(fd, SIOCDISABLEPHY, &ifr);

+    ret = ioctl(fd, SIOCDISABLEPHY, &ifr);

+    close(fd);

+    return ret;

 }

 

 int sc_eth_autoneg_set(E_ETH_AUTONEG autoneg)

@@ -216,6 +222,7 @@
 	link_usettings = do_ioctl_glinksettings(&ctx);

 	if (link_usettings == NULL) {

 		printf("cannot get device gettings\n");

+                close(ctx.fd);

 		return -1;

 	}

 

@@ -229,6 +236,7 @@
 	free(link_usettings);

     if (ret < 0)

 		printf("set new settings failed\n");

+        close(ctx.fd);

 	return 0;

 }

 

@@ -256,17 +264,21 @@
     }

 	link_usettings = do_ioctl_glinksettings(&ctx);

 	if (link_usettings == NULL) {

+                close(ctx.fd);

 		printf("cannot get device gettings\n");

 		return -1;

 	}

 

 	ret = dump_link_usettings(link_usettings, &info);

 	free(link_usettings);

-	if (ret)

+	if (ret) {

+                close(ctx.fd);

 		return ret;

+        }

 

 	memcpy(autoneg, &info.autoneg, sizeof(E_ETH_AUTONEG));

 

+    close(ctx.fd);

     return 0;

 }

 

@@ -292,6 +304,7 @@
 	link_usettings = do_ioctl_glinksettings(&ctx);

 	if (link_usettings == NULL) {

 		printf("cannot get device gettings\n");

+                close(ctx.fd);

 		return -1;

 	}

     

@@ -310,6 +323,7 @@
 	free(link_usettings);

     if (ret < 0)

 		printf("set new settings failed\n");

+        close(ctx.fd);

 	return 0;

 

 }

@@ -339,6 +353,7 @@
     }

 	link_usettings = do_ioctl_glinksettings(&ctx);

 	if (link_usettings == NULL) {

+                close(ctx.fd);

 		printf("cannot get device gettings\n");

 		return -1;

 	}

@@ -347,11 +362,14 @@
 

 	ret = dump_link_usettings(link_usettings, &info);

 	free(link_usettings);

-	if (ret)

+	if (ret) {

+                close(ctx.fd);

 		return ret;

+        }

 

 

 	memcpy(speed, &info.speed, sizeof(E_ETH_SPEED));

+        close(ctx.fd);

 

 //    printf("[%s] exit:speed = %d\n", __func__, *speed);

 

@@ -379,6 +397,7 @@
     }

 	link_usettings = do_ioctl_glinksettings(&ctx);

 	if (link_usettings == NULL) {

+                close(ctx.fd);

 		printf("cannot get device gettings\n");

 		return -1;

 	}

@@ -391,8 +410,10 @@
 		printf("cannot set new settings\n");

 

 	free(link_usettings);

-    if (ret < 0)

+    if (ret < 0) 

 		printf("set new settings failed\n");

+

+        close(ctx.fd);

 	return 0;

 }

 

@@ -421,18 +442,22 @@
     }

 	link_usettings = do_ioctl_glinksettings(&ctx);

 	if (link_usettings == NULL) {

+                close(ctx.fd);

 		printf("cannot get device gettings\n");

 		return -1;

 	}

 

 	ret = dump_link_usettings(link_usettings, &info);

 	free(link_usettings);

-	if (ret)

-		return ret;

+	if (ret) {

+            close(ctx.fd);

+	    return ret;

+        }

 

 

 	memcpy(duplex, &info.duplex, sizeof(E_ETH_DUPLEX));

 

+    close(ctx.fd);

     return 0;

 }

 

@@ -510,6 +535,7 @@
 	    get_dev_fields(s, ife);

 	    break;

     }

+    fclose(fh);

     return 0;

 }

 

@@ -538,14 +564,17 @@
     }

 	link_usettings = do_ioctl_glinksettings(&ctx);

 	if (link_usettings == NULL) {

+                close(ctx.fd);

 		printf("cannot get device gettings\n");

 		return -1;

 	}

 

 	ret = dump_link_usettings(link_usettings, &local_info);

 	free(link_usettings);

-	if (ret)

-		return ret;

+	if (ret) {

+            close(ctx.fd); 

+	    return ret;

+        }

 

 

 	memcpy(info, &local_info, sizeof(struct sc_eth_info));

@@ -558,6 +587,7 @@
     info->rx_bytes = ife.stats.rx_bytes;

     info->rx_pkts = ife.stats.rx_packets;

 

+    close(ctx.fd);

 

     return 0;

 }

diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/libbsp/sc_usb.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/libbsp/sc_usb.c
index 5676a4f..1610126 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/libbsp/sc_usb.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/libbsp/sc_usb.c
@@ -17,7 +17,7 @@
 #include <linux/serial.h>
 #include <termios.h>
 #include "sc_usb.h"
-//#include "nv_api.h"
+#include "nv_api.h"
 
 #define BUFF_LEN   256
 
@@ -162,13 +162,53 @@
 }
 
 
+int sc_usb_get_hotplug_state(char* buf, int len)
+{
+	int ret = 0;
+	ret = readfile(USB_ATTR_HOT_PLUG_STATE, buf, len);
+	return ret;
+}
+
+/*
+ *get default netcard type from nv,
+ *return vaule:0:means default rndis;1:means ecm;other:invalid nv
+ */
+int sc_usb_get_default_nettype(void)
+{
+	int ret = 0;
+
+	char net_type[BUFF_LEN] = {0};
+	memset(net_type, 0, BUFF_LEN);
+	
+	ret = nv_get_item(NV_RO, STR_FORCE_NETCARD_TYPE,net_type, BUFF_LEN);
+	if(ret){
+		printf("sc_usb_get_default_nettype fail, ret:%d\n", ret);
+		goto GET_END;
+	}
+	
+	if(strstr(net_type, "rndis"))
+		return 0;
+	
+	if(strstr(net_type, "ecm"))
+		return 1;
+	
+	ret = -1;
+GET_END:	
+	return ret;
+}
+
 int sc_usb_set_netcardtype(e_usb_net_type type)
 {
 	int ret = 0;
-	if(type == USB_NET_RNDIS)
+	if(type == USB_NET_RNDIS){
+		nv_set_item(NV_RO, STR_FORCE_NETCARD_TYPE, "force_rndis", 1);
+		nv_commit(NV_RO);
 		ret = writefile(USB_ATTR_FORCENET, "0", 1);
-	else
+	}else{
+		nv_set_item(NV_RO, STR_FORCE_NETCARD_TYPE, "force_ecm", 1);
+		nv_commit(NV_RO);
 		ret = writefile(USB_ATTR_FORCENET, "1", 1);
+	}
 	return ret;
 }
 
@@ -223,4 +263,24 @@
 END:
 	return ret;
 }
+/*
+ *used for cap tell AP force plugout usb while system is going sleep
+ */
+int sc_usb_force_sleep(void)
+{
+	int ret = 0;
+	ret = writefile(USB_ATTR_FORCE_PLUG, "0", 1);
+	
+	return ret;
+}
 
+/*
+ *used for cap tell AP  usb can be enum while system is waking up &running
+ */
+int sc_usb_force_wakeup(void)
+{
+	int ret = 0;
+	ret = writefile(USB_ATTR_FORCE_PLUG, "1", 1);
+	
+	return ret;
+}
\ No newline at end of file
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/libbsp/sc_usb.h b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/libbsp/sc_usb.h
index 1ed8fb0..c3ec4c0 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/libbsp/sc_usb.h
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/libbsp/sc_usb.h
@@ -30,6 +30,9 @@
 #define USB_ATTR_SIMULATE_PLUG     "/sys/gen_usb/usb_state/usb_simulate_plug"

 #define USB_ATTR_BOOT_MODE         "/sys/gen_usb/usb_state/boot_mode"  

 #define USB_ATTR_CURRCFG           "/sys/gen_usb/usb_state/currcfg"  

+#define USB_ATTR_FORCE_PLUG           "/sys/gen_usb/usb_state/force_plug"  

+#define USB_ATTR_HOT_PLUG_STATE           "/sys/gen_usb/usb_state/hotplug"  

+

 #define STR_FORCE_NETCARD_TYPE           "forcenetcard_type" 

 

 #define USB_ATTR_FAST_POWEROFF     "/sys/gen_usb/usb_state/fast_poweroff"

@@ -132,8 +135,12 @@
 void sc_usb_set_net_ecm(void);

 int  sc_usb_usermode_net_state(void);

 int  sc_usb_usermode_adb_state(void);

+int sc_usb_force_sleep(void);

+int sc_usb_force_wakeup(void);

 

+int sc_usb_get_hotplug_state(char* buf, int len);

 

+int sc_usb_get_default_nettype(void);

 

 

 

diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/libmedia/sc_voice_api.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/libmedia/sc_voice_api.c
index b164906..d5886a1 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/libmedia/sc_voice_api.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/libmedia/sc_voice_api.c
@@ -22,7 +22,7 @@
     *p_dev_mode = msg_get_voice_device_mode();

     if(0 > *p_dev_mode){

         ret = VOICEIPC_ERROR;

-        printf("%s: get err, *p_dev_mode=%d", __func__, *p_dev_mode);

+        printf("%s: get err, *p_dev_mode=%d\n", __func__, *p_dev_mode);

     }

     

     return ret;

@@ -44,7 +44,49 @@
     *p_vol = msg_get_rx_voice_vol();

     if(0 > *p_vol){

         ret = VOICEIPC_ERROR;

-        printf("%s: get err, *p_vol=%d", __func__, *p_vol);

+        printf("%s: get err, *p_vol=%d\n", __func__, *p_vol);

+    }

+    

+    return ret;

+}

+

+int sc_audio_set_rx_voice_vol_gain(int gain)

+{

+    int ret = VOICEIPC_OK;

+    ret = msg_set_rx_voice_vol_gain(gain);

+    

+    return ret;

+}

+

+int sc_audio_get_rx_voice_vol_gain(int           *p_gain)

+{

+    int ret = VOICEIPC_OK;

+

+    *p_gain = msg_get_rx_voice_vol_gain();

+    if((-15 > *p_gain) || (24 < *p_gain)){

+        ret = VOICEIPC_ERROR;

+        printf("%s: get err, *p_gain=%d\n", __func__, *p_gain);

+    }

+    

+    return ret;

+}

+

+int sc_audio_set_tx_voice_vol_gain(int gain)

+{

+    int ret = VOICEIPC_OK;

+    ret = msg_set_tx_voice_vol_gain(gain);

+    

+    return ret;

+}

+

+int sc_audio_get_tx_voice_vol_gain(int           *p_gain)

+{

+    int ret = VOICEIPC_OK;

+

+    *p_gain = msg_get_tx_voice_vol_gain();

+    if((-15 > *p_gain) || (24 < *p_gain)){

+        ret = VOICEIPC_ERROR;

+        printf("%s: get err, *p_gain=%d\n", __func__, *p_gain);

     }

     

     return ret;

@@ -66,7 +108,7 @@
     *p_vol = msg_get_tx_voice_vol();

     if(0 > *p_vol){

         ret = VOICEIPC_ERROR;

-        printf("%s: get err, *p_vol=%d", __func__, *p_vol);

+        printf("%s: get err, *p_vol=%d\n", __func__, *p_vol);

     }

     

     return ret;

@@ -88,7 +130,7 @@
     *p_mute = msg_get_tx_voice_mute_state();

     if(0 > *p_mute){

         ret = VOICEIPC_ERROR;

-        printf("%s: get err, *p_mute=%d", __func__, *p_mute);

+        printf("%s: get err, *p_mute=%d\n", __func__, *p_mute);

     }

     

     return ret;

@@ -110,7 +152,7 @@
     *p_mute = msg_get_rx_voice_mute_state();

     if(0 > *p_mute){

         ret = VOICEIPC_ERROR;

-        printf("%s: get err, *p_mute=%d", __func__, *p_mute);

+        printf("%s: get err, *p_mute=%d\n", __func__, *p_mute);

     }

     

     return ret;

diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/libmedia/sc_voice_api.h b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/libmedia/sc_voice_api.h
index cdc52da..454c8f0 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/libmedia/sc_voice_api.h
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/libmedia/sc_voice_api.h
@@ -13,5 +13,9 @@
 int sc_audio_get_loopback_enable_state(int *p_enable);

 int sc_audio_ap_alsa_voice_open(int vmode);

 int sc_audio_ap_alsa_voice_close(int vmode);

+int sc_audio_set_rx_voice_vol_gain(int gain);

+int sc_audio_get_rx_voice_vol_gain(int           *p_gain);

+int sc_audio_set_tx_voice_vol_gain(int gain);

+int sc_audio_get_tx_voice_vol_gain(int           *p_gain);

 

 #endif

diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/libscrtc/sc_rtc_timer.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/libscrtc/sc_rtc_timer.c
index 033ef62..7130fa1 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/libscrtc/sc_rtc_timer.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/libscrtc/sc_rtc_timer.c
@@ -18,6 +18,7 @@
 #include  "rtc_timer.h"

 #include  "softap_api.h"

 #include  "message.h"

+#include "zxic_list.h"

 

 #define SC_ERR_SUCCESS 0

 #define SC_ERR_BADPARAM 3

diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/libscrtc/sc_rtc_timer.h b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/libscrtc/sc_rtc_timer.h
index ad90c41..f158d4f 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/libscrtc/sc_rtc_timer.h
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/libscrtc/sc_rtc_timer.h
@@ -21,7 +21,7 @@
 #include <stdlib.h>

 #include <stdio.h>

 #include <unistd.h>

-#include "zxic_list.h"

+

 

 #ifdef __cplusplus

 extern "C" {

diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/libsctel/include/sc_wifi.h b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/libsctel/include/sc_wifi.h
index 7faf0e1..7b87110 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/libsctel/include/sc_wifi.h
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/libsctel/include/sc_wifi.h
@@ -122,12 +122,13 @@
 	SC_WIFI_AUTH_WPA_PAIRWISE_MAX

 } sc_wifi_auth_wpa_psk_e;

 

+//pairwise,group_rekey is only used in get

 typedef struct

 {

 	sc_wifi_auth_e auth;

-	//sc_wifi_auth_wpa_psk_e pairwise;

+	sc_wifi_auth_wpa_psk_e pairwise; 

 	char passwd[64 + 1];

-	//int group_rekey;

+	int group_rekey; //in seconds

 } sc_wifi_ap_auth_t;

 

 //chang du bu yi zhi shi, yong dang qian zui da chang du cun jiu shi le

@@ -161,7 +162,7 @@
 {

 	sc_wifi_ap_status_e status;

 	char ifname[32];

-	//char bssid[18];

+	char bssid[18];

 }sc_wifi_ap_status_t;

 

 typedef void (*sc_wifi_ap_status_ind_cb_f)(sc_wifi_ap_index_e index, 

@@ -219,10 +220,10 @@
 {

 	char bssid[18];//mac

 	char essid[33];

-	//int signal;

+	int signal; //dbm

 	unsigned char signal_level; //0-4, max 4

-	//int frequency;

-	unsigned char channel; //1-13

+	int frequency; //Hz

+	unsigned char channel; //1-13, 36...

 	sc_wifi_auth_e auth;

 	sc_wifi_auth_wpa_psk_e cipher;

 }sc_wifi_sta_scan_info_t;

@@ -596,6 +597,7 @@
  */

 int sc_wifi_set_ap_sta_connect_ind_cb(sc_wifi_ap_sta_connect_ind_cb_f cb);

 

+int sc_wifi_get_hostname_by_mac(char *mac_str, char *hostname, int len);

 

 #ifdef __cplusplus

 }

diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/libsctel/wifi/sc_wifi.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/libsctel/wifi/sc_wifi.c
index ebc4af2..cf3d227 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/libsctel/wifi/sc_wifi.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/libsctel/wifi/sc_wifi.c
@@ -20,6 +20,8 @@
 #include "os_type_def.h"

 #include "wifi_msg.h"

 #include "wifi_inter_msg.h"

+#include "netotherapi.h"

+

 

 /*ÉÏÏÂÎÄÐÅÏ¢*/

 struct scwifi_context {	

@@ -134,6 +136,49 @@
 static char *cc_5g_16[] = {"CO", "CR", "EC", "JM", "PE", "PR", "TT", "US", "TH", "TW"};

 static int ch_5g_16[] = {36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165};

 

+static const scwifi_freq_ch_t g_sta_freq_ch[] = {

+    {2412, 	1},

+    {2417, 	2},

+    {2422, 	3},

+    {2427, 	4},

+    {2432, 	5},

+    {2437, 	6},

+    {2442, 	7},

+    {2447, 	8},

+    {2452, 	9},

+    {2457, 	10},

+    {2462, 	11},

+    {2467, 	12},

+    {2472, 	13},

+    {2484, 	14},

+

+	{5180, 	36},

+    {5200, 	40},

+    {5220, 	44},

+    {5240, 	48},

+    {5260, 	52},

+    {5280, 	56},

+    {5300, 	60},

+    {5320, 	64},

+    {5500, 	100},

+    {5520, 	104},

+    {5540, 	108},

+    {5560, 	112},

+    {5580, 	116},

+    {5600, 	120},

+    {5620, 	124},

+    {5640, 	128},

+    {5660, 	132},

+    {5680, 	136},

+    {5700, 	140},

+    {5720, 	144},

+    {5745, 	149},

+    {5765, 	153},

+    {5785, 	157},

+    {5805, 	161},

+    {5825, 	165}

+};

+

 static int sc_wifi_enable_status_ind(const sc_ipc_event* const pevt, const sc_ipc_msg* const pmsg)

 {

 	struct scwifi_context *pccctx = (struct scwifi_context *)pevt->param;

@@ -202,6 +247,7 @@
 		SCLOGI("sc_wifi_ap_status_ind call cb!\n");

 		strncpy(ap_msg.ifname, pstate_info->ifname, sizeof(ap_msg.ifname) - 1);

 		ap_msg.status = transe_ap_status(pstate_info->status);

+		strncpy(ap_msg.bssid, pstate_info->bssid, sizeof(ap_msg.bssid) - 1);

 		pre_status = transe_ap_status(pstate_info->pre_status);

 		pccctx->ap_status_cb(pstate_info->idx, pre_status, &ap_msg);

 	}

@@ -364,6 +410,20 @@
 	return sc_chiper;

 }

 

+static int transe_scan_ch_to_freq(int ch)

+{

+	int i = 0;

+	int tableSize = sizeof(g_sta_freq_ch)/sizeof(scwifi_freq_ch_t);

+	

+	for(i = 0; i < tableSize; i++) {

+       if(g_sta_freq_ch[i].ch == ch) {

+           return g_sta_freq_ch[i].freq;

+       }

+    }

+	SCLOGE("transe_scan_ch_to_freq unknow ch:%d\n", ch);

+	return 0;

+}

+

 static int sc_wifi_sta_scan_ind(const sc_ipc_event* const pevt, const sc_ipc_msg* const pmsg)

 {

 	struct scwifi_context *pccctx = (struct scwifi_context *)pevt->param;

@@ -385,7 +445,9 @@
 				msg.info[i].cipher = transe_scan_cipher_type(pind->info[i].cipher);

 			}

 			msg.info[i].channel = pind->info[i].channel;

+			msg.info[i].frequency = transe_scan_ch_to_freq(pind->info[i].channel);

 			msg.info[i].signal_level = pind->info[i].signal_level;

+			msg.info[i].signal = (int)pind->info[i].signal;

 			strncpy(msg.info[i].essid, pind->info[i].essid, sizeof(msg.info[i].essid)-1);

 			strncpy(msg.info[i].bssid, pind->info[i].bssid, sizeof(msg.info[i].bssid)-1);

 		}

@@ -1575,6 +1637,35 @@
 	return sc_auth;

 }

 

+static sc_wifi_auth_wpa_psk_e get_ap_wpa_psk_type(sc_wifi_auth_e auth)

+{

+	sc_wifi_auth_wpa_psk_e sc_wpa = SC_WIFI_AUTH_WPA_PAIRWISE_MIN;

+

+	switch (auth) {

+		case SC_WIFI_AUTH_WPA2_PSK:

+			sc_wpa = SC_WIFI_AUTH_WPA_PAIRWISE_AES;

+			break;

+		

+		case SC_WIFI_AUTH_WPA3_PSK:

+			sc_wpa = SC_WIFI_AUTH_WPA_PAIRWISE_AES;

+			break;

+	

+		case SC_WIFI_AUTH_WPA_WPA2_PSK_BOTH:

+			sc_wpa = SC_WIFI_AUTH_WPA_PAIRWISE_AUTO;

+			break;	

+		

+		case SC_WIFI_AUTH_WPA2_WPA3_PSK_BOTH:

+			sc_wpa = SC_WIFI_AUTH_WPA_PAIRWISE_AES;

+			break;

+		

+		default:

+			SCLOGE("unknow or not wpa auth:%d.\n", auth);

+			break;

+	}

+	return sc_wpa;

+}

+

+

 int sc_wifi_ap_param_get(sc_wifi_ap_index_e idx, sc_wifi_ap_param_t *p_param)

 {

 	sc_ipc_msg *req_msg = NULL;

@@ -1614,7 +1705,8 @@
 			strncpy(p_param->mac_list, data_res->mac_list, sizeof(p_param->mac_list) - 1);

 			p_param->auth.auth = transe_ap_auth_type(data_res->authmode, data_res->encrypt);

 			strncpy(p_param->auth.passwd, data_res->pwd, sizeof(p_param->auth.passwd) - 1);

-			

+			p_param->auth.pairwise = get_ap_wpa_psk_type(p_param->auth.auth);

+			p_param->auth.group_rekey = 3600;//s

 		}

 		else {

 			SCLOGE("sc_wifi_ap_param_get fail: %d!\n", ret);

@@ -1743,6 +1835,7 @@
 		if(SC_ERR_SUCCESS == ret) {

 			p_stat->status = transe_ap_status(rsp_data->status);

 			strncpy(p_stat->ifname, rsp_data->ifname, sizeof(p_stat->ifname) - 1);

+			strncpy(p_stat->bssid, rsp_data->bssid, sizeof(p_stat->bssid) - 1);

 		}

 		else {

 			SCLOGE("sc_wifi_ap_get_status fail: %d!\n", ret);

@@ -2127,3 +2220,63 @@
 	return 0;

 }

 

+static void parse_mac_str(char *mac_str, unsigned char *addr_array, int size)

+{

+	unsigned int a, b, c, d, e, f;

+	

+	if (size < 6) {

+		return;

+	}

+	

+	if (sscanf(mac_str, "%02x:%02x:%02x:%02x:%02x:%02x",

+		&a, &b, &c, &d, &e, &f) == 6) {

+		addr_array[0] = (unsigned char) a;

+		addr_array[1] = (unsigned char) b;

+		addr_array[2] = (unsigned char) c;

+		addr_array[3] = (unsigned char) d;

+		addr_array[4] = (unsigned char) e;

+		addr_array[5] = (unsigned char) f;

+	}

+}

+

+static DHCPOFFERADDR_LIST_t *find_match_sta(struct list_head *dhcp_info_list, unsigned char *addr_array)

+{

+	DHCPOFFERADDR_LIST_t * p_dhcp_info = NULL;

+

+	list_for_each_entry(p_dhcp_info, dhcp_info_list, list) {

+		if ((p_dhcp_info->dhcp_info.mac[0] == addr_array[0]) && (p_dhcp_info->dhcp_info.mac[1] == addr_array[1]) &&

+			(p_dhcp_info->dhcp_info.mac[2] == addr_array[2]) && (p_dhcp_info->dhcp_info.mac[3] == addr_array[3]) &&

+			(p_dhcp_info->dhcp_info.mac[4] == addr_array[4]) && (p_dhcp_info->dhcp_info.mac[5] == addr_array[5])) {

+			return p_dhcp_info;

+		}

+	}

+	return NULL;

+}

+

+//µ±wifiÉϱ¨sta½ÓÈëʱ,¿ÉÄÜ´ËʱstaµÄip»¹Ã»Íê³É·ÖÅä,»á³öÏֲ鲻µ½hostnameµÄÇé¿ö,¿ÉµÈÒ»»áÔÙ²é

+int sc_wifi_get_hostname_by_mac(char *mac_str, char *hostname, int len)

+{

+	int find_name = 0;

+	unsigned char mac_addr[6] = {0};

+	DHCPOFFERADDR_LIST_t * p_dhcp_info   = NULL;

+	struct list_head dhcp_info_list;

+	INIT_LIST_HEAD(&dhcp_info_list);

+	zte_get_mac_list_from_lease(&dhcp_info_list);

+	

+	parse_mac_str(mac_str, mac_addr, sizeof(mac_addr));

+	if((p_dhcp_info = find_match_sta(&dhcp_info_list, mac_addr)) != NULL)

+	{

+		if (len > sizeof(p_dhcp_info->dhcp_info.host_name)) {

+			strncpy(hostname, p_dhcp_info->dhcp_info.host_name, sizeof(p_dhcp_info->dhcp_info.host_name));

+		}

+		else {

+			strncpy(hostname, p_dhcp_info->dhcp_info.host_name, len - 1);

+		}

+		//SCLOGI("hostname:%s", hostname);

+		find_name = 1;

+	}					 

+	 

+	free_dhcp_list(&dhcp_info_list);

+	return find_name;

+} 

+

diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/ril/libril/ril.cpp b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/ril/libril/ril.cpp
index a28d0bd..3017fb8 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/ril/libril/ril.cpp
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/ril/libril/ril.cpp
@@ -4961,17 +4961,18 @@
 			}			
             break;
 		case SET_TEST_NUM:
-             if((3 == number) || (4 == number) || (5 == number)) {
+            if((3 == number) || (4 == number) || (5 == number)) {
 				RLOGI("Debug port: SET_TEST_NUM");
+				unsigned char testnum[32] = {0};
 	            ecallNumSet.arg_num = atoi(args[1]);
 				if(1 == ecallNumSet.arg_num){
 					ecallNumSet.type = atoi(args[2]);
 				} else if (2 == ecallNumSet.arg_num) {
 					ecallNumSet.type = atoi(args[2]);
 					ecallNumSet.address = args[3];
-				}     							
-	    		issueLocalRequest(RIL_REQUEST_ZXIC_ECALL_SET_TEST_NUM, &ecallNumSet, sizeof(ecallNumSet), socket_id); 			
-    		}
+				}
+				issueLocalRequest(RIL_REQUEST_ZXIC_ECALL_SET_TEST_NUM, &ecallNumSet, sizeof(ecallNumSet), socket_id);
+			}
 			else {
 				RLOGI("number(%d) error.",number);
 			}	
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/ril/reference-ril/ril_cc.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/ril/reference-ril/ril_cc.c
index 83dd3ed..f7f38d8 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/ril/reference-ril/ril_cc.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/ril/reference-ril/ril_cc.c
@@ -1809,7 +1809,7 @@
 	}

 	

 	s_ecallMsdData.call_id = id;

-	RIL_onUnsolicitedResponse(RIL_UNSOL_ECALL_INDICATIONS /*RIL_UNSOL_ZXIC_ECALL_INDICATIONS*/, &ecall_state_indicate, sizeof(ecall_state_indicate));

+	RIL_onUnsolicitedResponse(RIL_UNSOL_ECALL_INDICATIONS /*RIL_UNSOL_ZXIC_ECALL_INDICATIONS*/, &ecall_state_indicate, sizeof(ecall_state_indicate));/*modify by hq at 2024/04/07 for ecall*/

 	

 	return;

 }

diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/ril/reference-ril/ril_mm.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/ril/reference-ril/ril_mm.c
index 4e4f178..65d35d5 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/ril/reference-ril/ril_mm.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/ril/reference-ril/ril_mm.c
@@ -688,11 +688,11 @@
 	pSS->LTE_SignalStrength.cqi = 0x7FFFFFFF;

 	pSS->LTE_SignalStrength.timingAdvance = 0x7FFFFFFF;

 

-	pSS->TD_SCDMA_SignalStrength.signalStrength = 0x7FFFFFFF;

+	pSS->TD_SCDMA_SignalStrength.signalStrength = 99;

 	pSS->TD_SCDMA_SignalStrength.bitErrorRate = 0x7FFFFFFF;

 	pSS->TD_SCDMA_SignalStrength.rscp = 0x7FFFFFFF;

 

-	pSS->WCDMA_SignalStrength.signalStrength = 0x7FFFFFFF;

+	pSS->WCDMA_SignalStrength.signalStrength = 99;

 	pSS->WCDMA_SignalStrength.bitErrorRate = 0x7FFFFFFF;

 	pSS->WCDMA_SignalStrength.rscp = 0x7FFFFFFF;

 	pSS->WCDMA_SignalStrength.ecno = 0x7FFFFFFF;

@@ -1526,6 +1526,7 @@
 		else {

 			response[17] = changeCSQdbmToLevel(rscp - 121, 5);

 		}

+#if 0		

 		response[18] = 0x7FFFFFFF;

 

 		if (0 == rscp) {

@@ -1541,6 +1542,17 @@
 		} else {

 			response[20] = 0x7FFFFFFF;

 		}

+#else		

+		/*not known or not detectable*/

+		response[18] = 99;

+	

+		/*Valid values are (0-96, 255)*/

+		response[19] = rscp;

+

+		/*Valid values are (0-49, 255)*/

+		response[20] = ecno;

+		RLOGD("requestSignalStrength %d %d %d %d",response[17],response[18],response[19],response[20]);

+#endif		

 	}

 

 	RIL_onRequestComplete(t, RIL_E_SUCCESS, response, sizeof(response));

@@ -1849,9 +1861,10 @@
 		if(99 == rssi) {

 			result.WCDMA_SignalStrength.signalStrength = 99;

 		}

-

-		result.WCDMA_SignalStrength.signalStrength = changeCSQdbmToLevel(rssi - 116, act);

-

+		else {

+			result.WCDMA_SignalStrength.signalStrength = changeCSQdbmToLevel(rssi - 116, act);

+		}

+#if 0

 		result.WCDMA_SignalStrength.bitErrorRate = 0x7FFFFFFF;

 

 		if (0 == rssi) {

@@ -1859,6 +1872,19 @@
 		} else if (0 < rssi && rssi <= 96) {

 			result.WCDMA_SignalStrength.rscp = 121 - rssi;

 		}

+#else

+		/*ÓÉÓÚzsqr²»Éϱ¨ÎóÂëÂÊ£¬Ìîд99*/

+		result.WCDMA_SignalStrength.bitErrorRate = 99;

+		/*½«rssiתΪrscp£¬Valid values are (0-96, 255)*/

+		if(99 == rssi) {

+			result.WCDMA_SignalStrength.rscp = 255;

+		}

+		else {

+			result.WCDMA_SignalStrength.rscp = rssi + 5;

+		}

+		/*ÓÉÓÚzsqr²»Éϱ¨ecno£¬Ìîд255*/

+		result.WCDMA_SignalStrength.ecno = 255;

+#endif		

 	}

 	/*TD-SCDMA ģʽ, CSQºÍZSQRµÄÐźÅÇ¿¶ÈÖµÊÇCESQÖµ¼õ5*/

 	else if (15 == act) {

diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/adctest/Makefile b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/adctest/Makefile
old mode 100644
new mode 100755
index eed53fb..a77e850
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/adctest/Makefile
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/adctest/Makefile
@@ -10,7 +10,7 @@
 CFLAGS += -g -Werror=implicit-function-declaration
 
 
-LDLIBS = -lpthread -lm

+LDLIBS = -lpthread -lm  -lnvram

 #LDLIBS += -lnvram
 LDLIBS += -lbsp -L$(zte_lib_path)/libbsp

 #LDLIBS  += -lsoft_timer -L$(zte_lib_path)/libsoft_timer
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/bsp_test/Makefile b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/bsp_test/Makefile
old mode 100644
new mode 100755
index 5b8c608..ae79ec7
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/bsp_test/Makefile
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/bsp_test/Makefile
@@ -14,7 +14,7 @@
 CFLAGS += -g -Werror=implicit-function-declaration
 
 
-LDLIBS  += -lpthread
+LDLIBS  += -lpthread -lnvram
 LDLIBS  += -lbsp -L$(LIB_DIR)/libbsp
 
 ##############USER COMIZE END##################
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/crc_api/Makefile b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/crc_api/Makefile
index bcfbf24..2a2941f 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/crc_api/Makefile
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/crc_api/Makefile
@@ -19,7 +19,7 @@
 CFLAGS += -g -Werror=implicit-function-declaration

 

 #EXEC EXEC2 ¹«¹²LIB²ÎÊý£¬µÚÒ»Ðж¨ÒåLDLIBSÓÃ=£¬²»ÒªÓÃ+=,Ó¦ÓÃÁ¬½ÓµÄ¿â¶¼ÔÚ±¾Makefile¶¨Òå

-LDLIBS = -lpthread -lm

+LDLIBS = -lpthread -lm  -lnvram

 LDLIBS += -lbsp

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

 # targets

diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/ethtest/Makefile b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/ethtest/Makefile
old mode 100644
new mode 100755
index d9176f2..77efbb0
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/ethtest/Makefile
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/ethtest/Makefile
@@ -10,7 +10,7 @@
 CFLAGS += -g -Werror=implicit-function-declaration
 
 
-LDLIBS = -lpthread -lm

+LDLIBS = -lpthread -lm  -lnvram

 #LDLIBS += -lnvram
 LDLIBS += -lbsp -L$(zte_lib_path)/libbsp

 #LDLIBS  += -lsoft_timer -L$(zte_lib_path)/libsoft_timer
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/ethtest/ethtest.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/ethtest/ethtest.c
index bf3d842..0758e10 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/ethtest/ethtest.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/ethtest/ethtest.c
@@ -171,4 +171,5 @@
         }

         return 0;

     }

+    return 0;

 }

diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/i2ctest/Makefile b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/i2ctest/Makefile
old mode 100644
new mode 100755
index d96ea8a..cdda806
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/i2ctest/Makefile
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/i2ctest/Makefile
@@ -10,7 +10,7 @@
 CFLAGS += -g -Werror=implicit-function-declaration
 
 
-LDLIBS = -lpthread -lm

+LDLIBS = -lpthread -lm  -lnvram

 #LDLIBS += -lnvram
 LDLIBS += -lbsp -L$(zte_lib_path)/libbsp

 #LDLIBS  += -lsoft_timer -L$(zte_lib_path)/libsoft_timer
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/player_demo/Makefile b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/player_demo/Makefile
index 74faa57..42ceddb 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/player_demo/Makefile
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/player_demo/Makefile
@@ -20,6 +20,7 @@
 LDLIBS += -lpthread
 LDLIBS += -lmedia -L$(LIB_DIR)/libmedia
 LDLIBS += -lscipc -L$(LIB_DIR)/libscipc
+LDLIBS += -lsofttimer -L$(LIB_DIR)/libsofttimer
 
 all: $(EXEC_PLAYER) $(EXEC_PLAYBACK) $(EXEC_CAPTURE)
 
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/player_demo/capture_demo.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/player_demo/capture_demo.c
index 78d5556..e8d47c9 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/player_demo/capture_demo.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/player_demo/capture_demo.c
@@ -19,15 +19,29 @@
 

 #include "sc_audio.h"

 

+#include "soft_timer.h"

+

 /** ¶¨ÒåÒôƵ³õʼ»¯×î´óÖØÊÔ´ÎÊý */

 #define AUDIO_INIT_MAX_TRY_CNT 100

+

+#define CAPTURE_DURATION_TIMER	0x1300

+

+

 /*capture file path*/

 static char cap_filepath[128] = {0};

 static sc_audio_stream_format_e stream_format = SC_AUDIO_STREAM_FORMAT_PCM;

+static int cap_period_size = 320;

+static int cap_period_count = 2;

+static int cap_num_channels = 1;

+static int cap_sample_rate = 8000;

+

 

 /** ¶¨ÒåÒ»¸öÒôƵÎļþÂ¼ÖÆ½áÊø±êÖ¾ */

 static int g_capture_end = 0;

 

+static long capture_time = 0;

+static int capture_timer_running = 0;

+

 static char *player_event_name[] = {

 	"SUSPEND",

 	"RESUME",

@@ -62,9 +76,13 @@
 

 static void printUsage(const char *Opt)

 {

-	printf("Usage: capture_demo [-t 0] [-f filepath] \n", Opt);

+	printf("Usage: capture_demo [-t 0] [-f filepath] [-d ms]\n", Opt);

 	printf("f:capture file.\n");

 	printf("t: 0-invalid,1-pcm,2-wav,3-amr,4-amrnb,5-amrwb\n");

+	printf("d:capture time. default 0[ms]\n");

+	printf("r:sample rate. default 8000\n");

+	printf("s:period size. default 320\n");

+	printf("c:period count. default 2\n");

 	printf("\n");

 }

 

@@ -91,7 +109,7 @@
 {

 	int rc = 0;

     int c;

-    while ((c = getopt(argc, argv, "?f:t:")) != -1) {

+    while ((c = getopt(argc, argv, "?f:t:d:r:s:c:")) != -1) {

         switch (c) {

         case 'f':

 			if (optarg) {

@@ -103,6 +121,26 @@
 				stream_format = atoi(optarg);

 			}

 			break;

+		case 'd':

+			if (optarg) {

+				capture_time = atoi(optarg);

+			}

+			break;

+		case 'r':

+			if (optarg) {

+				cap_sample_rate = atoi(optarg);

+			}

+			break;

+		case 's':

+			if (optarg) {

+				cap_period_size = atoi(optarg);

+			}

+			break;

+		case 'c':

+			if (optarg) {

+				cap_period_count = atoi(optarg);

+			}

+			break;

         case '?':

         default:

             printUsage(argv[0]);

@@ -113,6 +151,36 @@
     return rc;

 }

 

+static void * capture_timer_cb(void *arg)

+{

+	capture_timer_running = 0;

+	g_capture_end = 1;	

+}

+

+static void create_capture_timer(void)

+{

+	if(0 == capture_time) {

+		return;

+	}

+	if(0 != sc_timer_create(CAPTURE_DURATION_TIMER, TIMER_FLAG_ONCE, capture_time, &capture_timer_cb, NULL)) {

+		audiodemo_log("sc_timer_create fail.\n");

+		return;

+	}

+	capture_timer_running = 1;

+}

+

+static void delete_capture_timer(void)

+{

+	if(0 == capture_time || 0 == capture_timer_running) {

+		return;

+	}

+	if(0 != sc_timer_delete(CAPTURE_DURATION_TIMER)) {

+		audiodemo_log("sc_timer_delete fail.\n");

+		return;

+	}

+	capture_timer_running = 0;

+}

+

 static int player_event_cb (sc_audio_handle_t handle, int event)

 {

 	audiodemo_log("player_event_cb handle:0x%x event:%s\n",handle, player_event_name[event]);

@@ -185,11 +253,11 @@
 	}

 	/** ¶¨Òå PCM ²ÎÊý£¬Ò²¿É²»¶¨Ò壬Èô²»¶¨Ò壬Ôò°´Ä¬ÈÏÖµ´¦Àí */

 	memset(&pcm_config, 0, sizeof(sc_audio_pcm_config_t));

-	pcm_config.period_size = 320;

-	pcm_config.period_count = 2;

+	pcm_config.period_size = cap_period_size;

+	pcm_config.period_count = cap_period_count;

 	pcm_config.flags = 0;

-	pcm_config.num_channels = 1;

-	pcm_config.sample_rate = 8000;

+	pcm_config.num_channels = cap_num_channels;

+	pcm_config.sample_rate = cap_sample_rate;

 	pcm_config.pcm_format = 2;

 

 	/** ÒôƵÎļþ²¶»ñ×¼±¸ */

@@ -213,6 +281,9 @@
 		error_line = __LINE__;

 		goto exit;

 	}

+

+	create_capture_timer();

+	

 	while (0 == g_capture_end)

 	{

 		/** Ñ­»·µÈ´ý½áÊø±êÖ¾£¬Èô g_capture_end ÉèÖÃΪ 1£¬Ôò½áÊøÑ­»· */

@@ -220,6 +291,8 @@
 	}	

 

 exit:

+	delete_capture_timer();

+	

 	/** ÒôƵÎļþÂ¼ÖÆ½áÊøºó£¬±ØÐëµ÷Óà close ½Ó¿Ú */

 	if(SC_AUDIO_INVALID_HANDLE != capture_handle) {

 		sc_audio_capture_stop(capture_handle);

@@ -229,6 +302,7 @@
 	if(error_line > 0) {

 		audiodemo_log("capture_demo:error_line %d.\n",error_line);

 	}

+	

 	audiodemo_log("capture_demo:Demo end.\n");

 	return 0;	

 }

diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/softap_demo/Makefile b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/softap_demo/Makefile
new file mode 100755
index 0000000..dd84a82
--- /dev/null
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/softap_demo/Makefile
@@ -0,0 +1,35 @@
+include $(COMMON_MK)
+
+EXEC = softap_demo
+OBJS = main.o tok.o
+
+CFLAGS += -I.
+CFLAGS += -I./inc
+CFLAGS += -I$(APP_DIR)/include
+
+
+CFLAGS += -g
+CFLAGS += -g -Werror=implicit-function-declaration
+
+LDLIBS += -lpthread
+LDLIBS += -lsoftap
+LDLIBS += -latutils
+LDLIBS += -lsofttimer
+LDLIBS += -lnvram
+
+all: $(EXEC)
+$(EXEC)all: $(EXEC)
+
+$(EXEC): $(OBJS)
+	$(CC) $(LDFLAGS) -o $@ $^ -Wl,--start-group $(LDLIBS) -Wl,--end-group
+	@cp $@ $@.elf
+
+romfs:
+	$(ROMFSINST) -e  /sbin/$(EXEC)
+	
+clean:
+	-rm -f $(EXEC) *.elf *.gdb *.o
+
+	$(CC) $(LDFLAGS) -o $@ $(OBJS) $(LDLIBS$(LDLIBS_$@))
+
+
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/softap_demo/main.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/softap_demo/main.c
new file mode 100755
index 0000000..f3546ec
--- /dev/null
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/softap_demo/main.c
@@ -0,0 +1,166 @@
+#include <ctype.h>

+#include <errno.h>

+#include <unistd.h>

+#include <getopt.h>

+#include <limits.h>

+#include <netdb.h>

+#include <stdbool.h>

+#include <stdint.h>

+#include <stdio.h>

+#include <stdlib.h>

+#include <string.h>

+#include <time.h>

+#include <syslog.h>

+#include <pthread.h>

+#include <stdarg.h>

+#include <signal.h>

+

+#include "tok.h"

+#include "softap_api.h"

+

+#define DEMO_CMD_MAX_LEN 64

+#define EXIT_CMD_STOP	"stop\n"

+#define EXIT_CMD_Q	"q\n"

+#define EXIT_CMD_EXIT	"exit\n"

+

+#define SET_LOWPOWER_MODE			"set_lowpower_mode"

+#define GET_LOWPOWER_MODE			"get_lowpower_mode"

+

+static int g_demo_terminate = 0;

+

+static void demo_termination_handler(int signum)

+{

+    g_demo_terminate = 1;

+	fputs(EXIT_CMD_Q, stdout);

+	printf("demo_termination_handler signum %d\n",signum);

+}

+

+static void demo_install_signal_handler(void)

+{

+    struct sigaction sig_action;

+

+    sig_action.sa_handler = demo_termination_handler;

+    sigemptyset(&sig_action.sa_mask);

+    sig_action.sa_flags = 0;

+

+    sigaction(SIGINT, &sig_action, NULL);

+    sigaction(SIGHUP, &sig_action, NULL);

+    sigaction(SIGTERM, &sig_action, NULL);

+}

+

+static void printUsage(const char *Opt)

+{

+	printf("Usage: %s\n", Opt);	

+	printf("set_lowpower_mode: mode		  	)\n");	

+	printf("get_lowpower_mode		  	)\n");

+	printf("\n");

+}

+

+

+static void demo_log(const char *fmt, ...)

+{

+	va_list arg = {0};

+	char log_buf[1024]= {0};

+

+	if(NULL == fmt)

+	{

+		return ;

+	}

+	va_start(arg,fmt);

+	vsnprintf(log_buf, 1023, fmt, arg);

+	va_end(arg);

+

+	printf("[softapdemo] %s\n",log_buf);

+	return;

+}

+

+static int set_lowpower_mode(char *data, int data_len)

+{

+	int ret;

+	unsigned int mode;

+

+	if (at_tok_start(&data) < 0) {

+		demo_log("set_lowpower_mode:at_tok_start error\n");

+		return -1;

+	}

+	if(at_tok_nextint(&data, &mode) < 0) {

+		demo_log("set_lowpower_mode:at_tok_nextint error\n");

+		return -1;

+	}

+

+	ret = platform_set_lowpower_mode(mode);

+	if(0 != ret) {

+		demo_log("set_lowpower_mode:ret=%d.\n",ret);

+	}

+	else {

+		demo_log("set_lowpower_mode:mode=%d.\n",mode);

+	}

+	

+	return ret;

+}

+static int get_lowpower_mode(char *data, int data_len)

+{

+	int ret;

+	unsigned int mode;

+	

+	ret = platform_get_lowpower_mode(&mode);

+	demo_log("platform_get_lowpower_mode:ret=%d,mode=%d\n",ret,mode);

+

+	return ret;

+}

+

+static void softap_cmd_proc(char *cmdstr)

+{

+	char *data = cmdstr;

+	int data_len = strlen(data) - 1;/* -strlen("\r")*/	

+	char request = data[0];

+

+	cmdstr[data_len] = '\0';

+	printf("softap_cmd_proc data=%s \n", data);

+	if(0 == strncmp(data, SET_LOWPOWER_MODE, strlen(SET_LOWPOWER_MODE))) {		

+		set_lowpower_mode(data, data_len);

+	}

+	else if(0 == strncmp(data, GET_LOWPOWER_MODE, strlen(GET_LOWPOWER_MODE))) {		

+		get_lowpower_mode(data, data_len);

+	}

+	else {

+		printf("Request unknow.\n");

+		printUsage(cmdstr);

+	}

+}

+

+int main(int argc, char *argv[])

+{

+	char cmdstr[DEMO_CMD_MAX_LEN];	

+	int ret;

+	

+	demo_log("softap_demo:Demo go.\n");

+	demo_install_signal_handler();		

+

+	while(!g_demo_terminate) {

+		memset(cmdstr,0,DEMO_CMD_MAX_LEN);		

+		demo_log("Please input an command:\n");

+	

+		if(NULL != fgets(cmdstr,DEMO_CMD_MAX_LEN - 1,stdin)) {			

+			if(0 == strcmp(EXIT_CMD_STOP,cmdstr) || 

+				0 == strcmp(EXIT_CMD_Q,cmdstr) || 

+				0 == strcmp(EXIT_CMD_EXIT,cmdstr)) {

+				break;

+			}

+			

+			demo_log("softap demo cmd : %s\n", cmdstr);

+			if(1 >= strlen(cmdstr)) {

+				continue;

+			}

+

+			/*request format:

+			 *Q:1,2,10086

+			 */

+			softap_cmd_proc(cmdstr);			

+		}

+	}

+

+

+	demo_log("softap_demo:Demo end.\n");

+	return 0;

+}

diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/softap_demo/tok.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/softap_demo/tok.c
new file mode 100755
index 0000000..95ddda0
--- /dev/null
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/softap_demo/tok.c
@@ -0,0 +1,190 @@
+/* 
+**
+** Copyright 2006, The Android Open Source Project
+**
+** Licensed under the Apache License, Version 2.0 (the "License");
+** you may not use this file except in compliance with the License.
+** You may obtain a copy of the License at
+**
+**     http://www.apache.org/licenses/LICENSE-2.0
+**
+** Unless required by applicable law or agreed to in writing, software
+** distributed under the License is distributed on an "AS IS" BASIS,
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+** See the License for the specific language governing permissions and
+** limitations under the License.
+*/
+
+#include "tok.h"
+#include <string.h>
+#include <ctype.h>
+#include <stdlib.h>
+
+/**
+ * Starts tokenizing an AT response string
+ * returns -1 if this is not a valid response string, 0 on success.
+ * updates *p_cur with current position
+ */
+int at_tok_start(char **p_cur)
+{
+    if (*p_cur == NULL) {
+        return -1;
+    }
+
+    // skip prefix
+    // consume "^[^:]:"
+
+    *p_cur = strchr(*p_cur, ':');
+
+    if (*p_cur == NULL) {
+        return -1;
+    }
+
+    (*p_cur)++;
+
+    return 0;
+}
+
+static void skipWhiteSpace(char **p_cur)
+{
+    if (*p_cur == NULL) return;
+
+    while (**p_cur != '\0' && isspace(**p_cur)) {
+        (*p_cur)++;
+    }
+}
+
+static void skipNextComma(char **p_cur)
+{
+    if (*p_cur == NULL) return;
+
+    while (**p_cur != '\0' && **p_cur != ',') {
+        (*p_cur)++;
+    }
+
+    if (**p_cur == ',') {
+        (*p_cur)++;
+    }
+}
+
+static char * nextTok(char **p_cur)
+{
+    char *ret = NULL;
+
+    skipWhiteSpace(p_cur);
+
+    if (*p_cur == NULL) {
+        ret = NULL;
+    } else if (**p_cur == '"') {
+        (*p_cur)++;
+        ret = strsep(p_cur, "\"");
+        skipNextComma(p_cur);
+    } else {
+        ret = strsep(p_cur, ",");
+    }
+
+    return ret;
+}
+
+
+/**
+ * Parses the next integer in the AT response line and places it in *p_out
+ * returns 0 on success and -1 on fail
+ * updates *p_cur
+ * "base" is the same as the base param in strtol
+ */
+
+static int at_tok_nextint_base(char **p_cur, int *p_out, int base, int  uns)
+{
+    char *ret;
+
+    if (*p_cur == NULL) {
+        return -1;
+    }
+
+    ret = nextTok(p_cur);
+
+    if (ret == NULL) {
+        return -1;
+    } else {
+        long l;
+        char *end;
+
+        if (uns)
+            l = strtoul(ret, &end, base);
+        else
+            l = strtol(ret, &end, base);
+
+        *p_out = (int)l;
+
+        if (end == ret) {
+            return -1;
+        }
+    }
+
+    return 0;
+}
+
+/**
+ * Parses the next base 10 integer in the AT response line
+ * and places it in *p_out
+ * returns 0 on success and -1 on fail
+ * updates *p_cur
+ */
+int at_tok_nextint(char **p_cur, int *p_out)
+{
+    return at_tok_nextint_base(p_cur, p_out, 10, 0);
+}
+
+/**
+ * Parses the next base 16 integer in the AT response line
+ * and places it in *p_out
+ * returns 0 on success and -1 on fail
+ * updates *p_cur
+ */
+int at_tok_nexthexint(char **p_cur, int *p_out)
+{
+    return at_tok_nextint_base(p_cur, p_out, 16, 1);
+}
+
+int at_tok_nextbool(char **p_cur, char *p_out)
+{
+    int ret;
+    int result;
+
+    ret = at_tok_nextint(p_cur, &result);
+
+    if (ret < 0) {
+        return -1;
+    }
+
+    // booleans should be 0 or 1
+    if (!(result == 0 || result == 1)) {
+        return -1;
+    }
+
+    if (p_out != NULL) {
+        *p_out = (char)result;
+    }
+
+    return ret;
+}
+
+int at_tok_nextstr(char **p_cur, char **p_out)
+{
+    if (*p_cur == NULL) {
+        return -1;
+    }
+
+    *p_out = nextTok(p_cur);
+
+    return 0;
+}
+
+/** returns 1 on "has more tokens" and 0 if no */
+int at_tok_hasmore(char **p_cur)
+{
+    return ! (*p_cur == NULL || **p_cur == '\0');
+}
+
+
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/softap_demo/tok.h b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/softap_demo/tok.h
new file mode 100755
index 0000000..88e0346
--- /dev/null
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/softap_demo/tok.h
@@ -0,0 +1,30 @@
+/*
+**
+** Copyright 2006, The Android Open Source Project
+**
+** Licensed under the Apache License, Version 2.0 (the "License");
+** you may not use this file except in compliance with the License.
+** You may obtain a copy of the License at
+**
+**     http://www.apache.org/licenses/LICENSE-2.0
+**
+** Unless required by applicable law or agreed to in writing, software
+** distributed under the License is distributed on an "AS IS" BASIS,
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+** See the License for the specific language governing permissions and
+** limitations under the License.
+*/
+
+#ifndef TOK_H
+#define TOK_H 1
+
+int at_tok_start(char **p_cur);
+int at_tok_nextint(char **p_cur, int *p_out);
+int at_tok_nexthexint(char **p_cur, int *p_out);
+
+int at_tok_nextbool(char **p_cur, char *p_out);
+int at_tok_nextstr(char **p_cur, char **out);
+
+int at_tok_hasmore(char **p_cur);
+
+#endif /*TOK_H */
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/spitest/Makefile b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/spitest/Makefile
index 3eeb858..bdc8164 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/spitest/Makefile
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/spitest/Makefile
@@ -14,7 +14,7 @@
 #EXEC LIB参数,第一行定义LDLIBS用=,不要用+=,应用连接的库都在本Makefile定义
 EXEC2 = test_spidev_used_gpio_ctrl
 OBJS2 = test_spidev_used_gpio_ctrl.o
-LDLIBS = -lpthread
+LDLIBS = -lpthread   -lnvram
 LDLIBS += -lbsp
 #*******************************************************************************
 # targets
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/tsctest/Makefile b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/tsctest/Makefile
old mode 100644
new mode 100755
index 238f106..34f1787
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/tsctest/Makefile
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/tsctest/Makefile
@@ -10,7 +10,7 @@
 CFLAGS += -g -Werror=implicit-function-declaration
 
 
-LDLIBS = -lpthread -lm

+LDLIBS = -lpthread -lm  -lnvram

 #LDLIBS += -lnvram
 LDLIBS += -lbsp -L$(zte_lib_path)/libbsp

 #LDLIBS  += -lsoft_timer -L$(zte_lib_path)/libsoft_timer
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/uarttest/Makefile b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/uarttest/Makefile
index c84068f..e0f79f9 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/uarttest/Makefile
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/uarttest/Makefile
@@ -12,7 +12,7 @@
 CFLAGS += -g -Werror=implicit-function-declaration
 
 
-LDLIBS = -lpthread -lm
+LDLIBS = -lpthread -lm -lnvram
 #LDLIBS += -lnvram
 LDLIBS += -lbsp
 #LDLIBS  += -lsoft_timer -L$(zte_lib_path)/libsoft_timer
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/usbtest/usbtest.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/usbtest/usbtest.c
index bf9ec36..4c363ff 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/usbtest/usbtest.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/usbtest/usbtest.c
@@ -398,7 +398,7 @@
 	

 	printf("Get param:%s \n", ((set_flag == 0)  ?  "ecm" : "rndis"));

 	if(set_flag){

-		nv_set_item(NV_RO, STR_FORCE_NETCARD_TYPE, "force_rndis", 1);		

+		//nv_set_item(NV_RO, STR_FORCE_NETCARD_TYPE, "force_rndis", 1);		

 		sc_usb_set_net_rndis();

 		sleep(2);

 		ret = sc_usb_get_netname(read_buf, BUF_LEN);

@@ -416,7 +416,7 @@
 		goto end;

 		

 	}else{		

-		nv_set_item(NV_RO, STR_FORCE_NETCARD_TYPE, "force_ecm", 1);

+		//nv_set_item(NV_RO, STR_FORCE_NETCARD_TYPE, "force_ecm", 1);

 		sc_usb_set_net_ecm();

 		sleep(2);

 		ret = sc_usb_get_netname(read_buf, BUF_LEN);

@@ -469,6 +469,51 @@
 	

 }

 

+void do_get_hotplug_state(int nargs, char **argv)

+{

+	

+	int ret = 0;

+

+	char read_buf[BUF_LEN] = {0};

+	memset(read_buf, 0, BUF_LEN);	

+	ret = sc_usb_get_hotplug_state(read_buf, BUF_LEN);

+	if(ret < 0){

+		printf("get hotplug state fail,ret:%d \n", ret);

+		return;

+	}

+	ret = strtol(read_buf, NULL, 0);

+

+	printf("usb hotplug state:%d, %s\n", ret, ((ret == 0) ? "plugout" : "plugin"));

+	

+}

+

+void do_force_plug(int nargs, char **argv)

+{

+

+	int ret;

+	int set_flag = 0;

+

+	CHECK(nargs != 2, "Usage: force_plug <cmd>\n",

+		exit(1));

+

+	errno = 0;

+	set_flag =strtol(argv[1], NULL, 0);

+	if(set_flag != 0 && set_flag != 1){

+		printf(" set invalid param, should be 0 or 1\n");

+		exit(1);

+	}

+	

+	printf("Get param:%s \n", (set_flag == 0)  ? "plugout" : "check&plugin");

+	if(set_flag){

+		sc_usb_force_wakeup();

+	}else

+		sc_usb_force_sleep();

+	

+

+	printf("force_plug succeed\n");

+	

+

+}

 

 void do_monitor_usb_plug(int nargs, char **argv)

 {

@@ -554,6 +599,16 @@
 		"get net state.",

 	  NULL, NULL, 0

 	},

+	{ do_force_plug, -1,

+	  "force_plug", "<cmd>\n"

+		"tell ap usb plugout or not.0:plugout;1:check&plugin",

+	  NULL, NULL, 0

+	},

+	{ do_get_hotplug_state, -0, 

+		"get_hotplug_state","\n"

+		"get usb hotplug state.",

+	  NULL, NULL, 0

+	},

 	{ 0, 0, 0, 0, NULL, NULL, 0 }

 };

 

diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/voice_demo/voice_demo.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/voice_demo/voice_demo.c
index 85d18ea..3c0895d 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/voice_demo/voice_demo.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/voice_demo/voice_demo.c
@@ -34,6 +34,10 @@
 #define REQ_GET_VOICE_DEVICE_MODE     "get_voice_device_mode"

 #define REQ_SET_RX_VOICE_VOL          "set_rx_voice_vol"

 #define REQ_GET_RX_VOICE_VOL          "get_rx_voice_vol"

+#define REQ_SET_RX_VOICE_GAIN_VOL     "set_rx_voice_gain_vol"

+#define REQ_GET_RX_VOICE_GAIN_VOL     "get_rx_voice_gain_vol"

+#define REQ_SET_TX_VOICE_GAIN_VOL     "set_tx_voice_gain_vol"

+#define REQ_GET_TX_VOICE_GAIN_VOL     "get_tx_voice_gain_vol"

 #define REQ_SET_TX_VOICE_VOL          "set_tx_voice_vol"

 #define REQ_GET_TX_VOICE_VOL          "get_tx_voice_vol"

 #define REQ_SET_TX_VOICE_MUTE_STATE   "set_tx_voice_mute_state"

@@ -73,6 +77,8 @@
     

     printf("set_voice_device_mode <value>           value: 0-handset, 1-speaker, 2-headset\n");

     printf("set_rx_voice_vol <value>                value: 0~5, corresponds to 0~5 level\n");

+    printf("set_rx_voice_gain_vol <value>           value: -15~24, corresponds to -15~24 dB\n");

+    printf("set_tx_voice_gain_vol <value>           value: -15~24, corresponds to -15~24 dB\n");

     printf("set_tx_voice_vol <value>                value: 0~5, corresponds to 0~5 level\n");

     printf("set_tx_voice_mute_state <value>         value: 0-unmute, 1-mute\n");

     printf("set_rx_voice_mute_state <value>         value: 0-unmute, 1-mute\n");

@@ -91,6 +97,8 @@
     

     printf("get_voice_device_mode                   no value input\n");

     printf("get_rx_voice_vol                        no value input\n");

+    printf("get_rx_voice_gain_vol                   no value input\n");

+    printf("get_tx_voice_gain_vol                   no value input\n");

     printf("get_tx_voice_vol                        no value input\n");

     printf("get_tx_voice_mute_state                 no value input\n");

     printf("get_rx_voice_mute_state                 no value input\n");

@@ -377,6 +385,35 @@
 	#endif

 

 #endif

+

+    else if(0 == strncmp(data, REQ_SET_RX_VOICE_GAIN_VOL, strlen(REQ_SET_RX_VOICE_GAIN_VOL))){

+        ret = sscanf(cmdstr, "%*s %d", &value);

+        if(1 != ret){

+            printf("value sscanf failed!(%d)\n", ret);

+            return;

+        }

+        printf("%s set value %d\n", data, value);

+        ret = sc_audio_set_rx_voice_vol_gain(value);

+        printf("%s return %d\n", data, ret);

+	}

+    else if(0 == strncmp(data, REQ_GET_RX_VOICE_GAIN_VOL, strlen(REQ_GET_RX_VOICE_GAIN_VOL))){

+		ret = sc_audio_get_rx_voice_vol_gain(p_value);

+        printf("%s return %d\n", data, ret);

+    }

+    else if(0 == strncmp(data, REQ_SET_TX_VOICE_GAIN_VOL, strlen(REQ_SET_TX_VOICE_GAIN_VOL))){

+        ret = sscanf(cmdstr, "%*s %d", &value);

+        if(1 != ret){

+            printf("value sscanf failed!(%d)\n", ret);

+            return;

+        }

+        printf("%s set value %d\n", data, value);

+        ret = sc_audio_set_tx_voice_vol_gain(value);

+        printf("%s return %d\n", data, ret);

+	}

+    else if(0 == strncmp(data, REQ_GET_TX_VOICE_GAIN_VOL, strlen(REQ_GET_TX_VOICE_GAIN_VOL))){

+		ret = sc_audio_get_tx_voice_vol_gain(p_value);

+        printf("%s return %d\n", data, ret);

+    }

     else{

 		printf("Request unknow.\n");

         printUsage(cmdstr);

diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/wifi_demo/sc_apstation.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/wifi_demo/sc_apstation.c
index 0157c5d..1f745c5 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/wifi_demo/sc_apstation.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/wifi_demo/sc_apstation.c
@@ -32,13 +32,21 @@
  sc_wifi_ap_status_e pre_status,

  sc_wifi_ap_status_t *p_msg)

 {

-	printf("[apsta_demo]user_ap_status_cb:%d,%d,%s,%d\n", index, pre_status, p_msg->ifname, p_msg->status);

+	printf("[apsta_demo]user_ap_status_cb:%d,%d,%s,%d,%s\n", index, pre_status, p_msg->ifname, p_msg->status, p_msg->bssid);

 }

 

 static void user_ap_sta_conn_status_cb(sc_wifi_ap_index_e index,

  sc_wifi_sta_connect_status_t *p_msg)

 {

-	printf("[apsta_demo]user_ap_sta_conn_status_cb:%d,%d,%s\n", index, p_msg->is_connected, p_msg->macaddr);

+	char hostname[32] = {0};

+	int ret = 0;

+	

+	sc_wifi_get_hostname_by_mac(p_msg->macaddr, hostname, sizeof(hostname));

+	if (ret == 0) {

+		printf("[wifi_demo]sta ip not assigned, try again later!\n");

+	}

+

+	printf("[apsta_demo]user_ap_sta_conn_status_cb:%d,%d,%s,%s\n", index, p_msg->is_connected, p_msg->macaddr, hostname);

 } 

 

 static void print_sta_status(sc_wifi_sta_status_t *p_msg)

@@ -84,8 +92,9 @@
 		return;

 	}

 	for (i = 0; i < p_msg->cnt; i++) {

-		printf("[apsta_demo]ap[%d]:%s,%d,%d,%d,%s,%d\n", i, p_msg->info[i].essid, p_msg->info[i].auth, 

-			p_msg->info[i].cipher, p_msg->info[i].channel, p_msg->info[i].bssid, p_msg->info[i].signal_level);

+		printf("[apsta_demo]ap[%d]:%s,%d,%d,%d,%s,%d,%d,%d\n", i, p_msg->info[i].essid, p_msg->info[i].auth, 

+			p_msg->info[i].cipher, p_msg->info[i].channel, p_msg->info[i].bssid, p_msg->info[i].signal_level, 

+			p_msg->info[i].frequency, p_msg->info[i].signal);

 	}

 }

 

diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/wifi_demo/sc_wifi_main.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/wifi_demo/sc_wifi_main.c
index aa7a952..d3052ca 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/wifi_demo/sc_wifi_main.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/wifi_demo/sc_wifi_main.c
@@ -81,13 +81,20 @@
  sc_wifi_ap_status_e pre_status,

  sc_wifi_ap_status_t *p_msg)

 {

-	printf("[wifi_demo]user_ap_status_cb:%d,%d,%s,%d\n", index, pre_status, p_msg->ifname, p_msg->status);

+	printf("[wifi_demo]user_ap_status_cb:%d,%d,%s,%d,%s\n", index, pre_status, p_msg->ifname, p_msg->status, p_msg->bssid);

 }

 

 static void user_ap_sta_conn_status_cb(sc_wifi_ap_index_e index,

  sc_wifi_sta_connect_status_t *p_msg)

 {

-	printf("[wifi_demo]user_ap_sta_conn_status_cb:%d,%d,%s\n", index, p_msg->is_connected, p_msg->macaddr);

+	char hostname[32] = {0};

+	int ret = 0;

+

+	ret = sc_wifi_get_hostname_by_mac(p_msg->macaddr, hostname, sizeof(hostname));

+	if (ret == 0) {

+		printf("[wifi_demo]sta ip not assigned, try again later!\n");

+	}

+	printf("[wifi_demo]user_ap_sta_conn_status_cb:%d,%d,%s,%s\n", index, p_msg->is_connected, p_msg->macaddr,hostname);

 } 

 

 static void print_sta_status(sc_wifi_sta_status_t *p_msg)

@@ -133,8 +140,9 @@
 		return;

 	}

 	for (i = 0; i < p_msg->cnt; i++) {

-		printf("[wifi_demo]ap[%d]:%s,%d,%d,%d,%s,%d\n", i, p_msg->info[i].essid, p_msg->info[i].auth, 

-			p_msg->info[i].cipher, p_msg->info[i].channel, p_msg->info[i].bssid, p_msg->info[i].signal_level);

+		printf("[wifi_demo]ap[%d]:%s,%d,%d,%d,%s,%d,%d,%d\n", i, p_msg->info[i].essid, p_msg->info[i].auth, 

+			p_msg->info[i].cipher, p_msg->info[i].channel, p_msg->info[i].bssid, p_msg->info[i].signal_level, 

+			p_msg->info[i].frequency, p_msg->info[i].signal);

 	}

 }

 

@@ -305,6 +313,7 @@
 			"mode:%d\nbw:%d\n"

 			"cc:%s\nch:%d\n"

 			"auth:%d\npw:%s\n"

+			"wpapsk:%d\nrekey:%d\n"

 			"access_num:%d\n"

 			"rule:%d\nmac:%s\n", 

 			id, ret, 

@@ -312,6 +321,7 @@
 			param.mode, param.bandwidth,

 			param.countrycode, param.channel,

 			param.auth.auth, param.auth.passwd,

+			param.auth.pairwise, param.auth.group_rekey,

 			param.max_sta_num, 

 			param.acl_rule, param.mac_list);

 	}

@@ -338,7 +348,7 @@
 		data = cmdstr + strlen("ap_status_get");

 		sscanf(data, "%d", &id);

 		ret = sc_wifi_ap_get_status(id, &stat);

-		printf("[wifi_demo]ap_status_get[%d] [%s, %d] ret=%d\n", id, stat.ifname, stat.status, ret);

+		printf("[wifi_demo]ap_status_get[%d] [%s, %d, %s] ret=%d\n", id, stat.ifname, stat.status, stat.bssid, ret);

 	}

 	//station

 	else if(0 == strncmp(data, "sta_param_set", strlen("sta_param_set"))) {

diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/LICENSE.txt b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/LICENSE.txt
new file mode 100755
index 0000000..d159169
--- /dev/null
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/LICENSE.txt
@@ -0,0 +1,339 @@
+                    GNU GENERAL PUBLIC LICENSE
+                       Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+                            Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users.  This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it.  (Some other Free Software Foundation software is covered by
+the GNU Lesser General Public License instead.)  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+  To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have.  You must make sure that they, too, receive or can get the
+source code.  And you must show them these terms so they know their
+rights.
+
+  We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+  Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software.  If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+  Finally, any free program is threatened constantly by software
+patents.  We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary.  To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+
+                    GNU GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License.  The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language.  (Hereinafter, translation is included without limitation in
+the term "modification".)  Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+  1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+  2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) You must cause the modified files to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    b) You must cause any work that you distribute or publish, that in
+    whole or in part contains or is derived from the Program or any
+    part thereof, to be licensed as a whole at no charge to all third
+    parties under the terms of this License.
+
+    c) If the modified program normally reads commands interactively
+    when run, you must cause it, when started running for such
+    interactive use in the most ordinary way, to print or display an
+    announcement including an appropriate copyright notice and a
+    notice that there is no warranty (or else, saying that you provide
+    a warranty) and that users may redistribute the program under
+    these conditions, and telling the user how to view a copy of this
+    License.  (Exception: if the Program itself is interactive but
+    does not normally print such an announcement, your work based on
+    the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+    a) Accompany it with the complete corresponding machine-readable
+    source code, which must be distributed under the terms of Sections
+    1 and 2 above on a medium customarily used for software interchange; or,
+
+    b) Accompany it with a written offer, valid for at least three
+    years, to give any third party, for a charge no more than your
+    cost of physically performing source distribution, a complete
+    machine-readable copy of the corresponding source code, to be
+    distributed under the terms of Sections 1 and 2 above on a medium
+    customarily used for software interchange; or,
+
+    c) Accompany it with the information you received as to the offer
+    to distribute corresponding source code.  (This alternative is
+    allowed only for noncommercial distribution and only if you
+    received the program in object code or executable form with such
+    an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it.  For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable.  However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+  4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License.  Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+  5. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Program or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+  6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+  7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+  8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded.  In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+  9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time.  Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation.  If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+  10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission.  For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this.  Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+                            NO WARRANTY
+
+  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+                     END OF TERMS AND CONDITIONS
+
+            How to Apply These Terms to Your New Programs
+
+  If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+  To do so, attach the following notices to the program.  It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the program's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License along
+    with this program; if not, write to the Free Software Foundation, Inc.,
+    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+    Gnomovision version 69, Copyright (C) year name of author
+    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+    This is free software, and you are welcome to redistribute it
+    under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License.  Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+  `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+  <signature of Ty Coon>, 1 April 1989
+  Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs.  If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library.  If this is what you want to do, use the GNU Lesser General
+Public License instead of this License.
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/Makefile b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/Makefile
new file mode 100755
index 0000000..8841f8b
--- /dev/null
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/Makefile
@@ -0,0 +1,41 @@
+# Makefile for custom apps to include in the image
+# Pseudo targets:
+#
+# - clean: remove all build aterfacts
+#
+# - all: build the init executable
+#
+# - run: try and cross-run init on host through QEMU
+#
+# Default is 'all'
+
+.PHONY: all install clean
+
+all: test_n2038 test_y2038
+test_y2038: $(patsubst %.c,%.64.o,$(wildcard *.c))
+	@echo "LD64  $^"
+	$(CC) $(LDFLAGS) -o test_y2038 $^ -lrt -lpthread
+
+test_n2038: $(patsubst %.c,%.32.o,$(wildcard *.c))
+	@echo "LD32  $^"
+	$(CC) $(LDFLAGS) -o test_n2038 $^ -lrt -lpthread
+
+%.64.o: %.c %.64.d
+	@echo "CC64  $<"
+	@$(CC) $(CFLAGS) -c -save-temps -o $@ -D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64 $<
+
+%.64.d: %.c
+	@$(CC) $(CFLAGS) -M -save-temps -o $@ -D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64 $<
+%.32.o: %.c %.32.d
+	@echo "CC32  $<"
+	@$(CC) $(CFLAGS) -c -o $@ -D_FILE_OFFSET_BITS=64 $<
+
+%.32.d: %.c
+	@$(CC) $(CFLAGS) -M -o $@ $<
+
+install: all
+	install -m 755 test_n2038 $(INSTALL_DIR)
+	install -m 755 test_y2038 $(INSTALL_DIR)
+
+clean:
+	rm -f test_[ny]2038 *.o *.d *.i *.s
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/README.md b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/README.md
new file mode 100755
index 0000000..95684a3
--- /dev/null
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/README.md
@@ -0,0 +1,17 @@
+# y2038tests - Are now regarded to be obsolete and not supported!
+
+**Please use the meta-y2038 with ptest to run time related tests from glibc on your target during
+integration**
+
+More information:
+https://github.com/lmajewski/meta-y2038/blob/master/README#L201
+
+
+# The y2038 tests description:
+Test for y2038 development (testing kernel syscalls)
+
+This repository contains extracted from y20380_sandbox tests for Y2038 syscalls compliance.
+
+Those corresponds to sandbox-devel-11.02.2019 branch from github.com/lmajewski/y2038_sandbox
+
+Storing those tests as a separate repo will facilitate re-use of it in e.g. OE/Yocto meta layers
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/id_glibc.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/id_glibc.c
new file mode 100755
index 0000000..a637582
--- /dev/null
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/id_glibc.c
@@ -0,0 +1,45 @@
+#include "id_kernel.h"
+#include <stdio.h>
+#include <unistd.h>
+#include <errno.h>
+#include <string.h>
+#include <stdlib.h>
+
+int print_glibc_version(void)
+{
+  char *confbuf;
+  unsigned int conflen;
+
+  conflen = confstr(  _CS_GNU_LIBC_VERSION, NULL, 0);
+  if (!conflen)
+  {
+	  printf("confstr(_CS_GNU_LIBC_VERSION, NULL, 0) failed with error %d (%s)\n", errno, strerror(errno));
+	  return 1;
+  }
+
+
+  conflen = confstr(  _CS_GNU_LIBC_VERSION, NULL, 0);
+  if (!conflen)
+  {
+	  printf("confstr(_CS_GNU_LIBC_VERSION, NULL, 0) failed with error %d (%s)\n", errno, strerror(errno));
+	  return 1;
+  }
+
+  confbuf = malloc(conflen);
+  if (!confbuf)
+  {
+	  printf("malloc(%d) failed with error %d (%s)\n", conflen, errno, strerror(errno));
+	  return 1;
+  }
+
+  if (conflen != confstr(  _CS_GNU_LIBC_VERSION, confbuf, conflen))
+  {
+	  printf("confstr(_CS_GNU_LIBC_VERSION, %p, %d) failed with error %d (%s)\n", confbuf, conflen, errno, strerror(errno));
+	  return 1;
+  }
+
+  printf("confstr() result:\n");
+  printf("- LIBC version: %s\n", confbuf);
+  return 0;
+}
+
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/id_glibc.h b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/id_glibc.h
new file mode 100755
index 0000000..ab77b2a
--- /dev/null
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/id_glibc.h
@@ -0,0 +1,6 @@
+#ifndef __ID_GLIBC_H_
+#define __ID_GLIBC_H_
+
+int print_glibc_version(void);
+
+#endif /* __ID_GLIBC_H_ */
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/id_kernel.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/id_kernel.c
new file mode 100755
index 0000000..488ce0f
--- /dev/null
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/id_kernel.c
@@ -0,0 +1,60 @@
+#include "id_kernel.h"
+#include <stdio.h>
+#include <sys/utsname.h>
+#include <errno.h>
+#include <string.h>
+#include <time.h>
+#include <unistd.h>
+
+int print_kernel_version(void)
+{
+  struct utsname utsname;
+  if (uname(&utsname) < 0)
+  {
+	  printf("uname() failed with error %d (%s)\n", errno, strerror(errno));
+	  return 1;
+  }
+  printf("uname() result:\n");
+  printf("- sysname      : %s\n", utsname.sysname);
+  printf("- nodename     : %s\n", utsname.nodename);
+  printf("- release      : %s\n", utsname.release);
+  printf("- version      : %s\n", utsname.version);
+  printf("- machine      : %s\n", utsname.machine);
+  return 0;
+}
+
+int check_kernel_timekeeping(void)
+{
+  int result;
+  // Set time to half a second before Y2038 or fail
+  struct timespec tv = { 0x7FFFFFFF, 500000000 };
+  result = clock_settime(CLOCK_REALTIME, &tv);
+  if (!result)
+  {
+    // Wait a second
+    usleep(1000000);
+    // Read back time or fail
+    memset(&tv, 0, sizeof(tv));
+    result = clock_gettime(CLOCK_REALTIME, &tv);
+    if (!result)
+    {
+      // Fail iff time in seconds now negative.
+      result = (tv.tv_sec < 0) ? 1: 0;
+    }
+  }
+  if (result < 0)
+  {
+    printf("\n");
+    printf("**********************************************\n");
+    printf("** Kernel timekeeping could not be verified **\n");
+    printf("**********************************************\n");
+  }
+  else if (result > 0)
+  {
+    printf("\n");
+    printf("**********************************************\n");
+    printf("** Kernel timekeeping not Y2038-proof!      **\n");
+    printf("**********************************************\n");
+  }
+  return result;
+}
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/id_kernel.h b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/id_kernel.h
new file mode 100755
index 0000000..1778f4e
--- /dev/null
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/id_kernel.h
@@ -0,0 +1,14 @@
+#ifndef __ID_KERNEL_H_
+#define __ID_KERNEL_H_
+
+/**
+ * Print the kernel version
+ *
+ * @return 0 if OK
+ */
+
+int print_kernel_version(void);
+
+int check_kernel_timekeeping(void);
+
+#endif /* __ID_KERNEL_H_ */
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/main.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/main.c
new file mode 100755
index 0000000..d601946
--- /dev/null
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/main.c
@@ -0,0 +1,111 @@
+#include <stdio.h>
+#include <time.h>
+#include <stdarg.h>
+#include "id_kernel.h"
+#include "id_glibc.h"
+
+#include "tests.h"
+
+#include "test_clock_gettime_settime.h"
+#include "test_ctime.h"
+#include "test_difftime.h"
+#include "test_gmtime.h"
+#include "test_gmtime_r.h"
+#include "test_mktime.h"
+#include "test_ctime_r.h"
+#include "test_timegm.h"
+#include "test_clock_nanosleep.h"
+#include "test_timespec_get.h"
+#include "test_futimens.h"
+#include "test_futimes.h"
+#include "test_utimensat.h"
+#include "test_timer_gettime_settime.h"
+#include "test_timerfd_gettime_settime.h"
+#include "test_stat.h"
+#include "test_fstat.h"
+#include "test_lstat.h"
+#include "test_fstatat.h"
+#include "test_time.h"
+#include "test_gettimeofday_settimeofday.h"
+#include "test_mq_timedreceive.h"
+#include "test_mq_timedsend.h"
+#include "test_msgctl.h"
+#include "test_sched_rr_get_interval.h"
+#include "test_nanosleep.h"
+#include "test_adjtime.h"
+#include "test_adjtimex.h"
+#include "test_clock_adjtime.h"
+#include "test_utime.h"
+#include "test_set_getitimer.h"
+#include "test_ppoll.h"
+#include "test_recvmmsg.h"
+#include "test_pthread_timedjoin_np.h"
+#include "test_pthread_cond_timedwait.h"
+#include "test_pthread_rwlock_timed.h"
+#include "test_sem_timedwait.h"
+
+# if defined(_TIME_BITS) && _TIME_BITS==64
+ #define _TIME_T_SIZE 8
+#else
+ #define _TIME_T_SIZE 4
+#endif
+
+int main(int argc __attribute__((unused)), char*argv[] __attribute__((unused)))
+{
+  int time_t_size = sizeof(time_t);
+  if (time_t_size != _TIME_T_SIZE)
+  {
+      printf("sizeof(time_t) = %d (expected %d)\n", time_t_size, _TIME_T_SIZE) ;
+      return 1;
+  }
+  int err = print_kernel_version();
+  if (!err) err = print_glibc_version();
+
+  if (err) return 1;
+
+  printf("\n");
+
+  tests_init();
+
+  test_run(test_clock_gettime_settime);
+  test_run(test_difftime);
+  test_run(test_ctime);
+  test_run(test_gmtime);
+  test_run(test_gmtime_r);
+  test_run(test_mktime);
+  test_run(test_ctime_r);
+  test_run(test_timegm);
+  test_run(test_clock_nanosleep);
+  test_run(test_timespec_get);
+  test_run(test_futimens);
+  test_run(test_futimes);
+  test_run(test_utimensat);
+  test_run(test_ppoll);
+  test_run(test_timer_gettime_settime);
+  test_run(test_timerfd_gettime_settime);
+  test_run(test_stat);
+  test_run(test_fstat);
+  test_run(test_lstat);
+  test_run(test_fstatat);
+  test_run(test_time_);
+  test_run(test_gettimeofday_settimeofday);
+  test_run(test_mq_timedreceive);
+  test_run(test_mq_timedsend);
+  test_run(test_msgctl);
+  test_run(test_sched_rr_get_interval);
+  test_run(test_nanosleep);
+  test_run(test_adjtime);
+  test_run(test_adjtimex);
+  test_run(test_clock_adjtime);
+  test_run(test_pthread_timedjoin_np);
+  test_run(test_pthread_cond_timedwait);
+  test_run(test_pthread_rwlock_timed);
+  test_run(test_sem_timedwait);
+  test_run(test_utime);
+  test_run(test_recvmmsg);
+  test_run(test_set_getitimer);
+
+  tests_report();
+
+  return 0;
+}
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_adjtime.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_adjtime.c
new file mode 100755
index 0000000..964780c
--- /dev/null
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_adjtime.c
@@ -0,0 +1,41 @@
+#include <sys/time.h>
+#include <time.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <errno.h>
+#include <string.h>
+
+#include "tests.h"
+
+void test_adjtime(void)
+{
+  struct timespec now, then;
+  struct timeval delta = { 0, 1000 };
+  struct timeval old;
+  int64_t diff;
+  int result;
+
+  test_begin("Get current real time before adjtime()");
+  result = clock_gettime(CLOCK_REALTIME, &then);
+  if (result) test_failure(1, "clock_gettime returned %d", result); else test_success();
+
+  test_begin("Adjusting time forward by 1 ms");
+  result = adjtime(&delta, &old);
+  if (result)
+    test_failure(1, "adjtime returned %d", result);
+  else
+    test_success();
+  
+  test_begin("Get current real time after adjtime()");
+  result = clock_gettime(CLOCK_REALTIME, &now);
+  if (result) test_failure(1, "clock_gettime returned %d", result); else test_success();
+
+  test_begin("Check that adjtime() did not cause more than a few ms adjustment");
+  diff = now.tv_sec-then.tv_sec;
+  diff *= 1000000000;
+  diff += now.tv_nsec-then.tv_nsec;
+  if (diff > 10000000) // 10 ms
+    test_failure(0, "adjtime drifted by %lld, more than 10000000", diff);
+  else
+    test_success();
+}
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_adjtime.h b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_adjtime.h
new file mode 100755
index 0000000..4435903
--- /dev/null
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_adjtime.h
@@ -0,0 +1 @@
+void test_adjtime(void);
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_adjtimex.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_adjtimex.c
new file mode 100755
index 0000000..adf0fa1
--- /dev/null
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_adjtimex.c
@@ -0,0 +1,51 @@
+#include <sys/time.h>
+#include <sys/timex.h>
+#include <time.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <errno.h>
+#include <string.h>
+
+#include "tests.h"
+
+void test_adjtimex(void)
+{
+  struct timespec now, then;
+  struct timex delta;
+  int64_t diff;
+  int result;
+
+  test_begin("Get current real time before adjtimex()");
+  result = clock_gettime(CLOCK_REALTIME, &then);
+  if (result)
+	  test_failure(1, "clock_gettime returned %d", result);
+  else
+	  test_success();
+
+  test_begin("Adjusting time forward by 1 ms");
+  delta.time.tv_sec = 0;
+  delta.time.tv_usec = 1000;
+  delta.modes = ADJ_SETOFFSET;
+
+  result = adjtimex(&delta);
+  if (result == -1)
+    test_failure(1, "adjtimex returned %d", result);
+  else
+    test_success();
+
+  test_begin("Get current real time after adjtimex()");
+  result = clock_gettime(CLOCK_REALTIME, &now);
+  if (result)
+	  test_failure(1, "clock_gettime returned %d", result);
+  else
+	  test_success();
+
+  test_begin("Check that adjtimex() did not cause more than a few ms adjustment");
+  diff = now.tv_sec-then.tv_sec;
+  diff *= 1000000000;
+  diff += now.tv_nsec-then.tv_nsec;
+  if (diff > 10000000) // 10 ms
+    test_failure(0, "adjtimex drifted by %lld, more than 10000000", diff);
+  else
+    test_success();
+}
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_adjtimex.h b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_adjtimex.h
new file mode 100755
index 0000000..da58bf0
--- /dev/null
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_adjtimex.h
@@ -0,0 +1 @@
+void test_adjtimex(void);
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_clock_adjtime.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_clock_adjtime.c
new file mode 100755
index 0000000..4fbcc8a
--- /dev/null
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_clock_adjtime.c
@@ -0,0 +1,51 @@
+#include <sys/time.h>
+#include <sys/timex.h>
+#include <time.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <errno.h>
+#include <string.h>
+
+#include "tests.h"
+
+void test_clock_adjtime(void)
+{
+  struct timespec now, then;
+  struct timex delta;
+  int64_t diff;
+  int result;
+
+  test_begin("Get current real time before clock_adjtime()");
+  result = clock_gettime(CLOCK_REALTIME, &then);
+  if (result)
+	  test_failure(1, "clock_gettime returned %d", result);
+  else
+	  test_success();
+
+  test_begin("Adjusting time forward by 1 ms");
+  delta.time.tv_sec = 0;
+  delta.time.tv_usec = 1000;
+  delta.modes = ADJ_SETOFFSET;
+
+  result = clock_adjtime(CLOCK_REALTIME, &delta);
+  if (result == -1)
+    test_failure(1, "clock_adjtime returned %d", result);
+  else
+    test_success();
+
+  test_begin("Get current real time after clock_adjtime()");
+  result = clock_gettime(CLOCK_REALTIME, &now);
+  if (result)
+	  test_failure(1, "clock_gettime returned %d", result);
+  else
+	  test_success();
+
+  test_begin("Check that clock_adjtime() did not cause more than a few ms adjustment");
+  diff = now.tv_sec-then.tv_sec;
+  diff *= 1000000000;
+  diff += now.tv_nsec-then.tv_nsec;
+  if (diff > 10000000) // 10 ms
+    test_failure(0, "clock_adjtime drifted by %lld, more than 10000000", diff);
+  else
+    test_success();
+}
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_clock_adjtime.h b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_clock_adjtime.h
new file mode 100755
index 0000000..539487f
--- /dev/null
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_clock_adjtime.h
@@ -0,0 +1 @@
+void test_clock_adjtime(void);
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_clock_gettime_settime.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_clock_gettime_settime.c
new file mode 100755
index 0000000..b099ad6
--- /dev/null
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_clock_gettime_settime.c
@@ -0,0 +1,120 @@
+#include <time.h>
+#include <stdio.h>
+#include <errno.h>
+#include <string.h>
+#include <sys/timex.h>
+
+#include "tests.h"
+
+static void test_clock_getres(struct timespec *tv, time_t sec)
+{
+  int result = clock_getres(CLOCK_REALTIME, tv);
+  if (result)
+    test_failure(1, "clock_getres returned %d", result);
+  else if (tv->tv_sec != sec)
+    test_failure(0, "clock_getres returned %lld instead of %lld", (long long) (tv->tv_sec), (long long) sec);
+  else
+    test_success();
+}
+
+static void test_clock_gettime(struct timespec *tv, time_t sec)
+{
+  int result = clock_gettime(CLOCK_REALTIME, tv);
+  if (result)
+    test_failure(1, "clock_gettime returned %d", result);
+  else if (tv->tv_sec != sec)
+    test_failure(0, "clock_gettime returned %lld instead of %lld", (long long) (tv->tv_sec), (long long) sec);
+  else
+    test_success();
+}
+
+static void test_ntp_gettime(time_t sec)
+{
+	struct ntptimeval ntv;
+  int result = ntp_gettime(&ntv);
+  if (result == -1)
+    test_failure(1, "ntp_gettime returned %d", result);
+  else if (ntv.time.tv_sec != sec)
+    test_failure(0, "ntp_gettime returned %lld instead of %lld",
+                 (long long) (ntv.time.tv_sec), (long long) sec);
+  else
+    test_success();
+}
+
+static void test_ntp_gettimex(time_t sec)
+{
+	struct ntptimeval ntv;
+  int result = ntp_gettimex(&ntv);
+  if (result == -1)
+    test_failure(1, "ntp_gettimex returned %d", result);
+  else if (ntv.time.tv_sec != sec)
+    test_failure(0, "ntp_gettimex returned %lld instead of %lld",
+                 (long long) (ntv.time.tv_sec), (long long) sec);
+  else
+    test_success();
+}
+
+static int test_clock_settime(struct timespec *tv)
+{
+  int result = clock_settime(CLOCK_REALTIME, tv);
+  if (result)
+    test_failure(1, "clock_settime returned %d", result);
+  else
+    test_success();
+  return result;
+}
+
+void test_clock_gettime_settime(void)
+{
+  struct timespec tv0, tv;
+
+  test_begin("Get clock real time");
+  memset(&tv0, 0x55, sizeof(tv0));
+  int result = clock_gettime(CLOCK_REALTIME, &tv0);
+  if (result) test_failure(1, "clock_gettime returned %d", result); else test_success();
+
+  test_begin("Get clock resolution");
+  tv.tv_sec = 0;
+  tv.tv_nsec = 0;
+  test_clock_getres(&tv, 0);
+
+  test_begin("Set clock real time to Y2038 minus 60 seconds");
+  tv.tv_sec = 0x7FFFFFFF;
+  tv.tv_sec -= 59;
+  tv.tv_nsec = 0;
+  result = test_clock_settime(&tv);
+  
+  if (result == 0)
+  {
+    test_begin("Get clock real time");
+    test_clock_gettime(&tv, tv.tv_sec);
+
+    test_begin("Get clock real time via NTP (ntp_gettime)");
+    test_ntp_gettime(tv.tv_sec);
+
+    test_begin("Get clock real time via NTP (ntp_gettimex)");
+    test_ntp_gettimex(tv.tv_sec);
+  }
+
+  test_begin("Set clock real time to Y2038 plus 60 seconds");
+  tv.tv_sec = 0x7FFFFFFF;
+  tv.tv_sec += 61;
+  tv.tv_nsec = 0;
+  result = test_clock_settime(&tv);
+
+  if (result == 0)
+  {
+    test_begin("Get clock real time");
+    test_clock_gettime(&tv, tv.tv_sec);
+
+    test_begin("Get clock real time via NTP (ntp_gettime)");
+    test_ntp_gettime(tv.tv_sec);
+
+    test_begin("Get clock real time via NTP (ntp_gettimex)");
+    test_ntp_gettimex(tv.tv_sec);
+  }
+
+  test_begin("Restore clock real time");
+  result = clock_settime(CLOCK_REALTIME, &tv0);
+  if (result) test_failure(1, "closk_settime returned %d", result); else test_success();
+}
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_clock_gettime_settime.h b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_clock_gettime_settime.h
new file mode 100755
index 0000000..aaa7ac3
--- /dev/null
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_clock_gettime_settime.h
@@ -0,0 +1 @@
+void test_clock_gettime_settime(void);
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_clock_nanosleep.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_clock_nanosleep.c
new file mode 100755
index 0000000..3ed5181
--- /dev/null
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_clock_nanosleep.c
@@ -0,0 +1,34 @@
+#include <time.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <errno.h>
+#include <string.h>
+
+#include "tests.h"
+
+void test_clock_nanosleep(void)
+{
+  struct timespec now, then, duration = { 1, 0 };
+  time_t diff;
+  int result;
+
+  test_begin("Get current real time before clock_nanosleep()");
+  result = clock_gettime(CLOCK_REALTIME, &then);
+  if (result) test_failure(1, "clock_gettime returned %d", result); else test_success();
+  
+  test_begin("Call clock_nanosleep() for 1 second");
+  result = clock_nanosleep(CLOCK_REALTIME, 0 /* relative */,
+    &duration, NULL);
+  if (result) test_failure(1, "clock_nanosleep returned %d", result); else test_success();
+
+  test_begin("Get current real time after clock_nanosleep()");
+  result = clock_gettime(CLOCK_REALTIME, &now);
+  if (result) test_failure(1, "clock_gettime returned %d", result); else test_success();
+
+  test_begin("Check that clock_nanosleep() lasted about 1 second");
+  diff = now.tv_sec-then.tv_sec;
+  diff *= 1000000000;
+  diff += now.tv_nsec-then.tv_nsec;
+  diff = abs(diff - 1000000000); /* how far from 1 second? */
+  if (diff > 100000000) test_failure(0, "clock_nanosleep error is %lld, more than 100000000", (long long) diff); else test_success();
+}
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_clock_nanosleep.h b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_clock_nanosleep.h
new file mode 100755
index 0000000..272337f
--- /dev/null
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_clock_nanosleep.h
@@ -0,0 +1 @@
+void test_clock_nanosleep(void);
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_ctime.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_ctime.c
new file mode 100755
index 0000000..7f1a46d
--- /dev/null
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_ctime.c
@@ -0,0 +1,33 @@
+#include <time.h>
+#include <stdio.h>
+#include <errno.h>
+#include <string.h>
+
+#include "tests.h"
+
+static void test_ctime_call(
+  const time_t *timep,
+  const char *expected_result)
+{
+  const char *result = ctime(timep);
+  if (!result)
+    test_failure(1, "ctime returned NULL");
+  else if (strcmp(result, expected_result))
+    test_failure(0, "ctime returned '%s' instead of '%s'", result, expected_result);
+  else
+    test_success();
+}
+
+void test_ctime(void)
+{
+  time_t t;
+ 
+  test_begin("Check that ctime(\"Thu Jan  1 00:00:00 1970\") == 0");
+  t = 0; test_ctime_call(&t, "Thu Jan  1 00:00:00 1970\n");
+
+  test_begin("Check that ctime(\"Tue Jan 19 03:14:07 2038\") == 0x7FFFFFFF");
+  t = 0x7fffffff; test_ctime_call(&t, "Tue Jan 19 03:14:07 2038\n");
+
+  test_begin("Check that ctime(\"Tue Jan 19 03:14:08 2038\") == 0x80000000");
+  t = 0x7fffffff; t++; test_ctime_call(&t, "Tue Jan 19 03:14:08 2038\n");
+}
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_ctime.h b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_ctime.h
new file mode 100755
index 0000000..121678f
--- /dev/null
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_ctime.h
@@ -0,0 +1 @@
+extern void test_ctime(void);
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_ctime_r.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_ctime_r.c
new file mode 100755
index 0000000..12a9829
--- /dev/null
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_ctime_r.c
@@ -0,0 +1,34 @@
+#include <time.h>
+#include <stdio.h>
+#include <errno.h>
+#include <string.h>
+
+#include "tests.h"
+
+static void test_ctime_r_call(
+  const time_t *timep,
+  const char *expected_result)
+{
+  char buf[26]; // that's the minimum mandated size for a ctime_r buffer
+  const char *result = ctime_r(timep, buf);
+  if (!result)
+    test_failure(1, "ctime_r returned NULL");
+  else if (strcmp(result, expected_result))
+    test_failure(0, "ctime_r returned '%s', expected '%s'", result, expected_result);
+  else
+    test_success();
+}
+
+void test_ctime_r(void)
+{
+  time_t t;
+
+  test_begin("Check that ctime_r(\"Thu Jan  1 00:00:00 1970\") == 0");
+  t = 0; test_ctime_r_call(&t, "Thu Jan  1 00:00:00 1970\n");
+
+  test_begin("Check that ctime_r(\"Tue Jan 19 03:14:07 2038\") == 0x7FFFFFFF");
+  t = 0x7fffffff; test_ctime_r_call(&t, "Tue Jan 19 03:14:07 2038\n");
+
+  test_begin("Check that ctime_r(\"Tue Jan 19 03:14:08 2038\") == 0x80000000");
+  t = 0x7fffffff; t++; test_ctime_r_call(&t, "Tue Jan 19 03:14:08 2038\n");
+}
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_ctime_r.h b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_ctime_r.h
new file mode 100755
index 0000000..b818560
--- /dev/null
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_ctime_r.h
@@ -0,0 +1 @@
+extern void test_ctime_r(void);
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_difftime.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_difftime.c
new file mode 100755
index 0000000..48d8579
--- /dev/null
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_difftime.c
@@ -0,0 +1,41 @@
+#include <time.h>
+#include <stdio.h>
+#include <errno.h>
+#include <string.h>
+
+#include "tests.h"
+
+static void test_difftime_call(
+  time_t time1,
+  time_t time0,
+  double expected_result)
+{
+  double result = difftime(time1, time0);
+  if (result != expected_result)
+    test_failure(0, "difftime(%lld,%lld) returned %g instead of %g", (long long) time1, (long long) time0, result, expected_result);
+  else
+    test_success();
+}
+
+void test_difftime(void)
+{
+  time_t time1, time0;
+
+  test_begin("Check that difftime(+1800, -1800) == 3600");
+  time1 = +1800; time0 = -1800; test_difftime_call(time1, time0, +3600.0);
+
+  test_begin("Check that difftime(-1800, +1800) == -3600");
+  time1 = -1800; time0 = +1800; test_difftime_call(time1, time0, -3600.0);
+
+  test_begin("Check that difftime(Y2038+1799, Y2038-1801) == 3600");
+  time1 = time0 = 0x7FFFFFFF; time1 += 1800; time0 -= 1800; test_difftime_call(time1, time0, +3600.0);
+
+  test_begin("Check that difftime(Y2038+1800, Y2038-1800) == 3600");
+  time1 = time0 = 0x80000000; time1 += 1800; time0 -= 1800; test_difftime_call(time1, time0, +3600.0);
+
+  test_begin("Check that difftime(Y2038-1800, Y2038+1800) == -3600");
+  time1 = time0 = 0x80000000; time1 -= 1800; time0 += 1800; test_difftime_call(time1, time0, -3600.0);
+
+  test_begin("Check that difftime(Y2038-1801, Y2038-1799) == -3600");
+  time1 = time0 = 0x7FFFFFFF; time1 -= 1800; time0 += 1800; test_difftime_call(time1, time0, -3600.0);
+}
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_difftime.h b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_difftime.h
new file mode 100755
index 0000000..4722c3f
--- /dev/null
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_difftime.h
@@ -0,0 +1 @@
+extern void test_difftime(void);
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_fstat.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_fstat.c
new file mode 100755
index 0000000..9a0e639
--- /dev/null
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_fstat.c
@@ -0,0 +1,29 @@
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <errno.h>
+#include <string.h>
+
+#include "tests.h"
+
+static int test_fstat_call(
+  int fd,
+  struct stat *buf)
+{
+  return fstat(fd, buf);
+}
+
+void test_fstat(void)
+{
+  int result;
+  struct stat buf;
+  int fd = open("/etc/init.d/rcS", O_RDONLY);
+
+  test_begin("Call fstat() on /etc/init.d/rcS");
+  result = test_fstat_call(fd, &buf);
+  if (result) test_failure(1, "fstat('/etc/init.d/rcS') returned %d", result); else test_success();
+
+  close(fd);
+}
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_fstat.h b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_fstat.h
new file mode 100755
index 0000000..973a43d
--- /dev/null
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_fstat.h
@@ -0,0 +1 @@
+extern void test_fstat(void);
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_fstatat.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_fstatat.c
new file mode 100755
index 0000000..ab96415
--- /dev/null
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_fstatat.c
@@ -0,0 +1,25 @@
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <errno.h>
+#include <string.h>
+
+#include "tests.h"
+
+static int test_fstatat_call(
+  const char  *pathname,
+  struct stat *buf)
+{
+  return fstatat(0, pathname, buf, 0);
+}
+
+void test_fstatat(void)
+{
+  int result;
+  struct stat buf;
+
+  test_begin("Call fstatat() on /etc/init.d/rcS");
+  result = test_fstatat_call("/etc/init.d/rcS", &buf);
+  if (result) test_failure(1, "fstatat('/etc/init.d/rcS') returned %d", result); else test_success();
+}
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_fstatat.h b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_fstatat.h
new file mode 100755
index 0000000..abfa540
--- /dev/null
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_fstatat.h
@@ -0,0 +1 @@
+extern void test_fstatat(void);
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_futimens.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_futimens.c
new file mode 100755
index 0000000..b3b141f
--- /dev/null
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_futimens.c
@@ -0,0 +1,67 @@
+#include <time.h>
+#include <stdio.h>
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "tests.h"
+
+static void test_futimens_call(const char *name, const struct timespec t[2])
+{
+  int result = 0, fd = open(name, O_CREAT, 0644);
+  if (fd == -1)
+  {
+    test_failure(1, "open('%s', O_CREAT) returned %d", name, fd);
+    return;
+  }
+  int c = close(fd);
+  if (c)
+  {
+    test_failure(1, "close returned %d", c);
+    return;
+  }
+  fd = open(name, O_RDWR);
+  if (fd == -1)
+  {
+    test_failure(1, "open('%s', O_RDWR) returned %d", name, fd);
+    return;
+  }
+  if (t==NULL)
+    test_success();
+  else
+  {
+    result = futimens(fd, t);
+    if (result)
+      test_failure(1, "futimens('%s'...) returned %d", name, result);
+    else
+      test_success();
+  }
+  close(fd);
+}
+
+void test_futimens(void)
+{
+  test_begin("Call futimens(NULL) on /futimens.null");
+  test_futimens_call("/futimens.null", NULL);
+
+  test_begin("Call futimens(Y2038-2, Y2038-1) on /futimens.n2038");
+  const struct timespec t1[2] = { { 0x7FFFFFFE, 0 },  { 0x7FFFFFFF, 0 } };
+  test_futimens_call("/futimens.n2038", t1);
+
+  test_begin("Check stat of /futimens.n2038");
+  struct stat st1;
+  int result = stat("/futimens.n2038", &st1);
+  if (result) test_failure(1, "stat('/futimens.n2038') returned %d", result); else test_success();
+
+  test_begin("Call futimens(Y2038+1, Y2038+2) on /futimens.y2038");
+  const struct timespec t2[2] = { { 0x80000001ull, 0 },  { 0x80000002ull, 0 } };
+  test_futimens_call("/futimens.y2038", t2);
+
+  test_begin("Check stat of /futimens.y2038");
+  struct stat st2;
+  result = stat("/futimens.y2038", &st2);
+  if (result) test_failure(1, "stat('/futimens.y2038') returned %d", result); else test_success();
+}
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_futimens.h b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_futimens.h
new file mode 100755
index 0000000..07c6ea5
--- /dev/null
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_futimens.h
@@ -0,0 +1 @@
+extern void test_futimens(void);
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_futimes.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_futimes.c
new file mode 100755
index 0000000..a295f3e
--- /dev/null
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_futimes.c
@@ -0,0 +1,68 @@
+#include <time.h>
+#include <stdio.h>
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/time.h>
+
+#include "tests.h"
+
+static void test_futimes_call(const char *name, const struct timeval t[2])
+{
+  int result = 0, fd = open(name, O_CREAT, 0644);
+  if (fd == -1)
+  {
+    test_failure(1, "open('%s', O_CREAT) returned %d", name, fd);
+    return;
+  }
+  int c = close(fd);
+  if (c)
+  {
+    test_failure(1, "close returned %d", c);
+    return;
+  }
+  fd = open(name, O_RDWR);
+  if (fd == -1)
+  {
+    test_failure(1, "open('%s', O_RDWR) returned %d", name, fd);
+    return;
+  }
+  if (t==NULL)
+    test_success();
+  else
+  {
+    result = futimes(fd, t);
+    if (result)
+      test_failure(1, "futimes('%s'...) returned %d", name, result);
+    else
+      test_success();
+  }
+  close(fd);
+}
+
+void test_futimes(void)
+{
+  test_begin("Call futimes(NULL) on /futimes.null");
+  test_futimes_call("/futimes.null", NULL);
+
+  test_begin("Call futimes(Y2038-2, Y2038-1) on /futimes.n2038");
+  const struct timeval t1[2] = { { 0x7FFFFFFE, 0 },  { 0x7FFFFFFF, 0 } };
+  test_futimes_call("/futimes.n2038", t1);
+
+  test_begin("Check stat of /futimes.n2038");
+  struct stat st1;
+  int result = stat("/futimes.n2038", &st1);
+  if (result) test_failure(1, "stat('/futimes.n2038') returned %d", result); else test_success();
+
+  test_begin("Call futimes(Y2038+1, Y2038+2) on /futimes.y2038");
+  const struct timeval t2[2] = { { 0x80000001ull, 0 },  { 0x80000002ull, 0 } };
+  test_futimes_call("/futimes.y2038", t2);
+
+  test_begin("Check stat of /futimes.y2038");
+  struct stat st2;
+  result = stat("/futimes.y2038", &st2);
+  if (result) test_failure(1, "stat('/futimes.y2038') returned %d", result); else test_success();
+}
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_futimes.h b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_futimes.h
new file mode 100755
index 0000000..a132cdc
--- /dev/null
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_futimes.h
@@ -0,0 +1 @@
+extern void test_futimes(void);
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_gettimeofday_settimeofday.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_gettimeofday_settimeofday.c
new file mode 100755
index 0000000..4132c37
--- /dev/null
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_gettimeofday_settimeofday.c
@@ -0,0 +1,71 @@
+#include <sys/time.h>
+#include <time.h>
+#include <errno.h>
+#include <string.h>
+#include <string.h>
+#include <stdio.h>
+
+#include "tests.h"
+
+static void test_gettimeofday(const struct timeval *tv)
+{
+  struct timeval t0;
+  int result = gettimeofday(&t0, NULL);
+  if (result)
+  {
+    test_failure(1, "gettimeofday returned %d", result);
+    return;
+  }
+  double d = difftime(t0.tv_sec, tv->tv_sec);
+  if (d < -1.0 || d > 1.0)
+    test_failure(0, "gettimeofday error is %g second, more than one second", d);
+  else
+    test_success();
+}
+
+static int test_settimeofday(const struct timeval *tv)
+{
+  int result = settimeofday(tv, NULL);
+  if (result)
+    test_failure(1, "settimeofday returned %d", result);
+  else
+    test_success();
+  return result;
+}
+
+void test_gettimeofday_settimeofday(void)
+{
+  struct timeval t0, t;
+
+  test_begin("Save current time of day");
+  int result = gettimeofday(&t0, NULL);
+  if (result) test_failure(1, "gettimeofday returned %d", result); else test_success();
+
+  test_begin("Set time of day to Y2038 minus 60 seconds");
+  t.tv_sec = 0x7FFFFFFF;
+  t.tv_sec -= 59;
+  t.tv_usec = 0;
+  test_settimeofday(&t);
+  
+  if (result == 0)
+  {
+    test_begin("Check time of day against Y2038-60s");
+    test_gettimeofday(&t);
+  }
+
+  test_begin("Set time of day to Y2038 plus 60 seconds");
+  t.tv_sec = 0x7FFFFFFF;
+  t.tv_sec += 61;
+  t.tv_usec = 0;
+  result = test_settimeofday(&t);
+
+  if (result == 0)
+  {
+    test_begin("Check time of day against Y2038+60s");
+    test_gettimeofday(&t);
+  }
+
+  test_begin("Restore time of day");
+  result = settimeofday(&t0, NULL);
+  if (result) test_failure(1, "settimeofday returned %d", result); else test_success();
+}
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_gettimeofday_settimeofday.h b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_gettimeofday_settimeofday.h
new file mode 100755
index 0000000..a23186d
--- /dev/null
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_gettimeofday_settimeofday.h
@@ -0,0 +1 @@
+void test_gettimeofday_settimeofday(void);
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_gmtime.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_gmtime.c
new file mode 100755
index 0000000..8c39695
--- /dev/null
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_gmtime.c
@@ -0,0 +1,91 @@
+#include <time.h>
+#include <stdio.h>
+#include <errno.h>
+#include <string.h>
+
+#include "tests.h"
+
+static void test_gmtime_call(
+  const time_t *timep,
+  const struct tm *expected_result)
+{
+  const struct tm *result = gmtime(timep);
+  if (!result)
+  {
+    test_failure(1, "gmtime returned NULL");
+    return;
+  }
+  int failed = 0;
+  if (result->tm_sec != expected_result->tm_sec)
+  {
+    test_failure(0, "gmtime returned tm_sec = %d instead of %d", result->tm_sec, expected_result->tm_sec);
+    failed = 1;
+  }
+  if (result->tm_min != expected_result->tm_min)
+  {
+    test_failure(0, "gmtime returned tm_min = %d instead of %d", result->tm_min, expected_result->tm_min);
+    failed = 1;
+  }
+  if (result->tm_hour != expected_result->tm_hour)
+  {
+    test_failure(0, "gmtime returned tm_hour = %d instead of %d", result->tm_hour, expected_result->tm_hour);
+    failed = 1;
+  }
+  if (result->tm_mday != expected_result->tm_mday)
+  {
+    test_failure(0, "gmtime returned tm_mday = %d instead of %d", result->tm_mday, expected_result->tm_mday);
+    failed = 1;
+  }
+  if (result->tm_mon != expected_result->tm_mon)
+  {
+    test_failure(0, "gmtime returned tm_mon = %d instead of %d", result->tm_mon, expected_result->tm_mon);
+    failed = 1;
+  }
+  if (result->tm_year != expected_result->tm_year)
+  {
+    test_failure(0, "gmtime returned tm_year = %d instead of %d", result->tm_year, expected_result->tm_year);
+    failed = 1;
+  }
+  if (result->tm_wday != expected_result->tm_wday)
+  {
+    test_failure(0, "gmtime returned tm_wday = %d instead of %d", result->tm_wday, expected_result->tm_wday);
+    failed = 1;
+  }
+  if (result->tm_yday != expected_result->tm_yday)
+  {
+    test_failure(0, "gmtime returned tm_yday = %d instead of %d", result->tm_yday, expected_result->tm_yday);
+    failed = 1;
+  }
+  if (result->tm_isdst != expected_result->tm_isdst)
+  {
+    test_failure(0, "gmtime returned tm_isdst = %d instead of %d", result->tm_isdst, expected_result->tm_isdst);
+    failed = 1;
+  }
+  if (!failed) test_success();
+}
+
+void test_gmtime(void)
+{
+  test_begin("Check that gmtime(0) yields 1970-01-01 00:00:00");
+  struct tm tm0 = {.tm_year = 70, .tm_mon = 0, .tm_mday = 1, .tm_hour = 0, .tm_min = 0, .tm_sec = 0, .tm_wday = 4, .tm_yday = 0 };
+  time_t t = 0;
+  test_gmtime_call(&t, &tm0);
+
+  test_begin("Check that gmtime(0x7FFFFFFF) yields 2038-01-19 03:14:07");
+  struct tm tmY2038 = {.tm_year = 138, .tm_mon = 0, .tm_mday = 19, .tm_hour = 3, .tm_min = 14, .tm_sec = 7, .tm_wday = 2, .tm_yday = 18 };
+  t = 0x7fffffff;
+  test_gmtime_call(&t, &tmY2038);
+
+  test_begin("Check that gmtime(0x7FFFFFFF+1) yields 2038-01-19 03:14:08");
+  struct tm tmY2038p = {.tm_year = 138, .tm_mon = 0, .tm_mday = 19, .tm_hour = 3, .tm_min = 14, .tm_sec = 8, .tm_wday = 2, .tm_yday = 18 };
+  t++;
+  test_gmtime_call(&t, &tmY2038p);
+
+  test_begin("Check that gmtime(0x80000000) yields 2038-01-19 03:14:08");
+  t = 0x80000000;
+  test_gmtime_call(&t, &tmY2038p);
+
+  test_begin("Check that gmtime(0x80000000-1) yields 2038-01-19 03:14:08 - 1");
+  t--;
+  test_gmtime_call(&t, &tmY2038);
+}
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_gmtime.h b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_gmtime.h
new file mode 100755
index 0000000..aeb0df6
--- /dev/null
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_gmtime.h
@@ -0,0 +1 @@
+extern void test_gmtime(void);
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_gmtime_r.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_gmtime_r.c
new file mode 100755
index 0000000..d277aee
--- /dev/null
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_gmtime_r.c
@@ -0,0 +1,92 @@
+#include <time.h>
+#include <stdio.h>
+#include <errno.h>
+#include <string.h>
+
+#include "tests.h"
+
+static void test_gmtime_r_call(
+  const time_t *timep,
+  const struct tm *expected_result)
+{
+  struct tm r, *result;
+  result = gmtime_r(timep, &r);
+  if (!result)
+  {
+    test_failure(1, "gmtime returned NULL");
+    return;
+  }
+  int failed = 0;
+  if (result->tm_sec != expected_result->tm_sec)
+  {
+    test_failure(0, "gmtime returned tm_sec = %d instead of %d", result->tm_sec, expected_result->tm_sec);
+    failed = 1;
+  }
+  if (result->tm_min != expected_result->tm_min)
+  {
+    test_failure(0, "gmtime returned tm_min = %d instead of %d", result->tm_min, expected_result->tm_min);
+    failed = 1;
+  }
+  if (result->tm_hour != expected_result->tm_hour)
+  {
+    test_failure(0, "gmtime returned tm_hour = %d instead of %d", result->tm_hour, expected_result->tm_hour);
+    failed = 1;
+  }
+  if (result->tm_mday != expected_result->tm_mday)
+  {
+    test_failure(0, "gmtime returned tm_mday = %d instead of %d", result->tm_mday, expected_result->tm_mday);
+    failed = 1;
+  }
+  if (result->tm_mon != expected_result->tm_mon)
+  {
+    test_failure(0, "gmtime returned tm_mon = %d instead of %d", result->tm_mon, expected_result->tm_mon);
+    failed = 1;
+  }
+  if (result->tm_year != expected_result->tm_year)
+  {
+    test_failure(0, "gmtime returned tm_year = %d instead of %d", result->tm_year, expected_result->tm_year);
+    failed = 1;
+  }
+  if (result->tm_wday != expected_result->tm_wday)
+  {
+    test_failure(0, "gmtime returned tm_wday = %d instead of %d", result->tm_wday, expected_result->tm_wday);
+    failed = 1;
+  }
+  if (result->tm_yday != expected_result->tm_yday)
+  {
+    test_failure(0, "gmtime returned tm_yday = %d instead of %d", result->tm_yday, expected_result->tm_yday);
+    failed = 1;
+  }
+  if (result->tm_isdst != expected_result->tm_isdst)
+  {
+    test_failure(0, "gmtime returned tm_isdst = %d instead of %d", result->tm_isdst, expected_result->tm_isdst);
+    failed = 1;
+  }
+  if (!failed) test_success();
+}
+
+void test_gmtime_r(void)
+{
+  test_begin("Check that gmtime_r(0) yields 1970-01-01 00:00:00");
+  struct tm tm0 = {.tm_year = 70, .tm_mon = 0, .tm_mday = 1, .tm_hour = 0, .tm_min = 0, .tm_sec = 0, .tm_wday = 4, .tm_yday = 0 };
+  time_t t = 0;
+  test_gmtime_r_call(&t, &tm0);
+
+  test_begin("Check that gmtime_r(0x7FFFFFFF) yields 2038-01-19 03:14:07");
+  struct tm tmY2038 = {.tm_year = 138, .tm_mon = 0, .tm_mday = 19, .tm_hour = 3, .tm_min = 14, .tm_sec = 7, .tm_wday = 2, .tm_yday = 18 };
+  t = 0x7fffffff;
+  test_gmtime_r_call(&t, &tmY2038);
+
+  test_begin("Check that gmtime_r(0x7FFFFFFF+1) yields 2038-01-19 03:14:08");
+  struct tm tmY2038p = {.tm_year = 138, .tm_mon = 0, .tm_mday = 19, .tm_hour = 3, .tm_min = 14, .tm_sec = 8, .tm_wday = 2, .tm_yday = 18 };
+  t++;
+  test_gmtime_r_call(&t, &tmY2038p);
+
+  test_begin("Check that gmtime_r(0x80000000) yields 2038-01-19 03:14:08");
+  t = 0x80000000;
+  test_gmtime_r_call(&t, &tmY2038p);
+
+  test_begin("Check that gmtime_r(0x80000000-1) yields 2038-01-19 03:14:07");
+  t--;
+  test_gmtime_r_call(&t, &tmY2038);
+}
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_gmtime_r.h b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_gmtime_r.h
new file mode 100755
index 0000000..438a7da
--- /dev/null
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_gmtime_r.h
@@ -0,0 +1 @@
+extern void test_gmtime_r(void);
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_lstat.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_lstat.c
new file mode 100755
index 0000000..6b583a2
--- /dev/null
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_lstat.c
@@ -0,0 +1,26 @@
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <errno.h>
+#include <string.h>
+
+#include "tests.h"
+
+static int test_lstat_call(
+  const char  *pathname,
+  struct stat *buf)
+{
+  int result = lstat(pathname, buf);
+  return result;
+}
+
+void test_lstat(void)
+{
+  int result;
+  struct stat buf;
+
+  test_begin("Call lstat() on /etc/init.d/rcS");
+  result = test_lstat_call("/etc/init.d/rcS", &buf);
+  if (result) test_failure(1, "lstat('/etc/init.d/rcS') returned %d", result); else test_success();
+}
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_lstat.h b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_lstat.h
new file mode 100755
index 0000000..14cfccf
--- /dev/null
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_lstat.h
@@ -0,0 +1 @@
+extern void test_lstat(void);
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_mktime.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_mktime.c
new file mode 100755
index 0000000..140ac6a
--- /dev/null
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_mktime.c
@@ -0,0 +1,37 @@
+#include <time.h>
+#include <stdio.h>
+#include <errno.h>
+#include <string.h>
+
+#include "tests.h"
+
+static void test_mktime_call(
+  struct tm *tm,
+  time_t expected_result)
+{
+  time_t result = mktime(tm);
+  if (result == -1)
+    test_failure(1, "mktime returned %lld", (long long) result);
+  else if (result != expected_result)
+    test_failure(0, "mktime returned %lld instead of %lld", (long long) result, (long long) expected_result);
+  else
+    test_success();
+}
+
+void test_mktime(void)
+{
+  test_begin("Check that mktime(1970-01-01 00:00:00) returns 0");
+  struct tm tm0 = {.tm_year = 70, .tm_mon = 0, .tm_mday = 1, .tm_hour = 0, .tm_min = 0, .tm_sec = 0, .tm_wday = 4, .tm_yday = 0 };
+  time_t t = 0;
+  test_mktime_call(&tm0, t);
+
+  test_begin("Check that mktime(2038-01-19 03:14:07) returns 0x7FFFFFFF");
+  struct tm tmY2038 = {.tm_year = 138, .tm_mon = 0, .tm_mday = 19, .tm_hour = 3, .tm_min = 14, .tm_sec = 7, .tm_wday = 2, .tm_yday = 18 };
+  t = 0x7fffffff;
+  test_mktime_call(&tmY2038, t);
+
+  test_begin("Check that mktime(2038-01-19 03:14:08) returns 0x80000000");
+  struct tm tmY2038p = {.tm_year = 138, .tm_mon = 0, .tm_mday = 19, .tm_hour = 3, .tm_min = 14, .tm_sec = 8, .tm_wday = 2, .tm_yday = 18 };
+  t++;
+  test_mktime_call(&tmY2038p, t);
+}
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_mktime.h b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_mktime.h
new file mode 100755
index 0000000..767a4ce
--- /dev/null
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_mktime.h
@@ -0,0 +1 @@
+extern void test_mktime(void);
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_mq_timedreceive.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_mq_timedreceive.c
new file mode 100755
index 0000000..6a50deb
--- /dev/null
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_mq_timedreceive.c
@@ -0,0 +1,136 @@
+#include <mqueue.h>
+#include <sys/time.h>
+#include <time.h>
+#include <stdio.h>
+#include <errno.h>
+#include <string.h>
+
+#include "tests.h"
+
+static void test_mq_timedreceive_onqueue(mqd_t q)
+{
+  char msg[8] = "ABCD1234";
+  unsigned int prio;
+
+  test_begin("mq_timedreceive() with a time-out in the past before Y2038");
+  struct timespec ts;
+  int result = timespec_get(&ts, TIME_UTC);
+  if (result != TIME_UTC)
+    test_failure(1, "timespec_get returned %d instead of %d (TIME_UTC)", result, TIME_UTC);
+  else
+  {
+    result = mq_timedreceive(q, msg, sizeof(msg), &prio, &ts);
+    if (result != -1)
+      test_failure(1, "mq_timedreceive returned %d", result);
+    else if (errno != ETIMEDOUT)
+      test_failure(1, "mq_timedreceive did not time out");
+    else
+      test_success();
+  }
+
+  test_begin("mq_timedreceive() with a time-out in the future before Y2038");
+  result = timespec_get(&ts, TIME_UTC);
+  if (result != TIME_UTC)
+    test_failure(1, "timespec_get returned %d instead of %d (TIME_UTC)", result, TIME_UTC);
+  else
+  {
+    ts.tv_sec++;
+    result = mq_timedreceive(q, msg, sizeof(msg), &prio, &ts);
+    if (result != -1)
+      test_failure(1, "mq_timedreceive returned %d", result);
+    else if (errno != ETIMEDOUT)
+      test_failure(1, "mq_timedreceive did not time out");
+    else
+      test_success();
+  }
+
+// Only test this part if we can set the time beyond Y2038
+// i.e. if our time_t is 64-bit
+
+#if defined(__USE_TIME_BITS_64) && __USE_TIME_BITS_64 == 1
+
+  test_begin("Get current time");
+  time_t t0 = time(NULL);
+  if (t0==(time_t)-1)
+  {
+    test_failure(1, "time returned -1");
+    return;
+  }
+  test_success();
+
+  test_begin("Set current time at Y2038+1s");
+  time_t t = 0x80000001;
+  result = stime(&t);
+  if (result)
+  {
+    test_failure(1, "stime returned %d", result);
+    return;
+  }
+  test_success();
+
+  test_begin("mq_timedreceive() with a time-out in the past after Y2038");
+  result = timespec_get(&ts, TIME_UTC);
+  if (result != TIME_UTC)
+    test_failure(1, "timespec_get returned %d instead of %d (TIME_UTC)", result, TIME_UTC);
+  else
+  {
+    result = mq_timedreceive(q, msg, sizeof(msg), &prio, &ts);
+    if (result != -1)
+      test_failure(1, "mq_timedreceive returned %d", result);
+    else if (errno != ETIMEDOUT)
+      test_failure(1, "mq_timedreceive did not time out");
+    else
+      test_success();
+  }
+
+  test_begin("mq_timedreceive() with a time-out in the future after Y2038");
+  result = timespec_get(&ts, TIME_UTC);
+  if (result != TIME_UTC)
+    test_failure(1, "timespec_get returned %d instead of %d (TIME_UTC)", result, TIME_UTC);
+  else
+  {
+    ts.tv_sec++;
+    result = mq_timedreceive(q, msg, sizeof(msg), &prio, &ts);
+    if (result != -1)
+      test_failure(1, "mq_timedreceive returned %d", result);
+    else if (errno != ETIMEDOUT)
+      test_failure(1, "mq_timedreceive did not time out");
+    else
+      test_success();
+  }
+
+  test_begin("Restore current time");
+  result = stime(&t0);
+  if (result) test_failure(1, "stime returned %d", result); else test_success();
+
+#endif
+}
+
+void test_mq_timedreceive(void)
+{
+  test_begin("Create the message queue");
+  struct mq_attr mq_attr = { .mq_maxmsg = 1, .mq_msgsize = 8 };
+  mqd_t q = mq_open("/y2038r", O_RDWR | O_CREAT, 0x777, &mq_attr);
+  if (q == (mqd_t) -1)
+  {
+    test_failure(1, "mq_open returned -1");
+    return;
+  }
+  test_success();
+
+  test_mq_timedreceive_onqueue(q);
+
+  test_begin("Close the message queue");
+  int cq = mq_close(q);
+  if (cq)
+    test_failure(1, "mq_close returned %d", cq);
+  else
+    test_success();
+
+  test_begin("Remove the message queue");
+  int uq = mq_unlink("/y2038r");
+  if (uq)
+    test_failure(1, "mq_unlink returned %d", uq);
+  else
+    test_success();
+}
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_mq_timedreceive.h b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_mq_timedreceive.h
new file mode 100755
index 0000000..7b6f044
--- /dev/null
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_mq_timedreceive.h
@@ -0,0 +1 @@
+extern void test_mq_timedreceive(void);
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_mq_timedsend.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_mq_timedsend.c
new file mode 100755
index 0000000..a8645ca
--- /dev/null
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_mq_timedsend.c
@@ -0,0 +1,144 @@
+#include <mqueue.h>
+#include <sys/time.h>
+#include <time.h>
+#include <stdio.h>
+#include <errno.h>
+#include <string.h>
+
+#include "tests.h"
+
+void test_mq_timedsend_onqueue(mqd_t q)
+{
+  char msg[8] = "ABCD1234";
+
+  test_begin("mq_send() to fill the queue up");
+  int result = mq_send(q, msg, sizeof(msg), 1);
+  if (result) test_failure(1, "mq_send returned %d", q); else test_success();
+
+  test_begin("mq_timedsend() with a time-out in the past before Y2038");
+  struct timespec ts;
+  result = timespec_get(&ts, TIME_UTC);
+  if (result != TIME_UTC)
+    test_failure(0, "timespec_get returned %d instead of %d (TIME_UTC)", result, TIME_UTC);
+  else
+  {
+    result = mq_timedsend(q, msg, sizeof(msg), 1, &ts);
+    if (result != -1)
+      test_failure(1, "mq_timedsend returned %d", result);
+    else if (errno != ETIMEDOUT)
+      test_failure(1, "mq_timedsend did not time out");
+    else
+      test_success();
+  }
+
+  test_begin("mq_timedreceive() with a time-out in the future before Y2038");
+  result = timespec_get(&ts, TIME_UTC);
+  if (result != TIME_UTC)
+    test_failure(1, "timespec_get returned %d instead of %d (TIME_UTC)", result, TIME_UTC);
+  else
+  {
+    ts.tv_sec++;
+    result = mq_timedsend(q, msg, sizeof(msg), 1, &ts);
+    if (result != -1)
+      test_failure(1, "mq_timedsend returned %d", result);
+    else if (errno != ETIMEDOUT)
+      test_failure(1, "mq_timedsend did not time out");
+    else
+      test_success();
+  }
+
+// Only test this part if we can set the time beyond Y2038
+// i.e. if our time_t is 64-bit
+
+#if defined(__USE_TIME_BITS64) && __USE_TIME_BITS64 == 1
+
+  test_begin("Get current time");
+  time_t t0 = time(NULL);
+  if (t0==(time_t)-1)
+  {
+    test_failure(1, "time returned -1");
+    return;
+  }
+  test_success();
+
+  test_begin("Set current time at Y2038+1s");
+  struct timespec t = { 0x80000001, 0};
+  result = clock_settime(CLOCK_REALTIME, &t);
+  if (result)
+  {
+    test_failure(1, "clock_settime returned %d", result);
+    return;
+  }
+  test_success();
+
+  test_begin("mq_timedsend() with a time-out in the past after Y2038");
+  result = timespec_get(&ts, TIME_UTC);
+  if (result != TIME_UTC)
+    test_failure(1, "timespec_get returned %d instead of %d (TIME_UTC)", result, TIME_UTC);
+  else
+  {
+    result = mq_timedsend(q, msg, sizeof(msg), 1, &ts);
+    if (result != -1)
+      test_failure(1, "mq_timedsend returned %d", result);
+    else if (errno != ETIMEDOUT)
+      test_failure(1, "mq_timedsend did not time out");
+    else
+      test_success();
+  }
+
+  test_begin("mq_timedreceive() with a time-out in the future after Y2038");
+  result = timespec_get(&ts, TIME_UTC);
+  if (result != TIME_UTC)
+    test_failure(1, "timespec_get returned %d instead of %d (TIME_UTC)", result, TIME_UTC);
+  else
+  {
+    ts.tv_sec++;
+    result = mq_timedsend(q, msg, sizeof(msg), 1, &ts);
+    if (result != -1)
+      test_failure(1, "mq_timedsend returned %d", result);
+    else if (errno != ETIMEDOUT)
+      test_failure(1, "mq_timedsend did not time out");
+    else
+      test_success();
+  }
+
+  test_begin("Restore current time");
+  struct timespec ts0;
+  ts0.tv_sec = t0;
+  ts0.tv_nsec = 0;
+
+  result = clock_settime(CLOCK_REALTIME, &ts0);
+  if (result)
+    test_failure(1, "clock_settime returned %d", result);
+  else 
+    test_success();
+
+#endif
+}
+
+void test_mq_timedsend(void)
+{
+  test_begin("Create the message queue");
+  struct mq_attr mq_attr = { .mq_maxmsg = 1, .mq_msgsize = 8 };
+  mqd_t q = mq_open("/y2038s", O_RDWR | O_CREAT, 0x777, &mq_attr);
+  if (q == (mqd_t) -1)
+  {
+    test_failure(1, "mq_open returned -1");
+    return;
+  }
+  test_success();
+  test_mq_timedsend_onqueue(q);
+  test_begin("Close the message queue");
+  int cq = mq_close(q);
+  if (cq)
+    test_failure(1, "mq_close returned %d", cq);
+  else
+    test_success();
+
+  test_begin("Remove the message queue");
+  int uq = mq_unlink("/y2038s");
+  if (uq)
+    test_failure(1, "mq_unlink returned %d", uq);
+  else
+    test_success();
+}
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_mq_timedsend.h b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_mq_timedsend.h
new file mode 100755
index 0000000..ae6ee59
--- /dev/null
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_mq_timedsend.h
@@ -0,0 +1 @@
+extern void test_mq_timedsend(void);
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_msgctl.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_msgctl.c
new file mode 100755
index 0000000..154b965
--- /dev/null
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_msgctl.c
@@ -0,0 +1,99 @@
+#include <sys/types.h>
+#include <sys/ipc.h>
+#include <sys/msg.h>
+#include <stdio.h>
+#include <errno.h>
+#include <string.h>
+
+#include "tests.h"
+
+static void test_msgctl_onqueue(int q)
+{
+  typedef struct
+  {
+    long mtype;
+    char mtext[1];
+  } msg_t;
+
+  msg_t msgs = { .mtype = 42, .mtext = { 'X' } };
+  msg_t msgr = { .mtype = -1, .mtext = { 'Z' } };
+
+  test_begin("call msgctl() with a never-used queue");
+  struct msqid_ds stat;
+  int result = msgctl(q, IPC_STAT, &stat);
+  if (result)
+    test_failure(1, "msgctl returned %d", result);
+  else if (stat.msg_stime)
+    test_failure(0, "msgctl: stat.msg_stime = %lld, expected 0", (long long) stat.msg_stime);
+  else if (stat.msg_rtime)
+    test_failure(0, "msgctl: stat.msg_rtime = %lld, expected 0", (long long) stat.msg_rtime);
+  else
+    test_success();
+
+  test_begin("call msgctl() after a single queue write");
+  result = msgsnd(q, &msgs, sizeof(msgs.mtext), IPC_NOWAIT);
+  if (result)
+    test_failure(1, "msgsnd returned %d", result);
+  else
+  {
+    result = msgctl(q, IPC_STAT, &stat);
+    if (result)
+      test_failure(1, "msgctl returned %d", result);
+    else if (stat.msg_stime == 0)
+      test_failure(0, "msgctl: stat.msg_stime = 0, expected nonzero");
+    else if (stat.msg_rtime)
+      test_failure(0, "msgctl: stat.msg_rtime = %lld, expected 0", (long long) stat.msg_rtime);
+    else
+      test_success();
+  }
+
+  test_begin("call msgctl() after a queue write and read");
+  result = msgsnd(q, &msgs, sizeof(msgs.mtext), IPC_NOWAIT);
+  if (result)
+    test_failure(1, "msgsnd returned %d", result);
+  else
+  {
+    result = msgrcv(q, &msgr, sizeof(msgs.mtext), 0, IPC_NOWAIT);
+    if (result < 0)
+      test_failure(1, "msgrcv returned %d", result);
+    else if (result != sizeof(msgs.mtext))
+      test_failure(0, "msgrcv returned %d, expected %d", result, sizeof(msgs.mtext));
+    else
+    {
+      result = msgctl(q, IPC_STAT, &stat);
+      if (result)
+        test_failure(1, "msgctl returned %d", result);
+      else if (stat.msg_stime == 0)
+        test_failure(0, "msgctl: stat.msg_stime = 0, expected nonzero");
+      else if (stat.msg_rtime == 0)
+        test_failure(0, "msgctl: stat.msg_rtime = 0, expected nonzero");
+      else if (msgr.mtype != 42)
+        test_failure(0, "msgctl: msgr.mtype = %ld, expected 42", msgr.mtype);
+      else if (msgr.mtext[0] != 'X')
+        test_failure(0, "msgctl: msgr.mttext = (char)%d, expected 'X'", msgr.mtext[0]);
+      else
+        test_success();
+    }
+  }
+}
+
+void test_msgctl(void)
+{
+  test_begin("Create the SysV message queue for msgctl tests");
+  int q = msgget(IPC_PRIVATE, 0x777);
+  if (q == -1)
+  {
+    test_failure(1, "msgget returned -1");
+    return;
+  }
+  test_success();
+
+  test_msgctl_onqueue(q);
+
+  test_begin("Close the msgctl test SysV message queue");
+  int r = msgctl(q, IPC_RMID, NULL);
+  if (r)
+    test_failure(1, "msgctl returned %d", r);
+  else
+    test_success();
+}
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_msgctl.h b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_msgctl.h
new file mode 100755
index 0000000..aeb9c80
--- /dev/null
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_msgctl.h
@@ -0,0 +1 @@
+extern void test_msgctl(void);
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_nanosleep.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_nanosleep.c
new file mode 100755
index 0000000..8e8de0a
--- /dev/null
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_nanosleep.c
@@ -0,0 +1,33 @@
+#include <time.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <errno.h>
+#include <string.h>
+
+#include "tests.h"
+
+void test_nanosleep(void)
+{
+  struct timespec now, then, duration = { 1, 0 };
+  time_t diff;
+  int result;
+
+  test_begin("Get current real time before nanosleep()");
+  result = clock_gettime(CLOCK_REALTIME, &then);
+  if (result) test_failure(1, "clock_gettime returned %d", result); else test_success();
+  
+  test_begin("Call nanosleep() for 1 second");
+  result = nanosleep(&duration, NULL);
+  if (result) test_failure(1, "nanosleep returned %d", result); else test_success();
+
+  test_begin("Get current real time after nanosleep()");
+  result = clock_gettime(CLOCK_REALTIME, &now);
+  if (result) test_failure(1, "clock_gettime returned %d", result); else test_success();
+
+  test_begin("Check that nanosleep() lasted about 1 second");
+  diff = now.tv_sec-then.tv_sec;
+  diff *= 1000000000;
+  diff += now.tv_nsec-then.tv_nsec;
+  diff = abs(diff - 1000000000); /* how far from 1 second? */
+  if (diff > 100000000) test_failure(0, "nanosleep error %lld is more than 100000000", (long long) diff); else test_success();
+}
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_nanosleep.h b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_nanosleep.h
new file mode 100755
index 0000000..71f8ad9
--- /dev/null
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_nanosleep.h
@@ -0,0 +1 @@
+void test_nanosleep(void);
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_ppoll.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_ppoll.c
new file mode 100755
index 0000000..6646909
--- /dev/null
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_ppoll.c
@@ -0,0 +1,71 @@
+/* ppoll syscall handling test - it only tests the functionality related
+   to struct timespec timeout_ts handling. */
+/* The ppoll() is only provided when _GNU_SOURCE is defined */
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE
+#endif
+#include <time.h>
+#include <errno.h>
+#include <poll.h>
+
+#include "tests.h"
+#define TIMEOUT 3
+#define TEST_DESCR_(TIMEOUT) "Checking ppoll exit after "#TIMEOUT" s"
+#define TEST_DESCR(TIMEOUT) TEST_DESCR_(TIMEOUT)
+
+static void test_ppoll_timeout(struct timespec *tv, int timeout)
+{
+  struct timespec tv0 = { 0, 0 }, tv1 = { 0, 0 };
+  struct pollfd fds = { -1, 0, 0 };   /* Ignore fds - just wait for timeout */
+  int ret;
+
+  /*
+   * NOTE:
+   * The masks for tv_sec ((1ULL << 32) - 1) checking are necessary as
+   * clock_gettime is not yet converted to support 64 bit time ABI.
+   *
+   */
+
+  ret = clock_gettime(CLOCK_REALTIME, &tv0);
+  if (ret)
+	  test_failure(1, "failed to read current time %d!", ret);
+
+  ret = ppoll (&fds, 1, tv, 0);
+  if (ret == 0) {
+	  ret = clock_gettime(CLOCK_REALTIME, &tv1);
+	  if (ret == 0) {
+		  if ((((1ULL << 32) - 1) & tv0.tv_sec) + timeout ==
+		      (((1ULL << 32) - 1) & tv1.tv_sec))
+			  test_success();
+		  else
+			  test_failure(1, "failed to timeout immediately");
+	  } else {
+		  test_failure(1, "failed to read current time %d!", ret);
+	  }
+  } else {
+	  test_failure(1, "failed to timeout immediately %d!", ret);
+  }
+}
+
+void test_ppoll(void)
+{
+  struct timespec tv = { 0, 0 };
+
+  /* Check if ppoll exits immediately */
+  test_begin(TEST_DESCR(0)" (immediate exit)");
+  errno = 0;
+
+  tv.tv_sec = 0;
+  tv.tv_nsec = 0;
+
+  test_ppoll_timeout(&tv, 0);
+
+  /* Check if ppoll exits immediately */
+  test_begin(TEST_DESCR(TIMEOUT));
+  errno = 0;
+
+  tv.tv_sec = TIMEOUT;
+  tv.tv_nsec = 0;
+
+  test_ppoll_timeout(&tv, TIMEOUT);
+}
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_ppoll.h b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_ppoll.h
new file mode 100755
index 0000000..c153396
--- /dev/null
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_ppoll.h
@@ -0,0 +1 @@
+void test_ppoll(void);
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_pthread_cond_timedwait.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_pthread_cond_timedwait.c
new file mode 100755
index 0000000..67d6e40
--- /dev/null
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_pthread_cond_timedwait.c
@@ -0,0 +1,85 @@
+#define _GNU_SOURCE
+#include <time.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <errno.h>
+#include <string.h>
+#include <pthread.h>
+#include <unistd.h>
+
+#include "tests.h"
+
+#define TIMEOUT_INC 2
+#define TEST_DESCR_(TIMEOUT, OP)	  \
+	"Test pthread_cond_"#OP"wait timeout "#TIMEOUT" s"
+#define TEST_DESCR(TIMEOUT, OP) TEST_DESCR_(TIMEOUT, OP)
+
+enum tst_type {
+  TST_COND_TIMED = 1,
+  TST_COND_CLOCK,
+};
+
+struct tst_struct {
+	struct timespec ts;
+	enum tst_type ttype;
+	int ret;
+};
+
+pthread_mutex_t fakeMutex = PTHREAD_MUTEX_INITIALIZER;
+pthread_cond_t fakeCond = PTHREAD_COND_INITIALIZER;
+
+static void *pt_fn(void *param)
+{
+	struct tst_struct *tstr = param;
+
+	pthread_mutex_lock(&fakeMutex);
+	if (tstr->ttype == TST_COND_TIMED)
+		tstr->ret = pthread_cond_timedwait(&fakeCond,
+		                                      &fakeMutex, &tstr->ts);
+	else
+		tstr->ret = pthread_cond_clockwait(&fakeCond, &fakeMutex,
+		                                      CLOCK_REALTIME,
+		                                      &tstr->ts);
+
+	pthread_mutex_unlock(&fakeMutex);
+	pthread_exit(NULL);
+}
+
+static void __test_cond(int tsec_inc, enum tst_type ttype)
+{
+	struct tst_struct tstr;
+  pthread_t t0;
+  int ret;
+
+  ret = clock_gettime(CLOCK_REALTIME, &tstr.ts);
+  if (ret)
+    test_failure(1, "failed to create thread %d!", ret);
+
+  tstr.ts.tv_sec += tsec_inc;
+  tstr.ttype = ttype;
+  tstr.ret = 0;
+
+  ret = pthread_create(&t0, NULL, pt_fn, &tstr);
+  if (ret)
+    test_failure(1, "failed to create thread %d!", ret);
+
+  sleep(3);
+  pthread_join(t0, NULL);
+  if (tstr.ret != ETIMEDOUT)
+    test_failure(1, "failed to join thread %d!", ret);
+
+  test_success();
+}
+
+void test_pthread_cond_timedwait(void)
+{
+  struct timespec ts;
+  pthread_t t0;
+  int ret;
+
+  test_begin(TEST_DESCR(TIMEOUT_INC, timed));
+  __test_cond(TIMEOUT_INC, TST_COND_TIMED);
+
+  test_begin(TEST_DESCR(TIMEOUT_INC, clock));
+  __test_cond(TIMEOUT_INC, TST_COND_CLOCK);
+}
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_pthread_cond_timedwait.h b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_pthread_cond_timedwait.h
new file mode 100755
index 0000000..e4e3076
--- /dev/null
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_pthread_cond_timedwait.h
@@ -0,0 +1 @@
+void test_pthread_cond_timedwait(void);
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_pthread_rwlock_timed.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_pthread_rwlock_timed.c
new file mode 100755
index 0000000..1940355
--- /dev/null
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_pthread_rwlock_timed.c
@@ -0,0 +1,89 @@
+#define _GNU_SOURCE
+#include <time.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <errno.h>
+#include <string.h>
+#include <pthread.h>
+#include <unistd.h>
+
+#include "tests.h"
+
+#define TIMEOUT_INC 2
+#define TEST_DESCR_(TIMEOUT, OP)	  \
+	"Test pthread_rwlock_"#OP"{rd|rw}lock timeout "#TIMEOUT" s"
+#define TEST_DESCR(TIMEOUT, OP) TEST_DESCR_(TIMEOUT, OP)
+
+enum tst_type {
+  TST_COND_TIMED = 1,
+  TST_COND_CLOCK,
+};
+
+struct tst_struct {
+  struct timespec ts;
+  enum tst_type ttype;
+  int ret;
+};
+
+pthread_rwlock_t rwlock;
+
+static void *pt_fn(void *param)
+{
+  struct tst_struct *tstr = param;
+
+  if (tstr->ttype == TST_COND_TIMED)
+    tstr->ret = pthread_rwlock_timedwrlock(&rwlock, &tstr->ts);
+  else
+    tstr->ret = pthread_rwlock_clockwrlock(&rwlock, CLOCK_REALTIME,
+					   &tstr->ts);
+
+  pthread_rwlock_destroy(&rwlock);
+  pthread_exit(NULL);
+}
+
+static void __test_cond(int tsec_inc, enum tst_type ttype)
+{
+  struct tst_struct tstr;
+  pthread_t t0;
+  int ret;
+
+  ret = pthread_rwlock_init(&rwlock, NULL);
+  if (ret)
+    test_failure(1, "failed to initialize rwlock %d!", ret);
+
+  ret = pthread_rwlock_wrlock(&rwlock);
+  if (ret)
+    test_failure(1, "failed to get wrlock %d!", ret);
+
+  ret = clock_gettime(CLOCK_REALTIME, &tstr.ts);
+  if (ret)
+    test_failure(1, "failed to create thread %d!", ret);
+
+  tstr.ts.tv_sec += tsec_inc;
+  tstr.ttype = ttype;
+  tstr.ret = 0;
+
+  ret = pthread_create(&t0, NULL, pt_fn, &tstr);
+  if (ret)
+    test_failure(1, "failed to create thread %d!", ret);
+
+  sleep(3);
+  pthread_join(t0, NULL);
+  if (tstr.ret != ETIMEDOUT)
+    test_failure(1, "failed to join thread %d!", ret);
+
+  test_success();
+}
+
+void test_pthread_rwlock_timed(void)
+{
+  struct timespec ts;
+  pthread_t t0;
+  int ret;
+
+  test_begin(TEST_DESCR(TIMEOUT_INC, timed));
+  __test_cond(TIMEOUT_INC, TST_COND_TIMED);
+
+  test_begin(TEST_DESCR(TIMEOUT_INC, clock));
+  __test_cond(TIMEOUT_INC, TST_COND_CLOCK);
+}
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_pthread_rwlock_timed.h b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_pthread_rwlock_timed.h
new file mode 100755
index 0000000..6c0e8b0
--- /dev/null
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_pthread_rwlock_timed.h
@@ -0,0 +1 @@
+void test_pthread_rwlock_timed(void);
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_pthread_timedjoin_np.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_pthread_timedjoin_np.c
new file mode 100755
index 0000000..b52dbed
--- /dev/null
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_pthread_timedjoin_np.c
@@ -0,0 +1,69 @@
+#define _GNU_SOURCE
+#include <time.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <errno.h>
+#include <string.h>
+#include <pthread.h>
+#include <unistd.h>
+
+#include "tests.h"
+
+#define TIMEOUT_INC 2
+#define TEST_DESCR_(TIMEOUT, OP)	  \
+	"Test pthread_"#OP"join_np timeout "#TIMEOUT" s"
+#define TEST_DESCR(TIMEOUT, OP) TEST_DESCR_(TIMEOUT, OP)
+
+static void *pt_fn(void *param)
+{
+  sleep(3);
+
+  return NULL;
+}
+
+enum tst_type {
+  TST_TIMED_JOIN = 1,
+  TST_CLOCK_JOIN,
+};
+
+void __test_join_np(int tsec_inc, enum tst_type ttype)
+{
+  struct timespec ts;
+  pthread_t t0;
+  int ret;
+
+  ret = pthread_create(&t0, NULL, pt_fn, NULL);
+  if (ret)
+    test_failure(1, "failed to create thread %d!", ret);
+
+  ret = clock_gettime(CLOCK_REALTIME, &ts);
+  if (ret)
+    test_failure(1, "failed to create thread %d!", ret);
+
+  ts.tv_sec += tsec_inc;
+
+  if (ttype == TST_TIMED_JOIN)
+    ret = pthread_timedjoin_np(t0, NULL, &ts);
+  else if (ttype == TST_CLOCK_JOIN)
+    ret = pthread_clockjoin_np(t0, NULL, CLOCK_REALTIME, &ts);
+  else
+    test_failure(0, "Wrong test!");
+
+  if (ret != ETIMEDOUT)
+    test_failure(1, "failed to join thread %d!", ret);
+
+  test_success();
+}
+
+void test_pthread_timedjoin_np(void)
+{
+  struct timespec ts;
+  pthread_t t0;
+  int ret;
+
+  test_begin(TEST_DESCR(TIMEOUT_INC, timed));
+  __test_join_np(TIMEOUT_INC, TST_TIMED_JOIN);
+
+  test_begin(TEST_DESCR(TIMEOUT_INC, clock));
+  __test_join_np(TIMEOUT_INC, TST_CLOCK_JOIN);
+}
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_pthread_timedjoin_np.h b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_pthread_timedjoin_np.h
new file mode 100755
index 0000000..9eaf690
--- /dev/null
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_pthread_timedjoin_np.h
@@ -0,0 +1 @@
+void test_pthread_timedjoin_np(void);
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_recvmmsg.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_recvmmsg.c
new file mode 100755
index 0000000..a6c4bdd
--- /dev/null
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_recvmmsg.c
@@ -0,0 +1,41 @@
+#define _GNU_SOURCE
+#include <sys/socket.h>
+#include <sys/time.h>
+#include <time.h>
+#include <stdio.h>
+#include <errno.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "tests.h"
+
+void test_recvmmsg(void)
+{
+  test_begin("Test recvmmsg");
+  struct timespec ts = {2, 0};
+  int socfd, ret;
+
+  socfd = socket(AF_INET , SOCK_STREAM , 0);
+  if (socfd == -1)
+    {
+      test_failure(1, "Cannot create socket");
+    }
+
+  ret = recvmmsg (socfd, NULL, 0, 0, &ts);
+  if (ret == -1)
+  {
+    close (socfd);
+    test_failure(1, "recvmmsg with 2s timeout returned -1");
+  }
+
+  /* Check passing NULL as struct timespec pointer */
+  ret = recvmmsg (socfd, NULL, 0, MSG_DONTWAIT, NULL);
+  if (ret == -1)
+  {
+    close (socfd);
+    test_failure(1, "recvmmsg with NULL timeout returned -1");
+  }
+
+  close (socfd);
+  test_success();
+}
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_recvmmsg.h b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_recvmmsg.h
new file mode 100755
index 0000000..dd4b646
--- /dev/null
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_recvmmsg.h
@@ -0,0 +1 @@
+extern void test_recvmmsg(void);
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_sched_rr_get_interval.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_sched_rr_get_interval.c
new file mode 100755
index 0000000..de3bb13
--- /dev/null
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_sched_rr_get_interval.c
@@ -0,0 +1,18 @@
+#include <sched.h>
+#include <errno.h>
+#include <string.h>
+
+#include "tests.h"
+
+void test_sched_rr_get_interval(void)
+{
+  test_begin("Call sched_rr_get_interval");
+  struct timespec ts[2] = { { -1, -1 }, { -1, -1 } };
+  int result = sched_rr_get_interval(0, ts);
+  if (result)
+    test_failure(1, "sched_rr_get_interval returned %d", result);
+  else if (ts[1].tv_sec != -1 || ts[1].tv_nsec != -1)
+    test_failure(1, "sched_rr_get_interval ts[1] = (%lld,%lld)", (long long) (ts[1].tv_sec), (long long) (ts[1].tv_nsec));
+  else
+    test_success();
+}
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_sched_rr_get_interval.h b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_sched_rr_get_interval.h
new file mode 100755
index 0000000..dd4f119
--- /dev/null
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_sched_rr_get_interval.h
@@ -0,0 +1 @@
+void test_sched_rr_get_interval(void);
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_sem_timedwait.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_sem_timedwait.c
new file mode 100755
index 0000000..383c3ea
--- /dev/null
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_sem_timedwait.c
@@ -0,0 +1,60 @@
+#define _GNU_SOURCE
+#define _POSIX_C_SOURCE 200809
+#include <time.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <errno.h>
+#include <string.h>
+#include <semaphore.h>
+#include <unistd.h>
+
+#include "tests.h"
+
+#define TIMEOUT_INC 2
+#define TEST_DESCR_(TIMEOUT, OP)	  \
+	"Test sem_"#OP"wait timeout "#TIMEOUT" s"
+#define TEST_DESCR(TIMEOUT, OP) TEST_DESCR_(TIMEOUT, OP)
+
+enum tst_type {
+  TST_COND_TIMED = 1,
+  TST_COND_CLOCK,
+};
+
+static void __test_cond(int tsec_inc, enum tst_type ttype)
+{
+	struct timespec ts;
+  sem_t sem;
+  int ret;
+
+  ret = clock_gettime(CLOCK_REALTIME, &ts);
+  if (ret)
+    test_failure(1, "failed to get current time %d!", ret);
+
+  ts.tv_sec += tsec_inc;
+
+  ret = sem_init(&sem, 0, 0);
+  if (ret == -1)
+    test_failure(1, "failed to init semaphore %d!", ret);
+
+	if (ttype == TST_COND_TIMED)
+		while ((ret = sem_timedwait(&sem, &ts)) == -1 && errno == EINTR)
+			continue;
+	else
+		while ((ret = sem_clockwait(&sem, CLOCK_REALTIME, &ts)) == -1 &&
+		       errno == EINTR)
+			continue;
+
+  if (ret == -1 && errno != ETIMEDOUT)
+    test_failure(1, "failed to join thread %d!", ret);
+
+  test_success();
+}
+
+void test_sem_timedwait(void)
+{
+  test_begin(TEST_DESCR(TIMEOUT_INC, timed));
+  __test_cond(TIMEOUT_INC, TST_COND_TIMED);
+
+  test_begin(TEST_DESCR(TIMEOUT_INC, clock));
+  __test_cond(TIMEOUT_INC, TST_COND_CLOCK);
+}
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_sem_timedwait.h b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_sem_timedwait.h
new file mode 100755
index 0000000..e5c35d4
--- /dev/null
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_sem_timedwait.h
@@ -0,0 +1 @@
+void test_sem_timedwait(void);
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_set_getitimer.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_set_getitimer.c
new file mode 100755
index 0000000..949eec0
--- /dev/null
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_set_getitimer.c
@@ -0,0 +1,55 @@
+#include <sys/time.h>
+#include <stdio.h>
+#include <errno.h>
+#include <string.h>
+#include <unistd.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+#include "tests.h"
+
+static int test_getitimer(struct itimerval *value)
+{
+  return getitimer(ITIMER_REAL, value);
+}
+
+static int test_setitimer(const struct itimerval
+  *value)
+{
+  return setitimer(ITIMER_REAL, value, NULL);
+}
+
+void test_set_getitimer(void)
+{
+  test_begin("Setting real time interval timer to 2 seconds");
+  struct itimerval settings = { { 2, 0 }, { 2, 0 } };
+  int result = test_setitimer(&settings);
+  if (result) test_failure(1, "setitimer returned %d", result); else test_success();
+
+  test_begin("Getting real time interval timer");
+  struct itimerval value1;
+  result = test_getitimer(&value1);
+  if (result) test_failure(1, "getitimer returned %d", result); else test_success();
+
+  usleep(1000000);
+
+  test_begin("Getting real time interval timer 1 second later");
+  struct itimerval value2;
+  result = test_getitimer(&value2);
+  if (result) test_failure(1, "getitimer returned %d", result); else test_success();
+
+  test_begin("Checking real time interval timer elapsed time");
+  int64_t diff = value1.it_value.tv_sec - value2.it_value.tv_sec;
+  diff *= 1000000;
+  diff += value1.it_value.tv_usec - value2.it_value.tv_usec;
+  diff -= 1000000;
+  diff = abs(diff);
+  if (diff > 100000) /* 1/10 sec */
+  {
+    int64_t s = diff / 1000000;
+    int64_t n = diff % 1000000;
+    test_failure(0, "real time interval timer lasted %lld.%09lld second instead of 1.0", s, n);
+  }
+  else
+    test_success();
+}
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_set_getitimer.h b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_set_getitimer.h
new file mode 100755
index 0000000..fb47ea2
--- /dev/null
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_set_getitimer.h
@@ -0,0 +1 @@
+void test_set_getitimer(void);
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_stat.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_stat.c
new file mode 100755
index 0000000..a4e4f00
--- /dev/null
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_stat.c
@@ -0,0 +1,25 @@
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <errno.h>
+#include <string.h>
+
+#include "tests.h"
+
+static int test_stat_call(
+  const char  *pathname,
+  struct stat *buf)
+{
+  return stat(pathname, buf);
+}
+
+void test_stat(void)
+{
+  int result;
+  struct stat buf;
+
+  test_begin("Call stat() on /etc/init.d/rcS");
+  result = test_stat_call("/etc/init.d/rcS", &buf);
+  if (result) test_failure(1, "stat('/etc/init.d/rcS') returned %d", result); else test_success();
+}
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_stat.h b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_stat.h
new file mode 100755
index 0000000..1b7b019
--- /dev/null
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_stat.h
@@ -0,0 +1 @@
+extern void test_stat(void);
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_time.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_time.c
new file mode 100755
index 0000000..4feab25
--- /dev/null
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_time.c
@@ -0,0 +1,64 @@
+#include <time.h>
+#include <errno.h>
+#include <string.h>
+
+#include "tests.h"
+
+static void test_time(const time_t sec)
+{
+  time_t t0 = time(NULL);
+  if (t0 == (time_t)-1)
+  {
+    test_failure(1, "time returned -1");
+    return;
+  }
+  double d = difftime(t0, sec);
+  if (d < -1.0 || d > 1.0)
+    test_failure(0, "time error is %g second, more than one second", d);
+  else
+    test_success();
+}
+
+static int test_clock_settime(const time_t sec)
+{
+  struct timespec ts;
+  int result;
+
+  ts.tv_sec = sec;
+  ts.tv_nsec = 0;
+
+  result = clock_settime(CLOCK_REALTIME, &ts);
+  if (result)
+    test_failure(1, "clock_settime returned %d", result);
+  else
+    test_success();
+  return result;
+}
+
+void test_time_(void)
+{
+  time_t t0, t;
+
+  test_begin("Save current time");
+  t0 = time(NULL);
+  if (t0==(time_t)-1) test_failure(1, "time returned -1"); else test_success();
+
+  test_begin("Set time to Y2038 minus 60 seconds");
+  t = 0x7FFFFFFF;
+  t -= 59;
+  int result = test_clock_settime(t);
+  if (result == 0) test_time(t);
+
+  test_begin("Set time to Y2038 plus 60 seconds");
+  t = 0x7FFFFFFF;
+  t += 61;
+  result = test_clock_settime(t);
+  if (result == 0) test_time(t);
+
+  test_begin("Restore time");
+  result = test_clock_settime(t0);
+  if (result)
+    test_failure(1, "clock_settime returned %d", result);
+  else
+    test_success();
+}
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_time.h b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_time.h
new file mode 100755
index 0000000..3ea63f8
--- /dev/null
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_time.h
@@ -0,0 +1 @@
+void test_time_(void);
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_timegm.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_timegm.c
new file mode 100755
index 0000000..0c1aa63
--- /dev/null
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_timegm.c
@@ -0,0 +1,45 @@
+#include <time.h>
+#include <stdio.h>
+#include <errno.h>
+#include <string.h>
+
+#include "tests.h"
+
+static void test_timegm_call(
+  struct tm *tm,
+  time_t expected_result)
+{
+  time_t result = timegm(tm);
+  if (result == -1)
+    test_failure(1, "timegm returned %lld", (long long) result);
+  else if (result != expected_result)
+    test_failure(0, "timegm returned %lld instead of %lld", (long long) result, (long long) expected_result);
+  else
+    test_success();
+}
+
+void test_timegm(void)
+{
+  test_begin("Check that gmtime_r(0) yields 1970-01-01 00:00:00");
+  struct tm tm0 = {.tm_year = 70, .tm_mon = 0, .tm_mday = 1, .tm_hour = 0, .tm_min = 0, .tm_sec = 0, .tm_wday = 4, .tm_yday = 0 };
+  time_t t = 0;
+  test_timegm_call(&tm0, t);
+
+  test_begin("Check that gmtime_r(0x7FFFFFFF) yields 2038-01-19 03:14:07");
+  struct tm tmY2038 = {.tm_year = 138, .tm_mon = 0, .tm_mday = 19, .tm_hour = 3, .tm_min = 14, .tm_sec = 7, .tm_wday = 2, .tm_yday = 18 };
+  t = 0x7fffffff;
+  test_timegm_call(&tmY2038, t);
+
+  test_begin("Check that gmtime_r(0x7FFFFFFF+1) yields 2038-01-19 03:14:08");
+  struct tm tmY2038p = {.tm_year = 138, .tm_mon = 0, .tm_mday = 19, .tm_hour = 3, .tm_min = 14, .tm_sec = 8, .tm_wday = 2, .tm_yday = 18 };
+  t++;
+  test_timegm_call(&tmY2038p, t);
+
+  test_begin("Check that gmtime_r(0x80000000) yields 2038-01-19 03:14:08");
+  t = 0x80000000;
+  test_timegm_call(&tmY2038p, t);
+
+  test_begin("Check that gmtime_r(0x80000000-1) yields 2038-01-19 03:14:07");
+  t--;
+  test_timegm_call(&tmY2038, t);
+}
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_timegm.h b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_timegm.h
new file mode 100755
index 0000000..10bcf11
--- /dev/null
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_timegm.h
@@ -0,0 +1 @@
+extern void test_timegm(void);
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_timer_gettime_settime.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_timer_gettime_settime.c
new file mode 100755
index 0000000..8213183
--- /dev/null
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_timer_gettime_settime.c
@@ -0,0 +1,64 @@
+#include <signal.h>
+#include <time.h>
+#include <stdio.h>
+#include <errno.h>
+#include <string.h>
+#include <unistd.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+#include "tests.h"
+
+static int test_timer_gettime(timer_t timerid, struct itimerspec
+  *value)
+{
+  return timer_gettime(timerid, value);
+}
+
+static int test_timer_settime(timer_t timerid, const struct itimerspec
+  *value)
+{
+  return timer_settime(timerid, 0, value, NULL);
+}
+
+void test_timer_gettime_settime(void)
+{
+  timer_t timerid;
+  struct sigevent sevp;
+
+  test_begin("Call timer_create()");
+  sevp.sigev_notify = SIGEV_NONE;
+  int result = timer_create(CLOCK_REALTIME, &sevp, &timerid);
+  if (result) test_failure(1, "timer_create returned %d", result); else test_success();
+
+  test_begin("Call timer_settime()");
+  struct itimerspec settings = { { 2, 0 }, { 2, 0 } };
+  result = test_timer_settime(timerid, &settings);
+  if (result) test_failure(1, "timer_settime returned %d", result); else test_success();
+
+  test_begin("Call timer_gettime() before sleep");
+  struct itimerspec value1;
+  result = test_timer_gettime(timerid, &value1);
+  if (result) test_failure(1, "timer_gettime returned %d", result); else test_success();
+
+  test_begin("Sleeping for 1 second");
+  result = sleep(1);
+  if (result) test_failure(1, "sleep returned %d", result); else test_success();
+
+  test_begin("Call timer_gettime() after sleep");
+  struct itimerspec value2;
+  result = test_timer_gettime(timerid, &value2);
+  if (result) test_failure(1, "timer_gettime returned %d", result); else test_success();
+
+  test_begin("Check difference between timer_gettime() calls");
+  int64_t diff = value1.it_value.tv_sec - value2.it_value.tv_sec;
+  diff *= 1000000000;
+  diff += value1.it_value.tv_nsec - value2.it_value.tv_nsec;
+  diff -= 1000000000;
+  diff = abs(diff);
+  if (diff > 100000000) test_failure(0, "timer drift is %lld, more than 100000000", diff); else test_success();
+
+  test_begin("Call timer_delete()");
+  result = timer_delete(timerid);
+  if (result) test_failure(1, "timer_delete returned %d", result); else test_success();
+}
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_timer_gettime_settime.h b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_timer_gettime_settime.h
new file mode 100755
index 0000000..c6e5a2f
--- /dev/null
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_timer_gettime_settime.h
@@ -0,0 +1 @@
+void test_timer_gettime_settime(void);
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_timerfd_gettime_settime.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_timerfd_gettime_settime.c
new file mode 100755
index 0000000..39be972
--- /dev/null
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_timerfd_gettime_settime.c
@@ -0,0 +1,71 @@
+#include <signal.h>
+#include <sys/timerfd.h>
+#include <stdio.h>
+#include <errno.h>
+#include <string.h>
+#include <unistd.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+#include "tests.h"
+
+static void test_timerfd_gettime(int fd, struct itimerspec
+  *value)
+{
+  int result = timerfd_gettime(fd, value);
+  if (result)
+    test_failure(1, "timerfd_gettime returned %d", result);
+  else
+    test_success();
+}
+
+static void test_timerfd_settime(int fd, const struct itimerspec
+  *value)
+{
+  int result = timerfd_settime(fd, 0, value, NULL);
+  if (result)
+    test_failure(1, "timerfd_settime returned %d", result);
+  else
+    test_success();
+}
+
+void test_timerfd_gettime_settime(void)
+{
+  int fd;
+
+  test_begin("Call timerfd_create()");
+  int result = timerfd_create(CLOCK_REALTIME, 0);
+  if (result==-1) test_failure(1, "timerfd_create(CLOCK_REALTIME, 0) returned -1"); else 
+  {
+	  test_success();
+	  fd = result;
+  }
+
+  test_begin("Call timerfd_settime()");
+  struct itimerspec settings = { { 2, 0 }, { 2, 0 } };
+  test_timerfd_settime(fd, &settings);
+
+  test_begin("Call timerfd_gettime() before delay");
+  struct itimerspec value1;
+  test_timerfd_gettime(fd, &value1);
+
+  test_begin("Sleep for 1 000 000 microseconds");
+  result = usleep(1000000);
+  if (result) test_failure(1, "usleep returned %d", result); else test_success();
+
+  test_begin("Call timerfd_gettime() after delay");
+  struct itimerspec value2;
+  test_timerfd_gettime(fd, &value2);
+
+  test_begin("Check difference between calls to test_timerfd_gettime()");
+  int64_t diff = value1.it_value.tv_sec - value2.it_value.tv_sec;
+  diff *= 1000000000;
+  diff += value1.it_value.tv_nsec - value2.it_value.tv_nsec;
+  diff -= 1000000000;
+  diff = abs(diff);
+  if (diff > 100000000) test_failure(0, "timer delay drifted by %lld, more than 100000000", diff); else test_success();
+
+  test_begin("Call close() on timer fd");
+  result = close(fd);
+  if (result) test_failure(1, "close returned %d", result); else test_success();
+}
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_timerfd_gettime_settime.h b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_timerfd_gettime_settime.h
new file mode 100755
index 0000000..9bb3b67
--- /dev/null
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_timerfd_gettime_settime.h
@@ -0,0 +1 @@
+void test_timerfd_gettime_settime(void);
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_timespec_get.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_timespec_get.c
new file mode 100755
index 0000000..3f18cdb
--- /dev/null
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_timespec_get.c
@@ -0,0 +1,31 @@
+#include <time.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <errno.h>
+#include <string.h>
+
+#include "tests.h"
+
+void test_timespec_get(void)
+{
+  struct timespec then, now;
+  time_t diff;
+
+  memset(&then, 0x55, sizeof(then));
+  memset(&now, 0x55, sizeof(now));
+
+  test_begin("Get current real time before timespec_get()");
+  int result = clock_gettime(CLOCK_REALTIME, &then);
+  if (result) test_failure(1, "clock_gettime returned %d", result); else test_success();
+
+  test_begin("Call timespec_get(&now, TIME_UTC)");
+  result = timespec_get(&now, TIME_UTC);
+  if (result != TIME_UTC) test_failure(1, "timespec_get returned %d", result); else test_success();
+
+  test_begin("Check that timespec_get() returned real time");
+  diff = now.tv_sec-then.tv_sec;
+  diff *= 1000000000;
+  diff += now.tv_nsec-then.tv_nsec;
+  diff %= 1000000000;
+  if (diff > 100000000) test_failure(0, "timespec_get drifted by %lld, more than 100000000", (long long) diff); else test_success();
+}
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_timespec_get.h b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_timespec_get.h
new file mode 100755
index 0000000..be6b791
--- /dev/null
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_timespec_get.h
@@ -0,0 +1 @@
+void test_timespec_get(void);
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_utime.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_utime.c
new file mode 100755
index 0000000..6d1cbbf
--- /dev/null
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_utime.c
@@ -0,0 +1,94 @@
+#include <utime.h>
+#include <stdio.h>
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "tests.h"
+
+static void test_utime_call(const char *name, const struct utimbuf *t)
+{
+  int result = utime(name, t);
+  if (result)
+    test_failure(1, "utime('%s', a=%lld m=%lld) returned %d", name, (long long) (t->actime), (long long) (t->modtime), result);
+  else
+    test_success();
+}
+
+void test_utime(void)
+{
+  test_begin("Creating /utime.null");
+  int fd1 = open("/utime.null", O_CREAT, 0644);
+  if (fd1 < 0)
+  {
+    test_failure(1, "open('/utime.null') returned %d", fd1);
+    return;
+  }
+  close(fd1);
+  test_success();
+
+  test_begin("Call utimes(NULL) on /utime.null");
+  test_utime_call("/utime.null", NULL);
+
+  test_begin("Creating /utime.n2038");
+  fd1 = open("/utime.n2038", O_CREAT, 0644);
+  if (fd1 < 0)
+  {
+    test_failure(1, "open('/utime.n2038') returned %d", fd1);
+    return;
+  }
+  close(fd1);
+  test_success();
+
+  test_begin("Call utime(Y2038-2, Y2038-1) on /utime.n2038");
+  const struct utimbuf t1 = { 0x7FFFFFFE, 0x7FFFFFFF };
+  test_utime_call("/utime.n2038", &t1);
+
+  test_begin("Check stat of /utime.n2038");
+  struct stat st1;
+  int result = stat("/utime.n2038", &st1);
+  if (result)
+    test_failure(1, "stat('/utime.n2038') returned %d", result);
+  else if (st1.st_atim.tv_sec != t1.actime || st1.st_mtim.tv_sec != t1.modtime)
+  {
+    test_failure(0, "utime returned a=%lld m=%lld, expected a=%lld m=%lld",
+        (long long int) st1.st_atim.tv_sec,
+        (long long int) st1.st_mtim.tv_sec,
+        (long long int) t1.actime,
+        (long long int) t1.modtime);
+  }
+  else
+    test_success();
+
+  test_begin("Creating /utime.y2038");
+  fd1 = open("/utime.y2038", O_CREAT, 0644);
+  if (fd1 < 0)
+  {
+    test_failure(1, "open('/utime.y2038') returned %d", fd1);
+    return;
+  }
+  close(fd1);
+  test_success();
+
+  test_begin("Call utime(Y2038+1, Y2038+2) on /utime.y2038");
+  const struct utimbuf t2 = { 0x80000001ull, 0x80000002ull };
+  test_utime_call("/utime.y2038", &t2);
+
+  test_begin("Check stat of /utime.y2038");
+  struct stat st2;
+  result = stat("/utime.y2038", &st2);
+  if (result)
+    test_failure(1, "stat returned %d", result);
+  else if (st2.st_atim.tv_sec != t2.actime || st2.st_mtim.tv_sec != t2.modtime)
+  {
+    test_failure(0, "utime returned a=%lld m=%lld, expected a=%lld m=%lld",
+        (long long int) st2.st_atim.tv_sec,
+        (long long int) st2.st_mtim.tv_sec,
+        (long long int) t2.actime,
+        (long long int) t2.modtime);
+  }
+  else test_success();
+}
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_utime.h b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_utime.h
new file mode 100755
index 0000000..a22a33c
--- /dev/null
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_utime.h
@@ -0,0 +1 @@
+extern void test_utime(void);
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_utimensat.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_utimensat.c
new file mode 100755
index 0000000..84f95f9
--- /dev/null
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_utimensat.c
@@ -0,0 +1,31 @@
+#include <time.h>
+#include <stdio.h>
+#include <errno.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "tests.h"
+
+static int test_utimensat_call(int dirfd, const char *name, const struct
+  timespec t[2], int flags)
+{
+  close(open(name, O_CREAT, 0644));
+  int result = utimensat(dirfd, name, t, flags);
+  return result;
+}
+
+void test_utimensat(void)
+{
+  
+  const struct timespec t[2] = { { 0x80000000ull, 0 },  { 0x80000120ull, 0 } };
+
+  test_begin("test_utimensat_call(0, \"/utimensat.ref\", NULL, 0)");
+  int result = test_utimensat_call(0, "/utimensat.ref", NULL, 0);
+  if (result) test_failure(1, "utimensat('/utimensat.ref', {0,120}) returned %d", result); else test_success();
+
+  test_begin("test_utimensat_call(0, \"/utimensat.tst\", {{Y2038, 0},{Y2038+120s,0}}, 0)");
+  result = test_utimensat_call(0, "/utimensat.tst", t, 0);
+  if (result) test_failure(1, "utimensat('/utimensat.tst', {Y2038,Y2038+120}) returned %d", result); else test_success();
+}
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_utimensat.h b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_utimensat.h
new file mode 100755
index 0000000..58f5b1f
--- /dev/null
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/test_utimensat.h
@@ -0,0 +1 @@
+extern void test_utimensat(void);
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/tests.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/tests.c
new file mode 100755
index 0000000..2acf0d4
--- /dev/null
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/tests.c
@@ -0,0 +1,87 @@
+#include "tests.h"
+
+#include <stdio.h>
+#include <stdarg.h>
+#include <string.h>
+#include <errno.h>
+
+static int test_failures;
+static int test_successes;
+static const char *test_desc;
+
+void tests_init(void)
+{
+  test_successes =0;
+  test_failures =0;
+  printf("Beginning tests\n");
+  printf("----------------------------------------------------\n");
+}
+
+static int test_underway;
+static int test_failed;
+static int test_succeeded;
+
+void test_end(void)
+{
+  if (test_underway)
+  {
+    printf(" ??? No test result was reported\n");
+    test_underway = 0;
+  }
+  else if (test_failed)
+  {
+    printf(" FAILED -- %s\n", test_desc);
+    test_failures++;
+    test_failed = 0;
+  }
+  else if (test_succeeded)
+  {
+    test_successes++;
+    printf(" ok     -- %s\n", test_desc);
+    test_succeeded = 0;
+  }
+  else
+  {
+    printf(" ??? No test was underway\n");
+  }
+}
+
+void test_begin(const char *description)
+{
+  if (test_underway || test_failed || test_succeeded) test_end();
+  test_desc = description;
+  test_underway = 1;
+  printf("Testing -- %s\n", test_desc);
+}
+
+void test_failure(int print_errno, const char *fmt, ...)
+{
+  va_list ap;
+  printf(" --- ");
+  va_start(ap, fmt);
+  vprintf(fmt, ap);
+  va_end(ap);
+  if (print_errno) printf(" (errno= %d / %s)", errno, strerror(errno));
+  printf("\n");
+  test_failed = 1;
+  test_underway = 0;
+}
+
+void test_success(void)
+{
+  test_succeeded = 1;
+  test_underway = 0;
+}
+
+void test_run(void (*test_function)(void))
+{
+  test_function();
+  test_end();
+}
+
+void tests_report(void)
+{
+  printf("----------------------------------------------------\n");
+  printf("Test succeeded: %d\n", test_successes);
+  printf("Test failed: %d\n", test_failures);
+}
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/tests.h b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/tests.h
new file mode 100755
index 0000000..7dd868c
--- /dev/null
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/y2038-tests/tests.h
@@ -0,0 +1,6 @@
+void tests_init(void);
+void test_begin(const char *description);
+void test_failure(int print_errno, const char *fmt, ...) __attribute__ ((format (printf, 2, 3)));
+void test_success(void);
+void tests_report(void);
+void test_run(void (*function)(void));