Skip to content

Commit

Permalink
Pull request project-chip#1535: [Silabs] Add CSL support to silabs pl…
Browse files Browse the repository at this point in the history
…atform

Merge in WMN_TOOLS/matter from feature/csl_support to RC_2.3.0-1.3

Squashed commit of the following:

commit bc76db8a38e982896726ef5ad66aed99d82bcbb4
Author: Mathieu Kardous <[email protected]>
Date:   Fri Feb 2 13:27:42 2024 -0500

    Update incorrect config

commit dbef02ca678e1f34eeb4552f6bfd1d7da1c69450
Author: mkardous-silabs <[email protected]>
Date:   Fri Feb 2 08:53:10 2024 -0500

    [Silabs] Add CSL support to silabs platform (project-chip#31838)

    * Add CSL support for Silabs platform

    * Clean up CSL support

    * enable ssed ICD on window-app by default

    * remove --ssed build flag

    * restyle

    * Enable ICDM cluster
  • Loading branch information
mkardous-silabs committed Feb 2, 2024
1 parent 135dab9 commit 93a805c
Show file tree
Hide file tree
Showing 10 changed files with 308 additions and 44 deletions.
7 changes: 1 addition & 6 deletions examples/light-switch-app/silabs/src/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,29 +25,24 @@
#include "AppConfig.h"
#include "AppEvent.h"
#include "BindingHandler.h"

#include "LEDWidget.h"

#include "LightSwitchMgr.h"

#ifdef DISPLAY_ENABLED
#include "lcd.h"
#ifdef QR_CODE_ENABLED
#include "qrcodegen.h"
#endif // QR_CODE_ENABLED
#endif // DISPLAY_ENABLED

#include <app/server/OnboardingCodesUtil.h>
#include <app/server/Server.h>
#include <app/util/attribute-storage.h>
#include <assert.h>
#include <lib/support/CodeUtils.h>
#include <platform/CHIPDeviceLayer.h>
#include <platform/silabs/platformAbstraction/SilabsPlatform.h>
#include <setup_payload/QRCodeSetupPayloadGenerator.h>
#include <setup_payload/SetupPayload.h>

#include <platform/silabs/platformAbstraction/SilabsPlatform.h>

/**********************************************************
* Defines and Constants
*********************************************************/
Expand Down
4 changes: 4 additions & 0 deletions examples/platform/silabs/MatterConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,11 @@ CHIP_ERROR SilabsMatterConfig::InitOpenThread(void)
ReturnErrorOnFailure(ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_Router));
#else // CHIP_DEVICE_CONFIG_THREAD_FTD
#if CHIP_CONFIG_ENABLE_ICD_SERVER
#if CHIP_DEVICE_CONFIG_THREAD_SSED
ReturnErrorOnFailure(ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_SynchronizedSleepyEndDevice));
#else
ReturnErrorOnFailure(ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_SleepyEndDevice));
#endif
#else // CHIP_CONFIG_ENABLE_ICD_SERVER
ReturnErrorOnFailure(ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_MinimalEndDevice));
#endif // CHIP_CONFIG_ENABLE_ICD_SERVER
Expand Down
28 changes: 16 additions & 12 deletions examples/platform/silabs/efr32/project_include/OpenThreadConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,35 +45,39 @@
// Timeout after 2 missed checkin or 4 mins if sleep interval is too short.
#define OPENTHREAD_CONFIG_MLE_CHILD_TIMEOUT_DEFAULT ((SL_MLE_TIMEOUT_s < 120) ? 240 : ((SL_MLE_TIMEOUT_s * 2) + 1))

#if defined(SL_CSL_ENABLE) && SL_CSL_ENABLE

#define OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE 1
#define OPENTHREAD_CONFIG_MAC_CSL_AUTO_SYNC_ENABLE 1
#define OPENTHREAD_CONFIG_PLATFORM_USEC_TIMER_ENABLE 1
#define OPENTHREAD_CONFIG_CHILD_SUPERVISION_CHECK_TIMEOUT 0
#define OPENTHREAD_CONFIG_CSL_RECEIVE_TIME_AHEAD 750
#define OPENTHREAD_CONFIG_CSL_TIMEOUT SL_CSL_TIMEOUT
#define SL_OPENTHREAD_CSL_TX_UNCERTAINTY 200

#endif // SL_CSL_ENABLE

#endif // SL_ICD_ENABLED

/****Uncomment below section for OpenThread Debug logs*/
// #define OPENTHREAD_CONFIG_LOG_LEVEL OT_LOG_LEVEL_DEBG

// #ifndef OPENTHREAD_CONFIG_LOG_CLI
// #define OPENTHREAD_CONFIG_LOG_CLI 1
// #define OPENTHREAD_CONFIG_LOG_CLI 1
// #endif

// #ifndef OPENTHREAD_CONFIG_LOG_PKT_DUMP
// #define OPENTHREAD_CONFIG_LOG_PKT_DUMP 1
// #define OPENTHREAD_CONFIG_LOG_PKT_DUMP 1
// #endif

// #ifndef OPENTHREAD_CONFIG_LOG_PLATFORM
// #define OPENTHREAD_CONFIG_LOG_PLATFORM 1
// #define OPENTHREAD_CONFIG_LOG_PLATFORM 1
// #endif

// #ifndef OPENTHREAD_CONFIG_LOG_PREPEND_LEVEL
// #define OPENTHREAD_CONFIG_LOG_PREPEND_LEVEL 1
// #define OPENTHREAD_CONFIG_LOG_PREPEND_LEVEL 1
// #endif

// EFR32MG21A020F1024IM32 has 96k of RAM. Reduce the number of buffers to
// conserve RAM for this Series 2 part.
#if defined(EFR32MG21)
#define OPENTHREAD_CONFIG_NUM_MESSAGE_BUFFERS 22
#define OPENTHREAD_CONFIG_CLI_UART_TX_BUFFER_SIZE 512
#define OPENTHREAD_CONFIG_CLI_UART_RX_BUFFER_SIZE 512
#endif

#define OPENTHREAD_CONFIG_NCP_HDLC_ENABLE 1
#define OPENTHREAD_CONFIG_IP6_SLAAC_ENABLE 1

Expand Down
97 changes: 97 additions & 0 deletions examples/window-app/common/window-app.matter
Original file line number Diff line number Diff line change
Expand Up @@ -1810,6 +1810,91 @@ cluster UserLabel = 65 {
readonly attribute int16u clusterRevision = 65533;
}

/** Allows servers to ensure that listed clients are notified when a server is available for communication. */
cluster IcdManagement = 70 {
revision 2;

enum OperatingModeEnum : enum8 {
kSIT = 0;
kLIT = 1;
}

bitmap Feature : bitmap32 {
kCheckInProtocolSupport = 0x1;
kUserActiveModeTrigger = 0x2;
kLongIdleTimeSupport = 0x4;
}

bitmap UserActiveModeTriggerBitmap : bitmap32 {
kPowerCycle = 0x1;
kSettingsMenu = 0x2;
kCustomInstruction = 0x4;
kDeviceManual = 0x8;
kActuateSensor = 0x10;
kActuateSensorSeconds = 0x20;
kActuateSensorTimes = 0x40;
kActuateSensorLightsBlink = 0x80;
kResetButton = 0x100;
kResetButtonLightsBlink = 0x200;
kResetButtonSeconds = 0x400;
kResetButtonTimes = 0x800;
kSetupButton = 0x1000;
kSetupButtonSeconds = 0x2000;
kSetupButtonLightsBlink = 0x4000;
kSetupButtonTimes = 0x8000;
kAppDefinedButton = 0x10000;
}

fabric_scoped struct MonitoringRegistrationStruct {
fabric_sensitive node_id checkInNodeID = 1;
fabric_sensitive int64u monitoredSubject = 2;
fabric_idx fabricIndex = 254;
}

readonly attribute int32u idleModeDuration = 0;
readonly attribute int32u activeModeDuration = 1;
readonly attribute int16u activeModeThreshold = 2;
readonly attribute access(read: administer) optional MonitoringRegistrationStruct registeredClients[] = 3;
readonly attribute access(read: administer) optional int32u ICDCounter = 4;
readonly attribute optional int16u clientsSupportedPerFabric = 5;
readonly attribute optional UserActiveModeTriggerBitmap userActiveModeTriggerHint = 6;
readonly attribute optional char_string<128> userActiveModeTriggerInstruction = 7;
readonly attribute optional OperatingModeEnum operatingMode = 8;
readonly attribute command_id generatedCommandList[] = 65528;
readonly attribute command_id acceptedCommandList[] = 65529;
readonly attribute event_id eventList[] = 65530;
readonly attribute attrib_id attributeList[] = 65531;
readonly attribute bitmap32 featureMap = 65532;
readonly attribute int16u clusterRevision = 65533;

request struct RegisterClientRequest {
node_id checkInNodeID = 0;
int64u monitoredSubject = 1;
octet_string<16> key = 2;
optional octet_string<16> verificationKey = 3;
}

response struct RegisterClientResponse = 1 {
int32u ICDCounter = 0;
}

request struct UnregisterClientRequest {
node_id checkInNodeID = 0;
optional octet_string<16> verificationKey = 1;
}

response struct StayActiveResponse = 4 {
int32u promisedActiveDuration = 0;
}

/** Register a client to the end device */
fabric command access(invoke: manage) RegisterClient(RegisterClientRequest): RegisterClientResponse = 0;
/** Unregister a client from an end device */
fabric command access(invoke: manage) UnregisterClient(UnregisterClientRequest): DefaultSuccess = 2;
/** Request the end device to stay in Active Mode for an additional ActiveModeThreshold */
command access(invoke: manage) StayActiveRequest(): StayActiveResponse = 3;
}

/** Provides an interface for controlling and adjusting automatic window coverings. */
cluster WindowCovering = 258 {
revision 5;
Expand Down Expand Up @@ -2360,6 +2445,18 @@ endpoint 0 {
ram attribute featureMap default = 0;
ram attribute clusterRevision default = 1;
}

server cluster IcdManagement {
callback attribute idleModeDuration;
callback attribute activeModeDuration;
callback attribute activeModeThreshold;
callback attribute generatedCommandList;
callback attribute acceptedCommandList;
callback attribute eventList;
callback attribute attributeList;
ram attribute featureMap default = 0x0000;
ram attribute clusterRevision default = 2;
}
}
endpoint 1 {
device type ma_windowcovering = 514, version 2;
Expand Down
157 changes: 156 additions & 1 deletion examples/window-app/common/window-app.zap
Original file line number Diff line number Diff line change
Expand Up @@ -5065,6 +5065,160 @@
"reportableChange": 0
}
]
},
{
"name": "ICD Management",
"code": 70,
"mfgCode": null,
"define": "ICD_MANAGEMENT_CLUSTER",
"side": "server",
"enabled": 1,
"attributes": [
{
"name": "IdleModeDuration",
"code": 0,
"mfgCode": null,
"side": "server",
"type": "int32u",
"included": 1,
"storageOption": "External",
"singleton": 0,
"bounded": 0,
"defaultValue": "",
"reportable": 1,
"minInterval": 1,
"maxInterval": 65534,
"reportableChange": 0
},
{
"name": "ActiveModeDuration",
"code": 1,
"mfgCode": null,
"side": "server",
"type": "int32u",
"included": 1,
"storageOption": "External",
"singleton": 0,
"bounded": 0,
"defaultValue": "",
"reportable": 1,
"minInterval": 1,
"maxInterval": 65534,
"reportableChange": 0
},
{
"name": "ActiveModeThreshold",
"code": 2,
"mfgCode": null,
"side": "server",
"type": "int16u",
"included": 1,
"storageOption": "External",
"singleton": 0,
"bounded": 0,
"defaultValue": "",
"reportable": 1,
"minInterval": 1,
"maxInterval": 65534,
"reportableChange": 0
},
{
"name": "GeneratedCommandList",
"code": 65528,
"mfgCode": null,
"side": "server",
"type": "array",
"included": 1,
"storageOption": "External",
"singleton": 0,
"bounded": 0,
"defaultValue": "",
"reportable": 1,
"minInterval": 1,
"maxInterval": 65534,
"reportableChange": 0
},
{
"name": "AcceptedCommandList",
"code": 65529,
"mfgCode": null,
"side": "server",
"type": "array",
"included": 1,
"storageOption": "External",
"singleton": 0,
"bounded": 0,
"defaultValue": "",
"reportable": 1,
"minInterval": 1,
"maxInterval": 65534,
"reportableChange": 0
},
{
"name": "EventList",
"code": 65530,
"mfgCode": null,
"side": "server",
"type": "array",
"included": 1,
"storageOption": "External",
"singleton": 0,
"bounded": 0,
"defaultValue": "",
"reportable": 1,
"minInterval": 1,
"maxInterval": 65534,
"reportableChange": 0
},
{
"name": "AttributeList",
"code": 65531,
"mfgCode": null,
"side": "server",
"type": "array",
"included": 1,
"storageOption": "External",
"singleton": 0,
"bounded": 0,
"defaultValue": "",
"reportable": 1,
"minInterval": 1,
"maxInterval": 65534,
"reportableChange": 0
},
{
"name": "FeatureMap",
"code": 65532,
"mfgCode": null,
"side": "server",
"type": "bitmap32",
"included": 1,
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
"defaultValue": "0x0000",
"reportable": 1,
"minInterval": 1,
"maxInterval": 65534,
"reportableChange": 0
},
{
"name": "ClusterRevision",
"code": 65533,
"mfgCode": null,
"side": "server",
"type": "int16u",
"included": 1,
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
"defaultValue": "2",
"reportable": 1,
"minInterval": 1,
"maxInterval": 65534,
"reportableChange": 0
}
]
}
]
},
Expand Down Expand Up @@ -7105,5 +7259,6 @@
"endpointId": 2,
"networkId": 0
}
]
],
"log": []
}
2 changes: 1 addition & 1 deletion examples/window-app/silabs/openthread.gn
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ check_system_includes = true
default_args = {
target_cpu = "arm"
target_os = "freertos"
chip_openthread_ftd = true
chip_openthread_ftd = false

import("//openthread.gni")
}
Loading

0 comments on commit 93a805c

Please sign in to comment.