[Feature][task-view-306]merge P56U08(patch6) 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: I8e809511ac30c97228dd110c304b4a08f4af36d7
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 c15e093..0aaab7f 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
@@ -140,6 +140,7 @@
CUSTOM_MACRO += "${@bb.utils.contains('DISTRO_FEATURES', 'use_voice_buffer', '-D_USE_VOICE_BUFFER', '', d)}"
#CONFIG_VB_TRANSMIT_INTF = "RTP"
#CONFIG_VB_TRANSMIT_INTF = "USB"
+#CONFIG_VB_TRANSMIT_INTF = "NULL"
CUSTOM_MACRO += "${@bb.utils.contains('CONFIG_VB_TRANSMIT_INTF', 'RTP', '-D_VB_TRANSMIT_INTF_RTP', '', d)}"
CUSTOM_MACRO += "${@bb.utils.contains('CONFIG_VB_TRANSMIT_INTF', 'USB', '-D_VB_TRANSMIT_INTF_USB', '', d)}"
#wifi 配置
@@ -153,6 +154,8 @@
CONFIG_TEL_API_SUPPORT = "RIL"
CUSTOM_MACRO += "${@bb.utils.contains('CONFIG_TEL_API_SUPPORT', 'BL', '-D_USE_BL', '', d)}"
+
+#RIL AT通道支持RPMSG模式
CUSTOM_MACRO += "${@bb.utils.contains('CONFIG_TEL_API_SUPPORT', 'RIL', '-DZXIC_ATCHN_RPMSG_MODE', '', d)}"
CUSTOM_MACRO += "${@bb.utils.contains('CONFIG_TEL_API_SUPPORT', 'RIL', '-DUSE_CUSTOM_YK', '', d)}"
@@ -321,6 +324,7 @@
zxic_app_open += "${@bb.utils.contains('CONFIG_TEL_API_SUPPORT', 'RIL', 'rild', '', d)}"
zxic_app_open += "${@bb.utils.contains('CONFIG_TEL_API_SUPPORT', 'BL', 'tel-svr', '', d)}"
+zxic_app_open += "${@bb.utils.contains('CONFIG_VB_TRANSMIT_INTF', 'NULL', 'vb-demo', '', d)}"
#开源应用及库
meta_app_open += "\
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 636cedd..eade5dc 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
@@ -439,7 +439,6 @@
NGECALL_FORTEST=0
CUSTOMER_FLAG=0
#for volte end
-DEBUG_INFO_DISABLE=0
DEBUG_INFO_FILE_PATH=/mnt/userdata
DEBUG_INFO_FILE_NUM=2
DEBUG_INFO_FILE_TOTAL_SIZE=1
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 7839262..32508c8 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
@@ -78,6 +78,10 @@
br_ipchange_flag=
br_node=usblan0+zvnet0
br_node_cap=zvnet0
+br_node_num=
+br_node0=
+br_node1=
+br_node2=
clat_fake_subnet=192.0.168.0
clat_frag_collect_timeout=300
clat_local_mapping_timeout=300
@@ -490,7 +494,7 @@
gw_in_cap=0
#yes-on no-off
cc_at_debug=no
-xlat_enable=0
+xlat_enable=1
ecallmode=2
telog_path_cap=
telog_path=
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc/fs/normal/rootfs/etc_rw/.gitkeep b/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc/fs/normal/rootfs/etc_rw/.gitkeep
new file mode 100755
index 0000000..e69de29
--- /dev/null
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc/fs/normal/rootfs/etc_rw/.gitkeep
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc/fs/normal/rootfs/mnt/emmc1/.gitkeep b/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc/fs/normal/rootfs/mnt/emmc1/.gitkeep
new file mode 100755
index 0000000..e69de29
--- /dev/null
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc/fs/normal/rootfs/mnt/emmc1/.gitkeep
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc/fs/normal/rootfs/mnt/emmc2/.gitkeep b/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc/fs/normal/rootfs/mnt/emmc2/.gitkeep
new file mode 100755
index 0000000..e69de29
--- /dev/null
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc/fs/normal/rootfs/mnt/emmc2/.gitkeep
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc/fs/normal/rootfs/mnt/oem/.gitkeep b/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc/fs/normal/rootfs/mnt/oem/.gitkeep
new file mode 100755
index 0000000..e69de29
--- /dev/null
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc/fs/normal/rootfs/mnt/oem/.gitkeep
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc/fs/normal/rootfs/mnt/userdata/.gitkeep b/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc/fs/normal/rootfs/mnt/userdata/.gitkeep
new file mode 100755
index 0000000..e69de29
--- /dev/null
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc/fs/normal/rootfs/mnt/userdata/.gitkeep
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc/fs/normal/rootfs/proc/.gitkeep b/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc/fs/normal/rootfs/proc/.gitkeep
new file mode 100755
index 0000000..e69de29
--- /dev/null
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc/fs/normal/rootfs/proc/.gitkeep
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc/fs/normal/rootfs/sys/.gitkeep b/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc/fs/normal/rootfs/sys/.gitkeep
new file mode 100755
index 0000000..e69de29
--- /dev/null
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc/fs/normal/rootfs/sys/.gitkeep
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 57c1ad7..014d309 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
@@ -439,7 +439,6 @@
NGECALL_FORTEST=0
CUSTOMER_FLAG=0
#for volte end
-DEBUG_INFO_DISABLE=0
DEBUG_INFO_FILE_PATH=/mnt/userdata
DEBUG_INFO_FILE_NUM=2
DEBUG_INFO_FILE_TOTAL_SIZE=1
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 dc03706..8dc2533 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
@@ -78,6 +78,10 @@
br_ipchange_flag=
br_node=usblan0+zvnet0
br_node_cap=zvnet0
+br_node_num=
+br_node0=
+br_node1=
+br_node2=
clat_fake_subnet=192.0.168.0
clat_frag_collect_timeout=300
clat_local_mapping_timeout=300
@@ -490,6 +494,6 @@
gw_in_cap=0
#yes-on no-off
cc_at_debug=no
-xlat_enable=0
+xlat_enable=1
telog_path_cap=
telog_path=
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_4Gb/fs/normal/rootfs/etc_rw/.gitkeep b/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_4Gb/fs/normal/rootfs/etc_rw/.gitkeep
new file mode 100755
index 0000000..e69de29
--- /dev/null
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_4Gb/fs/normal/rootfs/etc_rw/.gitkeep
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_4Gb/fs/normal/rootfs/mnt/emmc1/.gitkeep b/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_4Gb/fs/normal/rootfs/mnt/emmc1/.gitkeep
new file mode 100755
index 0000000..e69de29
--- /dev/null
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_4Gb/fs/normal/rootfs/mnt/emmc1/.gitkeep
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_4Gb/fs/normal/rootfs/mnt/emmc2/.gitkeep b/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_4Gb/fs/normal/rootfs/mnt/emmc2/.gitkeep
new file mode 100755
index 0000000..e69de29
--- /dev/null
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_4Gb/fs/normal/rootfs/mnt/emmc2/.gitkeep
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_4Gb/fs/normal/rootfs/mnt/oem/.gitkeep b/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_4Gb/fs/normal/rootfs/mnt/oem/.gitkeep
new file mode 100755
index 0000000..e69de29
--- /dev/null
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_4Gb/fs/normal/rootfs/mnt/oem/.gitkeep
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_4Gb/fs/normal/rootfs/mnt/oemdata/.gitkeep b/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_4Gb/fs/normal/rootfs/mnt/oemdata/.gitkeep
new file mode 100755
index 0000000..e69de29
--- /dev/null
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_4Gb/fs/normal/rootfs/mnt/oemdata/.gitkeep
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_4Gb/fs/normal/rootfs/mnt/userdata/.gitkeep b/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_4Gb/fs/normal/rootfs/mnt/userdata/.gitkeep
new file mode 100755
index 0000000..e69de29
--- /dev/null
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_4Gb/fs/normal/rootfs/mnt/userdata/.gitkeep
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_4Gb/fs/normal/rootfs/proc/.gitkeep b/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_4Gb/fs/normal/rootfs/proc/.gitkeep
new file mode 100755
index 0000000..e69de29
--- /dev/null
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_4Gb/fs/normal/rootfs/proc/.gitkeep
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_4Gb/fs/normal/rootfs/sys/.gitkeep b/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_4Gb/fs/normal/rootfs/sys/.gitkeep
new file mode 100755
index 0000000..e69de29
--- /dev/null
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_4Gb/fs/normal/rootfs/sys/.gitkeep
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 da7ced4..d5b8bbf 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
@@ -451,7 +451,6 @@
NGECALL_FORTEST=0
CUSTOMER_FLAG=0
#for volte end
-DEBUG_INFO_DISABLE=0
DEBUG_INFO_FILE_PATH=/mnt/userdata
DEBUG_INFO_FILE_NUM=2
DEBUG_INFO_FILE_TOTAL_SIZE=1
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 6cbb1ea..7b9ea9e 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
@@ -78,6 +78,10 @@
br_ipchange_flag=
br_node=usblan0+zvnet0
br_node_cap=zvnet0
+br_node_num=
+br_node0=
+br_node1=
+br_node2=
clat_fake_subnet=192.0.168.0
clat_frag_collect_timeout=300
clat_local_mapping_timeout=300
@@ -346,7 +350,7 @@
ACL_mode=0
AuthMode=WPA2PSK
Channel=0
-wifi_acs_num=5
+wifi_acs_num=3
closeEnable=0
closeTime=
CountryCode=CN
@@ -521,7 +525,7 @@
gw_in_cap=0
#yes-on no-off
cc_at_debug=no
-xlat_enable=0
+xlat_enable=1
ecallmode=2
telog_path_cap=
telog_path=
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_ref/fs/normal/rootfs/sbin/fdisk_emmc.sh b/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_ref/fs/normal/rootfs/sbin/fdisk_emmc.sh
index 492f934..ad96881 100755
--- a/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_ref/fs/normal/rootfs/sbin/fdisk_emmc.sh
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_ref/fs/normal/rootfs/sbin/fdisk_emmc.sh
@@ -15,7 +15,7 @@
p
1
-+200M
++256M
n
p
2
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 57c1ad7..014d309 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
@@ -439,7 +439,6 @@
NGECALL_FORTEST=0
CUSTOMER_FLAG=0
#for volte end
-DEBUG_INFO_DISABLE=0
DEBUG_INFO_FILE_PATH=/mnt/userdata
DEBUG_INFO_FILE_NUM=2
DEBUG_INFO_FILE_TOTAL_SIZE=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_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 3fbb096..92191d4 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
@@ -78,6 +78,10 @@
br_ipchange_flag=
br_node=usblan0+zvnet0
br_node_cap=zvnet0
+br_node_num=
+br_node0=
+br_node1=
+br_node2=
clat_fake_subnet=192.0.168.0
clat_frag_collect_timeout=300
clat_local_mapping_timeout=300
@@ -488,6 +492,6 @@
MaxRtrAdvInterval=1800
dhcps_in_cap=1
gw_in_cap=0
-xlat_enable=0
+xlat_enable=1
telog_path_cap=
telog_path=
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_systemd/fs/normal/rootfs/etc_rw/.gitkeep b/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_systemd/fs/normal/rootfs/etc_rw/.gitkeep
new file mode 100755
index 0000000..e69de29
--- /dev/null
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_systemd/fs/normal/rootfs/etc_rw/.gitkeep
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_systemd/fs/normal/rootfs/mnt/emmc1/.gitkeep b/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_systemd/fs/normal/rootfs/mnt/emmc1/.gitkeep
new file mode 100755
index 0000000..e69de29
--- /dev/null
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_systemd/fs/normal/rootfs/mnt/emmc1/.gitkeep
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_systemd/fs/normal/rootfs/mnt/emmc2/.gitkeep b/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_systemd/fs/normal/rootfs/mnt/emmc2/.gitkeep
new file mode 100755
index 0000000..e69de29
--- /dev/null
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_systemd/fs/normal/rootfs/mnt/emmc2/.gitkeep
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_systemd/fs/normal/rootfs/mnt/oem/.gitkeep b/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_systemd/fs/normal/rootfs/mnt/oem/.gitkeep
new file mode 100755
index 0000000..e69de29
--- /dev/null
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_systemd/fs/normal/rootfs/mnt/oem/.gitkeep
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_systemd/fs/normal/rootfs/mnt/oemdata/.gitkeep b/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_systemd/fs/normal/rootfs/mnt/oemdata/.gitkeep
new file mode 100755
index 0000000..e69de29
--- /dev/null
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_systemd/fs/normal/rootfs/mnt/oemdata/.gitkeep
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_systemd/fs/normal/rootfs/mnt/userdata/.gitkeep b/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_systemd/fs/normal/rootfs/mnt/userdata/.gitkeep
new file mode 100755
index 0000000..e69de29
--- /dev/null
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_systemd/fs/normal/rootfs/mnt/userdata/.gitkeep
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_systemd/fs/normal/rootfs/proc/.gitkeep b/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_systemd/fs/normal/rootfs/proc/.gitkeep
new file mode 100755
index 0000000..e69de29
--- /dev/null
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_systemd/fs/normal/rootfs/proc/.gitkeep
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_systemd/fs/normal/rootfs/sys/.gitkeep b/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_systemd/fs/normal/rootfs/sys/.gitkeep
new file mode 100755
index 0000000..e69de29
--- /dev/null
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_systemd/fs/normal/rootfs/sys/.gitkeep
diff --git a/cap/zx297520v3/sources/meta-zxic/recipes-app/at-ctl/at-ctl.bb b/cap/zx297520v3/sources/meta-zxic/recipes-app/at-ctl/at-ctl.bb
index 12ea54b..1f1ab91 100755
--- a/cap/zx297520v3/sources/meta-zxic/recipes-app/at-ctl/at-ctl.bb
+++ b/cap/zx297520v3/sources/meta-zxic/recipes-app/at-ctl/at-ctl.bb
@@ -1,5 +1,5 @@
DESCRIPTION = "at_ctl"
-DEPENDS = "libnvram libsoftap libsofttimer libatutils sqlcipher libatext libmxml libtelsvr libsd-daemon"
+DEPENDS = "libdebug-info libnvram libsoftap libsofttimer libatutils sqlcipher libatext libmxml libtelsvr libsd-daemon"
SECTION = "app"
LICENSE = "zte"
PV = "1.0.0"
@@ -87,4 +87,4 @@
SYSTEMD_SERVICE_${PN} = "at_ctl.service"
SYSTEMD_AUTO_ENABLE_${PN} = "enable"
-RDEPENDS_${PN} = " libnvram libsoftap libsofttimer libatutils sqlcipher libatext libmxml libvoice libsd-daemon"
+RDEPENDS_${PN} = " libdebug-info libnvram libsoftap libsofttimer libatutils sqlcipher libatext libmxml libvoice libsd-daemon"
diff --git a/cap/zx297520v3/sources/meta-zxic/recipes-app/sntp/sntp.bb b/cap/zx297520v3/sources/meta-zxic/recipes-app/sntp/sntp.bb
index 21f207e..dd579d3 100755
--- a/cap/zx297520v3/sources/meta-zxic/recipes-app/sntp/sntp.bb
+++ b/cap/zx297520v3/sources/meta-zxic/recipes-app/sntp/sntp.bb
@@ -1,6 +1,6 @@
DESCRIPTION = "sntp"
#sntp依赖libnvram库
-DEPENDS = "libnvram libsoftap libsofttimer"
+DEPENDS = "libdebug-info libnvram libsoftap libsofttimer"
SECTION = "app"
LICENSE = "zte"
PV = "1.0.0"
@@ -26,7 +26,8 @@
#引用公用头文件和编译选项。
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 sntp
@@ -49,7 +50,7 @@
if ${@bb.utils.contains('DISTRO_FEATURES','sysvinit','true','false',d)}; then
install -Dm 0755 ${WORKDIR}/sntp.sysvinit ${D}${sysconfdir}/init.d/sntp
install -d ${D}${sysconfdir}/rcS.d
- #ln -s ../init.d/sntp ${D}${sysconfdir}/rcS.d/S22sntp
+ ln -s ../init.d/sntp ${D}${sysconfdir}/rcS.d/S22sntp
fi
#install elfs
@@ -72,4 +73,4 @@
SYSTEMD_SERVICE_${PN} = "sntp.service"
SYSTEMD_AUTO_ENABLE_${PN} = "enable"
-RDEPENDS_${PN} = " libnvram libsoftap libsofttimer"
+RDEPENDS_${PN} = " libdebug-info libnvram libsoftap libsofttimer"
\ No newline at end of file
diff --git a/cap/zx297520v3/sources/meta-zxic/recipes-app/vb-demo/vb-demo.bb b/cap/zx297520v3/sources/meta-zxic/recipes-app/vb-demo/vb-demo.bb
new file mode 100755
index 0000000..f96197a
--- /dev/null
+++ b/cap/zx297520v3/sources/meta-zxic/recipes-app/vb-demo/vb-demo.bb
@@ -0,0 +1,64 @@
+DESCRIPTION = "vb_demo"
+DEPENDS = "libvoice libmedia"
+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/vb_demo \
+ ${@bb.utils.contains("DISTRO_FEATURES", "procd", "file://vb_demo.init","", d)} \
+ ${@bb.utils.contains("DISTRO_FEATURES", "systemd", "file://vb_demo.service","", d)} \
+ "
+LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/zte;md5=c075689d1d1e06d4ab5bbe53623a6808"
+S = "${WORKDIR}"
+S_SRC_PATH = "${S}/test/vb_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}/vb_demo ${D}${bindir}/
+
+ if ${@bb.utils.contains('DISTRO_FEATURES','procd','true','false',d)}; then
+ install -Dm 0755 ${WORKDIR}/vb_demo.init ${D}${sysconfdir}/init.d/vb_demo
+ fi
+
+ if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then
+ install -d ${D}${systemd_unitdir}/system
+ install -m 0644 ${WORKDIR}/vb_demo.service ${D}${systemd_unitdir}/system
+ fi
+
+ #install elfs
+ install -d ${ELFS-PATH}/
+ install -m 0755 ${S_SRC_PATH}/vb_demo ${ELFS-PATH}/
+}
+
+do_cleanlibs () {
+ rm -fr ${ELFS-PATH}/vb_demo
+}
+
+addtask cleanlibs after do_clean before do_cleansstate
+
+FILES_${PN} = "\
+ ${bindir}/ \
+ ${@bb.utils.contains("DISTRO_FEATURES", "procd", "${sysconfdir}/init.d/vb_demo","", d)} \
+ "
+SYSTEMD_SERVICE_${PN} = "vb_demo.service"
+SYSTEMD_AUTO_ENABLE_${PN} = "disable"
+
+RDEPENDS_${PN} = " libvoice libmedia"
diff --git a/cap/zx297520v3/sources/meta-zxic/recipes-app/vb-demo/vb-demo/vb_demo.init b/cap/zx297520v3/sources/meta-zxic/recipes-app/vb-demo/vb-demo/vb_demo.init
new file mode 100755
index 0000000..e05899f
--- /dev/null
+++ b/cap/zx297520v3/sources/meta-zxic/recipes-app/vb-demo/vb-demo/vb_demo.init
@@ -0,0 +1,21 @@
+#!/bin/sh /etc/rc.common
+
+START=18
+STOP=85
+USE_PROCD=1
+
+logger -t vb_demo
+
+start_service() {
+ procd_open_instance
+ procd_set_param command /usr/bin/vb_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/vb-demo/vb-demo/vb_demo.service b/cap/zx297520v3/sources/meta-zxic/recipes-app/vb-demo/vb-demo/vb_demo.service
new file mode 100755
index 0000000..d519809
--- /dev/null
+++ b/cap/zx297520v3/sources/meta-zxic/recipes-app/vb-demo/vb-demo/vb_demo.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=The vb_demo service
+
+[Service]
+Type=simple
+ExecStart=/usr/bin/vb_demo
+Restart=always
+
+[Install]
+WantedBy=basic.target
+
diff --git a/cap/zx297520v3/sources/meta-zxic/recipes-app/zxic-debug/zxic-debug.bb b/cap/zx297520v3/sources/meta-zxic/recipes-app/zxic-debug/zxic-debug.bb
index c7f87d1..61650fa 100755
--- a/cap/zx297520v3/sources/meta-zxic/recipes-app/zxic-debug/zxic-debug.bb
+++ b/cap/zx297520v3/sources/meta-zxic/recipes-app/zxic-debug/zxic-debug.bb
@@ -16,6 +16,8 @@
FILESEXTRAPATHS_prepend :="${APP-OPEN-PATH}/platform:"
SRC_URI = " \
file://zxic_debug \
+ ${@bb.utils.contains("DISTRO_FEATURES", "procd", "file://zxic_debug.init","", d)} \
+ ${@bb.utils.contains("DISTRO_FEATURES", "systemd", "file://zxic_debug.service","", d)} \
${@bb.utils.contains("DISTRO_FEATURES", "sysvinit", "file://zxic_debug.sysvinit","", d)} \
"
@@ -37,10 +39,20 @@
install -d ${D}${bindir}/
install -m 0755 ${S}/zxic_debug/zxic_debug ${D}${bindir}/
+ if ${@bb.utils.contains('DISTRO_FEATURES','procd','true','false',d)}; then
+ install -Dm 0755 ${WORKDIR}/zxic_debug.init ${D}${sysconfdir}/init.d/zxic_debug
+ fi
+
+ if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then
+ install -d ${D}${systemd_unitdir}/system
+ install -m 0644 ${WORKDIR}/zxic_debug.service ${D}${systemd_unitdir}/system
+ fi
+
if ${@bb.utils.contains('DISTRO_FEATURES','sysvinit','true','false',d)}; then
install -Dm 0755 ${WORKDIR}/zxic_debug.sysvinit ${D}${sysconfdir}/init.d/zxic_debug
install -d ${D}${sysconfdir}/rcS.d
ln -s ../init.d/zxic_debug ${D}${sysconfdir}/rcS.d/S90zxic_debug
+ ln -s ../init.d/zxic_debug ${D}${sysconfdir}/rcS.d/K10zxic_debug
fi
#install elfs
@@ -57,5 +69,11 @@
#rootfs包含的文件
FILES_${PN} = "\
${bindir}/ \
- ${@bb.utils.contains("DISTRO_FEATURES", "sysvinit", "${sysconfdir}/","", d)} \
+ ${@bb.utils.contains("DISTRO_FEATURES", "procd", "${sysconfdir}/","", d)} \
+ ${@bb.utils.contains("DISTRO_FEATURES", "sysvinit", "${sysconfdir}/","", d)} \
"
+SYSTEMD_SERVICE_${PN} = "zxic_debug.service"
+SYSTEMD_AUTO_ENABLE_${PN} = "enable"
+
+
+
diff --git a/cap/zx297520v3/sources/meta-zxic/recipes-app/zxic-debug/zxic-debug/zxic_debug.service b/cap/zx297520v3/sources/meta-zxic/recipes-app/zxic-debug/zxic-debug/zxic_debug.service
new file mode 100755
index 0000000..8dcc30b
--- /dev/null
+++ b/cap/zx297520v3/sources/meta-zxic/recipes-app/zxic-debug/zxic-debug/zxic_debug.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=The zxic_debug service
+
+[Service]
+Type=simple
+ExecStart=/usr/bin/zxic_debug
+Restart=always
+
+[Install]
+WantedBy=basic.target
+
diff --git a/cap/zx297520v3/sources/meta-zxic/recipes-app/zxic-mainctrl/zxic-mainctrl.bb b/cap/zx297520v3/sources/meta-zxic/recipes-app/zxic-mainctrl/zxic-mainctrl.bb
index dba5672..772f149 100755
--- a/cap/zx297520v3/sources/meta-zxic/recipes-app/zxic-mainctrl/zxic-mainctrl.bb
+++ b/cap/zx297520v3/sources/meta-zxic/recipes-app/zxic-mainctrl/zxic-mainctrl.bb
@@ -1,5 +1,5 @@
DESCRIPTION = "zxic_mainctrl"
-DEPENDS = "libnvram libsofttimer libatutils libsoftap openssl libscipc libupi-ab"
+DEPENDS = "libdebug-info libnvram libsofttimer libatutils libsoftap openssl libscipc libupi-ab"
SECTION = "app"
LICENSE = "zte"
PV = "1.0.0"
@@ -24,6 +24,8 @@
S_SRC_PATH = "${S}/zxic_mainctrl"
#引用公用头文件和编译选项。
include ${BSPDIR}/sources/meta-zxic/conf/app_com.inc
+include ${BSPDIR}/sources/meta-zxic/conf/pub.inc
+CFLAGS_append += "${ZXIC_EXTRA_CFLAGS}"
#inherit autotools pkgconfig systemd
@@ -74,4 +76,4 @@
SYSTEMD_SERVICE_${PN} = "zxic_mainctrl.service"
SYSTEMD_AUTO_ENABLE_${PN} = "enable"
-RDEPENDS_${PN} = " libnvram libsofttimer libatutils libsoftap openssl libscipc libupi-ab"
+RDEPENDS_${PN} = " libdebug-info libnvram libsofttimer libatutils libsoftap openssl libscipc libupi-ab"
diff --git a/cap/zx297520v3/sources/meta-zxic/recipes-core/glibc/files/0002-fix-y2038-time_t-unsigned-long.patch b/cap/zx297520v3/sources/meta-zxic/recipes-core/glibc/files/0002-fix-y2038-time_t-unsigned-long.patch
new file mode 100755
index 0000000..bc67008
--- /dev/null
+++ b/cap/zx297520v3/sources/meta-zxic/recipes-core/glibc/files/0002-fix-y2038-time_t-unsigned-long.patch
@@ -0,0 +1,48 @@
+diff -ruN a/bits/typesizes.h b/bits/typesizes.h
+--- a/bits/typesizes.h 2024-05-13 15:49:06.279310297 +0800
++++ b/bits/typesizes.h 2024-06-24 19:10:05.732039157 +0800
+@@ -47,7 +47,7 @@
+ #define __FSWORD_T_TYPE __SWORD_TYPE
+ #define __ID_T_TYPE __U32_TYPE
+ #define __CLOCK_T_TYPE __SLONGWORD_TYPE
+-#define __TIME_T_TYPE __SLONGWORD_TYPE
++#define __TIME_T_TYPE __ULONGWORD_TYPE
+ #define __USECONDS_T_TYPE __U32_TYPE
+ #define __SUSECONDS_T_TYPE __SLONGWORD_TYPE
+ #define __DADDR_T_TYPE __S32_TYPE
+diff -ruN a/sysdeps/unix/sysv/linux/adjtime.c b/sysdeps/unix/sysv/linux/adjtime.c
+--- a/sysdeps/unix/sysv/linux/adjtime.c 2024-05-13 15:49:08.415312000 +0800
++++ b/sysdeps/unix/sysv/linux/adjtime.c 2024-06-26 16:25:56.512216926 +0800
+@@ -33,16 +33,17 @@
+ struct timeval tmp;
+
+ /* We will do some check here. */
+- tmp.tv_sec = itv->tv_sec + itv->tv_usec / 1000000L;
++ tmp.tv_sec = (signed long)itv->tv_sec + itv->tv_usec / 1000000L;
+ tmp.tv_usec = itv->tv_usec % 1000000L;
+- if (tmp.tv_sec > MAX_SEC || tmp.tv_sec < MIN_SEC)
++ if ((signed long)tmp.tv_sec > (signed long)MAX_SEC || (signed long)tmp.tv_sec < (signed long)MIN_SEC)
+ return INLINE_SYSCALL_ERROR_RETURN_VALUE (EINVAL);
+- tntx.offset = tmp.tv_usec + tmp.tv_sec * 1000000L;
++ tntx.offset = tmp.tv_usec + (signed long)tmp.tv_sec * 1000000L;
+ tntx.modes = ADJ_OFFSET_SINGLESHOT;
+ }
+ else
+ tntx.modes = ADJ_OFFSET_SS_READ;
+
++
+ if (__glibc_unlikely (__adjtimex (&tntx) < 0))
+ return -1;
+
+diff -ruN a/sysdeps/unix/sysv/linux/generic/bits/typesizes.h b/sysdeps/unix/sysv/linux/generic/bits/typesizes.h
+--- a/sysdeps/unix/sysv/linux/generic/bits/typesizes.h 2024-05-13 15:49:08.427312010 +0800
++++ b/sysdeps/unix/sysv/linux/generic/bits/typesizes.h 2024-06-24 19:10:56.580110887 +0800
+@@ -48,7 +48,7 @@
+ #define __FSWORD_T_TYPE __SWORD_TYPE
+ #define __ID_T_TYPE __U32_TYPE
+ #define __CLOCK_T_TYPE __SLONGWORD_TYPE
+-#define __TIME_T_TYPE __SLONGWORD_TYPE
++#define __TIME_T_TYPE __ULONGWORD_TYPE
+ #define __USECONDS_T_TYPE __U32_TYPE
+ #define __SUSECONDS_T_TYPE __SLONGWORD_TYPE
+ #define __DADDR_T_TYPE __S32_TYPE
diff --git a/cap/zx297520v3/sources/meta-zxic/recipes-core/glibc/glibc_%.bbappend b/cap/zx297520v3/sources/meta-zxic/recipes-core/glibc/glibc_%.bbappend
index 0314602..1ea730c 100755
--- a/cap/zx297520v3/sources/meta-zxic/recipes-core/glibc/glibc_%.bbappend
+++ b/cap/zx297520v3/sources/meta-zxic/recipes-core/glibc/glibc_%.bbappend
@@ -3,6 +3,7 @@
SRC_URI += " \
file://0001-write-log-to-zcat-tool.patch \
+ file://0002-fix-y2038-time_t-unsigned-long.patch \
"
do_install_append() {
diff --git a/cap/zx297520v3/sources/meta-zxic/recipes-kernel/linux/files/zx297520v3/linux-5_10-vehicle_dc_ref-normal-defconfig b/cap/zx297520v3/sources/meta-zxic/recipes-kernel/linux/files/zx297520v3/linux-5_10-vehicle_dc_ref-normal-defconfig
index 49e7188..ec41c23 100755
--- a/cap/zx297520v3/sources/meta-zxic/recipes-kernel/linux/files/zx297520v3/linux-5_10-vehicle_dc_ref-normal-defconfig
+++ b/cap/zx297520v3/sources/meta-zxic/recipes-kernel/linux/files/zx297520v3/linux-5_10-vehicle_dc_ref-normal-defconfig
@@ -156,7 +156,9 @@
CONFIG_SIGNALFD=y
CONFIG_TIMERFD=y
CONFIG_EVENTFD=y
+#l.yang modify for mount to limit size
CONFIG_SHMEM=y
+#l.yang modify for mount to limit size
CONFIG_AIO=y
CONFIG_IO_URING=y
CONFIG_ADVISE_SYSCALLS=y
@@ -2232,7 +2234,7 @@
# end of Microsoft Hyper-V guest support
# CONFIG_GREYBUS is not set
-# CONFIG_STAGING is not set
+CONFIG_STAGING=y
#
# ZX297520 voice buffer driver
#
@@ -2491,10 +2493,12 @@
# CONFIG_PROC_CHILDREN is not set
CONFIG_KERNFS=y
CONFIG_SYSFS=y
+#l.yang modify for mount to limit size
CONFIG_TMPFS=y
CONFIG_TMPFS_POSIX_ACL=y
CONFIG_TMPFS_XATTR=y
CONFIG_MEMFD_CREATE=y
+#l.yang modify for mount to limit size
# CONFIG_CONFIGFS_FS is not set
# end of Pseudo filesystems
diff --git a/cap/zx297520v3/sources/meta-zxic/recipes-kernel/linux/linux-zxic_5.10.bb b/cap/zx297520v3/sources/meta-zxic/recipes-kernel/linux/linux-zxic_5.10.bb
index abadd9b..dedd280 100755
--- a/cap/zx297520v3/sources/meta-zxic/recipes-kernel/linux/linux-zxic_5.10.bb
+++ b/cap/zx297520v3/sources/meta-zxic/recipes-kernel/linux/linux-zxic_5.10.bb
@@ -12,7 +12,7 @@
DEPENDS += "${@bb.utils.contains('DISTRO_FEATURES','dm-verity','zstd-native','',d)}"
inherit kernel siteinfo
-EXTRA_OEMAKE_append = " LOADADDR=${KERNEL_LOADADDR} EXTRA_CFLAGS='${ZXIC_EXTRA_CFLAGS}' "
+EXTRA_OEMAKE_append = " LOADADDR=${KERNEL_LOADADDR} EXTRA_CFLAGS='${ZXIC_EXTRA_CFLAGS}' EXTRA_AFLAGS='${ZXIC_EXTRA_CFLAGS}' "
FILESEXTRAPATHS_prepend :="${SRC-PATH}:"
# PR_CONFIG_cpe = "linux-5_10-cpe-${BOOT_CTL}-defconfig"
# PR_CONFIG_v2x = "linux-5_10-v2x-${BOOT_CTL}-defconfig"
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 4dea285..75ee812 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 fe069d4..4b725c0 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/kernel/svc_s.S b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/arch/arm/kernel/svc_s.S
old mode 100644
new mode 100755
index a52abb7..f249292
--- a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/arch/arm/kernel/svc_s.S
+++ b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/arch/arm/kernel/svc_s.S
@@ -1,9 +1,12 @@
+#define _USE_VEHICLE_DC
+#include "ram_base_config_7520v3.h"
+
#define GIC_DIST_BASE (0xF2000000)
#define GIC_RDIST_BASE (0xF2040000)
#define REAL_TXT_ADDR (CONFIG_PHYS_OFFSET + 0x8000)
-#define DTB_ADDR (CONFIG_DTB_ADDR)
+#define DTB_ADDR (DDR_BASE_CAP_DTB_ADDR)
secure_init:
diff --git a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/misc/zcat/debug_info.c b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/misc/zcat/debug_info.c
index d23e340..52a2146 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/misc/zcat/debug_info.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/misc/zcat/debug_info.c
@@ -5,10 +5,7 @@
#include <linux/cdev.h>
#include <linux/semaphore.h>
#include <linux/timer.h>
-
-// #include <linux/fs.h>
#include <linux/ioport.h>
-// #include <linux/serial_reg.h>
#include <linux/poll.h>
#include <linux/delay.h>
#include <linux/wait.h>
@@ -18,88 +15,94 @@
#include <linux/types.h>
#include <linux/device.h>
#include <linux/miscdevice.h>
-// #include <linux/spinlock.h>
#include <linux/list.h>
#include <linux/slab.h>
#include <linux/sched.h>
-// #include <linux/kthread.h>
#include <asm/io.h>
-
#include <linux/vmalloc.h>
#include <linux/soc/zte/rpmsg.h>
-// #include <linux/syscalls.h>
-
-// #include "debuginfo.h"
#include "pub_debug_info.h"
#include "ringbuf.h"
+#include "ram_config.h"
+#include "ZspTrace.h"
+#include <linux/proc_fs.h>
+#include <asm/barrier.h>
+#include <asm/cache.h>
+#include <asm/cacheflush.h>
+#include <linux/seq_file.h>
+#include <linux/ktime.h>
+#include <linux/time.h>
-
-#if defined(_USE_ZXIC_DEBUG_INFO) && !defined(CONFIG_SYSTEM_RECOVERY)
+#if defined(_USE_ZXIC_DEBUG_INFO)
/*******************************************************************************
* 宏定义 *
*******************************************************************************/
-#define DEBUG_INFO_SHARE_MEM_LEN (0x2000)
+#define DEBUG_INFO_AP_MEM_LEN (0x2000)
#define DEBUG_INFO_READABLE_LEN (0x1400)
-#define DEBUG_INFO_MAX_DATA_LEN (128)
-#define DEBUG_INFO_MAX_TOTAL_LEN (140) // 8 + 128 + 4
#define DEBUG_INFO_READ_TIME_MSECS (10000)
-#define DEBUG_INFO_CHANNEL (9)
-#define DEBUG_INFO_MSG_CAP_SIZE (2 * 1024)
-
#define DEBUG_INFO_OK (0)
#define DEBUG_INFO_ERROR (-1)
+#define DEBUG_READ_NOBLOCK (11)
-#define DEBUG_INFO_IOCTL_SET_DISABLE (0x1001)
+#define DEBUG_INFO_MAX_ID_LEN (16+3)
+#define DEBUG_INFO_MAX_DATA_LEN (128)
+#define DEBUG_INFO_MAX_TIME_LEN (0)//(20+3)
+#define DEBUG_INFO_MAX_DATE_LEN (19+3)
+#define DEBUG_INFO_MAX_TOTAL_LEN (DEBUG_INFO_MAX_ID_LEN + DEBUG_INFO_MAX_DATA_LEN + DEBUG_INFO_MAX_TIME_LEN)
+
+#define DEBUG_INFO_CORE_NUM (2)
/*******************************************************************************
* 结构体定义 *
*******************************************************************************/
-typedef unsigned int UINT32;
+typedef unsigned int UINT32;
typedef unsigned short UINT16;
-typedef unsigned char UINT8;
-
-typedef struct
-{
- UINT16 module_id; // 模块id
- UINT16 sub_len; // 用户数据长度
- UINT32 time;
- char sub_data[]; // 用户数据
-} T_SHARED_MEM_DATA;
-
-typedef struct
-{
- UINT32 head; // 0x010a0a0a
- UINT32 total_len; // 数据内容长度
- long long time; // time()函数获取
+typedef unsigned char UINT8;
+typedef unsigned long UINT64;
+typedef struct{
+ unsigned int head; /* 0x010a0a0a */
+ unsigned int datalen[DEBUG_INFO_CORE_NUM]; /* 数据内容长度 */
} T_SAVE_FILE_DATA;
/*******************************************************************************
* 全局变量 *
*******************************************************************************/
-volatile T_RINGBUFFER *g_debug_info_buf = NULL;
static struct semaphore debug_sem;
-static DEFINE_RAW_SPINLOCK(debugWr_lock);
static int g_init_flag = 0;
+UINT32 *g_ps_debug_write_cnt;
+UINT32 *g_ps_debug_full_cnt;
+UINT32 g_ps_debug_read_cnt;
+UINT32 g_ps_debug_read_full_cnt;
+unsigned long g_debug_read_cnt;
+unsigned long g_ap_debug_write_cnt;
+unsigned long g_ap_debug_read_cnt;
+UINT8 *g_ap_debug_buffer_start;
+UINT8 *g_ap_debug_buffer_read;
+UINT8 *g_ap_debug_buffer_write;
+UINT8 *g_ap_debug_buffer_end;
+UINT8 *g_ps_debug_buffer_start;
+UINT8 *g_ps_debug_buffer_end;
+UINT8 *g_ps_debug_buffer_read;
+static DEFINE_SPINLOCK(debug_info_lock);
+static char g_ap_debug_buffer[DEBUG_INFO_AP_MEM_LEN];
+unsigned long g_debug_read_state = 0;
/*******************************************************************************
* 内部函数定义 *
*******************************************************************************/
-static int sc_debug_info_read_to_user(char *buf, unsigned short count);
-static int sc_debug_info_record_from_user(const char *info, unsigned short count);
-static int sc_debug_info_write(UINT32 flag, const UINT8 *buf, UINT32 len);
-static void sc_debug_info_from_ap(void *buf, unsigned int len);
-
+static int sc_debug_info_read_to_user(char *buf, size_t count);
+static int sc_debug_info_record_from_user(const char *info, size_t count);
+static void sc_debug_info_from_ps(void *buf, unsigned int len);
static void kernel_timer_timeout(struct timer_list *t);
static ssize_t debug_info_read(struct file *fp, char __user *buf, size_t count, loff_t *pos);
static ssize_t debug_info_write(struct file *fp, const char __user *buf, size_t count, loff_t *pos);
static int debug_info_open(struct inode *ip, struct file *fp);
static long debug_info_ioctl(struct file *fp, unsigned int cmd, unsigned long arg);
static int debug_info_release(struct inode *ip, struct file *fp);
-
-//初始化timer
+extern u64 cop_time_get_value64(void);
+extern int seq_write(struct seq_file *seq, const void *data, size_t len);
static DEFINE_TIMER(timer, kernel_timer_timeout);
-
static const struct file_operations debug_info_fops = {
.owner = THIS_MODULE,
.read = debug_info_read,
@@ -114,35 +117,36 @@
.name = "debug_info",
.fops = &debug_info_fops,
};
-
static void kernel_timer_timeout(struct timer_list *t)
-{
+{
if (debug_sem.count == 0)
- {
+ {
up(&debug_sem);
}
- /* 因为内核定时器是一个单次的定时器,所以如果想要多次重复定时需要在定时器绑定的函数结尾重新装载时间,并启动定时 */
/* Kernel Timer restart */
- mod_timer(&timer, jiffies + msecs_to_jiffies(DEBUG_INFO_READ_TIME_MSECS));
+ mod_timer(&timer, jiffies + msecs_to_jiffies(DEBUG_INFO_READ_TIME_MSECS));
}
+/* Started by AICoder, pid:y6ffbg9a06ieda114a190b4cb0ff4417bd78c0f4 */
static ssize_t debug_info_read(struct file *fp, char __user *buf, size_t count, loff_t *pos)
{
int ret;
int rd_len;
- ret = down_interruptible(&debug_sem);
- if(ret < 0)
+ if (g_debug_read_state != DEBUG_READ_NOBLOCK)
{
- return ret;
+ ret = down_interruptible(&debug_sem);
+ if (ret < 0)
+ {
+ return ret;
+ }
}
- else
- {
- rd_len = sc_debug_info_read_to_user(buf, count);
- }
+
+ rd_len = sc_debug_info_read_to_user(buf, count);
return rd_len;
}
+/* Ended by AICoder, pid:y6ffbg9a06ieda114a190b4cb0ff4417bd78c0f4 */
static ssize_t debug_info_write(struct file *fp, const char __user *buf, size_t count, loff_t *pos)
{
@@ -156,241 +160,425 @@
return 0;
}
-static long debug_info_ioctl(struct file *fp, unsigned int cmd, unsigned long arg)
-{
- switch(cmd)
- {
- case DEBUG_INFO_IOCTL_SET_DISABLE:
- *(volatile UINT32 *)ZCAT_DEBUG_INFO_DISABLE = arg;
- break;
-
- default:
- break;
+/* Started by AICoder, pid:u635ed463ce5ab2145a109c3c0f54d149e6386b3 */
+static long debug_info_ioctl(struct file *fp, unsigned int cmd, unsigned long arg) {
+ if (cmd == DEBUG_READ_NOBLOCK) {
+ g_debug_read_state = DEBUG_READ_NOBLOCK;
+ } else {
+ // 如果命令不匹配,返回错误码
+ return -EINVAL;
}
+
+ // 记录调试信息
+ sc_debug_info_record("debug_info", "read noblock!\n");
+
return 0;
}
+/* Ended by AICoder, pid:u635ed463ce5ab2145a109c3c0f54d149e6386b3 */
static int debug_info_release(struct inode *ip, struct file *fp)
{
return 0;
}
-static void sc_debug_info_from_ap(void *buf, unsigned int len)
+static int ap_log_proc_show(struct seq_file *m, void *v)
{
- T_SHARED_MEM_DATA *debug_msg = (T_SHARED_MEM_DATA *)buf;
- debug_msg->time = jiffies;
+ unsigned long writecnt = g_ap_debug_write_cnt;
- sc_debug_info_write(ZCAT_MEM_TYPE_KERNEL, buf, len);
+ if (writecnt > DEBUG_INFO_AP_MEM_LEN)
+ {
+ writecnt = DEBUG_INFO_AP_MEM_LEN;
+ }
+
+ seq_write(m, g_ap_debug_buffer_start, writecnt);
+
+ return 0;
+}
+
+static int ps_log_proc_show(struct seq_file *m, void *v)
+{
+ unsigned long writecnt = 0;
+ unsigned long fulllcnt = 0;
+
+ writecnt = *(UINT32 *)g_ps_debug_write_cnt;
+ fulllcnt = *(UINT32 *)g_ps_debug_full_cnt;
+
+ if (fulllcnt > 0)
+ {
+ writecnt = PS_DEBUG_INFO_SIZE;
+ }
+
+ //__inval_dcache_area((void *)g_ps_debug_buffer_start, writecnt);
+ seq_write(m, g_ps_debug_buffer_start, writecnt);
+
+ return 0;
+}
+
+UINT32 skip_end_null(char *buf, size_t count)
+{
+ UINT32 len = 0;
+ char *tmpbuf = buf;
+
+ while (count > 0)
+ {
+ if (*tmpbuf == '\0')
+ {
+ ++len;
+ tmpbuf -= 1;
+ count -= 1;
+ }
+ else
+ {
+ break;
+ }
+ }
+
+ return len;
+}
+
+int sc_debug_info_read_ap(char *buf, size_t count)
+{
+ UINT32 readLen = 0;
+ UINT32 updatelen = 0;
+ UINT32 readremainLen = 0;
+ UINT8 *readbuffaddr = 0;
+ UINT32 nullLen = 0;
+ char *tmpbuf = buf;
+
+ updatelen = g_ap_debug_write_cnt - g_ap_debug_read_cnt;
+ if (updatelen > DEBUG_INFO_AP_MEM_LEN)
+ updatelen = DEBUG_INFO_AP_MEM_LEN;
+
+ if(g_ap_debug_buffer_end - g_ap_debug_buffer_read >= updatelen)
+ {
+ readbuffaddr = g_ap_debug_buffer_read;
+ readLen = updatelen;
+ if (copy_to_user(tmpbuf , readbuffaddr, readLen))
+ {
+ return -EFAULT;
+ }
+ g_ap_debug_buffer_read += readLen;
+ }
+ else if(g_ap_debug_buffer_end - g_ap_debug_buffer_read < updatelen)
+ {
+ readbuffaddr = g_ap_debug_buffer_read;
+ readLen = g_ap_debug_buffer_end - readbuffaddr;
+ readremainLen = updatelen - readLen;
+ nullLen = skip_end_null(g_ap_debug_buffer_end - 1, readLen);
+ readLen = readLen - nullLen;
+ if (copy_to_user(tmpbuf, readbuffaddr, readLen))
+ {
+ return -EFAULT;
+ }
+ if (copy_to_user(tmpbuf + readLen, g_ap_debug_buffer_start, readremainLen))
+ {
+ return -EFAULT;
+ }
+ g_ap_debug_buffer_read = g_ap_debug_buffer_start + readremainLen;
+ }
+ else
+ {
+ panic("gaohf sc_debug_info_read_to_user error");
+ }
+ g_ap_debug_read_cnt = g_ap_debug_write_cnt;
+
+ return (readLen + readremainLen);
+}
+
+int sc_debug_info_read_ps(char *buf, size_t count)
+{
+ UINT32 readLen = 0;
+ UINT32 readremainLen = 0;
+ UINT8 *readbuffaddr = 0;
+ UINT32 fulllcnt = 0;
+ UINT32 fulllcntdiff = 0;
+ unsigned long writecnt = 0;
+ UINT32 nullLen = 0;
+ char *tmpbuf = buf;
+
+ writecnt = *(volatile UINT32 *)g_ps_debug_write_cnt;
+ fulllcnt = *(volatile UINT32 *)g_ps_debug_full_cnt;
+
+ if (fulllcnt >= g_ps_debug_read_full_cnt)
+ {
+ fulllcntdiff = fulllcnt - g_ps_debug_read_full_cnt;
+ }
+ else
+ {
+ fulllcntdiff = 0xFFFFFFFF - g_ps_debug_read_full_cnt + fulllcnt;
+ }
+ if(fulllcntdiff >= 2)
+ {
+ readbuffaddr = g_ps_debug_buffer_start + writecnt;
+ readLen = g_ps_debug_buffer_end - readbuffaddr;
+ readremainLen = writecnt;
+ nullLen = skip_end_null(g_ps_debug_buffer_end - 1, readLen);
+ readLen = readLen - nullLen;
+ if (copy_to_user(tmpbuf, readbuffaddr, readLen))
+ {
+ return -EFAULT;
+ }
+ if (copy_to_user(tmpbuf + readLen, g_ps_debug_buffer_start, readremainLen))
+ {
+ return -EFAULT;
+ }
+ g_ps_debug_buffer_read = g_ps_debug_buffer_start + readremainLen;
+ }
+ else if(fulllcntdiff == 0)
+ {
+ readbuffaddr = g_ps_debug_buffer_read;
+ readLen = writecnt - g_ps_debug_read_cnt;;
+ if (copy_to_user(tmpbuf , readbuffaddr, readLen))
+ {
+ return -EFAULT;
+ }
+ g_ps_debug_buffer_read += readLen;
+ }
+ else if(fulllcntdiff == 1)
+ {
+ readLen = writecnt >= g_ps_debug_read_cnt ? writecnt : g_ps_debug_read_cnt;
+ readLen = PS_DEBUG_INFO_SIZE - readLen;
+ readbuffaddr = g_ps_debug_buffer_read;
+ nullLen = skip_end_null(g_ps_debug_buffer_end - 1, readLen);
+ readLen = readLen - nullLen;
+ if (copy_to_user(tmpbuf, readbuffaddr, readLen))
+ {
+ return -EFAULT;
+ }
+ readremainLen = writecnt;
+ if (copy_to_user(tmpbuf + readLen , g_ps_debug_buffer_start, readremainLen))
+ {
+ return -EFAULT;
+ }
+ g_ps_debug_buffer_read = g_ps_debug_buffer_start + readremainLen;
+ }
+ else
+ {
+ panic("gaohf sc_debug_info_read_to_user error");
+ }
+ g_ps_debug_read_cnt = writecnt;
+ g_ps_debug_read_full_cnt = fulllcnt;
+
+ return (readLen + readremainLen);
+}
+
+int sc_debug_info_read_to_user(char *buf, size_t count)
+{
+ char *tmpbuf = 0;
+ int ret = 0;
+ int ap_len = 0;
+ int ps_len = 0;
+ T_SAVE_FILE_DATA fileDataHead;
+
+ if (g_init_flag == 0)
+ {
+ printk("debug_info not init.\n");
+ return DEBUG_INFO_ERROR;
+ }
+
+ if (count == 0 || buf == NULL )
+ {
+ printk("sc_debug_info_read_to_user count == 0 || buf == NULL \n");
+ return DEBUG_INFO_ERROR;
+ }
+ tmpbuf = buf + sizeof(T_SAVE_FILE_DATA);
+ ap_len = sc_debug_info_read_ap(tmpbuf, DEBUG_INFO_AP_MEM_LEN);
+ tmpbuf += ap_len;
+ ps_len = sc_debug_info_read_ps(tmpbuf, PS_DEBUG_INFO_SIZE);
+
+ fileDataHead.head = 0x010a0a0a;
+ fileDataHead.datalen[0] = ap_len;
+ fileDataHead.datalen[1] = ps_len;
+
+ if (copy_to_user(buf, &fileDataHead, sizeof(T_SAVE_FILE_DATA)))
+ {
+ printk("sc_debug_info_read_to_user copy_to_user error \n");
+ return -EFAULT;
+ }
+ return sizeof(T_SAVE_FILE_DATA) + ap_len + ps_len;
+}
+
+static int sc_debug_info_record_from_user(const char *info, size_t count)
+{
+ UINT32 cnt = 0;
+ int spacelen;
+ int msg_len = 0;
+ struct tm tm;
+ time64_t time;
+ unsigned long used_space;
+ char buffer[DEBUG_INFO_MAX_TOTAL_LEN];
+ unsigned long flags;
+ UINT8 *tmp_write_addr = buffer;
+
+ if (g_init_flag == 0 || info == NULL)
+ {
+ printk("debug_info not init or sc_debug_info_record_from_user info is NULL\n");
+ return DEBUG_INFO_ERROR;
+ }
+
+ if(count > DEBUG_INFO_MAX_DATA_LEN + DEBUG_INFO_MAX_ID_LEN)
+ {
+ printk("debug_info data too long\n");
+ return DEBUG_INFO_ERROR;
+ }
+
+ time = ktime_get_real_seconds();
+ time64_to_tm(time, 0, &tm);
+ cnt = snprintf((char *)tmp_write_addr, DEBUG_INFO_MAX_DATE_LEN, "[%ld-%02d-%02d %d:%02d:%02d]", \
+ tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec);
+ tmp_write_addr += cnt;
+ msg_len = cnt;
+
+ spin_lock_irqsave(&debug_info_lock, flags);
+ spacelen = g_ap_debug_buffer_end - g_ap_debug_buffer_write;
+ if (spacelen < msg_len + count)
+ {
+ g_ap_debug_write_cnt += spacelen;
+ memset(g_ap_debug_buffer_write, '\0', spacelen);
+ g_ap_debug_buffer_write = g_ap_debug_buffer_start;
+ }
+ memcpy(g_ap_debug_buffer_write, buffer, msg_len);
+ if (copy_from_user(g_ap_debug_buffer_write + msg_len, info, count))
+ return -EFAULT;
+ msg_len += count;
+ g_ap_debug_buffer_write += msg_len;
+ g_ap_debug_write_cnt += msg_len;
+ used_space = g_ap_debug_write_cnt - g_ap_debug_read_cnt;
+ spin_unlock_irqrestore(&debug_info_lock, flags);
+ if (used_space > DEBUG_INFO_READABLE_LEN)
+ {
+ if (debug_sem.count == 0)
+ {
+ up(&debug_sem);
+ }
+ }
+ return msg_len;
+}
+
+int sc_debug_info_vrecord(char *id, const char *format, va_list args)
+{
+ int spacelen;
+ int msg_len = 0;
+ int cnt = 0;
+ unsigned long used_space;
+ struct tm tm;
+ time64_t time;
+ char buffer[DEBUG_INFO_MAX_TOTAL_LEN];
+ unsigned long flags;
+ UINT8 *tmp_write_addr = buffer;
+
+ time = ktime_get_real_seconds();
+ time64_to_tm(time, 0, &tm);
+ cnt = snprintf((char *)tmp_write_addr, DEBUG_INFO_MAX_DATE_LEN, "[%ld-%02d-%02d %d:%02d:%02d]", tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec);
+ tmp_write_addr += cnt;
+ msg_len = cnt;
+
+ cnt = snprintf((char *)tmp_write_addr, DEBUG_INFO_MAX_ID_LEN, "[%s]",id);
+ tmp_write_addr += cnt;
+ msg_len += cnt;
+ msg_len += vsnprintf((char *)tmp_write_addr, DEBUG_INFO_MAX_DATA_LEN, format, args);
+
+ spin_lock_irqsave(&debug_info_lock, flags);
+ spacelen = g_ap_debug_buffer_end - g_ap_debug_buffer_write;
+ if (spacelen < DEBUG_INFO_MAX_TOTAL_LEN)
+ {
+ g_ap_debug_write_cnt += spacelen;
+ memset(g_ap_debug_buffer_write, '\0', spacelen);
+ g_ap_debug_buffer_write = g_ap_debug_buffer_start;
+ }
+
+ memcpy(g_ap_debug_buffer_write, buffer, msg_len);
+ g_ap_debug_buffer_write += msg_len;
+ g_ap_debug_write_cnt += msg_len;
+ used_space = g_ap_debug_write_cnt - g_ap_debug_read_cnt;
+ spin_unlock_irqrestore(&debug_info_lock, flags);
+ if (used_space > DEBUG_INFO_READABLE_LEN)
+ {
+ if (debug_sem.count == 0)
+ {
+ up(&debug_sem);
+ }
+ }
+ return msg_len;
+}
+EXPORT_SYMBOL(sc_debug_info_vrecord);
+
+int sc_debug_info_record(char *id, const char *format, ...)
+{
+ va_list args;
+ int r;
+
+ if (g_init_flag == 0)
+ {
+ printk("debug_info not init.\n");
+ return DEBUG_INFO_ERROR;
+ }
+
+ va_start(args, format);
+ r = sc_debug_info_vrecord(id, format, args);
+ va_end(args);
+
+ return r;
+}
+EXPORT_SYMBOL(sc_debug_info_record);
+
+void early_debug_info_init(void)
+{
+ g_ap_debug_buffer_start = g_ap_debug_buffer;
+ g_ap_debug_buffer_write = g_ap_debug_buffer_start;
+ g_ap_debug_buffer_read = g_ap_debug_buffer_start;
+ g_ap_debug_buffer_end = g_ap_debug_buffer + DEBUG_INFO_AP_MEM_LEN;
+ g_ap_debug_read_cnt = 0;
+ g_ap_debug_write_cnt = 0;
+
+ g_init_flag = 1;
+ printk("cap early_debug_info_init success \n");
}
static int __init debug_info_init(void)
{
- int ret = misc_register(&debug_info_device);
+ int ret;
+
+ ret = misc_register(&debug_info_device);
if (ret)
{
- printk("debug_info_device init.\n");
+ printk("debug_info_init init.\n");
return DEBUG_INFO_ERROR;
}
- void *mem;
- mem = vmalloc(DEBUG_INFO_SHARE_MEM_LEN);
- if (!mem)
- {
- printk("vmalloc failed.\n");
- return DEBUG_INFO_ERROR;
- }
-
- g_debug_info_buf = CreateRingBuffer((UINT8 *)mem, DEBUG_INFO_SHARE_MEM_LEN);
- if (g_debug_info_buf == NULL)
- {
- printk("CreateRingBuffer failed.\n");
- return DEBUG_INFO_ERROR;
- }
-#if 1
- ret = rpmsgCreateChannel(
- CORE_PS0,
- DEBUG_INFO_CHANNEL,
- DEBUG_INFO_MSG_CAP_SIZE);
- if (ret != DEBUG_INFO_OK)
- {
- printk("rpmsgCreateChannel failed, ret = %d\n", ret);
- return DEBUG_INFO_ERROR;
- }
-
- ret = rpmsgRegCallBack(
- CORE_PS0,
- DEBUG_INFO_CHANNEL,
- sc_debug_info_from_ap);
- if (ret != DEBUG_INFO_OK)
- {
- printk("rpmsgRegCallBack failed,ret = %d\n", ret);
- return DEBUG_INFO_ERROR;
- }
-#endif
+ g_ps_debug_write_cnt = (UINT32 *)ioremap(PS_DEBUG_INFO_LEN_ADDR_PA, PS_DEBUG_INFO_LEN_SIZE);
+ // printf("PS_DEBUG_INFO_LEN_ADDR_PA \n",)
+ g_ps_debug_full_cnt = (UINT32 *)((char *)g_ps_debug_write_cnt + 4);
+ g_ps_debug_buffer_start = (unsigned long)ioremap(PS_DEBUG_INFO_ADDR_PA, PS_DEBUG_INFO_SIZE);
+ g_ps_debug_buffer_read = g_ps_debug_buffer_start;
+ g_ps_debug_buffer_end = g_ps_debug_buffer_start + PS_DEBUG_INFO_SIZE;
+ g_ps_debug_read_cnt = 0;
+ g_ps_debug_read_full_cnt = 0;
sema_init(&debug_sem, 0);
- /* 添加并启动定时器, 10ms */
- mod_timer(&timer, jiffies + 1);
-
- g_init_flag = 1;
-
+ proc_create_single("debug_info_cap", 0, NULL, ap_log_proc_show);
+ proc_create_single("debug_info_ap", 0, NULL, ps_log_proc_show);
+ mod_timer(&timer, jiffies + 1);
+ printk("cap debug_info_init success \n");
+ // g_init_flag = 1;
return 0;
}
static void __exit debug_info_exit(void)
{
misc_deregister(&debug_info_device);
-
del_timer(&timer);
}
-static int sc_debug_info_write(UINT32 flag, const UINT8 *buf, UINT32 len)
-{
- UINT32 writelen;
- UINT32 used_space;
- unsigned long flags;
-
- if (len == 0 || g_debug_info_buf == NULL)
- {
- printk("sc_debug_info_write:: (len == 0 || g_debug_info_buf == NULL).\n");
- return DEBUG_INFO_ERROR;
- }
-
- raw_spin_lock_irqsave(&debugWr_lock, flags);
- writelen = WriteRingBuffer(g_debug_info_buf, buf, len, flag);
- raw_spin_unlock_irqrestore(&debugWr_lock, flags);
- used_space = GetRingBufferSize(g_debug_info_buf);
- if (used_space > DEBUG_INFO_READABLE_LEN)
- {
- if (debug_sem.count == 0)
- {
- up(&debug_sem);
- }
- }
-
- return writelen;
-}
-
-static int sc_debug_info_read_to_user(char *buf, unsigned short count)
-{
- unsigned int bufSize_used = 0;
- unsigned int readLen = 0;
- unsigned int bufLen = 0;
- T_SAVE_FILE_DATA fileDataHead;
-
- if (g_init_flag == 0)
- {
- printk("debug_info not init.\n");
- return DEBUG_INFO_ERROR;
- }
- if (count == 0 || buf == NULL || g_debug_info_buf == NULL)
- {
- printk("sc_debug_info_read_to_user:: (count == 0 || buf == NULL || g_debug_info_buf == NULL).\n");
- return DEBUG_INFO_ERROR;
- }
-
- bufSize_used = GetRingBufferSize(g_debug_info_buf);
- if (bufSize_used == 0)
- {
- // printk("sc_debug_info_read_to_user:: ringBuf is empty.\n");
- return 0;
- }
-
- fileDataHead.head = 0x010a0a0a;
- fileDataHead.time = 0;
- fileDataHead.total_len = bufSize_used;
-
- copy_to_user(buf, &fileDataHead, sizeof(T_SAVE_FILE_DATA));
-
- readLen = ReadRingBuffer(g_debug_info_buf, (buf + sizeof(T_SAVE_FILE_DATA)), bufSize_used, ZCAT_MEM_TYPE_USER);
- if (readLen == 0)
- {
- // printk("ReadRingBuffer failed.\n");
- return 0;
- }
-
- return (readLen + sizeof(T_SAVE_FILE_DATA));
-}
-
-static int sc_debug_info_record_from_user(const char *info, unsigned short count)
-{
- unsigned int cnt = 0;
- unsigned int my_jiffies = jiffies;
-
- if (g_init_flag == 0)
- {
- printk("debug_info not init.\n");
- return DEBUG_INFO_ERROR;
- }
- if (info == NULL)
- {
- printk("sc_debug_info_record_from_user:: info is NULL.\n");
- return DEBUG_INFO_ERROR;
- }
-
- copy_to_user(info + 4, &my_jiffies, sizeof(my_jiffies));
- cnt = sc_debug_info_write(ZCAT_MEM_TYPE_USER, (UINT8 *)info, count);
-
- return cnt;
-}
-
module_init(debug_info_init);
module_exit(debug_info_exit);
-
-MODULE_AUTHOR("jcw");
MODULE_DESCRIPTION("debug_info driver");
MODULE_LICENSE("GPL");
-
-int sc_debug_info_vrecord(unsigned int id, const char *format, va_list args)
-{
- int len;
- UINT32 writelen;
- // va_list args;
- char str_buf[DEBUG_INFO_MAX_TOTAL_LEN] __attribute__((aligned(4)));
- T_SHARED_MEM_DATA *shareMemData = (T_SHARED_MEM_DATA *)str_buf;
-
- if (g_init_flag == 0)
- {
- printk("debug_info not init.\n");
- return DEBUG_INFO_ERROR;
- }
-
- /* args是一个char*类型指针,指向format之后的第一个参数*/
- // va_start(args, format);
- len = vsnprintf(shareMemData->sub_data, DEBUG_INFO_MAX_DATA_LEN, format, args);
- // va_end(args);
- if (len < 0)
- {
- printk("vsnprintf format error.\n");
- return DEBUG_INFO_ERROR;
- }
-
- shareMemData->module_id = (UINT16)(id & 0xFFFF);
- shareMemData->sub_len = len;
- shareMemData->time = jiffies;
-
- writelen = sc_debug_info_write(ZCAT_MEM_TYPE_KERNEL, (UINT8 *)shareMemData, len + sizeof(T_SHARED_MEM_DATA));
- return writelen;
-}
-EXPORT_SYMBOL(sc_debug_info_vrecord);
-
-int sc_debug_info_record(unsigned int id, const char *format, ...)
-{
- va_list args;
- int r;
-
- va_start(args, format);
- r = sc_debug_info_vrecord(id, format, args);
- va_end(args);
-
-
- return r;
-}
-EXPORT_SYMBOL(sc_debug_info_record);
#else
-int sc_debug_info_record(unsigned int id, const char *format, ...)
+int sc_debug_info_record(char *id, const char *format, ...)
{
- return 0;
+ return 0;
}
#endif /* _USE_ZXIC_DEBUG_INFO */
+
diff --git a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/net/zvnet/zvnet_dev.c b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/net/zvnet/zvnet_dev.c
index 2a8fcc3..c7da7a4 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/net/zvnet/zvnet_dev.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/net/zvnet/zvnet_dev.c
@@ -8,7 +8,7 @@
#include "zvnet_dev.h"
#include "ram_config.h"
#include <net/netfilter/nf_conntrack.h>
-
+#include <net/SI/fast_common.h>
/*******************************************************************************
* Macro definitions *
******************************************************************************/
@@ -72,10 +72,8 @@
module_param(g_wrap_num, int, 0644);
unsigned int g_wrap_timeout = 10;
module_param(g_wrap_timeout, int, 0644);
-/*jb.qi add for debug network package on 20240806 start*/
unsigned int g_trace_limit = 0;
module_param(g_trace_limit, int, 0644);
-/*jb.qi add for debug network package on 20240806 end*/
#endif
/*******************************************************************************
@@ -85,7 +83,6 @@
extern void v7_dma_map_area(const void *, size_t, int);
extern void *get_ct_for_ap(struct sk_buff *skb);
extern void put_ct_for_ap(void *ct);
-extern spinlock_t fast_fw_spinlock;
/*******************************************************************************
* Local function declarations *
******************************************************************************/
@@ -128,38 +125,41 @@
return NULL;
}
+/* Started by AICoder, pid:2fa080381bb2e3d14fbc0aa44091291a60d78e35 */
void check_skb_test(struct sk_buff *skb)
{
- if(skb && vir_addr_ap){
- struct sk_buff *tmp_skb;
- if((skb->capHead && (virt_to_phys_ap(skb->head) == NULL))
- || ((skb->capHead == NULL) && virt_to_phys_ap(skb->head))){
- dump_stack();
- msleep(1000);
- panic("capHead err");
- }
- skb_queue_walk(&g_zvnet_skb_queue, tmp_skb) {
- if(tmp_skb == skb){
- dump_stack();
- msleep(1000);
- panic("dup free");
- }
- }
- }
+ if (skb && vir_addr_ap) {
+ struct sk_buff *tmp_skb;
+ if ((skb->capHead && (virt_to_phys_ap(skb->head) == NULL))
+ || ((skb->capHead == NULL) && virt_to_phys_ap(skb->head))) {
+ dump_stack();
+ panic("capHead err");
+ }
+ skb_queue_walk(&g_zvnet_skb_queue, tmp_skb) {
+ if (tmp_skb == skb) {
+ dump_stack();
+ panic("dup free");
+ }
+ }
+ }
}
-/*jb.qi add for debug network package on 20240806 start*/
+/* Ended by AICoder, pid:2fa080381bb2e3d14fbc0aa44091291a60d78e35 */
+
+/* Started by AICoder, pid:z5702yf8bad07ad1448a083e806dc31250b2418f */
void zvnet_dump_packet(unsigned char * data, int len, int limit_len)
{
int i = 0;
-
- for(i = 0; i < len && i < limit_len; i=i+16)
+ unsigned char *p = data;
+ for(i = 0; i < len && i < limit_len; i+=16)
{
- printk("0x%04x: %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x\n",i,
- *(data+i),*(data+i+1),*(data+i+2),*(data+i+3),*(data+i+4),*(data+i+5),*(data+i+6),*(data+i+7),
- *(data+i+8),*(data+i+9),*(data+i+10),*(data+i+11),*(data+i+12),*(data+i+13),*(data+i+14),*(data+i+15));
+ printk("0x%04x: %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x\n",i,
+ p[0],p[1],p[2],p[3],p[4],p[5],p[6],p[7],
+ p[8],p[9],p[10],p[11],p[12],p[13],p[14],p[15]);
+ p += 16;
}
}
-/*jb.qi add for debug network package on 20240806 end*/
+/* Ended by AICoder, pid:z5702yf8bad07ad1448a083e806dc31250b2418f */
+
int zvnet_get_index_by_netdev(struct net_device *net)
{
int i;
@@ -304,13 +304,11 @@
/* make sure we initialize shinfo sequentially */
skb_reset_network_header(skb);
skb_set_kcov_handle(skb, kcov_common_handle());
- /*jb.qi add for debug network package on 20240806 start*/
if(unlikely(g_trace_limit > 0)){
- printk("-%s-dump_packet-start-%d\n", skb->dev->name, skb->len);
- zvnet_dump_packet(skb->data, skb->len, g_trace_limit);
- printk("-%s-dump_packet-end-\n", skb->dev->name);
- }
- /*jb.qi add for debug network package on 20240806 end*/
+ printk("-%s-dump_packet-start-%d\n", skb->dev->name, skb->len);
+ zvnet_dump_packet(skb->data, skb->len, g_trace_limit);
+ printk("-%s-dump_packet-end-\n", skb->dev->name);
+ }
return skb;
}
@@ -321,33 +319,38 @@
return 0;
}
+/* Started by AICoder, pid:b001dtf2551fd53146790a57201be3321cf0a682 */
static void skb_debug_test(struct sk_buff *skb)
{
int i;
- int vcount = skb->len/10;
- int rcount = skb->len%10;
+ int vcount = skb->len / 10;
+ int rcount = skb->len % 10;
char tmp[64] = {0};
char strbuf[64] = {0};
+ const unsigned char *data = skb->data;
zv_info("\n");
- for(i=0; i<vcount; i++) {
- zv_info("%d---0x%x,0x%x,0x%x,0x%x,0x%x,0x%x,0x%x,0x%x,0x%x,0x%x\n",i,skb->data[0+10*i],skb->data[1+10*i],skb->data[2+10*i],
- skb->data[3+10*i],skb->data[4+10*i],skb->data[5+10*i],skb->data[6+10*i],skb->data[7+10*i],skb->data[8+10*i],skb->data[9+10*i]);
+ for (i = 0; i < vcount; i++) {
+ zv_info("%d---%02x,%02x,%02x,%02x,%02x,%02x,%02x,%02x,%02x,%02x\n", i,
+ data[0 + 10 * i], data[1 + 10 * i], data[2 + 10 * i], data[3 + 10 * i],
+ data[4 + 10 * i], data[5 + 10 * i], data[6 + 10 * i], data[7 + 10 * i],
+ data[8 + 10 * i], data[9 + 10 * i]);
}
- if(vcount > 0) {
- memset(tmp,0,sizeof(tmp));
- memset(strbuf,0,sizeof(strbuf));
- sprintf(strbuf,"%d---",vcount);
+ if (vcount > 0) {
+ memset(tmp, 0, sizeof(tmp));
+ sprintf(strbuf, "%d---", vcount);
+ char *p = strbuf + strlen(strbuf);
- for(i=0; i<rcount; i++)
- {
- sprintf(tmp,"0x%x,",skb->data[10*vcount + i]);
- strcat(strbuf,tmp);
+ for (i = 0; i < rcount; i++) {
+ sprintf(p, "%02x,", data[10 * vcount + i]);
+ p += strlen(p);
}
- zv_info("%s ",strbuf);
+ *(p - 1) = '\0'; // ÒÆ³ý×îºóÒ»¸ö¶ººÅ
+ zv_info("%s ", strbuf);
}
zv_info("\n");
}
+/* Ended by AICoder, pid:b001dtf2551fd53146790a57201be3321cf0a682 */
static int zvnet_open(struct net_device *net)
{
@@ -473,8 +476,8 @@
return NET_XMIT_SUCCESS;
}
- if(unlikely(skb_headroom(skb) < NET_SKB_PAD || skb->next//|| skb->capHead
- || skb->fclone || skb->cloned || (skb_shinfo(skb)->nr_frags) || skb->sk || (skb->indev == NULL)
+ if(unlikely(skb->next//|| skb->capHead || skb_headroom(skb) < NET_SKB_PAD
+ || skb->fclone || skb->cloned || (skb_shinfo(skb)->nr_frags) || skb->sk || (skb->indev == NULL)
|| (skb_shinfo(skb)->tx_flags & SKBTX_DEV_ZEROCOPY) || (skb_has_frag_list(skb)))){
int ret_len = skb->len;
@@ -632,6 +635,7 @@
.ndo_get_stats = zvnet_get_stats,
.ndo_change_mtu = eth_change_mtu,
.ndo_validate_addr = eth_validate_addr,
+ .ndo_set_mac_address = eth_mac_addr,
};
static void v2xnet_init_netdev(struct net_device *net)
@@ -802,30 +806,32 @@
{
struct sk_buff *skb;
#if 0
- char skb_data[ZVNET_TMP_BUFF_LEN];
- int ret_len = 0;
+/* Started by AICoder, pid:sd1cfsbc2eu87c41445f09652039f525fa147687 */
+int ret_len = 0;
+struct sk_buff *skb;
- if(NULL == chninfo || NULL == dev) {
- zv_err("zvnet_channel_read null.\n");
- return NULL;
- }
+ret_len = zvnet_channel_read(chninfo, NULL, 0); // »ñÈ¡ÐèÒª¶ÁÈ¡µÄÊý¾Ý³¤¶È
+if(ret_len <= 0) {
+ zv_err("zvnet_channel_read fail.\n");
+ return NULL;
+}
- ret_len = zvnet_channel_read(chninfo, (void *)skb_data, sizeof(skb_data));
+skb = dev_alloc_skb(ret_len + ZVNET_SKB_PAD);
+if (unlikely(!skb)) {
+ zv_err("netdev_alloc_skb fail,len %d",ret_len);
+ return NULL;
+}
- if(ret_len <= 0) {
- zv_err("zvnet_channel_read fail.\n");
- return NULL;
- }
+ret_len = zvnet_channel_read(chninfo, skb->data, ret_len); // ¶ÁÈ¡Êý¾Ýµ½skb->data
+if(ret_len <= 0) {
+ kfree_skb(skb); // Èç¹û¶Áȡʧ°Ü£¬ÊÍ·ÅÒÑ·ÖÅäµÄskb
+ zv_err("zvnet_channel_read fail.\n");
+ return NULL;
+}
- skb = dev_alloc_skb(ret_len + ZVNET_SKB_PAD);
- if (unlikely(!skb)) {
- zv_err("netdev_alloc_skb fail,len %d",ret_len);
- return NULL;
- }
-
- skb_put(skb,ret_len);
- skb_reserve(skb, ZVNET_SKB_PAD);
- memcpy(skb->data, &skb_data[0], ret_len);
+skb_put(skb,ret_len);
+skb_reserve(skb, ZVNET_SKB_PAD);
+/* Ended by AICoder, pid:sd1cfsbc2eu87c41445f09652039f525fa147687 */
#else
struct T_zvnet_rpmsg buff = {0};
int ret_len = 0;
@@ -1099,6 +1105,9 @@
.flag = 0};
int ret_len = 0;
struct nf_conn *ct;
+ fast_entry_t *entry;
+ struct net_device *in;
+ struct net_device *out;
while(1) {
struct T_zvnet_rpmsg_ctstat buff = {0};
@@ -1115,33 +1124,104 @@
panic("err, ret:%d!!!!!!", ret_len);
}
ct = (struct nf_conn *)buff.cap_nfct;
-
WARN_ON(atomic_read(&ct->ct_general.use) == 0);
if(buff.flag){
+ if(!(buff.pkt[0].pkt || buff.pkt[0].len || buff.pkt[1].pkt || buff.pkt[1].len))
+ continue;
BUG_ON(buff.in <= 0 || buff.out <= 0);
+ in = zvnet_dev[buff.in-1].net;
+ out = zvnet_dev[buff.out-1].net;
if(buff.pkt[0].pkt && buff.pkt[0].len){
zv_info("nf_update %x %s %s %d %d", buff.cap_nfct, ct->indev[0]->name, ct->outdev[0]->name, buff.in, buff.out);
- zvnet_dev[buff.in-1].net->stats.rx_packets += buff.pkt[0].pkt;
- zvnet_dev[buff.in-1].net->stats.rx_bytes += buff.pkt[0].len;
- zvnet_dev[buff.out-1].net->stats.tx_packets += buff.pkt[0].pkt;
- zvnet_dev[buff.out-1].net->stats.tx_bytes += buff.pkt[0].len;
+ in->stats.rx_packets += buff.pkt[0].pkt;
+ in->stats.rx_bytes += buff.pkt[0].len;
+ out->stats.tx_packets += buff.pkt[0].pkt;
+ out->stats.tx_bytes += buff.pkt[0].len;
}
if(buff.pkt[1].pkt && buff.pkt[1].len){
zv_info("nf_update %x %s %s %d %d", buff.cap_nfct, ct->indev[1]->name, ct->outdev[1]->name, buff.out, buff.in);
- zvnet_dev[buff.out-1].net->stats.rx_packets += buff.pkt[1].pkt;
- zvnet_dev[buff.out-1].net->stats.rx_bytes += buff.pkt[1].len;
- zvnet_dev[buff.in-1].net->stats.tx_packets += buff.pkt[1].pkt;
- zvnet_dev[buff.in-1].net->stats.tx_bytes += buff.pkt[1].len;
+ out->stats.rx_packets += buff.pkt[1].pkt;
+ out->stats.rx_bytes += buff.pkt[1].len;
+ in->stats.tx_packets += buff.pkt[1].pkt;
+ in->stats.tx_bytes += buff.pkt[1].len;
}
spin_lock_bh(&fast_fw_spinlock);
+ /*¸üÐÂÁ´½Ó³¬Ê±*/
+ if (IPPROTO_TCP == nf_ct_protonum(ct))
+ {
+ ct->timeout = jiffies + tcp_timeouts[ct->proto.tcp.state];
+ }else if (IPPROTO_UDP == nf_ct_protonum(ct)){
+ /*udp*/
+ if (test_bit(IPS_SEEN_REPLY_BIT, &ct->status)){
+ ct->timeout = jiffies + fast_udp_timeout_stream;
+ }else{
+ ct->timeout = jiffies + fast_udp_timeout;
+ }
+ }
+ entry = (fast_entry_t *)ct->fast_entry;
+ if(entry){
+ WARN_ON(entry->ct != ct);
+ mod_timer(&entry->timeout, ct->timeout);
+ }
ct->packet_info[IP_CT_DIR_ORIGINAL].bytes += buff.pkt[IP_CT_DIR_ORIGINAL].len;
ct->packet_info[IP_CT_DIR_ORIGINAL].packets += buff.pkt[IP_CT_DIR_ORIGINAL].pkt;
ct->packet_info[IP_CT_DIR_REPLY].bytes += buff.pkt[IP_CT_DIR_REPLY].len;
ct->packet_info[IP_CT_DIR_REPLY].packets += buff.pkt[IP_CT_DIR_REPLY].pkt;
+ if(ct->indev[0] && is_vlan_dev(ct->indev[0])){
+ struct net_device *tmp = vlan_dev_real_dev(ct->indev[0]);
+ struct vlan_pcpu_stats *stats = this_cpu_ptr(vlan_dev_priv(ct->indev[0])->vlan_pcpu_stats);
+
+ if(tmp == in){
+/* Started by AICoder, pid:tbef0151bf4135d1479d0a5d108c870bc756e858 */
+u64_stats_update_begin(&stats->syncp);
+stats->rx_packets += buff.pkt[0].pkt;
+stats->rx_bytes += buff.pkt[0].len;
+stats->tx_packets += buff.pkt[1].pkt;
+stats->tx_bytes += buff.pkt[1].len;
+u64_stats_update_end(&stats->syncp);
+/* Ended by AICoder, pid:tbef0151bf4135d1479d0a5d108c870bc756e858 */
+ }else if(tmp == out){
+/* Started by AICoder, pid:y34f7id6bcs049f144f10bb8a05c9703b196635b */
+u64_stats_update_begin(&stats->syncp);
+stats->tx_packets += buff.pkt[0].pkt;
+stats->tx_bytes += buff.pkt[0].len;
+stats->rx_packets += buff.pkt[1].pkt;
+stats->rx_bytes += buff.pkt[1].len;
+u64_stats_update_end(&stats->syncp);
+/* Ended by AICoder, pid:y34f7id6bcs049f144f10bb8a05c9703b196635b */
+ }else
+ zv_err("nf_update0 %s->%s!=%s-%s", in->name, out->name, tmp->name, ct->indev[0]->name);
+ }
+ if(ct->indev[1] && is_vlan_dev(ct->indev[1])){
+ struct net_device *tmp = vlan_dev_real_dev(ct->indev[1]);
+ struct vlan_pcpu_stats *stats = this_cpu_ptr(vlan_dev_priv(ct->indev[1])->vlan_pcpu_stats);
+
+ if(tmp == in){
+/* Started by AICoder, pid:8bef0t51bfu135d1479d0a5d108c870bc756e858 */
+u64_stats_update_begin(&stats->syncp);
+stats->rx_packets += buff.pkt[0].pkt;
+stats->rx_bytes += buff.pkt[0].len;
+stats->tx_packets += buff.pkt[1].pkt;
+stats->tx_bytes += buff.pkt[1].len;
+u64_stats_update_end(&stats->syncp);
+/* Ended by AICoder, pid:8bef0t51bfu135d1479d0a5d108c870bc756e858 */
+ }else if(tmp == out){
+/* Started by AICoder, pid:934f7zd6bcl049f144f10bb8a05c9703b196635b */
+u64_stats_update_begin(&stats->syncp);
+stats->tx_packets += buff.pkt[0].pkt;
+stats->tx_bytes += buff.pkt[0].len;
+stats->rx_packets += buff.pkt[1].pkt;
+stats->rx_bytes += buff.pkt[1].len;
+u64_stats_update_end(&stats->syncp);
+/* Ended by AICoder, pid:934f7zd6bcl049f144f10bb8a05c9703b196635b */
+ }else
+ zv_err("nf_update1 %s->%s!=%s-%s", in->name, out->name, tmp->name, ct->indev[1]->name);
+ }
spin_unlock_bh(&fast_fw_spinlock);
zv_info("nf_update %x %d %d %d %d", buff.cap_nfct, buff.pkt[0].pkt, buff.pkt[0].len, buff.pkt[1].pkt, buff.pkt[1].len);
}else{
zv_info("nf_put %x", buff.cap_nfct);
+ WRITE_ONCE(ct->timeout, nfct_time_stamp);
nf_conntrack_put(buff.cap_nfct);
}
}
@@ -1179,11 +1259,11 @@
return err;
}
- net->needed_headroom += ZVNET_SKB_PAD;//NET_SKB_PAD;
+ //net->needed_headroom += ZVNET_SKB_PAD;//NET_SKB_PAD;
sprintf(net->name, "%s%d", ZVNET_IFNAME_PREFIX, i);
dev = v2xnet_dev_init(net, zvnetdev);
v2xnet_init_netdev(net);
- if(0 == i){
+ if(0 == i || i > 8){
net->flags = (net->flags & (~IFF_NOARP));
}
err = register_netdev(net);
diff --git a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/net/zvnet/zvnet_dev.h b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/net/zvnet/zvnet_dev.h
index d1feaa5..7c46dd3 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/net/zvnet/zvnet_dev.h
+++ b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/net/zvnet/zvnet_dev.h
@@ -27,7 +27,7 @@
__func__ , ## arg)
//zvnetÉ豸×î´óÊý
-#define DDR_ZVNET_DEV_MAX 10
+#define DDR_ZVNET_DEV_MAX 16
#define ZVNET_IFNAME_PREFIX "zvnet"
#define ICP_CHN_ZVNET1 20 //ICP_CHANNEL_WAN1
diff --git a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/rtc/class.c b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/rtc/class.c
old mode 100644
new mode 100755
index 625effe..87310ce
--- a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/rtc/class.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/rtc/class.c
@@ -19,6 +19,7 @@
#include <linux/workqueue.h>
#include "rtc-core.h"
+#include "pub_debug_info.h"
static DEFINE_IDA(rtc_ida);
struct class *rtc_class;
@@ -80,7 +81,7 @@
#endif
err = do_settimeofday64(&tv64);
-
+ sc_debug_info_record("hctosys", "time synchronization successful!\r\n");
dev_info(rtc->dev.parent, "setting system clock to %ptR UTC (%lld)\n",
&tm, (long long)tv64.tv_sec);
diff --git a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/soc/sc/pcu/pcu-zx297520v3.c b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/soc/sc/pcu/pcu-zx297520v3.c
index 66c8cf3..f9b23d7 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/soc/sc/pcu/pcu-zx297520v3.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/soc/sc/pcu/pcu-zx297520v3.c
@@ -37,6 +37,7 @@
#include <linux/soc/sc/rpmsg.h>
#include <dt-bindings/soc/zx297520v3-irq.h>
#include <uapi/linux/sc_bsp/bsp_api.h>
+#include <pub_debug_info.h>
#include "pcu-common.h"
@@ -705,6 +706,7 @@
if(index_found != 0xff)
{
pm_ram_log(" wake: %d [%s]\n", zx297520v3_pcu_int_info[index_found].gic_index, zx297520v3_pcu_int_info[index_found].int_name);
+ sc_debug_info_record(MODULE_ID_CAP_PM, " wake: %d [%s]\n", zx297520v3_pcu_int_info[index_found].gic_index, zx297520v3_pcu_int_info[index_found].int_name);
if(zx297520v3_pcu_int_info[index_found].gic_index ==ICP_PS2AP_INT) {
show_icp_state(CORE_PS0);
diff --git a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/soc/sc/rpmsg/zx29_icp.c b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/soc/sc/rpmsg/zx29_icp.c
index aae42a2..3c5ba58 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/soc/sc/rpmsg/zx29_icp.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/soc/sc/rpmsg/zx29_icp.c
@@ -15,6 +15,7 @@
#include <linux/pm_runtime.h>
#include <linux/soc/sc/common.h>
#include <linux/soc/sc/spinlock.h>
+#include <pub_debug_info.h>
#include "icp_dev.h"
#include "zx29_icp.h"
@@ -334,6 +335,7 @@
icp_get_int_info(actorID, &hw, &lw);
pr_info("[SLP] icpwake: 0x%x 0x%x\n", hw, lw);
+ sc_debug_info_record(MODULE_ID_CAP_PM, " icpwake: 0x%x 0x%x\n", hw, lw);
for (i=0; i<32; i++)
if (lw&BIT(i))
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 fd49fd6..57600dc 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
@@ -2341,7 +2341,9 @@
.iface = SPI_INTERFACE_MOTOROLA_SPI,
.hierarchy = SPI_MASTER,
.slave_tx_disable = DO_NOT_DRIVE_TX,
+ /* yu.dong@20240521 [T106BUG-616] SPI set to slave mode for read will get stuck start */
.rx_lev_trig = SPI_RX_8_OR_MORE_ELEM,
+ /* yu.dong@20240521 [T106BUG-616] SPI set to slave mode for read will get stuck end */
.tx_lev_trig = SPI_TX_4_OR_MORE_EMPTY_LOC,
// .ctrl_len = SSP_BITS_8,
// .wait_state = SSP_MWIRE_WAIT_ZERO,
diff --git a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/include/net/SI/netioc_proc.h b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/include/net/SI/netioc_proc.h
index f0c8aa4..38f9bce 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/include/net/SI/netioc_proc.h
+++ b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/include/net/SI/netioc_proc.h
@@ -417,6 +417,9 @@
extern int fast_local4_output_num; //±¾µØfast_local4³É¹¦·¢Ëͱ¨ÎÄ
extern int fast_local6_output_num; //±¾µØfast_local6³É¹¦·¢Ëͱ¨ÎÄ
extern int fast_tcpdump_num; //fast×¥°üÊýÁ¿
+extern int skb_expand4; //Í·¿Õ¼ä²»¹»ÖØÐÂÉêÇëµÄV4Êý¾Ý°ü
+extern int skb_expand6; //Í·¿Õ¼ä²»¹»ÖØÐÂÉêÇëµÄV6Êý¾Ý°ü
+
extern int double_mac;
diff --git a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/include/net/netfilter/nf_conntrack.h b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/include/net/netfilter/nf_conntrack.h
index 04ab917..ff7b8ea 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/include/net/netfilter/nf_conntrack.h
+++ b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/include/net/netfilter/nf_conntrack.h
@@ -131,6 +131,7 @@
struct conn_skbinfo packet_info[IP_CT_DIR_MAX];
struct net_device* indev[IP_CT_DIR_MAX];
struct net_device* outdev[IP_CT_DIR_MAX];
+ void *fast_entry;
};
static inline struct nf_conn *
diff --git a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/init/main.c b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/init/main.c
index 83d93ea..576e168 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/init/main.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/init/main.c
@@ -852,7 +852,7 @@
}
void __weak early_drv_init(void) {}
-
+void __weak early_debug_info_init(void){}
asmlinkage __visible void __init __no_sanitize_address start_kernel(void)
{
char *command_line;
@@ -950,7 +950,7 @@
initcall_debug_enable();
context_tracking_init();
-
+ early_debug_info_init();
early_drv_init();
/* init some links before init_ISA_irqs() */
diff --git a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/kernel/ramdump/ramdump_device_trans.c b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/kernel/ramdump/ramdump_device_trans.c
index 40c920d..f3e91e9 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/kernel/ramdump/ramdump_device_trans.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/kernel/ramdump/ramdump_device_trans.c
@@ -620,6 +620,8 @@
/* interactive begin */
if(ramdump_device_init() < 0)
return;
+
+ ramdump_device_write_logbuf();
data_trans_max = RAMDUMP_SHARED_MEM_LEN - roundup(sizeof(ramdump_shmem_t), RAMDUMP_SHMEM_ALIGN_SIZE) - RAMDUMP_COMPRESS_OUT_LEN;
cap_to_server_msg.cmd = RAMDUMP_PC_INTERACTIVE_REQ;
ramdump_oss_data_trans_write((unsigned char*)(&cap_to_server_msg), sizeof(cap_to_server_msg));
@@ -635,8 +637,8 @@
ramdump_trans_server_interactive_req *server_to_cap_msg = (ramdump_trans_server_interactive_req *)req_buf;
/* data from server to cap */
ramdump_file_num = server_to_cap_msg->file_num;
- ramdump_device_fp.file_num = ramdump_file_num;
- ramdump_spinand_fp.file_num = ramdump_file_num;
+ ramdump_device_fp.file_num += ramdump_file_num;
+ ramdump_spinand_fp.file_num += ramdump_file_num;
/* data from cap to server */
cap_to_server_msg.cmd = RAMDUMP_PC_FILE_INFO_READ_REQ;
@@ -732,7 +734,6 @@
}
case RAMDUMP_TRANS_SERVER_FILE_TRANS_DONE_RSP:
{
- ramdump_device_write_logbuf();
ramdump_device_close();
return;
}
diff --git a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/net/8021q/vlan_dev.c b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/net/8021q/vlan_dev.c
old mode 100644
new mode 100755
index 86a1c99..6117e9c
--- a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/net/8021q/vlan_dev.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/net/8021q/vlan_dev.c
@@ -94,7 +94,7 @@
return NETDEV_TX_OK;
#endif
}
-
+extern void fast_update_indev(struct sk_buff *skb, struct net_device *dev);
static netdev_tx_t vlan_dev_hard_start_xmit(struct sk_buff *skb,
struct net_device *dev)
{
@@ -120,7 +120,7 @@
len = skb->len;
if (unlikely(netpoll_tx_running(dev)))
return vlan_netpoll_send_skb(vlan, skb);
-
+ fast_update_indev(skb, dev);
ret = dev_queue_xmit(skb);
if (likely(ret == NET_XMIT_SUCCESS || ret == NET_XMIT_CN)) {
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 65a6054..974ee5e 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
@@ -1313,7 +1313,7 @@
u16 vid = 0;
int ntl_port_id = 0xff;
- if(!skb->dev)
+ if(!skb->dev || fastbr_level != 1)
{
//print_sun(SUN_DBG, "fast_br skb->dev err skb->dev = %x\n", skb->dev);
return 0;
diff --git a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/net/core/SI/net_other.c b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/net/core/SI/net_other.c
index a6748c7..816686b 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/net/core/SI/net_other.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/net/core/SI/net_other.c
@@ -1090,7 +1090,8 @@
int fast_local4_output_num = 0; //±¾µØfast_local4³É¹¦·¢Ëͱ¨ÎÄ
int fast_local6_output_num = 0; //±¾µØfast_local6³É¹¦·¢Ëͱ¨ÎÄ
int fast_tcpdump_num = 0; //fast×¥°üÊýÁ¿
-
+int skb_expand4 = 0; //Í·¿Õ¼ä²»¹»ÖØÐÂÉêÇëµÄV4Êý¾Ý°ü
+int skb_expand6 = 0; //Í·¿Õ¼ä²»¹»ÖØÐÂÉêÇëµÄV6Êý¾Ý°ü
int double_mac = 0; //mac¼ì²é¿ª¹Ø
//slabÄÚ´æÊ¹ÓÃÏà¹ØÍ³¼Æ£¬Î´¿¼ÂÇͨÓÃslabµØÖ·³Ø£¬Èçkmalloc
diff --git a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/net/core/fastproc/fast4_fw.c b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/net/core/fastproc/fast4_fw.c
index 0ef32e4..a0674f9 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/net/core/fastproc/fast4_fw.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/net/core/fastproc/fast4_fw.c
@@ -67,6 +67,7 @@
/* ******************************** º¯ÊýʵÏÖ ********************************/
int dst_expire_count = 0;
extern int no_neighbour;
+extern fast_list_t working_list;
static inline int rt_is_expired(struct rtable *rth)
{
@@ -555,7 +556,11 @@
{
ret = ifname_compare_aligned(ct->indev[dir]->name, ipinfo->iniface, ipinfo->iniface_mask);
}
-
+ else
+ {
+ ret=1;
+ }
+
if(ipinfo->iniface[0] != '\0')
*match_filter = 1;
@@ -583,6 +588,8 @@
ip_packet_match_neg(const struct ipt_ip *ipinfo,struct nf_conn* ct,int dir, int* match_filter)
{
unsigned long ret;
+ if(!(ct->status & IPS_NAT_MASK))
+ return false;
if (NF_INVF(ipinfo, IPT_INV_SRCIP,
(ct->tuplehash[dir].tuple.dst.u3.ip & ipinfo->smsk.s_addr) != ipinfo->src.s_addr) ||
NF_INVF(ipinfo, IPT_INV_DSTIP,
@@ -595,7 +602,11 @@
{
ret = ifname_compare_aligned(ct->outdev[dir]->name, ipinfo->iniface, ipinfo->iniface_mask);
}
-
+ else
+ {
+ ret = 1;
+ }
+
if(ipinfo->iniface[0] != '\0')
*match_filter = 1;
@@ -675,7 +686,7 @@
e = get_entry(table_base, private->hook_entry[NF_INET_LOCAL_IN]);
break;
default:
- break;
+ return;
}
while(num--)
{
@@ -747,8 +758,7 @@
static void ct_iptables_bhfunc(unsigned long param)
{
- int hash = 0;
- struct nf_conntrack_tuple_hash *h;
+ fast_entry_t *ret = NULL;
struct hlist_nulls_node *n;
struct nf_conn *ct;
struct xt_table_info *private;
@@ -756,13 +766,12 @@
unsigned int addend;
local_bh_disable();
addend = xt_write_recseq_begin();
- for(hash = 0; hash < nf_conntrack_htable_size; hash++)
- {
- hlist_nulls_for_each_entry_rcu(h,n,&nf_conntrack_hash[hash],hnnode)
+ spin_lock_bh(&fast_fw_spinlock);
+ for (ret = (&working_list)->next; ret; ret = ret->next)
+ {
+ if(ret)
{
- if(h)
- {
- ct = nf_ct_tuplehash_to_ctrack(h);
+ ct = ret->ct;
if(ct->fast_ct.isFast)
{
net = nf_ct_net(ct);
@@ -777,19 +786,66 @@
}
else
continue;
- spin_lock_bh(&fast_fw_spinlock);
+
ct->packet_info[IP_CT_DIR_ORIGINAL].bytes = 0;
ct->packet_info[IP_CT_DIR_ORIGINAL].packets = 0;
ct->packet_info[IP_CT_DIR_REPLY].bytes = 0;
ct->packet_info[IP_CT_DIR_REPLY].packets = 0;
- spin_unlock_bh(&fast_fw_spinlock);
- }
- }
- }
+ }
+ }
+ spin_unlock_bh(&fast_fw_spinlock);
xt_write_recseq_end(addend);
local_bh_enable();
}
+#if 0
+/*ÐÂfastÏÂiptablesͬ²½µÄ´úÂ루±£Áô£©*/
+/* Started by AICoder, pid:bc328v3b69u30bb14fea08b4d0be594808c2486b */
+static void ct_iptables_bhfunc(unsigned long param)
+{
+ unsigned int addend;
+ local_bh_disable();
+ addend = xt_write_recseq_begin();
+ spin_lock_bh(&fast_fw_spinlock);
+ for(int hash = 0; hash < nf_conntrack_htable_size; hash++)
+ {
+ struct nf_conntrack_tuple_hash *h;
+ struct hlist_nulls_node *n;
+ for_each_rcu_safe(h, n, &nf_conntrack_hash[hash])
+ {
+ if(h)
+ {
+ struct nf_conn *ct = nf_ct_tuplehash_to_ctrack(h);
+ if(ct->fast_ct.isFast)
+ {
+ struct net *net = nf_ct_net(ct);
+ struct xt_table_info *private;
+ const char *chain_names[] = {
+ "IPTABLE_RAW",
+ "IPTABLE_MANGLE",
+ "IPTABLE_NAT",
+ "IPTABLE_FILTER"
+ };
+ for (int i = 0; i < 4; i++) {
+ switch (i) {
+ case 0: private = READ_ONCE(net->ipv4.iptable_raw->private); break;
+ case 1: private = READ_ONCE(net->ipv4.iptable_mangle->private); break;
+ case 2: private = READ_ONCE(net->ipv4.nat_table->private); break;
+ case 3: private = READ_ONCE(net->ipv4.iptable_filter->private); break;
+ }
+ ct_iptables_syn_handle(ct, private, chain_names[i]);
+ }
+ }
+ }
+ }
+ }
+ spin_unlock_bh(&fast_fw_spinlock);
+ xt_write_recseq_end(addend);
+ local_bh_enable();
+}
+/* Ended by AICoder, pid:bc328v3b69u30bb14fea08b4d0be594808c2486b */
+#endif
+
int fast4_fw_init(void)
{
diff --git a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/net/core/fastproc/fast6.c b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/net/core/fastproc/fast6.c
index d5fab9c..5beebba 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/net/core/fastproc/fast6.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/net/core/fastproc/fast6.c
@@ -207,7 +207,9 @@
__u8 next_hdr = 0;
unsigned char *l4head;
struct ipv6hdr *ip6;
-
+ struct sk_buff *skb2 = NULL;
+ int l4_offset = 0;
+
print_sun(SUN_DBG, "enter fast_6_recv \n");
if (fastnat_level == FAST_CLOSE)
@@ -286,13 +288,18 @@
print_sun(SUN_DBG, "fast_6_recv l4head is null \n");
return 0;
}
-
-
-
- if (!(skb = fast_expand_headroom_v6(skb, dev))){
+ l4_offset = l4head - skb->data;
+
+ if (!(skb2 = fast_expand_headroom_v6(skb, dev))){
rcu_read_unlock();
return 1;
}
+
+ if(skb2 != skb){
+ l4head = skb2->data + l4_offset;
+ skb = skb2;
+ skb_expand6++;
+ }
fast_tcpdump(skb);
@@ -316,8 +323,30 @@
skb->isFastnat = 1;
skb->priority = fast6_entry_data->priority;
skb->mark = fast6_entry_data->mark;
-
-
+ if (likely(skb_get_nfct(skb) == 0)){
+ skb_set_nfct(skb, (unsigned long)fast6_entry->ct);
+ nf_conntrack_get(&fast6_entry->ct->ct_general);
+ }
+ spin_lock_bh(&fast_fw_spinlock);
+ //»ùÓÚctÁ´½ÓµÄÁ÷Á¿Í³¼Æ --- ͳ¼ÆIP°ü²»ÊÇMAC°ü
+ if (fast6_entry_data->tuplehash.tuple.dst.dir == IP_CT_DIR_ORIGINAL){
+ fast6_entry->ct->packet_info[IP_CT_DIR_ORIGINAL].packets++;
+ fast6_entry->ct->packet_info[IP_CT_DIR_ORIGINAL].bytes += skb->len;
+ if(unlikely(fast6_entry->ct->indev[IP_CT_DIR_ORIGINAL] == NULL))
+ fast6_entry->ct->indev[IP_CT_DIR_ORIGINAL] = skb->indev;
+ if(unlikely(fast6_entry->ct->outdev[IP_CT_DIR_ORIGINAL] == NULL))
+ fast6_entry->ct->outdev[IP_CT_DIR_ORIGINAL] = dev;
+ } else if (fast6_entry_data->tuplehash.tuple.dst.dir == IP_CT_DIR_REPLY){
+ fast6_entry->ct->packet_info[IP_CT_DIR_REPLY].packets++;
+ fast6_entry->ct->packet_info[IP_CT_DIR_REPLY].bytes += skb->len;
+ if(unlikely(fast6_entry->ct->indev[IP_CT_DIR_REPLY] == NULL))
+ fast6_entry->ct->indev[IP_CT_DIR_REPLY] = skb->indev;
+ if(unlikely(fast6_entry->ct->outdev[IP_CT_DIR_REPLY] == NULL))
+ fast6_entry->ct->outdev[IP_CT_DIR_REPLY] = dev;
+ } else {
+ printk("fast6 packet error\n");
+ }
+ spin_unlock_bh(&fast_fw_spinlock);
//ÄÚºË×Ô´øµÄ»ùÓÚÁ´½ÓµÄÁ÷Á¿Í³¼Æ
struct nf_conn_counter *acct = (struct nf_conn_counter*)nf_conn_acct_find(fast6_entry->ct);
if (acct) {
@@ -348,7 +377,8 @@
//Ö»Óе±ÓÐMACÍ·Ô¤¸³ÖµÊ±£¬²Å×¼¸³Öµ£¬·ñÔòΪIPÍ·
skb_push(skb, ETH_HLEN);
-
+
+ if (fast6_entry_data->hh_flag)
memcpy(skb->data, fast6_entry_data->hh_data, ETH_HLEN);
/*¸üÐÂÁ¬½Ó³¬Ê±*/
if (IPPROTO_TCP == tuple.dst.protonum)
@@ -470,12 +500,12 @@
return NF_ACCEPT;
}
_neighbour = dst_neigh_lookup_skb(dst, skb);
- if(!_neighbour)
- {
- return NF_ACCEPT;
+ if(_neighbour == NULL && ((ipv6_addr_type(&ipv6_hdr(skb)->daddr)) == IPV6_ADDR_ANY
+ || ((ipv6_addr_type(&ipv6_hdr(skb)->daddr)) & IPV6_ADDR_LOOPBACK))){
+ return NF_ACCEPT;
}
- if (memcmp(_neighbour->ha, zeromac, ETH_ALEN) == 0)
+ if (_neighbour && memcmp(_neighbour->ha, zeromac, ETH_ALEN) == 0)
{
goto accept;
}
@@ -536,9 +566,10 @@
fast6_entry_data = &fast6_entry->data[dir];
fast6_entry_data->tuplehash.tuple = ct->tuplehash[dir].tuple;
- memcpy(fast6_entry_data->dmac, _neighbour->ha, ETH_ALEN);
+ //memcpy(fast6_entry_data->dmac, _neighbour->ha, ETH_ALEN);
fast6_entry_data->priority = skb->priority;
fast6_entry_data->mark = skb->mark;
+ if(fast6_entry_data->outdev == NULL){
fast6_entry_data->outdev = out;
if (!record_MAC_header(working_hash6, ct, fast6_entry, fast6_entry_data, _neighbour, out, htons(ETH_P_IPV6)))
@@ -546,7 +577,7 @@
spin_unlock_bh(&fast6_spinlock);
goto accept;
}
-
+ }
//´Ë´¦±£Ö¤Õý·´Á½¸ö±ê¼Çλ²»³åÍ»
fast6_entry->flags = fast6_entry->flags | (1 << dir);
@@ -563,7 +594,7 @@
ct->fast_ct.isFast = FAST_CT_WND6;
accept:
-
+ if(_neighbour)
neigh_release(_neighbour);
return NF_ACCEPT;
}
diff --git a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/net/core/fastproc/fast6_fw.c b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/net/core/fastproc/fast6_fw.c
index 322175b..ec21bc6 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/net/core/fastproc/fast6_fw.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/net/core/fastproc/fast6_fw.c
@@ -40,8 +40,23 @@
#include <net/SI/net_cache.h>
#include <net/SI/print_sun.h>
+#include <linux/netfilter/xt_tcpudp.h>
+#include <linux/netfilter_ipv6/ip6_tables.h>
+
+
MODULE_LICENSE("GPL");
+static struct task_struct *ct_ip6tables_syn;
+static struct tasklet_struct ct_ip6tables_bh;
+extern unsigned int ct_iptables_syn_sw;
+enum table6_index {
+ IP6TABLE_RAW,
+ IP6TABLE_MANGLE,
+ IP6TABLE_NAT,
+ IP6TABLE_FILTER
+};
+
+
/* ***************** ipv6 ¿ìËÙת·¢Ïà¹Ø±äÁ¿ ************************* */
@@ -53,6 +68,7 @@
int dst_expire_count_v6 = 0;
extern int no_neighbour;
+extern fast_list_t working_list6;
extern void ntl_ct_set_iw(struct sk_buff *skb, struct nf_conn *ct, int ct_dir);
int fast6_fw_recv(struct nf_conn *tmpl,
struct sk_buff *skb,
@@ -163,7 +179,8 @@
skb->isFastnat = 1;
nf_ct_set(skb, (struct nf_conn *)&ct->ct_general, ctinfo);
-
+ ct->packet_info[dir].packets++;
+ ct->packet_info[dir].bytes += skb->len;
//»ùÓÚÍø¿ÚµÄÁ÷Á¿Í³¼Æ --- ²Î¿¼linuxÔÉúµÄÇý¶¯£¬Í³¼ÆµÄ¶¼ÊÇIP°ü³¤¶È
if (fastnat_level == FAST_NET_DEVICE)
{
@@ -203,6 +220,17 @@
}
skb->dev = dev;
skb->now_location |= FASTNAT_SUCC;
+
+ if(ct->indev[dir] == NULL && skb->indev != NULL)
+ {
+ ct->indev[dir] = skb->indev;
+ }
+
+ if(ct->outdev[dir] == NULL && skb->dev != NULL)
+ {
+ ct->outdev[dir] = skb->dev;
+ }
+
skb->vlan_proto = vlan_proto_raw;
skb->vlan_tci = vlan_tci_raw;
__flush_dcache_area(skb->data, skb->len);
@@ -370,6 +398,372 @@
.priority = NF_IP6_PRI_LAST,
};
+static inline bool
+port_match(u_int16_t min, u_int16_t max, u_int16_t port, bool invert)
+{
+ return (port >= min && port <= max) ^ invert;
+}
+
+static bool ctable_mt(struct nf_conn* ct, struct xt_action_param *par,int dir, int* match_filter)
+{
+ const struct xt_tcp *tcpinfo = par->matchinfo;
+
+ if (!port_match(tcpinfo->spts[0], tcpinfo->spts[1],
+ ntohs(ct->tuplehash[dir].tuple.src.u.tcp.port),
+ !!(tcpinfo->invflags & XT_TCP_INV_SRCPT)))
+ return false;
+ if((tcpinfo->spts[0] || tcpinfo->spts[1]) ^ (!!(tcpinfo->invflags & XT_TCP_INV_SRCPT)))
+ *match_filter = 1;
+ if (!port_match(tcpinfo->dpts[0], tcpinfo->dpts[1],
+ ntohs(ct->tuplehash[dir].tuple.dst.u.tcp.port),
+ !!(tcpinfo->invflags & XT_TCP_INV_DSTPT)))
+ return false;
+ if((tcpinfo->dpts[0] || tcpinfo->dpts[1]) ^ (!!(tcpinfo->invflags & XT_TCP_INV_DSTPT)))
+ *match_filter = 1;
+ return true;
+}
+
+static inline bool
+ip6_packet_match(const struct ip6t_ip6 *ip6info,struct nf_conn* ct,int dir, int* match_filter)
+{
+ unsigned long ret;
+ if (NF_INVF(ip6info, IP6T_INV_SRCIP,
+ ipv6_masked_addr_cmp((struct in6_addr *)(ct->tuplehash[dir].tuple.src.u3.ip6), &ip6info->smsk,
+ &ip6info->src)) ||
+ NF_INVF(ip6info, IP6T_INV_DSTIP,
+ ipv6_masked_addr_cmp((struct in6_addr *)(ct->tuplehash[dir].tuple.dst.u3.ip6), &ip6info->dmsk,
+ &ip6info->dst)))
+ return false;
+ if(ip6info->src.in6_u.u6_addr32[0] || ip6info->dst.in6_u.u6_addr32[0])
+ {
+ *match_filter = 1;
+ }
+
+ if(ct->indev[dir] != NULL)
+ {
+ ret = ifname_compare_aligned(ct->indev[dir]->name, ip6info->iniface, ip6info->iniface_mask);
+ }
+ else
+ {
+ ret=1;
+ }
+
+ if(ip6info->iniface[0] != '\0')
+ *match_filter = 1;
+
+ if (NF_INVF(ip6info, IP6T_INV_VIA_IN, ret != 0))
+ return false;
+ if(ct->outdev[dir] != NULL)
+ {
+ ret = ifname_compare_aligned(ct->outdev[dir]->name, ip6info->outiface, ip6info->outiface_mask);
+ }
+
+ if(ip6info->outiface[0] != '\0')
+ *match_filter = 1;
+
+ if (NF_INVF(ip6info, IP6T_INV_VIA_OUT, ret != 0))
+ return false;
+
+ if (ip6info->flags & IP6T_F_PROTO) {
+ int protohdr;
+
+ protohdr = ct->tuplehash[dir].tuple.dst.protonum;
+
+ if (ip6info->proto == protohdr) {
+ if (ip6info->invflags & IP6T_INV_PROTO)
+ return false;
+
+ return true;
+ }
+
+ /* We need match for the '-p all', too! */
+ if ((ip6info->proto != 0) &&
+ !(ip6info->invflags & IP6T_INV_PROTO))
+ return false;
+ }
+
+ return true;
+}
+
+static inline bool
+ip6_packet_match_neg(const struct ip6t_ip6 *ip6info,struct nf_conn* ct,int dir, int* match_filter)
+{
+ unsigned long ret;
+ if(!(ct->status & IPS_NAT_MASK))
+ return false;
+ if (NF_INVF(ip6info, IP6T_INV_SRCIP,
+ ipv6_masked_addr_cmp((struct in6_addr *)ct->tuplehash[dir].tuple.src.u3.ip6, &ip6info->smsk,
+ &ip6info->src)) ||
+ NF_INVF(ip6info, IP6T_INV_DSTIP,
+ ipv6_masked_addr_cmp((struct in6_addr *)ct->tuplehash[dir].tuple.dst.u3.ip6, &ip6info->dmsk,
+ &ip6info->dst)))
+ return false;
+ if(ip6info->src.in6_u.u6_addr32[0] || ip6info->dst.in6_u.u6_addr32[0])
+ *match_filter = 1;
+
+ if(ct->outdev[dir] != NULL)
+ {
+ ret = ifname_compare_aligned(ct->outdev[dir]->name, ip6info->iniface, ip6info->iniface_mask);
+ }
+ else
+ {
+ ret = 1;
+ }
+
+ if(ip6info->iniface[0] != '\0')
+ *match_filter = 1;
+
+ if (NF_INVF(ip6info, IP6T_INV_VIA_IN, ret != 0))
+ return false;
+ if(ct->indev[dir] != NULL)
+ {
+ ret = ifname_compare_aligned(ct->indev[dir]->name, ip6info->outiface, ip6info->outiface_mask);
+ }
+
+ if(ip6info->outiface[0] != '\0')
+ *match_filter = 1;
+
+ if (NF_INVF(ip6info, IP6T_INV_VIA_OUT, ret != 0))
+ return false;
+
+ if (ip6info->flags & IP6T_F_PROTO) {
+ int protohdr;
+
+ protohdr = ct->tuplehash[dir].tuple.dst.protonum;
+
+ if (ip6info->proto == protohdr) {
+ if (ip6info->invflags & IP6T_INV_PROTO)
+ return false;
+
+ return true;
+ }
+
+ /* We need match for the '-p all', too! */
+ if ((ip6info->proto != 0) &&
+ !(ip6info->invflags & IP6T_INV_PROTO))
+ return false;
+ }
+
+ return true;
+}
+
+static inline struct ip6t_entry *
+get_entry(const void *base, unsigned int offset)
+{
+ return (struct ip6t_entry *)(base + offset);
+}
+
+static inline
+struct ip6t_entry *ip6t_next_entry(const struct ip6t_entry *entry)
+{
+ return (void *)entry + entry->next_offset;
+}
+
+
+
+//ͬ²½ctͳ¼ÆÐÅÏ¢µ½iptables,ͬ²½ÖÜÆÚÔݶ¨1s
+static int ct_ip6tables_syn_thread(void *param)
+{
+ while (1)
+ {
+ if(ct_iptables_syn_sw)
+ {
+ rcu_read_lock();
+ tasklet_schedule(&ct_ip6tables_bh);
+ rcu_read_unlock();
+ //ÿ´Îͬ²½¼ä¸ôΪ1s.
+ }
+ msleep(1*1000);
+ }
+ return 0;
+}
+
+void ct_ip6tables_syn_handle(struct nf_conn *ct,struct xt_table_info *private,int table_id)
+{
+ void *table_base;
+ struct ip6t_entry *e;
+ const struct xt_entry_match *ematch;
+ struct xt_action_param acpar;
+ struct xt_counters *counter;
+ int match_flag = 0;
+ int match_filter = 0;
+ int num = 0;
+
+
+ table_base = private->entries;
+ num = private->number;
+ switch(table_id)
+ {
+ case 0:
+ case 1:
+ case 2:
+ e = get_entry(table_base, private->hook_entry[NF_INET_PRE_ROUTING]);
+ break;
+ case 3:
+ e = get_entry(table_base, private->hook_entry[NF_INET_LOCAL_IN]);
+ break;
+ default:
+ return;
+ }
+ while(num--)
+ {
+ match_flag = 0;
+ match_filter = 0;
+ if(!ip6_packet_match(&e->ipv6, ct, IP_CT_DIR_ORIGINAL,&match_filter) &&
+ !ip6_packet_match_neg(&e->ipv6, ct, IP_CT_DIR_REPLY,&match_filter))
+ {
+ }
+ else
+ {
+ xt_ematch_foreach(ematch, e)
+ {
+ acpar.matchinfo = ematch->data;
+ if (!ctable_mt(ct, &acpar, IP_CT_DIR_ORIGINAL,&match_filter))
+ {
+ match_flag = 1;
+ break;
+ }
+ else
+ {
+ }
+ }
+ if(!match_flag)
+ {
+ if(match_filter)
+ {
+ counter = xt_get_this_cpu_counter(&e->counters);
+ ADD_COUNTER(*counter, ct->packet_info[IP_CT_DIR_ORIGINAL].bytes,ct->packet_info[IP_CT_DIR_ORIGINAL].packets);
+ }
+ e = ip6t_next_entry(e);
+ continue;
+ }
+ match_flag = 0;
+ match_filter = 0;
+ }
+
+ if (!ip6_packet_match(&e->ipv6, ct, IP_CT_DIR_REPLY,&match_filter) &&
+ !ip6_packet_match_neg(&e->ipv6, ct, IP_CT_DIR_ORIGINAL,&match_filter))
+ {
+ e = ip6t_next_entry(e);
+ continue;
+ }
+ else
+ {
+ xt_ematch_foreach(ematch, e)
+ {
+ acpar.matchinfo = ematch->data;
+ if (!ctable_mt(ct, &acpar, IP_CT_DIR_REPLY,&match_filter))
+ {
+ match_flag = 1;
+ break;
+ }
+ }
+ if(!match_flag)
+ {
+ if(match_filter)
+ {
+ counter = xt_get_this_cpu_counter(&e->counters);
+ ADD_COUNTER(*counter, ct->packet_info[IP_CT_DIR_REPLY].bytes,ct->packet_info[IP_CT_DIR_REPLY].packets);
+ }
+ e = ip6t_next_entry(e);
+ continue;
+ }
+ }
+ }
+
+}
+
+static void ct_ip6tables_bhfunc(unsigned long param)
+{
+ fast_entry_t *ret = NULL;
+ struct hlist_nulls_node *n;
+ struct nf_conn *ct;
+ struct xt_table_info *private;
+ struct net * net;
+ unsigned int addend;
+ local_bh_disable();
+ addend = xt_write_recseq_begin();
+ spin_lock_bh(&fast_fw_spinlock);
+ for (ret = (&working_list6)->next; ret; ret = ret->next)
+ {
+ if(ret)
+ {
+ ct = ret->ct;
+ if(ct->fast_ct.isFast)
+ {
+ net = nf_ct_net(ct);
+ private = READ_ONCE(net->ipv6.ip6table_raw->private);
+ ct_ip6tables_syn_handle(ct,private,IP6TABLE_RAW);
+ private = READ_ONCE(net->ipv6.ip6table_mangle->private);
+ ct_ip6tables_syn_handle(ct,private,IP6TABLE_MANGLE);
+ private = READ_ONCE(net->ipv6.ip6table_nat->private);
+ ct_ip6tables_syn_handle(ct,private,IP6TABLE_NAT);
+ private = READ_ONCE(net->ipv6.ip6table_filter->private);
+ ct_ip6tables_syn_handle(ct,private,IP6TABLE_FILTER);
+ }
+ else
+ continue;
+
+ ct->packet_info[IP_CT_DIR_ORIGINAL].bytes = 0;
+ ct->packet_info[IP_CT_DIR_ORIGINAL].packets = 0;
+ ct->packet_info[IP_CT_DIR_REPLY].bytes = 0;
+ ct->packet_info[IP_CT_DIR_REPLY].packets = 0;
+ }
+ }
+ spin_unlock_bh(&fast_fw_spinlock);
+ xt_write_recseq_end(addend);
+ local_bh_enable();
+}
+
+#if 0
+/*ÐÂfast ip6tablesÁ÷Á¿Í¬²½´úÂë,±£Áô*/
+/* Started by AICoder, pid:b1b62d7ef7md76714807099a103c224334833109 */
+static void ct_ip6tables_bhfunc(unsigned long param)
+{
+ int hash;
+ struct nf_conn *ct;
+ struct xt_table_info *private;
+ struct net *net;
+ unsigned int addend;
+ local_bh_disable();
+ addend = xt_write_recseq_begin();
+ for(hash = 0; hash < nf_conntrack_htable_size; hash++)
+ {
+ struct nf_conntrack_tuple_hash *h;
+ struct hlist_nulls_node *n;
+ hlist_nulls_for_each_entry_rcu(h, n, &nf_conntrack_hash[hash], hnnode)
+ {
+ if(h)
+ {
+ ct = nf_ct_tuplehash_to_ctrack(h);
+ if(ct->fast_ct.isFast)
+ {
+ net = nf_ct_net(ct);
+ private = READ_ONCE(net->ipv6.ip6table_raw->private);
+ ct_ip6tables_syn_handle(ct, private, IP6TABLE_RAW);
+ private = READ_ONCE(net->ipv6.ip6table_mangle->private);
+ ct_ip6tables_syn_handle(ct, private, IP6TABLE_MANGLE);
+ private = READ_ONCE(net->ipv6.ip6table_nat->private);
+ ct_ip6tables_syn_handle(ct, private, IP6TABLE_NAT);
+ private = READ_ONCE(net->ipv6.ip6table_filter->private);
+ ct_ip6tables_syn_handle(ct, private, IP6TABLE_FILTER);
+ spin_lock_bh(&fast_fw_spinlock);
+ for(int i = 0; i < 4; i++)
+ {
+ ct->packet_info[i].bytes = 0;
+ ct->packet_info[i].packets = 0;
+ }
+ spin_unlock_bh(&fast_fw_spinlock);
+ }
+ }
+ }
+ }
+ xt_write_recseq_end(addend);
+ local_bh_enable();
+}
+/* Ended by AICoder, pid:b1b62d7ef7md76714807099a103c224334833109 */
+#endif
+
int fast6_fw_init(void)
{
@@ -383,6 +777,14 @@
}
print_sun(SUN_DBG,"init fast6_fw_init done\n");
+ ct_ip6tables_bh.func = ct_ip6tables_bhfunc;
+ ct_ip6tables_syn = kthread_create(ct_ip6tables_syn_thread, (void *)0, "ct_ip6tables_syn" );
+ if (!IS_ERR(ct_ip6tables_syn))
+ {
+ printk("ntl_syn_task thread's init is succ");
+ wake_up_process(ct_ip6tables_syn);
+ }
+
return 0;
}
@@ -390,6 +792,12 @@
{
fast_release_all(RELEASE_ALL_DST);
nf_unregister_net_hook(&init_net, &fast6_fw_hook);
+ if (ct_ip6tables_syn)
+ {
+ kthread_stop(ct_ip6tables_syn);
+ ct_ip6tables_syn = NULL;
+ }
+ tasklet_kill(&ct_ip6tables_bh);
return 0;
}
diff --git a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/net/core/fastproc/fast_common.c b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/net/core/fastproc/fast_common.c
index 69f3761..80ad864 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/net/core/fastproc/fast_common.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/net/core/fastproc/fast_common.c
@@ -621,7 +621,7 @@
//²Î¿¼ip6_xmit,À©³äskbÍ·²¿
struct sk_buff *fast_expand_headroom_v6(struct sk_buff *skb, struct net_device *dev) {
- unsigned int hh_len = LL_RESERVED_SPACE(dev) + sizeof(struct ipv6hdr);
+ unsigned int hh_len = LL_RESERVED_SPACE(dev);//EC616000622279½â¾öv6ÉÏÐÐÊý¾Ý°üÓÉÓÚÍ·¿Õ¼ä²»¹»ÖØÐÂÉêÇëµÄÎÊÌâ + sizeof(struct ipv6hdr);
struct sk_buff *skb2 = NULL;
if (unlikely(skb_headroom(skb) < hh_len)) {
skb2 = skb_realloc_headroom(skb, max(hh_len, NET_SKB_PAD));
@@ -726,6 +726,9 @@
{
tcpack_rel(entry);
//nf_ct_put(entry->ct);
+ spin_lock_bh(&fast_fw_spinlock);
+ entry->ct->fast_entry = NULL;
+ spin_unlock_bh(&fast_fw_spinlock);
atomic_dec(&(entry->ct->ct_general.use));
fn_list_del(list_head, entry);
}
@@ -810,6 +813,7 @@
netslab_inc(FAST_SLAB);
memset(ret, 0, sizeof(fast_entry_t));
ret->ct = ct;
+ ct->fast_entry = ret;
ret->list_head = list_head;
//ÉèÖö¨Ê±Æ÷
@@ -897,7 +901,7 @@
goto REL;
//½ö¶ÔÒÔÌ«ÍøÀàÍø¿Ú½øÐÐMACÍ·Ô¤¸³Öµ£¬ÆäËüµÄÈçPPP¡¢PPPoEÕâЩ£¬½ÔÊǿɱäµÄ£¬²»ÄÜÔ¤¸³Öµ£»²Î¼ûalloc_netdevºÍalloc_etherdev½Ó¿Ú
- if (out->type != ARPHRD_ETHER)
+ if (out->type != ARPHRD_ETHER || neigh == NULL)
return 1;
//¶ÔÓÚ³ö¿ÚÎªÍøÇÅbrʱ£¬Ö±½Ó»ñÈ¡L2ÍøÂçÉ豸£¬¼´usb0»òwifi0
@@ -906,7 +910,7 @@
if(out->dev_addr == NULL)
goto REL;
- if (fastbr_level == 1)
+ if (fastbr_level)
{
dst_out = getbrport_bydst(out, neigh->ha);
if (dst_out == NULL)
@@ -964,6 +968,9 @@
//»Ö¸´ctµÄ³¬Ê±
//add_timer(&ct->timeout);
//nf_ct_put(ct);
+ spin_lock_bh(&fast_fw_spinlock);
+ entry->ct->fast_entry = NULL;
+ spin_unlock_bh(&fast_fw_spinlock);
atomic_dec(&(ct->ct_general.use));
del_timer(&entry->timeout);
fn_list_del(entry->list_head, entry);
@@ -1079,7 +1086,9 @@
del_timer(&entry->timeout);
workinghash_del_node(entry);
-
+ spin_lock_bh(&fast_fw_spinlock);
+ entry->ct->fast_entry = NULL;
+ spin_unlock_bh(&fast_fw_spinlock);
//»Ö¸´ctµÄ³¬Ê±
//add_timer(&entry->ct->timeout);
fn_list_del(list_head, entry);
@@ -1552,7 +1561,7 @@
return 1;
}
//vlan
- else if (next_pro == cpu_to_be16(ETH_P_8021Q))
+ else if (next_pro == cpu_to_be16(ETH_P_8021Q) && fastbr_level == 1)
{
skb->isvlan = 1;
skb_pull(skb, VLAN_HLEN);
@@ -1591,7 +1600,7 @@
//if (((unsigned long)skb->data)%4 != 0)
//panic("ERR: fast from dev skb->data%4 != 0");
- if (skb->indev == NULL)
+ if (skb->indev == NULL || is_vlan_dev(skb->dev))
skb->indev = skb->dev;
//ÐèҪ׼ȷ¶¨Î»µ½IPÍ·£¬ÆÚ¼ä¿ÉÄÜÌø¹ýppp/mac/pppoeµÈ¸÷ÖÖ²ã2Í·²¿
if (set_skbdata_toip(skb) == 1 && fast_for_ipdata(skb))
@@ -2055,6 +2064,21 @@
return dst;
}
+void fast_update_indev(struct sk_buff *skb, struct net_device *dev)
+{
+ if(fastbr_level != 1 && skb->isFastnat == 1){
+ enum ip_conntrack_info ctinfo;
+ struct nf_conn *ct = nf_ct_get(skb, &ctinfo);
+
+ if(ct){
+ if(ct->indev[0] == skb->indev && ct->indev[1] == NULL)
+ ct->indev[1] = dev;
+ if(ct->indev[1] == skb->indev && ct->indev[0] == NULL)
+ ct->indev[0] = dev;
+ }
+ }
+}
+
/*fast³õʼ»¯*/
static int __init
tsp_fast_init(void)
diff --git a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/net/core/fastproc/fast_track.c b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/net/core/fastproc/fast_track.c
index 37f3cfc..712ff6d 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/net/core/fastproc/fast_track.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/net/core/fastproc/fast_track.c
@@ -234,7 +234,7 @@
if (copy_from_user(char_fastbr, buffer, 1))
return -EFAULT;
- if (char_fastbr[0] < '0' || char_fastbr[0] > '1')
+ if (char_fastbr[0] < '0' || char_fastbr[0] > '2')
return -EINVAL;
fastbr_level = (int)(char_fastbr[0] - '0');
@@ -252,8 +252,8 @@
{
if (*pos == 0)
{
- seq_printf(seq, "fastnat have %d conn!!!\nskb_num4:%d,fastnat_num:%d\n",
- working_list.count, skb_num4, fastnat_num);
+ seq_printf(seq, "fastnat have %d conn!!!\nskb_num4:%d,fastnat_num:%d,expand_head4:%d\n",
+ working_list.count, skb_num4, fastnat_num, skb_expand4);
seq_printf(seq, "fastbr_sum:%d,fastbr_num:%d\n",
skb_num4 + skb_num6 + skb_unknown - fastnat_num - fast6_num, fastbr_num);
@@ -399,8 +399,8 @@
working_list.count,fastnat_recv_count,fastnat_real_count);
seq_printf(seq, "send_2_ps_failed:%u, send_2_usb_failed:%u\n", send_2_ps_failed, send_2_usb_failed);
#endif
- seq_printf(seq, "fast6 have %d conn!!!\nskb_num6:%d,fast6_num:%d\n",
- working_list6.count, skb_num6, fast6_num);
+ seq_printf(seq, "fast6 have %d conn!!!\nskb_num6:%d,fast6_num:%d,expand_head6:%d\n",
+ working_list6.count, skb_num6, fast6_num, skb_expand6);
}
return &working_hash6[*pos];
}
@@ -1160,6 +1160,42 @@
.proc_write = ct_iptables_syn_set,
};
+/* Started by AICoder, pid:i2747j1887i1a311479909db709e49391b4455c1 */
+static ssize_t dev_unreg_set(struct file *file, const char __user *buffer, size_t count, loff_t *pos)
+{
+ struct net_device *dev = NULL;
+ size_t size;
+ char dev_name[MAX_NET_DEVICE_NAME_LEN + 1] = {0};
+
+ // Ensure that the string is null-terminated
+ if (count == 0 || count > MAX_NET_DEVICE_NAME_LEN + 1)
+ return -EINVAL;
+
+ // Copy the device name from user space and ensure it's null terminated
+ size = min(count - 1, MAX_NET_DEVICE_NAME_LEN);
+ if (copy_from_user(dev_name, buffer, size)) {
+ return -EFAULT;
+ }
+ dev_name[size] = '\0'; // Ensure null-termination
+
+ // Try to get the network device by name
+ dev = dev_get_by_name(&init_net, dev_name);
+ if (dev) {
+ // Put the device reference
+ dev_put(dev);
+ // Unregister the network device
+ unregister_netdev(dev);
+ } else {
+ printk("dev_unreg %s not found\n", dev_name);
+ }
+
+ return count;
+}
+
+static const struct proc_ops dev_unreg_file_ops = {
+ .proc_write = dev_unreg_set,
+};
+/* Ended by AICoder, pid:i2747j1887i1a311479909db709e49391b4455c1 */
//¿ìËÙת·¢procÎļþµÄ³õʼ»¯
int fast_conntrack_init_proc(void)
@@ -1195,6 +1231,7 @@
proc_create("dev_reset_stats", 0440, init_net.proc_net, &dev_reset_file_ops);
proc_create("ct_iptables_syn", 0440, init_net.proc_net, &ct_iptables_syn_file_ops);
+ proc_create("dev_unreg", 0440, init_net.proc_net, &dev_unreg_file_ops);
return 1;
}
diff --git a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/net/core/fastproc/fastnat.c b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/net/core/fastproc/fastnat.c
index 717454c..8d585c0 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/net/core/fastproc/fastnat.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/net/core/fastproc/fastnat.c
@@ -209,6 +209,7 @@
{
iph = (struct iphdr *)skb2->data;
skb = skb2;
+ skb_expand4++;
}
fast_tcpdump(skb);
@@ -275,7 +276,8 @@
skb->priority = nat_entry_data->priority;
skb->mark = nat_entry_data->mark;
-
+
+ spin_lock_bh(&fast_fw_spinlock);
//»ùÓÚctÁ´½ÓµÄÁ÷Á¿Í³¼Æ --- ͳ¼ÆIP°ü²»ÊÇMAC°ü
if (nat_entry_data->tuplehash.tuple.dst.dir == IP_CT_DIR_ORIGINAL){
nat_entry->ct->packet_info[IP_CT_DIR_ORIGINAL].packets++;
@@ -294,6 +296,7 @@
} else {
printk("fastnat packet error\n");
}
+ spin_unlock_bh(&fast_fw_spinlock);
//ÄÚºË×Ô´øµÄ»ùÓÚÁ´½ÓµÄÁ÷Á¿Í³¼Æ
struct nf_conn_counter *acct = (struct nf_conn_counter *)nf_conn_acct_find((const struct nf_conn *)nat_entry->ct);
@@ -450,7 +453,8 @@
}
//¹ã²¥¡¢×é²¥²»½¨Á´
- if (ipv4_is_multicast(ip_hdr(skb)->daddr) || ipv4_is_lbcast(ip_hdr(skb)->daddr))
+ if (ipv4_is_multicast(ip_hdr(skb)->daddr) || ipv4_is_lbcast(ip_hdr(skb)->daddr)
+ || ip_hdr(skb)->daddr == 0 || ip_hdr(skb)->saddr == 0)
{
return NF_ACCEPT;
}
@@ -467,13 +471,10 @@
}
_neighbour = dst_neigh_lookup_skb(dst, skb);
- if (!_neighbour)
- {
- print_sun(SUN_DBG,"napt_handle() _neighbour = null\n");
+ if(_neighbour == NULL && ((ip_hdr(skb)->daddr & 0xff000000) == 0xff000000 )){
return NF_ACCEPT;
- }
-
- if (memcmp(_neighbour->ha, zeromac, ETH_ALEN) == 0)
+ }
+ if (_neighbour && memcmp(_neighbour->ha, zeromac, ETH_ALEN) == 0)
{
if (strncmp(out->name, ppp_name, strlen(ppp_name)) != 0)
{
@@ -557,9 +558,10 @@
entry_data = &nat_entry->data[dir];
entry_data->tuplehash.tuple = ct->tuplehash[dir].tuple;
- memcpy(entry_data->dmac, _neighbour->ha, ETH_ALEN);
+ //memcpy(entry_data->dmac, _neighbour->ha, ETH_ALEN);
entry_data->priority = skb->priority;
entry_data->mark = skb->mark;
+ if(entry_data->outdev == NULL){
entry_data->outdev = out;
/*¼Ç¼MACµØÖ·µ½entry_data->hh_data*/
@@ -568,6 +570,7 @@
spin_unlock_bh(&fastnat_spinlock);
goto accept;
}
+ }
print_sun(SUN_DBG,"napt_handle() ct->status=0x%x\n", ct->status);
/*»ñÈ¡natת»»ÐèÒªµÄIPºÍportÐÅÏ¢*/
if (test_bit(IPS_SRC_NAT_BIT, &ct->status))
@@ -624,6 +627,7 @@
spin_unlock_bh(&fastnat_spinlock);
accept:
+ if(_neighbour)
neigh_release(_neighbour);
return NF_ACCEPT;
}
diff --git a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/net/netfilter/nf_conntrack_core.c b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/net/netfilter/nf_conntrack_core.c
index e92413e..d4ae0b7 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/net/netfilter/nf_conntrack_core.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/net/netfilter/nf_conntrack_core.c
@@ -1621,6 +1621,11 @@
ct->packet_info[IP_CT_DIR_ORIGINAL].bytes = 0;
ct->packet_info[IP_CT_DIR_REPLY].packets = 0;
ct->packet_info[IP_CT_DIR_REPLY].bytes = 0;
+ ct->indev[IP_CT_DIR_ORIGINAL] = NULL;
+ ct->outdev[IP_CT_DIR_ORIGINAL] = NULL;
+ ct->indev[IP_CT_DIR_REPLY] = NULL;
+ ct->outdev[IP_CT_DIR_REPLY] = NULL;
+ ct->fast_entry = NULL;
for(dir = IP_CT_DIR_ORIGINAL; dir < IP_CT_DIR_MAX; dir++)
{
ct->indev[dir] = NULL;
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/Script/scripts/internet.sh b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/Script/scripts/internet.sh
index 3cde326..a674513 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/Script/scripts/internet.sh
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/Script/scripts/internet.sh
@@ -7,7 +7,7 @@
path_sh=`nv get path_sh`
. $path_sh/global.sh
echo "Info: internet.sh start" > $test_log
-echo "Info: `date +%m-%d %H:%M:%S`" >> $test_log
+echo "Info: `date +%m-%d_%H:%M:%S`" >> $test_log
echo 7200 > /proc/sys/net/netfilter/nf_conntrack_tcp_timeout_established
@@ -28,6 +28,10 @@
echo "Info: set fastnat_level£º$fastnat_level" >> $test_log
echo $fastnat_level > /proc/net/fastnat_level
+fastbr_level=`nv get fastbr_level`
+echo "Info: set fastbr_level: $fastbr_level" >> $test_log
+echo $fastbr_level > /proc/net/fastbr_level
+
#½«²»Ö§³Ö¿ìËÙת·¢µÄÐÒé¶Ë¿ÚºÅ´«¸øÄÚºË
nofast_port=`nv get nofast_port`
echo "Info: set nofast_port£º$nofast_port" >> $test_log
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/adb/adb.h b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/adb/adb.h
index c3c937a..f675d9c 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/adb/adb.h
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/adb/adb.h
@@ -329,7 +329,7 @@
/* define ADB_TRACE to 1 to enable tracing support, or 0 to disable it */
-#define ADB_TRACE 1
+#define ADB_TRACE 0
/* IMPORTANT: if you change the following list, don't
* forget to update the corresponding 'tags' table in
@@ -398,10 +398,16 @@
errno = save_errno; \
} \
} while (0)
+
+#define debug_printf(...) \
+ do{ printf(__VA_ARGS__); } while(0)
+
+
#else
# define D(...) ((void)0)
# define DR(...) ((void)0)
# define ADB_TRACING 0
+#define debug_printf(...) ((void)0)
#endif
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/adb/fdevent.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/adb/fdevent.c
index 7546e89..59630b5 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/adb/fdevent.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/adb/fdevent.c
@@ -56,7 +56,11 @@
#define FATAL(x...) fatal(__FUNCTION__, x)
-#if 1
+#ifndef ADB_TRACE
+#define ADB_TRACE 0
+#endif
+
+#if ADB_TRACE
#define D(...) \
do { \
adb_mutex_lock(&D_lock); \
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/adb/file_sync_service.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/adb/file_sync_service.c
index 07bc505..5efd4a5 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/adb/file_sync_service.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/adb/file_sync_service.c
@@ -57,7 +57,7 @@
{
syncmsg msg;
struct stat st;
- printf("<====> do_stat enter \n");
+ debug_printf("<====> do_stat enter \n");
msg.stat.id = ID_STAT;
if(lstat(path, &st)) {
@@ -70,9 +70,9 @@
msg.stat.time = htoll(st.st_mtime);
}
- printf("<====> do_stat writex \n");
+ debug_printf("<====> do_stat writex \n");
return writex(s, &msg.stat, sizeof(msg.stat));
- printf("<====> do_stat writex end\n");
+ //printf("<====> do_stat writex end\n");
}
static int do_list(int s, const char *path)
@@ -156,10 +156,10 @@
unsigned int timestamp = 0;
int fd;
- printf("<====> enter handle_send_file \n");
- printf("<====> enter handle_send_file s=%d \n", s);
- printf("<====> enter handle_send_file path=%s \n", path);
- printf("<====> enter handle_send_file mode=%d \n", mode);
+ debug_printf("<====> enter handle_send_file \n");
+ debug_printf("<====> enter handle_send_file s=%d \n", s);
+ debug_printf("<====> enter handle_send_file path=%s \n", path);
+ debug_printf("<====> enter handle_send_file mode=%d \n", mode);
fd = adb_open_mode(path, O_WRONLY | O_CREAT | O_EXCL, mode);
if(fd < 0 && errno == ENOENT) {
@@ -211,7 +211,7 @@
}
fdatasync(fd);
- printf("[zhouguopo]sync %s\n", path);
+ printf("[adb] sync %s\n", path);
if(fd >= 0) {
struct utimbuf u;
@@ -226,7 +226,7 @@
return -1;
}
- printf("<====> enter handle_send_file success\n");
+ debug_printf("<====> enter handle_send_file success\n");
return 0;
fail:
@@ -292,7 +292,7 @@
mode_t mode;
int is_link, ret;
- printf("<====> enter do_send \n");
+ debug_printf("<====> enter do_send \n");
tmp = strrchr(path,',');
if(tmp) {
@@ -335,7 +335,7 @@
{
syncmsg msg;
int fd, r;
- printf("<====> enter do_recv \n");
+ debug_printf("<====> enter do_recv \n");
fd = adb_open(path, O_RDONLY);
if(fd < 0) {
if(fail_errno(s)) return -1;
@@ -414,7 +414,7 @@
for(;;) {
D("sync: waiting for command\n");
- printf("<=====>file_sync_service waiting for command\n");
+ debug_printf("<=====>file_sync_service waiting for command\n");
if(readx(fd, &msg.req, sizeof(msg.req))) {
printf("<=====>file_sync_service command read failure\n");
@@ -423,14 +423,14 @@
}
namelen = ltohl(msg.req.namelen);
- printf("<=====>file_sync_service %d\n",__LINE__);
+ debug_printf("<=====>file_sync_service %d\n",__LINE__);
if(namelen > 1024) {
printf("<=====>file_sync_service invalid namelen\n");
fail_message(fd, "invalid namelen");
break;
}
- printf("<=====>file_sync_service %d\n",__LINE__);
+ debug_printf("<=====>file_sync_service %d\n",__LINE__);
if(readx(fd, name, namelen)) {
printf("<=====>file_sync_service filename read failure\n");
fail_message(fd, "filename read failure");
@@ -441,7 +441,7 @@
msg.req.namelen = 0;
//D("sync: '%s' '%s'\n", (char*) &msg.req, name);
//printf("<=====>file_sync_service sync: req='%s',name= '%s' \n");
- printf("<=====>file_sync_service %d\n",__LINE__);
+ debug_printf("<=====>file_sync_service %d\n",__LINE__);
/* ADB:auto fix endian.[ */
#if 0
@@ -476,31 +476,31 @@
#else
if(ID_STAT == msg.req.id)
{
- printf("<====> sync ID_STAT \n");
+ debug_printf("<====> sync ID_STAT \n");
if(do_stat(fd, name)) goto fail;
- printf("<====> do_stat over \n");
+ debug_printf("<====> do_stat over \n");
}
else if(ID_LIST == msg.req.id)
{
- printf("<====> sync ID_LIST \n");
+ debug_printf("<====> sync ID_LIST \n");
if(do_list(fd, name)) goto fail;
- printf("<====> do_list over \n");
+ debug_printf("<====> do_list over \n");
}
else if(ID_SEND == msg.req.id)
{
- printf("<====> sync ID_SEND \n");
+ debug_printf("<====> sync ID_SEND \n");
if(do_send(fd, name, buffer)) goto fail;
- printf("<====> do_send over \n");
+ debug_printf("<====> do_send over \n");
}
else if(ID_RECV == msg.req.id)
{
- printf("<====> sync ID_RECV \n");
+ debug_printf("<====> sync ID_RECV \n");
if(do_recv(fd, name, buffer)) goto fail;
- printf("<====> do_recv over \n");
+ debug_printf("<====> do_recv over \n");
}
else if(ID_QUIT == msg.req.id)
{
- printf("<====> sync ID_QUIT \n");
+ debug_printf("<====> sync ID_QUIT \n");
goto fail;
}
else
@@ -515,7 +515,7 @@
fail:
if(buffer != 0) free(buffer);
D("sync: done\n");
- printf("<====> sync: done\n");
+ debug_printf("<====> sync: done\n");
adb_close(fd);
adb_rm_wakelock();
}
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/adb/services.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/adb/services.c
index f870096..abff7b2 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/adb/services.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/adb/services.c
@@ -220,7 +220,7 @@
adb_thread_t t;
int s[2];
- printf("create_service_thread start\n");
+ debug_printf("create_service_thread start\n");
if(adb_socketpair(s)) {
return -1;
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/at_ctl/Makefile b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/at_ctl/Makefile
index 4736fbe..d00656e 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/at_ctl/Makefile
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/at_ctl/Makefile
@@ -16,6 +16,7 @@
CFLAGS += -I$(LIB_DIR)/libatext
#CFLAGS += -I$(LIB_DIR)/libsqlite
CFLAGS += -I$(LIB_DIR)/libnvram
+CFLAGS += -I$(LIB_DIR)/libdebug_info
CFLAGS += -I$(LIB_DIR)/libzcore/std/inc/zCore/bl
CFLAGS += -I$(LIB_DIR)/libzcore/std/inc/zCore/gui
@@ -37,6 +38,7 @@
LDLIBS += $(LDLIBS_EXT)
LDLIBS += -lcrypto
LDLIBS += -lsd-daemon
+LDLIBS += -ldebug_info -L$(LIB_DIR)/libdebug_info
LDLIBS += -ltelsvr -L$(zte_lib_path)/libtelsvr/lib/libtelsvr.a
#LDLIBS += -lstdzcore -L$(LIB_DIR)/libzcore/std -L$(LIB_DIR)/libzcore/std/platadapt/linux/lib -lplatadapt -L$(LIB_DIR)/libzcore/std/prebuilts/ime -lzi8clib -L$(LIB_DIR)/libzcore/std/lib/font -lttf_font -L$(LIB_DIR)/libzcore/std/prebuilts/freetype -lft2debug
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/at_ctl/src/atconfig/config_linux.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/at_ctl/src/atconfig/config_linux.c
index 7417673..01cd03b 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/at_ctl/src/atconfig/config_linux.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/at_ctl/src/atconfig/config_linux.c
@@ -108,7 +108,7 @@
register_clt_func("ZGPCOAUTH=",zgpcoauth_ok_act,zgpcoauth_err_act);
register_inform_func("cgev",cgev_auto_act);
- register_inform_func("zgipdns",zgipdns_auto_act);
+ //register_inform_func("zgipdns",zgipdns_auto_act);
register_fwd_func("zpdpdeact=",zpdpdeact_fwd,NULL,NULL);
register_fwd_func("cgact=",cgact_req_rcv_act,cgact_fwd_ok_act,cgact_fwd_err_act);
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/at_ctl/src/atconfig/ps_normal.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/at_ctl/src/atconfig/ps_normal.c
index 3a9f5b7..83ef32e 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/at_ctl/src/atconfig/ps_normal.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/at_ctl/src/atconfig/ps_normal.c
@@ -21,7 +21,7 @@
//bsim
#include <openssl/aes.h>
-
+#include "pub_debug_info.h"
//>>>sj.zhang add @2023-10-08 for fix the issue of timezone.
#define _XOPEN_SOURCE
extern long timezone;
@@ -93,6 +93,8 @@
#endif
extern struct defcid_mng_t g_defcid_mng;
char imsi[50] = {0};
+char MODULE_ID_AT_CTL_DEBUG[20] = "cap_at_ctl";
+
//zdm ÇëÕ×·áÈ·ÈÏÊÇ·ñÐèҪͬ²½µ½AP²à
//ºóÐøÓÃËøÍøÌæ´ú£¬ÆÕͨ°æ±¾²»Ëø
char* zurdy_convert_cmd(void *msg,struct at_context *context)
@@ -175,6 +177,7 @@
return AT_END;
}
rtc_set_time(MODULE_ID_AT_CTL);
+ sc_debug_info_record(MODULE_ID_AT_CTL_DEBUG, "nitz time synchronization successful!\n");
return AT_END;
}
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/at_ctl/src/atconfig/ps_pdp.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/at_ctl/src/atconfig/ps_pdp.c
index 4f3ab13..452f574 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/at_ctl/src/atconfig/ps_pdp.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/at_ctl/src/atconfig/ps_pdp.c
@@ -190,7 +190,7 @@
snprintf(cmd, sizeof(cmd),"ifconfig zvnet%d %s/126 up", cid, ip);
at_print(AT_ERR,"proc_netdev_v6=%s\n",cmd);
soft_system(cmd);
- snprintf(cmd, sizeof(cmd), "ip -6 route add default dev zvnet%d", cid);
+ snprintf(cmd, sizeof(cmd), "ip -6 ro add default dev zvnet%d", cid);
soft_system(cmd);
soft_system("echo 1 > /proc/sys/net/ipv6/conf/all/forwarding");
soft_system("echo 1 > /proc/sys/net/ipv6/conf/all/proxy_ndp");
@@ -215,7 +215,7 @@
soft_system(cmd);
}
soft_system("echo 1 > /proc/sys/net/ipv4/ip_forward");
- snprintf(cmd, sizeof(cmd), "ip route add default dev zvnet%d", cid);
+ snprintf(cmd, sizeof(cmd), "ip ro add default dev zvnet%d", cid);
soft_system(cmd);
}
}else{
@@ -224,9 +224,9 @@
if(atoi(cap_gw_cid) == cid){
snprintf(cmd, sizeof(cmd), "iptables -t nat -D POSTROUTING -o zvnet%d -j MASQUERADE", cid);
soft_system(cmd);
- snprintf(cmd, sizeof(cmd), "ip route del default dev zvnet%d", cid);
+ snprintf(cmd, sizeof(cmd), "ip ro del default dev zvnet%d", cid);
soft_system(cmd);
- snprintf(cmd, sizeof(cmd), "ip route -6 del default dev zvnet%d", cid);
+ snprintf(cmd, sizeof(cmd), "ip -6 ro del default dev zvnet%d", cid);
soft_system(cmd);
sc_cfg_set("cap_gw_cid", "");
sc_cfg_set("default_wan6_name", "");
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 e8d1132..4c4931c 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
@@ -50,6 +50,9 @@
SCWIFI_CMD_ENABLE_REQ, //dev on/off
SCWIFI_CMD_ENABLE_RSP,
+ SCWIFI_GET_ENABLE_REQ,
+ SCWIFI_GET_ENABLE_RSP,
+
SCWIFI_CMD_WAKE_REQ, //dev wakeup/sleep
SCWIFI_CMD_WAKE_RSP,
@@ -180,6 +183,11 @@
int is_sleep;
} scwifi_sleep_res_t;
+typedef struct {
+ int result;
+ int wifi_status;
+} scwifi_enable_res_t;
+
//¶ÔÄÚÍ·Îļþ
//Ö»ÔÚcapÓÃ
typedef struct {
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/libatchn/inc/zxic_atchn_api.h b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/libatchn/inc/zxic_atchn_api.h
index dd56305..68cd3a8 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/libatchn/inc/zxic_atchn_api.h
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/libatchn/inc/zxic_atchn_api.h
@@ -76,28 +76,28 @@
int zxic_write_atchn(long handle, char *buf,unsigned int len);
/**
- * @brief ×¢²áRPMSGеÄATͨµÀ¡£
- * @param name RPMSGͨµÀÃû(Èç"/dev/armps_rpmsgch%d")¡£²»ÄÜΪ¿Õ¡£
- * @param callbacks ͨµÀ»Øµ÷ÐÅÏ¢at_chn_calls_t¡£
- * @param priv ˽ÓÐÊý¾Ý£¬µ÷ÓÃat_chn_calls_tÖлص÷ʱ´øÈë¡£
- * @param flag ͨµÀ±êÖ¾¡£Ö§³ÖZXIC_ATCHN_FLAGS_NONE¡¢ZXIC_ATCHN_FLAGS_AUTOµÈ
- * @return ATͨµÀ¾ä±ú¡£·µ»Ø-1±íʾͨµÀ×¢²áʧ°Ü¡£
+ * @brief ×¢²áRPMSGеÄATͨµÀ¡£
+ * @param name RPMSGͨµÀÃû(Èç"/dev/armps_rpmsgch%d")¡£²»ÄÜΪ¿Õ¡£
+ * @param callbacks ͨµÀ»Øµ÷ÐÅÏ¢at_chn_calls_t¡£
+ * @param priv ˽ÓÐÊý¾Ý£¬µ÷ÓÃat_chn_calls_tÖлص÷ʱ´øÈë¡£
+ * @param flag ͨµÀ±êÖ¾¡£Ö§³ÖZXIC_ATCHN_FLAGS_NONE¡¢ZXIC_ATCHN_FLAGS_AUTOµÈ
+ * @return ATͨµÀ¾ä±ú¡£·µ»Ø-1±íʾͨµÀ×¢²áʧ°Ü¡£
* @note
*/long zxic_register_atchn_rpmsg(char *name, struct at_chn_calls_t *callbacks, void *priv, unsigned int flag);
/**
- * @brief ×¢ÏúRPMSGÖ¸¶¨ATͨµÀ¡£
- * @param handle ͨµÀ¾ä±ú£¬zxic_register_atchn_rpmsg·µ»ØÖµ¡£
- * @return 0±íʾ³É¹¦£»-1±íʾʧ°Ü¡£
+ * @brief ×¢ÏúRPMSGÖ¸¶¨ATͨµÀ¡£
+ * @param handle ͨµÀ¾ä±ú£¬zxic_register_atchn_rpmsg·µ»ØÖµ¡£
+ * @return 0±íʾ³É¹¦£»-1±íʾʧ°Ü¡£
* @note
*/
int zxic_unregister_atchn_rpmsg(long handle);
/**
- * @brief ·¢ËÍATÃüÁî¡£
- * @param handle ͨµÀ¾ä±ú£¬zxic_register_atchn_rpmsg·µ»ØÖµ¡£
- * @param buf ATÃüÁ´æ¡£
- * @param len ATÃüÁ¶È¡£
- * @return 0±íʾ³É¹¦£»-1±íʾʧ°Ü¡£
- * @note ÍêÕûµÄATÃüÁî±ØÐë´ø"/r/n"¡£
+ * @brief ·¢ËÍATÃüÁî¡£
+ * @param handle ͨµÀ¾ä±ú£¬zxic_register_atchn_rpmsg·µ»ØÖµ¡£
+ * @param buf ATÃüÁ´æ¡£
+ * @param len ATÃüÁ¶È¡£
+ * @return 0±íʾ³É¹¦£»-1±íʾʧ°Ü¡£
+ * @note ÍêÕûµÄATÃüÁî±ØÐë´ø"/r/n"¡£
*/
int zxic_write_atchn_rpmsg(long handle, char *buf,unsigned int len);
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/libflags/flags_api.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/libflags/flags_api.c
index f40389a..c6bf37c 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/libflags/flags_api.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/libflags/flags_api.c
@@ -218,6 +218,7 @@
char mtdname[64] = {0};
int mtdnum = 0;
unsigned int mtdsize, mtderasesize;
+
memset(buf, 0, sizeof(buf));
line_str = fgets(buf, sizeof(buf) - 1, fp_mtd);
@@ -791,9 +792,10 @@
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;
@@ -808,101 +810,172 @@
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 *)malloc(sizeof(T_FLAGS_INFO));
+ if (NULL == main_flag)
{
- flags_err("get flags info fail");
-
- return -1;
+ flags_err("malloc main_flag fail");
+ goto err;
+ }
+
+ backup_flag = (T_FLAGS_INFO *)malloc(sizeof(T_FLAGS_INFO));
+ if (NULL == backup_flag)
+ {
+ flags_err("malloc backup_flag fail");
+ goto err;
+ }
+
+ p_flags_info_tmp = (T_FLAGS_INFO *)malloc(sizeof(T_FLAGS_INFO));
+ if (NULL == p_flags_info_tmp)
+ {
+ flags_err("malloc p_flags_info_tmp fail");
+ goto err;
}
- flags_log("main_flag crc32=%u, crc32_1=%u", main_flag.crc32, main_flag.crc32_1);
- flags_log("backup_flag crc32=%u, crc32_1=%u", backup_flag.crc32, backup_flag.crc32_1);
+ 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");
+ goto err;
+ }
+
+ flags_log("main_flag crc32=%u, crc32_1=%u", main_flag->crc32, main_flag->crc32_1);
+ flags_log("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)))
{
- memcpy(&p_flags_info_tmp, &main_flag, sizeof(T_FLAGS_INFO));
- memset(p_flags_info_tmp.img_size[0].name, 0, sizeof(T_FLAGS_INFO)-512);
+ memcpy(p_flags_info_tmp, main_flag, sizeof(T_FLAGS_INFO));
+ memset(p_flags_info_tmp->img_size[0].name, 0, sizeof(T_FLAGS_INFO)-512);
crc32init_le();
- p_flags_info_tmp.crc32_1 = crc32_le(0, (unsigned char const *)(&p_flags_info_tmp), sizeof(T_FLAGS_INFO));
- flags_log("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_log("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;
crc32init_le();
- 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_log("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_log("crc32_le_backup crc32=%u", crc32_le_backup);
if (crc32_main == crc32_le_main)
{
- copy_flags_info(p_flags_info, &main_flag);
-
- return 0;
+ copy_flags_info(p_flags_info, main_flag);
+ goto succ;
}
if (crc32_backup == crc32_le_backup)
{
- copy_flags_info(p_flags_info, &backup_flag);
-
- return 0;
+ copy_flags_info(p_flags_info, backup_flag);
+ goto succ;
+ }
+
+ flags_err("do not find valid flags info");
+ goto err;
+
+succ:
+ if (NULL != main_flag)
+ {
+ free(main_flag);
}
- flags_err("do not find valid flags info");
-
+ if (NULL != backup_flag)
+ {
+ free(backup_flag);
+ }
+
+ if (NULL != p_flags_info_tmp)
+ {
+ free(p_flags_info_tmp);
+ }
+
+ return 0;
+
+err:
+ if (NULL != main_flag)
+ {
+ free(main_flag);
+ }
+
+ if (NULL != backup_flag)
+ {
+ free(backup_flag);
+ }
+
+ if (NULL != p_flags_info_tmp)
+ {
+ free(p_flags_info_tmp);
+ }
+
return -1;
}
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;
}
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)
+ main_flag = (T_FLAGS_INFO *)malloc(sizeof(T_FLAGS_INFO));
+ if (NULL == main_flag)
+ {
+ flags_err("malloc main_flag fail");
+ goto err;
+ }
+
+ backup_flag = (T_FLAGS_INFO *)malloc(sizeof(T_FLAGS_INFO));
+ if (NULL == backup_flag)
+ {
+ flags_err("malloc backup_flag fail");
+ goto err;
+ }
+
+ memset(main_flag, 0, sizeof(T_FLAGS_INFO));
+ memset(backup_flag, 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;
}
crc32init_le();
@@ -918,11 +991,33 @@
if (set_flags_info(p_flags_info, &main_index, &backup_index) != 0)
{
flags_err("set flags info fail");
-
- return -1;
+ goto err;
}
+
+ if (NULL != main_flag)
+ {
+ free(main_flag);
+ }
+
+ if (NULL != backup_flag)
+ {
+ free(backup_flag);
+ }
return 0;
+
+err:
+ if (NULL != main_flag)
+ {
+ free(main_flag);
+ }
+
+ if (NULL != backup_flag)
+ {
+ free(backup_flag);
+ }
+
+ return -1;
}
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/libvoice/Makefile b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/libvoice/Makefile
index 07cf19a..701804e 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/libvoice/Makefile
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/libvoice/Makefile
@@ -31,6 +31,12 @@
else
OBJS = voice.o alsa_call.o voice_ipc.o
endif
+
+ifeq ($(CONFIG_VB_TRANSMIT_INTF), NULL)
+OBJS += voice_buffer.o
+endif
+
+
CFLAGS += -g
#LDFLAGS += -lpthread
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/libvoice/include/voice_lib.h b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/libvoice/include/voice_lib.h
index 14ac0cc..f43a1a2 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/libvoice/include/voice_lib.h
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/libvoice/include/voice_lib.h
@@ -81,7 +81,12 @@
int vbuffer_client_stream_stop(void);
#endif
-
+ int voice_buffer_open(void);
+ int voice_buffer_close(int fd);
+ int voice_buffer_write(int fd, unsigned char *pdata, unsigned int len);
+ int voice_buffer_read(int fd, unsigned char *pdata, unsigned int len);
+ int voice_buffer_ioctl(int fd, unsigned int cmd, void *pvalue);
+ int voice_buffer_stop(int fd);
#endif
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/libvoice/voice.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/libvoice/voice.c
index 01267be..b8f0364 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/libvoice/voice.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/libvoice/voice.c
@@ -217,10 +217,13 @@
slic_flag = voice_GetSlicFlag();
printf(" voice slic flag get, slic_flag=%d!\n", slic_flag);
if (slic_flag == 1) {
+
+ printf("%s:cap slic_flag set,return!\n",__func__);
return 0;
}
}
+ printf("%s:cap do mixer and pcm opt!\n",__func__);
//open mixer dev for codec control
voice_mixer = mixer_open(0);
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/libvoice/voice_buffer.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/libvoice/voice_buffer.c
index e236432..b4a9a5d 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/libvoice/voice_buffer.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/libvoice/voice_buffer.c
@@ -133,10 +133,6 @@
FILE *rtp_tx_pcm_file;
int rtp_tx_pcm_filesize;
-
-#endif
- int fs;
-
int sockfd;
int af;
struct sockaddr_in src;
@@ -146,6 +142,11 @@
char *rtp_from_net_filename;
FILE *rtp_from_net_file;
int rtp_from_net_filesize;
+
+#endif
+ int fs;
+
+
#ifdef _USE_VOICE_ALSA
struct mixer *mixer_handle;
struct pcm *p_pcm_handle;
@@ -265,7 +266,6 @@
fd = open(VBUFFER_DEV_NAME, VBUFFER_DEV_FLAGS);
printf("%s: fd=%d!\n",__func__,fd);
- signal(SIGIO,vb_signal_back_func);
fcntl(fd,F_SETOWN,getpid());
oflags = fcntl(fd,F_GETFL);
fcntl(fd,F_SETFL,oflags|FASYNC);
@@ -368,6 +368,25 @@
}
+int voice_buffer_stop(int fd)
+{
+ int ret;
+ if (fd > 0) {
+ sem_post(&vb_rec.read_sem);
+ sem_post(&vb_rec.write_sem);
+ }
+ else{
+ printf("%s: fd invalid,return!\n",__func__);
+ return -ENOENT;
+
+ }
+ return ret;
+}
+
+
+#ifdef _VB_TRANSMIT_INTF_RTP
+
+
//#define BINDING_DEVICE_NAME "eth0"
//#define DEST_IP_ADDR "192.168.0.100"
@@ -556,6 +575,8 @@
return s_size;
}
+
+#endif
static int vb_thread_create( const char *name,pthread_t *thread_t, vb_thread_proc *proc,
int stack_size, unsigned priority,void *arg )
{
@@ -1072,6 +1093,7 @@
+#ifdef _VB_TRANSMIT_INTF_RTP
//640+12
char rtp_in_buf[652]={0};
@@ -1615,6 +1637,7 @@
return 0;
}
+#endif
static int vb_rx_thread_func(void *arg)
{
int ret;
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 6199ad5..26aafe1 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
@@ -171,8 +171,7 @@
msgSnd.msgType = MSG_TYPE_NV;
msgSnd.pid = g_pid;
//printf("apnv_cap msgsnd to nvserver pid:%d\n", msgSnd.pid);
- if (strcmp(msgSnd.key, "zcat_mode"))
- //print_nv_info(&msgSnd);
+ //print_nv_info(&msgSnd);
retry1:
if (-1 == msgsnd(msgId, &msgSnd, sizeof(T_NV_MSG_INFO) - sizeof(long), 0))
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 dddd8d9..d1733c9 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
@@ -184,7 +184,7 @@
return 0;
}
- if (read(fd, &p_item_count, 4) != 4)
+ if (read(fd, p_item_count, 4) != 4)
{
*p_item_count = 0;
close(fd);
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/sntp/Makefile b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/sntp/Makefile
index 7f6dd06..4f35d35 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/sntp/Makefile
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/sntp/Makefile
@@ -11,6 +11,7 @@
CFLAGS += -I$(LIB_DIR)/libnvram
CFLAGS += -I$(LIB_DIR)/libsqlite
CFLAGS += -I$(LIB_DIR)/libsoftap
+CFLAGS += -I$(LIB_DIR)/libdebug_info
CFLAGS += -g
CFLAGS += -g -Werror=implicit-function-declaration
@@ -22,6 +23,7 @@
LDLIBS += -lnvram -L$(LIB_DIR)/libnvram
LDLIBS += -lsoftap -L$(LIB_DIR)/libsoftap
LDLIBS += -lsofttimer -L$(LIB_DIR)/libsofttimer
+LDLIBS += -ldebug_info -L$(LIB_DIR)/libdebug_info
##############USER COMIZE END##################
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/sntp/sntp.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/sntp/sntp.c
index 1118b95..0596798 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/sntp/sntp.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/sntp/sntp.c
@@ -21,6 +21,7 @@
//#include "cfg_api.h"
//#include "at_com.h"
#include "sntp.h"
+#include "pub_debug_info.h"
/**************************************************************************
@@ -36,6 +37,7 @@
int g_sntp_success_count = 0;
int g_sntp_sync_interval_time = 1; //ͬ²½³É¹¦ºó£¬ÔÙ´Î×Ô¶¯Í¬²½µÄ¼ä¸ôʱ¼ä£¬µ¥Î»:Ìì
+char MODULE_ID_SNTP_DEBUG[20] = "cap_sntp";
// ¶Ôsem_idÖ´ÐÐp²Ù×÷
static int sem_p(int sem_id)
{
@@ -549,6 +551,7 @@
system("zxic-rtc-clock");
time_t cur_time = time(0);
ipc_send_message(0, MODULE_ID_RTC_SERVICE, RTC_MSG_SNTP_UPDATE, sizeof(time_t),&cur_time, 0);
+ sc_debug_info_record(MODULE_ID_SNTP_DEBUG, "sntp time synchronization successful!\n");
slog(MISC_PRINT, SLOG_DEBUG, "[zyl]system zxic-rtc-clock \n");
}
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/wlan_proxy/Makefile b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/wlan_proxy/Makefile
index 18e3f81..c187e6e 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/wlan_proxy/Makefile
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/wlan_proxy/Makefile
@@ -10,7 +10,7 @@
CFLAGS += -g
CFLAGS += -g -Werror=implicit-function-declaration
-CFLAGS += -DCONFIG_WIFI_EFUSE_MAC
+#CFLAGS += -DCONFIG_WIFI_EFUSE_MAC
LDLIBS += -lpthread -lm -lrt
LDLIBS += -lsoftap -L$(zte_lib_path)/libsoftap
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 498e319..9416f0d 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
@@ -42,6 +42,8 @@
static wlan_sta_status_t g_wifi_sta_status = {0};
+static int g_wifi_enable_status = IN_WIFI_STATUS_DISABLED;
+
//
static int g_support_5g = 0;
@@ -67,6 +69,7 @@
{
{0, 1, 0, SCWIFI_CMD_CONN_REQ, wifi_evts_proc, NULL, NULL},
{0, 1, 0, SCWIFI_CMD_ENABLE_REQ, wifi_evts_proc, NULL, NULL},
+ {0, 1, 0, SCWIFI_GET_ENABLE_REQ, wifi_evts_proc, NULL, NULL},
{0, 1, 0, SCWIFI_CMD_WAKE_REQ, wifi_evts_proc, NULL, NULL},
{0, 1, 0, SCWIFI_GET_WAKE_REQ, wifi_evts_proc, NULL, NULL},
{0, 1, 0, SCWIFI_CMD_MODE_REQ, wifi_evts_proc, NULL, NULL},
@@ -108,6 +111,7 @@
//cap
CASE_RETURN_STR(SCWIFI_CMD_CONN_REQ);
CASE_RETURN_STR(SCWIFI_CMD_ENABLE_REQ);
+ CASE_RETURN_STR(SCWIFI_GET_ENABLE_REQ);
CASE_RETURN_STR(SCWIFI_CMD_WAKE_REQ);
CASE_RETURN_STR(SCWIFI_GET_WAKE_REQ);
CASE_RETURN_STR(SCWIFI_CMD_MODE_REQ);
@@ -187,17 +191,17 @@
return SC_ERR_SUCCESS;
}
+/* Started by AICoder, pid:038a7674aba23d0148ad08b870e06923e5e4d150 */
static void send_msg_by_key(sc_ipc_msg* pmsg)
{
int ret = 0;
int msg_fd = -1;
- scwifi_cli_key_t *pCur = NULL;
scwifi_cli_key_t *pTmp = NULL;
list_for_each_entry(pTmp, &cli_msgkey_list, list) {
pmsg->fd_svr = pTmp->cli_key;
- ret = sc_ipc_send_msg(pmsg);
+ ret = sc_ipc_send_msg_with_flag(pmsg, IPC_NOWAIT);
if (ret != 0) {
slog(WIFI_PRINT, SLOG_ERR, "wifi msg to cli(0x%x) fail.\n", pTmp->cli_key);
}
@@ -207,6 +211,7 @@
}
}
+/* Ended by AICoder, pid:038a7674aba23d0148ad08b870e06923e5e4d150 */
static sc_ipc_msg *wifi_connect_request(const sc_ipc_msg* const pmsg)
{
@@ -319,6 +324,28 @@
return pmsg_rsp;
}
+/* Started by AICoder, pid:60e9fjb798619c014cef097b405981181bb6e69a */
+static sc_ipc_msg *wifi_get_enable_stat(const sc_ipc_msg* const pmsg)
+{
+ scwifi_enable_res_t data_res = {0};
+ sc_ipc_msg *pmsg_rsp = sc_ipc_msg_new(sizeof(data_res));
+ int ret = 0;
+ char s_wifi_status[10] = {0};
+
+ if(NULL == pmsg_rsp) {
+ slog(WIFI_PRINT, SLOG_ERR, "wifi ipcmsg no memory!\n");
+ return NULL;
+ }
+
+ data_res.result = SC_ERR_SUCCESS;
+ data_res.wifi_status = g_wifi_enable_status;
+
+ wifi_ipcmsg_set(pmsg->fd_cli, pmsg->msg_rsp, (void *)&data_res, sizeof(data_res), pmsg_rsp);
+
+ return pmsg_rsp;
+}
+/* Ended by AICoder, pid:60e9fjb798619c014cef097b405981181bb6e69a */
+
static sc_ipc_msg *wifi_wake_request(const sc_ipc_msg* const pmsg)
{
scwifi_enable_t *pdata_info = (scwifi_enable_t *)pmsg->data;
@@ -360,6 +387,8 @@
g_ap_enable = SC_WIFI_DISABLE;
g_sta_enable = SC_WIFI_DISABLE;
clear_all_sta_record();
+ sc_timer_delete(STA_SCAN_SOFTTIMER_ID);
+ g_sta_scaning = 0;
g_sleep_stat.sleep_stat = SC_WIFI_SLEEP;
comm_res.result = SC_ERR_SUCCESS;
@@ -470,12 +499,12 @@
//dtest --- if ap is open, return error!!
if (g_work_mode == IN_WIFI_WORK_MODE_AP0) {
if (g_wifi_ap_status[0].status == IN_WIFI_AP_STATUS_NONE) {
- g_wifi_ap_status[0].status = IN_WIFI_AP_STATUS_IDLE;
+ //g_wifi_ap_status[0].status = IN_WIFI_AP_STATUS_IDLE;
}
}
if (g_work_mode == IN_WIFI_WORK_MODE_AP1) {
if (g_wifi_ap_status[1].status == IN_WIFI_AP_STATUS_NONE) {
- g_wifi_ap_status[1].status = IN_WIFI_AP_STATUS_IDLE;
+ //g_wifi_ap_status[1].status = IN_WIFI_AP_STATUS_IDLE;
}
}
@@ -929,7 +958,7 @@
sc_cfg_get("wifi_mac_white_list", p_param->mac_list, sizeof(p_param->mac_list));
}
else if (p_param->acl_rule == 2) {
- sc_cfg_get("wifi_mac_white_list", p_param->mac_list, sizeof(p_param->mac_list));
+ sc_cfg_get("wifi_mac_black_list", p_param->mac_list, sizeof(p_param->mac_list));
}
sc_cfg_get("AuthMode", p_param->authmode, sizeof(p_param->authmode));
@@ -964,17 +993,15 @@
sc_cfg_get("MAX_Access_num_5g", s_max_sta_num, sizeof(s_max_sta_num));
p_param->max_sta_num = atoi(s_max_sta_num);
- // zw.wang [wifi] If the 5G hotspot is enabled, the country code cannot be obtained by calling qser_wifi_ap_channel_get on 20240830 start
sc_cfg_get("CountryCode", p_param->countrycode, sizeof(p_param->countrycode));
- // zw.wang [wifi] If the 5G hotspot is enabled, the country code cannot be obtained by calling qser_wifi_ap_channel_get on 20240830 start
-
+
sc_cfg_get("ACL_mode_5g", s_acl_rule, sizeof(s_acl_rule));
p_param->acl_rule = atoi(s_acl_rule);
if (p_param->acl_rule == 1) {
sc_cfg_get("wifi_mac_white_list_5g", p_param->mac_list, sizeof(p_param->mac_list));
}
else if (p_param->acl_rule == 2) {
- sc_cfg_get("wifi_mac_white_list_5g", p_param->mac_list, sizeof(p_param->mac_list));
+ sc_cfg_get("wifi_mac_black_list_5g", p_param->mac_list, sizeof(p_param->mac_list));
}
sc_cfg_get("AuthMode_5g", p_param->authmode, sizeof(p_param->authmode));
@@ -1164,6 +1191,7 @@
return spot;
}
+/* Started by AICoder, pid:v1e40q3284sc8c614d6c0b4190a41d38b8c064f4 */
static sc_ipc_msg *wifi_sta_get_param_request(const sc_ipc_msg* const pmsg)
{
scwifi_sta_param_res_t data_res = {0};
@@ -1183,17 +1211,20 @@
if (strcmp(spot_string, "") != 0) {
spot_t *spot = NULL;
spot = parse_spot_string(spot_string);
- strncpy(data_res.ssid, spot->ssid, sizeof(data_res.ssid)-1);
- strncpy(data_res.authmode, spot->auth_mode, sizeof(data_res.authmode)-1);
- strncpy(data_res.encrypt, spot->encrypt_type, sizeof(data_res.encrypt)-1);
- strncpy(data_res.pwd, spot->password, sizeof(data_res.pwd)-1);
- safe_free(spot);
+ if (spot != NULL) {
+ strncpy(data_res.ssid, spot->ssid, sizeof(data_res.ssid)-1);
+ strncpy(data_res.authmode, spot->auth_mode, sizeof(data_res.authmode)-1);
+ strncpy(data_res.encrypt, spot->encrypt_type, sizeof(data_res.encrypt)-1);
+ strncpy(data_res.pwd, spot->password, sizeof(data_res.pwd)-1);
+ safe_free(spot);
+ }
}
wifi_ipcmsg_set(pmsg->fd_cli, pmsg->msg_rsp, (void *)&data_res, sizeof(data_res), pmsg_rsp);
return pmsg_rsp;
}
+/* Ended by AICoder, pid:v1e40q3284sc8c614d6c0b4190a41d38b8c064f4 */
static int check_sta_pre_condition(int enable)
{
@@ -1435,6 +1466,10 @@
case SCWIFI_CMD_ENABLE_REQ:
pmsg_rsp = wifi_enable_request(pmsg);
break;
+
+ case SCWIFI_GET_ENABLE_REQ:
+ pmsg_rsp = wifi_get_enable_stat(pmsg);
+ break;
case SCWIFI_CMD_WAKE_REQ:
pmsg_rsp = wifi_wake_request(pmsg);
@@ -1545,6 +1580,8 @@
{
wlan_status_t *status = (wlan_status_t *)pmsg->aucDataBuf;
sc_ipc_msg *pmsg_ind = NULL;
+
+ g_wifi_enable_status = status->wifi_status;
if (list_empty(&cli_msgkey_list)) {
slog(WIFI_PRINT, SLOG_ERR, "wifi_enable_status_ind no client.\n");
@@ -1575,6 +1612,8 @@
return NULL;
}
+ g_wifi_ap_status[idx].idx = idx;
+
g_wifi_ap_status[idx].pre_status = g_wifi_ap_status[idx].status;
g_wifi_ap_status[idx].status = ap_status->status;
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/zlog_agent/cap_aplog_transfer.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/zlog_agent/cap_aplog_transfer.c
index 6adba03..ea8faa5 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/zlog_agent/cap_aplog_transfer.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/zlog_agent/cap_aplog_transfer.c
@@ -34,7 +34,7 @@
/**
* Íⲿº¯ÊýÉùÃ÷
*/
-extern void send_log_out(unsigned char* buf, int len);
+extern int send_log_out(unsigned char* buf, int len);
/**
* È«¾Ö±äÁ¿¶¨Òå
@@ -136,7 +136,8 @@
if(read_Len > 0)
{
- send_log_out(gReadLogBuffer, read_Len);
+ if(send_log_out(gReadLogBuffer, read_Len) < 0)
+ sleep(3);
}
else
{
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/zlog_agent/cap_logagt_fs.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/zlog_agent/cap_logagt_fs.c
index 308567f..208d2c6 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/zlog_agent/cap_logagt_fs.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/zlog_agent/cap_logagt_fs.c
@@ -3,7 +3,7 @@
* @file cap_logagt_fs.c
* @brief
* This file is part of ZCAT.
- * Ó¦Óòãzlog_agent´¦ÀíÊý¾ÝÁ÷±£´æµ½FS
+ * ÓŠÓòãzlog_agentŽŠÀíÊýŸÝÁ÷±£ŽæµœFS
*
* @details
* @author Tools Team.
@@ -38,18 +38,16 @@
#include "cfg_api.h"
/**
- * ºê¶¨Òå
+ * ºê¶šÒå
*/
-/*CAPFS ģʽ:±£´æµ½fs£¬¹ÒÔØÂ·¾¶ºÍ¹æÔò·¾¶ÓÉÓû§ÅäÖÃ*/
+/*CAPFS ģʜ:±£Žæµœfs£¬¹ÒÔØÂ·Ÿ¶ºÍ¹æÔò·Ÿ¶ÓÉÓû§ÅäÖÃ*/
#define ZCAT_FS_SAVE_LOG_SUFFIX ".log"
-#define MAX_STRING_LENGTH (256)
-#define MAX_NVCFG_LOG_SIZE (1000)
#define MAX_CREATE_TIME_VAL (INT_MAX)
-
+#define ZCAT_FS_NO_SPACE_ERRNO (28)
#define MIN_VALUE(x, y) ((x) < (y) ? (x) : (y))
/**
- * Íⲿ±äÁ¿º¯ÊýÉùÃ÷
+ * Íⲿ±äÁ¿º¯ÊýÉùÃ÷
*/
extern BOOL bSDSet;
extern int aplog_fd;
@@ -75,24 +73,12 @@
int log_file_cnt;
}rule_struct;
-typedef struct
-{
- time_t create_time;
- char file_name[MAX_STRING_LENGTH];
-}zlog_data_t;
-
-typedef struct {
- int add_index;
- int del_index;
- zlog_data_t info[ZCAT_MAX_LOG_NUM];
-}zlog_node_t;
-
/**
- * È«¾Ö±äÁ¿¶¨Òå
+ * È«ŸÖ±äÁ¿¶šÒå
*/
pthread_t cap_heartbeat_thread = 0;
pthread_mutex_t mutex_manager;
-zlog_node_t glog_manager;
+zlog_node_t *glog_manager;
T_LOG_FS_PARA gLogSaveParam = { {0} };
char gHeartBeat_Buff[35] = {
@@ -104,8 +90,8 @@
};
/**
- * @brief ÅжÏĿ¼ÊÇ·ñ´æÔÚ£¬Èç¹û²»´æÔÚÔò´´½¨Ò»¸öеÄĿ¼
- * @param[in] dir_path Ŀ¼·¾¶
+ * @brief ÅжÏĿŒÊÇ·ñŽæÔÚ£¬Èç¹û²»ŽæÔÚÔòŽŽœšÒ»žöеÄĿŒ
+ * @param[in] dir_path ĿŒ·Ÿ¶
* @return 0 on success, -1 error.
* @note
* @see
@@ -157,8 +143,8 @@
}
/**
- * @brief ½«NVÏîÖеÄ×Ö·û´®ÀàÐÍת»»ÎªÊýÖµÀàÐÍ
- * @param[in] nvItem_str ×Ö·û´®ÀàÐÍ
+ * @brief œ«NVÏîÖеÄ×Ö·ûŽ®ÀàÐÍת»»ÎªÊýÖµÀàÐÍ
+ * @param[in] nvItem_str ×Ö·ûŽ®ÀàÐÍ
* @return[out] error: -1.
* @note
* @see
@@ -179,20 +165,42 @@
}
/**
- * @brief ³õʼ»¯sd¿¨´ælogµÄÅäÖòÎÊý
+ * @brief ³õÊŒ»¯log¹ÜÀíÐÅÏ¢
+ * @param[in] void
+ * @return[out] error: -1.
+ * @note
+ * @see
+ */
+/* Started by AICoder, pid:h47de527f6c62981445409d9c0b08e1797b1da3f */
+int init_log_manager(void)
+{
+ glog_manager = (zlog_node_t *)calloc(1, sizeof(zlog_node_t) + ZCAT_MAX_LOG_NUM * sizeof(zlog_data_t));
+
+ if (!glog_manager)
+ {
+ printf("[Error] glog_manager alloc memory fail, No memory available, errno=%d(%s)\n", errno, strerror(errno));
+ return -1;
+ }
+ return 0;
+}
+/* Ended by AICoder, pid:h47de527f6c62981445409d9c0b08e1797b1da3f */
+
+/**
+ * @brief ³õÊŒ»¯sd¿šŽælogµÄÅäÖòÎÊý
* @return void
* @note
- * zlog_agent -t total_size -n max_lognum ÍÆ¼öʹÓÃ
- * Óû§Î´Ð´Æô¶¯²ÎÊýʱ: ´ÓNV»ñȡ·¾¶ºÍÎļþ´óСÏÞÖÆ²ÎÊý
- zlog_agent : ĬÈÏÖµ(µ¥¸öZCAT_SINGLE_LOG_SIZE£¬Log¸öÊýZCAT_MAX_LOG_NUM)
+ * zlog_agent -t total_size -n max_lognum ÍÆŒöʹÓÃ
+ * Óû§ÎŽÐŽÆô¶¯²ÎÊýʱ: ŽÓNV»ñȡ·Ÿ¶ºÍÎÄŒþŽóСÏÞÖÆ²ÎÊý
+ zlog_agent : ĬÈÏÖµ(µ¥žöZCAT_SINGLE_LOG_SIZE£¬LogžöÊýZCAT_MAX_LOG_NUM)
* @see
*/
void init_cfg_param(void)
{
- int nvint_size = 0;
- int nvint_num = 0;
- int max_logNum = 0;
- UINT64 total_size = 0;
+ int nvint_size = 0;
+ int nvint_num = 0;
+ int max_logNum = 0;
+ int max_filesize = 0;
+ UINT64 total_size = 0;
char nvstr_num[MAX_NUMSIZE_STRING_LEN] = {0};
char nvstr_size[MAX_NUMSIZE_STRING_LEN] = {0};
@@ -222,28 +230,39 @@
max_logNum = gLogSaveParam.max_file_num;
total_size = gLogSaveParam.max_total_size;
- printf("[zlog-agent] max_logNum %d, total_size1 %lld\n", max_logNum, total_size);
-
+ /* Started by AICoder, pid:3bccco7155r66d21421e0847a0ebbd1c372353bc */
if (total_size && max_logNum)
{
- gLogSaveParam.max_file_size = total_size / max_logNum;
+ gLogSaveParam.max_file_size = (total_size / max_logNum) > ZCAT_SINGLE_LOG_SIZE ? ZCAT_SINGLE_LOG_SIZE : (total_size / max_logNum);
+ gLogSaveParam.max_file_num = total_size / gLogSaveParam.max_file_size;
}
else
{
gLogSaveParam.max_file_num = ZCAT_MAX_LOG_NUM;
gLogSaveParam.max_file_size = ZCAT_SINGLE_LOG_SIZE;
}
+ printf("[zlog-agent]total_size %llu MB\n", gLogSaveParam.max_total_size / ZCAT_ONE_MB_SIZE);
+ printf("[zlog-agent]max_file_size %.2f MB\n", ((float)gLogSaveParam.max_file_size) / ZCAT_ONE_MB_SIZE);
+ printf("[zlog-agent]max_file_num %d\n", gLogSaveParam.max_file_num);
+ /* Ended by AICoder, pid:3bccco7155r66d21421e0847a0ebbd1c372353bc */
+
+ /* Started by AICoder, pid:s2e33u73a3ufcaf14d7b096af0ebd50c24f9b1a2 */
+ max_filesize = gLogSaveParam.max_file_size;
+
gLogSaveParam.log_switch = TRUE;
gLogSaveParam.log_overwrite = 1;
gLogSaveParam.file_counts = 0;
gLogSaveParam.output_fd = -1;
- gLogSaveParam.free_space_limit = ZCAT_ONE_MB_SIZE;
+ gLogSaveParam.free_space_limit = max_filesize + max_filesize / 10;
+
+ printf("[zlog-agent]free_space_limit %d MB \n", ((float)gLogSaveParam.free_space_limit) / ZCAT_ONE_MB_SIZE);
+ /* Ended by AICoder, pid:s2e33u73a3ufcaf14d7b096af0ebd50c24f9b1a2 */
}
/**
- * @brief qsortÎļþ´´½¨Ê±¼äÅÅÐòº¯ÊýÖ¸ÕëʵÏÖ
- * @param[in]´ýÅÅÐòµÄÎļþ½á¹¹Ìå(¼´´´½¨Ê±¼ä)
- * @return ·µ»Ø±È½Ï½á¹û
+ * @brief qsortÎÄŒþŽŽœšÊ±ŒäÅÅÐòº¯ÊýÖžÕëʵÏÖ
+ * @param[in]ŽýÅÅÐòµÄÎÄŒþœá¹¹Ìå(ŒŽŽŽœšÊ±Œä)
+ * @return ·µ»Ø±ÈœÏœá¹û
* @note
* @see
*/
@@ -263,9 +282,9 @@
}
/**
- * @brief ½«logÎļþÃûÖеÄʱ¼ä×Ö·û´®×ª»»ÎªUnixʱ¼ä´Á
- * @param[in]ÎļþÃû
- * @return Unixʱ¼ä´Á
+ * @brief œ«logÎÄŒþÃûÖеÄʱŒä×Ö·ûŽ®×ª»»ÎªUnixʱŒäŽÁ
+ * @param[in]ÎÄŒþÃû
+ * @return UnixʱŒäŽÁ
* @note
* @see
*/
@@ -275,23 +294,23 @@
struct tm timeinfo;
time_t timestamp;
- // ÌáÈ¡ÈÕÆÚºÍʱ¼ä
+ // ÌáÈ¡ÈÕÆÚºÍʱŒä
strncpy(date_time, &file_name[0], 16);
date_time[16] = '\0';
- // ½«×Ö·û´®¸ñʽµÄÈÕÆÚºÍʱ¼äת»»Îªstruct tmÀàÐÍ
+ // œ«×Ö·ûŽ®žñÊœµÄÈÕÆÚºÍʱŒäת»»Îªstruct tmÀàÐÍ
strptime(date_time, "%Y_%m%d_%H%M%S", &timeinfo);
- // ½«struct tmÀàÐÍת»»Îªtime_tÀàÐÍ
+ // œ«struct tmÀàÐÍת»»Îªtime_tÀàÐÍ
timestamp = mktime(&timeinfo);
return timestamp;
}
/**
- * @brief ¶ÔÎļþĿ¼ÖеÄlogÎļþ½øÐнâÎö
- * @param[in]´ýÅÅÐòµÄÎļþ·¾¶
- * @return ·µ»ØÎļþ¸öÊý
+ * @brief ¶ÔÎÄŒþĿŒÖеÄlogÎÄŒþœøÐМâÎö
+ * @param[in]ŽýÅÅÐòµÄÎÄŒþ·Ÿ¶
+ * @return ·µ»ØÎÄŒþžöÊý
* @note
* @see
*/
@@ -324,11 +343,13 @@
memset((void *)file_name, 0, MAX_STRING_LENGTH);
pthread_mutex_lock(&mutex_manager);
- memset(&glog_manager, 0, sizeof(zlog_node_t));
+
+ /* Started by AICoder, pid:fb0efu7dbc73d3a1485d0864f0423e4f8651d557 */
+ memset(glog_manager, 0, sizeof(zlog_node_t) + ZCAT_MAX_LOG_NUM * sizeof(zlog_data_t));
for (; index < ZCAT_MAX_LOG_NUM; index++)
{
- glog_manager.info[index].create_time = MAX_CREATE_TIME_VAL;
+ glog_manager->info[index].create_time = MAX_CREATE_TIME_VAL;
}
index = 0;
@@ -346,31 +367,35 @@
creatime_real = zLogAgt_FileNameToTimeStamp(p_entry->d_name);
if (index < ZCAT_MAX_LOG_NUM)
{
- glog_manager.info[index].create_time = creatime_real;
- strncpy(&glog_manager.info[index].file_name, file_name, MAX_STRING_LENGTH - 1);
+ glog_manager->info[index].create_time = creatime_real;
+ strncpy(&glog_manager->info[index].file_name, file_name, MAX_STRING_LENGTH - 1);
index++;
}
}
- array_size = sizeof(glog_manager.info) / sizeof(glog_manager.info[0]);
- qsort(glog_manager.info, array_size, sizeof(glog_manager.info[0]), zLogAgt_QsortCompareFunc);
+ array_size = ZCAT_MAX_LOG_NUM;
+ qsort(glog_manager->info, array_size, sizeof(glog_manager->info[0]), zLogAgt_QsortCompareFunc);
- closedir(p_dir);
+ if (closedir(p_dir) < 0)
+ {
+ printf("[Error] Failed to close directory, errno=%d(%s)\n", errno, strerror(errno));
+ }
- glog_manager.del_index = 0;
- glog_manager.add_index = file_num;
- if (glog_manager.add_index >= ZCAT_MAX_LOG_NUM)
- glog_manager.add_index = 0;
-
+ glog_manager->del_index = 0;
+ glog_manager->add_index = file_num;
+ if (glog_manager->add_index >= ZCAT_MAX_LOG_NUM)
+ glog_manager->add_index = 0;
+ /* Ended by AICoder, pid:fb0efu7dbc73d3a1485d0864f0423e4f8651d557 */
+
pthread_mutex_unlock(&mutex_manager);
free(file_name);
return file_num;
}
/**
- * @brief ɾ³ýĿ¼ÏÂÔçÆÚ´´½¨µÄÎļþ\n
- * ¸ù¾ÝÎļþÃûÅжϴ´½¨Ê±¼ä£¬É¾³ý×îÏÈ´´½¨µÄÄǸöÎļþ
- * @param[in] dir_path ÎÄĿ¼·¾¶
+ * @brief ÉŸ³ýĿŒÏÂÔçÆÚŽŽœšµÄÎÄŒþ\n
+ * žùŸÝÎÄŒþÃûÅÐ¶ÏŽŽœšÊ±Œä£¬ÉŸ³ý×îÏÈŽŽœšµÄÄÇžöÎÄŒþ
+ * @param[in] dir_path ÎÄĿŒ·Ÿ¶
* @return void
* @note
* @see
@@ -384,32 +409,33 @@
pthread_mutex_lock(&mutex_manager);
- index = glog_manager.del_index;
- if (glog_manager.info[index].file_name[0] != '\0')
+ /* Started by AICoder, pid:0bdcfx652ejcd9614b060a34b0f72b1bb2739d79 */
+ index = glog_manager->del_index;
+ if (glog_manager->info[index].file_name[0] != '\0')
{
- if (remove(glog_manager.info[index].file_name) != 0)
- {
- printf("[zlog-agent] remove index=%d time=%ld name:%s fail! errno=%d(%s)\n", index, glog_manager.info[index].create_time, glog_manager.info[index].file_name, errno, strerror(errno));
- }
- else
- printf("[zlog-agent] remove index=%d time=%ld name:%s success\n", index, glog_manager.info[index].create_time, glog_manager.info[index].file_name);
+ if (remove(glog_manager->info[index].file_name) == 0)
+ printf("[zlog-agent] remove index=%d time=%ld name:%s success\n", index, glog_manager->info[index].create_time, glog_manager->info[index].file_name);
+ else
+ printf("[zlog-agent] remove index=%d time=%ld name:%s fail! errno=%d(%s)\n", index, glog_manager->info[index].create_time, glog_manager->info[index].file_name, errno, strerror(errno));
+ }
+ else
+ {
+ printf("[zlog-agent] remove index=%d time=%ld name is 0!\n", index, glog_manager->info[index].create_time);
}
- else
- printf("[zlog-agent] remove index=%d time=%ld name is 0!\n", index, glog_manager.info[index].create_time);
- glog_manager.del_index++;
- if (glog_manager.del_index == ZCAT_MAX_LOG_NUM)
- glog_manager.del_index = 0;
+ // žüÐÂÑ»·Ë÷Òý
+ glog_manager->del_index = (glog_manager->del_index + 1) % ZCAT_MAX_LOG_NUM;
+ /* Ended by AICoder, pid:0bdcfx652ejcd9614b060a34b0f72b1bb2739d79 */
pthread_mutex_unlock(&mutex_manager);
}
/**
- * @brief ÔÚdir_pathĿ¼Ï´ò¿ªlogÊä³öÎļþ²¢·µ»ØÎļþ¾ä±ú,\n
- * ÒÔµ±Ç°Ê±¼äΪÎļþÃû£¬´´½¨logÊä³öÎļþ¡£
- * Èôµ±Ç°ÎļþÊýÒÑ´ïÉÏÏÞ£¬É¾³ý×îÏÈ´´½¨µÄÎļþ,ÔÙÒÔµ±Ç°Ê±¼äΪÎļþÃû´´½¨Îļþ
- * @param[in] logParam Log´æfs²ÎÊý
- * @return ´ò¿ªµÄlogÎļþÃèÊö·û
+ * @brief ÔÚdir_pathĿŒÏÂŽò¿ªlogÊä³öÎÄŒþ²¢·µ»ØÎÄŒþŸä±ú,\n
+ * ÒÔµ±Ç°Ê±ŒäΪÎÄŒþÃû£¬ŽŽœšlogÊä³öÎÄŒþ¡£
+ * Èôµ±Ç°ÎÄŒþÊýÒÑŽïÉÏÏÞ£¬ÉŸ³ý×îÏÈŽŽœšµÄÎÄŒþ,ÔÙÒÔµ±Ç°Ê±ŒäΪÎÄŒþÃûŽŽœšÎÄŒþ
+ * @param[in] logParam LogŽæfs²ÎÊý
+ * @return Žò¿ªµÄlogÎÄŒþÃèÊö·û
* @note
* @see
*/
@@ -453,9 +479,12 @@
/*We Can print the reason when the earliest logfile is deleted*/
if (flcnt_limit || space_limit)
{
- zLogAgt_DelFile();
- logParam->file_counts--;
- printf("[zlog-agent] Delete the earliest log: filenum limit %d, space limit %d, file_num is %d\n", flcnt_limit, space_limit, logParam->file_counts);
+ if(logParam->file_counts > 1)
+ {
+ zLogAgt_DelFile();
+ logParam->file_counts--;
+ printf("[zlog-agent] Delete the earliest log: filenum limit %d, space limit %d, file_num is %d\n", flcnt_limit, space_limit, logParam->file_counts);
+ }
}
}
@@ -467,7 +496,8 @@
}
else
{
- printf("[zlog-agent] openfile error info: %s\n", strerror(errno));
+ logParam->file_counts--;
+ printf("[zlog-agent] openfile error info: %s, file_counts %d \n", strerror(errno), logParam->file_counts);
return -1;
}
strncpy(logParam->log_name, file_name, MAX_STRING_LENGTH - 1);
@@ -475,21 +505,72 @@
creatime_real = zLogAgt_FileNameToTimeStamp(file_temp);
pthread_mutex_lock(&mutex_manager);
- index = glog_manager.add_index;
+ index = glog_manager->add_index;
assert(index < ZCAT_MAX_LOG_NUM);
- glog_manager.info[index].create_time = creatime_real;
- strncpy(&glog_manager.info[index].file_name, file_name, MAX_STRING_LENGTH - 1);
+ glog_manager->info[index].create_time = creatime_real;
+ strncpy(&glog_manager->info[index].file_name, file_name, MAX_STRING_LENGTH - 1);
- glog_manager.add_index++;
- if (glog_manager.add_index >= ZCAT_MAX_LOG_NUM)
- glog_manager.add_index = 0;
+ glog_manager->add_index++;
+ if (glog_manager->add_index >= ZCAT_MAX_LOG_NUM)
+ glog_manager->add_index = 0;
pthread_mutex_unlock(&mutex_manager);
return fd;
}
/**
- * @brief ³õʼ»¯logµÄ¸öÊý
+ * @brief ÔÚdir_pathĿ¼ÏÂÖмì²éÊ£Óà¿Õ¼ä\n
+ * @param[in] logdir_path Log´æ´¢Â·¾¶
+ * @return ´ò¿ªµÄlogÎļþÃèÊö·û
+ * @note
+ * @see
+ */
+/* Started by AICoder, pid:q9ab1febcdt6b781414c0b6970ec0c547aa2aca8 */
+int zLogAgt_CheckFreeSpace(char *logdir_path)
+{
+ UINT32 file_cnt = 0;
+ struct statfs diskInfo;
+ BOOL space_limit = FALSE;
+ double free_space_MB = 0;
+ double limit_space_MB = 0;
+ double file_size_MB = 0;
+ T_LOG_FS_PARA *msg_para = &gLogSaveParam;
+
+ if (!logdir_path)
+ {
+ printf("[zlog-agent] logdir is NULL, return\n");
+ return -1;
+ }
+ if (statfs(msg_para->log_dir, &diskInfo) == -1)
+ {
+ perror("[zlog-agent] Failed to get disk info\n");
+ return -1;
+ }
+
+ space_limit = (diskInfo.f_bfree * diskInfo.f_bsize) < msg_para->free_space_limit;
+
+ free_space_MB = (double)(diskInfo.f_bfree * diskInfo.f_bsize) / ZCAT_ONE_MB_SIZE;
+ file_size_MB = (double)(msg_para->max_file_size) / ZCAT_ONE_MB_SIZE;
+ limit_space_MB = (double)(msg_para->free_space_limit) / ZCAT_ONE_MB_SIZE;
+
+ printf("[zlog-agent] CheckFreeSpace zlog_size/zlog_num=One file size is %.2f M, zlog_path %s free space is %.2f M, space_limit %.2f M!\n",
+ file_size_MB, msg_para->log_dir, free_space_MB, limit_space_MB);
+
+ if(!space_limit)
+ return 0;
+
+ if(msg_para->file_counts == 0)
+ {
+ printf("[zlog-agent]Not enough to save one file : Please change filesize using zlog_nvctrl -t size -n lognum, or change zlog_path which space bigger than %.2f M!!!\n",
+ file_size_MB);
+ return -1;
+ }
+ return 0;
+}
+/* Ended by AICoder, pid:q9ab1febcdt6b781414c0b6970ec0c547aa2aca8 */
+
+/**
+ * @brief ³õÊŒ»¯logµÄžöÊý
* @param[in] n/a
* @return 0 on success, errno otherwise
* @note
@@ -534,7 +615,7 @@
close(output_fd);
}
- /*´ò¿ªÈÕÖ¾Îļþ*/
+ /*Žò¿ªÈÕÖŸÎÄŒþ*/
output_fd = open_log_file(&gLogSaveParam);
gLogSaveParam.output_fd = output_fd;
gLogSaveParam.file_size = 0;
@@ -567,11 +648,11 @@
}
/**
- * @brief ÉèÖÃlogµÄĿ¼
+ * @brief ÉèÖÃlogµÄĿŒ
* @param[in] n/a
* @return 0 on success, errno otherwise
- * @note CAPFS ģʽ:LogĬÈÏ·¾¶ /mnt/userdata/zcat
- * ĬÈϹæÔòÎļþ /mnt/userdata/all_3.rule
+ * @note CAPFS ģʜ:LogĬÈÏ·Ÿ¶ /mnt/userdata/zcat
+ * ĬÈϹæÔòÎÄŒþ /mnt/userdata/all_3.rule
* @see
*/
int zLogAgt_SetFsLogDir(char *log_path_arg)
@@ -581,7 +662,7 @@
if (log_path_arg)
{
- /*ÅжÏ·¾¶ÊÇ·ñ¿ÉÓÃ*/
+ /*ÅжÏ·Ÿ¶ÊÇ·ñ¿ÉÓÃ*/
if (access(log_path_arg, R_OK|W_OK) < 0 && test_dir_exist(log_path_arg) < 0)
{
printf("[zlog-agent]Fs path error, errno=%d\n", errno);
@@ -613,11 +694,11 @@
/**
- * @brief ³õʼ»¯logµÄĿ¼
+ * @brief ³õÊŒ»¯logµÄĿŒ
* @param[in] n/a
* @return 0 on success, errno otherwise
- * @note CAPFS ģʽ:LogĬÈÏ·¾¶ /mnt/userdata/zcat
- * ĬÈϹæÔòÎļþ /mnt/userdata/all_3.rule
+ * @note CAPFS ģʜ:LogĬÈÏ·Ÿ¶ /mnt/userdata/zcat
+ * ĬÈϹæÔòÎÄŒþ /mnt/userdata/all_3.rule
* @see
*/
int init_fs_log_dir(void)
@@ -664,8 +745,11 @@
sleep(3);
}
else
- {
- break;
+ {
+ if(zLogAgt_CheckFreeSpace(dstlog_path) < 0)
+ sleep(3);
+ else
+ break;
}
}
@@ -681,7 +765,7 @@
close(output_fd);
}
- /*´ò¿ªÈÕÖ¾Îļþ*/
+ /*Žò¿ªÈÕÖŸÎÄŒþ*/
output_fd = open_log_file(&gLogSaveParam);
if (output_fd == -1)
{
@@ -694,10 +778,10 @@
}
/**
- * @brief bufferÄÚÈÝдÈëµ½Îļþϵͳ·¾¶ÖÐ
- * @param[in] buffer ´ýдÈëÊý¾ÝÖ¸Õë
- * @param[in] buffer_len ´ýдÈëÊý¾Ý³¤¶È
- * @return ʵ¼ÊдÈëµÄ³¤¶È
+ * @brief bufferÄÚÈÝÐŽÈ뵜ÎÄŒþϵͳ·Ÿ¶ÖÐ
+ * @param[in] buffer ŽýÐŽÈëÊýŸÝÖžÕë
+ * @param[in] buffer_len ŽýÐŽÈëÊýŸÝ³€¶È
+ * @return ʵŒÊÐŽÈëµÄ³€¶È
* @note
* @see
*/
@@ -712,7 +796,7 @@
msg_para->file_size += len;
- /* Èç¹ûÎļþ´óС´ïµ½×î´óÎļþ³ß´ç£¬Ôòн¨Ò»¸öÎļþ*/
+ /* Èç¹ûÎÄŒþŽóСŽïµœ×îŽóÎÄŒþ³ßŽç£¬ÔòМšÒ»žöÎÄŒþ*/
if (msg_para->file_size > msg_para->max_file_size)
{
fsync(output_fd);
@@ -727,21 +811,33 @@
msg_para->output_fd = output_fd;
msg_para->file_size = len;
}
+ /* Started by AICoder, pid:58487hcf1e9fc11143dd0a58805f1d18c369f013 */
+ errno = 0;
write_len = full_write(output_fd, buf, len);
if(write_len != len)
{
+ msg_para->file_size -= len;
printf("[zlog-agent] write error, len=%d != %d!, errno=%d(%s)\n", write_len, len, errno, strerror(errno));
+ if((errno == ZCAT_FS_NO_SPACE_ERRNO)
+ && (msg_para->file_counts >= 1))
+ {
+ zLogAgt_DelFile();
+ msg_para->file_counts--;
+ printf("[zlog-agent] Write error, delete the earliest log: file_num is %d\n", msg_para->file_counts);
+ }
return -1;
}
- return write_len;
+ /* Ended by AICoder, pid:58487hcf1e9fc11143dd0a58805f1d18c369f013 */
+
+ return write_len;
}
/**
- * @brief ·¢Ë͹æÔòÎļþµ½cp.\n
- * @param[in] fd ¹æÔòÎļþÃèÊö·û
- * @param[in] offset ÎļþÆ«ÒÆ
- * @param[in] length ·¢ËÍÊý¾Ý³¤¶È
+ * @brief ·¢Ë͹æÔòÎÄŒþµœcp.\n
+ * @param[in] fd ¹æÔòÎÄŒþÃèÊö·û
+ * @param[in] offset ÎÄŒþÆ«ÒÆ
+ * @param[in] length ·¢ËÍÊýŸÝ³€¶È
* @return 0 on success, -1 otherwise
* @note
* @see
@@ -789,10 +885,10 @@
}
/**
- * @brief ¼ì¹æÔòÎļþºÏ·¨ÐÔ£¬¶ÁȡժҪÐÅÏ¢.\n
- * @param[in] fd ¹æÔòÎļþÃèÊö·û
- * @param[out] rule_info ¹æÔòÎļþ¸ÅÒªÐÅÏ¢
- * @return ¹æÔòÎļþµÄ´óС
+ * @brief Œì¹æÔòÎÄŒþºÏ·šÐÔ£¬¶ÁȡժҪÐÅÏ¢.\n
+ * @param[in] fd ¹æÔòÎÄŒþÃèÊö·û
+ * @param[out] rule_info ¹æÔòÎÄŒþžÅÒªÐÅÏ¢
+ * @return ¹æÔòÎÄŒþµÄŽóС
* @note
* @see
*/
@@ -819,7 +915,7 @@
return -1;
}
- /* ¶ÁÈ¡¹æÔòÎļþÖеÄÐÄÌø°üÊý¾Ý£¬Ì滻ĬÈÏÐÄÌøÊý¾Ý */
+ /* ¶ÁÈ¡¹æÔòÎÄŒþÖеÄÐÄÌø°üÊýŸÝ£¬Ì滻ĬÈÏÐÄÌøÊýŸÝ */
if(lseek(fd, rule_info->heartbeat_pos, SEEK_SET) == -1)
{
printf("[zlog-agent] check_rule, lseek to heartbeat_pos error.\n");
@@ -835,9 +931,9 @@
}
/**
- * @brief ¹æÔòºÍÐÄÌø·¢ËÍỊ̈߳¬\n
- * ¶ÁÈ¡¹æÔòÎļþ·¢Ë͸ø°å²à£¬ÖÜÆÚÐԵķ¢ËÍÐÄÌø.
- * @param[in] arg ÎļþÃèÊö·û
+ * @brief ¹æÔòºÍÐÄÌø·¢ËÍỊ̈߳¬\n
+ * ¶ÁÈ¡¹æÔòÎÄŒþ·¢ËÍžø°å²à£¬ÖÜÆÚÐԵķ¢ËÍÐÄÌø.
+ * @param[in] arg ÎÄŒþÃèÊö·û
* @return void
* @note
* @see
@@ -856,7 +952,7 @@
return -1;
}
- /*¼ì²é¹æÔòÎļþºÏ·¨ÐÔ*/
+ /*Œì²é¹æÔòÎÄŒþºÏ·šÐÔ*/
rule_len = get_rule_data(rule_fd, &rule_info);
if(rule_len <= 0)
{
@@ -867,7 +963,7 @@
ioctl(aplog_fd, ZCAP_IOCTL_RULE_START, 0);
- /*·¢ËÍcp¹æÔò*/
+ /*·¢ËÍcp¹æÔò*/
ret = send_rules_to_ap(rule_fd, rule_info.rule_pos, rule_info.rule_len);
if (ret < 0)
{
@@ -879,7 +975,7 @@
rule_info.rule_len,
rule_info.rule_pos);
- /*·¢ËÍap¹æÔò*/
+ /*·¢ËÍap¹æÔò*/
send_rules_to_ap(rule_fd, rule_info.ap_rule_pos, rule_info.ap_rule_len);
printf("[zlog-agent] send rules to ap %d bytes, position %d\n",
rule_info.ap_rule_len,
@@ -892,9 +988,9 @@
}
/**
- * @brief ¹æÔòºÍÐÄÌø·¢ËÍỊ̈߳¬\n
- * ¶ÁÈ¡EMMCÖеĹæÔòÎļþ·¢Ë͸øpc£¬ÖÜÆÚÐԵķ¢ËÍÐÄÌø.
- * @param[in] arg ÎļþÃèÊö·û
+ * @brief ¹æÔòºÍÐÄÌø·¢ËÍỊ̈߳¬\n
+ * ¶ÁÈ¡EMMCÖеĹæÔòÎÄŒþ·¢ËÍžøpc£¬ÖÜÆÚÐԵķ¢ËÍÐÄÌø.
+ * @param[in] arg ÎÄŒþÃèÊö·û
* @return void
* @note
* @see
@@ -929,7 +1025,7 @@
}
/**
- * @brief ³õʼ»¯FSģʽ£¬´´½¨¹æÔòºÍÐÄÌø·¢ËÍÏß³Ì.
+ * @brief ³õÊŒ»¯FSģʜ£¬ŽŽœš¹æÔòºÍÐÄÌø·¢ËÍÏß³Ì.
* @param[in] void
* @return 0 on success, errno otherwise
* @note
@@ -941,6 +1037,10 @@
init_cfg_param();
+ ret = init_log_manager();
+ if(ret < 0)
+ return ret;
+
ret = pthread_create(&cap_heartbeat_thread, NULL, (void*)rule_heartbeat_entry, NULL);
if(ret < 0)
{
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/zlog_agent/cap_logagt_main.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/zlog_agent/cap_logagt_main.c
index 7dd8185..ee27e82 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/zlog_agent/cap_logagt_main.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/zlog_agent/cap_logagt_main.c
@@ -203,6 +203,22 @@
return 0;
}
+/* Started by AICoder, pid:d5f1dycf32bb1511456009e2e079d633b8a81051 */
+void zLogAgt_saveConfig(int fileNum, unsigned long long totalSize)
+{
+ char nvstr_num[MAX_STRING_LENGTH] = {0};
+ char nvstr_size[MAX_STRING_LENGTH] = {0};
+
+ snprintf(nvstr_num, MAX_STRING_LENGTH - 1, "%d", fileNum);
+ snprintf(nvstr_size, MAX_STRING_LENGTH - 1, "%llu", totalSize / ZCAT_ONE_MB_SIZE);
+
+ printf("[zlog-agent]nvstr_num %s, nvstr_size %s, max_file_size %.2f M\n", nvstr_num, nvstr_size, (float)(gLogSaveParam.max_file_size)/ZCAT_ONE_MB_SIZE);
+ sc_cfg_set("zlog_num", nvstr_num);
+ sc_cfg_set("zlog_size", nvstr_size);
+ sc_cfg_save();
+}
+/* Ended by AICoder, pid:d5f1dycf32bb1511456009e2e079d633b8a81051 */
+
/**
* @brief ÊÕµ½µÄÏûÏ¢´¦ÀíÁ÷³Ì
* @param[in] stMsg ÏûÏ¢ÌåÄÚÈÝ
@@ -214,11 +230,7 @@
{
int retval = 0;
T_LOG_USER_CMD_MSG *msgdata;
-
- char nvstr_num[MAX_NUMSIZE_STRING_LEN] = {0};
- char nvstr_size[MAX_NUMSIZE_STRING_LEN] = {0};
- int char_len = MAX_NUMSIZE_STRING_LEN - 1;
- char dstlog_path[MAX_STRING_LENGTH] = {0};
+ UINT64 max_file_size = 0;
if (!stMsg || !(stMsg->aucDataBuf))
{
@@ -237,19 +249,30 @@
zLogAgt_SetzCatMode(msgdata->zcat_mode);
}
+ if(g_log_dir != ZCAT_MODE_CAP_FS)
+ {
+ printf("[zlog-agent]Now zat_mode is 0x%x ! zlog_size/zlog_num/zlog_path/rule_file only can be changed when zat_mode is 0x%x:APFS.\n", g_log_dir, ZCAT_MODE_CAP_FS);
+ return 0;
+ }
+
/*¶Ôlog´óСºÍ¸öÊý½øÐÐÐÞ¸Ä*/
if ((msgdata->max_file_num > 0)
&& (msgdata->max_total_size > 0))
{
- gLogSaveParam.max_file_num = msgdata->max_file_num;
+ /* Started by AICoder, pid:0bba1w3f40b217b14ad60a5c705e8439df929952 */
+ max_file_size = msgdata->max_total_size / msgdata->max_file_num;
+ gLogSaveParam.max_file_size = max_file_size > ZCAT_SINGLE_LOG_SIZE ? ZCAT_SINGLE_LOG_SIZE: max_file_size;
+ gLogSaveParam.max_file_num = msgdata->max_total_size / gLogSaveParam.max_file_size;
gLogSaveParam.max_total_size = msgdata->max_total_size;
- gLogSaveParam.max_file_size = (msgdata->max_total_size) / (msgdata->max_file_num);
- snprintf(nvstr_num, char_len, "%d", msgdata->max_file_num);
- snprintf(nvstr_size, char_len, "%llu", msgdata->max_total_size / ZCAT_ONE_MB_SIZE);
- sc_cfg_set("zlog_num", nvstr_num);
- sc_cfg_set("zlog_size",nvstr_size);
- sc_cfg_save();
- zLogAgt_AdjustFileCounts(gLogSaveParam.log_dir);
+ gLogSaveParam.free_space_limit = gLogSaveParam.max_file_size + (gLogSaveParam.max_file_size) / 10;
+
+ // ±£´æÅäÖõ½NV²ÎÊý
+ zLogAgt_saveConfig(gLogSaveParam.max_file_num, gLogSaveParam.max_total_size);
+
+ /*½âÎölog dirÖеÄÎļþ£¬µ÷Õû¸öÊý*/
+ zLogAgt_AdjustFileCounts(gLogSaveParam.log_dir);
+ zLogAgt_CheckFreeSpace(gLogSaveParam.log_dir);
+ /* Ended by AICoder, pid:0bba1w3f40b217b14ad60a5c705e8439df929952 */
}
/*ÐÞ¸Älog·¾¶*/
if(strlen(msgdata->log_dir))
@@ -257,7 +280,8 @@
zLogAgt_CloseLogFile();
pthread_mutex_lock(&mutex_fs);
zLogAgt_SetFsLogDir(msgdata->log_dir);
- zLogAgt_AdjustFileCounts(msgdata->log_dir);
+ zLogAgt_AdjustFileCounts(msgdata->log_dir);
+ zLogAgt_CheckFreeSpace(msgdata->log_dir);
pthread_mutex_unlock(&mutex_fs);
if (gLogSaveParam.log_switch)
zLogAgt_OpenLogFile();
@@ -356,6 +380,8 @@
if(g_wakefd >= 0)
close(g_wakefd);
+ free(glog_manager);
+
printf("[zlog-agent] log_agent exit.\n");
}
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/zlog_agent/cap_logagt_tool.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/zlog_agent/cap_logagt_tool.c
index 988072b..031cc88 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/zlog_agent/cap_logagt_tool.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/zlog_agent/cap_logagt_tool.c
@@ -146,17 +146,21 @@
* @note
* @see
*/
-void send_log_out(unsigned char* buf, int len)
+/* Started by AICoder, pid:374366406fb1532145910bcb2009b142ff932bf2 */
+int send_log_out(unsigned char* buf, int len)
{
+ int ret = 0;
+
if(!gLogSaveParam.log_switch)
{
- return;
+ printf("[zcat] log is OFF: gLogSaveParam.log_switch %d.\n", gLogSaveParam.log_switch);
+ return -1;
}
if(g_log_state != ZCAT_STATE_RUNNING)
{
printf("[zcat] send_log_out fail, state = %d.\n", g_log_state);
- return;
+ return -1;
}
if(g_log_dir == ZCAT_MODE_CAP_NET)
@@ -171,19 +175,21 @@
if(init_fs_log_dir() < 0) //³õʼ»¯cpÊä³öÎļþ¼Ð¼°²ÎÊý
{
bSDSet = FALSE;
- return;
+ return -1;
}
hb_flag = 1;
- return;
+ return 0;
}
if(bSDSet == TRUE)
{
pthread_mutex_lock(&mutex_fs);
- send_message_to_fs(buf, len);
+ ret = send_message_to_fs(buf, len);
pthread_mutex_unlock(&mutex_fs);
}
}
+ return ret;
}
+/* Ended by AICoder, pid:374366406fb1532145910bcb2009b142ff932bf2 */
/**
* @brief ½«ap²àprintf¡¢printk²úÉúµÄlogÊý¾Ý·¢ËͳöÈ¥
@@ -422,4 +428,4 @@
}
-
\ No newline at end of file
+
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/zlog_agent/cap_loginfo.h b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/zlog_agent/cap_loginfo.h
index 3142620..0431f27 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/zlog_agent/cap_loginfo.h
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/zlog_agent/cap_loginfo.h
@@ -75,19 +75,18 @@
#define DIR_LOG_USB_VALUE (0x03)
#define DIR_LOG_USB_AP_VALUE (0x04)
-#define ZCAT_MAX_LOG_NUM (10)
-#define ZCAT_MAX_CFG_TOTAL_SIZE (0x100000)
+#define ZCAT_MAX_LOG_NUM (1000)
#define ZCAT_RULE_MAX_SIZE (2048)
#define ZCAT_ONE_MB_SIZE (1024*1024)
-#define ZCAT_SINGLE_LOG_SIZE (100*1024*1024)
-#define ZCAT_FILE_NAME_SIZE (64)
+#define ZCAT_SINGLE_LOG_SIZE (512*1024*1024)
#define ZCAT_MODE_STR_LEN (16)
#define ZCAT_FS_ROOT_PATH "/"
#define ZCAT_PATH_DOUBLE_SLASHS "//"
#define MAX_NUMSIZE_STRING_LEN (16)
-#define MAX_STRING_LENGTH (256)
-#define MAX_FILE_NAME_LEN (128)
+#define MAX_STRING_LENGTH (192)
+#define MAX_FILE_NAME_LEN (64)
+#define MAX_NVCFG_LOG_SIZE (512*1000) /*500G*/
#define ZCAP_IOCTL_TYPE 'T'
#define ZCAP_IOCTL_RULE_START _IO(ZCAP_IOCTL_TYPE, 0)
@@ -302,11 +301,25 @@
UINT64 max_total_size;
}T_LOG_USER_CMD_MSG;
+typedef struct
+{
+ time_t create_time;
+ char file_name[MAX_STRING_LENGTH];
+}zlog_data_t;
+
+typedef struct {
+ int add_index;
+ int del_index;
+ zlog_data_t info[];
+}zlog_node_t;
+
/********************************************
* extern variables and function declarations
********************************************/
extern T_LOG_FS_PARA gLogSaveParam;
extern pthread_mutex_t mutex_fs;
+extern zlog_node_t *glog_manager;
+
extern int init_fs_log_dir(void);
extern void init_cfg_param(void);
#endif /* CAP_LOGINFO_H_ */
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/zlog_agent/cap_nvctrl_main.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/zlog_agent/cap_nvctrl_main.c
index eef97dd..8dcb62c 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/zlog_agent/cap_nvctrl_main.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/zlog_agent/cap_nvctrl_main.c
@@ -219,7 +219,7 @@
if (cmd_msg->max_file_num > ZCAT_MAX_LOG_NUM)
{
- printf("[zlog-nvctrl] -t error: please set log num smaller than or equal to %d !\n", ZCAT_MAX_LOG_NUM);
+ printf("[zlog-nvctrl] -n error: please set log num smaller than or equal to %d !\n", ZCAT_MAX_LOG_NUM);
return -1;
}
}
@@ -232,13 +232,14 @@
{
tsize_val = atoi(optarg);
if ((0 < tsize_val)
- && (tsize_val <= ZCAT_MAX_CFG_TOTAL_SIZE))
+ && (tsize_val <= MAX_NVCFG_LOG_SIZE))
{
- cmd_msg->max_total_size = tsize_val * ZCAT_ONE_MB_SIZE;
+ cmd_msg->max_total_size = (UINT64)tsize_val * ZCAT_ONE_MB_SIZE;
+ printf("[zlog-nvctrl] max_total_size %llu \n", cmd_msg->max_total_size);
}
else
{
- printf("[zlog-nvctrl] -t error: total log size should be smaller than %d !", ZCAT_MAX_CFG_TOTAL_SIZE);
+ printf("[zlog-nvctrl] -t error: total log size should be smaller than %d !", MAX_NVCFG_LOG_SIZE);
return -1;
}
}
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 c1ce4cd..c07abe1 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
@@ -6,14 +6,21 @@
#include <fcntl.h>
#include <sys/stat.h>
#include <time.h>
-//#include <pthread.h>
-
+#include <stdbool.h>
#include "cfg_api.h"
#include "pub_debug_info.h"
+#include <signal.h>
/*******************************************************************************
* 宏定义 *
*******************************************************************************/
+#ifndef PATH_MAX
+#define PATH_MAX 255
+#endif
+#define DEBUG_INFO_FS_ROOT_PATH "/"
+#define DEBUG_INFO_PATH_DOUBLE_SLASHS "//"
+#define DEBUG_INFO_STRING_MAX_LEN (256)
+
#define DEBUG_INFO_FILE1_NAME ("1.log")
#define DEBUG_INFO_FILE2_NAME ("2.log")
#define DEBUG_INFO_TAB_FILE_NAME ("debug_tab.txt")
@@ -22,17 +29,16 @@
#define DEBUG_INFO_FILE_NUM_MAX (10)
#define DEBUG_INFO_FILE_NUM_MIN (2)
#define DEBUG_INFO_FILE_NUM (2)
-#define DEBUG_INFO_READ_BUFFFER_SIZE (9 * 1024)
+#define DEBUG_INFO_CORE_NUM (2)
+#define DEBUG_INFO_READ_BUFFER_SIZE (76 * 1024) //64+8
#define DEBUG_INFO_FOLDER_PATH_LENGTH_MAX (256)
#define DEBUG_INFO_FILE_PATH_LENGTH_MAX (320)
#define DEBUG_INFO_TAB_SIZE (16)
#define DEBUG_INFO_MAGIC (0x7E8118E7U)
-
-#define DEBUG_INFO_DISABLE ("DEBUG_INFO_DISABLE")
+#define DEBUG_READ_NOBLOCK (11)
#define DEBUG_INFO_FILE_PATH_NAME ("DEBUG_INFO_FILE_PATH")
#define DEBUG_INFO_FILE_NUM_NAME ("DEBUG_INFO_FILE_NUM")
#define DEBUG_INFO_FILE_TOTAL_SIZE_NAME ("DEBUG_INFO_FILE_TOTAL_SIZE")
-#define DEBUG_INFO_IOCTL_SET_DISABLE (0x1001)
/*******************************************************************************
* 全局变量定义 *
@@ -41,27 +47,34 @@
static int g_file_size_total = DEBUG_INFO_DEFAULT_TOTAL_FILE_SIZE;
static int g_file_size_single = DEBUG_INFO_DEFAULT_TOTAL_FILE_SIZE / DEBUG_INFO_FILE_NUM;
static char g_folder_path[DEBUG_INFO_FOLDER_PATH_LENGTH_MAX] = {0};
-static char g_save_file_path[DEBUG_INFO_FILE_NUM_MAX][DEBUG_INFO_FILE_PATH_LENGTH_MAX];
static char g_tab_file_path[DEBUG_INFO_FILE_PATH_LENGTH_MAX] = {0};
+static char *g_read_buf = NULL;
/*******************************************************************************
* 结构体定义 *
*******************************************************************************/
typedef struct
{
- unsigned int magic; /* 数据有效性魔术字 */
- unsigned int file_id; /* 1:第一个文件 2:第二个文件...*/
- unsigned int index; /* 存入文件后当前的游标位置*/
- unsigned int magic2; /* 数据有效性魔术字 */
+ unsigned int magic; /* 数据有效性魔术字 */
+ unsigned int file_id[DEBUG_INFO_CORE_NUM]; /* ap log 1:第一个文件 2:第二个文件...*/
+ unsigned int index[DEBUG_INFO_CORE_NUM]; /* ap log 存入文件后当前的游标位置*/
+ unsigned int pwron_cnt;
+ unsigned int magic2; /* 数据有效性魔术字 */
} T_TAB_DATA;
typedef struct
{
- unsigned int head; /* 0x010a0a0a */
- unsigned int total_len; /* 数据内容长度 */
- long long time; /* time()函数获取 */
+ char file_path[DEBUG_INFO_FILE_NUM_MAX][DEBUG_INFO_FILE_PATH_LENGTH_MAX];
+}T_FILE_INFO;
+
+T_FILE_INFO g_save_file_path[DEBUG_INFO_CORE_NUM];
+typedef struct{
+ unsigned int head; /* 0x010a0a0a */
+ unsigned int datalen[DEBUG_INFO_CORE_NUM]; /* 数据内容长度 */
} T_SAVE_FILE_DATA;
+char *g_core_name[] ={"cap","ap"};
+
/*******************************************************************************
* 内部函数 *
*******************************************************************************/
@@ -72,7 +85,7 @@
static ssize_t set_tab(const T_TAB_DATA *tab_data);
static ssize_t get_tab(T_TAB_DATA *tab_data);
static int init_tab(T_TAB_DATA *tab_data);
-static ssize_t write_debug_to_file(int pFile_id, const char *pBuf, ssize_t pLen, off_t pIndex);
+static ssize_t write_debug_to_file(char *filename, const char *pBuf, ssize_t pLen, off_t pIndex);
static int usage(const char *exe);
static int init_debug_param(void);
static void write_lockfile(char *filepath, char *setbuf);
@@ -91,34 +104,34 @@
*/
static ssize_t readn(int fd, void *vptr, size_t n)
{
- size_t nleft;
- ssize_t nread;
- char *ptr;
+ size_t nleft;
+ ssize_t nread;
+ char *ptr;
- ptr = vptr;
- nleft = n;
- while (nleft > 0)
- {
- if ((nread = read(fd, ptr, nleft)) < 0)
- {
- if (errno == EINTR)
- {
- nread = 0; /* and call read() again */
- }
- else
- {
- return (-1);
- }
- }
- else if (nread == 0)
- {
- break; /* EOF */
- }
+ ptr = vptr;
+ nleft = n;
+ while (nleft > 0)
+ {
+ if ((nread = read(fd, ptr, nleft)) < 0)
+ {
+ if (errno == EINTR)
+ {
+ nread = 0; /* and call read() again */
+ }
+ else
+ {
+ return (-1);
+ }
+ }
+ else if (nread == 0)
+ {
+ break; /* EOF */
+ }
- nleft -= nread;
- ptr += nread;
- }
- return (n - nleft); /* return >= 0 */
+ nleft -= nread;
+ ptr += nread;
+ }
+ return (n - nleft); /* return >= 0 */
}
/**
@@ -133,35 +146,35 @@
*/
static ssize_t writen(int fd, const void *vptr, size_t n)
{
- size_t nleft;
- ssize_t nwritten;
- const char *ptr;
+ size_t nleft;
+ ssize_t nwritten;
+ const char *ptr;
- ptr = vptr;
- nleft = n;
- while (nleft > 0)
- {
- nwritten = write(fd, ptr, nleft);
- if (nwritten < 0)
- {
- if (errno == EINTR)
- {
- nwritten = 0; /* call write() again */
- }
- else
- {
- return (-1); /* error */
- }
- }
- else if (nwritten == 0)
- {
- break;
- }
+ ptr = vptr;
+ nleft = n;
+ while (nleft > 0)
+ {
+ nwritten = write(fd, ptr, nleft);
+ if (nwritten < 0)
+ {
+ if (errno == EINTR)
+ {
+ nwritten = 0; /* call write() again */
+ }
+ else
+ {
+ return (-1); /* error */
+ }
+ }
+ else if (nwritten == 0)
+ {
+ break;
+ }
- nleft -= nwritten;
- ptr += nwritten;
- }
- return (n - nleft); /* return >= 0 */
+ nleft -= nwritten;
+ ptr += nwritten;
+ }
+ return (n - nleft); /* return >= 0 */
}
/**
@@ -174,24 +187,24 @@
*/
static int isTabFileExists()
{
- int ret;
-
- ret = access(g_tab_file_path, F_OK);
- if (ret == 0)
- {
- printf("[zxic_debug]: isTabFileExists, %s exists.\n", g_tab_file_path);
- }
- else
- {
- printf("[zxic_debug]: isTabFileExists, %s not exists.\n", g_tab_file_path);
- }
-
- return ret;
+ int ret;
+
+ ret = access(g_tab_file_path, F_OK);
+ if (ret == 0)
+ {
+ printf("[zxic_debug]: isTabFileExists, %s exists.\n", g_tab_file_path);
+ }
+ else
+ {
+ printf("[zxic_debug]: isTabFileExists, %s not exists.\n", g_tab_file_path);
+ }
+
+ return ret;
}
/**
* @brief 判断tab文件标识数据是否有效
- * @param tab 入参,tab结构体指针
+ * @param tab 入参,tab结构体指针
* @return 成功返回非0,失败返回0
* @retval
* @note
@@ -199,13 +212,12 @@
*/
static int tab_ok(const T_TAB_DATA *tab)
{
- return ((tab->magic == DEBUG_INFO_MAGIC) && (tab->magic2 == DEBUG_INFO_MAGIC));
+ return ((tab->magic == DEBUG_INFO_MAGIC) && (tab->magic2 == DEBUG_INFO_MAGIC));
}
-#if 1
/**
* @brief 设置tab文件
- * @param tab 入参,tab结构体指针
+ * @param tab 入参,tab结构体指针
* @return 成功返回写入的长度,失败返回-1
* @retval
* @note
@@ -213,31 +225,32 @@
*/
static ssize_t set_tab(const T_TAB_DATA *tab_data)
{
- int fd_tab = -1;
- ssize_t write_len;
+ int fd_tab = -1;
+ ssize_t write_len;
- fd_tab = open(g_tab_file_path, O_RDWR | O_CREAT | O_SYNC, 0644);
- if (fd_tab < 0)
- {
- printf("[zxic_debug]: set_tab, open %s error, %s\n", g_tab_file_path, strerror(errno));
- return -1;
- }
+ fd_tab = open(g_tab_file_path, O_RDWR | O_CREAT | O_SYNC, 0644);
+ if (fd_tab < 0)
+ {
+ printf("[zxic_debug]: set_tab, open %s error, %s\n", g_tab_file_path, strerror(errno));
+ return -1;
+ }
- write_len = writen(fd_tab, tab_data, sizeof(T_TAB_DATA));
- if (write_len < 0)
- {
- printf("[zxic_debug]: set_tab, write %s error, %s\n", g_tab_file_path, strerror(errno));
- close(fd_tab);
- return -1;
- }
- fsync(fd_tab);
- close(fd_tab);
- return write_len;
+ write_len = writen(fd_tab, tab_data, sizeof(T_TAB_DATA));
+ if (write_len < 0)
+ {
+ printf("[zxic_debug]: set_tab, write %s error, %s\n", g_tab_file_path, strerror(errno));
+ close(fd_tab);
+ return -1;
+ }
+ fsync(fd_tab);
+ syncfs(fd_tab);
+ close(fd_tab);
+ return write_len;
}
/**
* @brief 获取tab文件数据
- * @param tab 出参,tab结构体指针
+ * @param tab 出参,tab结构体指针
* @return 成功返回读取的长度,失败返回-1
* @retval
* @note
@@ -245,38 +258,43 @@
*/
static ssize_t get_tab(T_TAB_DATA *tab_data)
{
- int fd_tab = -1;
- ssize_t read_len;
+ int fd_tab = -1;
+ ssize_t read_len;
+ int i;
+
+ fd_tab = open(g_tab_file_path, O_RDWR | O_CREAT, 0644);
+ if (fd_tab < 0)
+ {
+ printf("[zxic_debug]: get_tab, open %s error, %s\n", g_tab_file_path, strerror(errno));
+ return -1;
+ }
- fd_tab = open(g_tab_file_path, O_RDWR | O_CREAT, 0644);
- if (fd_tab < 0)
- {
- printf("[zxic_debug]: get_tab, open %s error, %s\n", g_tab_file_path, strerror(errno));
- return -1;
- }
+ read_len = readn(fd_tab, tab_data, sizeof(T_TAB_DATA));
+ if (read_len < 0)
+ {
+ printf("[zxic_debug]: get_tab, read %s error, %s\n", g_tab_file_path, strerror(errno));
+ close(fd_tab);
+ return -1;
+ }
- read_len = readn(fd_tab, tab_data, sizeof(T_TAB_DATA));
- if (read_len < 0)
- {
- printf("[zxic_debug]: get_tab, read %s error, %s\n", g_tab_file_path, strerror(errno));
- close(fd_tab);
- return -1;
- }
- if(tab_data->file_id > g_file_num)
- {
- tab_data->file_id = 0;
- tab_data->index = 0;
- printf("[zxic_debug]: get_tab, tab out of range, restart from the beginning\n");
- }
+ for ( i = 0; i < DEBUG_INFO_CORE_NUM; i++)
+ {
+ if ( tab_data->file_id[i] > g_file_num )
+ {
+ tab_data->file_id[i] = 0;
+ tab_data->index[i] = 0;
+ printf("[zxic_debug]: get_tab, tab out of range, restart from the beginning\n");
+ }
+ }
- close(fd_tab);
- return read_len;
+ close(fd_tab);
+ return read_len;
}
/**
* @brief 初始化tab文件数据
- * @param tab 出参,tab结构体指针
+ * @param tab 出参,tab结构体指针
* @return 成功返回0,失败返回-1
* @retval
* @note
@@ -284,141 +302,279 @@
*/
static int init_tab(T_TAB_DATA *tab_data)
{
- if (isTabFileExists() == 0)
- {
- if(get_tab(tab_data) < 0)
- {
- return -1;
- }
- if(!tab_ok(tab_data))
- {
- tab_data->magic = DEBUG_INFO_MAGIC;
- tab_data->file_id = 0;
- tab_data->index = 0;
- tab_data->magic2 = DEBUG_INFO_MAGIC;
- if(set_tab(tab_data) < 0)
- {
- return -1;
- }
- }
- }
- else
- {
- tab_data->magic = DEBUG_INFO_MAGIC;
- tab_data->file_id = 0;
- tab_data->index = 0;
- tab_data->magic2 = DEBUG_INFO_MAGIC;
- if(set_tab(tab_data) < 0)
- {
- return -1;
- }
- }
+ int i = 0;
+ if (isTabFileExists() == 0)
+ {
+ if(get_tab(tab_data) < 0)
+ {
+ return -1;
+ }
+ if(!tab_ok(tab_data))
+ {
+ tab_data->magic = DEBUG_INFO_MAGIC;
+ for ( i = 0; i < DEBUG_INFO_CORE_NUM; i++)
+ {
+ tab_data->file_id[i] = 0;
+ tab_data->index[i] = 0;
+ }
+ tab_data->pwron_cnt = 0;
+ tab_data->magic2 = DEBUG_INFO_MAGIC;
+ if(set_tab(tab_data) < 0)
+ {
+ return -1;
+ }
+ }
+ }
+ else
+ {
+ tab_data->magic = DEBUG_INFO_MAGIC;
+ for ( i = 0; i < DEBUG_INFO_CORE_NUM; i++)
+ {
+ tab_data->file_id[i] = 0;
+ tab_data->index[i] = 0;
+ }
+ tab_data->pwron_cnt = 0;
+ tab_data->magic2 = DEBUG_INFO_MAGIC;
+ if (access(g_folder_path, F_OK) != 0)
+ {
+ if (mkdir(g_folder_path, 0755) != 0)
+ {
+ printf("[zxic_debug]: init_tab, mkdir %s fali,errno=%d\n", g_folder_path, errno);
+ return -1;
+ }
+ }
+ if(set_tab(tab_data) < 0)
+ {
+ return -1;
+ }
+ printf("[zxic_debug]: init_tab,g_folder_path=mkdir %s \n", g_folder_path);
+ }
- return 0;
+ return 0;
}
-#endif
-
/**
* @brief debug数据写到文件
- * @param pFile_id 入参,文件号
- * @param pBuf 入参,数据缓冲区
- * @param pLen 入参,写入的数据长度
- * @param pIndex 入参,写入的文件其实位置
+ * @param pFile_id 入参,文件号
+ * @param pBuf 入参,数据缓冲区
+ * @param pLen 入参,写入的数据长度
+ * @param pIndex 入参,写入的文件其实位置
* @return 成功返回0,失败返回-1
* @retval
* @note
* @warning
*/
-static ssize_t write_debug_to_file(int pFile_id, const char *pBuf, ssize_t pLen, off_t pIndex)
+static ssize_t write_debug_to_file( char *filename, const char *pBuf, ssize_t pLen, off_t pIndex)
{
- int fd_file;
- ssize_t wr_len;
+ int fd_file;
+ ssize_t wr_len;
- fd_file = open(g_save_file_path[pFile_id], O_RDWR | O_CREAT | O_SYNC, 0644);
- if (fd_file < 0)
- {
- printf("[zxic_debug]: write_debug_to_file, open %s error, %s\n", g_save_file_path[pFile_id], strerror(errno));
- return -1;
- }
- if (lseek(fd_file, pIndex, SEEK_SET) < 0)
- {
- printf("[zxic_debug]: write_debug_to_file, lseek %s error = %s!\n", g_save_file_path[pFile_id], strerror(errno));
- close(fd_file);
- return -1;
- }
- wr_len = writen(fd_file, pBuf, pLen);
- if (wr_len < 0)
- {
- printf("[zxic_debug]: write_debug_to_file, write %s error, %s\n", g_save_file_path[pFile_id], strerror(errno));
- close(fd_file);
- return -1;
- }
- fsync(fd_file);
- close(fd_file);
+ fd_file = open(filename, O_RDWR | O_CREAT | O_SYNC, 0644);
+ if (fd_file < 0)
+ {
+ printf("[zxic_debug]: write_debug_to_file, open %s error, %s\n", filename, strerror(errno));
+ return -1;
+ }
+ if (lseek(fd_file, pIndex, SEEK_SET) < 0)
+ {
+ printf("[zxic_debug]: write_debug_to_file, lseek %s error = %s!\n", filename, strerror(errno));
+ close(fd_file);
+ return -1;
+ }
+ wr_len = writen(fd_file, pBuf, pLen);
+ if (wr_len < 0)
+ {
+ printf("[zxic_debug]: write_debug_to_file, write %s error, %s\n", filename, strerror(errno));
+ close(fd_file);
+ return -1;
+ }
+ fsync(fd_file);
+ syncfs(fd_file);
+ close(fd_file);
- return wr_len;
+ return wr_len;
}
static int usage(const char *exe)
{
- printf("%s -n file_num -s file_size_total -p save_path -h\n", exe);
- printf("-h, help\n");
- printf("-p save_path\n");
- printf("-n file_num, the range:(1~10)\n");
- printf("-s file_size_total, the range:(1~1024), unit:(MB), the maximum size of a single file is about (file_size_total/file_num)\n");
- return 0;
+ printf("%s -n file_num -s file_size_total -p save_path -h\n", exe);
+ printf("-h, help\n");
+ printf("-p save_path\n");
+ printf("-n file_num, the range:(1~10)\n");
+ printf("-s file_size_total, the range:(1~1024), unit:(MB), the maximum size of a single file is about (file_size_total/file_num)\n");
+ return 0;
}
+static int test_dir_exist(char* dir_path)
+{
+ char tmp[256] = {0};
+ char *p = NULL;
+ int created;
+ struct stat st;
+
+ snprintf(tmp, sizeof(tmp) - 1, "%s", dir_path);
+ if (stat(tmp, &st) == 0) {
+ return 0;
+ }
+
+ p = tmp + 1;
+ while (1) {
+ char *slash = strchr(p, '/');
+ if (slash != NULL) {
+ *slash = '\0';
+ }
+
+ if (stat(tmp, &st) == 0) {
+ if(slash) {
+ *slash = '/';
+ p = slash + 1;
+ }
+ else {
+ break;
+ }
+ continue;
+
+ } else {
+ if (mkdir(tmp, 0777) == -1) {
+ printf("[zxic_debug]: Failed to create %s directory, errno=%d(%s)\n", tmp, errno, strerror(errno));
+ return -1;
+ }
+ }
+
+ if (slash == NULL) {
+ break;
+ }
+
+ *slash = '/';
+ p = slash + 1;
+ }
+ return 0;
+}
+
+/**
+ * @brief 收到的路径进行预处理流程
+ * @param[in] path 路径信息
+ * @return 是否成功
+ * @note
+ * @see
+ */
+int debug_info_PreCheckPath(char *srcpath, char *dstpath, unsigned int len)
+{
+ char *ret;
+ char *check_ptr;
+ char srcdir_ptr[DEBUG_INFO_STRING_MAX_LEN];
+
+ if (!srcpath || !dstpath || srcpath[0]== '\0')
+ {
+ printf("[zxic_debug] %s path error\n", __func__);
+ return -1;
+ }
+
+ if(strcmp(srcpath, DEBUG_INFO_FS_ROOT_PATH) == 0)
+ return 0;
+
+ strncpy(dstpath, srcpath, len);
+ strncpy(srcdir_ptr, srcpath, sizeof(srcdir_ptr) - 1);
+
+ if(strcmp(srcpath, DEBUG_INFO_PATH_DOUBLE_SLASHS) == 0)
+ {
+ dstpath[1]= '\0';
+ return 0;
+ }
+
+ ret = strrchr(srcdir_ptr, '/');
+ if(ret == NULL)
+ return -1;
+
+ while(1)
+ {
+ ret = strrchr(srcdir_ptr, '/');
+ if(ret != NULL)
+ {
+ check_ptr = ret + 1;
+ *ret = '\0';
+
+ if(*check_ptr != '\0')
+ break;
+
+ strncpy(dstpath, srcpath, ret - srcdir_ptr);
+ dstpath[ret - srcdir_ptr] = '\0';
+ }
+ }
+ return 0;
+}
static int init_debug_param(void)
{
- char file_num[4] = {0};
- char file_size_total[4] = {0};
- char folder_path[DEBUG_INFO_FOLDER_PATH_LENGTH_MAX] = {0};
+ char file_num[4] = {0};
+ char file_size_total[4] = {0};
+ char folder_path[DEBUG_INFO_FOLDER_PATH_LENGTH_MAX] = {0};
+ char dst_folder_path[DEBUG_INFO_FOLDER_PATH_LENGTH_MAX] = {0};
+ int retval;
+
+
+ while(1)
+ {
+ if(sc_cfg_get(DEBUG_INFO_FILE_PATH_NAME, folder_path, sizeof(folder_path)) < 0)
+ {
+ printf("[zxic_debug] DEBUG_INFO_FILE_PATH failed\n");
+ return -1;
+ }
+ retval = debug_info_PreCheckPath(folder_path, dst_folder_path, DEBUG_INFO_FOLDER_PATH_LENGTH_MAX - 1);
+ if(retval < 0)
+ {
+ printf("[zxic_debug] log_path %s error, please check zxic_debug path \n", folder_path);
+ sleep(3);
+ continue;
+ }
+ if(test_dir_exist(dst_folder_path) < 0)
+ {
+ printf("[zxic_debug] test %s dir mkdir failed. \n", dst_folder_path);
+ sleep(3);
+ }
+ else
+ {
+ break;
+ }
+ }
+
+ if(strlen(dst_folder_path))
+ {
+ strncpy(g_folder_path, dst_folder_path, DEBUG_INFO_FOLDER_PATH_LENGTH_MAX - 1);
+ }
- if(sc_cfg_get(DEBUG_INFO_FILE_PATH_NAME, folder_path, sizeof(folder_path)) < 0)
- {
- printf("init_debug_param:: sc_cfg_get DEBUG_INFO_FILE_PATH failed\n");
- return -1;
- }
- if(strlen(folder_path))
- {
- strncpy(g_folder_path, folder_path, DEBUG_INFO_FOLDER_PATH_LENGTH_MAX - 1);
- }
+ if(sc_cfg_get(DEBUG_INFO_FILE_NUM_NAME, file_num, sizeof(file_num)) < 0)
+ {
+ printf("[zxic_debug] DEBUG_INFO_FILE_NUM failed\n");
+ return -1;
+ }
+ if(strlen(file_num))
+ {
+ g_file_num = atoi(file_num);
+ if(g_file_num < DEBUG_INFO_FILE_NUM_MIN)
+ {
+ g_file_num = DEBUG_INFO_FILE_NUM_MIN;
+ }
+ else if(g_file_num > DEBUG_INFO_FILE_NUM_MAX)
+ {
+ g_file_num = DEBUG_INFO_FILE_NUM_MAX;
+ }
+ }
- if(sc_cfg_get(DEBUG_INFO_FILE_NUM_NAME, file_num, sizeof(file_num)) < 0)
- {
- printf("init_debug_param:: sc_cfg_get DEBUG_INFO_FILE_NUM failed\n");
- return -1;
- }
- if(strlen(file_num))
- {
- g_file_num = atoi(file_num);
- if(g_file_num < DEBUG_INFO_FILE_NUM_MIN)
- {
- g_file_num = DEBUG_INFO_FILE_NUM_MIN;
- }
- else if(g_file_num > DEBUG_INFO_FILE_NUM_MAX)
- {
- g_file_num = DEBUG_INFO_FILE_NUM_MAX;
- }
- }
+ if(sc_cfg_get(DEBUG_INFO_FILE_TOTAL_SIZE_NAME, file_size_total, sizeof(file_size_total)) < 0)
+ {
+ printf("[zxic_debug] DEBUG_INFO_FILE_NUM failed\n");
+ return -1;
+ }
+ 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_TOTAL_FILE_SIZE_MAX)
+ {
+ g_file_size_total = DEBUG_INFO_TOTAL_FILE_SIZE_MAX;
+ }
+ }
- if(sc_cfg_get(DEBUG_INFO_FILE_TOTAL_SIZE_NAME, file_size_total, sizeof(file_size_total)) < 0)
- {
- printf("init_debug_param:: sc_cfg_get DEBUG_INFO_FILE_NUM failed\n");
- return -1;
- }
- 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_TOTAL_FILE_SIZE_MAX)
- {
- g_file_size_total = DEBUG_INFO_TOTAL_FILE_SIZE_MAX;
- }
- }
-
- return 0;
+ return 0;
}
static void write_lockfile(char *filepath, char *setbuf)
@@ -443,236 +599,296 @@
static void wake_debug_lock()
{
- write_lockfile("/sys/power/wake_lock", "debug_lock");
+ //write_lockfile("/sys/power/wake_lock", "debug_lock");
}
static void wake_debug_unlock()
{
- write_lockfile("/sys/power/wake_unlock", "debug_lock");
+ //write_lockfile("/sys/power/wake_unlock", "debug_lock");
}
-static int init_debug_info_flag(int fd)
-{
- int ret = 0;
- int val_disable = 0;
- char str_disable[4] = {0};
+/* Started by AICoder, pid:c9402dc3b5fc1d114a7e080581f4f22130e69848 */
+void signal_handler(int signum) {
+ int corenum;
+ ssize_t rd_len;
+ ssize_t wr_len;
+ unsigned long long index;
+ char *buf = NULL;
+ T_TAB_DATA tab_data;
+ T_SAVE_FILE_DATA *file_data;
+ char *startbuf = NULL;
+ ssize_t rdwr_tab_len;
+ int fd = -1;
- if (fd < 0)
- {
- printf("%s:: parma fd error! \n", __func__);
- return -1;
- }
- if(sc_cfg_get(DEBUG_INFO_DISABLE, str_disable, sizeof(str_disable)) < 0)
- {
- printf("%s:: sc_cfg_get DEBUG_INFO_DISABLE failed\n", __func__);
- return -1;
- }
-
- errno = 0;
- val_disable = (int)strtol(str_disable, NULL, 0);
-
- if(errno == ERANGE)
- {
- printf("%s: strtol error, return\n", __func__);
- return -1;
+ fd = open(DEBUG_INFO_DEV_PATH, O_RDWR);
+ if (fd == -1) {
+ perror("Failed to open debug device");
+ exit(EXIT_FAILURE);
}
-
- ret = ioctl(fd, DEBUG_INFO_IOCTL_SET_DISABLE, val_disable);
- if (ret < 0)
- {
- printf("%s: ioctl failed %d\n", __func__, ret);
- return -1;
+
+ buf = g_read_buf;
+ if (!buf) {
+ printf("[zxic_debug]: sig buff null\n");
+ close(fd);
+ exit(EXIT_FAILURE);
}
- return 0;
+
+ ioctl(fd, DEBUG_READ_NOBLOCK, 0);
+ rd_len = read(fd, buf, DEBUG_INFO_READ_BUFFER_SIZE);
+ if (rd_len <= 0) {
+ printf("[zxic_debug]: sig read %zd\n", rd_len);
+ close(fd);
+ exit(EXIT_FAILURE);
+ }
+
+ file_data = (T_SAVE_FILE_DATA *)buf;
+ startbuf = buf + sizeof(T_SAVE_FILE_DATA);
+
+ // 读取标记文件
+ rdwr_tab_len = get_tab(&tab_data);
+ if (rdwr_tab_len < 0) {
+ printf("[zxic_debug]: sig get_tab error\n");
+ close(fd);
+ exit(EXIT_FAILURE);
+ }
+
+ for (corenum = 0; corenum < DEBUG_INFO_CORE_NUM; corenum++) {
+ wr_len = 0;
+ int file_id = tab_data.file_id[corenum];
+ index = tab_data.index[corenum];
+ printf("gaohf [zxic_debug]: sig file_id =%d corenum= %d index = %llu datalen = %zu \n",
+ file_id, corenum, index, file_data->datalen[corenum]);
+
+ if (index > g_file_size_single) {
+ file_id = (file_id + 1) % g_file_num;
+ printf("[zxic_debug]: sig save to next file %s begin...g_file_size_single=%zu index=%llu\n",
+ g_save_file_path[corenum].file_path[file_id], g_file_size_single, index);
+ index = 0;
+ tab_data.index[corenum] = index;
+ } else if (index < 0) {
+ printf("[zxic_debug]: sig lseek %s error = %s!\n",
+ g_save_file_path[corenum].file_path[file_id], strerror(errno));
+ } else {
+ printf("[zxic_debug]: sig save to current %s file, continue...\n",
+ g_save_file_path[corenum].file_path[file_id]);
+ }
+
+ if (file_data->datalen[corenum] > 0) {
+ wr_len = write_debug_to_file(g_save_file_path[corenum].file_path[file_id], startbuf, file_data->datalen[corenum], index);
+ printf("gaohf [zxic_debug]: sig filename=%s wr_len = %zu datalen = %zu \n",
+ g_save_file_path[corenum].file_path[file_id], wr_len, file_data->datalen[corenum]);
+ if (wr_len < 0) {
+ close(fd);
+ exit(EXIT_FAILURE);
+ }
+ }
+ startbuf += wr_len;
+ tab_data.file_id[corenum] = file_id;
+ tab_data.index[corenum] += wr_len;
+ }
+
+ rdwr_tab_len = set_tab(&tab_data);
+ close(fd);
+ exit(EXIT_SUCCESS);
}
+/* Ended by AICoder, pid:c9402dc3b5fc1d114a7e080581f4f22130e69848 */
int main(int argc, char *argv[])
{
- int i;
- int ch;
- int ret = -1;
+ int i;
+ int corenum;
+ int ch;
+ int ret = -1;
+ int file_id;
+ int fd = -1;
+ ssize_t rd_len;
+ ssize_t wr_len;
+ unsigned int index;
+ char *buf = NULL;
+ T_TAB_DATA tab_data;
+ T_SAVE_FILE_DATA *file_data;
+ char *startbuf = NULL;
+ ssize_t rdwr_tab_len;
+ bool pwron_write = true;
+ char buffer[1024] = {0};
+
+ wake_debug_lock();
+ if(init_debug_param() == -1)
+ {
+ return -1;
+ }
+ signal(SIGTERM, signal_handler);
- int file_id;
- int fd = -1;
- ssize_t rd_len;
- ssize_t wr_len;
- off_t index;
- char *buf = NULL;
- time_t t;
- T_SAVE_FILE_DATA *file_data;
+ while ((ch = getopt(argc, argv, "hn:s:p:")) != -1)
+ {
+ switch (ch)
+ {
+ case 'h':
+ ret = usage(argv[0]);
+ return ret;
+ case 'n':
+ g_file_num = atoi(optarg);
+ if(g_file_num < DEBUG_INFO_FILE_NUM_MIN)
+ {
+ g_file_num = DEBUG_INFO_FILE_NUM_MIN;
+ }
+ else if(g_file_num > DEBUG_INFO_FILE_NUM_MAX)
+ {
+ g_file_num = DEBUG_INFO_FILE_NUM_MAX;
+ }
+ printf("[zxic_debug]: -n, g_file_num = %d\n", g_file_num);
+ break;
+ case 's':
+ g_file_size_total = atoi(optarg) * DEBUG_INFO_DEFAULT_TOTAL_FILE_SIZE;
+ if(g_file_size_total > DEBUG_INFO_TOTAL_FILE_SIZE_MAX)
+ {
+ g_file_size_total = DEBUG_INFO_TOTAL_FILE_SIZE_MAX;
+ }
+ printf("[zxic_debug]: -s, g_file_size_total = %dM\n", atoi(optarg));
+ break;
+ case 'p':
+ strncpy(g_folder_path, optarg, DEBUG_INFO_FOLDER_PATH_LENGTH_MAX - 1);
+ printf("[zxic_debug]: -p, g_folder_path = %s\n", g_folder_path);
+ break;
+ default:
+ printf("[zxic_debug]: please input the correct option, for help(zxic_debug -h)\n");
+ return 0;
+ }
+ }
+ //设置文件路径及大小
+ g_file_size_single = g_file_size_total / g_file_num;
+ sprintf(g_tab_file_path, "%s/%s", g_folder_path, DEBUG_INFO_TAB_FILE_NAME);
+ printf("[zxic_debug]: g_tab_file_path is %s\n", g_tab_file_path);
+ for (corenum = 0; corenum < DEBUG_INFO_CORE_NUM; corenum++)
+ {
+ for (i = 0; i < g_file_num; i++)
+ {
+ sprintf(g_save_file_path[corenum].file_path[i], "%s/zxic_debug_%s-%d.log", g_folder_path, g_core_name[corenum], i+1);
+ printf("[zxic_debug]: g_save_file_path[%d] is %s\n", i, g_save_file_path[corenum].file_path[i]);
+ }
+ }
- T_TAB_DATA tab_data;
- ssize_t rdwr_tab_len;
+ buf = (char *)malloc(DEBUG_INFO_READ_BUFFER_SIZE);
+ if (!buf)
+ {
+ printf("[zxic_debug]: malloc failed\n");
+ return -1;
+ }
+ g_read_buf = buf;
+ fd = open(DEBUG_INFO_DEV_PATH, O_RDWR);
+ if (fd < 0)
+ {
+ printf("[zxic_debug]: open debug_info error, %s\n", strerror(errno));
+ if (buf != NULL)
+ {
+ free(buf);
+ }
+ return -1;
+ }
- wake_debug_lock();
- if(init_debug_param() == -1)
- {
- wake_debug_unlock();
- return -1;
- }
-
- while ((ch = getopt(argc, argv, "hn:s:p:")) != -1)
- {
- switch (ch)
- {
- case 'h':
- ret = usage(argv[0]);
- wake_debug_unlock();
- return ret;
- case 'n':
- g_file_num = atoi(optarg);
- if(g_file_num < DEBUG_INFO_FILE_NUM_MIN)
- {
- g_file_num = DEBUG_INFO_FILE_NUM_MIN;
- }
- else if(g_file_num > DEBUG_INFO_FILE_NUM_MAX)
- {
- g_file_num = DEBUG_INFO_FILE_NUM_MAX;
- }
- printf("[zxic_debug]: -n, g_file_num = %d\n", g_file_num);
- break;
- case 's':
- g_file_size_total = atoi(optarg) * DEBUG_INFO_DEFAULT_TOTAL_FILE_SIZE;
- if(g_file_size_total > DEBUG_INFO_TOTAL_FILE_SIZE_MAX)
- {
- g_file_size_total = DEBUG_INFO_TOTAL_FILE_SIZE_MAX;
- }
- printf("[zxic_debug]: -s, g_file_size_total = %dM\n", atoi(optarg));
- break;
- case 'p':
- strncpy(g_folder_path, optarg, DEBUG_INFO_FOLDER_PATH_LENGTH_MAX - 1);
- printf("[zxic_debug]: -p, g_folder_path = %s\n", g_folder_path);
- break;
- default:
- printf("[zxic_debug]: please input the correct option, for help(zxic_debug -h)\n");
- wake_debug_unlock();
- return 0;
- }
- }
- //设置文件路径及大小
- g_file_size_single = g_file_size_total / g_file_num;
- sprintf(g_tab_file_path, "%s/%s", g_folder_path, DEBUG_INFO_TAB_FILE_NAME);
- printf("[zxic_debug]: g_tab_file_path is %s\n", g_tab_file_path);
- for (i = 0; i < g_file_num; i++)
- {
- sprintf(g_save_file_path[i], "%s/zxic_debug-%d.log", g_folder_path, i+1);
- printf("[zxic_debug]: g_save_file_path[%d] is %s\n", i, g_save_file_path[i]);
- }
-
-#if 1
+ if (init_tab(&tab_data) < 0)
+ {
+ printf("[zxic_debug]: init_tab error.\n");
+ if (buf != NULL)
+ {
+ free(buf);
+ }
+ return -1;
+ }
+ wake_debug_unlock();
- memset(&tab_data, 0, sizeof(tab_data));
+ while (1)
+ {
+ rd_len = read(fd, buf, DEBUG_INFO_READ_BUFFER_SIZE);
+ if (rd_len <= 0)
+ {
+ continue;
+ }
+ wake_debug_lock();
+ file_data = (T_SAVE_FILE_DATA *)buf;
+ startbuf = buf + sizeof(T_SAVE_FILE_DATA);
+ // 读取标记文件
+ rdwr_tab_len = get_tab(&tab_data);
+ if (rdwr_tab_len < 0)
+ {
+ perror("[zxic_debug]: get_tab error\n");
+ continue;
+ }
+ for ( corenum = 0; corenum < DEBUG_INFO_CORE_NUM; corenum++ )
+ {
+ wr_len = 0;
+ file_id = tab_data.file_id[corenum];
+ index = tab_data.index[corenum];
+ // printf("gaohf [zxic_debug]: file_id =%d corenum= %d index = %llu datalen = %u \n",file_id,corenum, index, file_data->datalen[corenum]);
+ if (index > g_file_size_single)
+ {
+ file_id = (file_id + 1) % g_file_num;
+ // ftruncate(fd_file[file_id], 0);
+ // 回绕到另一个文件,从头开始读
+ printf("[zxic_debug]: save to next file %s begin...g_file_size_single=%d index=%d\n", g_save_file_path[corenum].file_path[file_id],g_file_size_single,index);
+ index = 0;
+ tab_data.index[corenum] = index;
+
+ }
+ else if (index < 0)
+ {
+ printf("[zxic_debug]: lseek %s error = %s!\n", g_save_file_path[corenum].file_path[file_id], strerror(errno));
+ continue;
+ }
+ else
+ {
+ //printf("[zxic_debug]: save to current %s file, continue...\n", g_save_file_path[corenum].file_path[file_id]);
+ }
- buf = (char *)malloc(DEBUG_INFO_READ_BUFFFER_SIZE);
- if (!buf)
- {
- printf("[zxic_debug]: malloc failed\n");
- wake_debug_unlock();
- return -1;
- }
+ if (pwron_write)
+ {
+ ret = sprintf(buffer,"======================================restart:%d======================================\n", tab_data.pwron_cnt);
+ ret = write_debug_to_file(g_save_file_path[corenum].file_path[file_id], buffer, ret, index);
+ if (ret < 0)
+ {
+ printf("[zxic_debug]: %s power cnt write fail %d \n", g_save_file_path[corenum].file_path[file_id], ret);
+ }
+ else
+ {
+ index += ret;
+ tab_data.index[corenum] += ret;
+ }
+ }
+
+ if (file_data->datalen[corenum] > 0)
+ {
+ wr_len = write_debug_to_file(g_save_file_path[corenum].file_path[file_id], startbuf, file_data->datalen[corenum], index);
+ // printf("gaohf [zxic_debug]: filename=%s wr_len = %llu datalen = %u \n",g_save_file_path[corenum].file_path[file_id], wr_len, file_data->datalen[corenum]);
+ if (wr_len < 0)
+ {
+ continue;
+ }
+ }
+ startbuf += wr_len;
+ tab_data.file_id[corenum] = file_id;
+ tab_data.index[corenum] += wr_len;
+ }
+
+ if (pwron_write)
+ {
+ ++tab_data.pwron_cnt;
+ pwron_write = false;
+ }
+
+ rdwr_tab_len = set_tab(&tab_data);
+ if (rdwr_tab_len < 0)
+ {
+ perror("[zxic_debug]: set_tab error\n");
+ continue;
+ }
+ wake_debug_unlock();
+ }
-#if 1
- fd = open(DEBUG_INFO_DEV_PATH, O_RDWR);
- if (fd < 0)
- {
- printf("[zxic_debug]: open debug_info error, %s\n", strerror(errno));
- if (buf != NULL)
- {
- free(buf);
- }
- wake_debug_unlock();
- return -1;
- }
-
- if ((init_tab(&tab_data) < 0)
- || (init_debug_info_flag(fd) < 0))
- {
- printf("[zxic_debug]: init_tab or init_debug_info_flag error.\n");
- if (buf != NULL)
- {
- free(buf);
- }
- wake_debug_unlock();
- return -1;
- }
- wake_debug_unlock();
-#endif
+ if (buf != NULL)
+ {
+ free(buf);
+ }
+ close(fd);
- while (1)
- {
- rd_len = read(fd, buf, DEBUG_INFO_READ_BUFFFER_SIZE);
- if (rd_len <= 0)
- {
- continue;
- }
- wake_debug_lock();
- file_data = (T_SAVE_FILE_DATA *)buf;
- file_data->time = time(&t);
-#if 1
-
- // 读取标记文件
- rdwr_tab_len = get_tab(&tab_data);
- if (rdwr_tab_len < 0)
- {
- perror("[zxic_debug]: get_tab error\n");
- wake_debug_unlock();
- continue;
- }
- file_id = tab_data.file_id;
- index = tab_data.index;
-#endif
- // index = lseek(fd_file[file_id], 0, SEEK_CUR);
- printf("[zxic_debug]: index = %d\n", index);
- if (index > g_file_size_single)
- {
- file_id = (file_id + 1) % g_file_num;
- // ftruncate(fd_file[file_id], 0);
- // 回绕到另一个文件,从头开始读
- 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)
- {
- printf("[zxic_debug]: lseek %s error = %s!\n", g_save_file_path[file_id], strerror(errno));
- wake_debug_unlock();
- continue;
- }
- else
- {
- printf("[zxic_debug]: save to current %s file, continue...\n", g_save_file_path[file_id]);
- }
-#if 1
- wr_len = write_debug_to_file(file_id, buf, rd_len, index);
- if (wr_len < 0)
- {
- wake_debug_unlock();
- continue;
- }
-#endif
- index += wr_len;
- // times++;
- tab_data.magic = DEBUG_INFO_MAGIC;
- tab_data.file_id = file_id;
- tab_data.index = index;
- tab_data.magic2 = DEBUG_INFO_MAGIC;
- rdwr_tab_len = set_tab(&tab_data);
- if (rdwr_tab_len < 0)
- {
- perror("[zxic_debug]: set_tab error\n");
- wake_debug_unlock();
- continue;
- }
- wake_debug_unlock();
- }
-
- if (buf != NULL)
- {
- free(buf);
- }
- close(fd);
-
-#endif
-
- return 0;
+ return 0;
}
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/zxic_mainctrl/Makefile b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/zxic_mainctrl/Makefile
index 57b92d4..b9ea8b5 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/zxic_mainctrl/Makefile
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/zxic_mainctrl/Makefile
@@ -17,6 +17,7 @@
#CFLAGS += -I$(LIB_DIR)/libatutils
CFLAGS += -I$(LIB_DIR)/libsoftap
CFLAGS += -I$(LIB_DIR)/libsofttimer
+CFLAGS += -I$(LIB_DIR)/libdebug_info
CFLAGS += -O -Dlinux=1 -DHIGH_SPEED=1
CFLAGS += -g
CFLAGS += -g -Werror=implicit-function-declaration
@@ -32,6 +33,7 @@
LDLIBS += -lsoftap -L$(LIB_DIR)/libsoftap
LDLIBS += -lscipc -L$(zte_lib_path)/libscipc
LDLIBS += -lcrypto
+LDLIBS += -ldebug_info -L$(LIB_DIR)/libdebug_info
##############USER COMIZE END##################
#*******************************************************************************
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/zxic_mainctrl/zxic_mainctrl.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/zxic_mainctrl/zxic_mainctrl.c
index bf8b1c0..f0518e3 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/zxic_mainctrl/zxic_mainctrl.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/zxic_mainctrl/zxic_mainctrl.c
@@ -8,6 +8,8 @@
#include "sc_ipc.h"
#include "zxic_fota_ab_upgrade.h"
//#include "upi_sync_system.h"
+#include "pub_debug_info.h"
+
@@ -777,7 +779,9 @@
sc_cfg_get("time_to_2000_when_restore", time_to_2000, 16);
if (strcmp(time_to_2000, "yes") == 0) {
system("rm -rf /etc_rw/localtime");
+ system("ln -snf /usr/share/zoneinfo/Asia/Shanghai /etc_rw/localtime");
system("date -s \"2000-01-01 00:00:00\"");
+ sc_debug_info_record("ZXIC-MAINCTRL", "reset system time!\n");
system("zxic-rtc-clock");
}
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/zxic_ramdump/ramdump_app.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/zxic_ramdump/ramdump_app.c
index 5036c87..1b45ba3 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/zxic_ramdump/ramdump_app.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/zxic_ramdump/ramdump_app.c
@@ -235,7 +235,7 @@
fd = open(g_ramdump_info.ramdump_device, O_RDWR);
if (fd < 0)
{
- printf("[zxic_ramdump]%s : open device error\n", __func__);
+ printf("[zxic_ramdump]%s : open device error, %s! \n", __func__, strerror(errno));
return -1;
}
@@ -452,6 +452,62 @@
}
/*******************************************************************************
+* ¹¦ÄÜÃèÊö: ramdump_test_dir_exist
+* ²ÎÊý˵Ã÷:
+* (´«Èë²ÎÊý) dir_path: ramdump´æ´¢Â·¾¶
+* (´«Èë²ÎÊý)
+* (´«³ö²ÎÊý) void
+*
+* ÆäËü˵Ã÷: This function is used to test dir and mkdir
+*******************************************************************************/
+/* Started by AICoder, pid:n95b4nd3aar6288147dd082e1067fb4302c0f059 */
+int ramdump_test_dir_exist(char* dir_path)
+{
+ char tmp[256] = {0};
+ char *p = NULL;
+ int created;
+ struct stat st;
+
+ snprintf(tmp, sizeof(tmp) - 1, "%s", dir_path);
+ if (stat(tmp, &st) == 0) {
+ return 0;
+ }
+
+ p = tmp + 1;
+ while (1) {
+ char *slash = strchr(p, '/');
+ if (slash != NULL) {
+ *slash = '\0';
+ }
+
+ if (stat(tmp, &st) == 0) {
+ if(slash) {
+ *slash = '/';
+ p = slash + 1;
+ }
+ else {
+ break;
+ }
+ continue;
+ } else {
+ if (mkdir(tmp, 0777) == -1) {
+ printf("[zxic_ramdump]: Failed to create directory, errno=%d(%s)\n", errno, strerror(errno));
+ return -1;
+ }
+ }
+
+ if (slash == NULL) {
+ break;
+ }
+
+ *slash = '/';
+ p = slash + 1;
+ }
+ return 0;
+}
+/* Ended by AICoder, pid:n95b4nd3aar6288147dd082e1067fb4302c0f059 */
+
+/*******************************************************************************
* ¹¦ÄÜÃèÊö: ramdump_init_savepath
* ²ÎÊý˵Ã÷:
* (´«Èë²ÎÊý) argc
@@ -481,34 +537,41 @@
}
}
}
-
- while(1)
- {
- if (ramdump_save_path[0] == '\0')
- {
- if(file_path[0] == '\0')
- strncpy(file_path, RAMDUMP_DEFAULT_PATH, RAMDUMP_STRING_MAX_LEN - 1);
-
- ret = ramdump_fold_name(ramdump_save_path, RAMDUMP_FILE_PATH_LEN, file_path, "ramdump");
- if(ret < 0)
- {
- printf("[zxic_ramdump]ramdump path exist fail.\n");
- sleep(2);
- }
- else
- {
- printf("[zxic_ramdump]ramdump file name is %s\n", ramdump_save_path);
- break;
- }
- }
- }
+
+ /* Started by AICoder, pid:8d56200ac5zff2b141c40ba250d1624ad4272d25 */
+ if(file_path[0] == '\0')
+ strncpy(file_path, RAMDUMP_DEFAULT_PATH, RAMDUMP_STRING_MAX_LEN - 1);
- g_ramdump_info.fp = fopen(ramdump_save_path, "wb+");
- if(!g_ramdump_info.fp)
- {
- printf("[zxic_ramdump]ramdump user open file %s failed, fp is %d!\n",file_path, g_ramdump_info.fp);
- return -1;
- }
+ ret = ramdump_fold_name(ramdump_save_path, RAMDUMP_FILE_PATH_LEN, file_path, "ramdump");
+ if(ret < 0)
+ {
+ printf("[zxic_ramdump]ramdump path exist fail.\n");
+ return -1;
+ }
+
+ while(1)
+ {
+ if(ramdump_test_dir_exist(file_path) < 0)
+ {
+ printf("[zxic_ramdump] test %s dir exist failed. \n", file_path);
+ sleep(2);
+ }
+ else
+ {
+ g_ramdump_info.fp = fopen(ramdump_save_path, "wb+");
+ if(!g_ramdump_info.fp)
+ {
+ printf("[zxic_ramdump]ramdump user open file %s failed, errno=%d(%s)\n", file_path, errno, strerror(errno));
+ sleep(2);
+ }
+ else
+ {
+ break;
+ }
+ }
+ }
+ /* Ended by AICoder, pid:8d56200ac5zff2b141c40ba250d1624ad4272d25 */
+
return 0;
}
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/libdebug_info/debug_info.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/libdebug_info/debug_info.c
index 6b82746..03fe2b8 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/libdebug_info/debug_info.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/libdebug_info/debug_info.c
@@ -8,38 +8,45 @@
#include "pub_debug_info.h"
-// #define DEBUG_INFO_ERROR 0
-
#define DEBUG_INFO_MAX_TOTAL_LEN (140)
-#define DEBUG_INFO_MAX_DATA_LEN (128)
-#define DEBUG_INFO_MEM_HEAD_LEN (8)
+//#define DEBUG_INFO_MAX_DATA_LEN (128)
+//#define DEBUG_INFO_MEM_HEAD_LEN (8)
-typedef unsigned int UINT32;
-typedef unsigned short UINT16;
-typedef unsigned char UINT8;
-
-typedef struct
+ssize_t safe_write(int fd, const void *buf, size_t count)
{
- UINT16 module_id; // 模块id
- UINT16 sub_len; // 用户数据长度
- UINT32 time;
- char sub_data[]; // 用户数据
-} T_SHARED_MEM_DATA;
+ ssize_t n;
-int sc_debug_info_record(unsigned int id, const char *format, ...)
+ for (;;) {
+ n = write(fd, buf, count);
+ if (n >= 0 || errno != EINTR)
+ break;
+ /* Some callers set errno=0, are upset when they see EINTR.
+ * Returning EINTR is wrong since we retry write(),
+ * the "error" was transient.
+ */
+ errno = 0;
+ /* repeat the write() */
+ }
+
+ return n;
+}
+int sc_debug_info_record(char *id, const char *format, ...)
{
int fd = -1;
ssize_t writelen;
-
int len;
va_list args;
char str_buf[DEBUG_INFO_MAX_TOTAL_LEN] __attribute__((aligned(4)));
- T_SHARED_MEM_DATA *shareMemData;
- shareMemData = (T_SHARED_MEM_DATA *)str_buf;
+ char *ptmpstr = str_buf;
/* args是一个char*类型指针,指向format之后的第一个参数*/
+ if( id == NULL)
+ return -1;
+
+ len = snprintf((char *)ptmpstr, DEBUG_INFO_MAX_TOTAL_LEN, "[%s]",id);
+ ptmpstr += len;
va_start(args, format);
- len = vsnprintf(shareMemData->sub_data, DEBUG_INFO_MAX_DATA_LEN, format, args);
+ len += vsnprintf(ptmpstr, DEBUG_INFO_MAX_TOTAL_LEN - len, format, args);
va_end(args);
if (len < 0)
{
@@ -47,10 +54,6 @@
return -1;
}
- shareMemData->module_id = (UINT16)(id & 0xFFFF);
- shareMemData->sub_len = len;
- shareMemData->time = 0;
-
fd = open(DEBUG_INFO_DEV_PATH, O_WRONLY);
if (fd < 0)
{
@@ -58,7 +61,7 @@
return -1;
}
- writelen = write(fd, (char *)shareMemData, (len + DEBUG_INFO_MEM_HEAD_LEN));
+ writelen = safe_write(fd, (char *)str_buf, len);
if (writelen < 0)
{
printf("[libdebug_info]: sc_debug_info_record, write debug_info error, %s\n", strerror(errno));
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/libscipc/sc_ipc.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/libscipc/sc_ipc.c
index c8fddb8..9fa6d06 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/libscipc/sc_ipc.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/libscipc/sc_ipc.c
@@ -546,6 +546,35 @@
return ret;
}
+/* Started by AICoder, pid:y969cx55f5ra53b142b308cff05de929a025e9bc */
+int sc_ipc_send_msg_with_flag(sc_ipc_msg* pmsg, int msgflg)
+{
+ int ret = 0;
+ int msg_fd = -1;
+
+ if(0 == pmsg)
+ return -1;
+ if(0 > pmsg->fd_svr)
+ {
+ SCLOGE("sc_ipc_send_msg failed(fd_svr=0x%x)\n", pmsg->fd_svr);
+ return -1;
+ }
+
+ pmsg->type = 1;
+ pmsg->token = s_ipc_msg_cnt++;
+ msg_fd = msgget(pmsg->fd_svr, 0);
+ if(0 > msg_fd)
+ {
+ SCLOGE("sc_ipc_send_msg failed(0x%x)\n", errno);
+ return -1;
+ }
+ ret = msgsnd(msg_fd, pmsg, sizeof(sc_ipc_msg)-sizeof(long)+pmsg->data_len, msgflg);
+ /* Todo : fragment process. */
+
+ return ret;
+}
+/* Ended by AICoder, pid:y969cx55f5ra53b142b308cff05de929a025e9bc */
+
int sc_ipc_send_msg_wait_rsp(sc_ipc_msg* pmsg, sc_ipc_msg** rsp_msg)
{
return sc_ipc_send_msg_wait_rsp_timeout(pmsg, rsp_msg, 0);
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/libscipc/sc_ipc.h b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/libscipc/sc_ipc.h
index f860c2c..56340df 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/libscipc/sc_ipc.h
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/libscipc/sc_ipc.h
@@ -92,6 +92,7 @@
* Global function declarations *
******************************************************************************/
int sc_ipc_send_msg(sc_ipc_msg* pmsg);
+int sc_ipc_send_msg_with_flag(sc_ipc_msg* pmsg, int msgflg);
int sc_ipc_send_msg_wait_rsp(sc_ipc_msg* pmsg, sc_ipc_msg** rsp_msg);
int sc_ipc_send_msg_wait_rsp_timeout(sc_ipc_msg* pmsg, sc_ipc_msg** rsp_msg, unsigned long msec);
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 f158d4f..f012d8e 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
@@ -135,7 +135,7 @@
* rtc_id¶¨Ê±Æ÷ID
* @param (out) ÎÞ¡£
* @return 0 - ³É¹¦
- * ÆäËû-ʧ°Ü
+ * ÆäËû-ʧ°Ü£¬-1£ºÖ¸¶¨IDµÄ¶¨Ê±Æ÷»òÕßÄÖÖӵȲ»´æÔÚ
* @note ×¢ÊÍ
* ×¢ÊÍ¡£
*/
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 d935686..9567ee8 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
@@ -332,7 +332,7 @@
* @param (out) ÎÞ
* @return 0 - ³É¹¦
* ÆäËûʧ°Ü
- * @note ÎÞ
+ * @note ͬ²½½Ó¿Ú
*
*/
int sc_wifi_init(void);
@@ -343,7 +343,7 @@
* @param (out) ÎÞ
* @return 0 - ³É¹¦
* ÆäËûʧ°Ü
- * @note ÎÞ
+ * @note ͬ²½½Ó¿Ú
*
*/
int sc_wifi_uninit(void);
@@ -354,7 +354,7 @@
* @param (out) ÎÞ
* @return 0 - ³É¹¦
* ÆäËûʧ°Ü
- * @note ÎÞ
+ * @note Òì²½½Ó¿Ú
*
*/
int sc_wifi_enable(void);
@@ -365,18 +365,29 @@
* @param (out) ÎÞ
* @return 0 - ³É¹¦
* ÆäËûʧ°Ü
- * @note ÎÞ
+ * @note Òì²½½Ó¿Ú
*
*/
int sc_wifi_disable(void);
/**
+ * @brief »ñÈ¡wifi״̬
+ * @param (in) ÎÞ
+ * @param (out) p_status: »ñÈ¡wifiÄ£¿é״̬ÐÅÏ¢
+ * @return 0 - ³É¹¦
+ * ÆäËûʧ°Ü
+ * @note ͬ²½½Ó¿Ú
+ *
+ */
+int sc_wifi_get_enable_status(sc_wifi_enable_status_e *p_status);
+
+/**
* @brief ×¢²áwifi״̬»Øµ÷º¯Êý
* @param (in) cb: wifi״̬»Øµ÷º¯Êý
* @param (out) ÎÞ
* @return 0 - ³É¹¦
* ÆäËûʧ°Ü
- * @note ÎÞ
+ * @note ͬ²½½Ó¿Ú
*
*/
int sc_wifi_set_enable_status_ind_cb(sc_wifi_enable_status_ind_cb_f cb);
@@ -387,7 +398,8 @@
* @param (out) ÎÞ
* @return 0 - ³É¹¦
* ÆäËûʧ°Ü
- * @note ÐèÔÚsc_wifi_ap_startǰÉèÖÃ
+ * @note ÐèÔÚsc_wifi_ap_start/sc_wifi_sta_startǰÉèÖÃ
+ * Òì²½½Ó¿Ú
*
*/
int sc_wifi_work_mode_set(sc_wifi_work_mode_e mode);
@@ -398,7 +410,7 @@
* @param (out) p_mode: µ±Ç°wifi¹¤×÷ģʽ
* @return 0 - ³É¹¦
* ÆäËûʧ°Ü
- * @note ÎÞ
+ * @note ͬ²½½Ó¿Ú
*
*/
int sc_wifi_work_mode_get(sc_wifi_work_mode_e *p_mode);
@@ -412,6 +424,7 @@
* ÆäËûʧ°Ü
* @note SSID²»¿É³¬¹ý32×Ö½Ú,ÇÒ²»Îª¿Õ,²»º¬ÌØÊâ×Ö·û
* ÐèÔÚsc_wifi_ap_startǰÉèÖÃ
+ * Òì²½½Ó¿Ú
*/
int sc_wifi_ap_ssid_set(sc_wifi_ap_index_e idx, const char *ssid);
@@ -424,6 +437,7 @@
* ÆäËûʧ°Ü
* @note ĬÈϲ»Òþ²Ø
* ÐèÔÚsc_wifi_ap_startǰÉèÖÃ
+ * Òì²½½Ó¿Ú
*/
int sc_wifi_ap_ssid_hidden_set(sc_wifi_ap_index_e idx, int ssid_hidden);
@@ -435,6 +449,7 @@
* @return 0 - ³É¹¦
* ÆäËûʧ°Ü
* @note ÐèÔÚsc_wifi_ap_startǰÉèÖÃ
+ * Òì²½½Ó¿Ú
*
*/
int sc_wifi_ap_mode_set(sc_wifi_ap_index_e idx, sc_wifi_ap_mode_type_e mode);
@@ -447,6 +462,7 @@
* @return 0 - ³É¹¦
* ÆäËûʧ°Ü
* @note ÐèÔÚsc_wifi_ap_startǰÉèÖÃ
+ * Òì²½½Ó¿Ú
*
*/
int sc_wifi_ap_bandwidth_set(sc_wifi_ap_index_e idx, sc_wifi_bandwidth_e bandwidth);
@@ -459,6 +475,7 @@
* @return 0 - ³É¹¦
* ÆäËûʧ°Ü
* @note ÐèÔÚsc_wifi_ap_startǰÉèÖÃ
+ * Òì²½½Ó¿Ú
*
*/
int sc_wifi_ap_max_sta_num_set(sc_wifi_ap_index_e idx, int max_sta_num);
@@ -473,6 +490,7 @@
* ÆäËûʧ°Ü
* @note ÐèÔÚsc_wifi_ap_startǰÉèÖÃ
* default CN
+ * Òì²½½Ó¿Ú
*/
int sc_wifi_ap_cc_ch_set(sc_wifi_ap_index_e idx, const char *country_code, int channel);
@@ -484,7 +502,7 @@
* @param (out) ÎÞ
* @return 0 - ³É¹¦
* ÆäËûʧ°Ü
- * @note ÎÞ
+ * @note Òì²½½Ó¿Ú
* mac_list AA:BB:CC:DD:EE:00;AA:BB:CC:DD:EE:01;AA:BB:CC:DD:EE:02
*/
int sc_wifi_ap_acl_set(sc_wifi_ap_index_e idx,
@@ -500,6 +518,7 @@
* ÆäËûʧ°Ü
* @note ÐèÔÚsc_wifi_ap_startǰÉèÖÃ
* ½öÖ§³ÖOPEN¡¢WPA
+ * Òì²½½Ó¿Ú
*/
int sc_wifi_ap_auth_set(sc_wifi_ap_index_e idx, sc_wifi_ap_auth_t *p_auth);
@@ -509,7 +528,7 @@
* @param (out) p_param: º¬ssid¡¢ÊÇ·ñÒþ²Ø¡¢ÐÒéģʽ¡¢´ø¿í¡¢¹ú¼ÒÂë¡¢ÐŵÀ¡¢×î´ó½ÓÈëÊý¡¢ºÚ°×Ãûµ¥¡¢°²È«ÈÏÖ¤ÐÅÏ¢
* @return 0 - ³É¹¦
* ÆäËûʧ°Ü
- * @note ÎÞ
+ * @note ͬ²½½Ó¿Ú
*
*/
int sc_wifi_ap_param_get(sc_wifi_ap_index_e idx, sc_wifi_ap_param_t *p_param);
@@ -520,7 +539,7 @@
* @param (out) ÎÞ
* @return 0 - ³É¹¦
* ÆäËûʧ°Ü
- * @note ÎÞ
+ * @note ͬ²½½Ó¿Ú
*
*/
int sc_wifi_ap_set_status_ind_cb(sc_wifi_ap_status_ind_cb_f cb);
@@ -531,7 +550,7 @@
* @param (out) ÎÞ
* @return 0 - ³É¹¦
* ÆäËûʧ°Ü
- * @note ÎÞ
+ * @note Òì²½½Ó¿Ú
*
*/
int sc_wifi_ap_start(sc_wifi_ap_index_e idx);
@@ -542,7 +561,7 @@
* @param (out) ÎÞ
* @return 0 - ³É¹¦
* ÆäËûʧ°Ü
- * @note ÎÞ
+ * @note Òì²½½Ó¿Ú
*
*/
int sc_wifi_ap_stop(sc_wifi_ap_index_e idx);
@@ -553,7 +572,7 @@
* @param (out) p_stat: ״̬ÐÅÏ¢
* @return 0 - ³É¹¦
* ÆäËûʧ°Ü
- * @note ÎÞ
+ * @note ͬ²½½Ó¿Ú
*
*/
int sc_wifi_ap_get_status(sc_wifi_ap_index_e idx, sc_wifi_ap_status_t *p_stat);
@@ -564,7 +583,7 @@
* @param (out) ÎÞ
* @return 0 - ³É¹¦
* ÆäËûʧ°Ü
- * @note ÎÞ
+ * @note Òì²½½Ó¿Ú
*
*/
int sc_wifi_sta_param_set(sc_wifi_sta_param_t *p_param);
@@ -576,7 +595,7 @@
* @param (out) ÎÞ
* @return 0 - ³É¹¦
* ÆäËûʧ°Ü
- * @note ÎÞ
+ * @note ͬ²½½Ó¿Ú
*
*/
int sc_wifi_sta_param_get(sc_wifi_sta_param_t *p_param);
@@ -588,6 +607,7 @@
* @return 0 - ³É¹¦
* ÆäËûʧ°Ü
* @note STAµÄÁ¬½Ó״̬
+ * ͬ²½½Ó¿Ú
*
*/
int sc_wifi_sta_set_status_ind_cb(sc_wifi_sta_status_ind_cb_f cb);
@@ -598,7 +618,7 @@
* @param (out) ÎÞ
* @return 0 - ³É¹¦
* ÆäËûʧ°Ü
- * @note ÎÞ
+ * @note Òì²½½Ó¿Ú
*
*/
int sc_wifi_sta_start(void);
@@ -609,7 +629,7 @@
* @param (out) ÎÞ
* @return 0 - ³É¹¦
* ÆäËûʧ°Ü
- * @note ÎÞ
+ * @note Òì²½½Ó¿Ú
*
*/
int sc_wifi_sta_stop(void);
@@ -620,7 +640,7 @@
* @param (out) p_sta: ״̬ÐÅÏ¢
* @return 0 - ³É¹¦
* ÆäËûʧ°Ü
- * @note ÎÞ
+ * @note ͬ²½½Ó¿Ú
*
*/
int sc_wifi_sta_get_status(sc_wifi_sta_status_t *p_sta);
@@ -631,7 +651,7 @@
* @param (out) ÎÞ
* @return 0 - ³É¹¦
* ÆäËûʧ°Ü
- * @note ÎÞ
+ * @note Òì²½½Ó¿Ú
*
*/
int sc_wifi_sta_start_scan(void);
@@ -642,7 +662,7 @@
* @param (out) ÎÞ
* @return 0 - ³É¹¦
* ÆäËûʧ°Ü
- * @note ÎÞ
+ * @note ͬ²½½Ó¿Ú
*
*/
int sc_wifi_sta_set_scan_result_ind_cb(sc_wifi_sta_scan_result_ind_cb_f cb);
@@ -653,7 +673,7 @@
* @param (out) ÎÞ
* @return 0 - ³É¹¦
* ÆäËûʧ°Ü
- * @note ÎÞ
+ * @note ͬ²½½Ó¿Ú
*
*/
int sc_wifi_set_service_error_cb(sc_wifi_service_error_cb_f cb);
@@ -664,7 +684,7 @@
* @param (out) ÎÞ
* @return 0 - ³É¹¦
* ÆäËûʧ°Ü
- * @note ÎÞ
+ * @note ͬ²½½Ó¿Ú
*
*/
int sc_wifi_set_ap_sta_connect_ind_cb(sc_wifi_ap_sta_connect_ind_cb_f cb);
@@ -676,7 +696,7 @@
* @param (out) hostname: ²éѯµ½µÄhostname´æÈë¸Ã»º´æ
* @return 1 - ³É¹¦
* ÆäËûʧ°Ü
- * @note ÎÞ
+ * @note ͬ²½½Ó¿Ú
*
*/
int sc_wifi_get_hostname_by_mac(char *mac_str, char *hostname, int len);
@@ -688,7 +708,7 @@
* list: lanhostÁÐ±í»º´æ
* @return 0 - ³É¹¦
* ÆäËûʧ°Ü
- * @note ÎÞ
+ * @note ͬ²½½Ó¿Ú
*
*/
int sc_wifi_lanhost_get_list(sc_lanhost_t *list, int *list_len);
@@ -699,7 +719,7 @@
* @param (out) sta_info£ºÒÑÁ¬½ÓstaµÄÐÅÏ¢
* @return 0 - ³É¹¦
* ÆäËûʧ°Ü
- * @note ÎÞ
+ * @note ͬ²½½Ó¿Ú
*
*/
int sc_wifi_ap_sta_info_get(sc_wifi_ap_index_e idx, sc_wifi_ap_sta_info_t *sta_info);
@@ -710,7 +730,7 @@
* @param (out)
* @return 0 - ³É¹¦
* ÆäËûʧ°Ü
- * @note ÎÞ
+ * @note Òì²½½Ó¿Ú
*
*/
int sc_wifi_sleep(void);
@@ -721,7 +741,7 @@
* @param (out)
* @return 0 - ³É¹¦
* ÆäËûʧ°Ü
- * @note ÎÞ
+ * @note Òì²½½Ó¿Ú
*
*/
int sc_wifi_wakeup(void);
@@ -732,7 +752,7 @@
* @param (out) p_sleep: ÊÇ·ñÐÝÃßµÄ״̬ÐÅÏ¢(1 ÐÝÃß, 0 ·ÇÐÝÃß)
* @return 0 - ³É¹¦
* ÆäËûʧ°Ü
- * @note ÎÞ
+ * @note ͬ²½½Ó¿Ú
*
*/
int sc_wifi_get_sleep_stats(int *p_sleep);
@@ -743,7 +763,7 @@
* @param (out) p_stat: ͳ¼ÆÐÅÏ¢
* @return 0 - ³É¹¦
* ÆäËûʧ°Ü
- * @note ÎÞ
+ * @note ͬ²½½Ó¿Ú
*
*/
int sc_wifi_get_ap_pkt_stats(sc_wifi_ap_index_e idx, sc_wifi_pkt_stats_t *p_stat);
@@ -754,7 +774,7 @@
* @param (out) p_stat: ͳ¼ÆÐÅÏ¢
* @return 0 - ³É¹¦
* ÆäËûʧ°Ü
- * @note ÎÞ
+ * @note ͬ²½½Ó¿Ú
*
*/
int sc_wifi_get_sta_pkt_stats(sc_wifi_pkt_stats_t *p_stat);
@@ -769,6 +789,7 @@
* ÆäËûʧ°Ü
* @note ½öÓÃÓÚ²âÊÔģʽ,ÓëÆäËûapi½Ó¿Ú³åÍ»,Õý³£Ä£Ê½ÏÂÇÐÎðµ÷ÓÃ!
* ÇÒÈ·±£wifiоƬÉϵçºóÖ±½ÓÖ´ÐвâÊÔģʽ£¬Í¬Ê±Õý³£Ä£Ê½´¦ÓڹرÕ״̬!
+ * Òì²½½Ó¿Ú
*
*/
int sc_wifi_drv_test_mode(int is_enable);
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 5de753a..8745709 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
@@ -612,9 +612,9 @@
}
sc_ipc_terminate_loop();
- //zw.wang If the customer switches the WIFI repeatedly, the WiFi will be stuck, and the AT can not be used on 20240821 on start
+
scwifi_ctx.have_init = 0;
- //zw.wang If the customer switches the WIFI repeatedly, the WiFi will be stuck, and the AT can not be used on 20240821 on end
+
SCLOGI("wifi uninit suc!\n");
return 0;
}
@@ -688,6 +688,48 @@
return ret;
}
+/* Started by AICoder, pid:k86085d52ao7e6014a38084150c59234c693fdf8 */
+int sc_wifi_get_enable_status(sc_wifi_enable_status_e *p_status)
+{
+ sc_ipc_msg *conn_req_msg = NULL;
+ sc_ipc_msg *conn_rsp_msg = NULL;
+
+ scwifi_enable_res_t *data_res = NULL;
+ int ret = SC_ERR_FAIL;
+
+ if (p_status == NULL) {
+ SCLOGE("sc_wifi_get_enable_status p_status is NULL!\n");
+ return SC_ERR_BADPARAM;
+ }
+
+ conn_req_msg = scwifi_ipcmsg_set(SCWIFI_GET_ENABLE_REQ, SCWIFI_GET_ENABLE_RSP, 1, NULL, 0);
+ if(NULL == conn_req_msg) {
+ SCLOGE("sc_wifi_get_enable_status no memory!\n");
+ return SC_ERR_NO_MEMORY;
+ }
+
+ if(0 != sc_ipc_send_msg_wait_rsp(conn_req_msg, &conn_rsp_msg)) {
+ SCLOGE("sc_wifi_get_enable_status msg fail!\n");
+ ret = SC_ERR_IPC;
+ }
+ else {
+ data_res = (scwifi_mode_res_t *)conn_rsp_msg->data;
+ ret = data_res->result;
+ if(SC_ERR_SUCCESS == ret) {
+ *p_status = data_res->wifi_status;//transe_work_mode_out
+ }
+ else {
+ SCLOGE("sc_wifi_get_enable_status fail: %d!\n", ret);
+ }
+ }
+
+ scwifi_ipcmsg_free(conn_req_msg);
+ scwifi_ipcmsg_free(conn_rsp_msg);
+
+ return ret;
+}
+/* Ended by AICoder, pid:k86085d52ao7e6014a38084150c59234c693fdf8 */
+
int sc_wifi_set_enable_status_ind_cb(sc_wifi_enable_status_ind_cb_f cb)
{
//when recvmsg, call cb
@@ -835,7 +877,7 @@
SCLOGE("sc_wifi_ap_ssid_set ssid too long:%s\n", ssid);
return SC_ERR_BADPARAM;
}
-#if 0 //[wifi] The hotspot whose ssid is Chinese or special characters cannot be connected on 20240830
+#if 0 //zw.wang@20240830 [wifi] The hotspot whose ssid is Chinese or special characters cannot be connected on 20240830
for (i = 0; i < strlen(ssid); i++) {
if (strchr("`$&*\\[];:\'\"<>,",ssid[i]) || !isprint(ssid[i])) {
SCLOGE("sc_wifi_ap_ssid_set invalid ssid:%s\n", ssid);
@@ -1899,8 +1941,8 @@
int ret = SC_ERR_FAIL;
int i = 0;
- if (p_param->ssid == NULL || strlen(p_param->ssid) >= WIFI_SSID_LEN) {
- SCLOGE("sta_param_set ssid too long:%s\n", p_param->ssid);
+ if (p_param->ssid == NULL || strlen(p_param->ssid) >= WIFI_SSID_LEN || strlen(p_param->ssid) == 0) {
+ SCLOGE("sta_param_set ssid len error:%s\n", p_param->ssid);
return SC_ERR_BADPARAM;
}
@@ -2644,7 +2686,7 @@
if (idx == SC_WIFI_AP_INDEX_AP0) {
strncpy(iface, "wlan0", sizeof(iface) - 1);
}
- else if (idx == SC_WIFI_AP_INDEX_AP0) {
+ else if (idx == SC_WIFI_AP_INDEX_AP1) {
strncpy(iface, "wlan0", sizeof(iface) - 1);
}
get_iface_pkt_stats(iface, p_stat);
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/optee/optee-client/tee-supplicant/src/tee_supp_fs.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/optee/optee-client/tee-supplicant/src/tee_supp_fs.c
index 09ac81f..7598bd1 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/optee/optee-client/tee-supplicant/src/tee_supp_fs.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/optee/optee-client/tee-supplicant/src/tee_supp_fs.c
@@ -271,6 +271,7 @@
return TEEC_ERROR_BAD_PARAMETERS;
fd = params[0].u.value.b;
+ fsync(fd);
while (close(fd)) {
if (errno != EINTR)
return TEEC_ERROR_GENERIC;
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/vb_demo/Makefile b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/vb_demo/Makefile
new file mode 100755
index 0000000..23ff649
--- /dev/null
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/vb_demo/Makefile
@@ -0,0 +1,33 @@
+include $(COMMON_MK)
+
+EXEC = vb_demo
+OBJS = vb_demo.o
+
+CFLAGS += -I.
+CFLAGS += -I./inc
+CFLAGS += -I$(APP_DIR)/include
+
+
+CFLAGS += -g
+CFLAGS += -g -Werror=implicit-function-declaration
+
+LDLIBS += -lpthread
+LDLIBS += -lvoice -L$(LIB_DIR)/libvoice
+LDLIBS += -lmedia -L$(LIB_DIR)/libmedia
+
+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/vb_demo/vb_demo.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/vb_demo/vb_demo.c
new file mode 100755
index 0000000..81d15e5
--- /dev/null
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/test/vb_demo/vb_demo.c
@@ -0,0 +1,734 @@
+#ifdef USE_CAP_SUPPORT
+#include <stdio.h>
+#include <unistd.h>
+#include <string.h>
+#include <stdlib.h>
+#include <stdint.h>
+#include <sys/ioctl.h>
+#include <fcntl.h>
+#include "voice_ipc.h"
+#include "voice_lib.h"
+#include <fcntl.h>
+#include <signal.h>
+#include <semaphore.h>
+#include <sys/types.h>
+#include <pthread.h>
+
+/*command max len*/
+#define VOICE_CMD_MAX_LEN 64
+
+#define EXIT_CMD_STOP "stop\n"
+#define EXIT_CMD_Q "q\n"
+#define EXIT_CMD_EXIT "exit\n"
+
+
+#define REQ_VOICE_BUFFER_TEST_START "voice_buffer_test_start"
+#define REQ_VOICE_BUFFER_TEST_STOP "voice_buffer_test_stop"
+#define REQ_VOICE_BUFFER_LOOP_TEST_START "voice_buffer_loop_test_start"
+#define REQ_VOICE_BUFFER_LOOP_TEST_STOP "voice_buffer_loop_test_stop"
+
+
+#define VBUFFER_TX_FILE_NAME "/mnt/userdata/tx.pcm"
+#define VBUFFER_RX_FILE_NAME "/mnt/userdata/rx.pcm"
+#define VBUFFER_TX16_FILE_NAME "/mnt/userdata/tx16.pcm"
+#define VBUFFER_RX16_FILE_NAME "/mnt/userdata/rx16.pcm"
+
+
+#define VB_MAX_INT 0x7fffffff
+#define VB_MIN_INT 0
+#define VB_INT_OVERFLOW(x) if((x < VB_MIN_INT)||(x > VB_MAX_INT)) x = 0;
+
+#define RX_FILE_LEN_MAX 0x100000
+typedef int (vb_thread_proc)(void*);
+struct vbuf_info_t
+{
+ int fd;
+ pthread_t rx_test_thread;
+ pthread_t tx_test_thread;
+ pthread_t loop_test_thread;
+ int quit;
+ char *tx_buf;
+ char *rx_buf;
+ int buf_size;
+ char *tx_filename;
+ char *rx_filename;
+ FILE *tx_file;
+ FILE *rx_file;
+ int tx_filesize;
+ int rx_filesize;
+ int fs;
+};
+
+static struct vbuf_info_t vbuf_rec = {0};
+
+static void printUsage(const char *Opt)
+{
+ printf("Usage: %s\n", Opt);
+
+ printf("voice_buffer_test_start value: 8000,16000\n");
+ printf("voice_buffer_test_stop no value input\n");
+ printf("voice_buffer_loop_test_start value: 8000,16000\n");
+ printf("voice_buffer_loop_test_stop no value input\n");
+ printf("\n");
+}
+
+static int vbuffer_start_flag = 0;
+static int tx_optcount = 0;
+static int rx_optcount = 0;
+static int first_rderr_flag = 0;
+static int first_wrerr_flag = 0;
+
+
+
+//whole rx path
+static int vb_rx_test_thread_func(void *arg)
+{
+ int ret;
+
+ char* buf = vbuf_rec.rx_buf;
+ int size = vbuf_rec.buf_size;
+ int bytes_read = 0;
+ int r_size;
+
+
+ printf( "%s: start size=%d! \n",__func__,size);
+ memset (buf,0, size);
+
+ while (!vbuf_rec.quit)
+ {
+ rx_optcount ++;
+ VB_INT_OVERFLOW(rx_optcount);
+ if((rx_optcount%1000) == 0){
+ printf("%s: rx_optcount=%d! \n",__func__,rx_optcount);
+
+ }
+ else if(rx_optcount == 1000000){
+ printf("%s: rx_optcount=%d! \n",__func__,rx_optcount);
+ rx_optcount = 0;
+
+ }
+
+ //read form ps
+ r_size = voice_buffer_read(vbuf_rec.fd, buf, size);
+ if(r_size <= 0)
+ {
+ first_rderr_flag++;
+ VB_INT_OVERFLOW(first_rderr_flag);
+ continue ;
+ }
+ else{
+ first_rderr_flag = 0;
+
+ }
+
+ if(vbuf_rec.rx_file != NULL)
+ {
+ r_size = fwrite(buf, 1,size, vbuf_rec.rx_file);
+
+ if (r_size != size) {
+ //printf("Error fwrite size not eq,r_size=%d,size=%d\n",r_size,size);
+ }
+ else{
+
+ bytes_read += size;
+ if(bytes_read >= vbuf_rec.rx_filesize){
+ fseek(vbuf_rec.rx_file, 0, SEEK_SET);
+ bytes_read = 0;
+ printf("fwrite over write maxsize(%d)!!!\n",vbuf_rec.rx_filesize);
+
+ }
+ }
+ }
+
+
+ }
+
+ return 0;
+}
+
+static int vb_tx_test_thread_func(void *arg)
+{
+ int ret;
+ int num_read;
+
+
+ char* buf = vbuf_rec.tx_buf;
+
+ int size = vbuf_rec.buf_size;
+ int w_size;
+
+ printf("%s: start size=%d! \n",__func__,size);
+
+
+ memset(buf, 0,size);
+ while (!vbuf_rec.quit)
+ {
+
+ if(vbuf_rec.tx_file != NULL)
+ {
+
+ num_read = fread(buf,1,size, vbuf_rec.tx_file);
+
+ if (num_read != size) {
+ //printf("Error fread size not eq,num_read=%d,size=%d\n",num_read,size);
+ }
+ if (num_read <= 0) {
+ printf("Error fread size not eq,num_read=%d,size=%d\n",num_read,size);
+ fseek(vbuf_rec.tx_file, 0, SEEK_SET);
+ }
+ }
+ tx_optcount ++;
+ VB_INT_OVERFLOW(tx_optcount);
+
+ w_size = voice_buffer_write(vbuf_rec.fd, buf, size);
+ if(w_size <= 0)
+ {
+ first_wrerr_flag++;
+
+ VB_INT_OVERFLOW(first_wrerr_flag);
+
+ continue;
+ }
+ else{
+ first_wrerr_flag = 0;
+
+ }
+
+ }
+ return 0;
+}
+
+
+static int vb_thread_create( const char *name,pthread_t *thread_t, vb_thread_proc *proc,
+ int stack_size, unsigned priority,void *arg )
+{
+ pthread_attr_t thread_attr;
+ int ret;
+ int default_size;
+
+ struct sched_param param;
+ int policy = SCHED_FIFO;
+
+ printf("%s: start! \n",__func__);
+
+ /* Init thread attributes */
+ pthread_attr_init(&thread_attr);
+ /* Create the thread. */
+
+ ret = pthread_create( thread_t, &thread_attr,proc, arg);
+ if (ret != 0)
+ {
+ printf("%s: pthread_create fail,ret=%d! \n",__func__,ret);
+
+ pthread_attr_destroy(&thread_attr);
+ return ret;
+ }
+
+ pthread_attr_getstacksize(&thread_attr, &default_size);
+ printf("%s: pthread_attr_getstacksize(%d)! \n",__func__,default_size);
+
+ pthread_attr_destroy(&thread_attr);
+
+ printf("%s: end \n",__func__);
+ return 0;
+}
+
+
+int voice_buffer_stream_test_start(int fs)
+{
+ int ret = 0;
+ int buf_size = 320;
+ tx_optcount = 0;
+ rx_optcount = 0;
+ int* buf_int;
+
+ int i;
+
+ if(vbuffer_start_flag == 1){
+ printf(" VB already start,return \n");
+
+ return 0;
+ }
+
+ vbuffer_start_flag = 1;
+
+
+
+ if((vbuf_rec.fd != -1)&&(vbuf_rec.fd != 0)){
+ printf(" VB fd already get, vbuf_rec.fd=%d return \n",vbuf_rec.fd);
+ }
+
+ if(fs == 8000){
+
+ buf_size = 320;
+ }
+ else if(fs == 16000){
+
+ buf_size = 640;
+ }
+ else
+ {
+ buf_size = 320;
+ }
+ printf("Starting vb stream fs=%d buf_size=%d \n",fs,buf_size);
+
+ printf("%s:open tx and rx file \n",__func__);
+ if(fs == 8000){
+
+ vbuf_rec.tx_filename = VBUFFER_TX_FILE_NAME;//"/cache/tx.pcm";
+ vbuf_rec.rx_filename = VBUFFER_RX_FILE_NAME;//"/cache/rx.pcm";
+
+ }
+ else if(fs == 16000){
+
+ vbuf_rec.tx_filename = VBUFFER_TX16_FILE_NAME;//"/cache/tx16.pcm";
+ vbuf_rec.rx_filename = VBUFFER_RX16_FILE_NAME;//"/cache/rx16.pcm";
+
+ }
+ else
+ {
+ vbuf_rec.tx_filename = VBUFFER_TX_FILE_NAME;//"/cache/tx.pcm";
+ vbuf_rec.rx_filename = VBUFFER_RX_FILE_NAME;//"/cache/rx.pcm";
+
+ }
+
+
+
+
+ vbuf_rec.tx_file = fopen(vbuf_rec.tx_filename , "rb");
+ if (!vbuf_rec.tx_file) {
+ printf("Unable to open file '%s'\n", vbuf_rec.tx_filename);
+ //return -1;
+ }
+
+
+ vbuf_rec.rx_file = fopen(vbuf_rec.rx_filename, "wb");
+ if (!vbuf_rec.rx_file) {
+ printf(stderr, "Unable to create file '%s'\n", vbuf_rec.rx_filename);
+ //fclose(vbuf_rec.tx_file);
+
+ //return -1;
+ }
+ vbuf_rec.rx_filesize = RX_FILE_LEN_MAX;
+ printf("%s : vbuf_rec.rx_filesize(%d) \n",__func__,vbuf_rec.rx_filesize);
+
+ vbuf_rec.rx_buf = (char*) malloc(buf_size);
+ if(!vbuf_rec.rx_buf) {
+ printf("%s : malloc buf fail,return \n",__func__);
+ return -1;
+ }
+ vbuf_rec.tx_buf = (char*) malloc(buf_size);
+ if(!vbuf_rec.tx_buf) {
+ free(vbuf_rec.rx_buf);
+ printf("%s : malloc buf fail,return \n",__func__);
+ vbuf_rec.rx_buf = NULL;
+ return -1;
+ }
+ vbuf_rec.buf_size = buf_size;
+
+ vbuf_rec.quit = 0;
+
+ printf("%s : vb open start \n",__func__);
+
+
+ vbuf_rec.fd = voice_buffer_open();
+ if(vbuf_rec.fd <= 0){
+ printf("%s : vb open fail fd=%d,return \n",__func__,vbuf_rec.fd);
+ ret = -1;
+ goto err;
+
+ }
+ printf("%s :voice_buffer_open end \n",__func__);
+
+ printf("%s :rx tx vb_thread_create start \n",__func__);
+ ret = vb_thread_create ("vb_playback_test",&vbuf_rec.rx_test_thread, vb_rx_test_thread_func,
+ 4*1024,35,NULL);
+ if (ret != 0)
+ {
+ printf("%s :rx vb_thread_create fail ret=%d,return \n",__func__,ret);
+ goto err;
+ }
+
+ printf("%s :rx vb_thread_create end \n",__func__);
+
+ ret = vb_thread_create ( "vbuf_record_test", &vbuf_rec.tx_test_thread, vb_tx_test_thread_func,
+ 4*1024,35,NULL);
+ if (ret != 0)
+ {
+
+ printf("%s :tx vb_thread_create fail ret=%d,return \n",__func__,ret);
+ vbuf_rec.quit = 1;
+ pthread_join(vbuf_rec.rx_test_thread,NULL);
+ vbuf_rec.rx_test_thread = NULL;
+ goto err;
+ }
+ printf("%s :tx vb_thread_create end \n",__func__);
+
+ return 0;
+
+err:
+ free(vbuf_rec.rx_buf);
+ vbuf_rec.rx_buf = NULL;
+ free(vbuf_rec.tx_buf);
+ vbuf_rec.tx_buf = NULL;
+
+ fclose(vbuf_rec.tx_file);
+ vbuf_rec.tx_file = NULL;
+ fclose(vbuf_rec.rx_file);
+ vbuf_rec.rx_file = NULL;
+
+ return ret;
+}
+
+
+//Stop stream
+int voice_buffer_stream_test_stop(void)
+{
+ int ret = 0;
+ printf("%s:rx tx thread exit start \n",__func__);
+ if(vbuf_rec.quit == 1) {
+ printf("%s,already stop ,return\n",__func__);
+
+ }
+
+ vbuf_rec.quit = 1;
+ voice_buffer_stop(vbuf_rec.fd);
+ if (vbuf_rec.tx_test_thread)
+ {
+ pthread_join (vbuf_rec.tx_test_thread,NULL);
+ vbuf_rec.tx_test_thread = NULL;
+
+ }
+
+ if (vbuf_rec.rx_test_thread)
+ {
+ pthread_join (vbuf_rec.rx_test_thread,NULL);
+ vbuf_rec.rx_test_thread = NULL;
+ }
+
+ printf("voice_buffer_close start \n");
+ ret = voice_buffer_close(vbuf_rec.fd);
+ if(ret != 0)
+ {
+ printf("%s : vb close fail \n",__func__);
+ }
+ vbuf_rec.fd = -1;
+
+ if(vbuf_rec.tx_file != NULL)
+ {
+ fclose(vbuf_rec.tx_file);
+ printf("%s : vb close ,close tx file \n",__func__);
+ vbuf_rec.tx_file = NULL;
+ }
+
+ if(vbuf_rec.rx_file != NULL)
+ {
+
+ fclose(vbuf_rec.rx_file);
+ printf("%s : vb close ,close rx file \n",__func__);
+ vbuf_rec.rx_file = NULL;
+
+ }
+
+ free(vbuf_rec.rx_buf);
+ vbuf_rec.rx_buf = NULL;
+
+ free(vbuf_rec.tx_buf);
+ vbuf_rec.tx_buf = NULL;
+
+
+ vbuffer_start_flag = 0;
+ printf("Stopping vb stream end\n");
+ return 0;
+}
+
+
+static int vb_loop_test_thread_func(void *arg)
+{
+ int ret;
+
+ char* buf = vbuf_rec.rx_buf;
+ int size = vbuf_rec.buf_size;
+
+ //char* buf = vbuf_rec.tx_buf;
+
+ //int size = vbuf_rec.buf_size;
+ int w_size;
+ int r_size;
+
+
+ printf( "%s: start size=%d! \n",__func__,size);
+ memset (buf,0, size);
+
+ while (!vbuf_rec.quit)
+ {
+ rx_optcount ++;
+ VB_INT_OVERFLOW(rx_optcount);
+ if((rx_optcount%1000) == 0){
+ printf("%s: rx_optcount=%d! \n",__func__,rx_optcount);
+
+ }
+ else if(rx_optcount == 1000000){
+ printf("%s: rx_optcount=%d! \n",__func__,rx_optcount);
+ rx_optcount = 0;
+
+ }
+
+ //read form ps
+ r_size = voice_buffer_read(vbuf_rec.fd, vbuf_rec.rx_buf, size);
+ if(r_size <= 0)
+ {
+ first_rderr_flag++;
+ VB_INT_OVERFLOW(first_rderr_flag);
+ continue ;
+ }
+ else{
+ first_rderr_flag = 0;
+ }
+ memcpy(vbuf_rec.tx_buf,vbuf_rec.rx_buf,size);
+ w_size = voice_buffer_write(vbuf_rec.fd, vbuf_rec.tx_buf, size);
+ if(w_size <= 0)
+ {
+ first_wrerr_flag++;
+
+ VB_INT_OVERFLOW(first_wrerr_flag);
+
+ continue;
+ }
+ else{
+ first_wrerr_flag = 0;
+ }
+
+ }
+
+ return 0;
+}
+
+
+int voice_buffer_stream_loop_test_start(int fs)
+{
+ int ret = 0;
+ int buf_size = 320;
+ tx_optcount = 0;
+ rx_optcount = 0;
+ int* buf_int;
+
+ int i;
+
+ if(vbuffer_start_flag == 1){
+ printf(" VB already start,return \n");
+
+ return 0;
+ }
+
+ if((vbuf_rec.fd != -1)&&(vbuf_rec.fd != 0)){
+ printf(" VB fd already get, vbuf_rec.fd=%d return \n",vbuf_rec.fd);
+ }
+
+ vbuffer_start_flag = 1;
+
+ if(fs == 8000){
+
+ buf_size = 320;
+ }
+ else if(fs == 16000){
+
+ buf_size = 640;
+ }
+ else
+ {
+ buf_size = 320;
+ }
+ printf("Starting vb stream fs=%d buf_size=%d \n",fs,buf_size);
+
+ vbuf_rec.rx_buf = (char*) malloc(buf_size);
+ if(!vbuf_rec.rx_buf) {
+ printf("%s : malloc buf fail,return \n",__func__);
+ return -1;
+ }
+ vbuf_rec.tx_buf = (char*) malloc(buf_size);
+ if(!vbuf_rec.tx_buf) {
+ free(vbuf_rec.rx_buf);
+ printf("%s : malloc buf fail,return \n",__func__);
+ vbuf_rec.rx_buf = NULL;
+ return -1;
+ }
+ vbuf_rec.buf_size = buf_size;
+
+ vbuf_rec.quit = 0;
+
+ printf("%s : vb open start \n",__func__);
+
+
+ vbuf_rec.fd = voice_buffer_open();
+ if(vbuf_rec.fd <= 0){
+ printf("%s : vb open fail fd=%d,return \n",__func__,vbuf_rec.fd);
+ ret = -1;
+ goto err;
+
+ }
+ printf("%s :loop vb_thread_create start \n",__func__);
+ ret = vb_thread_create ("vb_playback_test",&vbuf_rec.loop_test_thread, vb_loop_test_thread_func,
+ 4*1024,35,NULL);
+ if (ret != 0)
+ {
+ printf("%s :rx vb_thread_create fail ret=%d,return \n",__func__,ret);
+ goto err;
+ }
+
+ printf("%s :rx vb_thread_create end \n",__func__);
+
+ return 0;
+
+err:
+ free(vbuf_rec.rx_buf);
+ vbuf_rec.rx_buf = NULL;
+ free(vbuf_rec.tx_buf);
+ vbuf_rec.tx_buf = NULL;
+
+ return ret;
+}
+
+int voice_buffer_stream_loop_test_stop(void)
+{
+ int ret = 0;
+ printf("%s:loop thread exit start \n",__func__);
+ if(vbuf_rec.quit == 1) {
+ printf("%s,already stop ,return\n",__func__);
+
+ }
+
+ vbuf_rec.quit = 1;
+ voice_buffer_stop(vbuf_rec.fd);
+ if (vbuf_rec.loop_test_thread)
+ {
+ pthread_join (vbuf_rec.loop_test_thread,NULL);
+ vbuf_rec.tx_test_thread = NULL;
+
+ }
+
+ printf("voice_buffer_close start \n");
+ ret = voice_buffer_close(vbuf_rec.fd);
+ if(ret != 0)
+ {
+ printf("%s : vb close fail \n",__func__);
+ }
+ vbuf_rec.fd = -1;
+ free(vbuf_rec.rx_buf);
+ vbuf_rec.rx_buf = NULL;
+
+ free(vbuf_rec.tx_buf);
+ vbuf_rec.tx_buf = NULL;
+
+
+ vbuffer_start_flag = 0;
+ printf("Stopping vb stream end\n");
+ return 0;
+}
+
+
+
+void voice_buffer_cmd_proc(char *cmdstr)
+{
+ int ret = 0;
+ char data[VOICE_CMD_MAX_LEN];
+ int cmdstr_len = strlen(cmdstr) -1; //-strlen("\r")
+ int value = 0;
+ int *p_value = &value;
+
+ cmdstr[cmdstr_len] = '\0'; //+strlen("\0")
+
+ ret = sscanf(cmdstr, "%s", data);
+ if(1 != ret){
+ printf("data sscanf failed!(%d)\n", ret);
+ return;
+ }
+ if(0 == strncmp(data, REQ_VOICE_BUFFER_TEST_START, strlen(REQ_VOICE_BUFFER_TEST_START))){
+
+ ret = sscanf(cmdstr, "%*s %d", &value);
+ if(1 != ret){
+ printf("%s,value sscanf failed!(%d)\n",data, ret);
+ return;
+ }
+
+ printf("%s set value %d\n", data, value);
+ ret = voice_buffer_stream_test_start(value);
+
+ printf("%s return ret=%d\n", data, ret);
+
+ }
+ else if(0 == strncmp(data, REQ_VOICE_BUFFER_TEST_STOP, strlen(REQ_VOICE_BUFFER_TEST_STOP))){
+ ret = voice_buffer_stream_test_stop();
+ printf("%s return %d\n", data, ret);
+ }
+ else if(0 == strncmp(data, REQ_VOICE_BUFFER_LOOP_TEST_START, strlen(REQ_VOICE_BUFFER_LOOP_TEST_START))){
+
+ ret = sscanf(cmdstr, "%*s %d", &value);
+ if(1 != ret){
+ printf("%s,value sscanf failed!(%d)\n",data, ret);
+ return;
+ }
+
+ printf("%s set value %d\n", data, value);
+ ret = voice_buffer_stream_loop_test_start(value);
+
+ printf("%s return ret=%d\n", data, ret);
+
+ }
+ else if(0 == strncmp(data, REQ_VOICE_BUFFER_LOOP_TEST_STOP, strlen(REQ_VOICE_BUFFER_LOOP_TEST_STOP))){
+ printf("voice_buffer_stream_loop_test_stop \n");
+ ret = voice_buffer_stream_loop_test_stop();
+ printf("%s return %d\n", data, ret);
+ }
+
+ else{
+ printf("Request unknow.\n");
+ printUsage(cmdstr);
+ }
+}
+
+void signal_handle_func(int sig)
+{
+ printf("sig(%d) signal_handle_func exit ",sig);
+ exit(0);
+}
+
+int main(int argc, char **argv)
+{
+ char cmdstr[VOICE_CMD_MAX_LEN];
+ printf("voice_demo start\n");
+
+ signal(SIGINT, signal_handle_func);
+ signal(SIGQUIT, signal_handle_func);
+ signal(SIGTERM, signal_handle_func);
+ signal(SIGPIPE, signal_handle_func);
+
+ while(1){
+ memset(cmdstr, 0, VOICE_CMD_MAX_LEN);
+
+ printf("Please input an voice_demo command:\n");
+
+ if(NULL != fgets(cmdstr, VOICE_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;
+ }
+
+ printf("len:%d, cmdstr:%s\n", strlen(cmdstr), cmdstr);
+
+ if(1 >= strlen(cmdstr)){
+ continue;
+ }
+
+ voice_buffer_cmd_proc(cmdstr);
+ }
+ }
+
+ printf("voice_demo end\n");
+
+ return 0;
+}
+
+#endif
+
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 3c0895d..c544c48 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
@@ -318,6 +318,7 @@
ret = vbuffer_stream_test_stop();
printf("%s return %d\n", data, ret);
}
+ #ifdef _VB_TRANSMIT_INTF_RTP
else if(0 == strncmp(data, REQ_VOICE_BUFFER_RTP_TEST_START, strlen(REQ_VOICE_BUFFER_RTP_TEST_START))){
ret = sscanf(cmdstr, "%*s %d", &value);
@@ -339,6 +340,7 @@
ret = vbuffer_rtp_test_stop();
printf("%s return %d\n", data, ret);
}
+#endif
else if(0 == strncmp(data, REQ_VOICE_BUFFER_START, strlen(REQ_VOICE_BUFFER_START))){
ret = sscanf(cmdstr, "%*s %d", &value);
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 93e003d..cfdc186 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
@@ -24,6 +24,9 @@
static int g_userwifi_terminate = 0;
+static int g_wifi_status = 0;
+
+
static void user_wifi_termination_handler(int signum)
{
g_userwifi_terminate = 1;
@@ -44,10 +47,214 @@
sigaction(SIGTERM, &sig_action, NULL);
}
+#if 1 //use get
+/* Started by AICoder, pid:udac2ze245cf4421472a095940a9fc118c39ea7f */
+static int user_wait_enable_status(int timeout)
+{
+ int i = 0;
+ for (i = 0; i < timeout; i++) {
+ int ret = SC_ERR_FAIL;
+ int is_enable = SC_WIFI_STATUS_DISABLED;
+ sleep(1);
+ ret = sc_wifi_get_enable_status(&is_enable);
+ if (ret == SC_ERR_SUCCESS) {
+ if (is_enable == SC_WIFI_STATUS_ENABLED) {
+ return SC_ERR_SUCCESS;//success
+ }
+ else if (is_enable == SC_WIFI_STATUS_DEV_INIT_FAIL || is_enable == SC_WIFI_STATUS_FIRMWARE_CRASH) {
+ return SC_ERR_FAIL;//no device or insmod fail
+ }
+ }
+ }
+ return SC_ERR_BUSY;//timeout
+}
+/* Ended by AICoder, pid:udac2ze245cf4421472a095940a9fc118c39ea7f */
+#else //use cb
+/* Started by AICoder, pid:o5308x696en3f9d1455e0b0f00820212a4f735db */
+static int user_wait_enable_status(int timeout)
+{
+ int i = 0;
+ for (i = 0; i < timeout; i++) {
+ int ret = SC_ERR_FAIL;
+ sleep(1);
+ if (g_wifi_status == SC_WIFI_STATUS_ENABLED) {
+ return SC_ERR_SUCCESS;//success
+ }
+ else if (g_wifi_status == SC_WIFI_STATUS_DEV_INIT_FAIL || g_wifi_status == SC_WIFI_STATUS_FIRMWARE_CRASH) {
+ return SC_ERR_FAIL;//no device or insmod fail
+ }
+ }
+ return SC_ERR_BUSY;//timeout
+}
+/* Ended by AICoder, pid:o5308x696en3f9d1455e0b0f00820212a4f735db */
+#endif
+
+/* Started by AICoder, pid:74f4eq213cq5e4f14ae008fd90ca0d2ba132e33f */
+static int user_wait_disable_status(int timeout)
+{
+ int i = 0;
+ for (i = 0; i < timeout; i++) {
+ int ret = SC_ERR_FAIL;
+ int is_enable = SC_WIFI_STATUS_INVALID_MAC;
+ sleep(1);
+ ret = sc_wifi_get_enable_status(&is_enable);
+ if (ret == SC_ERR_SUCCESS) {
+ if (is_enable == SC_WIFI_STATUS_DISABLED) {
+ return SC_ERR_SUCCESS;//success
+ }
+ else if (is_enable == SC_WIFI_STATUS_DEV_INIT_FAIL || is_enable == SC_WIFI_STATUS_FIRMWARE_CRASH) {
+ return SC_ERR_FAIL;//no device or insmod fail
+ }
+ }
+ }
+ return SC_ERR_BUSY;//timeout
+}
+/* Ended by AICoder, pid:74f4eq213cq5e4f14ae008fd90ca0d2ba132e33f */
+
+/* Started by AICoder, pid:yf6ec5b36a8b25014aaf09a41078f116ab8648d4 */
+static int user_wait_ap_start_status(sc_wifi_ap_index_e idx, int timeout)
+{
+ int i = 0;
+ for (i = 0; i < timeout; i++) {
+ int ret = SC_ERR_FAIL;
+ sc_wifi_ap_status_t stat = {0};
+ sleep(1);
+ ret = sc_wifi_ap_get_status(idx, &stat);
+ if (ret == SC_ERR_SUCCESS) {
+ if (stat.status == SC_WIFI_AP_STATUS_ENABLED) {
+ return SC_ERR_SUCCESS;//success
+ }
+ else if (stat.status == SC_WIFI_AP_STATUS_ERROR) {
+ return SC_ERR_FAIL;//
+ }
+ }
+ }
+ return SC_ERR_BUSY;//timeout
+}
+/* Ended by AICoder, pid:yf6ec5b36a8b25014aaf09a41078f116ab8648d4 */
+
+/* Started by AICoder, pid:i85d44e0d2a216a14cbd0926f02b7811db585336 */
+static int user_wait_sta_start_status(int timeout)
+{
+ int i = 0;
+ for (i = 0; i < timeout; i++) {
+ int ret = SC_ERR_FAIL;
+ sc_wifi_sta_status_t stat = {0};
+ sleep(1);
+ ret = sc_wifi_sta_get_status(&stat);
+ if (ret == SC_ERR_SUCCESS) {
+ if (stat.status == SC_WIFI_STA_STATUS_IDLE) {
+ return SC_ERR_SUCCESS;//success
+ }
+ else if (stat.status == SC_WIFI_STA_STATUS_ERROR && stat.reason_code == SC_WIFI_REASON_CODE_NONE) {
+ return SC_ERR_FAIL;//
+ }
+ }
+ }
+ return SC_ERR_BUSY;//timeout
+}
+/* Ended by AICoder, pid:i85d44e0d2a216a14cbd0926f02b7811db585336 */
+
+/* Started by AICoder, pid:859d5zce96uaa9c142690b656098cd2b10d19e02 */
+static int user_wifi_enable(int timeout)
+{
+ int ret = SC_ERR_FAIL;
+
+ if (timeout <= 0) {
+ printf("[apsta_demo]Invalid timeout value:%d!!!\n", timeout);
+ return SC_ERR_BADPARAM;
+ }
+
+ ret = sc_wifi_enable();
+ if (ret != SC_ERR_SUCCESS) {
+ printf("[apsta_demo]sc_wifi_enable fail:%d!!!\n", ret);
+ return ret;
+ }
+
+ ret = user_wait_enable_status(timeout);
+ if (ret != SC_ERR_SUCCESS) {
+ printf("[apsta_demo]user_wait_enable_status fail:%d!!!\n", ret);
+ }
+ return ret;
+}
+/* Ended by AICoder, pid:859d5zce96uaa9c142690b656098cd2b10d19e02 */
+
+/* Started by AICoder, pid:20d5fe5ad258df314ee80b7b50e53129d2e41f1e */
+static int user_wifi_disable(int timeout)
+{
+ int ret = SC_ERR_FAIL;
+
+ if (timeout <= 0) {
+ printf("[apsta_demo]Invalid timeout value:%d!!!\n", timeout);
+ return SC_ERR_BADPARAM;
+ }
+
+ ret = sc_wifi_disable();
+ if (ret != SC_ERR_SUCCESS) {
+ printf("[apsta_demo]sc_wifi_disable fail:%d!!!\n", ret);
+ return ret;
+ }
+
+ ret = user_wait_disable_status(timeout);
+ if (ret != SC_ERR_SUCCESS) {
+ printf("[apsta_demo]user_wait_disable_status fail:%d!!!\n", ret);
+ }
+ return ret;
+}
+/* Ended by AICoder, pid:20d5fe5ad258df314ee80b7b50e53129d2e41f1e */
+
+/* Started by AICoder, pid:g3acco4ce7be2cf14e620b1040d6bb10c2a949fc */
+static int user_ap_enable(sc_wifi_ap_index_e idx, int timeout)
+{
+ int ret = SC_ERR_FAIL;
+
+ if (timeout <= 0) {
+ printf("[apsta_demo]Invalid timeout value:%d!!!\n", timeout);
+ return SC_ERR_BADPARAM;
+ }
+
+ ret = sc_wifi_ap_start(idx);
+ if (ret != SC_ERR_SUCCESS) {
+ printf("[apsta_demo]sc_wifi_ap_start fail:%d!!!\n", ret);
+ return ret;
+ }
+
+ ret = user_wait_ap_start_status(idx, timeout);
+ if (ret != SC_ERR_SUCCESS) {
+ printf("[apsta_demo]user_wait_ap_start_status fail:%d!!!\n", ret);
+ }
+ return ret;
+}
+/* Ended by AICoder, pid:g3acco4ce7be2cf14e620b1040d6bb10c2a949fc */
+
+/* Started by AICoder, pid:m6053t76a0bfc0914f5e09d5f0ee7b189e973ec0 */
+static int user_sta_enable(int timeout)
+{
+ int ret = SC_ERR_FAIL;
+
+ if (timeout <= 0) {
+ printf("[apsta_demo]Invalid timeout value:%d!!!\n", timeout);
+ return SC_ERR_BADPARAM;
+ }
+
+ ret = sc_wifi_sta_start();
+ if (ret != SC_ERR_SUCCESS) {
+ printf("[apsta_demo]sc_wifi_sta_start fail:%d!!!\n", ret);
+ return ret;
+ }
+
+ ret = user_wait_sta_start_status(timeout);
+ if (ret != SC_ERR_SUCCESS) {
+ printf("[apsta_demo]user_wait_sta_start_status fail:%d!!!\n", ret);
+ }
+ return ret;
+}
+/* Ended by AICoder, pid:m6053t76a0bfc0914f5e09d5f0ee7b189e973ec0 */
//demo ÕâЩ»Øµ÷ɶҲû¸É,°´Êµ¼ÊÒµÎñÐèÇó´¦Àí
static void user_status_cb(sc_wifi_enable_status_e pre_status, sc_wifi_enable_status_e status)
{
+ g_wifi_status = status;
printf("[apsta_demo]user_status_cb:%d,%d\n", pre_status, status);
}
@@ -230,18 +437,15 @@
user_wifi_install_signal_handler();
user_wifi_init();
-
- for (i = 0; i < 30; i++) {
- ret = sc_wifi_enable();
- if (ret != SC_ERR_NOT_READY)
- break;
- sleep(2);
- }
+
+ /* Started by AICoder, pid:ra837f7d8026351142c309a540c1400c4667a6e7 */
+ ret = user_wifi_enable(5);
if (ret != SC_ERR_SUCCESS) {
sc_wifi_uninit();
- printf("[apsta_demo]sc_wifi_enable fail:%d!!!\n", ret);
+ printf("[apsta_demo]user_wifi_enable fail:%d!!!\n", ret);
return 0;
}
+ /* Ended by AICoder, pid:ra837f7d8026351142c309a540c1400c4667a6e7 */
//ap 5G
if ((argc == 2 || argc == 5) && (0 == strcmp(argv[1], "1"))) {
@@ -277,10 +481,18 @@
printf("[apsta_demo]sc_wifi_ap_auth_set ret:%d\n", ret);
#endif
+ /* Started by AICoder, pid:78ba3f2faez368c1487e09f2009fa10d27b7236c */
//Ðèͨ¹ýsc_wifi_ap_set_status_ind_cb¼à¿ØÊµ¼ÊÖ´ÐÐ״̬
//¿Éͨ¹ýsc_wifi_set_ap_sta_connect_ind_cb¼à¿ØstasµÄ½ÓÈëÍ˳öÇé¿ö
- ret = sc_wifi_ap_start(SC_WIFI_AP_INDEX_AP1);
- printf("[apsta_demo]sc_wifi_ap_start ret:%d\n", ret);
+ ret = user_ap_enable(SC_WIFI_AP_INDEX_AP1, 5);
+ if (ret != SC_ERR_SUCCESS) {
+ printf("[apsta_demo]user_ap_enable fail:%d!!!\n", ret);
+ user_wifi_disable(5);
+ sc_wifi_uninit();
+ return 0;
+ }
+ printf("[apsta_demo]user_ap_enable succ\n");
+ /* Ended by AICoder, pid:78ba3f2faez368c1487e09f2009fa10d27b7236c */
}
else {//ap 2.4G
ret = sc_wifi_work_mode_set(SC_WIFI_WORK_MODE_AP0);
@@ -315,10 +527,18 @@
printf("[apsta_demo]sc_wifi_ap_auth_set ret:%d\n", ret);
#endif
+ /* Started by AICoder, pid:78ba3f2faez368c1487e09f2009fa10d27b7236c */
//Ðèͨ¹ýsc_wifi_ap_set_status_ind_cb¼à¿ØÊµ¼ÊÖ´ÐÐ״̬
//¿Éͨ¹ýsc_wifi_set_ap_sta_connect_ind_cb¼à¿ØstasµÄ½ÓÈëÍ˳öÇé¿ö
- ret = sc_wifi_ap_start(SC_WIFI_AP_INDEX_AP0);
- printf("[apsta_demo]sc_wifi_ap_start ret:%d\n", ret);
+ ret = user_ap_enable(SC_WIFI_AP_INDEX_AP0, 5);
+ if (ret != SC_ERR_SUCCESS) {
+ printf("[apsta_demo]user_ap_enable fail:%d!!!\n", ret);
+ user_wifi_disable(5);
+ sc_wifi_uninit();
+ return 0;
+ }
+ printf("[apsta_demo]user_ap_enable succ\n");
+ /* Ended by AICoder, pid:78ba3f2faez368c1487e09f2009fa10d27b7236c */
}
//station
#if 1 //°´Êµ¼ÊÇé¿öÅäÖÃ,¿ÉÔÚSTAÆô¶¯ºóÅä¡£Ö»»á±£´æµ±Ç°Á¬¸öÕâ¸öAPµÄÅäÖÃ
@@ -334,9 +554,19 @@
ret = sc_wifi_sta_param_set(&stat);
printf("[apsta_demo]sc_wifi_sta_param_set ret:%d\n", ret);
+
+ /* Started by AICoder, pid:k3535ef036f3b8c1407a0b6d5071be0138c8bce7 */
//Ðèͨ¹ýsc_wifi_sta_set_status_ind_cb¼à¿ØÊµ¼ÊÖ´ÐÐ״̬¡£
- ret = sc_wifi_sta_start();
- printf("[apsta_demo]sc_wifi_sta_start ret:%d\n", ret);
+ ret = user_sta_enable(5);
+ if (ret != SC_ERR_SUCCESS) {
+ printf("[apsta_demo]user_sta_enable fail:%d!!!\n", ret);
+ user_wifi_disable(5);
+ sc_wifi_uninit();
+ return 0;
+ }
+ printf("[apsta_demo]user_sta_enable succ\n");
+ /* Ended by AICoder, pid:k3535ef036f3b8c1407a0b6d5071be0138c8bce7 */
+
//Èç¹ûûÓÐsc_wifi_sta_param_setÉèÖÃÈȵã,Õâʱ¿Éµ÷ÓÃɨÃè½Ó¿Úsc_wifi_sta_start_scan»ñÈ¡ÖÜΧAPÐÅÏ¢¡£
//´Ó»Øµ÷sc_wifi_sta_set_scan_result_ind_cb»ñÈ¡APºó£¬ÔÙͨ¹ýsc_wifi_sta_param_setÉèÖá£
//sc_wifi_sta_start_scan();
@@ -367,8 +597,8 @@
ret = sc_wifi_ap_stop(SC_WIFI_AP_INDEX_AP0);
printf("[apsta_demo]sc_wifi_ap_stop ret:%d\n", ret);
- ret = sc_wifi_disable();
- printf("[apsta_demo]sc_wifi_disable ret:%d\n", ret);
+ ret = user_wifi_disable(5);
+ printf("[apsta_demo]user_wifi_disable ret:%d\n", ret);
sc_wifi_uninit();
printf("[apsta_demo]test end.\n");
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 702c02c..4c3451d 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
@@ -49,6 +49,7 @@
printf("[wifi_demo]Usage: %s\n", Opt);
printf("wifi_enable\n");
printf("wifi_disable\n");
+ printf("wifi_status_get\n");
printf("wifi_sleep\n");
printf("wifi_wakeup\n");
printf("wifi_sleep_get\n");
@@ -232,6 +233,11 @@
ret = sc_wifi_disable();
printf("[wifi_demo]sc_wifi_disable ret=%d\n", ret);
}
+ else if(0 == strncmp(data, "wifi_status_get", data_len)) {
+ int is_enable = 0;
+ ret = sc_wifi_get_enable_status(&is_enable);
+ printf("[wifi_demo]sc_wifi_get_enable_status ret=%d,is_enable=%d\n", ret, is_enable);
+ }
else if(0 == strncmp(data, "wifi_sleep", data_len)) {
ret = sc_wifi_sleep();
printf("[wifi_demo]sc_wifi_sleep ret=%d\n", ret);