Skip to content

Commit d1d0d2b

Browse files
[Silbas] Remove AppConfig header from Silabs Platform (#33348)
* remove app config header from the platform * replace SILABS_LOG with ChipLogProgress * Fix log
1 parent d653df1 commit d1d0d2b

11 files changed

+84
-106
lines changed

src/platform/silabs/DiagnosticDataProviderImpl.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
#if CHIP_DEVICE_CONFIG_ENABLE_THREAD
2929
#include <platform/OpenThread/GenericThreadStackManagerImpl_OpenThread.h>
3030
#endif
31-
#include "AppConfig.h"
3231
#include "FreeRTOS.h"
3332
#include "heap_4_silabs.h"
3433
#include <inet/InetInterface.h>

src/platform/silabs/PlatformManagerImpl.cpp

-2
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,6 @@
3939
#include <lwip/tcpip.h>
4040
#endif // CHIP_SYSTEM_CONFIG_USE_LWIP
4141

42-
#include "AppConfig.h"
43-
4442
using namespace chip::DeviceLayer::Internal;
4543

4644
namespace chip {

src/platform/silabs/SiWx917/wifi/dhcp_client.cpp

+8-7
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,11 @@
2626
#include "wfx_host_events.h"
2727
#include "wifi_config.h"
2828

29-
#include "AppConfig.h"
3029
#include "FreeRTOS.h"
3130
#include "event_groups.h"
3231

32+
#include <lib/support/logging/CHIPLogging.h>
33+
3334
#define MAX_DHCP_TRIES (4)
3435
#define NETIF_IPV4_ADDRESS(X, Y) (((X) >> (8 * Y)) & 0xFF)
3536

@@ -62,7 +63,7 @@ void dhcpclient_set_link_state(int link_up)
6263
if (link_up)
6364
{
6465
dhcp_state = DHCP_START;
65-
SILABS_LOG("DHCP: Starting");
66+
ChipLogProgress(DeviceLayer, "DHCP: Starting");
6667
}
6768
else
6869
{
@@ -88,7 +89,7 @@ uint8_t dhcpclient_poll(void * arg)
8889
switch (dhcp_state)
8990
{
9091
case DHCP_START:
91-
SILABS_LOG("DHCP: Wait addr");
92+
ChipLogProgress(DeviceLayer, "DHCP: Wait addr");
9293
ip_addr_set_zero_ip4(&netif->ip_addr);
9394
ip_addr_set_zero_ip4(&netif->netmask);
9495
ip_addr_set_zero_ip4(&netif->gw);
@@ -102,8 +103,8 @@ uint8_t dhcpclient_poll(void * arg)
102103
dhcp_state = DHCP_ADDRESS_ASSIGNED;
103104

104105
uint64_t addr = netif->ip_addr.u_addr.ip4.addr;
105-
SILABS_LOG("DHCP IP: %d.%d.%d.%d", NETIF_IPV4_ADDRESS(addr, 0), NETIF_IPV4_ADDRESS(addr, 1),
106-
NETIF_IPV4_ADDRESS(addr, 2), NETIF_IPV4_ADDRESS(addr, 3));
106+
ChipLogProgress(DeviceLayer, "DHCP IP: %d.%d.%d.%d", NETIF_IPV4_ADDRESS(addr, 0), NETIF_IPV4_ADDRESS(addr, 1),
107+
NETIF_IPV4_ADDRESS(addr, 2), NETIF_IPV4_ADDRESS(addr, 3));
107108
}
108109
else
109110
{
@@ -114,7 +115,7 @@ uint8_t dhcpclient_poll(void * arg)
114115
{
115116
dhcp_state = DHCP_TIMEOUT;
116117

117-
SILABS_LOG("*ERR*DHCP: Failed");
118+
ChipLogProgress(DeviceLayer, "*ERR*DHCP: Failed");
118119
/* Stop DHCP */
119120
dhcp_stop(netif);
120121

@@ -130,7 +131,7 @@ uint8_t dhcpclient_poll(void * arg)
130131

131132
case DHCP_LINK_DOWN:
132133
/* Stop DHCP */
133-
SILABS_LOG("*ERR*DHCP Link down");
134+
ChipLogProgress(DeviceLayer, "*ERR*DHCP Link down");
134135
dhcp_stop(netif);
135136
dhcp_state = DHCP_OFF;
136137
break;

src/platform/silabs/SiWx917/wifi/ethernetif.cpp

+21-17
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ extern "C" {
4545
#include "netif/etharp.h"
4646
#include "silabs_utils.h"
4747

48+
#include <lib/support/logging/CHIPLogging.h>
49+
4850
StaticSemaphore_t xEthernetIfSemaBuffer;
4951

5052
/*****************************************************************************
@@ -130,13 +132,14 @@ static void low_level_input(struct netif * netif, uint8_t * b, uint16_t len)
130132
(memcmp(netif->hwaddr, dst_mac, netif->hwaddr_len) != 0))
131133
{
132134
#ifdef WIFI_DEBUG_ENABLED
133-
SILABS_LOG("%s: DROP, [%02x:%02x:%02x:%02x:%02x:%02x]<-[%02x:%02x:%02x:%02x:%02x:%02x] type=%02x%02x", __func__,
135+
ChipLogProgress(DeviceLayer, "%s: DROP, [%02x:%02x:%02x:%02x:%02x:%02x]<-[%02x:%02x:%02x:%02x:%02x:%02x] type=%02x%02x",
136+
__func__,
134137

135-
dst_mac[0], dst_mac[1], dst_mac[2], dst_mac[3], dst_mac[4], dst_mac[5],
138+
dst_mac[0], dst_mac[1], dst_mac[2], dst_mac[3], dst_mac[4], dst_mac[5],
136139

137-
src_mac[0], src_mac[1], src_mac[2], src_mac[3], src_mac[4], src_mac[5],
140+
src_mac[0], src_mac[1], src_mac[2], src_mac[3], src_mac[4], src_mac[5],
138141

139-
b[12], b[13]);
142+
b[12], b[13]);
140143
#endif
141144
return;
142145
}
@@ -152,14 +155,15 @@ static void low_level_input(struct netif * netif, uint8_t * b, uint16_t len)
152155
bufferoffset += q->len;
153156
}
154157
#ifdef WIFI_DEBUG_ENABLED
155-
SILABS_LOG("%s: ACCEPT %d, [%02x:%02x:%02x:%02x:%02x:%02x]<-[%02x:%02x:%02x:%02x:%02x:%02x] type=%02x%02x", __func__,
156-
bufferoffset,
158+
ChipLogProgress(DeviceLayer,
159+
"%s: ACCEPT %d, [%02x:%02x:%02x:%02x:%02x:%02x]<-[%02x:%02x:%02x:%02x:%02x:%02x] type=%02x%02x", __func__,
160+
bufferoffset,
157161

158-
dst_mac[0], dst_mac[1], dst_mac[2], dst_mac[3], dst_mac[4], dst_mac[5],
162+
dst_mac[0], dst_mac[1], dst_mac[2], dst_mac[3], dst_mac[4], dst_mac[5],
159163

160-
src_mac[0], src_mac[1], src_mac[2], src_mac[3], src_mac[4], src_mac[5],
164+
src_mac[0], src_mac[1], src_mac[2], src_mac[3], src_mac[4], src_mac[5],
161165

162-
b[12], b[13]);
166+
b[12], b[13]);
163167
#endif
164168

165169
if (netif->input(p, netif) != ERR_OK)
@@ -199,7 +203,7 @@ static err_t low_level_output(struct netif * netif, struct pbuf * p)
199203
uint16_t datalength = 0;
200204

201205
#ifdef WIFI_DEBUG_ENABLED
202-
SILABS_LOG("LWIP : low_level_output");
206+
ChipLogProgress(DeviceLayer, "LWIP : low_level_output");
203207
#endif
204208
if (xSemaphoreTake(ethout_sem, portMAX_DELAY) != pdTRUE)
205209
{
@@ -221,24 +225,24 @@ static err_t low_level_output(struct netif * netif, struct pbuf * p)
221225
VERIFY_STATUS_AND_RETURN(status);
222226
if (packet == NULL)
223227
{
224-
SILABS_LOG("EN-RSI:No buf");
228+
ChipLogProgress(DeviceLayer, "EN-RSI:No buf");
225229
xSemaphoreGive(ethout_sem);
226230
return SL_STATUS_ALLOCATION_FAILED;
227231
}
228232
memset(packet->desc, 0, sizeof(packet->desc));
229233
#ifdef WIFI_DEBUG_ENABLED
230-
SILABS_LOG("EN-RSI: Output");
234+
ChipLogProgress(DeviceLayer, "EN-RSI: Output");
231235
#endif
232236
if ((netif->flags & (NETIF_FLAG_LINK_UP | NETIF_FLAG_UP)) != (NETIF_FLAG_LINK_UP | NETIF_FLAG_UP))
233237
{
234-
SILABS_LOG("EN-RSI:NOT UP");
238+
ChipLogProgress(DeviceLayer, "EN-RSI:NOT UP");
235239
xSemaphoreGive(ethout_sem);
236240
return ERR_IF;
237241
}
238242
#ifdef WIFI_DEBUG_ENABLED
239243
uint8_t * b = (uint8_t *) p->payload;
240-
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],
241-
b[4], b[5], b[6], b[7], b[8], b[9], b[10], b[11], b[12], b[13]);
244+
ChipLogProgress(DeviceLayer, "EN-RSI: Out [%02x:%02x:%02x:%02x:%02x:%02x][%02x:%02x:%02x:%02x:%02x:%02x]type=%02x%02x", b[0],
245+
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]);
242246
#endif
243247
/* Generate the packet */
244248
for (q = p, datalength = 0; q != NULL; q = q->next)
@@ -252,13 +256,13 @@ static err_t low_level_output(struct netif * netif, struct pbuf * p)
252256
wfx_rsi_pkt_add_data(packet, (uint8_t *) (p->payload), LWIP_FRAME_ALIGNMENT - datalength, datalength);
253257
}
254258
#ifdef WIFI_DEBUG_ENABLED
255-
SILABS_LOG("EN-RSI: Sending %d", framelength);
259+
ChipLogProgress(DeviceLayer, "EN-RSI: Sending %d", framelength);
256260
#endif
257261
packet->length = framelength & 0xFFF;
258262
packet->command = RSI_SEND_RAW_DATA;
259263
if (sl_si91x_driver_send_data_packet(SI91X_WLAN_CMD_QUEUE, buffer, 1000))
260264
{
261-
SILABS_LOG("*ERR*EN-RSI:Send fail");
265+
ChipLogProgress(DeviceLayer, "*ERR*EN-RSI:Send fail");
262266
xSemaphoreGive(ethout_sem);
263267
return ERR_IF;
264268
}

src/platform/silabs/SiWx917/wifi/lwip_netif.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
#include "wfx_host_events.h"
2323
#include "wifi_config.h"
2424

25-
#include "AppConfig.h"
2625
#include "dhcp_client.h"
2726
#include "ethernetif.h"
2827

src/platform/silabs/SiWx917/wifi/wfx_notify.cpp

+9-17
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@
1919
#include <stdlib.h>
2020
#include <string.h>
2121

22-
#include "AppConfig.h"
23-
2422
#include "FreeRTOS.h"
2523
#include "event_groups.h"
2624
#include "silabs_utils.h"
@@ -49,6 +47,8 @@ extern "C" {
4947
using namespace ::chip;
5048
using namespace ::chip::DeviceLayer;
5149

50+
#include <lib/support/logging/CHIPLogging.h>
51+
5252
extern uint32_t retryInterval;
5353
/*
5454
* Notifications to the upper-layer
@@ -67,8 +67,6 @@ void wfx_started_notify()
6767
sl_wfx_startup_ind_t evt;
6868
sl_wfx_mac_address_t mac;
6969

70-
SILABS_LOG("%s: started.", __func__);
71-
7270
memset(&evt, 0, sizeof(evt));
7371
evt.header.id = SL_WFX_STARTUP_IND_ID;
7472
evt.header.length = sizeof evt;
@@ -92,15 +90,13 @@ void wfx_connected_notify(int32_t status, sl_wfx_mac_address_t * ap)
9290
{
9391
sl_wfx_connect_ind_t evt;
9492

95-
SILABS_LOG("%s: started.", __func__);
96-
9793
if (status != SUCCESS_STATUS)
9894
{
99-
SILABS_LOG("%s: error: failed status: %d.", __func__, status);
95+
ChipLogProgress(DeviceLayer, "%s: error: failed status: %ld.", __func__, status);
10096
return;
10197
}
10298

103-
SILABS_LOG("%s: connected.", __func__);
99+
ChipLogProgress(DeviceLayer, "%s: connected.", __func__);
104100

105101
memset(&evt, 0, sizeof(evt));
106102
evt.header.id = SL_WFX_CONNECT_IND_ID;
@@ -125,8 +121,6 @@ void wfx_disconnected_notify(int32_t status)
125121
{
126122
sl_wfx_disconnect_ind_t evt;
127123

128-
SILABS_LOG("%s: started.", __func__);
129-
130124
memset(&evt, 0, sizeof(evt));
131125
evt.header.id = SL_WFX_DISCONNECT_IND_ID;
132126
evt.header.length = sizeof evt;
@@ -145,8 +139,6 @@ void wfx_ipv6_notify(int got_ip)
145139
{
146140
sl_wfx_generic_message_t eventData;
147141

148-
SILABS_LOG("%s: started.", __func__);
149-
150142
memset(&eventData, 0, sizeof(eventData));
151143
eventData.header.id = got_ip ? IP_EVENT_GOT_IP6 : IP_EVENT_STA_LOST_IP;
152144
eventData.header.length = sizeof(eventData.header);
@@ -174,8 +166,6 @@ void wfx_ip_changed_notify(int got_ip)
174166
{
175167
sl_wfx_generic_message_t eventData;
176168

177-
SILABS_LOG("%s: started.", __func__);
178-
179169
memset(&eventData, 0, sizeof(eventData));
180170
eventData.header.id = got_ip ? IP_EVENT_STA_GOT_IP : IP_EVENT_STA_LOST_IP;
181171
eventData.header.length = sizeof(eventData.header);
@@ -208,7 +198,8 @@ void wfx_retry_interval_handler(bool is_wifi_disconnection_event, uint16_t retry
208198
*/
209199
if (retryJoin < MAX_JOIN_RETRIES_COUNT)
210200
{
211-
SILABS_LOG("wfx_retry_interval_handler : Next attempt after %d Seconds", CONVERT_MS_TO_SEC(WLAN_RETRY_TIMER_MS));
201+
ChipLogProgress(DeviceLayer, "wfx_retry_interval_handler : Next attempt after %d Seconds",
202+
CONVERT_MS_TO_SEC(WLAN_RETRY_TIMER_MS));
212203
#if SL_ICD_ENABLED
213204
// TODO: cleanup the retry logic MATTER-1921
214205
if (!chip::Server::GetInstance().GetCommissioningWindowManager().IsCommissioningWindowOpen())
@@ -220,7 +211,7 @@ void wfx_retry_interval_handler(bool is_wifi_disconnection_event, uint16_t retry
220211
}
221212
else
222213
{
223-
SILABS_LOG("Connect failed after max %d tries", retryJoin);
214+
ChipLogProgress(DeviceLayer, "Connect failed after max %d tries", retryJoin);
224215
}
225216
}
226217
else
@@ -234,7 +225,8 @@ void wfx_retry_interval_handler(bool is_wifi_disconnection_event, uint16_t retry
234225
{
235226
retryInterval = WLAN_MAX_RETRY_TIMER_MS;
236227
}
237-
SILABS_LOG("wfx_retry_interval_handler : Next attempt after %d Seconds", CONVERT_MS_TO_SEC(retryInterval));
228+
ChipLogProgress(DeviceLayer, "wfx_retry_interval_handler : Next attempt after %ld Seconds",
229+
CONVERT_MS_TO_SEC(retryInterval));
238230
#if SL_ICD_ENABLED
239231
wfx_rsi_power_save(RSI_SLEEP_MODE_8, STANDBY_POWER_SAVE_WITH_RAM_RETENTION);
240232
#endif // SL_ICD_ENABLED

src/platform/silabs/efr32/wifi/dhcp_client.cpp

+8-7
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,11 @@
3232
#include "wfx_host_events.h"
3333
#include "wifi_config.h"
3434

35-
#include "AppConfig.h"
3635
#include "FreeRTOS.h"
3736
#include "event_groups.h"
3837

38+
#include <lib/support/logging/CHIPLogging.h>
39+
3940
#define MAX_DHCP_TRIES 4
4041
#define NETIF_IPV4_ADDRESS(X, Y) (((X) >> (8 * Y)) & 0xFF)
4142

@@ -68,7 +69,7 @@ void dhcpclient_set_link_state(int link_up)
6869
if (link_up)
6970
{
7071
dhcp_state = DHCP_START;
71-
SILABS_LOG("DHCP: Starting");
72+
ChipLogProgress(DeviceLayer, "DHCP: Starting");
7273
}
7374
else
7475
{
@@ -94,7 +95,7 @@ uint8_t dhcpclient_poll(void * arg)
9495
switch (dhcp_state)
9596
{
9697
case DHCP_START:
97-
SILABS_LOG("DHCP: Wait addr");
98+
ChipLogProgress(DeviceLayer, "DHCP: Wait addr");
9899
ip_addr_set_zero_ip4(&netif->ip_addr);
99100
ip_addr_set_zero_ip4(&netif->netmask);
100101
ip_addr_set_zero_ip4(&netif->gw);
@@ -108,8 +109,8 @@ uint8_t dhcpclient_poll(void * arg)
108109
dhcp_state = DHCP_ADDRESS_ASSIGNED;
109110

110111
uint64_t addr = netif->ip_addr.u_addr.ip4.addr;
111-
SILABS_LOG("DHCP IP: %d.%d.%d.%d", NETIF_IPV4_ADDRESS(addr, 0), NETIF_IPV4_ADDRESS(addr, 1),
112-
NETIF_IPV4_ADDRESS(addr, 2), NETIF_IPV4_ADDRESS(addr, 3));
112+
ChipLogProgress(DeviceLayer, "DHCP IP: %d.%d.%d.%d", NETIF_IPV4_ADDRESS(addr, 0), NETIF_IPV4_ADDRESS(addr, 1),
113+
NETIF_IPV4_ADDRESS(addr, 2), NETIF_IPV4_ADDRESS(addr, 3));
113114
}
114115
else
115116
{
@@ -120,7 +121,7 @@ uint8_t dhcpclient_poll(void * arg)
120121
{
121122
dhcp_state = DHCP_TIMEOUT;
122123

123-
SILABS_LOG("*ERR*DHCP: Failed");
124+
ChipLogProgress(DeviceLayer, "*ERR*DHCP: Failed");
124125
/* Stop DHCP */
125126
dhcp_stop(netif);
126127

@@ -136,7 +137,7 @@ uint8_t dhcpclient_poll(void * arg)
136137

137138
case DHCP_LINK_DOWN:
138139
/* Stop DHCP */
139-
SILABS_LOG("*ERR*DHCP Link down");
140+
ChipLogProgress(DeviceLayer, "*ERR*DHCP Link down");
140141
dhcp_stop(netif);
141142
dhcp_state = DHCP_OFF;
142143
break;

0 commit comments

Comments
 (0)