Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Silabs]DIC refactor changes #27340

Merged
merged 32 commits into from
Aug 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
caee87f
DIC refactor changes
Thirsrin Jun 20, 2023
7b313b4
Restyled by clang-format
restyled-commits Jun 20, 2023
88bc107
Restyled by gn
restyled-commits Jun 20, 2023
11acd99
removed windows src changes in DIC refactor
Thirsrin Jun 21, 2023
e232f16
removed windows src changes in DIC refactor
Thirsrin Jun 21, 2023
cdabe43
Refactor changes for DIC
Thirsrin Jul 31, 2023
d4f2462
DIC changes for light app
Thirsrin Jul 31, 2023
cf7a367
Restyled by clang-format
restyled-commits Jul 31, 2023
b574e87
Restyled by gn
restyled-commits Jul 31, 2023
b5846cb
build gn file related changes for DIC
Thirsrin Jul 31, 2023
01d81bf
DIC BUILD gn changes for 917 soc
Thirsrin Jul 31, 2023
50895ab
917 soc dic changes
Thirsrin Aug 10, 2023
8c3be8a
Addressed review comments
Thirsrin Aug 11, 2023
12a1a86
Restyled by gn
restyled-commits Aug 11, 2023
b36a2de
DIC refactor changes
Thirsrin Jun 20, 2023
4a8d907
Restyled by clang-format
restyled-commits Jun 20, 2023
0be8f53
Restyled by gn
restyled-commits Jun 20, 2023
5a9b23f
removed windows src changes in DIC refactor
Thirsrin Jun 21, 2023
d31815e
removed windows src changes in DIC refactor
Thirsrin Jun 21, 2023
c667031
Refactor changes for DIC
Thirsrin Jul 31, 2023
473dcdf
DIC changes for light app
Thirsrin Jul 31, 2023
0f283b4
Restyled by clang-format
restyled-commits Jul 31, 2023
fe30de7
Restyled by gn
restyled-commits Jul 31, 2023
6a0e53e
build gn file related changes for DIC
Thirsrin Jul 31, 2023
0da360b
DIC BUILD gn changes for 917 soc
Thirsrin Jul 31, 2023
1a18069
917 soc dic changes
Thirsrin Aug 10, 2023
f78f7b8
Addressed review comments
Thirsrin Aug 11, 2023
7798bd8
Restyled by gn
restyled-commits Aug 11, 2023
ba6f07e
Merge branch 'feature/DIC_refactor_changes' of https://github.com/Thi…
KishorSilabs Aug 16, 2023
dabe97e
Added changes with respect to aws ota
KishorSilabs Aug 18, 2023
013a513
Restyled by gn
restyled-commits Aug 18, 2023
7d350f9
Added DIC AWS OTA Changes
KishorSilabs Aug 18, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions examples/lighting-app/silabs/src/ZclCallbacks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@
#include <app/ConcreteAttributePath.h>
#include <lib/support/logging/CHIPLogging.h>

#ifdef DIC_ENABLE
#include "dic.h"
#endif // DIC_ENABLE

using namespace ::chip;
using namespace ::chip::app::Clusters;

Expand All @@ -40,6 +44,9 @@ void MatterPostAttributeChangeCallback(const chip::app::ConcreteAttributePath &

if (clusterId == OnOff::Id && attributeId == OnOff::Attributes::OnOff::Id)
{
#ifdef DIC_ENABLE
dic_sendmsg("light/state", (const char *) (value ? (*value ? "on" : "off") : "invalid"));
#endif // DIC_ENABLE
LightMgr().InitiateAction(AppEvent::kEventType_Light, *value ? LightingManager::ON_ACTION : LightingManager::OFF_ACTION);
}
else if (clusterId == LevelControl::Id)
Expand Down
7 changes: 7 additions & 0 deletions examples/lock-app/silabs/src/ZclCallbacks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@
#include <lib/core/DataModelTypes.h>
#include <lib/support/logging/CHIPLogging.h>

#ifdef DIC_ENABLE
#include "dic.h"
#endif // DIC_ENABLE

using namespace ::chip::app::Clusters;
using namespace ::chip::DeviceLayer::Internal;
using ::chip::app::DataModel::Nullable;
Expand All @@ -47,6 +51,9 @@ void MatterPostAttributeChangeCallback(const chip::app::ConcreteAttributePath &
DoorLock::DlLockState lockState = *(reinterpret_cast<DoorLock::DlLockState *>(value));
ChipLogProgress(Zcl, "Door lock cluster: " ChipLogFormatMEI " state %d", ChipLogValueMEI(clusterId),
to_underlying(lockState));
#ifdef DIC_ENABLE
dic_sendmsg("lock/state", (const char *) (lockState == DoorLock::DlLockState::kLocked ? "lock" : "unlock"));
#endif // DIC_ENABLE
}
}

Expand Down
25 changes: 25 additions & 0 deletions examples/platform/silabs/BaseApplication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@
#include <platform/silabs/NetworkCommissioningWiFiDriver.h>
#endif // SL_WIFI

#ifdef DIC_ENABLE
#include "dic.h"
#include "dic_control.h"
#endif // DIC_ENABLE

/**********************************************************
* Defines and Constants
*********************************************************/
Expand Down Expand Up @@ -140,6 +145,22 @@ Identify gIdentify = {
#endif // EMBER_AF_PLUGIN_IDENTIFY_SERVER
} // namespace

#ifdef DIC_ENABLE
namespace {
void AppSpecificConnectivityEventCallback(const ChipDeviceEvent * event, intptr_t arg)
{
SILABS_LOG("AppSpecificConnectivityEventCallback: call back for IPV4");
if ((event->Type == DeviceEventType::kInternetConnectivityChange) &&
(event->InternetConnectivityChange.IPv4 == kConnectivity_Established))
{
SILABS_LOG("Got IPv4 Address! Starting DIC module\n");
if (DIC_OK != dic_init(dic::control::subscribeCB))
SILABS_LOG("Failed to initialize DIC module\n");
}
}
} // namespace
#endif // DIC_ENABLE

/**********************************************************
* AppTask Definitions
*********************************************************/
Expand Down Expand Up @@ -220,6 +241,10 @@ CHIP_ERROR BaseApplication::Init()
sStatusLED.Init(SYSTEM_STATE_LED);
#endif // ENABLE_WSTK_LEDS

#ifdef DIC_ENABLE
chip::DeviceLayer::PlatformMgr().AddEventHandler(AppSpecificConnectivityEventCallback, reinterpret_cast<intptr_t>(nullptr));
#endif // DIC_ENABLE

ConfigurationMgr().LogDeviceConfig();

OutputQrCode(true /*refreshLCD at init*/);
Expand Down
2 changes: 1 addition & 1 deletion examples/platform/silabs/FreeRTOSConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ See http://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html. */
#ifndef configTOTAL_HEAP_SIZE
#ifdef SL_WIFI
#ifdef DIC_ENABLE
#define configTOTAL_HEAP_SIZE ((size_t)(56 * 1024))
#define configTOTAL_HEAP_SIZE ((size_t)(68 * 1024))
#else
#define configTOTAL_HEAP_SIZE ((size_t)(34 * 1024))
#endif // DIC
Expand Down
40 changes: 13 additions & 27 deletions examples/platform/silabs/SiWx917/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -83,33 +83,6 @@ config("chip_examples_project_config") {
]
}

if (enable_dic) {
config("efr32_dic_config") {
include_dirs = [
"${chip_root}/third_party/silabs/mqtt/stack",
"${chip_root}/third_party/silabs/mqtt/mqtt_transport_interface/include",
"${chip_root}/examples/platform/silabs/DIC/matter_abs_interface/include",
]
}

source_set("efr32-dic") {
sources = [
"${chip_root}/examples/platform/silabs/DIC/matter_abs_interface/src/dic.c",
"${chip_root}/third_party/silabs/mqtt/mqtt_transport_interface/src/MQTT_transport.c",
"${chip_root}/third_party/silabs/mqtt/mqtt_transport_interface/src/altcp.c",
"${chip_root}/third_party/silabs/mqtt/mqtt_transport_interface/src/altcp_alloc.c",
"${chip_root}/third_party/silabs/mqtt/mqtt_transport_interface/src/altcp_tcp.c",
"${chip_root}/third_party/silabs/mqtt/mqtt_transport_interface/src/altcp_tls_mbedtls.c",
"${chip_root}/third_party/silabs/mqtt/mqtt_transport_interface/src/altcp_tls_mbedtls_mem.c",
]
public_deps = [
"${chip_root}/src/inet",
"${chip_root}/src/lwip",
]
public_configs = [ ":efr32_dic_config" ]
}
}

source_set("siwx917-matter-shell") {
if (chip_build_libshell) {
defines = [ "ENABLE_CHIP_SHELL" ]
Expand Down Expand Up @@ -293,6 +266,19 @@ source_set("siwx917-common") {
deps += [ ":siwx917-matter-shell" ]
}

# DIC
if (enable_dic) {
public_deps +=
[ "${silabs_common_plat_dir}/DIC/matter_abs_interface:silabs-dic" ]
}

# AWS SDK OTA
if (aws_sdk_ota) {
public_deps += [
"${silabs_common_plat_dir}/DIC/matter_abs_interface:silabs-aws-sdk-ota",
]
}

# Attestation Credentials
if (chip_build_platform_attestation_credentials_provider) {
deps += [ ":siwx917-attestation-credentials" ]
Expand Down
39 changes: 10 additions & 29 deletions examples/platform/silabs/efr32/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -97,33 +97,6 @@ config("chip_examples_project_config") {
]
}

if (enable_dic) {
config("efr32_dic_config") {
include_dirs = [
"${chip_root}/third_party/silabs/mqtt/stack",
"${chip_root}/third_party/silabs/mqtt/mqtt_transport_interface/include",
"${chip_root}/examples/platform/silabs/DIC/matter_abs_interface/include",
]
}

source_set("efr32-dic") {
sources = [
"${chip_root}/examples/platform/silabs/DIC/matter_abs_interface/src/dic.c",
"${chip_root}/third_party/silabs/mqtt/mqtt_transport_interface/src/MQTT_transport.c",
"${chip_root}/third_party/silabs/mqtt/mqtt_transport_interface/src/altcp.c",
"${chip_root}/third_party/silabs/mqtt/mqtt_transport_interface/src/altcp_alloc.c",
"${chip_root}/third_party/silabs/mqtt/mqtt_transport_interface/src/altcp_tcp.c",
"${chip_root}/third_party/silabs/mqtt/mqtt_transport_interface/src/altcp_tls_mbedtls.c",
"${chip_root}/third_party/silabs/mqtt/mqtt_transport_interface/src/altcp_tls_mbedtls_mem.c",
]
public_deps = [
"${chip_root}/src/inet",
"${chip_root}/src/lwip",
]
public_configs = [ ":efr32_dic_config" ]
}
}

source_set("openthread_core_config_efr32_chip_examples") {
if (chip_enable_openthread) {
sources = [ "project_include/OpenThreadConfig.h" ]
Expand Down Expand Up @@ -259,9 +232,17 @@ source_set("efr32-common") {
"${efr32_sdk_build_root}:silabs_config",
]

# MQTT
# DIC
if (enable_dic) {
deps += [ "${examples_plat_dir}:efr32-dic" ]
public_deps +=
[ "${silabs_common_plat_dir}/DIC/matter_abs_interface:silabs-dic" ]
}

# AWS SDK OTA
if (aws_sdk_ota) {
public_deps += [
"${silabs_common_plat_dir}/DIC/matter_abs_interface:silabs-aws-sdk-ota",
]
}

include_dirs = [ "." ]
Expand Down
7 changes: 4 additions & 3 deletions src/lwip/silabs/lwipopts-wf200.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,13 @@
#define DNS_RAND_TXID() ((u32_t) rand())
#define MEM_SIZE 5632
#define MEMP_NUM_UDP_PCB (6)
#define TCP_MSS (4 * 1152)
#define TCPIP_THREAD_PRIO (3)
#else
#define LWIP_DNS 0
#define MEMP_NUM_UDP_PCB (5)
#define TCP_MSS (1152)
#define TCPIP_THREAD_PRIO (2)
#endif // DIC_ENABLE

#define LWIP_FREERTOS_USE_STATIC_TCPIP_TASK 1
Expand Down Expand Up @@ -131,7 +135,6 @@
#define PBUF_CUSTOM_POOL_IDX_START (MEMP_PBUF_POOL_SMALL)
#define PBUF_CUSTOM_POOL_IDX_END (MEMP_PBUF_POOL_LARGE)

#define TCP_MSS (1152)
#define TCP_SND_BUF (2 * TCP_MSS)
#define TCP_LISTEN_BACKLOG (1)

Expand All @@ -141,8 +144,6 @@

#define TCPIP_THREAD_STACKSIZE (2048)

#define TCPIP_THREAD_PRIO (2)

#define NETIF_MAX_HWADDR_LEN 8U

#define LWIP_IPV6_NUM_ADDRESSES 5
Expand Down
3 changes: 3 additions & 0 deletions third_party/silabs/efr32_sdk.gni
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,9 @@ template("efr32_sdk") {
assert(chip_enable_wifi_ipv4, "enable chip_enable_wifi_ipv4")
defines += [ "DIC_ENABLE=1" ]
}
if (aws_sdk_ota) {
defines += [ "ENABLE_AWS_OTA_FEAT=1" ]
}
if (chip_enable_wifi_ipv4) {
defines += [ "CHIP_DEVICE_CONFIG_ENABLE_IPV4=1" ]
}
Expand Down
3 changes: 3 additions & 0 deletions third_party/silabs/silabs_board.gni
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ declare_args() {
#Disable MQTT by default
enable_dic = false

# Disable AWS SDK OTA by default
aws_sdk_ota = false

# Disable UART log forwarding by default
sl_uart_log_output = false
}
Expand Down