[Realtek]  A fix for a DLPS bug and refactors the file structure (#40643)

* [Realtek] Support lwip & add SetSystemLedState

* [Realtek] Restyle files

* [Realtek] Fix get mac address bug

* [Realtek] Reduce app task stack size

* [Realtek] Add RAM reduction configuration support

* [Realtek] Reduce matter/thread task stack size

* [Realtek] Move large var from stack to heap

* [Realtek] Refactor examples platform paths

* [Realtek] Fix dlps bug

* [Realtek] Add dlps_on

* [Realtek] Restyle files

* [Realtek] Remove ENABLE_RAM_REDUCE

* [Realtek] Modify according to AI suggestion

* [Realtek] Fix some build error
diff --git a/config/realtek/bee/chip.cmake b/config/realtek/bee/chip.cmake
index f4e2893..8e90d37 100755
--- a/config/realtek/bee/chip.cmake
+++ b/config/realtek/bee/chip.cmake
@@ -35,6 +35,10 @@
 list(APPEND CHIP_CFLAGS -DCONFIG_FACTORY_DATA=1)
 endif (matter_enable_factory_data)
 
+if (matter_enable_dlps)
+list(APPEND CHIP_CFLAGS -DDLPS_EN=1)
+endif (matter_enable_dlps)
+
 list(
     APPEND CHIP_CXXFLAGS
 
@@ -135,7 +139,7 @@
 string(APPEND CHIP_GN_ARGS "chip_build_pw_rpc_lib = true\n")
 string(APPEND CHIP_GN_ARGS "pw_log_BACKEND = \"//third_party/pigweed/repo/pw_log_basic\"\n")
 string(APPEND CHIP_GN_ARGS "pw_assert_BACKEND = \"//third_party/pigweed/repo/pw_assert_log:check_backend\"\n")
-string(APPEND CHIP_GN_ARGS "pw_sys_io_BACKEND = \"//examples/platform/realtek/bee/pw_sys_io:pw_sys_io_bee\"\n")
+string(APPEND CHIP_GN_ARGS "pw_sys_io_BACKEND = \"//examples/platform/realtek/pw_sys_io:pw_sys_io_bee\"\n")
 string(APPEND CHIP_GN_ARGS "dir_pw_third_party_nanopb = \"//third_party/nanopb/repo\"\n")
 string(APPEND CHIP_GN_ARGS "pw_build_LINK_DEPS = [\"//third_party/pigweed/repo/pw_assert:impl\", \"//third_party/pigweed/repo/pw_log:impl\"]\n")
 string(APPEND CHIP_GN_ARGS "pw_rpc_CONFIG = \"//third_party/pigweed/repo/pw_rpc:disable_global_mutex\"")
diff --git a/config/realtek/bee/lib/pw_rpc/BUILD.gn b/config/realtek/bee/lib/pw_rpc/BUILD.gn
index a04f03c..0ab03dc 100644
--- a/config/realtek/bee/lib/pw_rpc/BUILD.gn
+++ b/config/realtek/bee/lib/pw_rpc/BUILD.gn
@@ -23,7 +23,7 @@
   deps = [
     "$dir_pw_rpc:server",
     "$dir_pw_rpc/nanopb:echo_service",
-    "${chip_root}/examples/platform/realtek/bee/pw_sys_io:pw_sys_io_bee",
+    "${chip_root}/examples/platform/realtek/pw_sys_io:pw_sys_io_bee",
     dir_pw_assert,
     dir_pw_hdlc,
     dir_pw_log,
diff --git a/examples/all-clusters-app/realtek/bee/chip_main.cmake b/examples/all-clusters-app/realtek/bee/chip_main.cmake
index 106331a..5294148 100644
--- a/examples/all-clusters-app/realtek/bee/chip_main.cmake
+++ b/examples/all-clusters-app/realtek/bee/chip_main.cmake
@@ -30,7 +30,7 @@
 
 add_subdirectory(${chip_dir}/third_party/pigweed/repo ${chip_dir}/examples/all-clusters-app/realtek/bee/out/pigweed)
 add_subdirectory(${chip_dir}/third_party/nanopb/repo ${chip_dir}/examples/all-clusters-app/realtek/bee/out/nanopb)
-add_subdirectory(${chip_dir}/examples/platform/realtek/bee/pw_sys_io ${chip_dir}/examples/all-clusters-app/realtek/bee/out/pw_sys_io)
+add_subdirectory(${chip_dir}/examples/platform/realtek/pw_sys_io ${chip_dir}/examples/all-clusters-app/realtek/out/pw_sys_io)
 
 pw_proto_library(attributes_service
   SOURCES
@@ -121,7 +121,7 @@
 list(
     APPEND ${list_chip_main_sources}
     #shell
-    ${chip_dir}/examples/platform/realtek/bee/shell/launch_shell.cpp
+    ${chip_dir}/examples/platform/realtek/shell/launch_shell.cpp
 )
 endif (matter_enable_shell)
 
@@ -129,8 +129,8 @@
 list(
     APPEND ${list_chip_main_sources}
     #rpc
-    ${chip_dir}/examples/platform/realtek/bee/PigweedLogger.cpp
-    ${chip_dir}/examples/platform/realtek/bee/Rpc.cpp
+    ${chip_dir}/examples/platform/realtek/PigweedLogger.cpp
+    ${chip_dir}/examples/platform/realtek/Rpc.cpp
     ${chip_dir}/examples/common/pigweed/RpcService.cpp
     ${chip_dir}/examples/common/pigweed/PigweedLoggerMutex.cpp
 )
@@ -145,7 +145,7 @@
     ${chip_dir}/src/app/clusters/ota-requestor/DefaultOTARequestorDriver.cpp
     ${chip_dir}/src/app/clusters/ota-requestor/DefaultOTARequestorStorage.cpp
     ${chip_dir}/src/app/clusters/ota-requestor/ota-requestor-server.cpp
-    ${chip_dir}/examples/platform/realtek/bee/ota/OTAInitializer.cpp
+    ${chip_dir}/examples/platform/realtek/ota/OTAInitializer.cpp
 )
 endif (matter_enable_ota_requestor)
 
@@ -179,7 +179,7 @@
     ${chip_dir}/examples/all-clusters-app/realtek/bee/main/DeviceCallbacks.cpp
     ${chip_dir}/examples/all-clusters-app/realtek/bee/main/CHIPDeviceManager.cpp
     ${chip_dir}/examples/all-clusters-app/realtek/bee/main/Globals.cpp 
-    ${chip_dir}/examples/platform/realtek/bee/util/LEDWidget.cpp
+    ${chip_dir}/examples/platform/realtek/util/LEDWidget.cpp
     ${chip_dir}/examples/providers/DeviceInfoProviderImpl.cpp
 )
 
@@ -198,8 +198,8 @@
     ${chip_main}
     PUBLIC
     #rpc
-    ${chip_dir}/examples/platform/realtek/bee
-    ${chip_dir}/examples/platform/realtek/bee/pw_sys_io/public
+    ${chip_dir}/examples/platform/realtek
+    ${chip_dir}/examples/platform/realtek/pw_sys_io/public
     ${chip_dir}/examples/common
     ${chip_dir}/examples/common/pigweed
     ${chip_dir}/examples/common/pigweed/realtek/bee
@@ -221,7 +221,7 @@
     ${chip_dir}/examples/all-clusters-app/all-clusters-common/include
     ${chip_dir}/examples/microwave-oven-app/microwave-oven-common
     ${chip_dir}/examples/microwave-oven-app/microwave-oven-common/include
-    ${chip_dir}/examples/platform/realtek/bee
+    ${chip_dir}/examples/platform/realtek
     ${chip_dir}/examples/providers
     ${chip_dir_output}/gen/include
     ${chip_dir}/src/include/
@@ -269,14 +269,6 @@
     -DCHIP_HAVE_CONFIG_H
 )
 
-if (matter_dac_key_encryption)
-list(
-    APPEND chip_main_flags 
-    
-    -DCONFIG_DAC_KEY_ENC=1
-)
-endif (matter_dac_key_encryption)
-
 if (matter_enable_persistentstorage_audit)
 list(
     APPEND chip_main_flags
diff --git a/examples/all-clusters-app/realtek/bee/main/AppTask.cpp b/examples/all-clusters-app/realtek/bee/main/AppTask.cpp
index dae8a62..0fc8ce7 100644
--- a/examples/all-clusters-app/realtek/bee/main/AppTask.cpp
+++ b/examples/all-clusters-app/realtek/bee/main/AppTask.cpp
@@ -69,12 +69,7 @@
 #define RESET_TRIGGER_TIMEOUT 1500
 #define BLE_ADV_TRIGGER_TIMEOUT 1500
 
-#if CONFIG_DAC_KEY_ENC
-#define APP_TASK_STACK_SIZE (8 * 1024)
-#else
 #define APP_TASK_STACK_SIZE (4 * 1024)
-#endif
-
 #define APP_TASK_PRIORITY 2
 #define APP_EVENT_QUEUE_SIZE 10
 #define LIGHT_ENDPOINT_ID (1)
diff --git a/examples/light-switch-app/realtek/bee/chip_main.cmake b/examples/light-switch-app/realtek/bee/chip_main.cmake
index 8792d69..94e459e 100755
--- a/examples/light-switch-app/realtek/bee/chip_main.cmake
+++ b/examples/light-switch-app/realtek/bee/chip_main.cmake
@@ -13,7 +13,7 @@
 list(
     APPEND ${list_chip_main_sources}
     #shell
-    ${chip_dir}/examples/platform/realtek/bee/shell/launch_shell.cpp
+    ${chip_dir}/examples/platform/realtek/shell/launch_shell.cpp
 )
 endif (matter_enable_shell)
 
@@ -26,7 +26,7 @@
     ${chip_dir}/src/app/clusters/ota-requestor/DefaultOTARequestorDriver.cpp
     ${chip_dir}/src/app/clusters/ota-requestor/DefaultOTARequestorStorage.cpp
     ${chip_dir}/src/app/clusters/ota-requestor/ota-requestor-server.cpp
-    ${chip_dir}/examples/platform/realtek/bee/ota/OTAInitializer.cpp
+    ${chip_dir}/examples/platform/realtek/ota/OTAInitializer.cpp
 )
 endif (matter_enable_ota_requestor)
 
@@ -40,7 +40,7 @@
     ${chip_dir}/examples/light-switch-app/realtek/bee/main/DeviceCallbacks.cpp
     ${chip_dir}/examples/light-switch-app/realtek/bee/main/CHIPDeviceManager.cpp
     ${chip_dir}/examples/light-switch-app/realtek/bee/main/Globals.cpp
-    ${chip_dir}/examples/platform/realtek/bee/util/LEDWidget.cpp
+    ${chip_dir}/examples/platform/realtek/util/LEDWidget.cpp
     ${chip_dir}/examples/providers/DeviceInfoProviderImpl.cpp
 )
 
@@ -64,7 +64,7 @@
     ${chip_dir}/zzz_generated/app-common
     ${chip_dir}/examples/light-switch-app/light-switch-common
     ${chip_dir}/examples/light-switch-app/realtek/bee/main/include
-    ${chip_dir}/examples/platform/realtek/bee
+    ${chip_dir}/examples/platform/realtek
     ${chip_dir}/examples/providers
     ${chip_dir_output}/gen/include
     ${chip_dir}/src/include/
@@ -86,14 +86,6 @@
     -DCHIP_HAVE_CONFIG_H
 )
 
-if (matter_dac_key_encryption)
-list(
-    APPEND chip_main_flags 
-
-    -DCONFIG_DAC_KEY_ENC=1
-)
-endif (matter_dac_key_encryption)
-
 if (matter_enable_persistentstorage_audit)
 list(
     APPEND chip_main_flags
diff --git a/examples/light-switch-app/realtek/bee/main/AppTask.cpp b/examples/light-switch-app/realtek/bee/main/AppTask.cpp
index 4f496ab..41842ae 100644
--- a/examples/light-switch-app/realtek/bee/main/AppTask.cpp
+++ b/examples/light-switch-app/realtek/bee/main/AppTask.cpp
@@ -32,6 +32,7 @@
 #include <app/clusters/ota-requestor/OTATestEventTriggerHandler.h>
 #include <app/server/Dnssd.h>
 #include <app/server/Server.h>
+#include <app/util/attribute-storage.h>
 #include <credentials/DeviceAttestationCredsProvider.h>
 #include <credentials/examples/DeviceAttestationCredsExample.h>
 #include <data-model-providers/codegen/Instance.h>
@@ -66,18 +67,13 @@
 #define FACTORY_RESET_CANCEL_WINDOW_TIMEOUT 5000
 #define RESET_TRIGGER_TIMEOUT 1500
 
-#if CONFIG_DAC_KEY_ENC
-#define APP_TASK_STACK_SIZE (8 * 1024)
-#else
 #define APP_TASK_STACK_SIZE (4 * 1024)
-#endif
-
 #define APP_TASK_PRIORITY 2
 #define APP_EVENT_QUEUE_SIZE 10
 
 namespace {
 
-#if (CONFIG_1_TO_2_ZAP || CONFIG_1_TO_8_ZAP || CONFIG_1_TO_12_ZAP)
+#if (CONFIG_1_TO_2_ZAP || CONFIG_1_TO_8_ZAP || CONFIG_1_TO_11_ZAP)
 
 // Switches Namespace: 0x43, tag 0x08 (Custom)
 constexpr const uint8_t kNamespaceSwitches = 0x43;
@@ -139,8 +135,9 @@
 QueueHandle_t sAppEventQueue;
 
 // NOTE! This key is for test/certification only and should not be available in production devices!
-uint8_t sTestEventTriggerEnableKey[TestEventTriggerDelegate::kEnableKeyLength] = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
-                                                                                   0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff };
+static const uint8_t sTestEventTriggerEnableKey[TestEventTriggerDelegate::kEnableKeyLength] = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55,
+                                                                                                0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb,
+                                                                                                0xcc, 0xdd, 0xee, 0xff };
 
 chip::DeviceLayer::DeviceInfoProviderImpl gExampleDeviceInfoProvider;
 } // namespace
diff --git a/examples/light-switch-app/realtek/bee/main/include/CHIPProjectConfig.h b/examples/light-switch-app/realtek/bee/main/include/CHIPProjectConfig.h
index 883e826..d9d0b46 100644
--- a/examples/light-switch-app/realtek/bee/main/include/CHIPProjectConfig.h
+++ b/examples/light-switch-app/realtek/bee/main/include/CHIPProjectConfig.h
@@ -168,17 +168,17 @@
 #define CONFIG_DEFAULT_ZAP 1
 #endif
 
-// You must modidy chip_main.cmake : ZAP_FILE ${matter_example_path}/data_model/light-switch-app-1_to_2.zap
+// You must modidy chip_main.cmake : ZAP_FILE ${matter_example_path}/../data_model/light-switch-app-1_to_2.zap
 #ifndef CONFIG_1_TO_2_ZAP
 #define CONFIG_1_TO_2_ZAP 0
 #endif
 
-// You must modidy chip_main.cmake : ZAP_FILE ${matter_example_path}/data_model/light-switch-app-1_to_8.zap
+// You must modidy chip_main.cmake : ZAP_FILE ${matter_example_path}/../data_model/light-switch-app-1_to_8.zap
 #ifndef CONFIG_1_TO_8_ZAP
 #define CONFIG_1_TO_8_ZAP 0
 #endif
 
-// You must modidy chip_main.cmake : ZAP_FILE ${matter_example_path}/data_model/light-switch-app-1_to_12.zap
+// You must modidy chip_main.cmake : ZAP_FILE ${matter_example_path}/../data_model/light-switch-app-1_to_11.zap
 #ifndef CONFIG_1_TO_11_ZAP
 #define CONFIG_1_TO_11_ZAP 0
 #define MATTER_BINDING_TABLE_SIZE 20
diff --git a/examples/lighting-app/realtek/bee/chip_main.cmake b/examples/lighting-app/realtek/bee/chip_main.cmake
index 6246248..f2a4999 100755
--- a/examples/lighting-app/realtek/bee/chip_main.cmake
+++ b/examples/lighting-app/realtek/bee/chip_main.cmake
@@ -30,7 +30,7 @@
 
 add_subdirectory(${chip_dir}/third_party/pigweed/repo ${chip_dir}/examples/lighting-app/realtek/bee/out/pigweed)
 add_subdirectory(${chip_dir}/third_party/nanopb/repo ${chip_dir}/examples/lighting-app/realtek/bee/out/nanopb)
-add_subdirectory(${chip_dir}/examples/platform/realtek/bee/pw_sys_io ${chip_dir}/examples/lighting-app/realtek/bee/out/pw_sys_io)
+add_subdirectory(${chip_dir}/examples/platform/realtek/pw_sys_io ${chip_dir}/examples/lighting-app/realtek/bee/out/pw_sys_io)
 
 pw_proto_library(attributes_service
   SOURCES
@@ -121,7 +121,7 @@
 list(
     APPEND ${list_chip_main_sources}
     #shell
-    ${chip_dir}/examples/platform/realtek/bee/shell/launch_shell.cpp
+    ${chip_dir}/examples/platform/realtek/shell/launch_shell.cpp
 )
 endif (matter_enable_shell)
 
@@ -129,8 +129,8 @@
 list(
     APPEND ${list_chip_main_sources}
     #rpc
-    ${chip_dir}/examples/platform/realtek/bee/PigweedLogger.cpp
-    ${chip_dir}/examples/platform/realtek/bee/Rpc.cpp
+    ${chip_dir}/examples/platform/realtek/PigweedLogger.cpp
+    ${chip_dir}/examples/platform/realtek/Rpc.cpp
     ${chip_dir}/examples/common/pigweed/RpcService.cpp
     ${chip_dir}/examples/common/pigweed/realtek/PigweedLoggerMutex.cpp
 )
@@ -145,7 +145,7 @@
     ${chip_dir}/src/app/clusters/ota-requestor/DefaultOTARequestorDriver.cpp
     ${chip_dir}/src/app/clusters/ota-requestor/DefaultOTARequestorStorage.cpp
     ${chip_dir}/src/app/clusters/ota-requestor/ota-requestor-server.cpp
-    ${chip_dir}/examples/platform/realtek/bee/ota/OTAInitializer.cpp
+    ${chip_dir}/examples/platform/realtek/ota/OTAInitializer.cpp
 )
 endif (matter_enable_ota_requestor)
 
@@ -159,7 +159,7 @@
     ${chip_dir}/examples/lighting-app/realtek/bee/main/DeviceCallbacks.cpp
     ${chip_dir}/examples/lighting-app/realtek/bee/main/CHIPDeviceManager.cpp
     ${chip_dir}/examples/lighting-app/realtek/bee/main/Globals.cpp
-    ${chip_dir}/examples/platform/realtek/bee/util/LEDWidget.cpp
+    ${chip_dir}/examples/platform/realtek/util/LEDWidget.cpp
     ${chip_dir}/examples/providers/DeviceInfoProviderImpl.cpp
 )
 
@@ -179,8 +179,8 @@
     ${chip_main}
     PUBLIC
     #rpc
-    ${chip_dir}/examples/platform/realtek/bee
-    ${chip_dir}/examples/platform/realtek/bee/pw_sys_io/public
+    ${chip_dir}/examples/platform/realtek
+    ${chip_dir}/examples/platform/realtek/pw_sys_io/public
     ${chip_dir}/examples/common
     ${chip_dir}/examples/common/pigweed
     ${chip_dir}/examples/common/pigweed/realtek
@@ -200,7 +200,7 @@
       ${chip_dir}/examples/lighting-app/realtek/bee/main/include
       ${chip_dir}/examples/lighting-app/lighting-common
       ${chip_dir}/examples/lighting-app/lighting-common/include
-      ${chip_dir}/examples/platform/realtek/bee
+      ${chip_dir}/examples/platform/realtek
       ${chip_dir}/examples/providers
       ${chip_dir_output}/gen/include
       ${chip_dir}/src/include/
@@ -248,14 +248,6 @@
     -DCHIP_HAVE_CONFIG_H
 )
 
-if (matter_dac_key_encryption)
-list(
-    APPEND chip_main_flags 
-
-    -DCONFIG_DAC_KEY_ENC=1
-)
-endif (matter_dac_key_encryption)
-
 if (matter_enable_persistentstorage_audit)
 list(
     APPEND chip_main_flags
diff --git a/examples/lighting-app/realtek/bee/main/AppTask.cpp b/examples/lighting-app/realtek/bee/main/AppTask.cpp
index 1e782b6..4f18690 100644
--- a/examples/lighting-app/realtek/bee/main/AppTask.cpp
+++ b/examples/lighting-app/realtek/bee/main/AppTask.cpp
@@ -65,12 +65,7 @@
 #define RESET_TRIGGER_TIMEOUT 1500
 #define BLE_ADV_TRIGGER_TIMEOUT 1500
 
-#if CONFIG_DAC_KEY_ENC
-#define APP_TASK_STACK_SIZE (8 * 1024)
-#else
 #define APP_TASK_STACK_SIZE (4 * 1024)
-#endif
-
 #define APP_TASK_PRIORITY 2
 #define APP_EVENT_QUEUE_SIZE 10
 #define LIGHT_ENDPOINT_ID (1)
@@ -83,8 +78,9 @@
 QueueHandle_t sAppEventQueue;
 
 // NOTE! This key is for test/certification only and should not be available in production devices!
-uint8_t sTestEventTriggerEnableKey[TestEventTriggerDelegate::kEnableKeyLength] = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
-                                                                                   0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff };
+static const uint8_t sTestEventTriggerEnableKey[TestEventTriggerDelegate::kEnableKeyLength] = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55,
+                                                                                                0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb,
+                                                                                                0xcc, 0xdd, 0xee, 0xff };
 
 chip::DeviceLayer::DeviceInfoProviderImpl gExampleDeviceInfoProvider;
 } // namespace
diff --git a/examples/lock-app/realtek/bee/chip_main.cmake b/examples/lock-app/realtek/bee/chip_main.cmake
index f6b4b7a..449f162 100755
--- a/examples/lock-app/realtek/bee/chip_main.cmake
+++ b/examples/lock-app/realtek/bee/chip_main.cmake
@@ -30,7 +30,7 @@
 
 add_subdirectory(${chip_dir}/third_party/pigweed/repo ${chip_dir}/examples/lock-app/realtek/bee/out/pigweed)
 add_subdirectory(${chip_dir}/third_party/nanopb/repo ${chip_dir}/examples/lock-app/realtek/bee/out/nanopb)
-add_subdirectory(${chip_dir}/examples/platform/realtek/bee/pw_sys_io ${chip_dir}/examples/lock-app/realtek/bee/out/pw_sys_io)
+add_subdirectory(${chip_dir}/examples/platform/realtek/pw_sys_io ${chip_dir}/examples/lock-app/realtek/bee/out/pw_sys_io)
 
 pw_proto_library(attributes_service
   SOURCES
@@ -121,7 +121,7 @@
 list(
     APPEND ${list_chip_main_sources}
     #shell
-    ${chip_dir}/examples/platform/realtek/bee/shell/launch_shell.cpp
+    ${chip_dir}/examples/platform/realtek/shell/launch_shell.cpp
 )
 endif (matter_enable_shell)
 
@@ -129,8 +129,8 @@
 list(
     APPEND ${list_chip_main_sources}
     #rpc
-    ${chip_dir}/examples/platform/realtek/bee/PigweedLogger.cpp
-    ${chip_dir}/examples/platform/realtek/bee/Rpc.cpp
+    ${chip_dir}/examples/platform/realtek/PigweedLogger.cpp
+    ${chip_dir}/examples/platform/realtek/Rpc.cpp
     ${chip_dir}/examples/common/pigweed/RpcService.cpp
     ${chip_dir}/examples/common/pigweed/realtek/PigweedLoggerMutex.cpp
 )
@@ -145,7 +145,7 @@
     ${chip_dir}/src/app/clusters/ota-requestor/DefaultOTARequestorDriver.cpp
     ${chip_dir}/src/app/clusters/ota-requestor/DefaultOTARequestorStorage.cpp
     ${chip_dir}/src/app/clusters/ota-requestor/ota-requestor-server.cpp
-    ${chip_dir}/examples/platform/realtek/bee/ota/OTAInitializer.cpp
+    ${chip_dir}/examples/platform/realtek/ota/OTAInitializer.cpp
 )
 endif (matter_enable_ota_requestor)
 
@@ -158,7 +158,7 @@
     ${chip_dir}/examples/lock-app/realtek/bee/main/DeviceCallbacks.cpp
     ${chip_dir}/examples/lock-app/realtek/bee/main/CHIPDeviceManager.cpp
     ${chip_dir}/examples/lock-app/realtek/bee/main/Globals.cpp
-    ${chip_dir}/examples/platform/realtek/bee/util/LEDWidget.cpp
+    ${chip_dir}/examples/platform/realtek/util/LEDWidget.cpp
     
 
     ${chip_dir}/examples/providers/DeviceInfoProviderImpl.cpp
@@ -180,8 +180,8 @@
     ${chip_main}
     PUBLIC
     #rpc
-    ${chip_dir}/examples/platform/realtek/bee
-    ${chip_dir}/examples/platform/realtek/bee/pw_sys_io/public
+    ${chip_dir}/examples/platform/realtek
+    ${chip_dir}/examples/platform/realtek/pw_sys_io/public
     ${chip_dir}/examples/common
     ${chip_dir}/examples/common/pigweed
     ${chip_dir}/examples/common/pigweed/realtek/bee
@@ -201,7 +201,7 @@
     ${chip_dir}/examples/lock-app/lock-common
     ${chip_dir}/examples/lock-app/lock-common/include
     ${chip_dir}/examples/lock-app/realtek/bee/main/include
-    ${chip_dir}/examples/platform/realtek/bee
+    ${chip_dir}/examples/platform/realtek
     ${chip_dir}/examples/providers
     ${chip_dir_output}/gen/include
     ${chip_dir}/src/include/
@@ -249,14 +249,6 @@
     -DCHIP_HAVE_CONFIG_H
 )
 
-if (matter_dac_key_encryption)
-list(
-    APPEND chip_main_flags 
-    
-    -DCONFIG_DAC_KEY_ENC=1
-)
-endif (matter_dac_key_encryption)
-
 if (matter_enable_persistentstorage_audit)
 list(
     APPEND chip_main_flags
diff --git a/examples/lock-app/realtek/bee/main/AppTask.cpp b/examples/lock-app/realtek/bee/main/AppTask.cpp
index 0079ef7..9da4d85 100644
--- a/examples/lock-app/realtek/bee/main/AppTask.cpp
+++ b/examples/lock-app/realtek/bee/main/AppTask.cpp
@@ -62,12 +62,7 @@
 #define FACTORY_RESET_CANCEL_WINDOW_TIMEOUT 5000
 #define RESET_TRIGGER_TIMEOUT 1500
 
-#if CONFIG_DAC_KEY_ENC
-#define APP_TASK_STACK_SIZE (8 * 1024)
-#else
 #define APP_TASK_STACK_SIZE (4 * 1024)
-#endif
-
 #define APP_TASK_PRIORITY 2
 #define APP_EVENT_QUEUE_SIZE 10
 #define LOCK_ENDPOINT_ID (1)
diff --git a/examples/ota-requestor-app/realtek/bee/chip_main.cmake b/examples/ota-requestor-app/realtek/bee/chip_main.cmake
index e85e9e9..1d1867b 100644
--- a/examples/ota-requestor-app/realtek/bee/chip_main.cmake
+++ b/examples/ota-requestor-app/realtek/bee/chip_main.cmake
@@ -13,7 +13,7 @@
 list(
     APPEND ${list_chip_main_sources}
     #shell
-    ${chip_dir}/examples/platform/realtek/bee/shell/launch_shell.cpp
+    ${chip_dir}/examples/platform/realtek/shell/launch_shell.cpp
 )
 endif (matter_enable_shell)
 
@@ -26,7 +26,7 @@
     ${chip_dir}/src/app/clusters/ota-requestor/DefaultOTARequestorDriver.cpp
     ${chip_dir}/src/app/clusters/ota-requestor/DefaultOTARequestorStorage.cpp
     ${chip_dir}/src/app/clusters/ota-requestor/ota-requestor-server.cpp
-    ${chip_dir}/examples/platform/realtek/bee/ota/OTAInitializer.cpp
+    ${chip_dir}/examples/platform/realtek/ota/OTAInitializer.cpp
 )
 endif (matter_enable_ota_requestor)
 
@@ -37,7 +37,7 @@
     ${chip_dir}/examples/ota-requestor-app/realtek/bee/main/DeviceCallbacks.cpp
     ${chip_dir}/examples/ota-requestor-app/realtek/bee/main/CHIPDeviceManager.cpp
     ${chip_dir}/examples/ota-requestor-app/realtek/bee/main/AppTask.cpp
-    ${chip_dir}/examples/platform/realtek/bee/util/LEDWidget.cpp
+    ${chip_dir}/examples/platform/realtek/util/LEDWidget.cpp
     ${chip_dir}/examples/providers/DeviceInfoProviderImpl.cpp
 )
 
@@ -61,8 +61,8 @@
     ${chip_dir}/zzz_generated/app-common
     ${chip_dir}/examples/ota-requestor-app/ota-requestor-common
     ${chip_dir}/examples/ota-requestor-app/realtek/bee/main/include
-    ${chip_dir}/examples/platform/realtek/bee
-    ${chip_dir}/examples/platform/realtek/bee/util
+    ${chip_dir}/examples/platform/realtek
+    ${chip_dir}/examples/platform/realtek/util
     ${chip_dir}/examples/providers
     ${chip_dir_output}/gen/include
     ${chip_dir}/src/include/
@@ -84,14 +84,6 @@
     -DCHIP_HAVE_CONFIG_H
 )
 
-if (matter_dac_key_encryption)
-list(
-    APPEND chip_main_flags 
-    
-    -DCONFIG_DAC_KEY_ENC=1
-)
-endif (matter_dac_key_encryption)
-
 if (matter_enable_persistentstorage_audit)
 list(
     APPEND chip_main_flags
diff --git a/examples/ota-requestor-app/realtek/bee/main/AppTask.cpp b/examples/ota-requestor-app/realtek/bee/main/AppTask.cpp
index f78e5ff..a8fae81 100644
--- a/examples/ota-requestor-app/realtek/bee/main/AppTask.cpp
+++ b/examples/ota-requestor-app/realtek/bee/main/AppTask.cpp
@@ -59,12 +59,7 @@
 #define FACTORY_RESET_CANCEL_WINDOW_TIMEOUT 5000
 #define RESET_TRIGGER_TIMEOUT 1500
 
-#if CONFIG_DAC_KEY_ENC
-#define APP_TASK_STACK_SIZE (8 * 1024)
-#else
 #define APP_TASK_STACK_SIZE (4 * 1024)
-#endif
-
 #define APP_TASK_PRIORITY 2
 #define APP_EVENT_QUEUE_SIZE 10
 
diff --git a/examples/platform/realtek/bee/PigweedLogger.cpp b/examples/platform/realtek/PigweedLogger.cpp
similarity index 100%
rename from examples/platform/realtek/bee/PigweedLogger.cpp
rename to examples/platform/realtek/PigweedLogger.cpp
diff --git a/examples/platform/realtek/bee/PigweedLogger.h b/examples/platform/realtek/PigweedLogger.h
similarity index 100%
rename from examples/platform/realtek/bee/PigweedLogger.h
rename to examples/platform/realtek/PigweedLogger.h
diff --git a/examples/platform/realtek/bee/Rpc.cpp b/examples/platform/realtek/Rpc.cpp
similarity index 100%
rename from examples/platform/realtek/bee/Rpc.cpp
rename to examples/platform/realtek/Rpc.cpp
diff --git a/examples/platform/realtek/bee/Rpc.h b/examples/platform/realtek/Rpc.h
similarity index 100%
rename from examples/platform/realtek/bee/Rpc.h
rename to examples/platform/realtek/Rpc.h
diff --git a/examples/platform/realtek/bee/ota/OTAInitializer.cpp b/examples/platform/realtek/ota/OTAInitializer.cpp
similarity index 100%
rename from examples/platform/realtek/bee/ota/OTAInitializer.cpp
rename to examples/platform/realtek/ota/OTAInitializer.cpp
diff --git a/examples/platform/realtek/bee/ota/OTAInitializer.h b/examples/platform/realtek/ota/OTAInitializer.h
similarity index 100%
rename from examples/platform/realtek/bee/ota/OTAInitializer.h
rename to examples/platform/realtek/ota/OTAInitializer.h
diff --git a/examples/platform/realtek/bee/pw_sys_io/BUILD.gn b/examples/platform/realtek/pw_sys_io/BUILD.gn
similarity index 100%
rename from examples/platform/realtek/bee/pw_sys_io/BUILD.gn
rename to examples/platform/realtek/pw_sys_io/BUILD.gn
diff --git a/examples/platform/realtek/bee/pw_sys_io/CMakeLists.txt b/examples/platform/realtek/pw_sys_io/CMakeLists.txt
similarity index 100%
rename from examples/platform/realtek/bee/pw_sys_io/CMakeLists.txt
rename to examples/platform/realtek/pw_sys_io/CMakeLists.txt
diff --git a/examples/platform/realtek/bee/pw_sys_io/public/pw_sys_io_bee/init.h b/examples/platform/realtek/pw_sys_io/public/pw_sys_io_bee/init.h
similarity index 100%
rename from examples/platform/realtek/bee/pw_sys_io/public/pw_sys_io_bee/init.h
rename to examples/platform/realtek/pw_sys_io/public/pw_sys_io_bee/init.h
diff --git a/examples/platform/realtek/bee/pw_sys_io/sys_io_bee.cc b/examples/platform/realtek/pw_sys_io/sys_io_bee.cc
similarity index 100%
rename from examples/platform/realtek/bee/pw_sys_io/sys_io_bee.cc
rename to examples/platform/realtek/pw_sys_io/sys_io_bee.cc
diff --git a/examples/platform/realtek/bee/shell/launch_shell.cpp b/examples/platform/realtek/shell/launch_shell.cpp
similarity index 100%
rename from examples/platform/realtek/bee/shell/launch_shell.cpp
rename to examples/platform/realtek/shell/launch_shell.cpp
diff --git a/examples/platform/realtek/bee/shell/launch_shell.h b/examples/platform/realtek/shell/launch_shell.h
similarity index 100%
rename from examples/platform/realtek/bee/shell/launch_shell.h
rename to examples/platform/realtek/shell/launch_shell.h
diff --git a/examples/platform/realtek/bee/util/LEDWidget.cpp b/examples/platform/realtek/util/LEDWidget.cpp
similarity index 100%
rename from examples/platform/realtek/bee/util/LEDWidget.cpp
rename to examples/platform/realtek/util/LEDWidget.cpp
diff --git a/examples/platform/realtek/bee/util/LEDWidget.h b/examples/platform/realtek/util/LEDWidget.h
similarity index 100%
rename from examples/platform/realtek/bee/util/LEDWidget.h
rename to examples/platform/realtek/util/LEDWidget.h
diff --git a/examples/platform/realtek/bee/util/RealtekObserver.h b/examples/platform/realtek/util/RealtekObserver.h
similarity index 100%
rename from examples/platform/realtek/bee/util/RealtekObserver.h
rename to examples/platform/realtek/util/RealtekObserver.h
diff --git a/examples/thermostat/realtek/bee/chip_main.cmake b/examples/thermostat/realtek/bee/chip_main.cmake
index 66943fb..0ac44ad 100755
--- a/examples/thermostat/realtek/bee/chip_main.cmake
+++ b/examples/thermostat/realtek/bee/chip_main.cmake
@@ -13,7 +13,7 @@
 list(
     APPEND ${list_chip_main_sources}
     #shell
-    ${chip_dir}/examples/platform/realtek/bee/shell/launch_shell.cpp
+    ${chip_dir}/examples/platform/realtek/shell/launch_shell.cpp
 )
 endif (matter_enable_shell)
 
@@ -26,7 +26,7 @@
     ${chip_dir}/src/app/clusters/ota-requestor/DefaultOTARequestorDriver.cpp
     ${chip_dir}/src/app/clusters/ota-requestor/DefaultOTARequestorStorage.cpp
     ${chip_dir}/src/app/clusters/ota-requestor/ota-requestor-server.cpp
-    ${chip_dir}/examples/platform/realtek/bee/ota/OTAInitializer.cpp
+    ${chip_dir}/examples/platform/realtek/ota/OTAInitializer.cpp
 )
 endif (matter_enable_ota_requestor)
 
@@ -39,7 +39,7 @@
     ${chip_dir}/examples/thermostat/realtek/bee/main/DeviceCallbacks.cpp
     ${chip_dir}/examples/thermostat/realtek/bee/main/CHIPDeviceManager.cpp
     ${chip_dir}/examples/thermostat/realtek/bee/main/Globals.cpp
-    ${chip_dir}/examples/platform/realtek/bee/util/LEDWidget.cpp
+    ${chip_dir}/examples/platform/realtek/util/LEDWidget.cpp
     ${chip_dir}/examples/providers/DeviceInfoProviderImpl.cpp
 )
 
@@ -64,7 +64,7 @@
     ${chip_dir}/examples/thermostat/realtek/bee/main/include
     ${chip_dir}/examples/thermostat/thermostat-common
     ${chip_dir}/examples/thermostat/thermostat-common/include
-    ${chip_dir}/examples/platform/realtek/bee
+    ${chip_dir}/examples/platform/realtek
     ${chip_dir}/examples/providers
     ${chip_dir_output}/gen/include
     ${chip_dir}/src/include/
@@ -86,14 +86,6 @@
     -DCHIP_HAVE_CONFIG_H
 )
 
-if (matter_dac_key_encryption)
-list(
-    APPEND chip_main_flags 
-    
-    -DCONFIG_DAC_KEY_ENC=1
-)
-endif (matter_dac_key_encryption)
-
 if (matter_enable_persistentstorage_audit)
 list(
     APPEND chip_main_flags
diff --git a/examples/thermostat/realtek/bee/main/AppTask.cpp b/examples/thermostat/realtek/bee/main/AppTask.cpp
index cf4b8c9..f4fbc37 100644
--- a/examples/thermostat/realtek/bee/main/AppTask.cpp
+++ b/examples/thermostat/realtek/bee/main/AppTask.cpp
@@ -58,12 +58,7 @@
 #define FACTORY_RESET_CANCEL_WINDOW_TIMEOUT 5000
 #define RESET_TRIGGER_TIMEOUT 1500
 
-#if CONFIG_DAC_KEY_ENC
-#define APP_TASK_STACK_SIZE (8 * 1024)
-#else
 #define APP_TASK_STACK_SIZE (4 * 1024)
-#endif
-
 #define APP_TASK_PRIORITY 2
 #define APP_EVENT_QUEUE_SIZE 10
 #define Thermostat_ENDPOINT_ID (1)
diff --git a/examples/window-app/realtek/bee/chip_main.cmake b/examples/window-app/realtek/bee/chip_main.cmake
index b3ef6fd..8412fb4 100755
--- a/examples/window-app/realtek/bee/chip_main.cmake
+++ b/examples/window-app/realtek/bee/chip_main.cmake
@@ -13,7 +13,7 @@
 list(
     APPEND ${list_chip_main_sources}
     #shell
-    ${chip_dir}/examples/platform/realtek/bee/shell/launch_shell.cpp
+    ${chip_dir}/examples/platform/realtek/shell/launch_shell.cpp
 )
 endif (matter_enable_shell)
 
@@ -26,7 +26,7 @@
     ${chip_dir}/src/app/clusters/ota-requestor/DefaultOTARequestorDriver.cpp
     ${chip_dir}/src/app/clusters/ota-requestor/DefaultOTARequestorStorage.cpp
     ${chip_dir}/src/app/clusters/ota-requestor/ota-requestor-server.cpp
-    ${chip_dir}/examples/platform/realtek/bee/ota/OTAInitializer.cpp
+    ${chip_dir}/examples/platform/realtek/ota/OTAInitializer.cpp
 )
 endif (matter_enable_ota_requestor)
 
@@ -38,7 +38,7 @@
     ${chip_dir}/examples/window-app/realtek/bee/main/CHIPDeviceManager.cpp
     ${chip_dir}/examples/window-app/realtek/bee/main/WindowCovering.cpp
     ${chip_dir}/examples/window-app/realtek/bee/main/AppTask.cpp
-    ${chip_dir}/examples/platform/realtek/bee/util/LEDWidget.cpp
+    ${chip_dir}/examples/platform/realtek/util/LEDWidget.cpp
 
     ${chip_dir}/examples/providers/DeviceInfoProviderImpl.cpp
 )
@@ -62,8 +62,8 @@
     ${chip_dir}/zzz_generated/window-app/zap-generated
     ${chip_dir}/zzz_generated/app-common
     ${chip_dir}/examples/window-app/realtek/bee/main/include
-    ${chip_dir}/examples/platform/realtek/bee
-    ${chip_dir}/examples/platform/realtek/bee/util
+    ${chip_dir}/examples/platform/realtek
+    ${chip_dir}/examples/platform/realtek/util
     ${chip_dir}/examples/providers
     ${chip_dir_output}/gen/include
     ${chip_dir}/src/include/
@@ -85,14 +85,6 @@
     -DCHIP_HAVE_CONFIG_H
 )
 
-if (matter_dac_key_encryption)
-list(
-    APPEND chip_main_flags 
-    
-    -DCONFIG_DAC_KEY_ENC=1
-)
-endif (matter_dac_key_encryption)
-
 if (matter_enable_persistentstorage_audit)
 list(
     APPEND chip_main_flags
diff --git a/src/platform/realtek/BEE/FactoryDataProvider.cpp b/src/platform/realtek/BEE/FactoryDataProvider.cpp
index 10a7e76..c195e3e 100644
--- a/src/platform/realtek/BEE/FactoryDataProvider.cpp
+++ b/src/platform/realtek/BEE/FactoryDataProvider.cpp
@@ -30,6 +30,10 @@
 #include <platform/internal/GenericConfigurationManagerImpl.ipp>
 #include <platform/realtek/BEE/CHIPDevicePlatformConfig.h>
 
+#if CONFIG_FACTORY_DATA
+#define FACTORY_DATA_BUFFER_LEN (2560)
+#endif
+
 #define FACTORY_TEST 0
 
 using namespace ::chip::DeviceLayer::Internal;
@@ -108,14 +112,13 @@
     CHIP_ERROR err = CHIP_NO_ERROR;
 
 #if CONFIG_FACTORY_DATA
-#define BUFFER_LEN (1024 * 3)
-    uint8_t * buffer         = (uint8_t *) malloc(BUFFER_LEN); // FactoryData won't overflow 2KB
+    uint8_t * buffer         = (uint8_t *) malloc(FACTORY_DATA_BUFFER_LEN);
     uint16_t factorydata_len = 0x5A5A;
 
     if (buffer)
     {
         FactoryDataDecoder decoder = FactoryDataDecoder::GetInstance();
-        err                        = decoder.ReadFactoryData(buffer, BUFFER_LEN, &factorydata_len);
+        err                        = decoder.ReadFactoryData(buffer, FACTORY_DATA_BUFFER_LEN, &factorydata_len);
         ChipLogDetail(DeviceLayer, "DecodeFactoryData factorydata_len %d!", factorydata_len);
         if (err != CHIP_NO_ERROR)
         {
diff --git a/src/platform/realtek/BEE/ThreadStackManagerImpl.cpp b/src/platform/realtek/BEE/ThreadStackManagerImpl.cpp
index 130197c..a6deb12 100644
--- a/src/platform/realtek/BEE/ThreadStackManagerImpl.cpp
+++ b/src/platform/realtek/BEE/ThreadStackManagerImpl.cpp
@@ -40,6 +40,18 @@
 #include <platform/ThreadStackManager.h>
 #include <platforms/openthread-system.h>
 
+#if DLPS_EN
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void BEE_RadioExternalWakeup(void);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
 extern void otSysInit(int argc, char * argv[]);
 
 namespace chip {
@@ -54,6 +66,26 @@
     return InitThreadStack(NULL);
 }
 
+void ThreadStackManagerImpl::_LockThreadStack(void)
+{
+    xSemaphoreTake(sInstance.mThreadStackLock, portMAX_DELAY);
+#if DLPS_EN
+    // Wake up the radio before accessing the Thread stack to ensure it's
+    // responsive, as part of the Deep Low Power State (DLPS) management.
+    BEE_RadioExternalWakeup();
+#endif
+}
+
+bool ThreadStackManagerImpl::_TryLockThreadStack(void)
+{
+    return xSemaphoreTake(sInstance.mThreadStackLock, 0) == pdTRUE;
+}
+
+void ThreadStackManagerImpl::_UnlockThreadStack(void)
+{
+    xSemaphoreGive(sInstance.mThreadStackLock);
+}
+
 CHIP_ERROR ThreadStackManagerImpl::InitThreadStack(otInstance * otInst)
 {
     CHIP_ERROR err = CHIP_NO_ERROR;
diff --git a/src/platform/realtek/BEE/ThreadStackManagerImpl.h b/src/platform/realtek/BEE/ThreadStackManagerImpl.h
index f3be687..39522b0 100644
--- a/src/platform/realtek/BEE/ThreadStackManagerImpl.h
+++ b/src/platform/realtek/BEE/ThreadStackManagerImpl.h
@@ -92,6 +92,9 @@
 protected:
     // ===== Methods that implement the ThreadStackManager abstract interface.
     CHIP_ERROR _StartThreadTask();
+    void _LockThreadStack(void);
+    bool _TryLockThreadStack(void);
+    void _UnlockThreadStack(void);
 
 private:
     // ===== Methods that implement the ThreadStackManager abstract interface.