Skip to content

Commit 7a2dd22

Browse files
authoredMay 16, 2023
[Silabs] Move Logging api to a common place (project-chip#26609)
* Move Logging api to a common place * fix 9116
1 parent b7c4222 commit 7a2dd22

File tree

31 files changed

+39
-267
lines changed

31 files changed

+39
-267
lines changed
 

‎examples/chef/efr32/include/AppConfig.h

+1-18
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
*/
1919

2020
#pragma once
21+
#include "silabs_utils.h"
2122

2223
// ---- Lighting Example App Config ----
2324

@@ -26,21 +27,3 @@
2627
// Time it takes in ms for the simulated actuator to move from one
2728
// state to another.
2829
#define ACTUATOR_MOVEMENT_PERIOS_MS 10
29-
30-
// EFR Logging
31-
#ifdef __cplusplus
32-
extern "C" {
33-
#endif
34-
35-
void silabsInitLog(void);
36-
37-
void efr32Log(const char * aFormat, ...);
38-
#define SILABS_LOG(...) efr32Log(__VA_ARGS__);
39-
void appError(int err);
40-
41-
#ifdef __cplusplus
42-
}
43-
44-
#include <lib/core/CHIPError.h>
45-
void appError(CHIP_ERROR error);
46-
#endif

‎examples/light-switch-app/silabs/SiWx917/include/AppConfig.h

+2-18
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919

2020
#pragma once
2121

22+
#include "silabs_utils.h"
23+
2224
// ---- Lighting Example App Config ----
2325

2426
#define APP_TASK_NAME "Lit"
@@ -28,21 +30,3 @@
2830
// Time it takes in ms for the simulated actuator to move from one
2931
// state to another.
3032
#define ACTUATOR_MOVEMENT_PERIOS_MS 10
31-
32-
// EFR Logging
33-
#ifdef __cplusplus
34-
extern "C" {
35-
#endif
36-
37-
void silabsInitLog(void);
38-
39-
void efr32Log(const char * aFormat, ...);
40-
#define SILABS_LOG(...) efr32Log(__VA_ARGS__);
41-
void appError(int err);
42-
43-
#ifdef __cplusplus
44-
}
45-
46-
#include <lib/core/CHIPError.h>
47-
void appError(CHIP_ERROR error);
48-
#endif

‎examples/light-switch-app/silabs/efr32/include/AppConfig.h

+2-18
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919

2020
#pragma once
2121

22+
#include "silabs_utils.h"
23+
2224
// ---- Lighting Example App Config ----
2325

2426
#define APP_TASK_NAME "Lit"
@@ -85,21 +87,3 @@
8587
0x00, 0xFC, 0xFF, 0xFF, 0x3F, 0x00, 0x00, 0x00, 0x00, 0xFC, 0xFF, 0xFF, 0x7F, 0x00, 0x00, 0x00, 0x00, 0xFE, 0xFF, 0xFF, \
8688
0xFF, 0x01, 0x00, 0x00, 0x80, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, \
8789
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF
88-
89-
// EFR Logging
90-
#ifdef __cplusplus
91-
extern "C" {
92-
#endif
93-
94-
void silabsInitLog(void);
95-
96-
void efr32Log(const char * aFormat, ...);
97-
#define SILABS_LOG(...) efr32Log(__VA_ARGS__);
98-
void appError(int err);
99-
100-
#ifdef __cplusplus
101-
}
102-
103-
#include <lib/core/CHIPError.h>
104-
void appError(CHIP_ERROR error);
105-
#endif

‎examples/lighting-app/silabs/SiWx917/include/AppConfig.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
#pragma once
2121

22-
#include "siwx917_utils.h"
22+
#include "silabs_utils.h"
2323

2424
// ---- Lighting Example App Config ----
2525

‎examples/lighting-app/silabs/efr32/include/AppConfig.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
#pragma once
2121

22-
#include "efr32_utils.h"
22+
#include "silabs_utils.h"
2323

2424
// ---- Lighting Example App Config ----
2525

‎examples/lock-app/silabs/SiWx917/include/AppConfig.h

+2-18
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919

2020
#pragma once
2121

22+
#include "silabs_utils.h"
23+
2224
// ---- Door lock Example App Config ----
2325

2426
#define APP_TASK_NAME "Lock"
@@ -28,21 +30,3 @@
2830
// Time it takes in ms for the simulated actuator to move from one
2931
// state to another.
3032
#define ACTUATOR_MOVEMENT_PERIOS_MS 10
31-
32-
// EFR Logging
33-
#ifdef __cplusplus
34-
extern "C" {
35-
#endif
36-
37-
void silabsInitLog(void);
38-
39-
void efr32Log(const char * aFormat, ...);
40-
#define SILABS_LOG(...) efr32Log(__VA_ARGS__);
41-
void appError(int err);
42-
43-
#ifdef __cplusplus
44-
}
45-
46-
#include <lib/core/CHIPError.h>
47-
void appError(CHIP_ERROR error);
48-
#endif

‎examples/lock-app/silabs/efr32/include/AppConfig.h

+2-18
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919

2020
#pragma once
2121

22+
#include "silabs_utils.h"
23+
2224
// ---- Door lock Example App Config ----
2325

2426
#define APP_TASK_NAME "Lock"
@@ -84,21 +86,3 @@
8486
0x00, 0xF8, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, \
8587
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, \
8688
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF
87-
88-
// EFR Logging
89-
#ifdef __cplusplus
90-
extern "C" {
91-
#endif
92-
93-
void silabsInitLog(void);
94-
95-
void efr32Log(const char * aFormat, ...);
96-
#define SILABS_LOG(...) efr32Log(__VA_ARGS__);
97-
void appError(int err);
98-
99-
#ifdef __cplusplus
100-
}
101-
102-
#include <lib/core/CHIPError.h>
103-
void appError(CHIP_ERROR error);
104-
#endif

‎examples/platform/silabs/SiWx917/BUILD.gn

+1-1
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,7 @@ source_set("siwx917-common") {
240240
sources = [
241241
"${silabs_common_plat_dir}/LEDWidget.cpp",
242242
"${silabs_common_plat_dir}/heap_4_silabs.c",
243+
"${silabs_common_plat_dir}/silabs_utils.cpp",
243244
"${silabs_common_plat_dir}/syscalls_stubs.cpp",
244245
"${wifi_sdk_dir}/dhcp_client.cpp",
245246
"${wifi_sdk_dir}/ethernetif.cpp",
@@ -249,7 +250,6 @@ source_set("siwx917-common") {
249250
"SiWx917/wfx_rsi_host.c",
250251
"init_ccpPlatform.cpp",
251252
"matter_config.cpp",
252-
"siwx917_utils.cpp",
253253
]
254254

255255
if (use_base_app) {

‎examples/platform/silabs/SiWx917/BaseApplication.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
#include "SilabsDeviceDataProvider.h"
3838
#include "rsi_board.h"
3939
#include "rsi_chip.h"
40-
#include "siwx917_utils.h"
40+
#include "silabs_utils.h"
4141
#include <app/server/OnboardingCodesUtil.h>
4242
#include <app/server/Server.h>
4343
#include <app/util/attribute-storage.h>

‎examples/platform/silabs/SiWx917/SiWx917/hal/rsi_hal_mcu_platform_init.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
#include "rsi_board.h"
2222
#include "rsi_pll.h"
2323
#include "rsi_rom_clks.h"
24-
#include "siwx917_utils.h"
24+
#include "silabs_utils.h"
2525
#include "system_RS1xxxx.h"
2626

2727
#define SOC_PLL_REF_FREQUENCY 32000000 /* PLL input REFERENCE clock 32MHZ */

‎examples/platform/silabs/SiWx917/SiWx917/wfx_rsi.h

-2
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ extern "C" {
8181
#endif
8282
void wfx_rsidev_init(void);
8383
void wfx_rsi_task(void * arg);
84-
void efr32Log(const char * aFormat, ...);
8584
#if CHIP_DEVICE_CONFIG_ENABLE_IPV4
8685
void wfx_ip_changed_notify(int got_ip);
8786
#endif /* CHIP_DEVICE_CONFIG_ENABLE_IPV4 */
@@ -90,7 +89,6 @@ int32_t wfx_rsi_get_ap_ext(wfx_wifi_scan_ext_t * extra_info);
9089
int32_t wfx_rsi_reset_count();
9190
int32_t wfx_rsi_disconnect();
9291
int32_t wfx_rsi_init_platform();
93-
#define SILABS_LOG(...) efr32Log(__VA_ARGS__);
9492

9593
#ifdef __cplusplus
9694
}

‎examples/platform/silabs/SiWx917/siwx917_utils.cpp

-36
This file was deleted.

‎examples/platform/silabs/SiWx917/siwx917_utils.h

-38
This file was deleted.

‎examples/platform/silabs/SiWx917/uart.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
#include "USART.h"
2020
#include "matter_shell.h"
2121
#include "rsi_rom_egpio.h"
22-
#include "siwx917_utils.h"
22+
#include "silabs_utils.h"
2323
#ifdef __cplusplus
2424
extern "C" {
2525
#endif

‎examples/platform/silabs/SilabsDeviceDataProvider.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
#ifdef SIWX917_USE_COMISSIONABLE_DATA
2626
#include "DeviceConfig.h"
27-
#include "siwx917_utils.h"
27+
#include "silabs_utils.h"
2828
#include <setup_payload/Base38Decode.h>
2929
#include <setup_payload/QRCodeSetupPayloadGenerator.h>
3030
#endif // SIWX917_USE_COMISSIONABLE_DATA

‎examples/platform/silabs/efr32/BUILD.gn

+1-1
Original file line numberDiff line numberDiff line change
@@ -282,8 +282,8 @@ source_set("efr32-common") {
282282
sources = [
283283
"${silabs_common_plat_dir}/LEDWidget.cpp",
284284
"${silabs_common_plat_dir}/heap_4_silabs.c",
285+
"${silabs_common_plat_dir}/silabs_utils.cpp",
285286
"${silabs_common_plat_dir}/syscalls_stubs.cpp",
286-
"efr32_utils.cpp",
287287
"init_efrPlatform.cpp",
288288
"matter_config.cpp",
289289
]

‎examples/platform/silabs/efr32/rs911x/hal/efx_spi.c

+2-3
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@
3636
#endif
3737
#include "spidrv.h"
3838

39+
#include "silabs_utils.h"
40+
3941
#include "gpiointerrupt.h"
4042
#include "sl_device_init_clocks.h"
4143
#include "sl_status.h"
@@ -140,13 +142,10 @@ void rsi_hal_board_init(void)
140142
xSemaphoreGive(spiTransferLock);
141143

142144
/* GPIO INIT of MG12 & MG24 : Reset, Wakeup, Interrupt */
143-
SILABS_LOG("RSI_HAL: init GPIO");
144145
sl_wfx_host_gpio_init();
145146

146147
/* Reset of Wifi chip */
147-
SILABS_LOG("RSI_HAL: Reset Wifi");
148148
sl_wfx_host_reset_chip();
149-
SILABS_LOG("RSI_HAL: Init done");
150149
}
151150

152151
/*****************************************************************************

‎examples/platform/silabs/efr32/rs911x/hal/rsi_hal_mcu_interrupt.c

-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ void rsi_gpio_irq_cb(uint8_t irqnum)
7070
void rsi_hal_intr_config(void (*rsi_interrupt_handler)(void))
7171
{
7272
call_back = rsi_interrupt_handler;
73-
SILABS_LOG("RSI:Set SPI intr CB to=%x", (uint32_t) call_back);
7473
}
7574

7675
/*===================================================*/

‎examples/platform/silabs/efr32/rs911x/rsi_if.c

+2
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@
3131
#include "event_groups.h"
3232
#include "task.h"
3333

34+
#include "silabs_utils.h"
35+
3436
#include "wfx_host_events.h"
3537

3638
#include "rsi_driver.h"

‎examples/platform/silabs/efr32/rs911x/wfx_rsi.h

-2
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ extern "C" {
8383
#endif
8484
void wfx_rsidev_init(void);
8585
void wfx_rsi_task(void * arg);
86-
void efr32Log(const char * aFormat, ...);
8786
#if CHIP_DEVICE_CONFIG_ENABLE_IPV4
8887
void wfx_ip_changed_notify(int got_ip);
8988
#endif /* CHIP_DEVICE_CONFIG_ENABLE_IPV4 */
@@ -94,7 +93,6 @@ int32_t wfx_rsi_disconnect();
9493
#if CHIP_DEVICE_CONFIG_ENABLE_SED
9594
int32_t wfx_rsi_power_save();
9695
#endif /* CHIP_DEVICE_CONFIG_ENABLE_SED */
97-
#define SILABS_LOG(...) efr32Log(__VA_ARGS__);
9896

9997
#ifdef __cplusplus
10098
}

0 commit comments

Comments
 (0)
Please sign in to comment.