From a42d2cb88f0c6664226d8855ff5c92b6653f37e3 Mon Sep 17 00:00:00 2001 From: Jean-Francois Penven <67962328+jepenven-silabs@users.noreply.github.com> Date: Tue, 16 May 2023 16:27:02 -0400 Subject: [PATCH] [Silabs] Move Logging api to a common place (#26609) * Move Logging api to a common place * fix 9116 --- examples/chef/efr32/include/AppConfig.h | 19 +--------- .../silabs/SiWx917/include/AppConfig.h | 20 +--------- .../silabs/efr32/include/AppConfig.h | 20 +--------- .../silabs/SiWx917/include/AppConfig.h | 2 +- .../silabs/efr32/include/AppConfig.h | 2 +- .../silabs/SiWx917/include/AppConfig.h | 20 +--------- .../lock-app/silabs/efr32/include/AppConfig.h | 20 +--------- examples/platform/silabs/SiWx917/BUILD.gn | 2 +- .../silabs/SiWx917/BaseApplication.cpp | 2 +- .../SiWx917/hal/rsi_hal_mcu_platform_init.c | 2 +- .../platform/silabs/SiWx917/SiWx917/wfx_rsi.h | 2 - .../platform/silabs/SiWx917/siwx917_utils.cpp | 36 ------------------ .../platform/silabs/SiWx917/siwx917_utils.h | 38 ------------------- examples/platform/silabs/SiWx917/uart.cpp | 2 +- .../silabs/SilabsDeviceDataProvider.cpp | 2 +- examples/platform/silabs/efr32/BUILD.gn | 2 +- .../silabs/efr32/rs911x/hal/efx_spi.c | 5 +-- .../efr32/rs911x/hal/rsi_hal_mcu_interrupt.c | 1 - .../platform/silabs/efr32/rs911x/rsi_if.c | 2 + .../platform/silabs/efr32/rs911x/wfx_rsi.h | 2 - .../silabs/efr32/rs911x/wfx_rsi_host.c | 14 +------ .../platform/silabs/efr32/wf200/efr_spi.c | 1 - .../efr32_utils.cpp => silabs_utils.cpp} | 2 +- .../{efr32/efr32_utils.h => silabs_utils.h} | 4 +- .../silabs/efr32/include/AppConfig.h | 20 +--------- .../silabs/SiWx917/include/AppConfig.h | 19 +--------- .../silabs/efr32/include/AppConfig.h | 19 +--------- src/platform/silabs/Logging.cpp | 2 +- .../silabs/SiWx917/wifi/ethernetif.cpp | 4 +- src/platform/silabs/efr32/wifi/ethernetif.cpp | 4 +- src/test_driver/efr32/include/AppConfig.h | 16 +------- 31 files changed, 39 insertions(+), 267 deletions(-) delete mode 100644 examples/platform/silabs/SiWx917/siwx917_utils.cpp delete mode 100644 examples/platform/silabs/SiWx917/siwx917_utils.h rename examples/platform/silabs/{efr32/efr32_utils.cpp => silabs_utils.cpp} (97%) rename examples/platform/silabs/{efr32/efr32_utils.h => silabs_utils.h} (91%) diff --git a/examples/chef/efr32/include/AppConfig.h b/examples/chef/efr32/include/AppConfig.h index a936fe1d8abaeb..e278e9439a437f 100644 --- a/examples/chef/efr32/include/AppConfig.h +++ b/examples/chef/efr32/include/AppConfig.h @@ -18,6 +18,7 @@ */ #pragma once +#include "silabs_utils.h" // ---- Lighting Example App Config ---- @@ -26,21 +27,3 @@ // Time it takes in ms for the simulated actuator to move from one // state to another. #define ACTUATOR_MOVEMENT_PERIOS_MS 10 - -// EFR Logging -#ifdef __cplusplus -extern "C" { -#endif - -void silabsInitLog(void); - -void efr32Log(const char * aFormat, ...); -#define SILABS_LOG(...) efr32Log(__VA_ARGS__); -void appError(int err); - -#ifdef __cplusplus -} - -#include -void appError(CHIP_ERROR error); -#endif diff --git a/examples/light-switch-app/silabs/SiWx917/include/AppConfig.h b/examples/light-switch-app/silabs/SiWx917/include/AppConfig.h index b20cbf8fc20d55..0b6308b9f1eb61 100644 --- a/examples/light-switch-app/silabs/SiWx917/include/AppConfig.h +++ b/examples/light-switch-app/silabs/SiWx917/include/AppConfig.h @@ -19,6 +19,8 @@ #pragma once +#include "silabs_utils.h" + // ---- Lighting Example App Config ---- #define APP_TASK_NAME "Lit" @@ -28,21 +30,3 @@ // Time it takes in ms for the simulated actuator to move from one // state to another. #define ACTUATOR_MOVEMENT_PERIOS_MS 10 - -// EFR Logging -#ifdef __cplusplus -extern "C" { -#endif - -void silabsInitLog(void); - -void efr32Log(const char * aFormat, ...); -#define SILABS_LOG(...) efr32Log(__VA_ARGS__); -void appError(int err); - -#ifdef __cplusplus -} - -#include -void appError(CHIP_ERROR error); -#endif diff --git a/examples/light-switch-app/silabs/efr32/include/AppConfig.h b/examples/light-switch-app/silabs/efr32/include/AppConfig.h index 6d61bd11840cb6..040aafc6912b25 100644 --- a/examples/light-switch-app/silabs/efr32/include/AppConfig.h +++ b/examples/light-switch-app/silabs/efr32/include/AppConfig.h @@ -19,6 +19,8 @@ #pragma once +#include "silabs_utils.h" + // ---- Lighting Example App Config ---- #define APP_TASK_NAME "Lit" @@ -85,21 +87,3 @@ 0x00, 0xFC, 0xFF, 0xFF, 0x3F, 0x00, 0x00, 0x00, 0x00, 0xFC, 0xFF, 0xFF, 0x7F, 0x00, 0x00, 0x00, 0x00, 0xFE, 0xFF, 0xFF, \ 0xFF, 0x01, 0x00, 0x00, 0x80, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, \ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF - -// EFR Logging -#ifdef __cplusplus -extern "C" { -#endif - -void silabsInitLog(void); - -void efr32Log(const char * aFormat, ...); -#define SILABS_LOG(...) efr32Log(__VA_ARGS__); -void appError(int err); - -#ifdef __cplusplus -} - -#include -void appError(CHIP_ERROR error); -#endif diff --git a/examples/lighting-app/silabs/SiWx917/include/AppConfig.h b/examples/lighting-app/silabs/SiWx917/include/AppConfig.h index 0b916a32f8452c..5352f6742a8e76 100644 --- a/examples/lighting-app/silabs/SiWx917/include/AppConfig.h +++ b/examples/lighting-app/silabs/SiWx917/include/AppConfig.h @@ -19,7 +19,7 @@ #pragma once -#include "siwx917_utils.h" +#include "silabs_utils.h" // ---- Lighting Example App Config ---- diff --git a/examples/lighting-app/silabs/efr32/include/AppConfig.h b/examples/lighting-app/silabs/efr32/include/AppConfig.h index 1cb27c78ae654c..4aee946506f022 100644 --- a/examples/lighting-app/silabs/efr32/include/AppConfig.h +++ b/examples/lighting-app/silabs/efr32/include/AppConfig.h @@ -19,7 +19,7 @@ #pragma once -#include "efr32_utils.h" +#include "silabs_utils.h" // ---- Lighting Example App Config ---- diff --git a/examples/lock-app/silabs/SiWx917/include/AppConfig.h b/examples/lock-app/silabs/SiWx917/include/AppConfig.h index f6985596d8993e..62cff5df0aa336 100644 --- a/examples/lock-app/silabs/SiWx917/include/AppConfig.h +++ b/examples/lock-app/silabs/SiWx917/include/AppConfig.h @@ -19,6 +19,8 @@ #pragma once +#include "silabs_utils.h" + // ---- Door lock Example App Config ---- #define APP_TASK_NAME "Lock" @@ -28,21 +30,3 @@ // Time it takes in ms for the simulated actuator to move from one // state to another. #define ACTUATOR_MOVEMENT_PERIOS_MS 10 - -// EFR Logging -#ifdef __cplusplus -extern "C" { -#endif - -void silabsInitLog(void); - -void efr32Log(const char * aFormat, ...); -#define SILABS_LOG(...) efr32Log(__VA_ARGS__); -void appError(int err); - -#ifdef __cplusplus -} - -#include -void appError(CHIP_ERROR error); -#endif diff --git a/examples/lock-app/silabs/efr32/include/AppConfig.h b/examples/lock-app/silabs/efr32/include/AppConfig.h index 405bb4691ad8e5..2045ce3ef4d947 100644 --- a/examples/lock-app/silabs/efr32/include/AppConfig.h +++ b/examples/lock-app/silabs/efr32/include/AppConfig.h @@ -19,6 +19,8 @@ #pragma once +#include "silabs_utils.h" + // ---- Door lock Example App Config ---- #define APP_TASK_NAME "Lock" @@ -84,21 +86,3 @@ 0x00, 0xF8, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, \ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, \ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF - -// EFR Logging -#ifdef __cplusplus -extern "C" { -#endif - -void silabsInitLog(void); - -void efr32Log(const char * aFormat, ...); -#define SILABS_LOG(...) efr32Log(__VA_ARGS__); -void appError(int err); - -#ifdef __cplusplus -} - -#include -void appError(CHIP_ERROR error); -#endif diff --git a/examples/platform/silabs/SiWx917/BUILD.gn b/examples/platform/silabs/SiWx917/BUILD.gn index ad3775845f3efa..3233ea7e88dd98 100644 --- a/examples/platform/silabs/SiWx917/BUILD.gn +++ b/examples/platform/silabs/SiWx917/BUILD.gn @@ -240,6 +240,7 @@ source_set("siwx917-common") { sources = [ "${silabs_common_plat_dir}/LEDWidget.cpp", "${silabs_common_plat_dir}/heap_4_silabs.c", + "${silabs_common_plat_dir}/silabs_utils.cpp", "${silabs_common_plat_dir}/syscalls_stubs.cpp", "${wifi_sdk_dir}/dhcp_client.cpp", "${wifi_sdk_dir}/ethernetif.cpp", @@ -249,7 +250,6 @@ source_set("siwx917-common") { "SiWx917/wfx_rsi_host.c", "init_ccpPlatform.cpp", "matter_config.cpp", - "siwx917_utils.cpp", ] if (use_base_app) { diff --git a/examples/platform/silabs/SiWx917/BaseApplication.cpp b/examples/platform/silabs/SiWx917/BaseApplication.cpp index 8412eff3e81fc7..7b0bae137b2ecd 100644 --- a/examples/platform/silabs/SiWx917/BaseApplication.cpp +++ b/examples/platform/silabs/SiWx917/BaseApplication.cpp @@ -37,7 +37,7 @@ #include "SilabsDeviceDataProvider.h" #include "rsi_board.h" #include "rsi_chip.h" -#include "siwx917_utils.h" +#include "silabs_utils.h" #include #include #include diff --git a/examples/platform/silabs/SiWx917/SiWx917/hal/rsi_hal_mcu_platform_init.c b/examples/platform/silabs/SiWx917/SiWx917/hal/rsi_hal_mcu_platform_init.c index 453954795f6556..3801ebd30a4603 100644 --- a/examples/platform/silabs/SiWx917/SiWx917/hal/rsi_hal_mcu_platform_init.c +++ b/examples/platform/silabs/SiWx917/SiWx917/hal/rsi_hal_mcu_platform_init.c @@ -21,7 +21,7 @@ #include "rsi_board.h" #include "rsi_pll.h" #include "rsi_rom_clks.h" -#include "siwx917_utils.h" +#include "silabs_utils.h" #include "system_RS1xxxx.h" #define SOC_PLL_REF_FREQUENCY 32000000 /* PLL input REFERENCE clock 32MHZ */ diff --git a/examples/platform/silabs/SiWx917/SiWx917/wfx_rsi.h b/examples/platform/silabs/SiWx917/SiWx917/wfx_rsi.h index cb1279590926c7..51555534613d78 100644 --- a/examples/platform/silabs/SiWx917/SiWx917/wfx_rsi.h +++ b/examples/platform/silabs/SiWx917/SiWx917/wfx_rsi.h @@ -81,7 +81,6 @@ extern "C" { #endif void wfx_rsidev_init(void); void wfx_rsi_task(void * arg); -void efr32Log(const char * aFormat, ...); #if CHIP_DEVICE_CONFIG_ENABLE_IPV4 void wfx_ip_changed_notify(int got_ip); #endif /* CHIP_DEVICE_CONFIG_ENABLE_IPV4 */ @@ -90,7 +89,6 @@ int32_t wfx_rsi_get_ap_ext(wfx_wifi_scan_ext_t * extra_info); int32_t wfx_rsi_reset_count(); int32_t wfx_rsi_disconnect(); int32_t wfx_rsi_init_platform(); -#define SILABS_LOG(...) efr32Log(__VA_ARGS__); #ifdef __cplusplus } diff --git a/examples/platform/silabs/SiWx917/siwx917_utils.cpp b/examples/platform/silabs/SiWx917/siwx917_utils.cpp deleted file mode 100644 index 49a23255cd93c5..00000000000000 --- a/examples/platform/silabs/SiWx917/siwx917_utils.cpp +++ /dev/null @@ -1,36 +0,0 @@ -/* - * - * Copyright (c) 2020 Project CHIP Authors - * Copyright (c) 2022 Silabs. - * All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "siwx917_utils.h" -#include "init_ccpPlatform.h" - -#include - -void appError(int err) -{ - SILABS_LOG("!!!!!!!!!!!! App Critical Error: %d !!!!!!!!!!!", err); - portDISABLE_INTERRUPTS(); - while (true) - ; -} - -void appError(CHIP_ERROR error) -{ - appError(static_cast(error.AsInteger())); -} diff --git a/examples/platform/silabs/SiWx917/siwx917_utils.h b/examples/platform/silabs/SiWx917/siwx917_utils.h deleted file mode 100644 index 2223275d841733..00000000000000 --- a/examples/platform/silabs/SiWx917/siwx917_utils.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * - * Copyright (c) 2020 Project CHIP Authors - * Copyright (c) 2022 Silabs. - * All rights reserved. - * - * 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. - */ - -#pragma once - -// SiWx917 Logging -#ifdef __cplusplus -extern "C" { -#endif - -void silabsInitLog(void); - -void efr32Log(const char * aFormat, ...); -#define SILABS_LOG(...) efr32Log(__VA_ARGS__); -void appError(int err); - -#ifdef __cplusplus -} - -#include -void appError(CHIP_ERROR error); -#endif diff --git a/examples/platform/silabs/SiWx917/uart.cpp b/examples/platform/silabs/SiWx917/uart.cpp index 74e77f43f11ad4..966fe44d7efd25 100644 --- a/examples/platform/silabs/SiWx917/uart.cpp +++ b/examples/platform/silabs/SiWx917/uart.cpp @@ -19,7 +19,7 @@ #include "USART.h" #include "matter_shell.h" #include "rsi_rom_egpio.h" -#include "siwx917_utils.h" +#include "silabs_utils.h" #ifdef __cplusplus extern "C" { #endif diff --git a/examples/platform/silabs/SilabsDeviceDataProvider.cpp b/examples/platform/silabs/SilabsDeviceDataProvider.cpp index 585699785937bd..53e3e5fa3da259 100644 --- a/examples/platform/silabs/SilabsDeviceDataProvider.cpp +++ b/examples/platform/silabs/SilabsDeviceDataProvider.cpp @@ -24,7 +24,7 @@ #ifdef SIWX917_USE_COMISSIONABLE_DATA #include "DeviceConfig.h" -#include "siwx917_utils.h" +#include "silabs_utils.h" #include #include #endif // SIWX917_USE_COMISSIONABLE_DATA diff --git a/examples/platform/silabs/efr32/BUILD.gn b/examples/platform/silabs/efr32/BUILD.gn index d74792a1cba233..549b2aeec9da5a 100644 --- a/examples/platform/silabs/efr32/BUILD.gn +++ b/examples/platform/silabs/efr32/BUILD.gn @@ -282,8 +282,8 @@ source_set("efr32-common") { sources = [ "${silabs_common_plat_dir}/LEDWidget.cpp", "${silabs_common_plat_dir}/heap_4_silabs.c", + "${silabs_common_plat_dir}/silabs_utils.cpp", "${silabs_common_plat_dir}/syscalls_stubs.cpp", - "efr32_utils.cpp", "init_efrPlatform.cpp", "matter_config.cpp", ] diff --git a/examples/platform/silabs/efr32/rs911x/hal/efx_spi.c b/examples/platform/silabs/efr32/rs911x/hal/efx_spi.c index 02ae9b2cba9b17..507523a2f6e03e 100644 --- a/examples/platform/silabs/efr32/rs911x/hal/efx_spi.c +++ b/examples/platform/silabs/efr32/rs911x/hal/efx_spi.c @@ -36,6 +36,8 @@ #endif #include "spidrv.h" +#include "silabs_utils.h" + #include "gpiointerrupt.h" #include "sl_device_init_clocks.h" #include "sl_status.h" @@ -140,13 +142,10 @@ void rsi_hal_board_init(void) xSemaphoreGive(spiTransferLock); /* GPIO INIT of MG12 & MG24 : Reset, Wakeup, Interrupt */ - SILABS_LOG("RSI_HAL: init GPIO"); sl_wfx_host_gpio_init(); /* Reset of Wifi chip */ - SILABS_LOG("RSI_HAL: Reset Wifi"); sl_wfx_host_reset_chip(); - SILABS_LOG("RSI_HAL: Init done"); } /***************************************************************************** diff --git a/examples/platform/silabs/efr32/rs911x/hal/rsi_hal_mcu_interrupt.c b/examples/platform/silabs/efr32/rs911x/hal/rsi_hal_mcu_interrupt.c index cb802e32948839..b8edbd71cace76 100644 --- a/examples/platform/silabs/efr32/rs911x/hal/rsi_hal_mcu_interrupt.c +++ b/examples/platform/silabs/efr32/rs911x/hal/rsi_hal_mcu_interrupt.c @@ -70,7 +70,6 @@ void rsi_gpio_irq_cb(uint8_t irqnum) void rsi_hal_intr_config(void (*rsi_interrupt_handler)(void)) { call_back = rsi_interrupt_handler; - SILABS_LOG("RSI:Set SPI intr CB to=%x", (uint32_t) call_back); } /*===================================================*/ diff --git a/examples/platform/silabs/efr32/rs911x/rsi_if.c b/examples/platform/silabs/efr32/rs911x/rsi_if.c index dae7b0cd4f762e..86238374ef175f 100644 --- a/examples/platform/silabs/efr32/rs911x/rsi_if.c +++ b/examples/platform/silabs/efr32/rs911x/rsi_if.c @@ -31,6 +31,8 @@ #include "event_groups.h" #include "task.h" +#include "silabs_utils.h" + #include "wfx_host_events.h" #include "rsi_driver.h" diff --git a/examples/platform/silabs/efr32/rs911x/wfx_rsi.h b/examples/platform/silabs/efr32/rs911x/wfx_rsi.h index 7292970a11c011..cd18672faf42ba 100644 --- a/examples/platform/silabs/efr32/rs911x/wfx_rsi.h +++ b/examples/platform/silabs/efr32/rs911x/wfx_rsi.h @@ -83,7 +83,6 @@ extern "C" { #endif void wfx_rsidev_init(void); void wfx_rsi_task(void * arg); -void efr32Log(const char * aFormat, ...); #if CHIP_DEVICE_CONFIG_ENABLE_IPV4 void wfx_ip_changed_notify(int got_ip); #endif /* CHIP_DEVICE_CONFIG_ENABLE_IPV4 */ @@ -94,7 +93,6 @@ int32_t wfx_rsi_disconnect(); #if CHIP_DEVICE_CONFIG_ENABLE_SED int32_t wfx_rsi_power_save(); #endif /* CHIP_DEVICE_CONFIG_ENABLE_SED */ -#define SILABS_LOG(...) efr32Log(__VA_ARGS__); #ifdef __cplusplus } diff --git a/examples/platform/silabs/efr32/rs911x/wfx_rsi_host.c b/examples/platform/silabs/efr32/rs911x/wfx_rsi_host.c index 0691c21670518a..80368c1b66734b 100644 --- a/examples/platform/silabs/efr32/rs911x/wfx_rsi_host.c +++ b/examples/platform/silabs/efr32/rs911x/wfx_rsi_host.c @@ -26,6 +26,8 @@ #include "em_usart.h" #include "sl_status.h" +#include "silabs_utils.h" + #include "FreeRTOS.h" #include "event_groups.h" #include "task.h" @@ -53,11 +55,9 @@ sl_status_t wfx_wifi_start(void) { if (wfx_rsi.dev_state & WFX_RSI_ST_STARTED) { - SILABS_LOG("%s: already started.", __func__); return SL_STATUS_OK; } wfx_rsi.dev_state |= WFX_RSI_ST_STARTED; - SILABS_LOG("%s: starting..", __func__); /* * Create the Wifi driver task */ @@ -66,7 +66,6 @@ sl_status_t wfx_wifi_start(void) if (NULL == wfx_rsi.wlan_task) { - SILABS_LOG("%s: error: failed to create task.", __func__); return SL_STATUS_FAIL; } return SL_STATUS_OK; @@ -95,7 +94,6 @@ bool wfx_is_sta_mode_enabled(void) { bool mode; mode = !!(wfx_rsi.dev_state & WFX_RSI_ST_STA_MODE); - // SILABS_LOG("%s: %d", __func__, (mode ? "yes" : "no")); return mode; } @@ -170,7 +168,6 @@ void wfx_clear_wifi_provision(void) { memset(&wfx_rsi.sec, 0, sizeof(wfx_rsi.sec)); wfx_rsi.dev_state &= ~WFX_RSI_ST_STA_PROVISIONED; - SILABS_LOG("%s: completed.", __func__); } /************************************************************************* @@ -228,7 +225,6 @@ void wfx_setup_ip6_link_local(sl_wfx_interface_t whichif) * TODO: Implement IPV6 setup, currently in wfx_rsi_task() * This is hooked with MATTER code. */ - SILABS_LOG("%s: warning: not implemented.", __func__); } /********************************************************************* @@ -243,7 +239,6 @@ bool wfx_is_sta_connected(void) { bool status; status = (wfx_rsi.dev_state & WFX_RSI_ST_STA_CONNECTED) ? true : false; - SILABS_LOG("%s: status: %s", __func__, (status ? "connected" : "not connected")); return status; } @@ -272,11 +267,9 @@ wifi_mode_t wfx_get_wifi_mode() ***********************************************************************/ sl_status_t wfx_sta_discon(void) { - SILABS_LOG("%s: started.", __func__); int32_t status; status = wfx_rsi_disconnect(); wfx_rsi.dev_state &= ~WFX_RSI_ST_STA_CONNECTED; - SILABS_LOG("%s: completed.", __func__); return status; } #if CHIP_DEVICE_CONFIG_ENABLE_IPV4 @@ -299,7 +292,6 @@ bool wfx_have_ipv4_addr(sl_wfx_interface_t which_if) { status = false; /* TODO */ } - SILABS_LOG("%s: status: %d", __func__, status); return status; } #endif /* CHIP_DEVICE_CONFIG_ENABLE_IPV4 */ @@ -323,7 +315,6 @@ bool wfx_have_ipv6_addr(sl_wfx_interface_t which_if) { status = false; /* TODO */ } - SILABS_LOG("%s: status: %d", __func__, status); return status; } @@ -420,6 +411,5 @@ bool wfx_start_scan(char * ssid, void (*callback)(wfx_wifi_scan_result_t *)) void wfx_cancel_scan(void) { /* Not possible */ - SILABS_LOG("%s: cannot cancel scan", __func__); } #endif /* SL_WFX_CONFIG_SCAN */ diff --git a/examples/platform/silabs/efr32/wf200/efr_spi.c b/examples/platform/silabs/efr32/wf200/efr_spi.c index 927b9a5fb892fa..5c97a294321648 100644 --- a/examples/platform/silabs/efr32/wf200/efr_spi.c +++ b/examples/platform/silabs/efr32/wf200/efr_spi.c @@ -417,7 +417,6 @@ static void sl_wfx_spi_wakeup_irq_callback(uint8_t irqNumber) *****************************************************************************/ void sl_wfx_host_gpio_init(void) { - 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/efr32_utils.cpp b/examples/platform/silabs/silabs_utils.cpp similarity index 97% rename from examples/platform/silabs/efr32/efr32_utils.cpp rename to examples/platform/silabs/silabs_utils.cpp index bd2bf771c60152..2e8a83bdf5be2b 100644 --- a/examples/platform/silabs/efr32/efr32_utils.cpp +++ b/examples/platform/silabs/silabs_utils.cpp @@ -17,7 +17,7 @@ * limitations under the License. */ -#include "efr32_utils.h" +#include "silabs_utils.h" #include "init_efrPlatform.h" #include "sl_system_kernel.h" diff --git a/examples/platform/silabs/efr32/efr32_utils.h b/examples/platform/silabs/silabs_utils.h similarity index 91% rename from examples/platform/silabs/efr32/efr32_utils.h rename to examples/platform/silabs/silabs_utils.h index 04cf773fc49eff..93941fbf9c668e 100644 --- a/examples/platform/silabs/efr32/efr32_utils.h +++ b/examples/platform/silabs/silabs_utils.h @@ -26,8 +26,8 @@ extern "C" { void silabsInitLog(void); -void efr32Log(const char * aFormat, ...); -#define SILABS_LOG(...) efr32Log(__VA_ARGS__); +void silabsLog(const char * aFormat, ...); +#define SILABS_LOG(...) silabsLog(__VA_ARGS__); void appError(int err); #ifdef __cplusplus diff --git a/examples/thermostat/silabs/efr32/include/AppConfig.h b/examples/thermostat/silabs/efr32/include/AppConfig.h index a1561de487da01..edba77c5fc078c 100644 --- a/examples/thermostat/silabs/efr32/include/AppConfig.h +++ b/examples/thermostat/silabs/efr32/include/AppConfig.h @@ -19,6 +19,8 @@ #pragma once +#include "silabs_utils.h" + // ---- Lighting Example App Config ---- #define APP_TASK_NAME "Lit" @@ -58,21 +60,3 @@ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, \ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF #define OFF_DEMO_BITMAP ON_DEMO_BITMAP - -// EFR Logging -#ifdef __cplusplus -extern "C" { -#endif - -void silabsInitLog(void); - -void efr32Log(const char * aFormat, ...); -#define SILABS_LOG(...) efr32Log(__VA_ARGS__); -void appError(int err); - -#ifdef __cplusplus -} - -#include -void appError(CHIP_ERROR error); -#endif diff --git a/examples/window-app/silabs/SiWx917/include/AppConfig.h b/examples/window-app/silabs/SiWx917/include/AppConfig.h index 7a3f809ac217c5..19c64320bf6e7a 100644 --- a/examples/window-app/silabs/SiWx917/include/AppConfig.h +++ b/examples/window-app/silabs/SiWx917/include/AppConfig.h @@ -19,14 +19,11 @@ #pragma once +#include "silabs_utils.h" + // ---- Window Example App Config ---- #define APP_TASK_NAME "APP" -// EFR Logging -#ifdef __cplusplus -extern "C" { -#endif - #define LCD_SIZE 128 #define LCD_MARGIN_SIZE 1 #define LCD_BORDER_SIZE 2 @@ -56,15 +53,3 @@ extern "C" { #ifndef COVER_LIFT_TILT_TIMEOUT #define COVER_LIFT_TILT_TIMEOUT 500 #endif - -void silabsInitLog(void); - -void efr32Log(const char * aFormat, ...); -#define SILABS_LOG(...) efr32Log(__VA_ARGS__); - -#ifdef __cplusplus -} - -#include -void appError(CHIP_ERROR error); -#endif diff --git a/examples/window-app/silabs/efr32/include/AppConfig.h b/examples/window-app/silabs/efr32/include/AppConfig.h index 7a3f809ac217c5..19c64320bf6e7a 100644 --- a/examples/window-app/silabs/efr32/include/AppConfig.h +++ b/examples/window-app/silabs/efr32/include/AppConfig.h @@ -19,14 +19,11 @@ #pragma once +#include "silabs_utils.h" + // ---- Window Example App Config ---- #define APP_TASK_NAME "APP" -// EFR Logging -#ifdef __cplusplus -extern "C" { -#endif - #define LCD_SIZE 128 #define LCD_MARGIN_SIZE 1 #define LCD_BORDER_SIZE 2 @@ -56,15 +53,3 @@ extern "C" { #ifndef COVER_LIFT_TILT_TIMEOUT #define COVER_LIFT_TILT_TIMEOUT 500 #endif - -void silabsInitLog(void); - -void efr32Log(const char * aFormat, ...); -#define SILABS_LOG(...) efr32Log(__VA_ARGS__); - -#ifdef __cplusplus -} - -#include -void appError(CHIP_ERROR error); -#endif diff --git a/src/platform/silabs/Logging.cpp b/src/platform/silabs/Logging.cpp index 75f2cdd5d5f44b..05ed5194f56ab2 100644 --- a/src/platform/silabs/Logging.cpp +++ b/src/platform/silabs/Logging.cpp @@ -192,7 +192,7 @@ extern "C" void silabsInitLog(void) /** * General-purpose logging function */ -extern "C" void efr32Log(const char * aFormat, ...) +extern "C" void silabsLog(const char * aFormat, ...) { va_list v; diff --git a/src/platform/silabs/SiWx917/wifi/ethernetif.cpp b/src/platform/silabs/SiWx917/wifi/ethernetif.cpp index 13cc843d0e705d..73cc46c42daa5a 100644 --- a/src/platform/silabs/SiWx917/wifi/ethernetif.cpp +++ b/src/platform/silabs/SiWx917/wifi/ethernetif.cpp @@ -40,8 +40,8 @@ #ifndef SILABS_LOG extern "C" { -void efr32Log(const char * aFormat, ...); -#define SILABS_LOG(...) efr32Log(__VA_ARGS__); +void silabsLog(const char * aFormat, ...); +#define SILABS_LOG(...) silabsLog(__VA_ARGS__); } #endif diff --git a/src/platform/silabs/efr32/wifi/ethernetif.cpp b/src/platform/silabs/efr32/wifi/ethernetif.cpp index d1fcc01f3c4f9b..8b231c4e8b7898 100644 --- a/src/platform/silabs/efr32/wifi/ethernetif.cpp +++ b/src/platform/silabs/efr32/wifi/ethernetif.cpp @@ -46,8 +46,8 @@ #ifndef SILABS_LOG extern "C" { -void efr32Log(const char * aFormat, ...); -#define SILABS_LOG(...) efr32Log(__VA_ARGS__); +void silabsLog(const char * aFormat, ...); +#define SILABS_LOG(...) silabsLog(__VA_ARGS__); } #endif diff --git a/src/test_driver/efr32/include/AppConfig.h b/src/test_driver/efr32/include/AppConfig.h index b1085fd1c71038..2c15469ddb4c61 100644 --- a/src/test_driver/efr32/include/AppConfig.h +++ b/src/test_driver/efr32/include/AppConfig.h @@ -18,18 +18,6 @@ #pragma once -// ---- Device Test App Config ---- - -// EFR Logging -#ifdef __cplusplus -extern "C" { -#endif +#include "silabs_utils.h" -void silabsInitLog(void); -void efr32Log(const char * aFormat, ...); -#define SILABS_LOG(...) efr32Log(__VA_ARGS__); -void appError(int err); - -#ifdef __cplusplus -} -#endif +// ---- Device Test App Config ----