Skip to content

Commit

Permalink
[Silbas] Remove AppConfig header from Silabs Platform (#33348)
Browse files Browse the repository at this point in the history
* remove app config header from the platform

* replace SILABS_LOG with ChipLogProgress

* Fix log
  • Loading branch information
mkardous-silabs authored May 9, 2024
1 parent d653df1 commit d1d0d2b
Show file tree
Hide file tree
Showing 11 changed files with 84 additions and 106 deletions.
1 change: 0 additions & 1 deletion src/platform/silabs/DiagnosticDataProviderImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
#if CHIP_DEVICE_CONFIG_ENABLE_THREAD
#include <platform/OpenThread/GenericThreadStackManagerImpl_OpenThread.h>
#endif
#include "AppConfig.h"
#include "FreeRTOS.h"
#include "heap_4_silabs.h"
#include <inet/InetInterface.h>
Expand Down
2 changes: 0 additions & 2 deletions src/platform/silabs/PlatformManagerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@
#include <lwip/tcpip.h>
#endif // CHIP_SYSTEM_CONFIG_USE_LWIP

#include "AppConfig.h"

using namespace chip::DeviceLayer::Internal;

namespace chip {
Expand Down
15 changes: 8 additions & 7 deletions src/platform/silabs/SiWx917/wifi/dhcp_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,11 @@
#include "wfx_host_events.h"
#include "wifi_config.h"

#include "AppConfig.h"
#include "FreeRTOS.h"
#include "event_groups.h"

#include <lib/support/logging/CHIPLogging.h>

#define MAX_DHCP_TRIES (4)
#define NETIF_IPV4_ADDRESS(X, Y) (((X) >> (8 * Y)) & 0xFF)

Expand Down Expand Up @@ -62,7 +63,7 @@ void dhcpclient_set_link_state(int link_up)
if (link_up)
{
dhcp_state = DHCP_START;
SILABS_LOG("DHCP: Starting");
ChipLogProgress(DeviceLayer, "DHCP: Starting");
}
else
{
Expand All @@ -88,7 +89,7 @@ uint8_t dhcpclient_poll(void * arg)
switch (dhcp_state)
{
case DHCP_START:
SILABS_LOG("DHCP: Wait addr");
ChipLogProgress(DeviceLayer, "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);
Expand All @@ -102,8 +103,8 @@ uint8_t dhcpclient_poll(void * arg)
dhcp_state = DHCP_ADDRESS_ASSIGNED;

uint64_t addr = netif->ip_addr.u_addr.ip4.addr;
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));
ChipLogProgress(DeviceLayer, "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
{
Expand All @@ -114,7 +115,7 @@ uint8_t dhcpclient_poll(void * arg)
{
dhcp_state = DHCP_TIMEOUT;

SILABS_LOG("*ERR*DHCP: Failed");
ChipLogProgress(DeviceLayer, "*ERR*DHCP: Failed");
/* Stop DHCP */
dhcp_stop(netif);

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

case DHCP_LINK_DOWN:
/* Stop DHCP */
SILABS_LOG("*ERR*DHCP Link down");
ChipLogProgress(DeviceLayer, "*ERR*DHCP Link down");
dhcp_stop(netif);
dhcp_state = DHCP_OFF;
break;
Expand Down
38 changes: 21 additions & 17 deletions src/platform/silabs/SiWx917/wifi/ethernetif.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ extern "C" {
#include "netif/etharp.h"
#include "silabs_utils.h"

#include <lib/support/logging/CHIPLogging.h>

StaticSemaphore_t xEthernetIfSemaBuffer;

/*****************************************************************************
Expand Down Expand Up @@ -130,13 +132,14 @@ 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
SILABS_LOG("%s: DROP, [%02x:%02x:%02x:%02x:%02x:%02x]<-[%02x:%02x:%02x:%02x:%02x:%02x] type=%02x%02x", __func__,
ChipLogProgress(DeviceLayer, "%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;
}
Expand All @@ -152,14 +155,15 @@ static void low_level_input(struct netif * netif, uint8_t * b, uint16_t len)
bufferoffset += q->len;
}
#ifdef WIFI_DEBUG_ENABLED
SILABS_LOG("%s: ACCEPT %d, [%02x:%02x:%02x:%02x:%02x:%02x]<-[%02x:%02x:%02x:%02x:%02x:%02x] type=%02x%02x", __func__,
bufferoffset,
ChipLogProgress(DeviceLayer,
"%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)
Expand Down Expand Up @@ -199,7 +203,7 @@ static err_t low_level_output(struct netif * netif, struct pbuf * p)
uint16_t datalength = 0;

#ifdef WIFI_DEBUG_ENABLED
SILABS_LOG("LWIP : low_level_output");
ChipLogProgress(DeviceLayer, "LWIP : low_level_output");
#endif
if (xSemaphoreTake(ethout_sem, portMAX_DELAY) != pdTRUE)
{
Expand All @@ -221,24 +225,24 @@ static err_t low_level_output(struct netif * netif, struct pbuf * p)
VERIFY_STATUS_AND_RETURN(status);
if (packet == NULL)
{
SILABS_LOG("EN-RSI:No buf");
ChipLogProgress(DeviceLayer, "EN-RSI:No buf");
xSemaphoreGive(ethout_sem);
return SL_STATUS_ALLOCATION_FAILED;
}
memset(packet->desc, 0, sizeof(packet->desc));
#ifdef WIFI_DEBUG_ENABLED
SILABS_LOG("EN-RSI: Output");
ChipLogProgress(DeviceLayer, "EN-RSI: Output");
#endif
if ((netif->flags & (NETIF_FLAG_LINK_UP | NETIF_FLAG_UP)) != (NETIF_FLAG_LINK_UP | NETIF_FLAG_UP))
{
SILABS_LOG("EN-RSI:NOT UP");
ChipLogProgress(DeviceLayer, "EN-RSI:NOT UP");
xSemaphoreGive(ethout_sem);
return ERR_IF;
}
#ifdef WIFI_DEBUG_ENABLED
uint8_t * b = (uint8_t *) p->payload;
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]);
ChipLogProgress(DeviceLayer, "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, datalength = 0; q != NULL; q = q->next)
Expand All @@ -252,13 +256,13 @@ static err_t low_level_output(struct netif * netif, struct pbuf * p)
wfx_rsi_pkt_add_data(packet, (uint8_t *) (p->payload), LWIP_FRAME_ALIGNMENT - datalength, datalength);
}
#ifdef WIFI_DEBUG_ENABLED
SILABS_LOG("EN-RSI: Sending %d", framelength);
ChipLogProgress(DeviceLayer, "EN-RSI: Sending %d", framelength);
#endif
packet->length = framelength & 0xFFF;
packet->command = RSI_SEND_RAW_DATA;
if (sl_si91x_driver_send_data_packet(SI91X_WLAN_CMD_QUEUE, buffer, 1000))
{
SILABS_LOG("*ERR*EN-RSI:Send fail");
ChipLogProgress(DeviceLayer, "*ERR*EN-RSI:Send fail");
xSemaphoreGive(ethout_sem);
return ERR_IF;
}
Expand Down
1 change: 0 additions & 1 deletion src/platform/silabs/SiWx917/wifi/lwip_netif.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
#include "wfx_host_events.h"
#include "wifi_config.h"

#include "AppConfig.h"
#include "dhcp_client.h"
#include "ethernetif.h"

Expand Down
26 changes: 9 additions & 17 deletions src/platform/silabs/SiWx917/wifi/wfx_notify.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
#include <stdlib.h>
#include <string.h>

#include "AppConfig.h"

#include "FreeRTOS.h"
#include "event_groups.h"
#include "silabs_utils.h"
Expand Down Expand Up @@ -49,6 +47,8 @@ extern "C" {
using namespace ::chip;
using namespace ::chip::DeviceLayer;

#include <lib/support/logging/CHIPLogging.h>

extern uint32_t retryInterval;
/*
* Notifications to the upper-layer
Expand All @@ -67,8 +67,6 @@ void wfx_started_notify()
sl_wfx_startup_ind_t evt;
sl_wfx_mac_address_t mac;

SILABS_LOG("%s: started.", __func__);

memset(&evt, 0, sizeof(evt));
evt.header.id = SL_WFX_STARTUP_IND_ID;
evt.header.length = sizeof evt;
Expand All @@ -92,15 +90,13 @@ void wfx_connected_notify(int32_t status, sl_wfx_mac_address_t * ap)
{
sl_wfx_connect_ind_t evt;

SILABS_LOG("%s: started.", __func__);

if (status != SUCCESS_STATUS)
{
SILABS_LOG("%s: error: failed status: %d.", __func__, status);
ChipLogProgress(DeviceLayer, "%s: error: failed status: %ld.", __func__, status);
return;
}

SILABS_LOG("%s: connected.", __func__);
ChipLogProgress(DeviceLayer, "%s: connected.", __func__);

memset(&evt, 0, sizeof(evt));
evt.header.id = SL_WFX_CONNECT_IND_ID;
Expand All @@ -125,8 +121,6 @@ void wfx_disconnected_notify(int32_t status)
{
sl_wfx_disconnect_ind_t evt;

SILABS_LOG("%s: started.", __func__);

memset(&evt, 0, sizeof(evt));
evt.header.id = SL_WFX_DISCONNECT_IND_ID;
evt.header.length = sizeof evt;
Expand All @@ -145,8 +139,6 @@ void wfx_ipv6_notify(int got_ip)
{
sl_wfx_generic_message_t eventData;

SILABS_LOG("%s: started.", __func__);

memset(&eventData, 0, sizeof(eventData));
eventData.header.id = got_ip ? IP_EVENT_GOT_IP6 : IP_EVENT_STA_LOST_IP;
eventData.header.length = sizeof(eventData.header);
Expand Down Expand Up @@ -174,8 +166,6 @@ void wfx_ip_changed_notify(int got_ip)
{
sl_wfx_generic_message_t eventData;

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;
eventData.header.length = sizeof(eventData.header);
Expand Down Expand Up @@ -208,7 +198,8 @@ void wfx_retry_interval_handler(bool is_wifi_disconnection_event, uint16_t retry
*/
if (retryJoin < MAX_JOIN_RETRIES_COUNT)
{
SILABS_LOG("wfx_retry_interval_handler : Next attempt after %d Seconds", CONVERT_MS_TO_SEC(WLAN_RETRY_TIMER_MS));
ChipLogProgress(DeviceLayer, "wfx_retry_interval_handler : Next attempt after %d Seconds",
CONVERT_MS_TO_SEC(WLAN_RETRY_TIMER_MS));
#if SL_ICD_ENABLED
// TODO: cleanup the retry logic MATTER-1921
if (!chip::Server::GetInstance().GetCommissioningWindowManager().IsCommissioningWindowOpen())
Expand All @@ -220,7 +211,7 @@ void wfx_retry_interval_handler(bool is_wifi_disconnection_event, uint16_t retry
}
else
{
SILABS_LOG("Connect failed after max %d tries", retryJoin);
ChipLogProgress(DeviceLayer, "Connect failed after max %d tries", retryJoin);
}
}
else
Expand All @@ -234,7 +225,8 @@ void wfx_retry_interval_handler(bool is_wifi_disconnection_event, uint16_t retry
{
retryInterval = WLAN_MAX_RETRY_TIMER_MS;
}
SILABS_LOG("wfx_retry_interval_handler : Next attempt after %d Seconds", CONVERT_MS_TO_SEC(retryInterval));
ChipLogProgress(DeviceLayer, "wfx_retry_interval_handler : Next attempt after %ld Seconds",
CONVERT_MS_TO_SEC(retryInterval));
#if SL_ICD_ENABLED
wfx_rsi_power_save(RSI_SLEEP_MODE_8, STANDBY_POWER_SAVE_WITH_RAM_RETENTION);
#endif // SL_ICD_ENABLED
Expand Down
15 changes: 8 additions & 7 deletions src/platform/silabs/efr32/wifi/dhcp_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,11 @@
#include "wfx_host_events.h"
#include "wifi_config.h"

#include "AppConfig.h"
#include "FreeRTOS.h"
#include "event_groups.h"

#include <lib/support/logging/CHIPLogging.h>

#define MAX_DHCP_TRIES 4
#define NETIF_IPV4_ADDRESS(X, Y) (((X) >> (8 * Y)) & 0xFF)

Expand Down Expand Up @@ -68,7 +69,7 @@ void dhcpclient_set_link_state(int link_up)
if (link_up)
{
dhcp_state = DHCP_START;
SILABS_LOG("DHCP: Starting");
ChipLogProgress(DeviceLayer, "DHCP: Starting");
}
else
{
Expand All @@ -94,7 +95,7 @@ uint8_t dhcpclient_poll(void * arg)
switch (dhcp_state)
{
case DHCP_START:
SILABS_LOG("DHCP: Wait addr");
ChipLogProgress(DeviceLayer, "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);
Expand All @@ -108,8 +109,8 @@ uint8_t dhcpclient_poll(void * arg)
dhcp_state = DHCP_ADDRESS_ASSIGNED;

uint64_t addr = netif->ip_addr.u_addr.ip4.addr;
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));
ChipLogProgress(DeviceLayer, "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
{
Expand All @@ -120,7 +121,7 @@ uint8_t dhcpclient_poll(void * arg)
{
dhcp_state = DHCP_TIMEOUT;

SILABS_LOG("*ERR*DHCP: Failed");
ChipLogProgress(DeviceLayer, "*ERR*DHCP: Failed");
/* Stop DHCP */
dhcp_stop(netif);

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

case DHCP_LINK_DOWN:
/* Stop DHCP */
SILABS_LOG("*ERR*DHCP Link down");
ChipLogProgress(DeviceLayer, "*ERR*DHCP Link down");
dhcp_stop(netif);
dhcp_state = DHCP_OFF;
break;
Expand Down
Loading

0 comments on commit d1d0d2b

Please sign in to comment.