From 3c3931fc6692d781d49d3e3398cde33c0d0fe71e Mon Sep 17 00:00:00 2001 From: chirag-silabs <100861685+chirag-silabs@users.noreply.github.com> Date: Mon, 28 Nov 2022 18:47:59 +0530 Subject: [PATCH] [Silabs] EFR32 common files modification, logging and some extra changes (#23751) * example/platform/silabs/efr32 modifications of common files * App modifications for the logging * src/platform folder modification with logging and common file modifications * restyling and some build changes that were missed * adding logs to places where it was missed for the build to pass --- examples/chef/efr32/include/AppConfig.h | 4 +- examples/chef/efr32/src/AppTask.cpp | 6 +- examples/chef/efr32/src/LightingManager.cpp | 12 +- examples/chef/efr32/src/main.cpp | 6 +- .../efr32/include/AppConfig.h | 4 +- .../light-switch-app/efr32/src/AppTask.cpp | 8 +- examples/light-switch-app/efr32/src/main.cpp | 10 +- .../lighting-app/silabs/efr32/src/AppTask.cpp | 18 +- .../silabs/efr32/src/LightingManager.cpp | 14 +- .../lighting-app/silabs/efr32/src/main.cpp | 10 +- examples/lock-app/efr32/include/AppConfig.h | 4 +- examples/lock-app/efr32/src/AppTask.cpp | 20 +- examples/lock-app/efr32/src/LockManager.cpp | 104 ++++----- examples/lock-app/efr32/src/main.cpp | 10 +- .../efr32/include/AppConfig.h | 4 +- examples/persistent-storage/efr32/main.cpp | 12 +- examples/pigweed-app/efr32/BUILD.gn | 2 +- .../pigweed-app/efr32/include/AppConfig.h | 4 +- examples/pigweed-app/efr32/src/main.cpp | 2 +- ...s.cpp => SilabsDeviceAttestationCreds.cpp} | 24 ++- ...Creds.h => SilabsDeviceAttestationCreds.h} | 6 +- examples/platform/silabs/efr32/BUILD.gn | 4 +- .../platform/silabs/efr32/BaseApplication.cpp | 42 ++-- .../silabs/efr32/EFR32DeviceDataProvider.cpp | 37 ++-- .../silabs/efr32/EFR32DeviceDataProvider.h | 4 +- .../platform/silabs/efr32/MemMonitoring.cpp | 30 +-- .../platform/silabs/efr32/display/lcd.cpp | 12 +- .../platform/silabs/efr32/efr32_utils.cpp | 2 +- examples/platform/silabs/efr32/efr32_utils.h | 4 +- .../silabs/efr32/init_efrPlatform.cpp | 4 +- .../platform/silabs/efr32/matter_config.cpp | 18 +- .../platform/silabs/efr32/wf200/efr_spi.c | 2 +- .../platform/silabs/efr32/wf200/host_if.cpp | 158 +++++++------- .../platform/silabs/efr32/wf200/sl_wfx_task.c | 4 +- .../platform/silabs/efr32/wf200/wf200_init.c | 8 +- examples/platform/silabs/efr32_creds.h | 41 ---- examples/platform/silabs/silabs_creds.h | 41 ++++ examples/shell/efr32/include/AppConfig.h | 4 +- examples/shell/efr32/src/main.cpp | 26 +-- examples/thermostat/efr32/include/AppConfig.h | 4 +- examples/thermostat/efr32/src/AppTask.cpp | 14 +- .../thermostat/efr32/src/SensorManager.cpp | 8 +- .../efr32/src/TemperatureManager.cpp | 10 +- .../thermostat/efr32/src/ThermostatUI.cpp | 2 +- examples/thermostat/efr32/src/main.cpp | 10 +- examples/window-app/efr32/include/AppConfig.h | 4 +- .../window-app/efr32/src/WindowAppImpl.cpp | 26 +-- examples/window-app/efr32/src/main.cpp | 10 +- .../silabs/CHIPDevicePlatformConfig.h | 6 +- src/platform/silabs/CHIPDevicePlatformEvent.h | 8 +- src/platform/silabs/CHIPPlatformConfig.h | 8 +- .../silabs/ConfigurationManagerImpl.h | 4 +- src/platform/silabs/ConnectivityManagerImpl.h | 4 +- .../silabs/DiagnosticDataProviderImpl.cpp | 4 +- src/platform/silabs/EFR32/BLEManagerImpl.cpp | 2 +- src/platform/silabs/EFR32/BUILD.gn | 4 +- .../silabs/EFR32/ConfigurationManagerImpl.cpp | 46 ++-- .../EFR32/Efr32PsaOperationalKeystore.cpp | 12 +- .../silabs/EFR32/KeyValueStoreManagerImpl.cpp | 34 +-- .../silabs/EFR32/OTAImageProcessorImpl.cpp | 2 +- .../silabs/EFR32/PlatformManagerImpl.cpp | 2 +- .../silabs/EFR32/wifi/dhcp_client.cpp | 12 +- src/platform/silabs/EFR32/wifi/ethernetif.cpp | 56 ++--- src/platform/silabs/EFR32/wifi/wfx_notify.cpp | 14 +- src/platform/silabs/EFR32Config.h | 199 ------------------ src/platform/silabs/InetPlatformConfig.h | 2 +- src/platform/silabs/Logging.cpp | 52 ++--- .../silabs/NetworkCommissioningWiFiDriver.cpp | 16 +- src/platform/silabs/PlatformManagerImpl.h | 4 +- .../{EFR32Config.cpp => SilabsConfig.cpp} | 60 +++--- src/platform/silabs/SilabsConfig.h | 199 ++++++++++++++++++ src/platform/silabs/SystemPlatformConfig.h | 2 +- src/platform/silabs/WarmPlatformConfig.h | 2 +- src/test_driver/efr32/BUILD.gn | 2 +- src/test_driver/efr32/include/AppConfig.h | 4 +- src/test_driver/efr32/src/main.cpp | 6 +- third_party/silabs/BUILD.gn | 2 +- third_party/silabs/efr32_sdk.gni | 2 +- 78 files changed, 795 insertions(+), 788 deletions(-) rename examples/platform/silabs/{EFR32DeviceAttestationCreds.cpp => SilabsDeviceAttestationCreds.cpp} (80%) rename examples/platform/silabs/{EFR32DeviceAttestationCreds.h => SilabsDeviceAttestationCreds.h} (92%) delete mode 100644 examples/platform/silabs/efr32_creds.h create mode 100644 examples/platform/silabs/silabs_creds.h delete mode 100644 src/platform/silabs/EFR32Config.h rename src/platform/silabs/{EFR32Config.cpp => SilabsConfig.cpp} (87%) create mode 100644 src/platform/silabs/SilabsConfig.h diff --git a/examples/chef/efr32/include/AppConfig.h b/examples/chef/efr32/include/AppConfig.h index 946b593cab50a4..a936fe1d8abaeb 100644 --- a/examples/chef/efr32/include/AppConfig.h +++ b/examples/chef/efr32/include/AppConfig.h @@ -32,10 +32,10 @@ extern "C" { #endif -void efr32InitLog(void); +void silabsInitLog(void); void efr32Log(const char * aFormat, ...); -#define EFR32_LOG(...) efr32Log(__VA_ARGS__); +#define SILABS_LOG(...) efr32Log(__VA_ARGS__); void appError(int err); #ifdef __cplusplus diff --git a/examples/chef/efr32/src/AppTask.cpp b/examples/chef/efr32/src/AppTask.cpp index a14eece74d85d3..0eb2b9ec492268 100644 --- a/examples/chef/efr32/src/AppTask.cpp +++ b/examples/chef/efr32/src/AppTask.cpp @@ -135,7 +135,7 @@ CHIP_ERROR AppTask::Init() err = BaseApplication::Init(&gIdentify); if (err != CHIP_NO_ERROR) { - EFR32_LOG("BaseApplication::Init() failed"); + SILABS_LOG("BaseApplication::Init() failed"); appError(err); } @@ -155,11 +155,11 @@ void AppTask::AppTaskMain(void * pvParameter) CHIP_ERROR err = sAppTask.Init(); if (err != CHIP_NO_ERROR) { - EFR32_LOG("AppTask.Init() failed"); + SILABS_LOG("AppTask.Init() failed"); appError(err); } - EFR32_LOG("App Task started"); + SILABS_LOG("App Task started"); while (true) { diff --git a/examples/chef/efr32/src/LightingManager.cpp b/examples/chef/efr32/src/LightingManager.cpp index 59ee2744cf6d5e..d6684bfa14ff2b 100644 --- a/examples/chef/efr32/src/LightingManager.cpp +++ b/examples/chef/efr32/src/LightingManager.cpp @@ -39,7 +39,7 @@ CHIP_ERROR LightingManager::Init() if (sLightTimer == NULL) { - EFR32_LOG("sLightTimer timer create failed"); + SILABS_LOG("sLightTimer timer create failed"); return APP_ERROR_CREATE_TIMER_FAILED; } @@ -125,7 +125,7 @@ void LightingManager::StartTimer(uint32_t aTimeoutMs) { if (xTimerIsTimerActive(sLightTimer)) { - EFR32_LOG("app timer already started!"); + SILABS_LOG("app timer already started!"); CancelTimer(); } @@ -134,7 +134,7 @@ void LightingManager::StartTimer(uint32_t aTimeoutMs) // cannot immediately be sent to the timer command queue. if (xTimerChangePeriod(sLightTimer, (aTimeoutMs / portTICK_PERIOD_MS), 100) != pdPASS) { - EFR32_LOG("sLightTimer timer start() failed"); + SILABS_LOG("sLightTimer timer start() failed"); appError(APP_ERROR_START_TIMER_FAILED); } } @@ -143,7 +143,7 @@ void LightingManager::CancelTimer(void) { if (xTimerStop(sLightTimer, 0) == pdFAIL) { - EFR32_LOG("sLightTimer stop() failed"); + SILABS_LOG("sLightTimer stop() failed"); appError(APP_ERROR_STOP_TIMER_FAILED); } } @@ -183,7 +183,7 @@ void LightingManager::AutoTurnOffTimerEventHandler(AppEvent * aEvent) light->mAutoTurnOffTimerArmed = false; - EFR32_LOG("Auto Turn Off has been triggered!"); + SILABS_LOG("Auto Turn Off has been triggered!"); light->InitiateAction(actor, OFF_ACTION); } @@ -219,7 +219,7 @@ void LightingManager::ActuatorMovementTimerEventHandler(AppEvent * aEvent) light->mAutoTurnOffTimerArmed = true; - EFR32_LOG("Auto Turn off enabled. Will be triggered in %u seconds", light->mAutoTurnOffDuration); + SILABS_LOG("Auto Turn off enabled. Will be triggered in %u seconds", light->mAutoTurnOffDuration); } } } diff --git a/examples/chef/efr32/src/main.cpp b/examples/chef/efr32/src/main.cpp index 81cc220fc6a346..c54683e092bd90 100644 --- a/examples/chef/efr32/src/main.cpp +++ b/examples/chef/efr32/src/main.cpp @@ -65,16 +65,16 @@ int main(void) #endif chip::DeviceLayer::PlatformMgr().UnlockChipStack(); - EFR32_LOG("Starting App Task"); + SILABS_LOG("Starting App Task"); if (AppTask::GetAppTask().StartAppTask() != CHIP_NO_ERROR) appError(CHIP_ERROR_INTERNAL); - EFR32_LOG("Starting FreeRTOS scheduler"); + SILABS_LOG("Starting FreeRTOS scheduler"); sl_system_kernel_start(); // Should never get here. chip::Platform::MemoryShutdown(); - EFR32_LOG("vTaskStartScheduler() failed"); + SILABS_LOG("vTaskStartScheduler() failed"); appError(CHIP_ERROR_INTERNAL); } diff --git a/examples/light-switch-app/efr32/include/AppConfig.h b/examples/light-switch-app/efr32/include/AppConfig.h index 946b593cab50a4..a936fe1d8abaeb 100644 --- a/examples/light-switch-app/efr32/include/AppConfig.h +++ b/examples/light-switch-app/efr32/include/AppConfig.h @@ -32,10 +32,10 @@ extern "C" { #endif -void efr32InitLog(void); +void silabsInitLog(void); void efr32Log(const char * aFormat, ...); -#define EFR32_LOG(...) efr32Log(__VA_ARGS__); +#define SILABS_LOG(...) efr32Log(__VA_ARGS__); void appError(int err); #ifdef __cplusplus diff --git a/examples/light-switch-app/efr32/src/AppTask.cpp b/examples/light-switch-app/efr32/src/AppTask.cpp index 96459f9a188bb1..3a3b2434b416dd 100644 --- a/examples/light-switch-app/efr32/src/AppTask.cpp +++ b/examples/light-switch-app/efr32/src/AppTask.cpp @@ -157,7 +157,7 @@ CHIP_ERROR AppTask::Init() err = BaseApplication::Init(&gIdentify); if (err != CHIP_NO_ERROR) { - EFR32_LOG("BaseApplication::Init() failed"); + SILABS_LOG("BaseApplication::Init() failed"); appError(err); } @@ -165,7 +165,7 @@ CHIP_ERROR AppTask::Init() err = InitBindingHandler(); if (err != CHIP_NO_ERROR) { - EFR32_LOG("InitBindingHandler() failed"); + SILABS_LOG("InitBindingHandler() failed"); appError(err); } @@ -185,7 +185,7 @@ void AppTask::AppTaskMain(void * pvParameter) CHIP_ERROR err = sAppTask.Init(); if (err != CHIP_NO_ERROR) { - EFR32_LOG("AppTask.Init() failed"); + SILABS_LOG("AppTask.Init() failed"); appError(err); } @@ -193,7 +193,7 @@ void AppTask::AppTaskMain(void * pvParameter) sAppTask.StartStatusLEDTimer(); #endif - EFR32_LOG("App Task started"); + SILABS_LOG("App Task started"); while (true) { BaseType_t eventReceived = xQueueReceive(sAppEventQueue, &event, portMAX_DELAY); diff --git a/examples/light-switch-app/efr32/src/main.cpp b/examples/light-switch-app/efr32/src/main.cpp index 7c6cebba603c81..0b0211fdbfe61c 100644 --- a/examples/light-switch-app/efr32/src/main.cpp +++ b/examples/light-switch-app/efr32/src/main.cpp @@ -28,7 +28,7 @@ #include #include #ifdef EFR32_ATTESTATION_CREDENTIALS -#include +#include #else #include #endif @@ -59,22 +59,22 @@ int main(void) chip::DeviceLayer::PlatformMgr().LockChipStack(); // Initialize device attestation config #ifdef EFR32_ATTESTATION_CREDENTIALS - SetDeviceAttestationCredentialsProvider(EFR32::GetEFR32DacProvider()); + SetDeviceAttestationCredentialsProvider(Silabs::GetSilabsDacProvider()); #else SetDeviceAttestationCredentialsProvider(Examples::GetExampleDACProvider()); #endif chip::DeviceLayer::PlatformMgr().UnlockChipStack(); - EFR32_LOG("Starting App Task"); + SILABS_LOG("Starting App Task"); if (AppTask::GetAppTask().StartAppTask() != CHIP_NO_ERROR) appError(CHIP_ERROR_INTERNAL); - EFR32_LOG("Starting FreeRTOS scheduler"); + SILABS_LOG("Starting FreeRTOS scheduler"); sl_system_kernel_start(); // Should never get here. chip::Platform::MemoryShutdown(); - EFR32_LOG("vTaskStartScheduler() failed"); + SILABS_LOG("vTaskStartScheduler() failed"); appError(CHIP_ERROR_INTERNAL); } diff --git a/examples/lighting-app/silabs/efr32/src/AppTask.cpp b/examples/lighting-app/silabs/efr32/src/AppTask.cpp index 5735943282d21c..850649df25e27d 100644 --- a/examples/lighting-app/silabs/efr32/src/AppTask.cpp +++ b/examples/lighting-app/silabs/efr32/src/AppTask.cpp @@ -141,14 +141,14 @@ CHIP_ERROR AppTask::Init() err = BaseApplication::Init(&gIdentify); if (err != CHIP_NO_ERROR) { - EFR32_LOG("BaseApplication::Init() failed"); + SILABS_LOG("BaseApplication::Init() failed"); appError(err); } err = LightMgr().Init(); if (err != CHIP_NO_ERROR) { - EFR32_LOG("LightMgr::Init() failed"); + SILABS_LOG("LightMgr::Init() failed"); appError(err); } @@ -175,7 +175,7 @@ void AppTask::AppTaskMain(void * pvParameter) CHIP_ERROR err = sAppTask.Init(); if (err != CHIP_NO_ERROR) { - EFR32_LOG("AppTask.Init() failed"); + SILABS_LOG("AppTask.Init() failed"); appError(err); } @@ -183,7 +183,7 @@ void AppTask::AppTaskMain(void * pvParameter) sAppTask.StartStatusLEDTimer(); #endif - EFR32_LOG("App Task started"); + SILABS_LOG("App Task started"); while (true) { @@ -242,7 +242,7 @@ void AppTask::LightActionEventHandler(AppEvent * aEvent) if (!initiated) { - EFR32_LOG("Action is already in progress or active."); + SILABS_LOG("Action is already in progress or active."); } } } @@ -274,7 +274,7 @@ void AppTask::ActionInitiated(LightingManager::Action_t aAction, int32_t aActor) { // Action initiated, update the light led bool lightOn = aAction == LightingManager::ON_ACTION; - EFR32_LOG("Turning light %s", (lightOn) ? "On" : "Off") + SILABS_LOG("Turning light %s", (lightOn) ? "On" : "Off") #ifdef ENABLE_WSTK_LEDS sLightLED.Set(lightOn); @@ -295,11 +295,11 @@ void AppTask::ActionCompleted(LightingManager::Action_t aAction) // action has been completed bon the light if (aAction == LightingManager::ON_ACTION) { - EFR32_LOG("Light ON") + SILABS_LOG("Light ON") } else if (aAction == LightingManager::OFF_ACTION) { - EFR32_LOG("Light OFF") + SILABS_LOG("Light OFF") } if (sAppTask.mSyncClusterToButtonAction) @@ -328,6 +328,6 @@ void AppTask::UpdateClusterState(intptr_t context) if (status != EMBER_ZCL_STATUS_SUCCESS) { - EFR32_LOG("ERR: updating on/off %x", status); + SILABS_LOG("ERR: updating on/off %x", status); } } diff --git a/examples/lighting-app/silabs/efr32/src/LightingManager.cpp b/examples/lighting-app/silabs/efr32/src/LightingManager.cpp index ac5f86a1fb0faf..31a4ca0ba91e7c 100644 --- a/examples/lighting-app/silabs/efr32/src/LightingManager.cpp +++ b/examples/lighting-app/silabs/efr32/src/LightingManager.cpp @@ -57,7 +57,7 @@ CHIP_ERROR LightingManager::Init() if (sLightTimer == NULL) { - EFR32_LOG("sLightTimer timer create failed"); + SILABS_LOG("sLightTimer timer create failed"); return APP_ERROR_CREATE_TIMER_FAILED; } @@ -156,7 +156,7 @@ void LightingManager::StartTimer(uint32_t aTimeoutMs) { if (xTimerIsTimerActive(sLightTimer)) { - EFR32_LOG("app timer already started!"); + SILABS_LOG("app timer already started!"); CancelTimer(); } @@ -165,7 +165,7 @@ void LightingManager::StartTimer(uint32_t aTimeoutMs) // cannot immediately be sent to the timer command queue. if (xTimerChangePeriod(sLightTimer, (aTimeoutMs / portTICK_PERIOD_MS), 100) != pdPASS) { - EFR32_LOG("sLightTimer timer start() failed"); + SILABS_LOG("sLightTimer timer start() failed"); appError(APP_ERROR_START_TIMER_FAILED); } } @@ -174,7 +174,7 @@ void LightingManager::CancelTimer(void) { if (xTimerStop(sLightTimer, 0) == pdFAIL) { - EFR32_LOG("sLightTimer stop() failed"); + SILABS_LOG("sLightTimer stop() failed"); appError(APP_ERROR_STOP_TIMER_FAILED); } } @@ -218,7 +218,7 @@ void LightingManager::AutoTurnOffTimerEventHandler(AppEvent * aEvent) light->mAutoTurnOffTimerArmed = false; - EFR32_LOG("Auto Turn Off has been triggered!"); + SILABS_LOG("Auto Turn Off has been triggered!"); light->InitiateAction(actor, OFF_ACTION); } @@ -236,7 +236,7 @@ void LightingManager::OffEffectTimerEventHandler(AppEvent * aEvent) light->mOffEffectArmed = false; - EFR32_LOG("OffEffect completed"); + SILABS_LOG("OffEffect completed"); light->InitiateAction(actor, OFF_ACTION); } @@ -272,7 +272,7 @@ void LightingManager::ActuatorMovementTimerEventHandler(AppEvent * aEvent) light->mAutoTurnOffTimerArmed = true; - EFR32_LOG("Auto Turn off enabled. Will be triggered in %u seconds", light->mAutoTurnOffDuration); + SILABS_LOG("Auto Turn off enabled. Will be triggered in %u seconds", light->mAutoTurnOffDuration); } } } diff --git a/examples/lighting-app/silabs/efr32/src/main.cpp b/examples/lighting-app/silabs/efr32/src/main.cpp index c9838ac87b9e5a..2594f6f9216e78 100644 --- a/examples/lighting-app/silabs/efr32/src/main.cpp +++ b/examples/lighting-app/silabs/efr32/src/main.cpp @@ -28,7 +28,7 @@ #include #include #ifdef EFR32_ATTESTATION_CREDENTIALS -#include +#include #else #include #endif @@ -59,22 +59,22 @@ int main(void) chip::DeviceLayer::PlatformMgr().LockChipStack(); // Initialize device attestation config #ifdef EFR32_ATTESTATION_CREDENTIALS - SetDeviceAttestationCredentialsProvider(EFR32::GetEFR32DacProvider()); + SetDeviceAttestationCredentialsProvider(Silabs::GetSilabsDacProvider()); #else SetDeviceAttestationCredentialsProvider(Examples::GetExampleDACProvider()); #endif chip::DeviceLayer::PlatformMgr().UnlockChipStack(); - EFR32_LOG("Starting App Task"); + SILABS_LOG("Starting App Task"); if (AppTask::GetAppTask().StartAppTask() != CHIP_NO_ERROR) appError(CHIP_ERROR_INTERNAL); - EFR32_LOG("Starting FreeRTOS scheduler"); + SILABS_LOG("Starting FreeRTOS scheduler"); sl_system_kernel_start(); // Should never get here. chip::Platform::MemoryShutdown(); - EFR32_LOG("vTaskStartScheduler() failed"); + SILABS_LOG("vTaskStartScheduler() failed"); appError(CHIP_ERROR_INTERNAL); } diff --git a/examples/lock-app/efr32/include/AppConfig.h b/examples/lock-app/efr32/include/AppConfig.h index 096560abefe349..3014c5be66479c 100644 --- a/examples/lock-app/efr32/include/AppConfig.h +++ b/examples/lock-app/efr32/include/AppConfig.h @@ -32,10 +32,10 @@ extern "C" { #endif -void efr32InitLog(void); +void silabsInitLog(void); void efr32Log(const char * aFormat, ...); -#define EFR32_LOG(...) efr32Log(__VA_ARGS__); +#define SILABS_LOG(...) efr32Log(__VA_ARGS__); void appError(int err); #ifdef __cplusplus diff --git a/examples/lock-app/efr32/src/AppTask.cpp b/examples/lock-app/efr32/src/AppTask.cpp index ae683cc92f86b5..55003936dc515e 100644 --- a/examples/lock-app/efr32/src/AppTask.cpp +++ b/examples/lock-app/efr32/src/AppTask.cpp @@ -160,7 +160,7 @@ CHIP_ERROR AppTask::Init() err = BaseApplication::Init(&gIdentify); if (err != CHIP_NO_ERROR) { - EFR32_LOG("BaseApplication::Init() failed"); + SILABS_LOG("BaseApplication::Init() failed"); appError(err); } @@ -168,7 +168,7 @@ CHIP_ERROR AppTask::Init() err = RegisterLockEvents(); if (err != CHIP_NO_ERROR) { - EFR32_LOG("RegisterLockEvents() failed"); + SILABS_LOG("RegisterLockEvents() failed"); appError(err); } #endif // ENABLE_CHIP_SHELL @@ -241,7 +241,7 @@ CHIP_ERROR AppTask::Init() if (err != CHIP_NO_ERROR) { - EFR32_LOG("LockMgr().Init() failed"); + SILABS_LOG("LockMgr().Init() failed"); appError(err); } @@ -273,7 +273,7 @@ void AppTask::AppTaskMain(void * pvParameter) CHIP_ERROR err = sAppTask.Init(); if (err != CHIP_NO_ERROR) { - EFR32_LOG("AppTask.Init() failed"); + SILABS_LOG("AppTask.Init() failed"); appError(err); } @@ -281,7 +281,7 @@ void AppTask::AppTaskMain(void * pvParameter) sAppTask.StartStatusLEDTimer(); #endif - EFR32_LOG("App Task started"); + SILABS_LOG("App Task started"); // Users and credentials should be checked once from nvm flash on boot LockMgr().ReadConfigValues(); @@ -350,7 +350,7 @@ void AppTask::LockActionEventHandler(AppEvent * aEvent) if (!initiated) { - EFR32_LOG("Action is already in progress or active."); + SILABS_LOG("Action is already in progress or active."); } } } @@ -383,7 +383,7 @@ void AppTask::ActionInitiated(LockManager::Action_t aAction, int32_t aActor) if (aAction == LockManager::UNLOCK_ACTION || aAction == LockManager::LOCK_ACTION) { bool locked = (aAction == LockManager::LOCK_ACTION); - EFR32_LOG("%s Action has been initiated", (locked) ? "Lock" : "Unlock"); + SILABS_LOG("%s Action has been initiated", (locked) ? "Lock" : "Unlock"); #ifdef ENABLE_WSTK_LEDS sLockLED.Set(!locked); #endif // ENABLE_WSTK_LEDS @@ -406,11 +406,11 @@ void AppTask::ActionCompleted(LockManager::Action_t aAction) // Turn on the lock LED if in an UNLOCKED state. if (aAction == LockManager::LOCK_ACTION) { - EFR32_LOG("Lock Action has been completed") + SILABS_LOG("Lock Action has been completed") } else if (aAction == LockManager::UNLOCK_ACTION) { - EFR32_LOG("Unlock Action has been completed") + SILABS_LOG("Unlock Action has been completed") } if (sAppTask.mSyncClusterToButtonAction) @@ -443,6 +443,6 @@ void AppTask::UpdateClusterState(intptr_t context) if (status != EMBER_ZCL_STATUS_SUCCESS) { - EFR32_LOG("ERR: updating lock state %x", status); + SILABS_LOG("ERR: updating lock state %x", status); } } diff --git a/examples/lock-app/efr32/src/LockManager.cpp b/examples/lock-app/efr32/src/LockManager.cpp index 4e7e17b092daa6..abc7b4513e2f71 100644 --- a/examples/lock-app/efr32/src/LockManager.cpp +++ b/examples/lock-app/efr32/src/LockManager.cpp @@ -40,22 +40,22 @@ CHIP_ERROR LockManager::Init(chip::app::DataModel::Nullable kMaxUsers) { - EFR32_LOG("Max number of users is greater than %d, the maximum amount of users currently supported on this platform", - kMaxUsers); + SILABS_LOG("Max number of users is greater than %d, the maximum amount of users currently supported on this platform", + kMaxUsers); return APP_ERROR_ALLOCATION_FAILED; } if (LockParams.numberOfCredentialsPerUser > kMaxCredentialsPerUser) { - EFR32_LOG("Max number of credentials per user is greater than %d, the maximum amount of users currently supported on this " - "platform", - kMaxCredentialsPerUser); + SILABS_LOG("Max number of credentials per user is greater than %d, the maximum amount of users currently supported on this " + "platform", + kMaxCredentialsPerUser); return APP_ERROR_ALLOCATION_FAILED; } if (LockParams.numberOfWeekdaySchedulesPerUser > kMaxWeekdaySchedulesPerUser) { - EFR32_LOG( + SILABS_LOG( "Max number of schedules is greater than %d, the maximum amount of schedules currently supported on this platform", kMaxWeekdaySchedulesPerUser); return APP_ERROR_ALLOCATION_FAILED; @@ -63,7 +63,7 @@ CHIP_ERROR LockManager::Init(chip::app::DataModel::Nullable kMaxYeardaySchedulesPerUser) { - EFR32_LOG( + SILABS_LOG( "Max number of schedules is greater than %d, the maximum amount of schedules currently supported on this platform", kMaxYeardaySchedulesPerUser); return APP_ERROR_ALLOCATION_FAILED; @@ -71,7 +71,7 @@ CHIP_ERROR LockManager::Init(chip::app::DataModel::Nullable kMaxHolidaySchedules) { - EFR32_LOG( + SILABS_LOG( "Max number of schedules is greater than %d, the maximum amount of schedules currently supported on this platform", kMaxHolidaySchedules); return APP_ERROR_ALLOCATION_FAILED; @@ -87,7 +87,7 @@ CHIP_ERROR LockManager::Init(chip::app::DataModel::Nullable(&mLockUsers), - sizeof(EmberAfPluginDoorLockUserInfo) * ArraySize(mLockUsers), outLen); + SILABSConfig::ReadConfigValueBin(SILABSConfig::kConfigKey_LockUser, reinterpret_cast(&mLockUsers), + sizeof(EmberAfPluginDoorLockUserInfo) * ArraySize(mLockUsers), outLen); - EFR32Config::ReadConfigValueBin(EFR32Config::kConfigKey_Credential, reinterpret_cast(&mLockCredentials), - sizeof(EmberAfPluginDoorLockCredentialInfo) * ArraySize(mLockCredentials), outLen); + SILABSConfig::ReadConfigValueBin(SILABSConfig::kConfigKey_Credential, reinterpret_cast(&mLockCredentials), + sizeof(EmberAfPluginDoorLockCredentialInfo) * ArraySize(mLockCredentials), outLen); - EFR32Config::ReadConfigValueBin(EFR32Config::kConfigKey_LockUserName, reinterpret_cast(mUserNames), - sizeof(mUserNames), outLen); + SILABSConfig::ReadConfigValueBin(SILABSConfig::kConfigKey_LockUserName, reinterpret_cast(mUserNames), + sizeof(mUserNames), outLen); - EFR32Config::ReadConfigValueBin(EFR32Config::kConfigKey_CredentialData, reinterpret_cast(mCredentialData), - sizeof(mCredentialData), outLen); + SILABSConfig::ReadConfigValueBin(SILABSConfig::kConfigKey_CredentialData, reinterpret_cast(mCredentialData), + sizeof(mCredentialData), outLen); - EFR32Config::ReadConfigValueBin(EFR32Config::kConfigKey_UserCredentials, reinterpret_cast(mCredentials), - sizeof(DlCredential) * LockParams.numberOfUsers * LockParams.numberOfCredentialsPerUser, - outLen); + SILABSConfig::ReadConfigValueBin(SILABSConfig::kConfigKey_UserCredentials, reinterpret_cast(mCredentials), + sizeof(DlCredential) * LockParams.numberOfUsers * LockParams.numberOfCredentialsPerUser, + outLen); - EFR32Config::ReadConfigValueBin(EFR32Config::kConfigKey_WeekDaySchedules, reinterpret_cast(mWeekdaySchedule), - sizeof(EmberAfPluginDoorLockWeekDaySchedule) * LockParams.numberOfWeekdaySchedulesPerUser * - LockParams.numberOfUsers, - outLen); + SILABSConfig::ReadConfigValueBin(SILABSConfig::kConfigKey_WeekDaySchedules, reinterpret_cast(mWeekdaySchedule), + sizeof(EmberAfPluginDoorLockWeekDaySchedule) * LockParams.numberOfWeekdaySchedulesPerUser * + LockParams.numberOfUsers, + outLen); - EFR32Config::ReadConfigValueBin(EFR32Config::kConfigKey_YearDaySchedules, reinterpret_cast(mYeardaySchedule), - sizeof(EmberAfPluginDoorLockYearDaySchedule) * LockParams.numberOfYeardaySchedulesPerUser * - LockParams.numberOfUsers, - outLen); + SILABSConfig::ReadConfigValueBin(SILABSConfig::kConfigKey_YearDaySchedules, reinterpret_cast(mYeardaySchedule), + sizeof(EmberAfPluginDoorLockYearDaySchedule) * LockParams.numberOfYeardaySchedulesPerUser * + LockParams.numberOfUsers, + outLen); - EFR32Config::ReadConfigValueBin(EFR32Config::kConfigKey_HolidaySchedules, reinterpret_cast(&(mHolidaySchedule)), - sizeof(EmberAfPluginDoorLockHolidaySchedule) * LockParams.numberOfHolidaySchedules, outLen); + SILABSConfig::ReadConfigValueBin(SILABSConfig::kConfigKey_HolidaySchedules, reinterpret_cast(&(mHolidaySchedule)), + sizeof(EmberAfPluginDoorLockHolidaySchedule) * LockParams.numberOfHolidaySchedules, outLen); return true; } @@ -219,7 +219,7 @@ void LockManager::StartTimer(uint32_t aTimeoutMs) { if (xTimerIsTimerActive(sLockTimer)) { - EFR32_LOG("app timer already started!"); + SILABS_LOG("app timer already started!"); CancelTimer(); } @@ -228,7 +228,7 @@ void LockManager::StartTimer(uint32_t aTimeoutMs) // cannot immediately be sent to the timer command queue. if (xTimerChangePeriod(sLockTimer, (aTimeoutMs / portTICK_PERIOD_MS), 100) != pdPASS) { - EFR32_LOG("sLockTimer timer start() failed"); + SILABS_LOG("sLockTimer timer start() failed"); appError(APP_ERROR_START_TIMER_FAILED); } } @@ -237,7 +237,7 @@ void LockManager::CancelTimer(void) { if (xTimerStop(sLockTimer, 0) == pdFAIL) { - EFR32_LOG("sLockTimer stop() failed"); + SILABS_LOG("sLockTimer stop() failed"); appError(APP_ERROR_STOP_TIMER_FAILED); } } @@ -386,14 +386,14 @@ bool LockManager::SetUser(chip::EndpointId endpointId, uint16_t userIndex, chip: userInStorage.credentials = chip::Span(mCredentials[userIndex], totalCredentials); // Save user information in NVM flash - EFR32Config::WriteConfigValueBin(EFR32Config::kConfigKey_LockUser, reinterpret_cast(&mLockUsers), - sizeof(EmberAfPluginDoorLockUserInfo) * LockParams.numberOfUsers); + SILABSConfig::WriteConfigValueBin(SILABSConfig::kConfigKey_LockUser, reinterpret_cast(&mLockUsers), + sizeof(EmberAfPluginDoorLockUserInfo) * LockParams.numberOfUsers); - EFR32Config::WriteConfigValueBin(EFR32Config::kConfigKey_UserCredentials, reinterpret_cast(mCredentials), - sizeof(DlCredential) * LockParams.numberOfUsers * LockParams.numberOfCredentialsPerUser); + SILABSConfig::WriteConfigValueBin(SILABSConfig::kConfigKey_UserCredentials, reinterpret_cast(mCredentials), + sizeof(DlCredential) * LockParams.numberOfUsers * LockParams.numberOfCredentialsPerUser); - EFR32Config::WriteConfigValueBin(EFR32Config::kConfigKey_LockUserName, reinterpret_cast(mUserNames), - sizeof(mUserNames)); + SILABSConfig::WriteConfigValueBin(SILABSConfig::kConfigKey_LockUserName, reinterpret_cast(mUserNames), + sizeof(mUserNames)); ChipLogProgress(Zcl, "Successfully set the user [mEndpointId=%d,index=%d]", endpointId, userIndex); @@ -473,11 +473,11 @@ bool LockManager::SetCredential(chip::EndpointId endpointId, uint16_t credential credentialInStorage.credentialData = chip::ByteSpan{ mCredentialData[credentialIndex], credentialData.size() }; // Save credential information in NVM flash - EFR32Config::WriteConfigValueBin(EFR32Config::kConfigKey_Credential, reinterpret_cast(&mLockCredentials), - sizeof(EmberAfPluginDoorLockCredentialInfo) * LockParams.numberOfCredentialsPerUser); + SILABSConfig::WriteConfigValueBin(SILABSConfig::kConfigKey_Credential, reinterpret_cast(&mLockCredentials), + sizeof(EmberAfPluginDoorLockCredentialInfo) * LockParams.numberOfCredentialsPerUser); - EFR32Config::WriteConfigValueBin(EFR32Config::kConfigKey_CredentialData, reinterpret_cast(&mCredentialData), - sizeof(mCredentialData)); + SILABSConfig::WriteConfigValueBin(SILABSConfig::kConfigKey_CredentialData, reinterpret_cast(&mCredentialData), + sizeof(mCredentialData)); ChipLogProgress(Zcl, "Successfully set the credential [credentialType=%u]", to_underlying(credentialType)); @@ -532,9 +532,9 @@ DlStatus LockManager::SetWeekdaySchedule(chip::EndpointId endpointId, uint8_t we scheduleInStorage.status = status; // Save schedule information in NVM flash - EFR32Config::WriteConfigValueBin(EFR32Config::kConfigKey_WeekDaySchedules, reinterpret_cast(mWeekdaySchedule), - sizeof(EmberAfPluginDoorLockWeekDaySchedule) * LockParams.numberOfWeekdaySchedulesPerUser * - LockParams.numberOfUsers); + SILABSConfig::WriteConfigValueBin( + SILABSConfig::kConfigKey_WeekDaySchedules, reinterpret_cast(mWeekdaySchedule), + sizeof(EmberAfPluginDoorLockWeekDaySchedule) * LockParams.numberOfWeekdaySchedulesPerUser * LockParams.numberOfUsers); return DlStatus::kSuccess; } @@ -581,9 +581,9 @@ DlStatus LockManager::SetYeardaySchedule(chip::EndpointId endpointId, uint8_t ye scheduleInStorage.status = status; // Save schedule information in NVM flash - EFR32Config::WriteConfigValueBin(EFR32Config::kConfigKey_YearDaySchedules, reinterpret_cast(mYeardaySchedule), - sizeof(EmberAfPluginDoorLockYearDaySchedule) * LockParams.numberOfYeardaySchedulesPerUser * - LockParams.numberOfUsers); + SILABSConfig::WriteConfigValueBin( + SILABSConfig::kConfigKey_YearDaySchedules, reinterpret_cast(mYeardaySchedule), + sizeof(EmberAfPluginDoorLockYearDaySchedule) * LockParams.numberOfYeardaySchedulesPerUser * LockParams.numberOfUsers); return DlStatus::kSuccess; } @@ -625,9 +625,9 @@ DlStatus LockManager::SetHolidaySchedule(chip::EndpointId endpointId, uint8_t ho scheduleInStorage.status = status; // Save schedule information in NVM flash - EFR32Config::WriteConfigValueBin(EFR32Config::kConfigKey_HolidaySchedules, - reinterpret_cast(&(mHolidaySchedule)), - sizeof(EmberAfPluginDoorLockHolidaySchedule) * LockParams.numberOfHolidaySchedules); + SILABSConfig::WriteConfigValueBin(SILABSConfig::kConfigKey_HolidaySchedules, + reinterpret_cast(&(mHolidaySchedule)), + sizeof(EmberAfPluginDoorLockHolidaySchedule) * LockParams.numberOfHolidaySchedules); return DlStatus::kSuccess; } diff --git a/examples/lock-app/efr32/src/main.cpp b/examples/lock-app/efr32/src/main.cpp index 0856b9f11baf83..67ec50bc6c1319 100644 --- a/examples/lock-app/efr32/src/main.cpp +++ b/examples/lock-app/efr32/src/main.cpp @@ -28,7 +28,7 @@ #include #include #ifdef EFR32_ATTESTATION_CREDENTIALS -#include +#include #else #include #endif @@ -59,22 +59,22 @@ int main(void) chip::DeviceLayer::PlatformMgr().LockChipStack(); // Initialize device attestation config #ifdef EFR32_ATTESTATION_CREDENTIALS - SetDeviceAttestationCredentialsProvider(EFR32::GetEFR32DacProvider()); + SetDeviceAttestationCredentialsProvider(Silabs::GetSilabsDacProvider()); #else SetDeviceAttestationCredentialsProvider(Examples::GetExampleDACProvider()); #endif chip::DeviceLayer::PlatformMgr().UnlockChipStack(); - EFR32_LOG("Starting App Task"); + SILABS_LOG("Starting App Task"); if (AppTask::GetAppTask().StartAppTask() != CHIP_NO_ERROR) appError(CHIP_ERROR_INTERNAL); - EFR32_LOG("Starting FreeRTOS scheduler"); + SILABS_LOG("Starting FreeRTOS scheduler"); sl_system_kernel_start(); // Should never get here. chip::Platform::MemoryShutdown(); - EFR32_LOG("vTaskStartScheduler() failed"); + SILABS_LOG("vTaskStartScheduler() failed"); appError(CHIP_ERROR_INTERNAL); } diff --git a/examples/persistent-storage/efr32/include/AppConfig.h b/examples/persistent-storage/efr32/include/AppConfig.h index ae2846d90c6caa..a6f11ca804fd78 100644 --- a/examples/persistent-storage/efr32/include/AppConfig.h +++ b/examples/persistent-storage/efr32/include/AppConfig.h @@ -24,10 +24,10 @@ extern "C" { #endif -void efr32InitLog(void); +void silabsInitLog(void); void efr32Log(const char * aFormat, ...); -#define EFR32_LOG(...) efr32Log(__VA_ARGS__); +#define SILABS_LOG(...) efr32Log(__VA_ARGS__); #ifdef __cplusplus } diff --git a/examples/persistent-storage/efr32/main.cpp b/examples/persistent-storage/efr32/main.cpp index fea4ccb297a965..408ca379320f03 100644 --- a/examples/persistent-storage/efr32/main.cpp +++ b/examples/persistent-storage/efr32/main.cpp @@ -40,7 +40,7 @@ void TestTask(void * pvParameter) { while (true) { - EFR32_LOG("Running Tests:"); + SILABS_LOG("Running Tests:"); chip::RunKvsTest(); vTaskDelay(60000); // Run every minute } @@ -51,16 +51,16 @@ int main(void) init_efrPlatform(); chip::DeviceLayer::PersistedStorage::KeyValueStoreMgrImpl().Init(); - EFR32_LOG("=================================================="); - EFR32_LOG("chip-efr32-persitent-storage-example starting"); - EFR32_LOG("=================================================="); + SILABS_LOG("=================================================="); + SILABS_LOG("chip-efr32-persitent-storage-example starting"); + SILABS_LOG("=================================================="); // Run tests xTaskCreate(TestTask, "Test", 2048, NULL, 1, &sTestTaskHandle); - EFR32_LOG("Starting FreeRTOS scheduler"); + SILABS_LOG("Starting FreeRTOS scheduler"); sl_system_kernel_start(); // Should never get here. - EFR32_LOG("vTaskStartScheduler() failed"); + SILABS_LOG("vTaskStartScheduler() failed"); return -1; } diff --git a/examples/pigweed-app/efr32/BUILD.gn b/examples/pigweed-app/efr32/BUILD.gn index cdc2bcacbc8fa8..5bbdfc0e0fd313 100644 --- a/examples/pigweed-app/efr32/BUILD.gn +++ b/examples/pigweed-app/efr32/BUILD.gn @@ -42,7 +42,7 @@ efr32_sdk("sdk") { defines = [ "BOARD_ID=${silabs_board}", "HAL_VCOM_ENABLE=1", - "EFR32_LOG_ENABLED=1", + "SILABS_LOG_ENABLED=1", "PW_RPC_ENABLED", ] } diff --git a/examples/pigweed-app/efr32/include/AppConfig.h b/examples/pigweed-app/efr32/include/AppConfig.h index 8935b7f3bb7284..95955e5bb09f08 100644 --- a/examples/pigweed-app/efr32/include/AppConfig.h +++ b/examples/pigweed-app/efr32/include/AppConfig.h @@ -39,9 +39,9 @@ extern "C" { #endif -void efr32InitLog(void); +void silabsInitLog(void); void efr32Log(const char * aFormat, ...); -#define EFR32_LOG(...) efr32Log(__VA_ARGS__); +#define SILABS_LOG(...) efr32Log(__VA_ARGS__); void appError(int err); #ifdef __cplusplus diff --git a/examples/pigweed-app/efr32/src/main.cpp b/examples/pigweed-app/efr32/src/main.cpp index 3ac349372f8856..ff53016b40d887 100644 --- a/examples/pigweed-app/efr32/src/main.cpp +++ b/examples/pigweed-app/efr32/src/main.cpp @@ -60,7 +60,7 @@ void RunRpcService(void *) int main(void) { init_efrPlatform(); - EFR32_LOG("***** CHIP EFR32 pigweed example *****\r\n"); + SILABS_LOG("***** CHIP EFR32 pigweed example *****\r\n"); pw_sys_io_Init(); // Initialize LEDs diff --git a/examples/platform/silabs/EFR32DeviceAttestationCreds.cpp b/examples/platform/silabs/SilabsDeviceAttestationCreds.cpp similarity index 80% rename from examples/platform/silabs/EFR32DeviceAttestationCreds.cpp rename to examples/platform/silabs/SilabsDeviceAttestationCreds.cpp index f68f0b892be1d6..2b405196b31059 100644 --- a/examples/platform/silabs/EFR32DeviceAttestationCreds.cpp +++ b/examples/platform/silabs/SilabsDeviceAttestationCreds.cpp @@ -14,30 +14,30 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include "EFR32DeviceAttestationCreds.h" +#include "SilabsDeviceAttestationCreds.h" #include #include #include #include -#include "efr32_creds.h" #include "psa/crypto.h" +#include "silabs_creds.h" extern uint8_t __attestation_credentials_base[]; namespace chip { namespace Credentials { -namespace EFR32 { +namespace Silabs { namespace { -class DeviceAttestationCredsEFR32 : public DeviceAttestationCredentialsProvider +class DeviceAttestationCredsSilabs : public DeviceAttestationCredentialsProvider { public: CHIP_ERROR GetCertificationDeclaration(MutableByteSpan & out_buffer) override { - ByteSpan cd_span(((uint8_t *) __attestation_credentials_base) + EFR32_CREDENTIALS_CD_OFFSET, EFR32_CREDENTIALS_CD_SIZE); + ByteSpan cd_span(((uint8_t *) __attestation_credentials_base) + SILABS_CREDENTIALS_CD_OFFSET, SILABS_CREDENTIALS_CD_SIZE); return CopySpanToMutableSpan(cd_span, out_buffer); } @@ -50,19 +50,21 @@ class DeviceAttestationCredsEFR32 : public DeviceAttestationCredentialsProvider CHIP_ERROR GetDeviceAttestationCert(MutableByteSpan & out_buffer) override { - ByteSpan cert_span(((uint8_t *) __attestation_credentials_base) + EFR32_CREDENTIALS_DAC_OFFSET, EFR32_CREDENTIALS_DAC_SIZE); + ByteSpan cert_span(((uint8_t *) __attestation_credentials_base) + SILABS_CREDENTIALS_DAC_OFFSET, + SILABS_CREDENTIALS_DAC_SIZE); return CopySpanToMutableSpan(cert_span, out_buffer); } CHIP_ERROR GetProductAttestationIntermediateCert(MutableByteSpan & out_pai_buffer) override { - ByteSpan cert_span(((uint8_t *) __attestation_credentials_base) + EFR32_CREDENTIALS_PAI_OFFSET, EFR32_CREDENTIALS_PAI_SIZE); + ByteSpan cert_span(((uint8_t *) __attestation_credentials_base) + SILABS_CREDENTIALS_PAI_OFFSET, + SILABS_CREDENTIALS_PAI_SIZE); return CopySpanToMutableSpan(cert_span, out_pai_buffer); } CHIP_ERROR SignWithDeviceAttestationKey(const ByteSpan & message_to_sign, MutableByteSpan & out_buffer) override { - psa_key_id_t key_id = EFR32_CREDENTIALS_DAC_KEY_ID; + psa_key_id_t key_id = SILABS_CREDENTIALS_DAC_KEY_ID; uint8_t signature[64] = { 0 }; size_t signature_size = sizeof(signature); @@ -76,12 +78,12 @@ class DeviceAttestationCredsEFR32 : public DeviceAttestationCredentialsProvider } // namespace -DeviceAttestationCredentialsProvider * GetEFR32DacProvider() +DeviceAttestationCredentialsProvider * GetSilabsDacProvider() { - static DeviceAttestationCredsEFR32 dac_provider; + static DeviceAttestationCredsSilabs dac_provider; return &dac_provider; } -} // namespace EFR32 +} // namespace Silabs } // namespace Credentials } // namespace chip diff --git a/examples/platform/silabs/EFR32DeviceAttestationCreds.h b/examples/platform/silabs/SilabsDeviceAttestationCreds.h similarity index 92% rename from examples/platform/silabs/EFR32DeviceAttestationCreds.h rename to examples/platform/silabs/SilabsDeviceAttestationCreds.h index 3dbc48a01b0872..ad98fbbbe6760b 100644 --- a/examples/platform/silabs/EFR32DeviceAttestationCreds.h +++ b/examples/platform/silabs/SilabsDeviceAttestationCreds.h @@ -23,7 +23,7 @@ namespace chip { namespace Credentials { -namespace EFR32 { +namespace Silabs { /** * @brief Get implementation of a sample DAC provider to validate device @@ -32,8 +32,8 @@ namespace EFR32 { * @returns a singleton DeviceAttestationCredentialsProvider that relies on no * storage abstractions. */ -DeviceAttestationCredentialsProvider * GetEFR32DacProvider(); +DeviceAttestationCredentialsProvider * GetSilabsDacProvider(); -} // namespace EFR32 +} // namespace Silabs } // namespace Credentials } // namespace chip diff --git a/examples/platform/silabs/efr32/BUILD.gn b/examples/platform/silabs/efr32/BUILD.gn index 9f644031b14341..dbd8473a6c89de 100644 --- a/examples/platform/silabs/efr32/BUILD.gn +++ b/examples/platform/silabs/efr32/BUILD.gn @@ -82,8 +82,8 @@ config("attestation-credentials-config") { source_set("efr32-attestation-credentials") { sources = [ - "../EFR32DeviceAttestationCreds.cpp", - "../EFR32DeviceAttestationCreds.h", + "../SilabsDeviceAttestationCreds.cpp", + "../SilabsDeviceAttestationCreds.h", ] public_deps = [ diff --git a/examples/platform/silabs/efr32/BaseApplication.cpp b/examples/platform/silabs/efr32/BaseApplication.cpp index 70f876c311cd06..85748b35359d3f 100644 --- a/examples/platform/silabs/efr32/BaseApplication.cpp +++ b/examples/platform/silabs/efr32/BaseApplication.cpp @@ -142,7 +142,7 @@ CHIP_ERROR BaseApplication::StartAppTask(TaskFunction_t taskFunction) sAppEventQueue = xQueueCreateStatic(APP_EVENT_QUEUE_SIZE, sizeof(AppEvent), sAppEventQueueBuffer, &sAppEventQueueStruct); if (sAppEventQueue == NULL) { - EFR32_LOG("Failed to allocate app event queue"); + SILABS_LOG("Failed to allocate app event queue"); appError(APP_ERROR_EVENT_QUEUE_FAILED); } @@ -151,7 +151,7 @@ CHIP_ERROR BaseApplication::StartAppTask(TaskFunction_t taskFunction) xTaskCreateStatic(taskFunction, APP_TASK_NAME, ArraySize(appStack), &sAppEventQueue, 1, appStack, &appTaskStruct); if (sAppTaskHandle == nullptr) { - EFR32_LOG("Failed to create app task"); + SILABS_LOG("Failed to create app task"); appError(APP_ERROR_CREATE_TASK_FAILED); } return CHIP_NO_ERROR; @@ -163,7 +163,7 @@ CHIP_ERROR BaseApplication::Init(Identify * identifyObj) if (identifyObj == nullptr) { - EFR32_LOG("Invalid Identify Object!"); + SILABS_LOG("Invalid Identify Object!"); appError(CHIP_ERROR_INVALID_ARGUMENT); } @@ -173,12 +173,12 @@ CHIP_ERROR BaseApplication::Init(Identify * identifyObj) /* * Wait for the WiFi to be initialized */ - EFR32_LOG("APP: Wait WiFi Init"); + SILABS_LOG("APP: Wait WiFi Init"); while (!wfx_hw_ready()) { vTaskDelay(10); } - EFR32_LOG("APP: Done WiFi Init"); + SILABS_LOG("APP: Done WiFi Init"); /* We will init server when we get IP */ sWiFiNetworkCommissioningInstance.Init(); @@ -193,7 +193,7 @@ CHIP_ERROR BaseApplication::Init(Identify * identifyObj) ); if (sFunctionTimer == NULL) { - EFR32_LOG("funct timer create failed"); + SILABS_LOG("funct timer create failed"); appError(APP_ERROR_CREATE_TIMER_FAILED); } @@ -206,11 +206,11 @@ CHIP_ERROR BaseApplication::Init(Identify * identifyObj) ); if (sLightTimer == NULL) { - EFR32_LOG("Light Timer create failed"); + SILABS_LOG("Light Timer create failed"); appError(APP_ERROR_CREATE_TIMER_FAILED); } - EFR32_LOG("Current Software Version: %s", CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING); + SILABS_LOG("Current Software Version: %s", CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING); #ifdef ENABLE_WSTK_LEDS LEDWidget::InitGpio(); @@ -235,7 +235,7 @@ CHIP_ERROR BaseApplication::Init(Identify * identifyObj) } else { - EFR32_LOG("Getting QR code failed!"); + SILABS_LOG("Getting QR code failed!"); } return err; @@ -261,7 +261,7 @@ void BaseApplication::FunctionEventHandler(AppEvent * aEvent) // initiate factory reset if (mFunctionTimerActive && mFunction == kFunction_StartBleAdv) { - EFR32_LOG("Factory Reset Triggered. Release button within %ums to cancel.", FACTORY_RESET_CANCEL_WINDOW_TIMEOUT); + SILABS_LOG("Factory Reset Triggered. Release button within %ums to cancel.", FACTORY_RESET_CANCEL_WINDOW_TIMEOUT); // Start timer for FACTORY_RESET_CANCEL_WINDOW_TIMEOUT to allow user to // cancel, if required. @@ -438,10 +438,10 @@ void BaseApplication::ButtonHandler(AppEvent * aEvent) chip::DeviceLayer::PlatformMgr().UnlockChipStack(); if (err != CHIP_NO_ERROR) { - EFR32_LOG("Failed to open the Basic Commissioning Window"); + SILABS_LOG("Failed to open the Basic Commissioning Window"); } } - else { EFR32_LOG("Network is already provisioned, Ble advertissement not enabled"); } + else { SILABS_LOG("Network is already provisioned, Ble advertissement not enabled"); } } else if (mFunctionTimerActive && mFunction == kFunction_FactoryReset) { @@ -454,7 +454,7 @@ void BaseApplication::ButtonHandler(AppEvent * aEvent) // Change the function to none selected since factory reset has been // canceled. mFunction = kFunction_NoneSelected; - EFR32_LOG("Factory Reset has been Canceled"); + SILABS_LOG("Factory Reset has been Canceled"); } } } @@ -463,7 +463,7 @@ void BaseApplication::CancelFunctionTimer() { if (xTimerStop(sFunctionTimer, 0) == pdFAIL) { - EFR32_LOG("app timer stop() failed"); + SILABS_LOG("app timer stop() failed"); appError(APP_ERROR_STOP_TIMER_FAILED); } @@ -474,7 +474,7 @@ void BaseApplication::StartFunctionTimer(uint32_t aTimeoutInMs) { if (xTimerIsTimerActive(sFunctionTimer)) { - EFR32_LOG("app timer already started!"); + SILABS_LOG("app timer already started!"); CancelFunctionTimer(); } @@ -483,7 +483,7 @@ void BaseApplication::StartFunctionTimer(uint32_t aTimeoutInMs) // cannot immediately be sent to the timer command queue. if (xTimerChangePeriod(sFunctionTimer, aTimeoutInMs / portTICK_PERIOD_MS, 100) != pdPASS) { - EFR32_LOG("app timer start() failed"); + SILABS_LOG("app timer start() failed"); appError(APP_ERROR_START_TIMER_FAILED); } @@ -494,7 +494,7 @@ void BaseApplication::StartStatusLEDTimer() { if (pdPASS != xTimerStart(sLightTimer, 0)) { - EFR32_LOG("Light Time start failed"); + SILABS_LOG("Light Time start failed"); appError(APP_ERROR_START_TIMER_FAILED); } } @@ -507,7 +507,7 @@ void BaseApplication::StopStatusLEDTimer() if (xTimerStop(sLightTimer, 100) != pdPASS) { - EFR32_LOG("Light Time start failed"); + SILABS_LOG("Light Time start failed"); appError(APP_ERROR_START_TIMER_FAILED); } } @@ -549,12 +549,12 @@ void BaseApplication::PostEvent(const AppEvent * aEvent) if (!status) { - EFR32_LOG("Failed to post event to app task event queue"); + SILABS_LOG("Failed to post event to app task event queue"); } } else { - EFR32_LOG("Event Queue is NULL should never happen"); + SILABS_LOG("Event Queue is NULL should never happen"); } } @@ -566,6 +566,6 @@ void BaseApplication::DispatchEvent(AppEvent * aEvent) } else { - EFR32_LOG("Event received with no handler. Dropping event."); + SILABS_LOG("Event received with no handler. Dropping event."); } } diff --git a/examples/platform/silabs/efr32/EFR32DeviceDataProvider.cpp b/examples/platform/silabs/efr32/EFR32DeviceDataProvider.cpp index 07966d3f3ba0fa..6e097ffa4db0e2 100644 --- a/examples/platform/silabs/efr32/EFR32DeviceDataProvider.cpp +++ b/examples/platform/silabs/efr32/EFR32DeviceDataProvider.cpp @@ -18,7 +18,7 @@ #include "EFR32DeviceDataProvider.h" #include #include -#include +#include #include #include @@ -34,7 +34,7 @@ CHIP_ERROR EFR32DeviceDataProvider::GetSetupDiscriminator(uint16_t & setupDiscri CHIP_ERROR err; uint32_t setupDiscriminator32; - err = EFR32Config::ReadConfigValue(EFR32Config::kConfigKey_SetupDiscriminator, setupDiscriminator32); + err = SILABSConfig::ReadConfigValue(SILABSConfig::kConfigKey_SetupDiscriminator, setupDiscriminator32); #if defined(CHIP_DEVICE_CONFIG_USE_TEST_SETUP_DISCRIMINATOR) && CHIP_DEVICE_CONFIG_USE_TEST_SETUP_DISCRIMINATOR if (err == CHIP_DEVICE_ERROR_CONFIG_NOT_FOUND) { @@ -50,7 +50,7 @@ CHIP_ERROR EFR32DeviceDataProvider::GetSetupDiscriminator(uint16_t & setupDiscri CHIP_ERROR EFR32DeviceDataProvider::GetSpake2pIterationCount(uint32_t & iterationCount) { - CHIP_ERROR err = EFR32Config::ReadConfigValue(EFR32Config::kConfigKey_Spake2pIterationCount, iterationCount); + CHIP_ERROR err = SILABSConfig::ReadConfigValue(SILABSConfig::kConfigKey_Spake2pIterationCount, iterationCount); #if defined(CHIP_DEVICE_CONFIG_USE_TEST_SPAKE2P_ITERATION_COUNT) && CHIP_DEVICE_CONFIG_USE_TEST_SPAKE2P_ITERATION_COUNT if (err == CHIP_DEVICE_ERROR_CONFIG_NOT_FOUND) @@ -70,7 +70,7 @@ CHIP_ERROR EFR32DeviceDataProvider::GetSpake2pSalt(MutableByteSpan & saltBuf) char saltB64[kSpake2pSalt_MaxBase64Len] = { 0 }; size_t saltB64Len = 0; - err = EFR32Config::ReadConfigValueStr(EFR32Config::kConfigKey_Spake2pSalt, saltB64, sizeof(saltB64), saltB64Len); + err = SILABSConfig::ReadConfigValueStr(SILABSConfig::kConfigKey_Spake2pSalt, saltB64, sizeof(saltB64), saltB64Len); #if defined(CHIP_DEVICE_CONFIG_USE_TEST_SPAKE2P_SALT) if (err == CHIP_DEVICE_ERROR_CONFIG_NOT_FOUND) @@ -103,8 +103,8 @@ CHIP_ERROR EFR32DeviceDataProvider::GetSpake2pVerifier(MutableByteSpan & verifie char verifierB64[kSpake2pSerializedVerifier_MaxBase64Len] = { 0 }; size_t verifierB64Len = 0; - err = - EFR32Config::ReadConfigValueStr(EFR32Config::kConfigKey_Spake2pVerifier, verifierB64, sizeof(verifierB64), verifierB64Len); + err = SILABSConfig::ReadConfigValueStr(SILABSConfig::kConfigKey_Spake2pVerifier, verifierB64, sizeof(verifierB64), + verifierB64Len); #if defined(CHIP_DEVICE_CONFIG_USE_TEST_SPAKE2P_VERIFIER) if (err == CHIP_DEVICE_ERROR_CONFIG_NOT_FOUND) @@ -133,8 +133,8 @@ CHIP_ERROR EFR32DeviceDataProvider::GetSetupPayload(MutableCharSpan & payloadBuf uint8_t payloadBitSet[kTotalPayloadDataSizeInBytes] = { 0 }; size_t bitSetLen = 0; - err = EFR32Config::ReadConfigValueBin(EFR32Config::kConfigKey_SetupPayloadBitSet, payloadBitSet, kTotalPayloadDataSizeInBytes, - bitSetLen); + err = SILABSConfig::ReadConfigValueBin(SILABSConfig::kConfigKey_SetupPayloadBitSet, payloadBitSet, kTotalPayloadDataSizeInBytes, + bitSetLen); #if defined(CHIP_DEVICE_CONFIG_USE_TEST_SETUP_PIN_CODE) && CHIP_DEVICE_CONFIG_USE_TEST_SETUP_PIN_CODE if (err == CHIP_DEVICE_ERROR_CONFIG_NOT_FOUND) @@ -170,7 +170,7 @@ CHIP_ERROR EFR32DeviceDataProvider::GetSetupPayload(MutableCharSpan & payloadBuf CHIP_ERROR EFR32DeviceDataProvider::GetVendorName(char * buf, size_t bufSize) { size_t vendorNameLen = 0; // without counting null-terminator - return EFR32Config::ReadConfigValueStr(EFR32Config::kConfigKey_VendorName, buf, bufSize, vendorNameLen); + return SILABSConfig::ReadConfigValueStr(SILABSConfig::kConfigKey_VendorName, buf, bufSize, vendorNameLen); } CHIP_ERROR EFR32DeviceDataProvider::GetVendorId(uint16_t & vendorId) @@ -178,7 +178,7 @@ CHIP_ERROR EFR32DeviceDataProvider::GetVendorId(uint16_t & vendorId) ChipError err = CHIP_NO_ERROR; uint32_t vendorId32 = 0; - err = EFR32Config::ReadConfigValue(EFR32Config::kConfigKey_VendorId, vendorId32); + err = SILABSConfig::ReadConfigValue(SILABSConfig::kConfigKey_VendorId, vendorId32); #if defined(CHIP_DEVICE_CONFIG_DEVICE_VENDOR_ID) && CHIP_DEVICE_CONFIG_DEVICE_VENDOR_ID if (err == CHIP_DEVICE_ERROR_CONFIG_NOT_FOUND) @@ -196,7 +196,7 @@ CHIP_ERROR EFR32DeviceDataProvider::GetVendorId(uint16_t & vendorId) CHIP_ERROR EFR32DeviceDataProvider::GetProductName(char * buf, size_t bufSize) { size_t productNameLen = 0; // without counting null-terminator - return EFR32Config::ReadConfigValueStr(EFR32Config::kConfigKey_ProductName, buf, bufSize, productNameLen); + return SILABSConfig::ReadConfigValueStr(SILABSConfig::kConfigKey_ProductName, buf, bufSize, productNameLen); } CHIP_ERROR EFR32DeviceDataProvider::GetProductId(uint16_t & productId) @@ -204,7 +204,7 @@ CHIP_ERROR EFR32DeviceDataProvider::GetProductId(uint16_t & productId) ChipError err = CHIP_NO_ERROR; uint32_t productId32 = 0; - err = EFR32Config::ReadConfigValue(EFR32Config::kConfigKey_ProductId, productId32); + err = SILABSConfig::ReadConfigValue(SILABSConfig::kConfigKey_ProductId, productId32); #if defined(CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_ID) && CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_ID if (err == CHIP_DEVICE_ERROR_CONFIG_NOT_FOUND) @@ -223,7 +223,7 @@ CHIP_ERROR EFR32DeviceDataProvider::GetHardwareVersionString(char * buf, size_t { size_t hardwareVersionStringLen = 0; // without counting null-terminator CHIP_ERROR err = - EFR32Config::ReadConfigValueStr(EFR32Config::kConfigKey_HardwareVersionString, buf, bufSize, hardwareVersionStringLen); + SILABSConfig::ReadConfigValueStr(SILABSConfig::kConfigKey_HardwareVersionString, buf, bufSize, hardwareVersionStringLen); #if defined(CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING) if (err == CHIP_DEVICE_ERROR_CONFIG_NOT_FOUND) { @@ -239,7 +239,7 @@ CHIP_ERROR EFR32DeviceDataProvider::GetHardwareVersion(uint16_t & hardwareVersio CHIP_ERROR err; uint32_t hardwareVersion32; - err = EFR32Config::ReadConfigValue(EFR32Config::kConfigKey_HardwareVersion, hardwareVersion32); + err = SILABSConfig::ReadConfigValue(SILABSConfig::kConfigKey_HardwareVersion, hardwareVersion32); #if defined(CHIP_DEVICE_CONFIG_DEVICE_HARDWARE_VERSION) if (err == CHIP_DEVICE_ERROR_CONFIG_NOT_FOUND) { @@ -260,7 +260,8 @@ CHIP_ERROR EFR32DeviceDataProvider::GetRotatingDeviceIdUniqueId(MutableByteSpan "Length of unique ID for rotating device ID is smaller than minimum."); size_t uniqueIdLen = 0; - err = EFR32Config::ReadConfigValueBin(EFR32Config::kConfigKey_UniqueId, uniqueIdSpan.data(), uniqueIdSpan.size(), uniqueIdLen); + err = + SILABSConfig::ReadConfigValueBin(SILABSConfig::kConfigKey_UniqueId, uniqueIdSpan.data(), uniqueIdSpan.size(), uniqueIdLen); #ifdef CHIP_DEVICE_CONFIG_ROTATING_DEVICE_ID_UNIQUE_ID if (err == CHIP_DEVICE_ERROR_CONFIG_NOT_FOUND) { @@ -282,7 +283,7 @@ CHIP_ERROR EFR32DeviceDataProvider::GetRotatingDeviceIdUniqueId(MutableByteSpan CHIP_ERROR EFR32DeviceDataProvider::GetSerialNumber(char * buf, size_t bufSize) { size_t serialNumberLen = 0; // without counting null-terminator - return EFR32Config::ReadConfigValueStr(EFR32Config::kConfigKey_SerialNum, buf, bufSize, serialNumberLen); + return SILABSConfig::ReadConfigValueStr(SILABSConfig::kConfigKey_SerialNum, buf, bufSize, serialNumberLen); } CHIP_ERROR EFR32DeviceDataProvider::GetManufacturingDate(uint16_t & year, uint8_t & month, uint8_t & day) @@ -293,8 +294,8 @@ CHIP_ERROR EFR32DeviceDataProvider::GetManufacturingDate(uint16_t & year, uint8_ size_t dateLen; char * parseEnd; - err = EFR32Config::ReadConfigValueBin(EFR32Config::kConfigKey_ManufacturingDate, reinterpret_cast(dateStr), - sizeof(dateStr), dateLen); + err = SILABSConfig::ReadConfigValueBin(SILABSConfig::kConfigKey_ManufacturingDate, reinterpret_cast(dateStr), + sizeof(dateStr), dateLen); SuccessOrExit(err); VerifyOrExit(dateLen == kDateStringLength, err = CHIP_ERROR_INVALID_ARGUMENT); diff --git a/examples/platform/silabs/efr32/EFR32DeviceDataProvider.h b/examples/platform/silabs/efr32/EFR32DeviceDataProvider.h index 3efc9a498d4c48..99d90496b30d12 100644 --- a/examples/platform/silabs/efr32/EFR32DeviceDataProvider.h +++ b/examples/platform/silabs/efr32/EFR32DeviceDataProvider.h @@ -29,11 +29,11 @@ namespace EFR32 { */ class EFR32DeviceDataProvider : public CommissionableDataProvider, - public Internal::GenericDeviceInstanceInfoProvider + public Internal::GenericDeviceInstanceInfoProvider { public: EFR32DeviceDataProvider() : - CommissionableDataProvider(), Internal::GenericDeviceInstanceInfoProvider( + CommissionableDataProvider(), Internal::GenericDeviceInstanceInfoProvider( ConfigurationManagerImpl::GetDefaultInstance()) {} diff --git a/examples/platform/silabs/efr32/MemMonitoring.cpp b/examples/platform/silabs/efr32/MemMonitoring.cpp index 08de06eaed18f9..9da075e4e79d42 100644 --- a/examples/platform/silabs/efr32/MemMonitoring.cpp +++ b/examples/platform/silabs/efr32/MemMonitoring.cpp @@ -72,23 +72,23 @@ void MemMonitoring::HeapMonitoring(void * pvParameter) lwipTaskValue = uxTaskGetStackHighWaterMark(lwipHandle); #endif // CHIP_SYSTEM_CONFIG_USE_LWIP - EFR32_LOG("============================="); - EFR32_LOG(" "); - EFR32_LOG("Largest Block allocated 0x%x", largestBlockAllocated); - EFR32_LOG("Number Of Successful Alloc 0x%x", nbAllocSuccess); - EFR32_LOG("Number Of Successful Frees 0x%x", nbFreeSuccess); - EFR32_LOG(" "); - EFR32_LOG("App Task most bytes ever Free 0x%x", (appTaskValue * 4)); - EFR32_LOG("BLE Event most bytes ever Free 0x%x", (bleEventTaskValue * 4)); - EFR32_LOG("BLE Stack most bytes ever Free 0x%x", (bleTaskValue * 4)); - EFR32_LOG("Link Layer Task most bytes ever Free 0x%x", (linkLayerTaskValue * 4)); - EFR32_LOG("OpenThread Task most bytes ever Free 0x%x", (openThreadTaskValue * 4)); - EFR32_LOG("Event Loop Task most bytes ever Free 0x%x", (eventLoopTaskValue * 4)); + SILABS_LOG("============================="); + SILABS_LOG(" "); + SILABS_LOG("Largest Block allocated 0x%x", largestBlockAllocated); + SILABS_LOG("Number Of Successful Alloc 0x%x", nbAllocSuccess); + SILABS_LOG("Number Of Successful Frees 0x%x", nbFreeSuccess); + SILABS_LOG(" "); + SILABS_LOG("App Task most bytes ever Free 0x%x", (appTaskValue * 4)); + SILABS_LOG("BLE Event most bytes ever Free 0x%x", (bleEventTaskValue * 4)); + SILABS_LOG("BLE Stack most bytes ever Free 0x%x", (bleTaskValue * 4)); + SILABS_LOG("Link Layer Task most bytes ever Free 0x%x", (linkLayerTaskValue * 4)); + SILABS_LOG("OpenThread Task most bytes ever Free 0x%x", (openThreadTaskValue * 4)); + SILABS_LOG("Event Loop Task most bytes ever Free 0x%x", (eventLoopTaskValue * 4)); #if CHIP_SYSTEM_CONFIG_USE_LWIP - EFR32_LOG("LWIP Task most bytes ever Free 0x%x", (lwipTaskValue * 4)); + SILABS_LOG("LWIP Task most bytes ever Free 0x%x", (lwipTaskValue * 4)); #endif // CHIP_SYSTEM_CONFIG_USE_LWIP - EFR32_LOG(" "); - EFR32_LOG("============================="); + SILABS_LOG(" "); + SILABS_LOG("============================="); vTaskDelay(pdMS_TO_TICKS(5000)); } } diff --git a/examples/platform/silabs/efr32/display/lcd.cpp b/examples/platform/silabs/efr32/display/lcd.cpp index 8e6b38eb4ca0a8..6e1f2d2fe93de3 100644 --- a/examples/platform/silabs/efr32/display/lcd.cpp +++ b/examples/platform/silabs/efr32/display/lcd.cpp @@ -51,7 +51,7 @@ CHIP_ERROR SilabsLCD::Init(uint8_t * name, bool initialState) { if (APP_NAME_MAX_LENGTH < strlen((char *) name)) { - EFR32_LOG("App Name too long"); + SILABS_LOG("App Name too long"); return CHIP_ERROR_INVALID_ARGUMENT; } else @@ -64,7 +64,7 @@ CHIP_ERROR SilabsLCD::Init(uint8_t * name, bool initialState) status = sl_board_enable_display(); if (status != SL_STATUS_OK) { - EFR32_LOG("Board Display enable fail %d", status); + SILABS_LOG("Board Display enable fail %d", status); err = CHIP_ERROR_INTERNAL; } @@ -72,7 +72,7 @@ CHIP_ERROR SilabsLCD::Init(uint8_t * name, bool initialState) status = DMD_init(0); if (DMD_OK != status) { - EFR32_LOG("DMD init failed %d", status); + SILABS_LOG("DMD init failed %d", status); err = CHIP_ERROR_INTERNAL; } @@ -80,7 +80,7 @@ CHIP_ERROR SilabsLCD::Init(uint8_t * name, bool initialState) status = GLIB_contextInit(&glibContext); if (GLIB_OK != status) { - EFR32_LOG("Glib context init failed %d", status); + SILABS_LOG("Glib context init failed %d", status); err = CHIP_ERROR_INTERNAL; } @@ -89,7 +89,7 @@ CHIP_ERROR SilabsLCD::Init(uint8_t * name, bool initialState) status = GLIB_clear(&glibContext); if (GLIB_OK != status) { - EFR32_LOG("Glib clear failed %d", status); + SILABS_LOG("Glib clear failed %d", status); err = CHIP_ERROR_INTERNAL; } demoUIInit(&glibContext); @@ -157,7 +157,7 @@ void SilabsLCD::WriteQRCode() if (!qrcodegen_encodeText((const char *) mQRCodeBuffer, workBuffer, qrCode, qrcodegen_Ecc_LOW, QR_CODE_VERSION, QR_CODE_VERSION, qrcodegen_Mask_AUTO, true)) { - EFR32_LOG("qrcodegen_encodeText() failed"); + SILABS_LOG("qrcodegen_encodeText() failed"); return; } diff --git a/examples/platform/silabs/efr32/efr32_utils.cpp b/examples/platform/silabs/efr32/efr32_utils.cpp index b428435fbc0966..bd2bf771c60152 100644 --- a/examples/platform/silabs/efr32/efr32_utils.cpp +++ b/examples/platform/silabs/efr32/efr32_utils.cpp @@ -25,7 +25,7 @@ void appError(int err) { - EFR32_LOG("!!!!!!!!!!!! App Critical Error: %d !!!!!!!!!!!", err); + SILABS_LOG("!!!!!!!!!!!! App Critical Error: %d !!!!!!!!!!!", err); portDISABLE_INTERRUPTS(); while (true) ; diff --git a/examples/platform/silabs/efr32/efr32_utils.h b/examples/platform/silabs/efr32/efr32_utils.h index 98087091d9c0e9..b0d508de5f8fe8 100644 --- a/examples/platform/silabs/efr32/efr32_utils.h +++ b/examples/platform/silabs/efr32/efr32_utils.h @@ -24,10 +24,10 @@ extern "C" { #endif -void efr32InitLog(void); +void silabsInitLog(void); void efr32Log(const char * aFormat, ...); -#define EFR32_LOG(...) efr32Log(__VA_ARGS__); +#define SILABS_LOG(...) efr32Log(__VA_ARGS__); void appError(int err); #ifdef __cplusplus diff --git a/examples/platform/silabs/efr32/init_efrPlatform.cpp b/examples/platform/silabs/efr32/init_efrPlatform.cpp index 2234be0e6c919a..993b4fefe069f8 100644 --- a/examples/platform/silabs/efr32/init_efrPlatform.cpp +++ b/examples/platform/silabs/efr32/init_efrPlatform.cpp @@ -71,8 +71,8 @@ void init_efrPlatform(void) SEGGER_SYSVIEW_Start(); #endif -#if EFR32_LOG_ENABLED - efr32InitLog(); +#if SILABS_LOG_ENABLED + silabsInitLog(); #endif #if CHIP_ENABLE_OPENTHREAD diff --git a/examples/platform/silabs/efr32/matter_config.cpp b/examples/platform/silabs/efr32/matter_config.cpp index a9dc33cc177688..83e909588d9811 100644 --- a/examples/platform/silabs/efr32/matter_config.cpp +++ b/examples/platform/silabs/efr32/matter_config.cpp @@ -87,7 +87,7 @@ void UnlockOpenThreadTask(void) CHIP_ERROR EFR32MatterConfig::InitOpenThread(void) { - EFR32_LOG("Initializing OpenThread stack"); + SILABS_LOG("Initializing OpenThread stack"); ReturnErrorOnFailure(ThreadStackMgr().InitThreadStack()); #if CHIP_DEVICE_CONFIG_THREAD_FTD @@ -100,7 +100,7 @@ CHIP_ERROR EFR32MatterConfig::InitOpenThread(void) #endif // CHIP_DEVICE_CONFIG_ENABLE_SED #endif // CHIP_DEVICE_CONFIG_THREAD_FTD - EFR32_LOG("Starting OpenThread task"); + SILABS_LOG("Starting OpenThread task"); return ThreadStackMgrImpl().StartThreadTask(); } #endif // CHIP_ENABLE_OPENTHREAD @@ -121,7 +121,7 @@ void EFR32MatterConfig::ConnectivityEventCallback(const ChipDeviceEvent * event, (event->InternetConnectivityChange.IPv6 == kConnectivity_Established))) { #if EFR32_OTA_ENABLED - EFR32_LOG("Scheduling OTA Requestor initialization") + SILABS_LOG("Scheduling OTA Requestor initialization") chip::DeviceLayer::SystemLayer().StartTimer(chip::System::Clock::Seconds32(OTAConfig::kInitOTARequestorDelaySec), InitOTARequestorHandler, nullptr); #endif @@ -134,9 +134,9 @@ CHIP_ERROR EFR32MatterConfig::InitMatter(const char * appName) mbedtls_platform_set_calloc_free(CHIPPlatformMemoryCalloc, CHIPPlatformMemoryFree); - EFR32_LOG("=================================================="); - EFR32_LOG("%s starting", appName); - EFR32_LOG("=================================================="); + SILABS_LOG("=================================================="); + SILABS_LOG("%s starting", appName); + SILABS_LOG("=================================================="); #if PW_RPC_ENABLED chip::rpc::Init(); @@ -151,7 +151,7 @@ CHIP_ERROR EFR32MatterConfig::InitMatter(const char * appName) //============================================== // Init Matter Stack //============================================== - EFR32_LOG("Init CHIP Stack"); + SILABS_LOG("Init CHIP Stack"); // Init Chip memory management before the stack ReturnErrorOnFailure(chip::Platform::MemoryInit()); ReturnErrorOnFailure(PlatformMgr().InitChipStack()); @@ -196,7 +196,7 @@ CHIP_ERROR EFR32MatterConfig::InitMatter(const char * appName) // OTA Requestor initialization will be triggered by the connectivity events PlatformMgr().AddEventHandler(ConnectivityEventCallback, reinterpret_cast(nullptr)); - EFR32_LOG("Starting Platform Manager Event Loop"); + SILABS_LOG("Starting Platform Manager Event Loop"); ReturnErrorOnFailure(PlatformMgr().StartEventLoopTask()); #ifdef SL_WIFI @@ -239,5 +239,5 @@ extern "C" void vApplicationIdleHook(void) // FreeRTOS Idle callback // Check CHIP Config nvm3 and repack flash if necessary. - Internal::EFR32Config::RepackNvm3Flash(); + Internal::SILABSConfig::RepackNvm3Flash(); } diff --git a/examples/platform/silabs/efr32/wf200/efr_spi.c b/examples/platform/silabs/efr32/wf200/efr_spi.c index d1d26c5b238bfa..fb35093797679d 100644 --- a/examples/platform/silabs/efr32/wf200/efr_spi.c +++ b/examples/platform/silabs/efr32/wf200/efr_spi.c @@ -399,7 +399,7 @@ static void sl_wfx_spi_wakeup_irq_callback(uint8_t irqNumber) *****************************************************************************/ void sl_wfx_host_gpio_init(void) { - EFR32_LOG("WIFI: GPIO Init:IRQ=%d", wirq_irq_nb); + SILABS_LOG("WIFI: GPIO Init:IRQ=%d", wirq_irq_nb); // Enable GPIO clock. CMU_ClockEnable(cmuClock_GPIO, true); diff --git a/examples/platform/silabs/efr32/wf200/host_if.cpp b/examples/platform/silabs/efr32/wf200/host_if.cpp index 60b914c6597171..c7224962adf1ad 100644 --- a/examples/platform/silabs/efr32/wf200/host_if.cpp +++ b/examples/platform/silabs/efr32/wf200/host_if.cpp @@ -91,7 +91,7 @@ struct netif * sta_netif; wfx_wifi_provision_t wifi_provision; sl_wfx_get_counters_cnf_t * counters; sl_wfx_get_counters_cnf_t * Tempcounters; -#define PUT_COUNTER(name) EFR32_LOG("%-24s %lu\r\n", #name, (unsigned long) counters->body.count_##name); +#define PUT_COUNTER(name) SILABS_LOG("%-24s %lu\r\n", #name, (unsigned long) counters->body.count_##name); bool hasNotifiedIPV6 = false; bool hasNotifiedIPV4 = false; @@ -142,7 +142,7 @@ static void wfx_events_task_start() wfxEventTaskStack, &wfxEventTaskBuffer); if (NULL == wfx_events_task_handle) { - EFR32_LOG("Failed to create WFX wfx_events"); + SILABS_LOG("Failed to create WFX wfx_events"); } } @@ -159,7 +159,7 @@ sl_status_t sl_wfx_host_process_event(sl_wfx_generic_message_t * event_payload) { /******** INDICATION ********/ case SL_WFX_STARTUP_IND_ID: { - EFR32_LOG("WFX Startup Completed\r\n"); + SILABS_LOG("WFX Startup Completed\r\n"); PlatformMgrImpl().HandleWFXSystemEvent(WIFI_EVENT, event_payload); break; } @@ -238,32 +238,32 @@ sl_status_t sl_wfx_host_process_event(sl_wfx_generic_message_t * event_payload) case SL_WFX_EXCEPTION_IND_ID: { sl_wfx_exception_ind_t * firmware_exception = (sl_wfx_exception_ind_t *) event_payload; uint8_t * exception_tmp = (uint8_t *) firmware_exception; - EFR32_LOG("firmware exception\r\n"); + SILABS_LOG("firmware exception\r\n"); for (uint16_t i = 0; i < firmware_exception->header.length; i += 16) { - EFR32_LOG("hif: %.8x:", i); + SILABS_LOG("hif: %.8x:", i); for (uint8_t j = 0; (j < 16) && ((i + j) < firmware_exception->header.length); j++) { - EFR32_LOG(" %.2x", *exception_tmp); + SILABS_LOG(" %.2x", *exception_tmp); exception_tmp++; } - EFR32_LOG("\r\n"); + SILABS_LOG("\r\n"); } break; } case SL_WFX_ERROR_IND_ID: { sl_wfx_error_ind_t * firmware_error = (sl_wfx_error_ind_t *) event_payload; uint8_t * error_tmp = (uint8_t *) firmware_error; - EFR32_LOG("firmware error %lu\r\n", firmware_error->body.type); + SILABS_LOG("firmware error %lu\r\n", firmware_error->body.type); for (uint16_t i = 0; i < firmware_error->header.length; i += 16) { - EFR32_LOG("hif: %.8x:", i); + SILABS_LOG("hif: %.8x:", i); for (uint8_t j = 0; (j < 16) && ((i + j) < firmware_error->header.length); j++) { - EFR32_LOG(" %.2x", *error_tmp); + SILABS_LOG(" %.2x", *error_tmp); error_tmp++; } - EFR32_LOG("\r\n"); + SILABS_LOG("\r\n"); } break; } @@ -282,11 +282,11 @@ static void sl_wfx_scan_result_callback(sl_wfx_scan_result_ind_body_t * scan_res { struct scan_result_holder * ap; - EFR32_LOG("# %2d %2d %03d %02X:%02X:%02X:%02X:%02X:%02X %s", scan_count, scan_result->channel, - ((int16_t)(scan_result->rcpi - 220) / 2), scan_result->mac[0], scan_result->mac[1], scan_result->mac[2], - scan_result->mac[3], scan_result->mac[4], scan_result->mac[5], scan_result->ssid_def.ssid); + SILABS_LOG("# %2d %2d %03d %02X:%02X:%02X:%02X:%02X:%02X %s", scan_count, scan_result->channel, + ((int16_t)(scan_result->rcpi - 220) / 2), scan_result->mac[0], scan_result->mac[1], scan_result->mac[2], + scan_result->mac[3], scan_result->mac[4], scan_result->mac[5], scan_result->ssid_def.ssid); /*Report one AP information*/ - EFR32_LOG("\r\n"); + SILABS_LOG("\r\n"); /* don't save if filter only wants specific ssid */ if (scan_ssid != (char *) 0) { @@ -295,7 +295,7 @@ static void sl_wfx_scan_result_callback(sl_wfx_scan_result_ind_body_t * scan_res } if ((ap = (struct scan_result_holder *) pvPortMalloc(sizeof(*ap))) == (struct scan_result_holder *) 0) { - EFR32_LOG("*ERR*Scan: No Mem"); + SILABS_LOG("*ERR*Scan: No Mem"); } else { @@ -360,7 +360,7 @@ static void sl_wfx_connect_callback(sl_wfx_connect_ind_body_t connect_indication switch (status) { case WFM_STATUS_SUCCESS: { - EFR32_LOG("STA-Connected\r\n"); + SILABS_LOG("STA-Connected\r\n"); memcpy(&ap_mac.octet[0], mac, MAC_ADDRESS_FIRST_OCTET); sl_wfx_context->state = static_cast(static_cast(sl_wfx_context->state) | static_cast(SL_WFX_STA_INTERFACE_CONNECTED)); @@ -368,27 +368,27 @@ static void sl_wfx_connect_callback(sl_wfx_connect_ind_body_t connect_indication break; } case WFM_STATUS_NO_MATCHING_AP: { - EFR32_LOG("WFX Connection failed, access point not found\r\n"); + SILABS_LOG("WFX Connection failed, access point not found\r\n"); break; } case WFM_STATUS_CONNECTION_ABORTED: { - EFR32_LOG("WFX Connection aborted\r\n"); + SILABS_LOG("WFX Connection aborted\r\n"); break; } case WFM_STATUS_CONNECTION_TIMEOUT: { - EFR32_LOG("WFX Connection timeout\r\n"); + SILABS_LOG("WFX Connection timeout\r\n"); break; } case WFM_STATUS_CONNECTION_REJECTED_BY_AP: { - EFR32_LOG("WFX Connection rejected by the access point\r\n"); + SILABS_LOG("WFX Connection rejected by the access point\r\n"); break; } case WFM_STATUS_CONNECTION_AUTH_FAILURE: { - EFR32_LOG("WFX Connection authentication failure\r\n"); + SILABS_LOG("WFX Connection authentication failure\r\n"); break; } default: { - EFR32_LOG("WF Connection attempt error\r\n"); + SILABS_LOG("WF Connection attempt error\r\n"); } } @@ -396,7 +396,7 @@ static void sl_wfx_connect_callback(sl_wfx_connect_ind_body_t connect_indication { retryJoin += 1; retryInProgress = false; - EFR32_LOG("WFX Retry to connect to network count: %d", retryJoin); + SILABS_LOG("WFX Retry to connect to network count: %d", retryJoin); sl_wfx_context->state = static_cast(static_cast(sl_wfx_context->state) & ~static_cast(SL_WFX_STARTED)); xEventGroupSetBits(sl_wfx_event_group, SL_WFX_RETRY_CONNECT); @@ -412,7 +412,7 @@ static void sl_wfx_connect_callback(sl_wfx_connect_ind_body_t connect_indication static void sl_wfx_disconnect_callback(uint8_t * mac, uint16_t reason) { (void) (mac); - EFR32_LOG("WFX Disconnected %d\r\n", reason); + SILABS_LOG("WFX Disconnected %d\r\n", reason); sl_wfx_context->state = static_cast(static_cast(sl_wfx_context->state) & ~static_cast(SL_WFX_STA_INTERFACE_CONNECTED)); xEventGroupSetBits(sl_wfx_event_group, SL_WFX_DISCONNECT); @@ -428,14 +428,14 @@ static void sl_wfx_start_ap_callback(uint32_t status) { if (status == AP_START_SUCCESS) { - EFR32_LOG("AP started\r\n"); + SILABS_LOG("AP started\r\n"); sl_wfx_context->state = static_cast(static_cast(sl_wfx_context->state) | static_cast(SL_WFX_AP_INTERFACE_UP)); xEventGroupSetBits(sl_wfx_event_group, SL_WFX_START_AP); } else { - EFR32_LOG("AP start failed\r\n"); + SILABS_LOG("AP start failed\r\n"); strcpy(event_log, "AP start failed"); } } @@ -448,7 +448,7 @@ static void sl_wfx_stop_ap_callback(void) { // TODO // dhcpserver_clear_stored_mac(); - EFR32_LOG("SoftAP stopped\r\n"); + SILABS_LOG("SoftAP stopped\r\n"); sl_wfx_context->state = static_cast(static_cast(sl_wfx_context->state) & ~static_cast(SL_WFX_AP_INTERFACE_UP)); xEventGroupSetBits(sl_wfx_event_group, SL_WFX_STOP_AP); @@ -461,9 +461,9 @@ static void sl_wfx_stop_ap_callback(void) *****************************************************************************/ static void sl_wfx_client_connected_callback(uint8_t * mac) { - EFR32_LOG("Client connected, MAC: %02X:%02X:%02X:%02X:%02X:%02X\r\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]); + SILABS_LOG("Client connected, MAC: %02X:%02X:%02X:%02X:%02X:%02X\r\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]); // TODO - EFR32_LOG("Open a web browser and go to http://%d.%d.%d.%d\r\n", ap_ip_addr0, ap_ip_addr1, ap_ip_addr2, ap_ip_addr3); + SILABS_LOG("Open a web browser and go to http://%d.%d.%d.%d\r\n", ap_ip_addr0, ap_ip_addr1, ap_ip_addr2, ap_ip_addr3); } /**************************************************************************** @@ -474,8 +474,8 @@ static void sl_wfx_client_connected_callback(uint8_t * mac) *****************************************************************************/ static void sl_wfx_ap_client_rejected_callback(uint32_t status, uint8_t * mac) { - EFR32_LOG("Client rejected, reason: %d, MAC: %02X:%02X:%02X:%02X:%02X:%02X\r\n", (int) status, mac[0], mac[1], mac[2], mac[3], - mac[4], mac[5]); + SILABS_LOG("Client rejected, reason: %d, MAC: %02X:%02X:%02X:%02X:%02X:%02X\r\n", (int) status, mac[0], mac[1], mac[2], mac[3], + mac[4], mac[5]); } /**************************************************************************** @@ -487,8 +487,8 @@ static void sl_wfx_ap_client_rejected_callback(uint32_t status, uint8_t * mac) static void sl_wfx_ap_client_disconnected_callback(uint32_t status, uint8_t * mac) { // TODO - EFR32_LOG("Client disconnected, reason: %d, MAC: %02X:%02X:%02X:%02X:%02X:%02X\r\n", (int) status, mac[0], mac[1], mac[2], - mac[3], mac[4], mac[5]); + SILABS_LOG("Client disconnected, reason: %d, MAC: %02X:%02X:%02X:%02X:%02X:%02X\r\n", (int) status, mac[0], mac[1], mac[2], + mac[3], mac[4], mac[5]); } #endif /* SL_WFX_CONFIG_SOFTAP */ @@ -500,7 +500,7 @@ static void sl_wfx_ap_client_disconnected_callback(uint32_t status, uint8_t * ma static void sl_wfx_generic_status_callback(sl_wfx_generic_ind_t * frame) { (void) (frame); - EFR32_LOG("WFX Generic status received\r\n"); + SILABS_LOG("WFX Generic status received\r\n"); } /*************************************************************************** @@ -532,7 +532,7 @@ static void wfx_events_task(void * p_arg) { if (!retryInProgress) { - EFR32_LOG("WFX sending the connect command"); + SILABS_LOG("WFX sending the connect command"); wfx_connect_to_ap(); retryInProgress = true; } @@ -551,7 +551,7 @@ static void wfx_events_task(void * p_arg) hasNotifiedIPV4 = true; if (!hasNotifiedWifiConnectivity) { - EFR32_LOG("WIFI: Has Notified Wifi Connectivity"); + SILABS_LOG("WIFI: Has Notified Wifi Connectivity"); wfx_connected_notify(CONNECTION_STATUS_SUCCESS, &ap_mac); hasNotifiedWifiConnectivity = true; } @@ -585,7 +585,7 @@ static void wfx_events_task(void * p_arg) wfx_ipv6_notify(GET_IPV6_FAIL); hasNotifiedIPV6 = false; hasNotifiedWifiConnectivity = false; - EFR32_LOG("WIFI: Connected to AP"); + SILABS_LOG("WIFI: Connected to AP"); wifi_extra |= WE_ST_STA_CONN; wfx_lwip_set_sta_link_up(); #ifdef SLEEP_ENABLED @@ -635,9 +635,9 @@ static void wfx_events_task(void * p_arg) sp = (sl_wfx_ssid_def_t *) 0; } - EFR32_LOG("WIFI Scan Paramter set to Active channel time %d, Passive " - "Channel Time: %d, Number of prob: %d", - ACTIVE_CHANNEL_TIME, PASSIVE_CHANNEL_TIME, NUM_PROBE_REQUEST); + SILABS_LOG("WIFI Scan Paramter set to Active channel time %d, Passive " + "Channel Time: %d, Number of prob: %d", + ACTIVE_CHANNEL_TIME, PASSIVE_CHANNEL_TIME, NUM_PROBE_REQUEST); (void) sl_wfx_set_scan_parameters(ACTIVE_CHANNEL_TIME, PASSIVE_CHANNEL_TIME, NUM_PROBE_REQUEST); (void) sl_wfx_send_scan_command(WFM_SCAN_MODE_ACTIVE, CHANNEL_LIST, /* Channel list */ CHANNEL_COUNT, /* Scan all chans */ @@ -648,7 +648,7 @@ static void wfx_events_task(void * p_arg) { struct scan_result_holder *hp, *next; - EFR32_LOG("WIFI: Return %d scan results", scan_count); + SILABS_LOG("WIFI: Return %d scan results", scan_count); for (hp = scan_save; hp; hp = next) { next = hp->next; @@ -679,15 +679,15 @@ static sl_status_t wfx_init(void) /* Initialize the WF200 used by the two interfaces */ wfx_events_task_start(); sl_status_t status = sl_wfx_init(&wifiContext); - EFR32_LOG("FMAC Driver version %s", FMAC_DRIVER_VERSION_STRING); + SILABS_LOG("FMAC Driver version %s", FMAC_DRIVER_VERSION_STRING); switch (status) { case SL_STATUS_OK: - EFR32_LOG("WF200 FW ver:%d.%d.%d [MAC %02x:%02x:%02x-%02x:%02x:%02x]", wifiContext.firmware_major, - wifiContext.firmware_minor, wifiContext.firmware_build, wifiContext.mac_addr_0.octet[0], - wifiContext.mac_addr_0.octet[1], wifiContext.mac_addr_0.octet[2], wifiContext.mac_addr_0.octet[3], - wifiContext.mac_addr_0.octet[4], wifiContext.mac_addr_0.octet[5]); - EFR32_LOG("WF200 Init OK"); + SILABS_LOG("WF200 FW ver:%d.%d.%d [MAC %02x:%02x:%02x-%02x:%02x:%02x]", wifiContext.firmware_major, + wifiContext.firmware_minor, wifiContext.firmware_build, wifiContext.mac_addr_0.octet[0], + wifiContext.mac_addr_0.octet[1], wifiContext.mac_addr_0.octet[2], wifiContext.mac_addr_0.octet[3], + wifiContext.mac_addr_0.octet[4], wifiContext.mac_addr_0.octet[5]); + SILABS_LOG("WF200 Init OK"); if (wifiContext.state == SL_WFX_STA_INTERFACE_CONNECTED) { @@ -696,19 +696,19 @@ static sl_status_t wfx_init(void) break; case SL_STATUS_WIFI_INVALID_KEY: - EFR32_LOG("*ERR*WF200: F/W keyset invalid"); + SILABS_LOG("*ERR*WF200: F/W keyset invalid"); break; case SL_STATUS_WIFI_FIRMWARE_DOWNLOAD_TIMEOUT: - EFR32_LOG("*ERR*WF200: F/W download timo"); + SILABS_LOG("*ERR*WF200: F/W download timo"); break; case SL_STATUS_TIMEOUT: - EFR32_LOG("*ERR*WF200: Poll for value timo"); + SILABS_LOG("*ERR*WF200: Poll for value timo"); break; case SL_STATUS_FAIL: - EFR32_LOG("*ERR*WF200: Error"); + SILABS_LOG("*ERR*WF200: Error"); break; default: - EFR32_LOG("*ERR*WF200: Unknown"); + SILABS_LOG("*ERR*WF200: Unknown"); } return status; @@ -726,21 +726,21 @@ static void wfx_wifi_hw_start(void) if (wifi_extra & WE_ST_HW_STARTED) return; - EFR32_LOG("STARTING WF200\n"); + SILABS_LOG("STARTING WF200\n"); wifi_extra |= WE_ST_HW_STARTED; sl_wfx_host_gpio_init(); if ((status = wfx_init()) == SL_STATUS_OK) { /* Initialize the LwIP stack */ - EFR32_LOG("WF200:Start LWIP"); + SILABS_LOG("WF200:Start LWIP"); wfx_lwip_start(); wifiContext.state = SL_WFX_STARTED; /* Really this is a bit mask */ - EFR32_LOG("WF200:ready.."); + SILABS_LOG("WF200:ready.."); } else { - EFR32_LOG("*ERR*WF200:init failed"); + SILABS_LOG("*ERR*WF200:init failed"); } } @@ -753,21 +753,21 @@ static void wfx_wifi_hw_start(void) int32_t wfx_get_ap_info(wfx_wifi_scan_result_t * ap) { int32_t signal_strength; - EFR32_LOG("WIFI:SSID:: %s", &ap_info.ssid[0]); + SILABS_LOG("WIFI:SSID:: %s", &ap_info.ssid[0]); memcpy(ap->ssid, ap_info.ssid, sizeof(ap_info.ssid)); - EFR32_LOG("WIFI:Mac addr:: %02x:%02x:%02x:%02x:%02x:%02x", ap_info.bssid[0], ap_info.bssid[1], ap_info.bssid[2], - ap_info.bssid[3], ap_info.bssid[4], ap_info.bssid[5]); + SILABS_LOG("WIFI:Mac addr:: %02x:%02x:%02x:%02x:%02x:%02x", ap_info.bssid[0], ap_info.bssid[1], ap_info.bssid[2], + ap_info.bssid[3], ap_info.bssid[4], ap_info.bssid[5]); memcpy(ap->bssid, ap_info.bssid, sizeof(ap_info.bssid)); ap->security = ap_info.security; - EFR32_LOG("WIFI:security:: %d", ap->security); + SILABS_LOG("WIFI:security:: %d", ap->security); ap->chan = ap_info.chan; - EFR32_LOG("WIFI:Channel:: to %d", ap->chan); + SILABS_LOG("WIFI:Channel:: to %d", ap->chan); sl_status_t status = sl_wfx_get_signal_strength((uint32_t *) &signal_strength); if (status == SL_STATUS_OK) { - EFR32_LOG("status SL_STATUS_OK & signal_strength:: %d", signal_strength); + SILABS_LOG("status SL_STATUS_OK & signal_strength:: %d", signal_strength); ap->rssi = (signal_strength - 220) / 2; } return status; @@ -785,7 +785,7 @@ int32_t wfx_get_ap_ext(wfx_wifi_scan_ext_t * extra_info) status = get_all_counters(); if (status != SL_STATUS_OK) { - EFR32_LOG("Failed to get the couters"); + SILABS_LOG("Failed to get the couters"); } else { @@ -825,8 +825,8 @@ sl_status_t get_all_counters(void) result = sl_wfx_host_wait_for_confirmation(command_id, SL_WFX_DEFAULT_REQUEST_TIMEOUT_MS, (void **) &counters); SL_WFX_ERROR_CHECK(result); - EFR32_LOG("%-24s %12s \r\n", "", "Debug Counters Content"); - EFR32_LOG("%-24s %lu\r\n", "rcpi", (unsigned long) counters->body.rcpi); + SILABS_LOG("%-24s %12s \r\n", "", "Debug Counters Content"); + SILABS_LOG("%-24s %lu\r\n", "rcpi", (unsigned long) counters->body.rcpi); PUT_COUNTER(plcp_errors); PUT_COUNTER(fcs_errors); PUT_COUNTER(tx_packets); @@ -890,7 +890,7 @@ sl_status_t wfx_wifi_start(void) { if (wifi_extra & WE_ST_STARTED) { - EFR32_LOG("WIFI: Already started"); + SILABS_LOG("WIFI: Already started"); return SL_STATUS_OK; } wifi_extra |= WE_ST_STARTED; @@ -954,7 +954,7 @@ void wfx_set_wifi_provision(wfx_wifi_provision_t * wifiConfig) { memcpy(wifi_provision.ssid, wifiConfig->ssid, sizeof(wifiConfig->ssid)); memcpy(wifi_provision.passkey, wifiConfig->passkey, sizeof(wifiConfig->passkey)); - EFR32_LOG("WIFI: Provision SSID=%s", &wifi_provision.ssid[0]); + SILABS_LOG("WIFI: Provision SSID=%s", &wifi_provision.ssid[0]); /* Not very good - To be improved */ switch (wifiConfig->security) @@ -1031,11 +1031,11 @@ sl_status_t wfx_connect_to_ap(void) { return SL_STATUS_NOT_AVAILABLE; } - EFR32_LOG("WIFI:JOIN to %s", &wifi_provision.ssid[0]); + SILABS_LOG("WIFI:JOIN to %s", &wifi_provision.ssid[0]); - EFR32_LOG("WIFI Scan Paramter set to Active channel time %d, Passive Channel " - "Time: %d, Number of prob: %d", - ACTIVE_CHANNEL_TIME, PASSIVE_CHANNEL_TIME, NUM_PROBE_REQUEST); + SILABS_LOG("WIFI Scan Paramter set to Active channel time %d, Passive Channel " + "Time: %d, Number of prob: %d", + ACTIVE_CHANNEL_TIME, PASSIVE_CHANNEL_TIME, NUM_PROBE_REQUEST); (void) sl_wfx_set_scan_parameters(ACTIVE_CHANNEL_TIME, PASSIVE_CHANNEL_TIME, NUM_PROBE_REQUEST); result = sl_wfx_send_join_command((uint8_t *) wifi_provision.ssid, strlen(wifi_provision.ssid), NULL, CHANNEL_0, @@ -1061,8 +1061,8 @@ void wfx_get_wifi_mac_addr(sl_wfx_interface_t interface, sl_wfx_mac_address_t * mac = &wifiContext.mac_addr_0; #endif *addr = *mac; - EFR32_LOG("WLAN:Get WiFi Mac addr %02x:%02x:%02x:%02x:%02x:%02x", mac->octet[0], mac->octet[1], mac->octet[2], mac->octet[3], - mac->octet[4], mac->octet[5]); + SILABS_LOG("WLAN:Get WiFi Mac addr %02x:%02x:%02x:%02x:%02x:%02x", mac->octet[0], mac->octet[1], mac->octet[2], mac->octet[3], + mac->octet[4], mac->octet[5]); memcpy(&ap_info.bssid[0], &mac->octet[0], 6); } @@ -1094,7 +1094,7 @@ bool wfx_have_ipv4_addr(sl_wfx_interface_t which_if) *****************************************************************************/ bool wfx_have_ipv6_addr(sl_wfx_interface_t which_if) { - EFR32_LOG("%s: started.", __func__); + SILABS_LOG("%s: started.", __func__); bool status = false; if (which_if == SL_WFX_STA_INTERFACE) { @@ -1104,7 +1104,7 @@ bool wfx_have_ipv6_addr(sl_wfx_interface_t which_if) { status = false; /* TODO */ } - EFR32_LOG("%s: status: %d", __func__, status); + SILABS_LOG("%s: status: %d", __func__, status); return status; } @@ -1116,7 +1116,7 @@ bool wfx_have_ipv6_addr(sl_wfx_interface_t which_if) *****************************************************************************/ sl_status_t wfx_sta_discon(void) { - EFR32_LOG("STA-Disconnecting"); + SILABS_LOG("STA-Disconnecting"); int32_t status = sl_wfx_send_disconnect_command(); wifi_extra &= ~WE_ST_STA_CONN; xEventGroupSetBits(sl_wfx_event_group, SL_WFX_RETRY_CONNECT); @@ -1145,7 +1145,7 @@ bool wfx_is_sta_connected(void) val = (wifi_extra & WE_ST_STA_CONN) ? true : false; - EFR32_LOG("WLAN: STA %s connected", (val ? "IS" : "NOT")); + SILABS_LOG("WLAN: STA %s connected", (val ? "IS" : "NOT")); return val; } @@ -1158,7 +1158,7 @@ bool wfx_is_sta_connected(void) *****************************************************************************/ void wfx_setup_ip6_link_local(sl_wfx_interface_t whichif) { - EFR32_LOG("Setup-IP6: TODO"); /* It is automatically done when lwip link up */ + SILABS_LOG("Setup-IP6: TODO"); /* It is automatically done when lwip link up */ } /**************************************************************************** diff --git a/examples/platform/silabs/efr32/wf200/sl_wfx_task.c b/examples/platform/silabs/efr32/wf200/sl_wfx_task.c index baa484772d47a4..8a00e454ade504 100644 --- a/examples/platform/silabs/efr32/wf200/sl_wfx_task.c +++ b/examples/platform/silabs/efr32/wf200/sl_wfx_task.c @@ -91,7 +91,7 @@ static sl_status_t receive_frames() */ static void wfx_bus_task(void * p_arg) { - EFR32_LOG("SPI: Bus Task started"); + SILABS_LOG("SPI: Bus Task started"); sl_wfx_host_start_platform_interrupt(); for (;;) { @@ -123,6 +123,6 @@ void wfx_bus_start() xTaskCreateStatic(wfx_bus_task, "wfxbus", BUS_TASK_STACK_SIZE, NULL, WFX_BUS_TASK_PRIORITY, busStack, &busTaskStruct); if (wfx_bus_task_handle == NULL) { - EFR32_LOG("*ERR*WFX BusTask"); + SILABS_LOG("*ERR*WFX BusTask"); } } diff --git a/examples/platform/silabs/efr32/wf200/wf200_init.c b/examples/platform/silabs/efr32/wf200/wf200_init.c index bebdaf0f0a5b8c..12973d3c8ffb67 100644 --- a/examples/platform/silabs/efr32/wf200/wf200_init.c +++ b/examples/platform/silabs/efr32/wf200/wf200_init.c @@ -89,7 +89,7 @@ sl_status_t sl_wfx_host_disable_spi(void); *****************************************************************************/ sl_status_t wfx_soft_init(void) { - EFR32_LOG("WF200:Soft Init"); + SILABS_LOG("WF200:Soft Init"); if ((wfx_event_Q = xQueueCreateStatic(SL_WFX_EVENT_LIST_SIZE, sizeof(uint8_t), sWfxEventQueueBuffer, &sWfxEventQueueStruct)) == NULL) { @@ -118,7 +118,7 @@ sl_status_t wfx_soft_init(void) *****************************************************************************/ sl_status_t sl_wfx_host_init(void) { - EFR32_LOG("WFX: Host Init"); + SILABS_LOG("WFX: Host Init"); host_context.wf200_firmware_download_progress = 0; host_context.wf200_initialized = 0; return SL_STATUS_OK; @@ -420,7 +420,7 @@ sl_status_t sl_wfx_host_lock(void) if (xSemaphoreTake(wfx_mutex, TICKS_TO_WAIT_500) != pdTRUE) { - EFR32_LOG("*ERR*Wi-Fi driver mutex timo"); + SILABS_LOG("*ERR*Wi-Fi driver mutex timo"); status = SL_STATUS_TIMEOUT; } @@ -536,7 +536,7 @@ void sl_wfx_host_log(const char * str, ...) void otSysEventSignalPending(void) { // BaseType_t yieldRequired = ThreadStackMgrImpl().SignalThreadActivityPendingFromISR(); - EFR32_LOG("*ERR*UART intr - NOT Handled"); + SILABS_LOG("*ERR*UART intr - NOT Handled"); portYIELD_FROM_ISR(pdFALSE); } #endif /* !CHIP_ENABLE_OPENTHREAD */ diff --git a/examples/platform/silabs/efr32_creds.h b/examples/platform/silabs/efr32_creds.h deleted file mode 100644 index 60a3b1724c6017..00000000000000 --- a/examples/platform/silabs/efr32_creds.h +++ /dev/null @@ -1,41 +0,0 @@ -/** - * This is a boilerplat header to define the EFR32 authentication credentials. - * Applications must provide their own version of this header, and include: - * - The content of the CSA-provided Certification Declaration - * - The location and size of the PAI, and DAC - * - The key ID of the key-pair associated with the DAC - * - * These credentials MUST be provided if the build variable "chip_build_device_attestation_credentials" is set to true. - */ -#ifndef EFR32_DEVICE_CREDENTIALS -#define EFR32_DEVICE_CREDENTIALS - -#ifndef EFR32_CREDENTIALS_CD_OFFSET -#define EFR32_CREDENTIALS_CD_OFFSET 0x0000 -#endif - -#ifndef EFR32_CREDENTIALS_CD_SIZE -#define EFR32_CREDENTIALS_CD_SIZE 541 -#endif - -#ifndef EFR32_CREDENTIALS_PAI_OFFSET -#define EFR32_CREDENTIALS_PAI_OFFSET 0x400 -#endif - -#ifndef EFR32_CREDENTIALS_PAI_SIZE -#define EFR32_CREDENTIALS_PAI_SIZE 463 -#endif - -#ifndef EFR32_CREDENTIALS_DAC_OFFSET -#define EFR32_CREDENTIALS_DAC_OFFSET 0x600 -#endif - -#ifndef EFR32_CREDENTIALS_DAC_SIZE -#define EFR32_CREDENTIALS_DAC_SIZE 492 -#endif - -#ifndef EFR32_CREDENTIALS_DAC_KEY_ID -#define EFR32_CREDENTIALS_DAC_KEY_ID PSA_KEY_ID_USER_MIN + 1 -#endif - -#endif // EFR32_DEVICE_CREDENTIALS diff --git a/examples/platform/silabs/silabs_creds.h b/examples/platform/silabs/silabs_creds.h new file mode 100644 index 00000000000000..f4808c61e7589c --- /dev/null +++ b/examples/platform/silabs/silabs_creds.h @@ -0,0 +1,41 @@ +/** + * This is a boilerplat header to define the SILABS authentication credentials. + * Applications must provide their own version of this header, and include: + * - The content of the CSA-provided Certification Declaration + * - The location and size of the PAI, and DAC + * - The key ID of the key-pair associated with the DAC + * + * These credentials MUST be provided if the build variable "chip_build_device_attestation_credentials" is set to true. + */ +#ifndef SILABS_DEVICE_CREDENTIALS +#define SILABS_DEVICE_CREDENTIALS + +#ifndef SILABS_CREDENTIALS_CD_OFFSET +#define SILABS_CREDENTIALS_CD_OFFSET 0x0000 +#endif + +#ifndef SILABS_CREDENTIALS_CD_SIZE +#define SILABS_CREDENTIALS_CD_SIZE 541 +#endif + +#ifndef SILABS_CREDENTIALS_PAI_OFFSET +#define SILABS_CREDENTIALS_PAI_OFFSET 0x400 +#endif + +#ifndef SILABS_CREDENTIALS_PAI_SIZE +#define SILABS_CREDENTIALS_PAI_SIZE 463 +#endif + +#ifndef SILABS_CREDENTIALS_DAC_OFFSET +#define SILABS_CREDENTIALS_DAC_OFFSET 0x600 +#endif + +#ifndef SILABS_CREDENTIALS_DAC_SIZE +#define SILABS_CREDENTIALS_DAC_SIZE 492 +#endif + +#ifndef SILABS_CREDENTIALS_DAC_KEY_ID +#define SILABS_CREDENTIALS_DAC_KEY_ID PSA_KEY_ID_USER_MIN + 1 +#endif + +#endif // SILABS_DEVICE_CREDENTIALS diff --git a/examples/shell/efr32/include/AppConfig.h b/examples/shell/efr32/include/AppConfig.h index 743c6eddbb18ad..34129249b0daf0 100644 --- a/examples/shell/efr32/include/AppConfig.h +++ b/examples/shell/efr32/include/AppConfig.h @@ -54,10 +54,10 @@ extern "C" { #endif -void efr32InitLog(void); +void silabsInitLog(void); void efr32Log(const char * aFormat, ...); -#define EFR32_LOG(...) efr32Log(__VA_ARGS__); +#define SILABS_LOG(...) efr32Log(__VA_ARGS__); void appError(int err); #ifdef __cplusplus diff --git a/examples/shell/efr32/src/main.cpp b/examples/shell/efr32/src/main.cpp index 7a6c59a3ec20bb..a7e6f9dcd8f319 100644 --- a/examples/shell/efr32/src/main.cpp +++ b/examples/shell/efr32/src/main.cpp @@ -70,7 +70,7 @@ using chip::Shell::Engine; void appError(int err) { - EFR32_LOG("!!!!!!!!!!!! App Critical Error: %d !!!!!!!!!!!", err); + SILABS_LOG("!!!!!!!!!!!! App Critical Error: %d !!!!!!!!!!!", err); portDISABLE_INTERRUPTS(); while (true) ; @@ -102,11 +102,11 @@ int main(void) MemMonitoring::startHeapMonitoring(); #endif - EFR32_LOG("=================================================="); - EFR32_LOG("chip-efr32-shell-example starting"); - EFR32_LOG("=================================================="); + SILABS_LOG("=================================================="); + SILABS_LOG("chip-efr32-shell-example starting"); + SILABS_LOG("=================================================="); - EFR32_LOG("Init CHIP Stack"); + SILABS_LOG("Init CHIP Stack"); // Init Chip memory management before the stack chip::Platform::MemoryInit(); @@ -114,44 +114,44 @@ int main(void) CHIP_ERROR ret = PlatformMgr().InitChipStack(); if (ret != CHIP_NO_ERROR) { - EFR32_LOG("PlatformMgr().InitChipStack() failed"); + SILABS_LOG("PlatformMgr().InitChipStack() failed"); appError(ret); } chip::DeviceLayer::ConnectivityMgr().SetBLEDeviceName("EFR32_SHELL"); - EFR32_LOG("Starting Platform Manager Event Loop"); + SILABS_LOG("Starting Platform Manager Event Loop"); ret = PlatformMgr().StartEventLoopTask(); if (ret != CHIP_NO_ERROR) { - EFR32_LOG("PlatformMgr().StartEventLoopTask() failed"); + SILABS_LOG("PlatformMgr().StartEventLoopTask() failed"); appError(ret); } #if CHIP_ENABLE_OPENTHREAD - EFR32_LOG("Initializing OpenThread stack"); + SILABS_LOG("Initializing OpenThread stack"); ret = ThreadStackMgr().InitThreadStack(); if (ret != CHIP_NO_ERROR) { - EFR32_LOG("ThreadStackMgr().InitThreadStack() failed"); + SILABS_LOG("ThreadStackMgr().InitThreadStack() failed"); appError(ret); } ret = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_Router); if (ret != CHIP_NO_ERROR) { - EFR32_LOG("ConnectivityMgr().SetThreadDeviceType() failed"); + SILABS_LOG("ConnectivityMgr().SetThreadDeviceType() failed"); appError(ret); } #endif // CHIP_ENABLE_OPENTHREAD #if CHIP_ENABLE_OPENTHREAD - EFR32_LOG("Starting OpenThread task"); + SILABS_LOG("Starting OpenThread task"); // Start OpenThread task ret = ThreadStackMgrImpl().StartThreadTask(); if (ret != CHIP_NO_ERROR) { - EFR32_LOG("ThreadStackMgr().StartThreadTask() failed"); + SILABS_LOG("ThreadStackMgr().StartThreadTask() failed"); appError(ret); } #endif // CHIP_ENABLE_OPENTHREAD diff --git a/examples/thermostat/efr32/include/AppConfig.h b/examples/thermostat/efr32/include/AppConfig.h index 946b593cab50a4..a936fe1d8abaeb 100644 --- a/examples/thermostat/efr32/include/AppConfig.h +++ b/examples/thermostat/efr32/include/AppConfig.h @@ -32,10 +32,10 @@ extern "C" { #endif -void efr32InitLog(void); +void silabsInitLog(void); void efr32Log(const char * aFormat, ...); -#define EFR32_LOG(...) efr32Log(__VA_ARGS__); +#define SILABS_LOG(...) efr32Log(__VA_ARGS__); void appError(int err); #ifdef __cplusplus diff --git a/examples/thermostat/efr32/src/AppTask.cpp b/examples/thermostat/efr32/src/AppTask.cpp index 64af0859e887c3..073a52ba392001 100644 --- a/examples/thermostat/efr32/src/AppTask.cpp +++ b/examples/thermostat/efr32/src/AppTask.cpp @@ -157,19 +157,19 @@ CHIP_ERROR AppTask::Init() err = BaseApplication::Init(&gIdentify); if (err != CHIP_NO_ERROR) { - EFR32_LOG("BaseApplication::Init() failed"); + SILABS_LOG("BaseApplication::Init() failed"); appError(err); } err = SensorMgr().Init(); if (err != CHIP_NO_ERROR) { - EFR32_LOG("SensorMgr::Init() failed"); + SILABS_LOG("SensorMgr::Init() failed"); appError(err); } err = TempMgr().Init(); if (err != CHIP_NO_ERROR) { - EFR32_LOG("TempMgr::Init() failed"); + SILABS_LOG("TempMgr::Init() failed"); appError(err); } @@ -189,7 +189,7 @@ void AppTask::AppTaskMain(void * pvParameter) CHIP_ERROR err = sAppTask.Init(); if (err != CHIP_NO_ERROR) { - EFR32_LOG("AppTask.Init() failed"); + SILABS_LOG("AppTask.Init() failed"); appError(err); } @@ -197,7 +197,7 @@ void AppTask::AppTaskMain(void * pvParameter) sAppTask.StartStatusLEDTimer(); #endif - EFR32_LOG("App Task started"); + SILABS_LOG("App Task started"); while (true) { BaseType_t eventReceived = xQueueReceive(sAppEventQueue, &event, portMAX_DELAY); @@ -244,8 +244,8 @@ void AppTask::UpdateThermoStatUI() AppTask::GetAppTask().GetLCD().WriteDemoUI(false); // State doesn't Matter } #else - EFR32_LOG("Thermostat Status - M:%d T:%d'C H:%d'C C:%d'C", TempMgr().GetMode(), TempMgr().GetCurrentTemp(), - TempMgr().GetHeatingSetPoint(), TempMgr().GetCoolingSetPoint()); + SILABS_LOG("Thermostat Status - M:%d T:%d'C H:%d'C C:%d'C", TempMgr().GetMode(), TempMgr().GetCurrentTemp(), + TempMgr().GetHeatingSetPoint(), TempMgr().GetCoolingSetPoint()); #endif // DISPLAY_ENABLED } diff --git a/examples/thermostat/efr32/src/SensorManager.cpp b/examples/thermostat/efr32/src/SensorManager.cpp index 4a60846fae950c..427b1dad57d8ed 100644 --- a/examples/thermostat/efr32/src/SensorManager.cpp +++ b/examples/thermostat/efr32/src/SensorManager.cpp @@ -62,14 +62,14 @@ CHIP_ERROR SensorManager::Init() if (sSensorTimer == NULL) { - EFR32_LOG("sSensorTimer timer create failed"); + SILABS_LOG("sSensorTimer timer create failed"); return APP_ERROR_CREATE_TIMER_FAILED; } #ifdef USE_TEMP_SENSOR if (SL_STATUS_OK != TemperatureSensor::Init()) { - EFR32_LOG("Failed to Init Sensor"); + SILABS_LOG("Failed to Init Sensor"); return CHIP_ERROR_INTERNAL; } #endif @@ -96,7 +96,7 @@ void SensorManager::SensorTimerEventHandler(TimerHandle_t xTimer) { if (SL_STATUS_OK != TemperatureSensor::GetTemp(&humidity, &temperature)) { - EFR32_LOG("Failed to read Temperature !!!"); + SILABS_LOG("Failed to read Temperature !!!"); } tempSum += temperature; } @@ -118,7 +118,7 @@ void SensorManager::SensorTimerEventHandler(TimerHandle_t xTimer) } #endif // USE_TEMP_SENSOR - EFR32_LOG("Sensor Temp is : %d", temperature); + SILABS_LOG("Sensor Temp is : %d", temperature); if ((temperature >= (lastTemperature + kMinTemperatureDelta)) || temperature <= (lastTemperature - kMinTemperatureDelta)) { diff --git a/examples/thermostat/efr32/src/TemperatureManager.cpp b/examples/thermostat/efr32/src/TemperatureManager.cpp index 8b0d6c7f8413cc..30b2ab26b91da8 100644 --- a/examples/thermostat/efr32/src/TemperatureManager.cpp +++ b/examples/thermostat/efr32/src/TemperatureManager.cpp @@ -90,27 +90,27 @@ void TemperatureManager::AttributeChangeHandler(EndpointId endpointId, Attribute { case ThermAttr::LocalTemperature::Id: { int8_t Temp = ConvertToPrintableTemp(*((int16_t *) value)); - EFR32_LOG("Local temp %d", Temp); + SILABS_LOG("Local temp %d", Temp); mCurrentTempCelsius = Temp; } break; case ThermAttr::OccupiedCoolingSetpoint::Id: { int8_t coolingTemp = ConvertToPrintableTemp(*((int16_t *) value)); - EFR32_LOG("CoolingSetpoint %d", coolingTemp); + SILABS_LOG("CoolingSetpoint %d", coolingTemp); mCoolingCelsiusSetPoint = coolingTemp; } break; case ThermAttr::OccupiedHeatingSetpoint::Id: { int8_t heatingTemp = ConvertToPrintableTemp(*((int16_t *) value)); - EFR32_LOG("HeatingSetpoint %d", heatingTemp); + SILABS_LOG("HeatingSetpoint %d", heatingTemp); mHeatingCelsiusSetPoint = heatingTemp; } break; case ThermAttr::SystemMode::Id: { - EFR32_LOG("SystemMode %d", static_cast(*value)); + SILABS_LOG("SystemMode %d", static_cast(*value)); uint8_t mode = static_cast(*value); if (mThermMode != mode) { @@ -120,7 +120,7 @@ void TemperatureManager::AttributeChangeHandler(EndpointId endpointId, Attribute break; default: { - EFR32_LOG("Unhandled thermostat attribute %x", attributeId); + SILABS_LOG("Unhandled thermostat attribute %x", attributeId); return; } break; diff --git a/examples/thermostat/efr32/src/ThermostatUI.cpp b/examples/thermostat/efr32/src/ThermostatUI.cpp index 9336d356770d48..26e15181585839 100644 --- a/examples/thermostat/efr32/src/ThermostatUI.cpp +++ b/examples/thermostat/efr32/src/ThermostatUI.cpp @@ -56,7 +56,7 @@ void ThermostatUI::DrawUI(GLIB_Context_t * glibContext) { if (glibContext == nullptr) { - EFR32_LOG("Context is null"); + SILABS_LOG("Context is null"); return; } diff --git a/examples/thermostat/efr32/src/main.cpp b/examples/thermostat/efr32/src/main.cpp index d2f19619adf86f..e822b71646261e 100644 --- a/examples/thermostat/efr32/src/main.cpp +++ b/examples/thermostat/efr32/src/main.cpp @@ -28,7 +28,7 @@ #include #include #ifdef EFR32_ATTESTATION_CREDENTIALS -#include +#include #else #include #endif @@ -59,22 +59,22 @@ int main(void) chip::DeviceLayer::PlatformMgr().LockChipStack(); // Initialize device attestation config #ifdef EFR32_ATTESTATION_CREDENTIALS - SetDeviceAttestationCredentialsProvider(EFR32::GetEFR32DacProvider()); + SetDeviceAttestationCredentialsProvider(Silabs::GetSilabsDacProvider()); #else SetDeviceAttestationCredentialsProvider(Examples::GetExampleDACProvider()); #endif chip::DeviceLayer::PlatformMgr().UnlockChipStack(); - EFR32_LOG("Starting App Task"); + SILABS_LOG("Starting App Task"); if (AppTask::GetAppTask().StartAppTask() != CHIP_NO_ERROR) appError(CHIP_ERROR_INTERNAL); - EFR32_LOG("Starting FreeRTOS scheduler"); + SILABS_LOG("Starting FreeRTOS scheduler"); sl_system_kernel_start(); // Should never get here. chip::Platform::MemoryShutdown(); - EFR32_LOG("vTaskStartScheduler() failed"); + SILABS_LOG("vTaskStartScheduler() failed"); appError(CHIP_ERROR_INTERNAL); } diff --git a/examples/window-app/efr32/include/AppConfig.h b/examples/window-app/efr32/include/AppConfig.h index a9957cf77b5bb9..661819aea7648b 100644 --- a/examples/window-app/efr32/include/AppConfig.h +++ b/examples/window-app/efr32/include/AppConfig.h @@ -57,10 +57,10 @@ extern "C" { #define COVER_LIFT_TILT_TIMEOUT 500 #endif -void efr32InitLog(void); +void silabsInitLog(void); void efr32Log(const char * aFormat, ...); -#define EFR32_LOG(...) efr32Log(__VA_ARGS__); +#define SILABS_LOG(...) efr32Log(__VA_ARGS__); #ifdef __cplusplus } diff --git a/examples/window-app/efr32/src/WindowAppImpl.cpp b/examples/window-app/efr32/src/WindowAppImpl.cpp index 6e4c4cf60e985b..dd81caba36278c 100644 --- a/examples/window-app/efr32/src/WindowAppImpl.cpp +++ b/examples/window-app/efr32/src/WindowAppImpl.cpp @@ -82,7 +82,7 @@ WindowAppImpl::Timer::Timer(const char * name, uint32_t timeoutInMs, Callback ca ); if (mHandler == NULL) { - EFR32_LOG("Timer create failed"); + SILABS_LOG("Timer create failed"); appError(CHIP_ERROR_INTERNAL); } } @@ -97,7 +97,7 @@ void WindowAppImpl::Timer::Start() // Timer is not active if (xTimerStart(mHandler, 100) != pdPASS) { - EFR32_LOG("Timer start() failed"); + SILABS_LOG("Timer start() failed"); appError(CHIP_ERROR_INTERNAL); } @@ -122,7 +122,7 @@ void WindowAppImpl::Timer::Stop() mIsActive = false; if (xTimerStop(mHandler, 0) == pdFAIL) { - EFR32_LOG("Timer stop() failed"); + SILABS_LOG("Timer stop() failed"); appError(CHIP_ERROR_INTERNAL); } } @@ -165,12 +165,12 @@ void WindowAppImpl::OnTaskCallback(void * parameter) /* * Wait for the WiFi to be initialized */ - EFR32_LOG("APP: Wait WiFi Init"); + SILABS_LOG("APP: Wait WiFi Init"); while (!wfx_hw_ready()) { vTaskDelay(10); } - EFR32_LOG("APP: Done WiFi Init"); + SILABS_LOG("APP: Done WiFi Init"); /* We will init server when we get IP */ sWiFiNetworkCommissioningInstance.Init(); /* added for commisioning with wifi */ @@ -195,7 +195,7 @@ CHIP_ERROR WindowAppImpl::Init() mHandle = xTaskCreateStatic(OnTaskCallback, APP_TASK_NAME, ArraySize(sAppStack), NULL, 1, sAppStack, &sAppTaskStruct); if (NULL == mHandle) { - EFR32_LOG("Failed to allocate app task"); + SILABS_LOG("Failed to allocate app task"); return CHIP_ERROR_NO_MEMORY; } @@ -203,7 +203,7 @@ CHIP_ERROR WindowAppImpl::Init() mQueue = xQueueCreateStatic(APP_EVENT_QUEUE_SIZE, sizeof(WindowApp::Event), sAppEventQueueBuffer, &sAppEventQueueStruct); if (NULL == mQueue) { - EFR32_LOG("Failed to allocate app event queue"); + SILABS_LOG("Failed to allocate app event queue"); return CHIP_ERROR_NO_MEMORY; } @@ -229,7 +229,7 @@ CHIP_ERROR WindowAppImpl::Init() } else { - EFR32_LOG("Getting QR code failed!"); + SILABS_LOG("Getting QR code failed!"); } #endif // QR_CODE_ENABLED @@ -238,7 +238,7 @@ CHIP_ERROR WindowAppImpl::Init() CHIP_ERROR WindowAppImpl::Start() { - EFR32_LOG("Starting FreeRTOS scheduler"); + SILABS_LOG("Starting FreeRTOS scheduler"); sl_system_kernel_start(); return CHIP_NO_ERROR; @@ -249,7 +249,7 @@ void WindowAppImpl::Finish() WindowApp::Finish(); chip::Platform::MemoryShutdown(); // Should never get here. - EFR32_LOG("vTaskStartScheduler() failed"); + SILABS_LOG("vTaskStartScheduler() failed"); appError(CHIP_ERROR_INTERNAL); } @@ -278,7 +278,7 @@ void WindowAppImpl::PostEvent(const WindowApp::Event & event) if (!status) { - EFR32_LOG("Failed to post event to app task event queue"); + SILABS_LOG("Failed to post event to app task event queue"); } } } @@ -349,13 +349,13 @@ void WindowAppImpl::DispatchEvent(const WindowApp::Event & event) DispatchEventAttributeChange(event.mEndpoint, event.mAttributeId); break; case EventId::ResetWarning: - EFR32_LOG("Factory Reset Triggered. Release button within %ums to cancel.", LONG_PRESS_TIMEOUT); + SILABS_LOG("Factory Reset Triggered. Release button within %ums to cancel.", LONG_PRESS_TIMEOUT); // Turn off all LEDs before starting blink to make sure blink is // co-ordinated. UpdateLEDs(); break; case EventId::ResetCanceled: - EFR32_LOG("Factory Reset has been Canceled"); + SILABS_LOG("Factory Reset has been Canceled"); UpdateLEDs(); break; case EventId::ProvisionedStateChanged: diff --git a/examples/window-app/efr32/src/main.cpp b/examples/window-app/efr32/src/main.cpp index 41cc1bac8f4e87..f0536c625cbe49 100644 --- a/examples/window-app/efr32/src/main.cpp +++ b/examples/window-app/efr32/src/main.cpp @@ -28,7 +28,7 @@ #include #include #ifdef EFR32_ATTESTATION_CREDENTIALS -#include +#include #else #include #endif @@ -58,12 +58,12 @@ int main(void) WindowApp & app = WindowApp::Instance(); - EFR32_LOG("Starting App"); + SILABS_LOG("Starting App"); chip::DeviceLayer::PlatformMgr().LockChipStack(); err = app.Init(); // Initialize device attestation config #ifdef EFR32_ATTESTATION_CREDENTIALS - SetDeviceAttestationCredentialsProvider(EFR32::GetEFR32DacProvider()); + SetDeviceAttestationCredentialsProvider(Silabs::GetSilabsDacProvider()); #else SetDeviceAttestationCredentialsProvider(Examples::GetExampleDACProvider()); #endif @@ -71,14 +71,14 @@ int main(void) if (err != CHIP_NO_ERROR) { - EFR32_LOG("App Init failed"); + SILABS_LOG("App Init failed"); appError(err); } err = app.Start(); if (err != CHIP_NO_ERROR) { - EFR32_LOG("App Start failed"); + SILABS_LOG("App Start failed"); appError(err); } diff --git a/src/platform/silabs/CHIPDevicePlatformConfig.h b/src/platform/silabs/CHIPDevicePlatformConfig.h index 1843088c1e23d8..b2f46f2dbc40c5 100644 --- a/src/platform/silabs/CHIPDevicePlatformConfig.h +++ b/src/platform/silabs/CHIPDevicePlatformConfig.h @@ -19,15 +19,15 @@ /** * @file * Platform-specific configuration overrides for the Chip Device Layer - * on EFR32 platforms using the Silicon Labs SDK. + * on Silabs platforms using the Silicon Labs SDK. */ #pragma once // ==================== Platform Adaptations ==================== -#define CHIP_DEVICE_CONFIG_EFR32_NVM3_ERROR_MIN 0xB00000 -#define CHIP_DEVICE_CONFIG_EFR32_BLE_ERROR_MIN 0xC00000 +#define CHIP_DEVICE_CONFIG_SILABS_NVM3_ERROR_MIN 0xB00000 +#define CHIP_DEVICE_CONFIG_SILABS_BLE_ERROR_MIN 0xC00000 #define CHIP_DEVICE_CONFIG_ENABLE_WIFI_AP 0 diff --git a/src/platform/silabs/CHIPDevicePlatformEvent.h b/src/platform/silabs/CHIPDevicePlatformEvent.h index 1252e16064dd89..8ab1e21b4573bb 100644 --- a/src/platform/silabs/CHIPDevicePlatformEvent.h +++ b/src/platform/silabs/CHIPDevicePlatformEvent.h @@ -19,7 +19,7 @@ /** * @file * Defines platform-specific event types and data for the Chip - * Device Layer on EFR32 platforms using the Silicon Labs SDK. + * Device Layer on Silabs platforms using the Silicon Labs SDK. */ #pragma once @@ -35,7 +35,7 @@ namespace DeviceLayer { namespace DeviceEventType { /** - * Enumerates EFR32 platform-specific event types that are visible to the application. + * Enumerates Silabs platform-specific event types that are visible to the application. */ enum PublicPlatformSpecificEventTypes { @@ -43,7 +43,7 @@ enum PublicPlatformSpecificEventTypes }; /** - * Enumerates EFR32 platform-specific event types that are internal to the Chip Device Layer. + * Enumerates Silabs platform-specific event types that are internal to the Chip Device Layer. */ enum InternalPlatformSpecificEventTypes { @@ -53,7 +53,7 @@ enum InternalPlatformSpecificEventTypes } // namespace DeviceEventType /** - * Represents platform-specific event information for Silicon Labs EFR32 platforms. + * Represents platform-specific event information for Silicon Labs platforms. */ struct ChipDevicePlatformEvent final diff --git a/src/platform/silabs/CHIPPlatformConfig.h b/src/platform/silabs/CHIPPlatformConfig.h index cffeb4645ec29d..ec36bc8f46eae2 100644 --- a/src/platform/silabs/CHIPPlatformConfig.h +++ b/src/platform/silabs/CHIPPlatformConfig.h @@ -19,7 +19,7 @@ /** * @file * Platform-specific configuration overrides for CHIP on - * Silcon Labs EFR32 platforms. + * Silcon Labs Silabs platforms. */ #pragma once @@ -34,13 +34,13 @@ #define CHIP_CONFIG_PERSISTED_STORAGE_ENC_MSG_CNTR_ID 1 #define CHIP_CONFIG_PERSISTED_STORAGE_MAX_KEY_LENGTH 2 -#define CHIP_CONFIG_LIFETIIME_PERSISTED_COUNTER_KEY EFR32Config::kConfigKey_LifeTimeCounter +#define CHIP_CONFIG_LIFETIIME_PERSISTED_COUNTER_KEY SilabsConfig::kConfigKey_LifeTimeCounter // ==================== Security Adaptations ==================== -// FIXME: EFR32 set to MBED-TLS (But this is third-party repo in CHIP, not SDK) +// FIXME: Silabs set to MBED-TLS (But this is third-party repo in CHIP, not SDK) -// FIXME: EFR32 currently set to CHIP (Does this use Entropy.cpp ?) +// FIXME: Silabs currently set to CHIP (Does this use Entropy.cpp ?) #if CHIP_HAVE_CONFIG_H #include diff --git a/src/platform/silabs/ConfigurationManagerImpl.h b/src/platform/silabs/ConfigurationManagerImpl.h index 7c47e98ab05c86..35f8c23304f8b5 100644 --- a/src/platform/silabs/ConfigurationManagerImpl.h +++ b/src/platform/silabs/ConfigurationManagerImpl.h @@ -26,7 +26,7 @@ #include -#include +#include namespace chip { namespace DeviceLayer { @@ -34,7 +34,7 @@ namespace DeviceLayer { /** * Concrete implementation of the ConfigurationManager singleton object for the EFR32 platform. */ -class ConfigurationManagerImpl : public Internal::GenericConfigurationManagerImpl +class ConfigurationManagerImpl : public Internal::GenericConfigurationManagerImpl { public: // This returns an instance of this class. diff --git a/src/platform/silabs/ConnectivityManagerImpl.h b/src/platform/silabs/ConnectivityManagerImpl.h index 97f71e1db43a9b..6e2540fa300cab 100644 --- a/src/platform/silabs/ConnectivityManagerImpl.h +++ b/src/platform/silabs/ConnectivityManagerImpl.h @@ -51,7 +51,7 @@ namespace DeviceLayer { class PlatformManagerImpl; /** - * Concrete implementation of the ConnectivityManager singleton object for Silicon Labs EFR32 platforms. + * Concrete implementation of the ConnectivityManager singleton object for Silicon Labs Silabs platforms. */ class ConnectivityManagerImpl final : public ConnectivityManager, public Internal::GenericConnectivityManagerImpl, @@ -193,7 +193,7 @@ inline ConnectivityManager & ConnectivityMgr(void) * Returns the platform-specific implementation of the ConnectivityManager singleton object. * * Chip applications can use this to gain access to features of the ConnectivityManager - * that are specific to the ESP32 platform. + * that are specific to the Silabs platform. */ inline ConnectivityManagerImpl & ConnectivityMgrImpl(void) { diff --git a/src/platform/silabs/DiagnosticDataProviderImpl.cpp b/src/platform/silabs/DiagnosticDataProviderImpl.cpp index b1c548ba7eb3fb..0b62542afbf3dd 100644 --- a/src/platform/silabs/DiagnosticDataProviderImpl.cpp +++ b/src/platform/silabs/DiagnosticDataProviderImpl.cpp @@ -18,7 +18,7 @@ /** * @file * Provides an implementation of the DiagnosticDataProvider object - * for EFR32 platform. + * for Silabs platform. */ #include @@ -47,7 +47,7 @@ DiagnosticDataProviderImpl & DiagnosticDataProviderImpl::GetDefaultInstance() // Software Diagnostics Getters /* * The following Heap stats are compiled values done by the FreeRTOS Heap4 implementation. - * See /examples/platform/efr32/heap_4_silabs.c + * See /examples/platform/silabs/heap_4_silabs.c * It keeps track of the number of calls to allocate and free memory as well as the * number of free bytes remaining, but says nothing about fragmentation. */ diff --git a/src/platform/silabs/EFR32/BLEManagerImpl.cpp b/src/platform/silabs/EFR32/BLEManagerImpl.cpp index 91de55f6698473..a76f26c6df6b20 100644 --- a/src/platform/silabs/EFR32/BLEManagerImpl.cpp +++ b/src/platform/silabs/EFR32/BLEManagerImpl.cpp @@ -371,7 +371,7 @@ CHIP_ERROR BLEManagerImpl::MapBLEError(int bleErr) case SL_STATUS_NOT_SUPPORTED: return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE; default: - return CHIP_ERROR(ChipError::Range::kPlatform, bleErr + CHIP_DEVICE_CONFIG_EFR32_BLE_ERROR_MIN); + return CHIP_ERROR(ChipError::Range::kPlatform, bleErr + CHIP_DEVICE_CONFIG_SILABS_BLE_ERROR_MIN); } } diff --git a/src/platform/silabs/EFR32/BUILD.gn b/src/platform/silabs/EFR32/BUILD.gn index 546fe7a2bed29b..b67c63c486a719 100644 --- a/src/platform/silabs/EFR32/BUILD.gn +++ b/src/platform/silabs/EFR32/BUILD.gn @@ -44,12 +44,12 @@ static_library("EFR32") { "${silabs_platform_dir}/ConnectivityManagerImpl.h", "${silabs_platform_dir}/DiagnosticDataProviderImpl.cpp", "${silabs_platform_dir}/DiagnosticDataProviderImpl.h", - "${silabs_platform_dir}/EFR32Config.cpp", - "${silabs_platform_dir}/EFR32Config.h", "${silabs_platform_dir}/InetPlatformConfig.h", "${silabs_platform_dir}/KeyValueStoreManagerImpl.h", "${silabs_platform_dir}/Logging.cpp", "${silabs_platform_dir}/PlatformManagerImpl.h", + "${silabs_platform_dir}/SilabsConfig.cpp", + "${silabs_platform_dir}/SilabsConfig.h", "${silabs_platform_dir}/SystemPlatformConfig.h", "../../FreeRTOS/SystemTimeSupport.cpp", "../../SingletonConfigurationManager.cpp", diff --git a/src/platform/silabs/EFR32/ConfigurationManagerImpl.cpp b/src/platform/silabs/EFR32/ConfigurationManagerImpl.cpp index 5dc4be65853829..aad749374aa943 100644 --- a/src/platform/silabs/EFR32/ConfigurationManagerImpl.cpp +++ b/src/platform/silabs/EFR32/ConfigurationManagerImpl.cpp @@ -28,7 +28,7 @@ #include #include -#include +#include #include "em_rmu.h" @@ -52,7 +52,7 @@ CHIP_ERROR ConfigurationManagerImpl::Init() CHIP_ERROR err; // Initialize the generic implementation base class. - err = Internal::GenericConfigurationManagerImpl::Init(); + err = Internal::GenericConfigurationManagerImpl::Init(); SuccessOrExit(err); // TODO: Initialize the global GroupKeyStore object here (#1626) @@ -82,19 +82,19 @@ void ConfigurationManagerImpl::InitiateFactoryReset() CHIP_ERROR ConfigurationManagerImpl::GetRebootCount(uint32_t & rebootCount) { - return EFR32Config::ReadConfigValue(EFR32Config::kConfigKey_BootCount, rebootCount); + return SILABSConfig::ReadConfigValue(SILABSConfig::kConfigKey_BootCount, rebootCount); } CHIP_ERROR ConfigurationManagerImpl::IncreaseBootCount(void) { uint32_t bootCount = 0; - if (EFR32Config::ConfigValueExists(EFR32Config::kConfigKey_BootCount)) + if (SILABSConfig::ConfigValueExists(SILABSConfig::kConfigKey_BootCount)) { GetRebootCount(bootCount); } - return EFR32Config::WriteConfigValue(EFR32Config::kConfigKey_BootCount, bootCount + 1); + return SILABSConfig::WriteConfigValue(SILABSConfig::kConfigKey_BootCount, bootCount + 1); } CHIP_ERROR ConfigurationManagerImpl::GetBootReason(uint32_t & bootReason) @@ -156,18 +156,18 @@ CHIP_ERROR ConfigurationManagerImpl::GetBootReason(uint32_t & bootReason) CHIP_ERROR ConfigurationManagerImpl::GetTotalOperationalHours(uint32_t & totalOperationalHours) { - if (!EFR32Config::ConfigValueExists(EFR32Config::kConfigKey_TotalOperationalHours)) + if (!SILABSConfig::ConfigValueExists(SILABSConfig::kConfigKey_TotalOperationalHours)) { totalOperationalHours = 0; return CHIP_NO_ERROR; } - return EFR32Config::ReadConfigValue(EFR32Config::kConfigKey_TotalOperationalHours, totalOperationalHours); + return SILABSConfig::ReadConfigValue(SILABSConfig::kConfigKey_TotalOperationalHours, totalOperationalHours); } CHIP_ERROR ConfigurationManagerImpl::StoreTotalOperationalHours(uint32_t totalOperationalHours) { - return EFR32Config::WriteConfigValue(EFR32Config::kConfigKey_TotalOperationalHours, totalOperationalHours); + return SILABSConfig::WriteConfigValue(SILABSConfig::kConfigKey_TotalOperationalHours, totalOperationalHours); } CHIP_ERROR ConfigurationManagerImpl::ReadPersistedStorageValue(::chip::Platform::PersistedStorage::Key persistedStorageKey, @@ -177,7 +177,7 @@ CHIP_ERROR ConfigurationManagerImpl::ReadPersistedStorageValue(::chip::Platform: // (where persistedStorageKey represents an index to the counter). CHIP_ERROR err; - err = EFR32Config::ReadConfigValueCounter(persistedStorageKey, value); + err = SILABSConfig::ReadConfigValueCounter(persistedStorageKey, value); if (err == CHIP_DEVICE_ERROR_CONFIG_NOT_FOUND) { err = CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND; @@ -195,7 +195,7 @@ CHIP_ERROR ConfigurationManagerImpl::WritePersistedStorageValue(::chip::Platform // (where persistedStorageKey represents an index to the counter). CHIP_ERROR err; - err = EFR32Config::WriteConfigValueCounter(persistedStorageKey, value); + err = SILABSConfig::WriteConfigValueCounter(persistedStorageKey, value); if (err == CHIP_DEVICE_ERROR_CONFIG_NOT_FOUND) { err = CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND; @@ -208,62 +208,62 @@ CHIP_ERROR ConfigurationManagerImpl::WritePersistedStorageValue(::chip::Platform CHIP_ERROR ConfigurationManagerImpl::ReadConfigValue(Key key, bool & val) { - return EFR32Config::ReadConfigValue(key, val); + return SILABSConfig::ReadConfigValue(key, val); } CHIP_ERROR ConfigurationManagerImpl::ReadConfigValue(Key key, uint32_t & val) { - return EFR32Config::ReadConfigValue(key, val); + return SILABSConfig::ReadConfigValue(key, val); } CHIP_ERROR ConfigurationManagerImpl::ReadConfigValue(Key key, uint64_t & val) { - return EFR32Config::ReadConfigValue(key, val); + return SILABSConfig::ReadConfigValue(key, val); } CHIP_ERROR ConfigurationManagerImpl::ReadConfigValueStr(Key key, char * buf, size_t bufSize, size_t & outLen) { - return EFR32Config::ReadConfigValueStr(key, buf, bufSize, outLen); + return SILABSConfig::ReadConfigValueStr(key, buf, bufSize, outLen); } CHIP_ERROR ConfigurationManagerImpl::ReadConfigValueBin(Key key, uint8_t * buf, size_t bufSize, size_t & outLen) { - return EFR32Config::ReadConfigValueBin(key, buf, bufSize, outLen); + return SILABSConfig::ReadConfigValueBin(key, buf, bufSize, outLen); } CHIP_ERROR ConfigurationManagerImpl::WriteConfigValue(Key key, bool val) { - return EFR32Config::WriteConfigValue(key, val); + return SILABSConfig::WriteConfigValue(key, val); } CHIP_ERROR ConfigurationManagerImpl::WriteConfigValue(Key key, uint32_t val) { - return EFR32Config::WriteConfigValue(key, val); + return SILABSConfig::WriteConfigValue(key, val); } CHIP_ERROR ConfigurationManagerImpl::WriteConfigValue(Key key, uint64_t val) { - return EFR32Config::WriteConfigValue(key, val); + return SILABSConfig::WriteConfigValue(key, val); } CHIP_ERROR ConfigurationManagerImpl::WriteConfigValueStr(Key key, const char * str) { - return EFR32Config::WriteConfigValueStr(key, str); + return SILABSConfig::WriteConfigValueStr(key, str); } CHIP_ERROR ConfigurationManagerImpl::WriteConfigValueStr(Key key, const char * str, size_t strLen) { - return EFR32Config::WriteConfigValueStr(key, str, strLen); + return SILABSConfig::WriteConfigValueStr(key, str, strLen); } CHIP_ERROR ConfigurationManagerImpl::WriteConfigValueBin(Key key, const uint8_t * data, size_t dataLen) { - return EFR32Config::WriteConfigValueBin(key, data, dataLen); + return SILABSConfig::WriteConfigValueBin(key, data, dataLen); } void ConfigurationManagerImpl::RunConfigUnitTest(void) { - EFR32Config::RunConfigUnitTest(); + SILABSConfig::RunConfigUnitTest(); } void ConfigurationManagerImpl::DoFactoryReset(intptr_t arg) @@ -272,7 +272,7 @@ void ConfigurationManagerImpl::DoFactoryReset(intptr_t arg) ChipLogProgress(DeviceLayer, "Performing factory reset"); - err = EFR32Config::FactoryResetConfig(); + err = SILABSConfig::FactoryResetConfig(); if (err != CHIP_NO_ERROR) { ChipLogError(DeviceLayer, "FactoryResetConfig() failed: %s", chip::ErrorStr(err)); diff --git a/src/platform/silabs/EFR32/Efr32PsaOperationalKeystore.cpp b/src/platform/silabs/EFR32/Efr32PsaOperationalKeystore.cpp index 411db046bc924d..e8fdf61ff1c903 100644 --- a/src/platform/silabs/EFR32/Efr32PsaOperationalKeystore.cpp +++ b/src/platform/silabs/EFR32/Efr32PsaOperationalKeystore.cpp @@ -25,7 +25,7 @@ #include #include "Efr32OpaqueKeypair.h" -#include +#include namespace chip { namespace DeviceLayer { @@ -56,7 +56,7 @@ CHIP_ERROR Efr32PsaOperationalKeystore::Init() size_t existingLen = 0; bool update_cache = false; - if (EFR32Config::ConfigValueExists(EFR32Config::kConfigKey_OpKeyMap, existingLen)) + if (SILABSConfig::ConfigValueExists(SILABSConfig::kConfigKey_OpKeyMap, existingLen)) { // There's a pre-existing key map on disk. Size the map to read it fully. size_t outLen = 0; @@ -76,7 +76,7 @@ CHIP_ERROR Efr32PsaOperationalKeystore::Init() VerifyOrExit(mKeyMap, error = CHIP_ERROR_NO_MEMORY); // Read the existing key map - error = EFR32Config::ReadConfigValueBin(EFR32Config::kConfigKey_OpKeyMap, (uint8_t *) mKeyMap, existingLen, outLen); + error = SILABSConfig::ReadConfigValueBin(SILABSConfig::kConfigKey_OpKeyMap, (uint8_t *) mKeyMap, existingLen, outLen); SuccessOrExit(error); // If upsizing, extend the map with undefined indices @@ -127,7 +127,7 @@ CHIP_ERROR Efr32PsaOperationalKeystore::Init() // Write-out keymap if needed if (update_cache) { - error = EFR32Config::WriteConfigValueBin(EFR32Config::kConfigKey_OpKeyMap, mKeyMap, mKeyMapSize); + error = SILABSConfig::WriteConfigValueBin(SILABSConfig::kConfigKey_OpKeyMap, mKeyMap, mKeyMapSize); SuccessOrExit(error); } @@ -304,7 +304,7 @@ CHIP_ERROR Efr32PsaOperationalKeystore::CommitOpKeypairForFabric(FabricIndex fab mKeyMap[keymap_index] = fabricIndex; // Persist key map - CHIP_ERROR error = EFR32Config::WriteConfigValueBin(EFR32Config::kConfigKey_OpKeyMap, mKeyMap, mKeyMapSize); + CHIP_ERROR error = SILABSConfig::WriteConfigValueBin(SILABSConfig::kConfigKey_OpKeyMap, mKeyMap, mKeyMapSize); if (error != CHIP_NO_ERROR) { return error; @@ -349,7 +349,7 @@ CHIP_ERROR Efr32PsaOperationalKeystore::RemoveOpKeypairForFabric(FabricIndex fab mKeyMap[keymap_index] = kUndefinedFabricIndex; // Persist key map - CHIP_ERROR error = EFR32Config::WriteConfigValueBin(EFR32Config::kConfigKey_OpKeyMap, mKeyMap, mKeyMapSize); + CHIP_ERROR error = SILABSConfig::WriteConfigValueBin(SILABSConfig::kConfigKey_OpKeyMap, mKeyMap, mKeyMapSize); if (error != CHIP_NO_ERROR) { return error; diff --git a/src/platform/silabs/EFR32/KeyValueStoreManagerImpl.cpp b/src/platform/silabs/EFR32/KeyValueStoreManagerImpl.cpp index 05b3acf122a43a..c752c757eb9cdb 100644 --- a/src/platform/silabs/EFR32/KeyValueStoreManagerImpl.cpp +++ b/src/platform/silabs/EFR32/KeyValueStoreManagerImpl.cpp @@ -18,22 +18,22 @@ /** * @file - * Platform-specific key value storage implementation for EFR32 + * Platform-specific key value storage implementation for SILABS */ #include #include #include #include -#include +#include #include #include using namespace ::chip; using namespace ::chip::DeviceLayer::Internal; -#define CONVERT_KEYMAP_INDEX_TO_NVM3KEY(index) (EFR32Config::kConfigKey_KvsFirstKeySlot + index) -#define CONVERT_NVM3KEY_TO_KEYMAP_INDEX(nvm3Key) (nvm3Key - EFR32Config::kConfigKey_KvsFirstKeySlot) +#define CONVERT_KEYMAP_INDEX_TO_NVM3KEY(index) (SILABSConfig::kConfigKey_KvsFirstKeySlot + index) +#define CONVERT_NVM3KEY_TO_KEYMAP_INDEX(nvm3Key) (nvm3Key - SILABSConfig::kConfigKey_KvsFirstKeySlot) namespace chip { namespace DeviceLayer { @@ -45,13 +45,13 @@ char mKvsStoredKeyString[KeyValueStoreManagerImpl::kMaxEntries][PersistentStorag CHIP_ERROR KeyValueStoreManagerImpl::Init(void) { CHIP_ERROR err; - err = EFR32Config::Init(); + err = SILABSConfig::Init(); SuccessOrExit(err); memset(mKvsStoredKeyString, 0, sizeof(mKvsStoredKeyString)); size_t outLen; - err = EFR32Config::ReadConfigValueBin(EFR32Config::kConfigKey_KvsStringKeyMap, reinterpret_cast(mKvsStoredKeyString), - sizeof(mKvsStoredKeyString), outLen); + err = SILABSConfig::ReadConfigValueBin(SILABSConfig::kConfigKey_KvsStringKeyMap, + reinterpret_cast(mKvsStoredKeyString), sizeof(mKvsStoredKeyString), outLen); if (err == CHIP_DEVICE_ERROR_CONFIG_NOT_FOUND) // Initial boot { @@ -64,7 +64,7 @@ CHIP_ERROR KeyValueStoreManagerImpl::Init(void) bool KeyValueStoreManagerImpl::IsValidKvsNvm3Key(uint32_t nvm3Key) const { - return ((EFR32Config::kConfigKey_KvsFirstKeySlot <= nvm3Key) && (nvm3Key <= EFR32Config::kConfigKey_KvsLastKeySlot)); + return ((SILABSConfig::kConfigKey_KvsFirstKeySlot <= nvm3Key) && (nvm3Key <= SILABSConfig::kConfigKey_KvsLastKeySlot)); } CHIP_ERROR KeyValueStoreManagerImpl::MapKvsKeyToNvm3(const char * key, uint32_t & nvm3Key, bool isSlotNeeded) const @@ -113,8 +113,8 @@ void KeyValueStoreManagerImpl::ForceKeyMapSave() void KeyValueStoreManagerImpl::OnScheduledKeyMapSave(System::Layer * systemLayer, void * appState) { - EFR32Config::WriteConfigValueBin(EFR32Config::kConfigKey_KvsStringKeyMap, - reinterpret_cast(mKvsStoredKeyString), sizeof(mKvsStoredKeyString)); + SILABSConfig::WriteConfigValueBin(SILABSConfig::kConfigKey_KvsStringKeyMap, + reinterpret_cast(mKvsStoredKeyString), sizeof(mKvsStoredKeyString)); } void KeyValueStoreManagerImpl::ScheduleKeyMapSave(void) @@ -124,7 +124,7 @@ void KeyValueStoreManagerImpl::ScheduleKeyMapSave(void) Commit the key map in nvm once it as stabilized. */ SystemLayer().StartTimer( - std::chrono::duration_cast(System::Clock::Seconds32(EFR32_KVS_SAVE_DELAY_SECONDS)), + std::chrono::duration_cast(System::Clock::Seconds32(SILABS_KVS_SAVE_DELAY_SECONDS)), KeyValueStoreManagerImpl::OnScheduledKeyMapSave, NULL); } @@ -138,7 +138,7 @@ CHIP_ERROR KeyValueStoreManagerImpl::_Get(const char * key, void * value, size_t VerifyOrReturnError(err == CHIP_NO_ERROR, err); size_t outLen; - err = EFR32Config::ReadConfigValueBin(nvm3Key, reinterpret_cast(value), value_size, outLen, offset_bytes); + err = SILABSConfig::ReadConfigValueBin(nvm3Key, reinterpret_cast(value), value_size, outLen, offset_bytes); if (read_bytes_size) { *read_bytes_size = outLen; @@ -160,10 +160,10 @@ CHIP_ERROR KeyValueStoreManagerImpl::_Put(const char * key, const void * value, CHIP_ERROR err = MapKvsKeyToNvm3(key, nvm3Key, /* isSlotNeeded */ true); VerifyOrReturnError(err == CHIP_NO_ERROR, err); - err = EFR32Config::WriteConfigValueBin(nvm3Key, reinterpret_cast(value), value_size); + err = SILABSConfig::WriteConfigValueBin(nvm3Key, reinterpret_cast(value), value_size); if (err == CHIP_NO_ERROR) { - uint32_t keyIndex = nvm3Key - EFR32Config::kConfigKey_KvsFirstKeySlot; + uint32_t keyIndex = nvm3Key - SILABSConfig::kConfigKey_KvsFirstKeySlot; Platform::CopyString(mKvsStoredKeyString[keyIndex], key); ScheduleKeyMapSave(); } @@ -179,7 +179,7 @@ CHIP_ERROR KeyValueStoreManagerImpl::_Delete(const char * key) CHIP_ERROR err = MapKvsKeyToNvm3(key, nvm3Key); VerifyOrReturnError(err == CHIP_NO_ERROR, err); - err = EFR32Config::ClearConfigValue(nvm3Key); + err = SILABSConfig::ClearConfigValue(nvm3Key); if (err == CHIP_NO_ERROR) { uint32_t keyIndex = CONVERT_NVM3KEY_TO_KEYMAP_INDEX(nvm3Key); @@ -194,9 +194,9 @@ CHIP_ERROR KeyValueStoreManagerImpl::ErasePartition(void) { // Iterate over all the Matter Kvs nvm3 records and delete each one... CHIP_ERROR err = CHIP_NO_ERROR; - for (uint32_t nvm3Key = EFR32Config::kMinConfigKey_MatterKvs; nvm3Key < EFR32Config::kMaxConfigKey_MatterKvs; nvm3Key++) + for (uint32_t nvm3Key = SILABSConfig::kMinConfigKey_MatterKvs; nvm3Key < SILABSConfig::kMaxConfigKey_MatterKvs; nvm3Key++) { - err = EFR32Config::ClearConfigValue(nvm3Key); + err = SILABSConfig::ClearConfigValue(nvm3Key); if (err != CHIP_NO_ERROR) { diff --git a/src/platform/silabs/EFR32/OTAImageProcessorImpl.cpp b/src/platform/silabs/EFR32/OTAImageProcessorImpl.cpp index 49fd73d4c7b3ba..f07fd947d03c17 100644 --- a/src/platform/silabs/EFR32/OTAImageProcessorImpl.cpp +++ b/src/platform/silabs/EFR32/OTAImageProcessorImpl.cpp @@ -25,7 +25,7 @@ extern "C" { #include "em_bus.h" // For CORE_CRITICAL_SECTION } -#include +#include /// No error, operation OK #define SL_BOOTLOADER_OK 0L diff --git a/src/platform/silabs/EFR32/PlatformManagerImpl.cpp b/src/platform/silabs/EFR32/PlatformManagerImpl.cpp index 626ea16dc26fe2..25de6d51d164b2 100644 --- a/src/platform/silabs/EFR32/PlatformManagerImpl.cpp +++ b/src/platform/silabs/EFR32/PlatformManagerImpl.cpp @@ -19,7 +19,7 @@ /** * @file * Provides an implementation of the PlatformManager object - * for EFR32 platforms using the Silicon Labs EFR32 SDK. + * for Silabs platforms using the Silicon Labs SDK. */ /* this file behaves like a config.h, comes first */ #include diff --git a/src/platform/silabs/EFR32/wifi/dhcp_client.cpp b/src/platform/silabs/EFR32/wifi/dhcp_client.cpp index f3e8c5597ad922..15c678515a0e62 100644 --- a/src/platform/silabs/EFR32/wifi/dhcp_client.cpp +++ b/src/platform/silabs/EFR32/wifi/dhcp_client.cpp @@ -68,7 +68,7 @@ void dhcpclient_set_link_state(int link_up) if (link_up) { dhcp_state = DHCP_START; - EFR32_LOG("DHCP: Starting"); + SILABS_LOG("DHCP: Starting"); } else { @@ -94,7 +94,7 @@ uint8_t dhcpclient_poll(void * arg) switch (dhcp_state) { case DHCP_START: - EFR32_LOG("DHCP: Wait addr"); + SILABS_LOG("DHCP: Wait addr"); ip_addr_set_zero_ip4(&netif->ip_addr); ip_addr_set_zero_ip4(&netif->netmask); ip_addr_set_zero_ip4(&netif->gw); @@ -108,8 +108,8 @@ uint8_t dhcpclient_poll(void * arg) dhcp_state = DHCP_ADDRESS_ASSIGNED; uint64_t addr = netif->ip_addr.u_addr.ip4.addr; - EFR32_LOG("DHCP IP: %d.%d.%d.%d", NETIF_IPV4_ADDRESS(addr, 0), NETIF_IPV4_ADDRESS(addr, 1), NETIF_IPV4_ADDRESS(addr, 2), - NETIF_IPV4_ADDRESS(addr, 3)); + SILABS_LOG("DHCP IP: %d.%d.%d.%d", NETIF_IPV4_ADDRESS(addr, 0), NETIF_IPV4_ADDRESS(addr, 1), + NETIF_IPV4_ADDRESS(addr, 2), NETIF_IPV4_ADDRESS(addr, 3)); } else { @@ -120,7 +120,7 @@ uint8_t dhcpclient_poll(void * arg) { dhcp_state = DHCP_TIMEOUT; - EFR32_LOG("*ERR*DHCP: Failed"); + SILABS_LOG("*ERR*DHCP: Failed"); /* Stop DHCP */ dhcp_stop(netif); @@ -136,7 +136,7 @@ uint8_t dhcpclient_poll(void * arg) case DHCP_LINK_DOWN: /* Stop DHCP */ - EFR32_LOG("*ERR*DHCP Link down"); + SILABS_LOG("*ERR*DHCP Link down"); dhcp_stop(netif); dhcp_state = DHCP_OFF; break; diff --git a/src/platform/silabs/EFR32/wifi/ethernetif.cpp b/src/platform/silabs/EFR32/wifi/ethernetif.cpp index 8c2e818222e138..d1fcc01f3c4f9b 100644 --- a/src/platform/silabs/EFR32/wifi/ethernetif.cpp +++ b/src/platform/silabs/EFR32/wifi/ethernetif.cpp @@ -44,10 +44,10 @@ #include "lwip/timeouts.h" #include "netif/etharp.h" -#ifndef EFR32_LOG +#ifndef SILABS_LOG extern "C" { void efr32Log(const char * aFormat, ...); -#define EFR32_LOG(...) efr32Log(__VA_ARGS__); +#define SILABS_LOG(...) efr32Log(__VA_ARGS__); } #endif @@ -136,13 +136,13 @@ static void low_level_input(struct netif * netif, uint8_t * b, uint16_t len) (memcmp(netif->hwaddr, dst_mac, netif->hwaddr_len) != 0)) { #ifdef WIFI_DEBUG_ENABLED - EFR32_LOG("%s: DROP, [%02x:%02x:%02x:%02x:%02x:%02x]<-[%02x:%02x:%02x:%02x:%02x:%02x] type=%02x%02x", __func__, + SILABS_LOG("%s: DROP, [%02x:%02x:%02x:%02x:%02x:%02x]<-[%02x:%02x:%02x:%02x:%02x:%02x] type=%02x%02x", __func__, - dst_mac[0], dst_mac[1], dst_mac[2], dst_mac[3], dst_mac[4], dst_mac[5], + dst_mac[0], dst_mac[1], dst_mac[2], dst_mac[3], dst_mac[4], dst_mac[5], - src_mac[0], src_mac[1], src_mac[2], src_mac[3], src_mac[4], src_mac[5], + src_mac[0], src_mac[1], src_mac[2], src_mac[3], src_mac[4], src_mac[5], - b[12], b[13]); + b[12], b[13]); #endif return; } @@ -158,27 +158,27 @@ static void low_level_input(struct netif * netif, uint8_t * b, uint16_t len) bufferoffset += q->len; } #ifdef WIFI_DEBUG_ENABLED - EFR32_LOG("%s: ACCEPT %d, [%02x:%02x:%02x:%02x:%02x:%02x]<-[%02x:%02x:%02x:%02x:%02x:%02x] type=%02x%02x", __func__, - bufferoffset, + SILABS_LOG("%s: ACCEPT %d, [%02x:%02x:%02x:%02x:%02x:%02x]<-[%02x:%02x:%02x:%02x:%02x:%02x] type=%02x%02x", __func__, + bufferoffset, - dst_mac[0], dst_mac[1], dst_mac[2], dst_mac[3], dst_mac[4], dst_mac[5], + dst_mac[0], dst_mac[1], dst_mac[2], dst_mac[3], dst_mac[4], dst_mac[5], - src_mac[0], src_mac[1], src_mac[2], src_mac[3], src_mac[4], src_mac[5], + src_mac[0], src_mac[1], src_mac[2], src_mac[3], src_mac[4], src_mac[5], - b[12], b[13]); + b[12], b[13]); #endif if (netif->input(p, netif) != ERR_OK) { gOverrunCount++; - EFR32_LOG("overrun count entering when fail to alloc value %d", gOverrunCount); + SILABS_LOG("overrun count entering when fail to alloc value %d", gOverrunCount); pbuf_free(p); } } else { gOverrunCount++; - EFR32_LOG("overrun count entering when fail to alloc value %d", gOverrunCount); + SILABS_LOG("overrun count entering when fail to alloc value %d", gOverrunCount); } } @@ -225,9 +225,9 @@ static err_t low_level_output(struct netif * netif, struct pbuf * p) // 12 is size of other data in buffer struct, user shouldn't have to care about this? if (sl_wfx_host_allocate_buffer((void **) &tx_buffer, SL_WFX_TX_FRAME_BUFFER, asize) != SL_STATUS_OK) { - EFR32_LOG("*ERR*EN-Out: No mem frame len=%d", framelength); + SILABS_LOG("*ERR*EN-Out: No mem frame len=%d", framelength); gOverrunCount++; - EFR32_LOG("overrun count exiting when faied to alloc value %d", gOverrunCount); + SILABS_LOG("overrun count exiting when faied to alloc value %d", gOverrunCount); return ERR_MEM; } buffer = tx_buffer->body.packet_data; @@ -249,7 +249,7 @@ static err_t low_level_output(struct netif * netif, struct pbuf * p) result = SL_STATUS_FAIL; #ifdef WIFI_DEBUG_ENABLED - EFR32_LOG("WF200: Out %d", (int) framelength); + SILABS_LOG("WF200: Out %d", (int) framelength); #endif /* send the generated frame over Wifi network */ @@ -261,7 +261,7 @@ static err_t low_level_output(struct netif * netif, struct pbuf * p) if (result != SL_STATUS_OK) { - EFR32_LOG("*ERR*Send enet %d", (int) framelength); + SILABS_LOG("*ERR*Send enet %d", (int) framelength); return ERR_IF; } return ERR_OK; @@ -296,7 +296,7 @@ void sl_wfx_host_received_frame_callback(sl_wfx_received_ind_t * rx_buffer) buffer = (uint8_t *) &(rx_buffer->body.frame[rx_buffer->body.frame_padding]); #ifdef WIFI_DEBUG_ENABLED - EFR32_LOG("WF200: In %d", (int) len); + SILABS_LOG("WF200: In %d", (int) len); #endif low_level_input(netif, buffer, len); @@ -304,14 +304,14 @@ void sl_wfx_host_received_frame_callback(sl_wfx_received_ind_t * rx_buffer) else { #ifdef WIFI_DEBUG_ENABLED - EFR32_LOG("WF200: NO-INTF"); + SILABS_LOG("WF200: NO-INTF"); #endif } } else { #ifdef WIFI_DEBUG_ENABLED - EFR32_LOG("WF200: Invalid frame IN"); + SILABS_LOG("WF200: Invalid frame IN"); #endif } } @@ -342,11 +342,11 @@ static err_t low_level_output(struct netif * netif, struct pbuf * p) return ERR_IF; } #ifdef WIFI_DEBUG_ENABLED - EFR32_LOG("EN-RSI: Output"); + SILABS_LOG("EN-RSI: Output"); #endif if ((netif->flags & (NETIF_FLAG_LINK_UP | NETIF_FLAG_UP)) != (NETIF_FLAG_LINK_UP | NETIF_FLAG_UP)) { - EFR32_LOG("EN-RSI:NOT UP"); + SILABS_LOG("EN-RSI:NOT UP"); xSemaphoreGive(ethout_sem); return ERR_IF; } @@ -354,15 +354,15 @@ static err_t low_level_output(struct netif * netif, struct pbuf * p) rsipkt = wfx_rsi_alloc_pkt(); if (!rsipkt) { - EFR32_LOG("EN-RSI:No buf"); + SILABS_LOG("EN-RSI:No buf"); xSemaphoreGive(ethout_sem); return ERR_IF; } #ifdef WIFI_DEBUG_ENABLED uint8_t * b = (uint8_t *) p->payload; - EFR32_LOG("EN-RSI: Out [%02x:%02x:%02x:%02x:%02x:%02x][%02x:%02x:%02x:%02x:%02x:%02x]type=%02x%02x", b[0], b[1], b[2], b[3], - b[4], b[5], b[6], b[7], b[8], b[9], b[10], b[11], b[12], b[13]); + SILABS_LOG("EN-RSI: Out [%02x:%02x:%02x:%02x:%02x:%02x][%02x:%02x:%02x:%02x:%02x:%02x]type=%02x%02x", b[0], b[1], b[2], b[3], + b[4], b[5], b[6], b[7], b[8], b[9], b[10], b[11], b[12], b[13]); #endif /* Generate the packet */ for (q = p, framelength = 0; q != NULL; q = q->next) @@ -376,7 +376,7 @@ static err_t low_level_output(struct netif * netif, struct pbuf * p) wfx_rsi_pkt_add_data(rsipkt, (uint8_t *) (p->payload), LWIP_FRAME_ALIGNMENT - framelength, framelength); } #ifdef WIFI_DEBUG_ENABLED - EFR32_LOG("EN-RSI: Sending %d", framelength); + SILABS_LOG("EN-RSI: Sending %d", framelength); #endif /* forward the generated packet to RSI to @@ -384,13 +384,13 @@ static err_t low_level_output(struct netif * netif, struct pbuf * p) */ if (wfx_rsi_send_data(rsipkt, framelength)) { - EFR32_LOG("*ERR*EN-RSI:Send fail"); + SILABS_LOG("*ERR*EN-RSI:Send fail"); xSemaphoreGive(ethout_sem); return ERR_IF; } #ifdef WIFI_DEBUG_ENABLED - EFR32_LOG("EN-RSI:Xmit %d", framelength); + SILABS_LOG("EN-RSI:Xmit %d", framelength); #endif xSemaphoreGive(ethout_sem); diff --git a/src/platform/silabs/EFR32/wifi/wfx_notify.cpp b/src/platform/silabs/EFR32/wifi/wfx_notify.cpp index 7e975f93416b41..9f681e796c6d19 100644 --- a/src/platform/silabs/EFR32/wifi/wfx_notify.cpp +++ b/src/platform/silabs/EFR32/wifi/wfx_notify.cpp @@ -63,7 +63,7 @@ void wfx_started_notify() sl_wfx_startup_ind_t evt; sl_wfx_mac_address_t mac; - EFR32_LOG("%s: started.", __func__); + SILABS_LOG("%s: started.", __func__); memset(&evt, 0, sizeof(evt)); evt.header.id = SL_WFX_STARTUP_IND_ID; @@ -88,15 +88,15 @@ void wfx_connected_notify(int32_t status, sl_wfx_mac_address_t * ap) { sl_wfx_connect_ind_t evt; - EFR32_LOG("%s: started.", __func__); + SILABS_LOG("%s: started.", __func__); if (status != SUCCESS_STATUS) { - EFR32_LOG("%s: error: failed status: %d.", __func__, status); + SILABS_LOG("%s: error: failed status: %d.", __func__, status); return; } - EFR32_LOG("%s: connected.", __func__); + SILABS_LOG("%s: connected.", __func__); memset(&evt, 0, sizeof(evt)); evt.header.id = SL_WFX_CONNECT_IND_ID; @@ -121,7 +121,7 @@ void wfx_disconnected_notify(int32_t status) { sl_wfx_disconnect_ind_t evt; - EFR32_LOG("%s: started.", __func__); + SILABS_LOG("%s: started.", __func__); memset(&evt, 0, sizeof(evt)); evt.header.id = SL_WFX_DISCONNECT_IND_ID; @@ -141,7 +141,7 @@ void wfx_ipv6_notify(int got_ip) { sl_wfx_generic_message_t eventData; - EFR32_LOG("%s: started.", __func__); + SILABS_LOG("%s: started.", __func__); memset(&eventData, 0, sizeof(eventData)); eventData.header.id = got_ip ? IP_EVENT_GOT_IP6 : IP_EVENT_STA_LOST_IP; @@ -170,7 +170,7 @@ void wfx_ip_changed_notify(int got_ip) { sl_wfx_generic_message_t eventData; - EFR32_LOG("%s: started.", __func__); + SILABS_LOG("%s: started.", __func__); memset(&eventData, 0, sizeof(eventData)); eventData.header.id = got_ip ? IP_EVENT_STA_GOT_IP : IP_EVENT_STA_LOST_IP; diff --git a/src/platform/silabs/EFR32Config.h b/src/platform/silabs/EFR32Config.h deleted file mode 100644 index 2bb0f50d98ffd3..00000000000000 --- a/src/platform/silabs/EFR32Config.h +++ /dev/null @@ -1,199 +0,0 @@ -/* - * - * Copyright (c) 2020-2022 Project CHIP Authors - * Copyright (c) 2019 Nest Labs, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @file - * Utilities for accessing persisted device configuration on - * platforms based on the Silicon Labs SDK. - */ - -#pragma once - -#include - -#include - -#include "nvm3.h" -#include "nvm3_hal_flash.h" - -#ifndef KVS_MAX_ENTRIES -#define KVS_MAX_ENTRIES 75 // Available key slot count for Kvs Key mapping. -#endif - -// Delay before Key/Value is actually saved in NVM -#define EFR32_KVS_SAVE_DELAY_SECONDS 5 - -static_assert((KVS_MAX_ENTRIES <= 255), "Implementation supports up to 255 Kvs entries"); -static_assert((KVS_MAX_ENTRIES >= 30), "Mininimal Kvs entries requirement is not met"); - -namespace chip { -namespace DeviceLayer { -namespace Internal { - -/** - * - * This implementation uses the Silicon Labs EFR32 NVM3 flash data storage library - * as the underlying storage layer. - * - * NOTE: This class is designed to be mixed-in to the concrete subclass of the - * GenericConfigurationManagerImpl<> template. When used this way, the class - * naturally provides implementations for the delegated members referenced by - * the template class (e.g. the ReadConfigValue() method). - */ - -// Silabs NVM3 objects use a 20-bit number, -// NVM3 Key 19:16 Stack region -// NVM3 Key 15:0 Available NVM3 keys 0x0000 -> 0xFFFF. -// Matter stack reserved region ranges from 0x087200 to 0x087FFF -// e.g. key = 0x087201 -// '08' = Matter nvm3 region -// '72' = the sub region group base offset (Factory, Config, Counter or KVS) -// '01' = the id offset inside the group. -constexpr uint32_t kMatterNvm3KeyDomain = 0x080000U; -constexpr uint32_t kMatterNvm3KeyLoLimit = 0x087200U; // Do not modify without Silabs GSDK team approval -constexpr uint32_t kMatterNvm3KeyHiLimit = 0x087FFFU; // Do not modify without Silabs GSDK team approval -constexpr inline uint32_t EFR32ConfigKey(uint8_t keyBaseOffset, uint8_t id) -{ - return kMatterNvm3KeyDomain | static_cast(keyBaseOffset) << 8 | id; -} - -class EFR32Config -{ -public: - // Definitions for Silicon Labs EFR32 NVM3 driver:- - - using Key = uint32_t; - - // NVM3 key base offsets used by the CHIP Device Layer. - // ** Key base can range from 0x72 to 0x7F ** - // Persistent config values set at manufacturing time. Retained during factory reset. - static constexpr uint8_t kMatterFactory_KeyBase = 0x72; - // Persistent config values set at runtime. Cleared during factory reset. - static constexpr uint8_t kMatterConfig_KeyBase = 0x73; - // Persistent counter values set at runtime. Retained during factory reset. - static constexpr uint8_t kMatterCounter_KeyBase = 0x74; - // Persistent config values set at runtime. Cleared during factory reset. - static constexpr uint8_t kMatterKvs_KeyBase = 0x75; - - // Key definitions for well-known configuration values. - // Factory config keys - static constexpr Key kConfigKey_SerialNum = EFR32ConfigKey(kMatterFactory_KeyBase, 0x00); - static constexpr Key kConfigKey_MfrDeviceId = EFR32ConfigKey(kMatterFactory_KeyBase, 0x01); - static constexpr Key kConfigKey_MfrDeviceCert = EFR32ConfigKey(kMatterFactory_KeyBase, 0x02); - static constexpr Key kConfigKey_MfrDevicePrivateKey = EFR32ConfigKey(kMatterFactory_KeyBase, 0x03); - static constexpr Key kConfigKey_ManufacturingDate = EFR32ConfigKey(kMatterFactory_KeyBase, 0x04); - static constexpr Key kConfigKey_SetupPayloadBitSet = EFR32ConfigKey(kMatterFactory_KeyBase, 0x05); - static constexpr Key kConfigKey_MfrDeviceICACerts = EFR32ConfigKey(kMatterFactory_KeyBase, 0x06); - static constexpr Key kConfigKey_SetupDiscriminator = EFR32ConfigKey(kMatterFactory_KeyBase, 0x07); - static constexpr Key kConfigKey_Spake2pIterationCount = EFR32ConfigKey(kMatterFactory_KeyBase, 0x08); - static constexpr Key kConfigKey_Spake2pSalt = EFR32ConfigKey(kMatterFactory_KeyBase, 0x09); - static constexpr Key kConfigKey_Spake2pVerifier = EFR32ConfigKey(kMatterFactory_KeyBase, 0x0A); - static constexpr Key kConfigKey_ProductId = EFR32ConfigKey(kMatterFactory_KeyBase, 0x0B); - static constexpr Key kConfigKey_VendorId = EFR32ConfigKey(kMatterFactory_KeyBase, 0x0C); - static constexpr Key kConfigKey_VendorName = EFR32ConfigKey(kMatterFactory_KeyBase, 0x0D); - static constexpr Key kConfigKey_ProductName = EFR32ConfigKey(kMatterFactory_KeyBase, 0x0E); - static constexpr Key kConfigKey_HardwareVersionString = EFR32ConfigKey(kMatterFactory_KeyBase, 0x0F); - static constexpr Key kConfigKey_UniqueId = EFR32ConfigKey(kMatterFactory_KeyBase, 0x1F); - // Matter Config Keys - static constexpr Key kConfigKey_ServiceConfig = EFR32ConfigKey(kMatterConfig_KeyBase, 0x01); - static constexpr Key kConfigKey_PairedAccountId = EFR32ConfigKey(kMatterConfig_KeyBase, 0x02); - static constexpr Key kConfigKey_ServiceId = EFR32ConfigKey(kMatterConfig_KeyBase, 0x03); - static constexpr Key kConfigKey_LastUsedEpochKeyId = EFR32ConfigKey(kMatterConfig_KeyBase, 0x05); - static constexpr Key kConfigKey_FailSafeArmed = EFR32ConfigKey(kMatterConfig_KeyBase, 0x06); - static constexpr Key kConfigKey_GroupKey = EFR32ConfigKey(kMatterConfig_KeyBase, 0x07); - static constexpr Key kConfigKey_HardwareVersion = EFR32ConfigKey(kMatterConfig_KeyBase, 0x08); - static constexpr Key kConfigKey_RegulatoryLocation = EFR32ConfigKey(kMatterConfig_KeyBase, 0x09); - static constexpr Key kConfigKey_CountryCode = EFR32ConfigKey(kMatterConfig_KeyBase, 0x0A); - static constexpr Key kConfigKey_WiFiSSID = EFR32ConfigKey(kMatterConfig_KeyBase, 0x0C); - static constexpr Key kConfigKey_WiFiPSK = EFR32ConfigKey(kMatterConfig_KeyBase, 0x0D); - static constexpr Key kConfigKey_WiFiSEC = EFR32ConfigKey(kMatterConfig_KeyBase, 0x0E); - static constexpr Key kConfigKey_GroupKeyBase = EFR32ConfigKey(kMatterConfig_KeyBase, 0x0F); - static constexpr Key kConfigKey_LockUser = EFR32ConfigKey(kMatterConfig_KeyBase, 0x10); - static constexpr Key kConfigKey_Credential = EFR32ConfigKey(kMatterConfig_KeyBase, 0x11); - static constexpr Key kConfigKey_LockUserName = EFR32ConfigKey(kMatterConfig_KeyBase, 0x12); - static constexpr Key kConfigKey_CredentialData = EFR32ConfigKey(kMatterConfig_KeyBase, 0x13); - static constexpr Key kConfigKey_UserCredentials = EFR32ConfigKey(kMatterConfig_KeyBase, 0x14); - static constexpr Key kConfigKey_WeekDaySchedules = EFR32ConfigKey(kMatterConfig_KeyBase, 0x15); - static constexpr Key kConfigKey_YearDaySchedules = EFR32ConfigKey(kMatterConfig_KeyBase, 0x16); - static constexpr Key kConfigKey_HolidaySchedules = EFR32ConfigKey(kMatterConfig_KeyBase, 0x17); - static constexpr Key kConfigKey_OpKeyMap = EFR32ConfigKey(kMatterConfig_KeyBase, 0x20); - - static constexpr Key kConfigKey_GroupKeyMax = - EFR32ConfigKey(kMatterConfig_KeyBase, 0x1E); // Allows 16 Group Keys to be created. - - // Matter Counter Keys - static constexpr Key kConfigKey_BootCount = EFR32ConfigKey(kMatterCounter_KeyBase, 0x00); - static constexpr Key kConfigKey_TotalOperationalHours = EFR32ConfigKey(kMatterCounter_KeyBase, 0x01); - static constexpr Key kConfigKey_LifeTimeCounter = EFR32ConfigKey(kMatterCounter_KeyBase, 0x02); - - // Matter KVS storage Keys - static constexpr Key kConfigKey_KvsStringKeyMap = EFR32ConfigKey(kMatterKvs_KeyBase, 0x00); - static constexpr Key kConfigKey_KvsFirstKeySlot = EFR32ConfigKey(kMatterKvs_KeyBase, 0x01); - static constexpr Key kConfigKey_KvsLastKeySlot = EFR32ConfigKey(kMatterKvs_KeyBase, KVS_MAX_ENTRIES); - - // Set key id limits for each group. - static constexpr Key kMinConfigKey_MatterFactory = EFR32ConfigKey(kMatterFactory_KeyBase, 0x00); - static constexpr Key kMaxConfigKey_MatterFactory = EFR32ConfigKey(kMatterFactory_KeyBase, 0x1F); - static constexpr Key kMinConfigKey_MatterConfig = EFR32ConfigKey(kMatterConfig_KeyBase, 0x00); - static constexpr Key kMaxConfigKey_MatterConfig = EFR32ConfigKey(kMatterConfig_KeyBase, 0x20); - - // Allows 32 Counters to be created. - static constexpr Key kMinConfigKey_MatterCounter = EFR32ConfigKey(kMatterCounter_KeyBase, 0x00); - static constexpr Key kMaxConfigKey_MatterCounter = EFR32ConfigKey(kMatterCounter_KeyBase, 0x1F); - - static constexpr Key kMinConfigKey_MatterKvs = EFR32ConfigKey(kMatterKvs_KeyBase, 0x00); - static constexpr Key kMaxConfigKey_MatterKvs = EFR32ConfigKey(kMatterKvs_KeyBase, 0xFF); - - static CHIP_ERROR Init(void); - static void DeInit(void); - - // Configuration methods used by the GenericConfigurationManagerImpl<> template. - static CHIP_ERROR ReadConfigValue(Key key, bool & val); - static CHIP_ERROR ReadConfigValue(Key key, uint32_t & val); - static CHIP_ERROR ReadConfigValue(Key key, uint64_t & val); - static CHIP_ERROR ReadConfigValueStr(Key key, char * buf, size_t bufSize, size_t & outLen); - static CHIP_ERROR ReadConfigValueBin(Key key, uint8_t * buf, size_t bufSize, size_t & outLen); - static CHIP_ERROR ReadConfigValueBin(Key key, uint8_t * buf, size_t bufSize, size_t & outLen, size_t offset); - static CHIP_ERROR ReadConfigValueCounter(uint8_t counterIdx, uint32_t & val); - static CHIP_ERROR WriteConfigValue(Key key, bool val); - static CHIP_ERROR WriteConfigValue(Key key, uint32_t val); - static CHIP_ERROR WriteConfigValue(Key key, uint64_t val); - static CHIP_ERROR WriteConfigValueStr(Key key, const char * str); - static CHIP_ERROR WriteConfigValueStr(Key key, const char * str, size_t strLen); - static CHIP_ERROR WriteConfigValueBin(Key key, const uint8_t * data, size_t dataLen); - static CHIP_ERROR WriteConfigValueCounter(uint8_t counterIdx, uint32_t val); - static CHIP_ERROR ClearConfigValue(Key key); - static bool ConfigValueExists(Key key); - static bool ConfigValueExists(Key key, size_t & dataLen); - static CHIP_ERROR FactoryResetConfig(void); - static bool ValidConfigKey(Key key); - - static void RunConfigUnitTest(void); - static void RepackNvm3Flash(void); - -protected: - using ForEachRecordFunct = std::function; - static CHIP_ERROR ForEachRecord(Key firstKey, Key lastKey, bool addNewRecord, ForEachRecordFunct funct); - -private: - static CHIP_ERROR MapNvm3Error(Ecode_t nvm3Res); -}; - -} // namespace Internal -} // namespace DeviceLayer -} // namespace chip diff --git a/src/platform/silabs/InetPlatformConfig.h b/src/platform/silabs/InetPlatformConfig.h index fe3304fa5d9915..99ca28ced0f9ea 100644 --- a/src/platform/silabs/InetPlatformConfig.h +++ b/src/platform/silabs/InetPlatformConfig.h @@ -19,7 +19,7 @@ /** * @file * Platform-specific configuration overrides for the CHIP Inet - * Layer on EFR32 platforms using the Silicon Labs SDK. + * Layer on Silabs platforms using the Silicon Labs SDK. * */ diff --git a/src/platform/silabs/Logging.cpp b/src/platform/silabs/Logging.cpp index bd8d712d8145e6..fbc9f2a25762c7 100644 --- a/src/platform/silabs/Logging.cpp +++ b/src/platform/silabs/Logging.cpp @@ -19,6 +19,10 @@ #include #include +#ifdef BRD4325A // For SiWx917 Platform only +#include "core_cm4.h" +#endif + #ifdef PW_RPC_ENABLED #include "PigweedLogger.h" #endif @@ -62,17 +66,17 @@ #if CHIP_SYSTEM_CONFIG_USE_LWIP #define LOG_LWIP "[lwip ]" #endif // CHIP_SYSTEM_CONFIG_USE_LWIP -#define LOG_EFR32 "[efr32 ]" +#define LOG_SILABS "[silabs ]" // If a new category string LOG_* is created, add it in the MaxStringLength arguments below #if CHIP_SYSTEM_CONFIG_USE_LWIP -static constexpr size_t kMaxCategoryStrLen = chip::MaxStringLength(LOG_ERROR, LOG_WARN, LOG_INFO, LOG_DETAIL, LOG_LWIP, LOG_EFR32); +static constexpr size_t kMaxCategoryStrLen = chip::MaxStringLength(LOG_ERROR, LOG_WARN, LOG_INFO, LOG_DETAIL, LOG_LWIP, LOG_SILABS); #else -static constexpr size_t kMaxCategoryStrLen = chip::MaxStringLength(LOG_ERROR, LOG_WARN, LOG_INFO, LOG_DETAIL, LOG_EFR32); +static constexpr size_t kMaxCategoryStrLen = chip::MaxStringLength(LOG_ERROR, LOG_WARN, LOG_INFO, LOG_DETAIL, LOG_SILABS); #endif // CHIP_SYSTEM_CONFIG_USE_LWIP static constexpr size_t kMaxTimestampStrLen = 16; // "[" (HH)HH:MM:SS + "." + miliseconds(3digits) + "]" -#if EFR32_LOG_ENABLED +#if SILABS_LOG_ENABLED static bool sLogInitialized = false; #endif #if LOG_RTT_BUFFER_INDEX != 0 @@ -80,7 +84,7 @@ static uint8_t sLogBuffer[LOG_RTT_BUFFER_SIZE]; static uint8_t sCmdLineBuffer[LOG_RTT_BUFFER_SIZE]; #endif -#if EFR32_LOG_ENABLED +#if SILABS_LOG_ENABLED using namespace chip; @@ -132,14 +136,14 @@ static void PrintLog(const char * msg) #endif } } -#endif // EFR32_LOG_ENABLED +#endif // SILABS_LOG_ENABLED /** * Initialize Segger RTT for logging */ -extern "C" void efr32InitLog(void) +extern "C" void silabsInitLog(void) { -#if EFR32_LOG_ENABLED +#if SILABS_LOG_ENABLED #if LOG_RTT_BUFFER_INDEX != 0 SEGGER_RTT_ConfigUpBuffer(LOG_RTT_BUFFER_INDEX, LOG_RTT_BUFFER_NAME, sLogBuffer, LOG_RTT_BUFFER_SIZE, SEGGER_RTT_MODE_NO_BLOCK_TRIM); @@ -154,7 +158,7 @@ extern "C" void efr32InitLog(void) PigweedLogger::init(); #endif sLogInitialized = true; -#endif // EFR32_LOG_ENABLED +#endif // SILABS_LOG_ENABLED } /** @@ -165,12 +169,12 @@ extern "C" void efr32Log(const char * aFormat, ...) va_list v; va_start(v, aFormat); -#if EFR32_LOG_ENABLED +#if SILABS_LOG_ENABLED char formattedMsg[CHIP_CONFIG_LOG_MESSAGE_MAX_SIZE]; static_assert(sizeof(formattedMsg) > kMaxTimestampStrLen + kMaxCategoryStrLen); // Greater than to at least accommodate a ending Null Character - size_t prefixLen = AddTimeStampAndPrefixStr(formattedMsg, LOG_EFR32, CHIP_CONFIG_LOG_MESSAGE_MAX_SIZE); + size_t prefixLen = AddTimeStampAndPrefixStr(formattedMsg, LOG_SILABS, CHIP_CONFIG_LOG_MESSAGE_MAX_SIZE); size_t len = vsnprintf(formattedMsg + prefixLen, sizeof formattedMsg - prefixLen, aFormat, v); if (len >= sizeof formattedMsg - prefixLen) @@ -179,7 +183,7 @@ extern "C" void efr32Log(const char * aFormat, ...) } PrintLog(formattedMsg); -#endif // EFR32_LOG_ENABLED +#endif // SILABS_LOG_ENABLED va_end(v); } @@ -207,7 +211,7 @@ namespace Platform { */ void LogV(const char * module, uint8_t category, const char * aFormat, va_list v) { -#if EFR32_LOG_ENABLED && _CHIP_USE_LOGGING +#if SILABS_LOG_ENABLED && _CHIP_USE_LOGGING if (IsCategoryEnabled(category)) { char formattedMsg[CHIP_CONFIG_LOG_MESSAGE_MAX_SIZE]; @@ -248,7 +252,7 @@ void LogV(const char * module, uint8_t category, const char * aFormat, va_list v // Let the application know that a log message has been emitted. chip::DeviceLayer::OnLogOutput(); -#endif // EFR32_LOG_ENABLED && _CHIP_USE_LOGGING +#endif // SILABS_LOG_ENABLED && _CHIP_USE_LOGGING } } // namespace Platform @@ -265,7 +269,7 @@ extern "C" void LwIPLog(const char * aFormat, ...) va_list v; va_start(v, aFormat); -#if EFR32_LOG_ENABLED +#if SILABS_LOG_ENABLED char formattedMsg[CHIP_CONFIG_LOG_MESSAGE_MAX_SIZE]; size_t prefixLen = AddTimeStampAndPrefixStr(formattedMsg, LOG_LWIP, CHIP_CONFIG_LOG_MESSAGE_MAX_SIZE); @@ -286,7 +290,7 @@ extern "C" void LwIPLog(const char * aFormat, ...) // Let the application know that a log message has been emitted. chip::DeviceLayer::OnLogOutput(); -#endif // EFR32_LOG_ENABLED +#endif // SILABS_LOG_ENABLED va_end(v); } #endif // CHIP_SYSTEM_CONFIG_USE_LWIP @@ -300,7 +304,7 @@ extern "C" void otPlatLog(otLogLevel aLogLevel, otLogRegion aLogRegion, const ch va_list v; va_start(v, aFormat); -#if EFR32_LOG_ENABLED +#if SILABS_LOG_ENABLED size_t prefixLen; char formattedMsg[CHIP_CONFIG_LOG_MESSAGE_MAX_SIZE]; @@ -342,12 +346,12 @@ extern "C" void otPlatLog(otLogLevel aLogLevel, otLogRegion aLogRegion, const ch // Let the application know that a log message has been emitted. chip::DeviceLayer::OnLogOutput(); -#endif // EFR32_LOG_ENABLED +#endif // SILABS_LOG_ENABLED va_end(v); } #endif // CHIP_ENABLE_OPENTHREAD -#if HARD_FAULT_LOG_ENABLE && EFR32_LOG_ENABLED +#if HARD_FAULT_LOG_ENABLE && SILABS_LOG_ENABLED /** * Log register contents to UART when a hard fault occurs. @@ -370,7 +374,7 @@ extern "C" void debugHardfault(uint32_t * sp) if (sLogInitialized == false) { - efr32InitLog(); + silabsInitLog(); } snprintf(formattedMsg, sizeof formattedMsg, LOG_ERROR "HardFault:\n"); @@ -428,7 +432,7 @@ extern "C" void vApplicationMallocFailedHook(void) timers, and semaphores. The size of the FreeRTOS heap is set by the configTOTAL_HEAP_SIZE configuration constant in FreeRTOSConfig.h. */ - EFR32_LOG("Failed do a malloc on HEAP. Is it too small ?"); + SILABS_LOG("Failed do a malloc on HEAP. Is it too small ?"); /* Force an assert. */ configASSERT((volatile void *) NULL); @@ -443,8 +447,8 @@ extern "C" void vApplicationStackOverflowHook(TaskHandle_t pxTask, char * pcTask /* Run time stack overflow checking is performed if configCHECK_FOR_STACK_OVERFLOW is defined to 1 or 2. This hook function is called if a stack overflow is detected. */ - EFR32_LOG("TASK OVERFLOW"); - EFR32_LOG(pcTaskName); + SILABS_LOG("TASK OVERFLOW"); + SILABS_LOG(pcTaskName); /* Force an assert. */ configASSERT((volatile void *) NULL); } @@ -503,4 +507,4 @@ extern "C" void vApplicationGetTimerTaskMemory(StaticTask_t ** ppxTimerTaskTCBBu configMINIMAL_STACK_SIZE is specified in words, not bytes. */ *pulTimerTaskStackSize = configTIMER_TASK_STACK_DEPTH; } -#endif // HARD_FAULT_LOG_ENABLE && EFR32_LOG_ENABLED +#endif // HARD_FAULT_LOG_ENABLE && SILABS_LOG_ENABLED diff --git a/src/platform/silabs/NetworkCommissioningWiFiDriver.cpp b/src/platform/silabs/NetworkCommissioningWiFiDriver.cpp index 55ae4d1fe5751e..61c95f7f52954c 100644 --- a/src/platform/silabs/NetworkCommissioningWiFiDriver.cpp +++ b/src/platform/silabs/NetworkCommissioningWiFiDriver.cpp @@ -18,8 +18,8 @@ #include #include #include -#include #include +#include #include @@ -44,12 +44,12 @@ CHIP_ERROR SlWiFiDriver::Init(NetworkStatusChangeCallback * networkStatusChangeC mpConnectCallback = nullptr; // If reading fails, wifi is not provisioned, no need to go further. - err = - EFR32Config::ReadConfigValueStr(EFR32Config::kConfigKey_WiFiSSID, mSavedNetwork.ssid, sizeof(mSavedNetwork.ssid), ssidLen); + err = SILABSConfig::ReadConfigValueStr(SILABSConfig::kConfigKey_WiFiSSID, mSavedNetwork.ssid, sizeof(mSavedNetwork.ssid), + ssidLen); VerifyOrReturnError(err == CHIP_NO_ERROR, CHIP_NO_ERROR); - err = EFR32Config::ReadConfigValueStr(EFR32Config::kConfigKey_WiFiPSK, mSavedNetwork.credentials, - sizeof(mSavedNetwork.credentials), credentialsLen); + err = SILABSConfig::ReadConfigValueStr(SILABSConfig::kConfigKey_WiFiPSK, mSavedNetwork.credentials, + sizeof(mSavedNetwork.credentials), credentialsLen); VerifyOrReturnError(err == CHIP_NO_ERROR, CHIP_NO_ERROR); mSavedNetwork.credentialsLen = credentialsLen; @@ -64,9 +64,9 @@ CHIP_ERROR SlWiFiDriver::CommitConfiguration() { uint8_t securityType = WFX_SEC_WPA2; - ReturnErrorOnFailure(EFR32Config::WriteConfigValueStr(EFR32Config::kConfigKey_WiFiSSID, mStagingNetwork.ssid)); - ReturnErrorOnFailure(EFR32Config::WriteConfigValueStr(EFR32Config::kConfigKey_WiFiPSK, mStagingNetwork.credentials)); - ReturnErrorOnFailure(EFR32Config::WriteConfigValueBin(EFR32Config::kConfigKey_WiFiSEC, &securityType, sizeof(securityType))); + ReturnErrorOnFailure(SILABSConfig::WriteConfigValueStr(SILABSConfig::kConfigKey_WiFiSSID, mStagingNetwork.ssid)); + ReturnErrorOnFailure(SILABSConfig::WriteConfigValueStr(SILABSConfig::kConfigKey_WiFiPSK, mStagingNetwork.credentials)); + ReturnErrorOnFailure(SILABSConfig::WriteConfigValueBin(SILABSConfig::kConfigKey_WiFiSEC, &securityType, sizeof(securityType))); mSavedNetwork = mStagingNetwork; return CHIP_NO_ERROR; diff --git a/src/platform/silabs/PlatformManagerImpl.h b/src/platform/silabs/PlatformManagerImpl.h index 39e2be6c8a2e93..511070c55b002f 100644 --- a/src/platform/silabs/PlatformManagerImpl.h +++ b/src/platform/silabs/PlatformManagerImpl.h @@ -19,7 +19,7 @@ /** * @file * Provides an implementation of the PlatformManager object - * for EFR32 platforms using the Silicon Labs SDK. + * for SILABS platforms using the Silicon Labs SDK. */ #pragma once @@ -33,7 +33,7 @@ namespace chip { namespace DeviceLayer { /** - * Concrete implementation of the PlatformManager singleton object for the EFR32 platform. + * Concrete implementation of the PlatformManager singleton object for the SILABS platform. */ class PlatformManagerImpl final : public PlatformManager, public Internal::GenericPlatformManagerImpl_FreeRTOS { diff --git a/src/platform/silabs/EFR32Config.cpp b/src/platform/silabs/SilabsConfig.cpp similarity index 87% rename from src/platform/silabs/EFR32Config.cpp rename to src/platform/silabs/SilabsConfig.cpp index 82751b36f2077c..a02fe5ed7f5d2d 100644 --- a/src/platform/silabs/EFR32Config.cpp +++ b/src/platform/silabs/SilabsConfig.cpp @@ -24,7 +24,7 @@ /* this file behaves like a config.h, comes first */ #include -#include +#include #include #include @@ -36,14 +36,14 @@ // Substitute the GSDK weak nvm3_lockBegin and nvm3_lockEnd // for an application controlled re-entrance protection -#define EFR32_SEM_TIMEOUT_ms 5 +#define SILABS_SEM_TIMEOUT_ms 5 static SemaphoreHandle_t nvm3_Sem; static StaticSemaphore_t nvm3_SemStruct; void nvm3_lockBegin(void) { VerifyOrDie(nvm3_Sem != NULL); - xSemaphoreTake(nvm3_Sem, EFR32_SEM_TIMEOUT_ms); + xSemaphoreTake(nvm3_Sem, SILABS_SEM_TIMEOUT_ms); } void nvm3_lockEnd(void) @@ -61,7 +61,7 @@ namespace Internal { // The NVM3 default section is placed at end of Flash minus 1 page byt the linker file // See examples/platform/efr32/ldscripts/efr32mgXX.ld -CHIP_ERROR EFR32Config::Init() +CHIP_ERROR SILABSConfig::Init() { nvm3_Sem = xSemaphoreCreateBinaryStatic(&nvm3_SemStruct); @@ -73,13 +73,13 @@ CHIP_ERROR EFR32Config::Init() return MapNvm3Error(nvm3_open(nvm3_defaultHandle, nvm3_defaultInit)); } -void EFR32Config::DeInit() +void SILABSConfig::DeInit() { vSemaphoreDelete(nvm3_Sem); nvm3_close(nvm3_defaultHandle); } -CHIP_ERROR EFR32Config::ReadConfigValue(Key key, bool & val) +CHIP_ERROR SILABSConfig::ReadConfigValue(Key key, bool & val) { CHIP_ERROR err; uint32_t objectType; @@ -101,7 +101,7 @@ CHIP_ERROR EFR32Config::ReadConfigValue(Key key, bool & val) return err; } -CHIP_ERROR EFR32Config::ReadConfigValue(Key key, uint32_t & val) +CHIP_ERROR SILABSConfig::ReadConfigValue(Key key, uint32_t & val) { CHIP_ERROR err; uint32_t objectType; @@ -123,7 +123,7 @@ CHIP_ERROR EFR32Config::ReadConfigValue(Key key, uint32_t & val) return err; } -CHIP_ERROR EFR32Config::ReadConfigValue(Key key, uint64_t & val) +CHIP_ERROR SILABSConfig::ReadConfigValue(Key key, uint64_t & val) { CHIP_ERROR err; uint32_t objectType; @@ -145,7 +145,7 @@ CHIP_ERROR EFR32Config::ReadConfigValue(Key key, uint64_t & val) return err; } -CHIP_ERROR EFR32Config::ReadConfigValueStr(Key key, char * buf, size_t bufSize, size_t & outLen) +CHIP_ERROR SILABSConfig::ReadConfigValueStr(Key key, char * buf, size_t bufSize, size_t & outLen) { CHIP_ERROR err; uint32_t objectType; @@ -194,7 +194,7 @@ CHIP_ERROR EFR32Config::ReadConfigValueStr(Key key, char * buf, size_t bufSize, return err; } -CHIP_ERROR EFR32Config::ReadConfigValueBin(Key key, uint8_t * buf, size_t bufSize, size_t & outLen) +CHIP_ERROR SILABSConfig::ReadConfigValueBin(Key key, uint8_t * buf, size_t bufSize, size_t & outLen) { CHIP_ERROR err; uint32_t objectType; @@ -224,7 +224,7 @@ CHIP_ERROR EFR32Config::ReadConfigValueBin(Key key, uint8_t * buf, size_t bufSiz return err; } -CHIP_ERROR EFR32Config::ReadConfigValueBin(Key key, uint8_t * buf, size_t bufSize, size_t & outLen, size_t offset) +CHIP_ERROR SILABSConfig::ReadConfigValueBin(Key key, uint8_t * buf, size_t bufSize, size_t & outLen, size_t offset) { CHIP_ERROR err; uint32_t objectType; @@ -261,7 +261,7 @@ CHIP_ERROR EFR32Config::ReadConfigValueBin(Key key, uint8_t * buf, size_t bufSiz return err; } -CHIP_ERROR EFR32Config::ReadConfigValueCounter(uint8_t counterIdx, uint32_t & val) +CHIP_ERROR SILABSConfig::ReadConfigValueCounter(uint8_t counterIdx, uint32_t & val) { CHIP_ERROR err; uint32_t tmpVal = 0; @@ -278,7 +278,7 @@ CHIP_ERROR EFR32Config::ReadConfigValueCounter(uint8_t counterIdx, uint32_t & va return err; } -CHIP_ERROR EFR32Config::WriteConfigValue(Key key, bool val) +CHIP_ERROR SILABSConfig::WriteConfigValue(Key key, bool val) { CHIP_ERROR err; @@ -291,7 +291,7 @@ CHIP_ERROR EFR32Config::WriteConfigValue(Key key, bool val) return err; } -CHIP_ERROR EFR32Config::WriteConfigValue(Key key, uint32_t val) +CHIP_ERROR SILABSConfig::WriteConfigValue(Key key, uint32_t val) { CHIP_ERROR err; @@ -304,7 +304,7 @@ CHIP_ERROR EFR32Config::WriteConfigValue(Key key, uint32_t val) return err; } -CHIP_ERROR EFR32Config::WriteConfigValue(Key key, uint64_t val) +CHIP_ERROR SILABSConfig::WriteConfigValue(Key key, uint64_t val) { CHIP_ERROR err; @@ -317,12 +317,12 @@ CHIP_ERROR EFR32Config::WriteConfigValue(Key key, uint64_t val) return err; } -CHIP_ERROR EFR32Config::WriteConfigValueStr(Key key, const char * str) +CHIP_ERROR SILABSConfig::WriteConfigValueStr(Key key, const char * str) { return WriteConfigValueStr(key, str, (str != NULL) ? strlen(str) : 0); } -CHIP_ERROR EFR32Config::WriteConfigValueStr(Key key, const char * str, size_t strLen) +CHIP_ERROR SILABSConfig::WriteConfigValueStr(Key key, const char * str, size_t strLen) { CHIP_ERROR err = CHIP_ERROR_INVALID_ARGUMENT; @@ -340,7 +340,7 @@ CHIP_ERROR EFR32Config::WriteConfigValueStr(Key key, const char * str, size_t st return err; } -CHIP_ERROR EFR32Config::WriteConfigValueBin(Key key, const uint8_t * data, size_t dataLen) +CHIP_ERROR SILABSConfig::WriteConfigValueBin(Key key, const uint8_t * data, size_t dataLen) { CHIP_ERROR err = CHIP_ERROR_INVALID_ARGUMENT; @@ -358,7 +358,7 @@ CHIP_ERROR EFR32Config::WriteConfigValueBin(Key key, const uint8_t * data, size_ return err; } -CHIP_ERROR EFR32Config::WriteConfigValueCounter(uint8_t counterIdx, uint32_t val) +CHIP_ERROR SILABSConfig::WriteConfigValueCounter(uint8_t counterIdx, uint32_t val) { CHIP_ERROR err; Key key = kMinConfigKey_MatterCounter + counterIdx; @@ -372,7 +372,7 @@ CHIP_ERROR EFR32Config::WriteConfigValueCounter(uint8_t counterIdx, uint32_t val return err; } -CHIP_ERROR EFR32Config::ClearConfigValue(Key key) +CHIP_ERROR SILABSConfig::ClearConfigValue(Key key) { CHIP_ERROR err; @@ -384,7 +384,7 @@ CHIP_ERROR EFR32Config::ClearConfigValue(Key key) return err; } -bool EFR32Config::ConfigValueExists(Key key) +bool SILABSConfig::ConfigValueExists(Key key) { uint32_t objectType; size_t dataLen; @@ -394,7 +394,7 @@ bool EFR32Config::ConfigValueExists(Key key) return (err == CHIP_NO_ERROR); } -bool EFR32Config::ConfigValueExists(Key key, size_t & dataLen) +bool SILABSConfig::ConfigValueExists(Key key, size_t & dataLen) { uint32_t objectType; size_t dLen; @@ -410,7 +410,7 @@ bool EFR32Config::ConfigValueExists(Key key, size_t & dataLen) return (err == CHIP_NO_ERROR); } -CHIP_ERROR EFR32Config::FactoryResetConfig(void) +CHIP_ERROR SILABSConfig::FactoryResetConfig(void) { // Deletes all nvm3 'Config' type objects. // Note- 'Factory' and 'Counter' type nvm3 objects are NOT deleted. @@ -438,7 +438,7 @@ CHIP_ERROR EFR32Config::FactoryResetConfig(void) return err; } -CHIP_ERROR EFR32Config::MapNvm3Error(Ecode_t nvm3Res) +CHIP_ERROR SILABSConfig::MapNvm3Error(Ecode_t nvm3Res) { CHIP_ERROR err; @@ -451,14 +451,14 @@ CHIP_ERROR EFR32Config::MapNvm3Error(Ecode_t nvm3Res) err = CHIP_DEVICE_ERROR_CONFIG_NOT_FOUND; break; default: - err = CHIP_ERROR(ChipError::Range::kPlatform, (nvm3Res & 0xFF) + CHIP_DEVICE_CONFIG_EFR32_NVM3_ERROR_MIN); + err = CHIP_ERROR(ChipError::Range::kPlatform, (nvm3Res & 0xFF) + CHIP_DEVICE_CONFIG_SILABS_NVM3_ERROR_MIN); break; } return err; } -CHIP_ERROR EFR32Config::ForEachRecord(Key firstNvm3Key, Key lastNvm3Key, bool addNewRecord, ForEachRecordFunct funct) +CHIP_ERROR SILABSConfig::ForEachRecord(Key firstNvm3Key, Key lastNvm3Key, bool addNewRecord, ForEachRecordFunct funct) { // Iterates through the specified range of nvm3 object key ids. // Invokes the callers CB function when appropriate. @@ -503,7 +503,7 @@ exit:; return err; } -bool EFR32Config::ValidConfigKey(Key key) +bool SILABSConfig::ValidConfigKey(Key key) { // Returns true if the key is in the Matter nvm3 reserved key range. // Additional check validates that the user consciously defined the expected key range @@ -516,13 +516,13 @@ bool EFR32Config::ValidConfigKey(Key key) return false; } -void EFR32Config::RunConfigUnitTest() +void SILABSConfig::RunConfigUnitTest() { // Run common unit test. - ::chip::DeviceLayer::Internal::RunConfigUnitTest(); + ::chip::DeviceLayer::Internal::RunConfigUnitTest(); } -void EFR32Config::RepackNvm3Flash(void) +void SILABSConfig::RepackNvm3Flash(void) { // Repack nvm3 flash if nvm3 space < headroom threshold. // Note- checking periodically during idle periods should prevent diff --git a/src/platform/silabs/SilabsConfig.h b/src/platform/silabs/SilabsConfig.h new file mode 100644 index 00000000000000..d08daf14158a1b --- /dev/null +++ b/src/platform/silabs/SilabsConfig.h @@ -0,0 +1,199 @@ +/* + * + * Copyright (c) 2020-2022 Project CHIP Authors + * Copyright (c) 2019 Nest Labs, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file + * Utilities for accessing persisted device configuration on + * platforms based on the Silicon Labs SDK. + */ + +#pragma once + +#include + +#include + +#include "nvm3.h" +#include "nvm3_hal_flash.h" + +#ifndef KVS_MAX_ENTRIES +#define KVS_MAX_ENTRIES 75 // Available key slot count for Kvs Key mapping. +#endif + +// Delay before Key/Value is actually saved in NVM +#define SILABS_KVS_SAVE_DELAY_SECONDS 5 + +static_assert((KVS_MAX_ENTRIES <= 255), "Implementation supports up to 255 Kvs entries"); +static_assert((KVS_MAX_ENTRIES >= 30), "Mininimal Kvs entries requirement is not met"); + +namespace chip { +namespace DeviceLayer { +namespace Internal { + +/** + * + * This implementation uses the Silicon Labs SILABS NVM3 flash data storage library + * as the underlying storage layer. + * + * NOTE: This class is designed to be mixed-in to the concrete subclass of the + * GenericConfigurationManagerImpl<> template. When used this way, the class + * naturally provides implementations for the delegated members referenced by + * the template class (e.g. the ReadConfigValue() method). + */ + +// Silabs NVM3 objects use a 20-bit number, +// NVM3 Key 19:16 Stack region +// NVM3 Key 15:0 Available NVM3 keys 0x0000 -> 0xFFFF. +// Matter stack reserved region ranges from 0x087200 to 0x087FFF +// e.g. key = 0x087201 +// '08' = Matter nvm3 region +// '72' = the sub region group base offset (Factory, Config, Counter or KVS) +// '01' = the id offset inside the group. +constexpr uint32_t kMatterNvm3KeyDomain = 0x080000U; +constexpr uint32_t kMatterNvm3KeyLoLimit = 0x087200U; // Do not modify without Silabs GSDK team approval +constexpr uint32_t kMatterNvm3KeyHiLimit = 0x087FFFU; // Do not modify without Silabs GSDK team approval +constexpr inline uint32_t SILABSConfigKey(uint8_t keyBaseOffset, uint8_t id) +{ + return kMatterNvm3KeyDomain | static_cast(keyBaseOffset) << 8 | id; +} + +class SILABSConfig +{ +public: + // Definitions for Silicon Labs EFR32 NVM3 driver:- + + using Key = uint32_t; + + // NVM3 key base offsets used by the CHIP Device Layer. + // ** Key base can range from 0x72 to 0x7F ** + // Persistent config values set at manufacturing time. Retained during factory reset. + static constexpr uint8_t kMatterFactory_KeyBase = 0x72; + // Persistent config values set at runtime. Cleared during factory reset. + static constexpr uint8_t kMatterConfig_KeyBase = 0x73; + // Persistent counter values set at runtime. Retained during factory reset. + static constexpr uint8_t kMatterCounter_KeyBase = 0x74; + // Persistent config values set at runtime. Cleared during factory reset. + static constexpr uint8_t kMatterKvs_KeyBase = 0x75; + + // Key definitions for well-known configuration values. + // Factory config keys + static constexpr Key kConfigKey_SerialNum = SILABSConfigKey(kMatterFactory_KeyBase, 0x00); + static constexpr Key kConfigKey_MfrDeviceId = SILABSConfigKey(kMatterFactory_KeyBase, 0x01); + static constexpr Key kConfigKey_MfrDeviceCert = SILABSConfigKey(kMatterFactory_KeyBase, 0x02); + static constexpr Key kConfigKey_MfrDevicePrivateKey = SILABSConfigKey(kMatterFactory_KeyBase, 0x03); + static constexpr Key kConfigKey_ManufacturingDate = SILABSConfigKey(kMatterFactory_KeyBase, 0x04); + static constexpr Key kConfigKey_SetupPayloadBitSet = SILABSConfigKey(kMatterFactory_KeyBase, 0x05); + static constexpr Key kConfigKey_MfrDeviceICACerts = SILABSConfigKey(kMatterFactory_KeyBase, 0x06); + static constexpr Key kConfigKey_SetupDiscriminator = SILABSConfigKey(kMatterFactory_KeyBase, 0x07); + static constexpr Key kConfigKey_Spake2pIterationCount = SILABSConfigKey(kMatterFactory_KeyBase, 0x08); + static constexpr Key kConfigKey_Spake2pSalt = SILABSConfigKey(kMatterFactory_KeyBase, 0x09); + static constexpr Key kConfigKey_Spake2pVerifier = SILABSConfigKey(kMatterFactory_KeyBase, 0x0A); + static constexpr Key kConfigKey_ProductId = SILABSConfigKey(kMatterFactory_KeyBase, 0x0B); + static constexpr Key kConfigKey_VendorId = SILABSConfigKey(kMatterFactory_KeyBase, 0x0C); + static constexpr Key kConfigKey_VendorName = SILABSConfigKey(kMatterFactory_KeyBase, 0x0D); + static constexpr Key kConfigKey_ProductName = SILABSConfigKey(kMatterFactory_KeyBase, 0x0E); + static constexpr Key kConfigKey_HardwareVersionString = SILABSConfigKey(kMatterFactory_KeyBase, 0x0F); + static constexpr Key kConfigKey_UniqueId = SILABSConfigKey(kMatterFactory_KeyBase, 0x1F); + // Matter Config Keys + static constexpr Key kConfigKey_ServiceConfig = SILABSConfigKey(kMatterConfig_KeyBase, 0x01); + static constexpr Key kConfigKey_PairedAccountId = SILABSConfigKey(kMatterConfig_KeyBase, 0x02); + static constexpr Key kConfigKey_ServiceId = SILABSConfigKey(kMatterConfig_KeyBase, 0x03); + static constexpr Key kConfigKey_LastUsedEpochKeyId = SILABSConfigKey(kMatterConfig_KeyBase, 0x05); + static constexpr Key kConfigKey_FailSafeArmed = SILABSConfigKey(kMatterConfig_KeyBase, 0x06); + static constexpr Key kConfigKey_GroupKey = SILABSConfigKey(kMatterConfig_KeyBase, 0x07); + static constexpr Key kConfigKey_HardwareVersion = SILABSConfigKey(kMatterConfig_KeyBase, 0x08); + static constexpr Key kConfigKey_RegulatoryLocation = SILABSConfigKey(kMatterConfig_KeyBase, 0x09); + static constexpr Key kConfigKey_CountryCode = SILABSConfigKey(kMatterConfig_KeyBase, 0x0A); + static constexpr Key kConfigKey_WiFiSSID = SILABSConfigKey(kMatterConfig_KeyBase, 0x0C); + static constexpr Key kConfigKey_WiFiPSK = SILABSConfigKey(kMatterConfig_KeyBase, 0x0D); + static constexpr Key kConfigKey_WiFiSEC = SILABSConfigKey(kMatterConfig_KeyBase, 0x0E); + static constexpr Key kConfigKey_GroupKeyBase = SILABSConfigKey(kMatterConfig_KeyBase, 0x0F); + static constexpr Key kConfigKey_LockUser = SILABSConfigKey(kMatterConfig_KeyBase, 0x10); + static constexpr Key kConfigKey_Credential = SILABSConfigKey(kMatterConfig_KeyBase, 0x11); + static constexpr Key kConfigKey_LockUserName = SILABSConfigKey(kMatterConfig_KeyBase, 0x12); + static constexpr Key kConfigKey_CredentialData = SILABSConfigKey(kMatterConfig_KeyBase, 0x13); + static constexpr Key kConfigKey_UserCredentials = SILABSConfigKey(kMatterConfig_KeyBase, 0x14); + static constexpr Key kConfigKey_WeekDaySchedules = SILABSConfigKey(kMatterConfig_KeyBase, 0x15); + static constexpr Key kConfigKey_YearDaySchedules = SILABSConfigKey(kMatterConfig_KeyBase, 0x16); + static constexpr Key kConfigKey_HolidaySchedules = SILABSConfigKey(kMatterConfig_KeyBase, 0x17); + static constexpr Key kConfigKey_OpKeyMap = SILABSConfigKey(kMatterConfig_KeyBase, 0x20); + + static constexpr Key kConfigKey_GroupKeyMax = + SILABSConfigKey(kMatterConfig_KeyBase, 0x1E); // Allows 16 Group Keys to be created. + + // Matter Counter Keys + static constexpr Key kConfigKey_BootCount = SILABSConfigKey(kMatterCounter_KeyBase, 0x00); + static constexpr Key kConfigKey_TotalOperationalHours = SILABSConfigKey(kMatterCounter_KeyBase, 0x01); + static constexpr Key kConfigKey_LifeTimeCounter = SILABSConfigKey(kMatterCounter_KeyBase, 0x02); + + // Matter KVS storage Keys + static constexpr Key kConfigKey_KvsStringKeyMap = SILABSConfigKey(kMatterKvs_KeyBase, 0x00); + static constexpr Key kConfigKey_KvsFirstKeySlot = SILABSConfigKey(kMatterKvs_KeyBase, 0x01); + static constexpr Key kConfigKey_KvsLastKeySlot = SILABSConfigKey(kMatterKvs_KeyBase, KVS_MAX_ENTRIES); + + // Set key id limits for each group. + static constexpr Key kMinConfigKey_MatterFactory = SILABSConfigKey(kMatterFactory_KeyBase, 0x00); + static constexpr Key kMaxConfigKey_MatterFactory = SILABSConfigKey(kMatterFactory_KeyBase, 0x1F); + static constexpr Key kMinConfigKey_MatterConfig = SILABSConfigKey(kMatterConfig_KeyBase, 0x00); + static constexpr Key kMaxConfigKey_MatterConfig = SILABSConfigKey(kMatterConfig_KeyBase, 0x20); + + // Allows 32 Counters to be created. + static constexpr Key kMinConfigKey_MatterCounter = SILABSConfigKey(kMatterCounter_KeyBase, 0x00); + static constexpr Key kMaxConfigKey_MatterCounter = SILABSConfigKey(kMatterCounter_KeyBase, 0x1F); + + static constexpr Key kMinConfigKey_MatterKvs = SILABSConfigKey(kMatterKvs_KeyBase, 0x00); + static constexpr Key kMaxConfigKey_MatterKvs = SILABSConfigKey(kMatterKvs_KeyBase, 0xFF); + + static CHIP_ERROR Init(void); + static void DeInit(void); + + // Configuration methods used by the GenericConfigurationManagerImpl<> template. + static CHIP_ERROR ReadConfigValue(Key key, bool & val); + static CHIP_ERROR ReadConfigValue(Key key, uint32_t & val); + static CHIP_ERROR ReadConfigValue(Key key, uint64_t & val); + static CHIP_ERROR ReadConfigValueStr(Key key, char * buf, size_t bufSize, size_t & outLen); + static CHIP_ERROR ReadConfigValueBin(Key key, uint8_t * buf, size_t bufSize, size_t & outLen); + static CHIP_ERROR ReadConfigValueBin(Key key, uint8_t * buf, size_t bufSize, size_t & outLen, size_t offset); + static CHIP_ERROR ReadConfigValueCounter(uint8_t counterIdx, uint32_t & val); + static CHIP_ERROR WriteConfigValue(Key key, bool val); + static CHIP_ERROR WriteConfigValue(Key key, uint32_t val); + static CHIP_ERROR WriteConfigValue(Key key, uint64_t val); + static CHIP_ERROR WriteConfigValueStr(Key key, const char * str); + static CHIP_ERROR WriteConfigValueStr(Key key, const char * str, size_t strLen); + static CHIP_ERROR WriteConfigValueBin(Key key, const uint8_t * data, size_t dataLen); + static CHIP_ERROR WriteConfigValueCounter(uint8_t counterIdx, uint32_t val); + static CHIP_ERROR ClearConfigValue(Key key); + static bool ConfigValueExists(Key key); + static bool ConfigValueExists(Key key, size_t & dataLen); + static CHIP_ERROR FactoryResetConfig(void); + static bool ValidConfigKey(Key key); + + static void RunConfigUnitTest(void); + static void RepackNvm3Flash(void); + +protected: + using ForEachRecordFunct = std::function; + static CHIP_ERROR ForEachRecord(Key firstKey, Key lastKey, bool addNewRecord, ForEachRecordFunct funct); + +private: + static CHIP_ERROR MapNvm3Error(Ecode_t nvm3Res); +}; + +} // namespace Internal +} // namespace DeviceLayer +} // namespace chip diff --git a/src/platform/silabs/SystemPlatformConfig.h b/src/platform/silabs/SystemPlatformConfig.h index 722198fc148d41..fc03009be723ef 100644 --- a/src/platform/silabs/SystemPlatformConfig.h +++ b/src/platform/silabs/SystemPlatformConfig.h @@ -19,7 +19,7 @@ /** * @file * Platform-specific configuration overrides for the CHIP System - * Layer on Silcon Labs EFR32 Platforms. + * Layer on Silcon Labs SILABS Platforms. * */ diff --git a/src/platform/silabs/WarmPlatformConfig.h b/src/platform/silabs/WarmPlatformConfig.h index cdc8d88f065063..ae068b2c9a165c 100644 --- a/src/platform/silabs/WarmPlatformConfig.h +++ b/src/platform/silabs/WarmPlatformConfig.h @@ -19,7 +19,7 @@ /** * @file * Platform-specific configuration overrides for the Chip - * Addressing and Routing Module (WARM) on EFR32 platforms + * Addressing and Routing Module (WARM) on SILABS platforms * using the Silcon Labs SDK. * */ diff --git a/src/test_driver/efr32/BUILD.gn b/src/test_driver/efr32/BUILD.gn index 4cdb8868f1ab76..5b9573ba9fa607 100644 --- a/src/test_driver/efr32/BUILD.gn +++ b/src/test_driver/efr32/BUILD.gn @@ -57,7 +57,7 @@ efr32_sdk("sdk") { defines = [ "BOARD_ID=${silabs_board}", - "EFR32_LOG_ENABLED=1", + "SILABS_LOG_ENABLED=1", "PW_RPC_ENABLED", # Thread is built but test driver do not have the NETWORK_COMMISSIONING cluster or zap config. diff --git a/src/test_driver/efr32/include/AppConfig.h b/src/test_driver/efr32/include/AppConfig.h index 3b83d375b46219..b1085fd1c71038 100644 --- a/src/test_driver/efr32/include/AppConfig.h +++ b/src/test_driver/efr32/include/AppConfig.h @@ -25,9 +25,9 @@ extern "C" { #endif -void efr32InitLog(void); +void silabsInitLog(void); void efr32Log(const char * aFormat, ...); -#define EFR32_LOG(...) efr32Log(__VA_ARGS__); +#define SILABS_LOG(...) efr32Log(__VA_ARGS__); void appError(int err); #ifdef __cplusplus diff --git a/src/test_driver/efr32/src/main.cpp b/src/test_driver/efr32/src/main.cpp index c3d6028ab136b5..03f0a626f1b9a7 100644 --- a/src/test_driver/efr32/src/main.cpp +++ b/src/test_driver/efr32/src/main.cpp @@ -189,15 +189,15 @@ int main(void) chip::DeviceLayer::PlatformMgr().InitChipStack(); - EFR32_LOG("***** CHIP EFR32 device tests *****\r\n"); + SILABS_LOG("***** CHIP EFR32 device tests *****\r\n"); // Start RPC service which runs the tests. sTestTaskHandle = xTaskCreateStatic(RunRpcService, "RPC_TEST_TASK", ArraySize(sTestTaskStack), nullptr, TEST_TASK_PRIORITY, sTestTaskStack, &sTestTaskBuffer); - EFR32_LOG("Starting FreeRTOS scheduler"); + SILABS_LOG("Starting FreeRTOS scheduler"); sl_system_kernel_start(); // Should never get here. - EFR32_LOG("vTaskStartScheduler() failed"); + SILABS_LOG("vTaskStartScheduler() failed"); return -1; } diff --git a/third_party/silabs/BUILD.gn b/third_party/silabs/BUILD.gn index 5ac5159b925968..f968d3dc38f13c 100644 --- a/third_party/silabs/BUILD.gn +++ b/third_party/silabs/BUILD.gn @@ -67,7 +67,7 @@ if (use_silabs_thread_lib) { ] include_dirs = [ - "${chip_root}/examples/platform/efr32", + "${chip_root}/examples/platform/silabs/efr32", "${sdk_support_root}/matter/efr32/${silabs_family}/${silabs_board}", "${sl_ot_efr32_root}/src/src", "${sl_openthread_root}/src/", diff --git a/third_party/silabs/efr32_sdk.gni b/third_party/silabs/efr32_sdk.gni index eec46000392061..39d6e5d7161ce4 100644 --- a/third_party/silabs/efr32_sdk.gni +++ b/third_party/silabs/efr32_sdk.gni @@ -174,7 +174,7 @@ template("efr32_sdk") { "__STARTUP_CLEAR_BSS", "HARD_FAULT_LOG_ENABLE", "CORTEXM3_EFM32_MICRO", - "EFR32_LOG_ENABLED=1", + "SILABS_LOG_ENABLED=1", "NVM3_DEFAULT_NVM_SIZE=40960", "NVM3_DEFAULT_MAX_OBJECT_SIZE=4092", "KVS_MAX_ENTRIES=${kvs_max_entries}",