From 2b3ace04ff43e1799cb71a662e32872fe229dc87 Mon Sep 17 00:00:00 2001 From: lpbeliveau-silabs Date: Thu, 18 Jul 2024 11:10:48 -0400 Subject: [PATCH] Grouped extern C statements --- examples/platform/silabs/BaseApplication.h | 4 ++-- ...GenericThreadStackManagerImpl_OpenThread.hpp | 2 +- .../silabs/ConfigurationManagerImpl.cpp | 4 ++-- .../silabs/efr32/ThreadStackManagerImpl.cpp | 17 +++++++---------- third_party/silabs/BUILD.gn | 1 + third_party/silabs/efr32_sdk.gni | 2 ++ 6 files changed, 15 insertions(+), 15 deletions(-) diff --git a/examples/platform/silabs/BaseApplication.h b/examples/platform/silabs/BaseApplication.h index ed233246ec8ee5..161f1cdc9eb2fd 100644 --- a/examples/platform/silabs/BaseApplication.h +++ b/examples/platform/silabs/BaseApplication.h @@ -165,8 +165,8 @@ class BaseApplication static void UpdateCommissioningStatus(bool newState); /** - * @brief Called when the last Fabric is removed, clears all Fabric related data and Thread Wifi provision. - * @note This function preserves some NVM3 data that is not Fabric scoped like Attribute Value or Boot Count. + * @brief Called when the last Fabric is removed, clears all Fabric related data, including Thread and Wifi provision. + * @note This function preserves some NVM3 data that is not Fabric scoped, like Attribute Value or Boot Count. */ static void DoProvisioningReset(); diff --git a/src/platform/OpenThread/GenericThreadStackManagerImpl_OpenThread.hpp b/src/platform/OpenThread/GenericThreadStackManagerImpl_OpenThread.hpp index 3fe20c2cf6a804..61452f5ff0ec90 100644 --- a/src/platform/OpenThread/GenericThreadStackManagerImpl_OpenThread.hpp +++ b/src/platform/OpenThread/GenericThreadStackManagerImpl_OpenThread.hpp @@ -1090,7 +1090,7 @@ CHIP_ERROR GenericThreadStackManagerImpl_OpenThread::_GetPollPeriod(u /** * @brief Helper that sets callbacks for OpenThread state changes and configures the Thread stack. - * Assigns mOTInst to and instance and configures the OT stack on a device by setting state change callbacks enabling features + * Assigns mOTInst to an instance, and configures the OT stack on a device by setting state change callbacks enabling features * for IPv6 address configuration, enabling the Thread network if necessary, and handling SRP if enabled. * Allows for the configuration of the Thread stack on a device where the instance and the otCLI are already initialised. * diff --git a/src/platform/silabs/ConfigurationManagerImpl.cpp b/src/platform/silabs/ConfigurationManagerImpl.cpp index 48ca5109e616d2..5a511038c799ed 100644 --- a/src/platform/silabs/ConfigurationManagerImpl.cpp +++ b/src/platform/silabs/ConfigurationManagerImpl.cpp @@ -263,11 +263,13 @@ void ConfigurationManagerImpl::RunConfigUnitTest(void) /// @brief Helper to erase Thread info from device void ConfigurationManagerImpl::ClearThreadStack() { +#if CHIP_DEVICE_CONFIG_ENABLE_THREAD #if CHIP_DEVICE_CONFIG_ENABLE_THREAD_SRP_CLIENT ThreadStackMgr().ClearAllSrpHostAndServices(); #endif // CHIP_DEVICE_CONFIG_ENABLE_THREAD_SRP_CLIENT ChipLogProgress(DeviceLayer, "Clearing Thread provision"); ThreadStackMgr().ErasePersistentInfo(); +#endif // CHIP_DEVICE_CONFIG_ENABLE_THREAD } void ConfigurationManagerImpl::DoFactoryReset(intptr_t arg) @@ -282,9 +284,7 @@ void ConfigurationManagerImpl::DoFactoryReset(intptr_t arg) ChipLogError(DeviceLayer, "FactoryResetConfig() failed: %s", chip::ErrorStr(err)); } -#if CHIP_DEVICE_CONFIG_ENABLE_THREAD GetDefaultInstance().ClearThreadStack(); -#endif // CHIP_DEVICE_CONFIG_ENABLE_THREAD PersistedStorage::KeyValueStoreMgrImpl().ErasePartition(); diff --git a/src/platform/silabs/efr32/ThreadStackManagerImpl.cpp b/src/platform/silabs/efr32/ThreadStackManagerImpl.cpp index ae44ed09fc7a18..d2ae058a8a03f1 100644 --- a/src/platform/silabs/efr32/ThreadStackManagerImpl.cpp +++ b/src/platform/silabs/efr32/ThreadStackManagerImpl.cpp @@ -41,14 +41,11 @@ extern "C" { #include "platform-efr32.h" -} - -// Forward declaration -extern "C" otInstance * otGetInstance(void); - +otInstance * otGetInstance(void); #if CHIP_DEVICE_CONFIG_THREAD_ENABLE_CLI -extern "C" void otAppCliInit(otInstance * aInstance); -#endif +void otAppCliInit(otInstance * aInstance); +#endif // CHIP_DEVICE_CONFIG_THREAD_ENABLE_CLI +} namespace chip { namespace DeviceLayer { @@ -56,21 +53,21 @@ namespace { otInstance * sOTInstance = NULL; // Network commissioning -#ifndef _NO_NETWORK_COMMISSIONING_DRIVER_ +#ifndef _NO_GENERIC_THREAD_NETWORK_COMMISSIONING_DRIVER_ NetworkCommissioning::GenericThreadDriver sGenericThreadDriver; app::Clusters::NetworkCommissioning::Instance sThreadNetworkCommissioningInstance(0 /* Endpoint Id */, &sGenericThreadDriver); #endif void initStaticNetworkCommissioningThreadDriver(void) { -#ifndef _NO_NETWORK_COMMISSIONING_DRIVER_ +#ifndef _NO_GENERIC_THREAD_NETWORK_COMMISSIONING_DRIVER_ sThreadNetworkCommissioningInstance.Init(); #endif } void shutdownStaticNetworkCommissioningThreadDriver(void) { -#ifndef _NO_NETWORK_COMMISSIONING_DRIVER_ +#ifndef _NO_GENERIC_THREAD_NETWORK_COMMISSIONING_DRIVER_ sThreadNetworkCommissioningInstance.Shutdown(); #endif } diff --git a/third_party/silabs/BUILD.gn b/third_party/silabs/BUILD.gn index 915cf8ba2bf164..e08c7cd0bd11bd 100644 --- a/third_party/silabs/BUILD.gn +++ b/third_party/silabs/BUILD.gn @@ -211,6 +211,7 @@ if (wifi_soc != true) { # CCP board include_dirs = [ "${sl_ot_platform_abstraction}/include" ] } + sources += [ "${sl_ot_platform_abstraction}/efr32/sleep.c" ] # Use silabs openthread library stack with or without coap api enabled COAP_API = "" diff --git a/third_party/silabs/efr32_sdk.gni b/third_party/silabs/efr32_sdk.gni index f22f82d464a240..08695af1fc3800 100644 --- a/third_party/silabs/efr32_sdk.gni +++ b/third_party/silabs/efr32_sdk.gni @@ -916,6 +916,8 @@ template("efr32_sdk") { sources += [ "${efr32_sdk_root}/hardware/driver/configuration_over_swo/src/sl_cos.c", "${efr32_sdk_root}/platform/driver/debug/src/sl_debug_swo.c", + "${efr32_sdk_root}/util/third_party/mbedtls/library/hmac_drbg.c", + "${efr32_sdk_root}/util/third_party/mbedtls/library/psa_crypto_ecp.c", ] }