Skip to content

Commit

Permalink
[Silabs] Move Logging api to a common place (#26609)
Browse files Browse the repository at this point in the history
* Move Logging api to a common place

* fix 9116
  • Loading branch information
jepenven-silabs authored and pull[bot] committed Sep 6, 2023
1 parent b1e0680 commit aac6763
Show file tree
Hide file tree
Showing 31 changed files with 39 additions and 267 deletions.
19 changes: 1 addition & 18 deletions examples/chef/efr32/include/AppConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
*/

#pragma once
#include "silabs_utils.h"

// ---- Lighting Example App Config ----

Expand All @@ -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 <lib/core/CHIPError.h>
void appError(CHIP_ERROR error);
#endif
20 changes: 2 additions & 18 deletions examples/light-switch-app/silabs/SiWx917/include/AppConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@

#pragma once

#include "silabs_utils.h"

// ---- Lighting Example App Config ----

#define APP_TASK_NAME "Lit"
Expand All @@ -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 <lib/core/CHIPError.h>
void appError(CHIP_ERROR error);
#endif
20 changes: 2 additions & 18 deletions examples/light-switch-app/silabs/efr32/include/AppConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@

#pragma once

#include "silabs_utils.h"

// ---- Lighting Example App Config ----

#define APP_TASK_NAME "Lit"
Expand Down Expand Up @@ -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 <lib/core/CHIPError.h>
void appError(CHIP_ERROR error);
#endif
2 changes: 1 addition & 1 deletion examples/lighting-app/silabs/SiWx917/include/AppConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

#pragma once

#include "siwx917_utils.h"
#include "silabs_utils.h"

// ---- Lighting Example App Config ----

Expand Down
2 changes: 1 addition & 1 deletion examples/lighting-app/silabs/efr32/include/AppConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

#pragma once

#include "efr32_utils.h"
#include "silabs_utils.h"

// ---- Lighting Example App Config ----

Expand Down
20 changes: 2 additions & 18 deletions examples/lock-app/silabs/SiWx917/include/AppConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@

#pragma once

#include "silabs_utils.h"

// ---- Door lock Example App Config ----

#define APP_TASK_NAME "Lock"
Expand All @@ -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 <lib/core/CHIPError.h>
void appError(CHIP_ERROR error);
#endif
20 changes: 2 additions & 18 deletions examples/lock-app/silabs/efr32/include/AppConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@

#pragma once

#include "silabs_utils.h"

// ---- Door lock Example App Config ----

#define APP_TASK_NAME "Lock"
Expand Down Expand Up @@ -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 <lib/core/CHIPError.h>
void appError(CHIP_ERROR error);
#endif
2 changes: 1 addition & 1 deletion examples/platform/silabs/SiWx917/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion examples/platform/silabs/SiWx917/BaseApplication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
#include "SilabsDeviceDataProvider.h"
#include "rsi_board.h"
#include "rsi_chip.h"
#include "siwx917_utils.h"
#include "silabs_utils.h"
#include <app/server/OnboardingCodesUtil.h>
#include <app/server/Server.h>
#include <app/util/attribute-storage.h>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
2 changes: 0 additions & 2 deletions examples/platform/silabs/SiWx917/SiWx917/wfx_rsi.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand All @@ -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
}
Expand Down
36 changes: 0 additions & 36 deletions examples/platform/silabs/SiWx917/siwx917_utils.cpp

This file was deleted.

38 changes: 0 additions & 38 deletions examples/platform/silabs/SiWx917/siwx917_utils.h

This file was deleted.

2 changes: 1 addition & 1 deletion examples/platform/silabs/SiWx917/uart.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion examples/platform/silabs/SilabsDeviceDataProvider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

#ifdef SIWX917_USE_COMISSIONABLE_DATA
#include "DeviceConfig.h"
#include "siwx917_utils.h"
#include "silabs_utils.h"
#include <setup_payload/Base38Decode.h>
#include <setup_payload/QRCodeSetupPayloadGenerator.h>
#endif // SIWX917_USE_COMISSIONABLE_DATA
Expand Down
2 changes: 1 addition & 1 deletion examples/platform/silabs/efr32/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -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",
]
Expand Down
5 changes: 2 additions & 3 deletions examples/platform/silabs/efr32/rs911x/hal/efx_spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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");
}

/*****************************************************************************
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/*===================================================*/
Expand Down
2 changes: 2 additions & 0 deletions examples/platform/silabs/efr32/rs911x/rsi_if.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
#include "event_groups.h"
#include "task.h"

#include "silabs_utils.h"

#include "wfx_host_events.h"

#include "rsi_driver.h"
Expand Down
2 changes: 0 additions & 2 deletions examples/platform/silabs/efr32/rs911x/wfx_rsi.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand All @@ -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
}
Expand Down
Loading

0 comments on commit aac6763

Please sign in to comment.