diff --git a/.github/boring-cyborg.yml b/.github/boring-cyborg.yml index bb2e2a7d2b5e9d..f9e4a7a44840c5 100644 --- a/.github/boring-cyborg.yml +++ b/.github/boring-cyborg.yml @@ -105,7 +105,7 @@ labelPRBasedOnFilePath: - src/darwin/* efr32: - - src/platform/EFR32/* + - src/platform/efr32/* esp32: - src/platform/ESP32/* diff --git a/.github/labeler.yml b/.github/labeler.yml index 235d671213f425..635acae0dbef2b 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -182,8 +182,8 @@ darwin: - examples/darwin-framework-tool/**/* efr32: - - src/platform/EFR32/* - - src/platform/EFR32/**/* + - src/platform/efr32/* + - src/platform/efr32/**/* esp32: - src/platform/ESP32/* diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index ffc0644df2c889..16e180a2c06e05 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -221,8 +221,30 @@ jobs: --tv-app ./out/linux-x64-tv-app-${BUILD_VARIANT}/chip-tv-app \ --bridge-app ./out/linux-x64-bridge-${BUILD_VARIANT}/chip-bridge-app \ " - - name: Run Tests using chip-repl + - name: Run Tests using chip-repl (skip slow) timeout-minutes: 45 + if: github.event_name == 'pull_request' + run: | + ./scripts/run_in_build_env.sh \ + "./scripts/tests/run_test_suite.py \ + --run-yamltests-with-chip-repl \ + --exclude-tags MANUAL \ + --exclude-tags FLAKY \ + --exclude-tags IN_DEVELOPMENT \ + --exclude-tags SLOW \ + run \ + --iterations 1 \ + --test-timeout-seconds 120 \ + --all-clusters-app ./out/linux-x64-all-clusters-${BUILD_VARIANT}/chip-all-clusters-app \ + --lock-app ./out/linux-x64-lock-${BUILD_VARIANT}/chip-lock-app \ + --ota-provider-app ./out/linux-x64-ota-provider-${BUILD_VARIANT}/chip-ota-provider-app \ + --ota-requestor-app ./out/linux-x64-ota-requestor-${BUILD_VARIANT}/chip-ota-requestor-app \ + --tv-app ./out/linux-x64-tv-app-${BUILD_VARIANT}/chip-tv-app \ + --bridge-app ./out/linux-x64-bridge-${BUILD_VARIANT}/chip-bridge-app \ + " + - name: Run Tests using chip-repl (including slow) + timeout-minutes: 45 + if: github.event_name == 'push' run: | ./scripts/run_in_build_env.sh \ "./scripts/tests/run_test_suite.py \ diff --git a/docs/guides/esp32/build_app_and_commission.md b/docs/guides/esp32/build_app_and_commission.md index db7ee6ebc30604..6fd2e2d0dbff45 100644 --- a/docs/guides/esp32/build_app_and_commission.md +++ b/docs/guides/esp32/build_app_and_commission.md @@ -194,7 +194,7 @@ $ out/debug/chip-tool pairing ble-wifi 12345 MY_SSID MY_PASSWORD 20202021 3840 #### Commissioning the Ethernet device (ESP32-Ethernet-Kit) ``` -$ out/debug/chip-tool pairing ethernet 12345 20202021 3840 device-remote-ip 5540 +$ out/debug/chip-tool pairing onnetwork 12345 20202021 ``` Note: In order to commission an ethernet device, from all-clusters-app enable diff --git a/examples/chef/efr32/BUILD.gn b/examples/chef/efr32/BUILD.gn index dd843668af0fdc..a81cb3bf90f46a 100644 --- a/examples/chef/efr32/BUILD.gn +++ b/examples/chef/efr32/BUILD.gn @@ -60,7 +60,7 @@ efr32_sdk("sdk") { ] include_dirs = [ - "${chip_root}/src/platform/silabs/EFR32", + "${chip_root}/src/platform/silabs/efr32", "${efr32_project_dir}/include", "${examples_plat_dir}", "${chip_root}/src/lib", diff --git a/examples/chef/efr32/args.gni b/examples/chef/efr32/args.gni index 0ad1d033053e34..af4de711ae6876 100644 --- a/examples/chef/efr32/args.gni +++ b/examples/chef/efr32/args.gni @@ -14,7 +14,7 @@ import("//build_overrides/chip.gni") import("${chip_root}/config/standalone/args.gni") -import("${chip_root}/src/platform/EFR32/args.gni") +import("${chip_root}/src/platform/efr32/args.gni") efr32_sdk_target = get_label_info(":sdk", "label_no_toolchain") diff --git a/examples/chef/efr32/build_for_wifi_args.gni b/examples/chef/efr32/build_for_wifi_args.gni index 902b282b9e4014..27e3d837658720 100644 --- a/examples/chef/efr32/build_for_wifi_args.gni +++ b/examples/chef/efr32/build_for_wifi_args.gni @@ -15,6 +15,6 @@ import("//build_overrides/chip.gni") efr32_sdk_target = get_label_info(":sdk", "label_no_toolchain") chip_enable_openthread = false -import("${chip_root}/src/platform/EFR32/wifi_args.gni") +import("${chip_root}/src/platform/efr32/wifi_args.gni") chip_enable_ota_requestor = true diff --git a/examples/chip-tool/commands/common/Commands.cpp b/examples/chip-tool/commands/common/Commands.cpp index 749cbdcc739250..ef4386725ec2f2 100644 --- a/examples/chip-tool/commands/common/Commands.cpp +++ b/examples/chip-tool/commands/common/Commands.cpp @@ -41,21 +41,27 @@ constexpr const char * kJsonCommandKey = "command"; constexpr const char * kJsonCommandSpecifierKey = "command_specifier"; constexpr const char * kJsonArgumentsKey = "arguments"; -std::vector GetArgumentsFromJson(Command * command, Json::Value & value, bool optional) +bool GetArgumentsFromJson(Command * command, Json::Value & value, bool optional, std::vector & outArgs) { + auto memberNames = value.getMemberNames(); + std::vector args; for (size_t i = 0; i < command->GetArgumentsCount(); i++) { - auto argName = command->GetArgumentName(i); - for (auto const & memberName : value.getMemberNames()) + auto argName = command->GetArgumentName(i); + auto memberNamesIterator = memberNames.begin(); + while (memberNamesIterator != memberNames.end()) { + auto memberName = *memberNamesIterator; if (strcasecmp(argName, memberName.c_str()) != 0) { + memberNamesIterator++; continue; } if (command->GetArgumentIsOptional(i) != optional) { + memberNamesIterator = memberNames.erase(memberNamesIterator); continue; } @@ -66,10 +72,20 @@ std::vector GetArgumentsFromJson(Command * command, Json::Value & v auto argValue = value[memberName].asString(); args.push_back(std::move(argValue)); + memberNamesIterator = memberNames.erase(memberNamesIterator); break; } } - return args; + + if (memberNames.size()) + { + auto memberName = memberNames.front(); + ChipLogError(chipTool, "The argument \"\%s\" is not supported.", memberName.c_str()); + return false; + } + + outArgs = args; + return true; }; // Check for arguments with a starting '"' but no ending '"': those @@ -542,8 +558,10 @@ bool Commands::DecodeArgumentsFromBase64EncodedJson(const char * json, std::vect VerifyOrReturnValue(parsedArguments, false, ChipLogError(chipTool, "Error while parsing json.")); VerifyOrReturnValue(jsonArguments.isObject(), false, ChipLogError(chipTool, "Unexpected json type, expects and object.")); - auto mandatoryArguments = GetArgumentsFromJson(command, jsonArguments, false /* addOptional */); - auto optionalArguments = GetArgumentsFromJson(command, jsonArguments, true /* addOptional */); + std::vector mandatoryArguments; + std::vector optionalArguments; + VerifyOrReturnValue(GetArgumentsFromJson(command, jsonArguments, false /* addOptional */, mandatoryArguments), false); + VerifyOrReturnValue(GetArgumentsFromJson(command, jsonArguments, true /* addOptional */, optionalArguments), false); args.push_back(std::move(clusterName)); args.push_back(std::move(commandName)); diff --git a/examples/light-switch-app/silabs/SiWx917/BUILD.gn b/examples/light-switch-app/silabs/SiWx917/BUILD.gn index 5972ad7265fbc4..a45c2d7a391ece 100644 --- a/examples/light-switch-app/silabs/SiWx917/BUILD.gn +++ b/examples/light-switch-app/silabs/SiWx917/BUILD.gn @@ -200,7 +200,7 @@ efr32_executable("light_switch_app") { ] if (use_wstk_leds) { - #sources += [ "${examples_plat_dir}/LEDWidget.cpp" ] + sources += [ "${examples_plat_dir}/LEDWidget.cpp" ] } if (chip_enable_pw_rpc || chip_build_libshell || enable_openthread_cli || diff --git a/examples/light-switch-app/silabs/SiWx917/include/AppTask.h b/examples/light-switch-app/silabs/SiWx917/include/AppTask.h index 29a0078d1472f3..de8ab5ce947e8e 100644 --- a/examples/light-switch-app/silabs/SiWx917/include/AppTask.h +++ b/examples/light-switch-app/silabs/SiWx917/include/AppTask.h @@ -38,49 +38,10 @@ /********************************************************** * Defines *********************************************************/ - -#define SL_SIMPLE_BUTTON_MODE_POLL 0U ///< BUTTON input capture using polling -#define SL_SIMPLE_BUTTON_MODE_POLL_AND_DEBOUNCE 1U ///< BUTTON input capture using polling and debouncing -#define SL_SIMPLE_BUTTON_MODE_INTERRUPT 2U ///< BUTTON input capture using interrupt - -#define SL_SIMPLE_BUTTON_DISABLED 2U ///< BUTTON state is disabled -#define SL_SIMPLE_BUTTON_PRESSED 1U ///< BUTTON state is pressed -#define SL_SIMPLE_BUTTON_RELEASED 0U ///< BUTTON state is released - -typedef uint8_t sl_button_mode_t; ///< BUTTON mode -typedef uint8_t sl_button_state_t; ///< BUTTON state -typedef struct sl_button sl_button_t; - -/// A BUTTON instance -typedef struct sl_button -{ - void * context; ///< The context for this BUTTON instance - void (*init)(const sl_button_t * handle); ///< Member function to initialize BUTTON instance - void (*poll)(const sl_button_t * handle); ///< Member function to poll BUTTON - void (*enable)(const sl_button_t * handle); ///< Member function to enable BUTTON - void (*disable)(const sl_button_t * handle); ///< Member function to disable BUTTON - sl_button_state_t (*get_state)(const sl_button_t * handle); ///< Member function to retrieve BUTTON state -} sl_button; - -const sl_button_t sl_button_btn0 = { - .context = NULL, - .init = NULL, - .poll = NULL, - .enable = NULL, - .disable = NULL, - .get_state = NULL, -}; -#define APP_FUNCTION_BUTTON &sl_button_btn0 - -const sl_button_t sl_button_btn1 = { - .context = NULL, - .init = NULL, - .poll = NULL, - .enable = NULL, - .disable = NULL, - .get_state = NULL, -}; -#define APP_LIGHT_SWITCH &sl_button_btn1 +// Button specific defines for SiWx917 +#define SL_SIMPLE_BUTTON_PRESSED 1U +#define SIWx917_BTN0 0 +#define SIWx917_BTN1 1 // Application-defined error codes in the CHIP_ERROR space. #define APP_ERROR_EVENT_QUEUE_FAILED CHIP_APPLICATION_ERROR(0x01) @@ -115,11 +76,11 @@ class AppTask : public BaseApplication * @brief Event handler when a button is pressed * Function posts an event for button processing * - * @param buttonHandle APP_LIGHT_SWITCH or APP_FUNCTION_BUTTON + * @param button - btn0 or btn1 * @param btnAction button action - SL_SIMPLE_BUTTON_PRESSED, * SL_SIMPLE_BUTTON_RELEASED or SL_SIMPLE_BUTTON_DISABLED */ - void ButtonEventHandler(const sl_button_t * buttonHandle, uint8_t btnAction); + void ButtonEventHandler(uint8_t button, uint8_t btnAction); /** * @brief Callback called by the identify-server when an identify command is received diff --git a/examples/light-switch-app/silabs/SiWx917/src/AppTask.cpp b/examples/light-switch-app/silabs/SiWx917/src/AppTask.cpp index 06a3dc734006ac..3ea96abf726399 100644 --- a/examples/light-switch-app/silabs/SiWx917/src/AppTask.cpp +++ b/examples/light-switch-app/silabs/SiWx917/src/AppTask.cpp @@ -60,9 +60,6 @@ #define SYSTEM_STATE_LED &sl_led_led0 -#define APP_FUNCTION_BUTTON &sl_button_btn0 -#define APP_LIGHT_SWITCH &sl_button_btn1 - namespace { constexpr chip::EndpointId kLightSwitchEndpoint = 1; @@ -258,14 +255,19 @@ void AppTask::SwitchActionEventHandler(AppEvent * aEvent) } } -void AppTask::ButtonEventHandler(const sl_button_t * buttonHandle, uint8_t btnAction) +void AppTask::ButtonEventHandler(uint8_t button, uint8_t btnAction) { - VerifyOrReturn(buttonHandle != NULL); - AppEvent button_event = {}; button_event.Type = AppEvent::kEventType_Button; button_event.ButtonEvent.Action = btnAction; - - button_event.Handler = SwitchActionEventHandler; - sAppTask.PostEvent(&button_event); + if (button == SIWx917_BTN1) + { + button_event.Handler = SwitchActionEventHandler; + sAppTask.PostEvent(&button_event); + } + else if (button == SIWx917_BTN0) + { + button_event.Handler = BaseApplication::ButtonHandler; + sAppTask.PostEvent(&button_event); + } } diff --git a/examples/light-switch-app/silabs/SiWx917/src/main.cpp b/examples/light-switch-app/silabs/SiWx917/src/main.cpp index c67851a2ca78cc..7bae26206310d4 100644 --- a/examples/light-switch-app/silabs/SiWx917/src/main.cpp +++ b/examples/light-switch-app/silabs/SiWx917/src/main.cpp @@ -33,7 +33,7 @@ #define BLE_DEV_NAME "SiLabs-Light-Switch" -extern "C" void sl_button_on_change(); +extern "C" void sl_button_on_change(uint8_t btn, uint8_t btnAction); using namespace ::chip; using namespace ::chip::Inet; @@ -81,7 +81,7 @@ int main(void) appError(CHIP_ERROR_INTERNAL); } -void sl_button_on_change() +void sl_button_on_change(uint8_t btn, uint8_t btnAction) { - AppTask::GetAppTask().ButtonEventHandler(APP_LIGHT_SWITCH, SL_SIMPLE_BUTTON_PRESSED); + AppTask::GetAppTask().ButtonEventHandler(btn, btnAction); } diff --git a/examples/light-switch-app/silabs/efr32/BUILD.gn b/examples/light-switch-app/silabs/efr32/BUILD.gn index 0d49e7c354149d..dbb6b7edf2245c 100644 --- a/examples/light-switch-app/silabs/efr32/BUILD.gn +++ b/examples/light-switch-app/silabs/efr32/BUILD.gn @@ -50,7 +50,7 @@ efr32_sdk("sdk") { include_dirs = [ "${chip_root}/examples/light-switch-app/silabs/common", - "${chip_root}/src/platform/silabs/EFR32", + "${chip_root}/src/platform/silabs/efr32", "${efr32_project_dir}/include", "${examples_plat_dir}", "${chip_root}/src/lib", diff --git a/examples/light-switch-app/silabs/efr32/args.gni b/examples/light-switch-app/silabs/efr32/args.gni index 5ca79b0919f47b..779402128b46a7 100644 --- a/examples/light-switch-app/silabs/efr32/args.gni +++ b/examples/light-switch-app/silabs/efr32/args.gni @@ -14,7 +14,7 @@ import("//build_overrides/chip.gni") import("${chip_root}/config/standalone/args.gni") -import("${chip_root}/src/platform/silabs/EFR32/args.gni") +import("${chip_root}/src/platform/silabs/efr32/args.gni") efr32_sdk_target = get_label_info(":sdk", "label_no_toolchain") diff --git a/examples/light-switch-app/silabs/efr32/build_for_wifi_args.gni b/examples/light-switch-app/silabs/efr32/build_for_wifi_args.gni index 7069bd4823a499..bac0164159fe10 100644 --- a/examples/light-switch-app/silabs/efr32/build_for_wifi_args.gni +++ b/examples/light-switch-app/silabs/efr32/build_for_wifi_args.gni @@ -16,7 +16,7 @@ import("${chip_root}/config/standalone/args.gni") efr32_sdk_target = get_label_info(":sdk", "label_no_toolchain") chip_enable_openthread = false -import("${chip_root}/src/platform/silabs/EFR32/wifi_args.gni") +import("${chip_root}/src/platform/silabs/efr32/wifi_args.gni") chip_enable_ota_requestor = true app_data_model = "${chip_root}/examples/light-switch-app/light-switch-common" diff --git a/examples/lighting-app/silabs/SiWx917/BUILD.gn b/examples/lighting-app/silabs/SiWx917/BUILD.gn index 8abb554a67c3be..d98d0a80b23388 100644 --- a/examples/lighting-app/silabs/SiWx917/BUILD.gn +++ b/examples/lighting-app/silabs/SiWx917/BUILD.gn @@ -204,8 +204,7 @@ efr32_executable("lighting_app") { ] if (use_wstk_leds) { - # TODO: Commentting for CCP till the bring up of this is done - #sources += [ "${examples_plat_dir}/LEDWidget.cpp" ] + sources += [ "${examples_plat_dir}/LEDWidget.cpp" ] } if (chip_enable_pw_rpc || chip_build_libshell || use_rs911x) { diff --git a/examples/lighting-app/silabs/SiWx917/include/AppTask.h b/examples/lighting-app/silabs/SiWx917/include/AppTask.h index 225b726f732b13..0310e9e187c80c 100644 --- a/examples/lighting-app/silabs/SiWx917/include/AppTask.h +++ b/examples/lighting-app/silabs/SiWx917/include/AppTask.h @@ -39,6 +39,10 @@ /********************************************************** * Defines *********************************************************/ +// Button specific defines for SiWx917 +#define SL_SIMPLE_BUTTON_PRESSED 1 +#define SIWx917_BTN0 0 +#define SIWx917_BTN1 1 // Application-defined error codes in the CHIP_ERROR space. #define APP_ERROR_EVENT_QUEUE_FAILED CHIP_APPLICATION_ERROR(0x01) @@ -69,6 +73,16 @@ class AppTask : public BaseApplication CHIP_ERROR StartAppTask(); + /** + * @brief Event handler when a button is pressed + * Function posts an event for button processing + * + * @param button - btn0 or btn1 + * @param btnAction button action - SL_SIMPLE_BUTTON_PRESSED, + * SL_SIMPLE_BUTTON_RELEASED or SL_SIMPLE_BUTTON_DISABLED + */ + void ButtonEventHandler(uint8_t button, uint8_t btnAction); + /** * @brief Callback called by the identify-server when an identify command is received * diff --git a/examples/lighting-app/silabs/SiWx917/src/AppTask.cpp b/examples/lighting-app/silabs/SiWx917/src/AppTask.cpp index 06665ad695743c..6133df35c33610 100644 --- a/examples/lighting-app/silabs/SiWx917/src/AppTask.cpp +++ b/examples/lighting-app/silabs/SiWx917/src/AppTask.cpp @@ -36,14 +36,20 @@ #include -#define APP_FUNCTION_BUTTON &sl_button_btn0 -#define APP_LIGHT_SWITCH &sl_button_btn1 +#ifdef ENABLE_WSTK_LEDS +#include "LEDWidget.h" +#define APP_ACTION_LED 1 +#endif // ENABLE_WSTK_LEDS using namespace chip; using namespace ::chip::DeviceLayer; namespace { +#ifdef ENABLE_WSTK_LEDS +LEDWidget sLightLED; +#endif // ENABLE_WSTK_LEDS + EmberAfIdentifyEffectIdentifier sIdentifyEffect = EMBER_ZCL_IDENTIFY_EFFECT_IDENTIFIER_STOP_EFFECT; /********************************************************** @@ -128,16 +134,19 @@ CHIP_ERROR AppTask::Init() appError(err); } - /* TODO - err = LightMgr().Init(); - if (err != CHIP_NO_ERROR) - { - SILABS_LOG("LightMgr::Init() failed"); - appError(err); - } + err = LightMgr().Init(); + if (err != CHIP_NO_ERROR) + { + SILABS_LOG("LightMgr::Init() failed"); + appError(err); + } + + LightMgr().SetCallbacks(ActionInitiated, ActionCompleted); - LightMgr().SetCallbacks(ActionInitiated, ActionCompleted); - */ +#ifdef ENABLE_WSTK_LEDS + sLightLED.Init(APP_ACTION_LED); + sLightLED.Set(LightMgr().IsLightOn()); +#endif // ENABLE_WSTK_LEDS return err; } @@ -227,11 +236,29 @@ void AppTask::LightActionEventHandler(AppEvent * aEvent) } } +void AppTask::ButtonEventHandler(uint8_t button, uint8_t btnAction) +{ + AppEvent button_event = {}; + button_event.Type = AppEvent::kEventType_Button; + button_event.ButtonEvent.Action = btnAction; + if (button == SIWx917_BTN1 && btnAction == SL_SIMPLE_BUTTON_PRESSED) + { + button_event.Handler = LightActionEventHandler; + sAppTask.PostEvent(&button_event); + } + else if (button == SIWx917_BTN0) + { + button_event.Handler = BaseApplication::ButtonHandler; + sAppTask.PostEvent(&button_event); + } +} + void AppTask::ActionInitiated(LightingManager::Action_t aAction, int32_t aActor) { // Action initiated, update the light led bool lightOn = aAction == LightingManager::ON_ACTION; - SILABS_LOG("Turning light %s", (lightOn) ? "On" : "Off") + SILABS_LOG("Turning light %s", (lightOn) ? "On" : "Off"); + sLightLED.Set(lightOn); #ifdef DISPLAY_ENABLED sAppTask.GetLCD().WriteDemoUI(lightOn); diff --git a/examples/lighting-app/silabs/SiWx917/src/main.cpp b/examples/lighting-app/silabs/SiWx917/src/main.cpp index e3ed2a9c8490a8..d95f6b7ab51295 100644 --- a/examples/lighting-app/silabs/SiWx917/src/main.cpp +++ b/examples/lighting-app/silabs/SiWx917/src/main.cpp @@ -33,6 +33,9 @@ #endif #define BLE_DEV_NAME "SiLabs-Light" + +extern "C" void sl_button_on_change(uint8_t btn, uint8_t btnAction); + using namespace ::chip; using namespace ::chip::Inet; using namespace ::chip::DeviceLayer; @@ -80,3 +83,8 @@ int main(void) SILABS_LOG("vTaskStartScheduler() failed"); appError(CHIP_ERROR_INTERNAL); } + +void sl_button_on_change(uint8_t btn, uint8_t btnAction) +{ + AppTask::GetAppTask().ButtonEventHandler(btn, btnAction); +} diff --git a/examples/lighting-app/silabs/efr32/BUILD.gn b/examples/lighting-app/silabs/efr32/BUILD.gn index f2103d5bde63b2..f51a73c92b7685 100644 --- a/examples/lighting-app/silabs/efr32/BUILD.gn +++ b/examples/lighting-app/silabs/efr32/BUILD.gn @@ -49,7 +49,7 @@ efr32_sdk("sdk") { ] include_dirs = [ - "${chip_root}/src/platform/silabs/EFR32", + "${chip_root}/src/platform/silabs/efr32", "${efr32_project_dir}/include", "${examples_plat_dir}", "${chip_root}/src/lib", diff --git a/examples/lighting-app/silabs/efr32/args.gni b/examples/lighting-app/silabs/efr32/args.gni index 75b21eaef170aa..88cb89a3a6de65 100644 --- a/examples/lighting-app/silabs/efr32/args.gni +++ b/examples/lighting-app/silabs/efr32/args.gni @@ -14,7 +14,7 @@ import("//build_overrides/chip.gni") import("${chip_root}/config/standalone/args.gni") -import("${chip_root}/src/platform/silabs/EFR32/args.gni") +import("${chip_root}/src/platform/silabs/efr32/args.gni") efr32_sdk_target = get_label_info(":sdk", "label_no_toolchain") diff --git a/examples/lighting-app/silabs/efr32/build_for_wifi_args.gni b/examples/lighting-app/silabs/efr32/build_for_wifi_args.gni index a1e4b995d96b1a..6f8812e9e4265f 100644 --- a/examples/lighting-app/silabs/efr32/build_for_wifi_args.gni +++ b/examples/lighting-app/silabs/efr32/build_for_wifi_args.gni @@ -16,7 +16,7 @@ import("${chip_root}/config/standalone/args.gni") efr32_sdk_target = get_label_info(":sdk", "label_no_toolchain") chip_enable_openthread = false -import("${chip_root}/src/platform/silabs/EFR32/wifi_args.gni") +import("${chip_root}/src/platform/silabs/efr32/wifi_args.gni") chip_enable_ota_requestor = true app_data_model = "${chip_root}/examples/lighting-app/lighting-common" diff --git a/examples/lock-app/linux/BUILD.gn b/examples/lock-app/linux/BUILD.gn index 189d37306e5548..fc4bc76d9c8b2f 100644 --- a/examples/lock-app/linux/BUILD.gn +++ b/examples/lock-app/linux/BUILD.gn @@ -44,3 +44,7 @@ executable("chip-lock-app") { group("linux") { deps = [ ":chip-lock-app" ] } + +group("default") { + deps = [ ":linux" ] +} diff --git a/examples/lock-app/silabs/SiWx917/BUILD.gn b/examples/lock-app/silabs/SiWx917/BUILD.gn index 01710fc7ef48fc..c2cbe6e06ebb59 100644 --- a/examples/lock-app/silabs/SiWx917/BUILD.gn +++ b/examples/lock-app/silabs/SiWx917/BUILD.gn @@ -197,7 +197,7 @@ efr32_executable("lock_app") { ] if (use_wstk_leds) { - #sources += [ "${examples_plat_dir}/LEDWidget.cpp" ] + sources += [ "${examples_plat_dir}/LEDWidget.cpp" ] } if (chip_enable_pw_rpc || chip_build_libshell || enable_openthread_cli || diff --git a/examples/lock-app/silabs/SiWx917/include/AppTask.h b/examples/lock-app/silabs/SiWx917/include/AppTask.h index e6b88fcf127766..9ad4a2cd134773 100644 --- a/examples/lock-app/silabs/SiWx917/include/AppTask.h +++ b/examples/lock-app/silabs/SiWx917/include/AppTask.h @@ -30,7 +30,6 @@ #include "BaseApplication.h" #include "FreeRTOS.h" #include "LockManager.h" -//#include "sl_simple_button_instances.h" #include "timers.h" // provides FreeRTOS timer support #include #include @@ -40,48 +39,10 @@ /********************************************************** * Defines *********************************************************/ -#define SL_SIMPLE_BUTTON_MODE_POLL 0U ///< BUTTON input capture using polling -#define SL_SIMPLE_BUTTON_MODE_POLL_AND_DEBOUNCE 1U ///< BUTTON input capture using polling and debouncing -#define SL_SIMPLE_BUTTON_MODE_INTERRUPT 2U ///< BUTTON input capture using interrupt - -#define SL_SIMPLE_BUTTON_DISABLED 2U ///< BUTTON state is disabled -#define SL_SIMPLE_BUTTON_PRESSED 1U ///< BUTTON state is pressed -#define SL_SIMPLE_BUTTON_RELEASED 0U ///< BUTTON state is released - -typedef uint8_t sl_button_mode_t; ///< BUTTON mode -typedef uint8_t sl_button_state_t; ///< BUTTON state -typedef struct sl_button sl_button_t; - -/// A BUTTON instance -typedef struct sl_button -{ - void * context; ///< The context for this BUTTON instance - void (*init)(const sl_button_t * handle); ///< Member function to initialize BUTTON instance - void (*poll)(const sl_button_t * handle); ///< Member function to poll BUTTON - void (*enable)(const sl_button_t * handle); ///< Member function to enable BUTTON - void (*disable)(const sl_button_t * handle); ///< Member function to disable BUTTON - sl_button_state_t (*get_state)(const sl_button_t * handle); ///< Member function to retrieve BUTTON state -} sl_button; - -const sl_button_t sl_button_btn0 = { - .context = NULL, - .init = NULL, - .poll = NULL, - .enable = NULL, - .disable = NULL, - .get_state = NULL, -}; -#define APP_FUNCTION_BUTTON &sl_button_btn0 - -const sl_button_t sl_button_btn1 = { - .context = NULL, - .init = NULL, - .poll = NULL, - .enable = NULL, - .disable = NULL, - .get_state = NULL, -}; -#define APP_LIGHT_SWITCH &sl_button_btn1 +// Button specific defines for SiWx917 +#define SL_SIMPLE_BUTTON_PRESSED 1 +#define SIWx917_BTN0 0 +#define SIWx917_BTN1 1 // Application-defined error codes in the CHIP_ERROR space. #define APP_ERROR_EVENT_QUEUE_FAILED CHIP_APPLICATION_ERROR(0x01) @@ -128,7 +89,7 @@ class AppTask : public BaseApplication * @param btnAction button action - SL_SIMPLE_BUTTON_PRESSED, * SL_SIMPLE_BUTTON_RELEASED or SL_SIMPLE_BUTTON_DISABLED */ - void ButtonEventHandler(const sl_button_t * buttonHandle, uint8_t btnAction); + void ButtonEventHandler(uint8_t button, uint8_t btnAction); /** * @brief Callback called by the identify-server when an identify command is received diff --git a/examples/lock-app/silabs/SiWx917/src/AppTask.cpp b/examples/lock-app/silabs/SiWx917/src/AppTask.cpp index 4685000385ae8b..0582eed798470c 100644 --- a/examples/lock-app/silabs/SiWx917/src/AppTask.cpp +++ b/examples/lock-app/silabs/SiWx917/src/AppTask.cpp @@ -26,7 +26,6 @@ #ifdef ENABLE_WSTK_LEDS #include "LEDWidget.h" -#include "sl_simple_led_instances.h" #endif // ENABLE_WSTK_LEDS #ifdef DISPLAY_ENABLED @@ -56,13 +55,9 @@ #include #ifdef ENABLE_WSTK_LEDS -#define SYSTEM_STATE_LED &sl_led_led0 -#define LOCK_STATE_LED &sl_led_led1 +#define LOCK_STATE_LED 1 #endif // ENABLE_WSTK_LEDS -#define APP_FUNCTION_BUTTON &sl_button_btn0 -#define APP_LOCK_SWITCH &sl_button_btn1 - using chip::app::Clusters::DoorLock::DlLockState; using chip::app::Clusters::DoorLock::DlOperationError; using chip::app::Clusters::DoorLock::DlOperationSource; @@ -352,20 +347,23 @@ void AppTask::LockActionEventHandler(AppEvent * aEvent) } } -void AppTask::ButtonEventHandler(const sl_button_t * buttonHandle, uint8_t btnAction) +void AppTask::ButtonEventHandler(uint8_t button, uint8_t btnAction) { - if (buttonHandle == NULL) - { - return; - } AppEvent button_event = {}; button_event.Type = AppEvent::kEventType_Button; button_event.ButtonEvent.Action = btnAction; - SILABS_LOG("### Lock button #### "); - button_event.Handler = BaseApplication::ButtonHandler; - sAppTask.PostEvent(&button_event); + if (button == SIWx917_BTN1 && btnAction == SL_SIMPLE_BUTTON_PRESSED) + { + button_event.Handler = LockActionEventHandler; + sAppTask.PostEvent(&button_event); + } + else if (button == SIWx917_BTN0) + { + button_event.Handler = BaseApplication::ButtonHandler; + sAppTask.PostEvent(&button_event); + } } void AppTask::ActionInitiated(LockManager::Action_t aAction, int32_t aActor) diff --git a/examples/lock-app/silabs/SiWx917/src/main.cpp b/examples/lock-app/silabs/SiWx917/src/main.cpp index c3cbf82681bfdc..a3617564575ec3 100644 --- a/examples/lock-app/silabs/SiWx917/src/main.cpp +++ b/examples/lock-app/silabs/SiWx917/src/main.cpp @@ -32,7 +32,7 @@ #endif #define BLE_DEV_NAME "SiLabs-Door-Lock" -extern "C" void sl_button_on_change(); +extern "C" void sl_button_on_change(uint8_t btn, uint8_t btnAction); using namespace ::chip; using namespace ::chip::Inet; @@ -79,7 +79,7 @@ int main(void) appError(CHIP_ERROR_INTERNAL); } -void sl_button_on_change() +void sl_button_on_change(uint8_t btn, uint8_t btnAction) { - AppTask::GetAppTask().ButtonEventHandler(APP_FUNCTION_BUTTON, SL_SIMPLE_BUTTON_PRESSED); + AppTask::GetAppTask().ButtonEventHandler(btn, btnAction); } diff --git a/examples/lock-app/silabs/efr32/BUILD.gn b/examples/lock-app/silabs/efr32/BUILD.gn index fda976b33fda14..60b2df5dce5f4e 100644 --- a/examples/lock-app/silabs/efr32/BUILD.gn +++ b/examples/lock-app/silabs/efr32/BUILD.gn @@ -49,7 +49,7 @@ efr32_sdk("sdk") { ] include_dirs = [ - "${chip_root}/src/platform/silabs/EFR32", + "${chip_root}/src/platform/silabs/efr32", "${efr32_project_dir}/include", "${examples_plat_dir}", "${chip_root}/src/lib", diff --git a/examples/lock-app/silabs/efr32/args.gni b/examples/lock-app/silabs/efr32/args.gni index 2795c9453cd48b..d72526e91d9867 100644 --- a/examples/lock-app/silabs/efr32/args.gni +++ b/examples/lock-app/silabs/efr32/args.gni @@ -14,7 +14,7 @@ import("//build_overrides/chip.gni") import("${chip_root}/config/standalone/args.gni") -import("${chip_root}/src/platform/silabs/EFR32/args.gni") +import("${chip_root}/src/platform/silabs/efr32/args.gni") efr32_sdk_target = get_label_info(":sdk", "label_no_toolchain") diff --git a/examples/lock-app/silabs/efr32/build_for_wifi_args.gni b/examples/lock-app/silabs/efr32/build_for_wifi_args.gni index 556c097dcf568c..f672499d83e259 100644 --- a/examples/lock-app/silabs/efr32/build_for_wifi_args.gni +++ b/examples/lock-app/silabs/efr32/build_for_wifi_args.gni @@ -16,7 +16,7 @@ import("${chip_root}/config/standalone/args.gni") efr32_sdk_target = get_label_info(":sdk", "label_no_toolchain") chip_enable_openthread = false -import("${chip_root}/src/platform/silabs/EFR32/wifi_args.gni") +import("${chip_root}/src/platform/silabs/efr32/wifi_args.gni") chip_enable_ota_requestor = true app_data_model = "${chip_root}/examples/lock-app/lock-common" diff --git a/examples/log-source-app/linux/BUILD.gn b/examples/log-source-app/linux/BUILD.gn index 3fa9dc2e1a8c61..4cc6b31dbe97d8 100644 --- a/examples/log-source-app/linux/BUILD.gn +++ b/examples/log-source-app/linux/BUILD.gn @@ -34,3 +34,7 @@ executable("chip-log-source-app") { group("linux") { deps = [ ":chip-log-source-app" ] } + +group("default") { + deps = [ ":linux" ] +} diff --git a/examples/ota-provider-app/linux/BUILD.gn b/examples/ota-provider-app/linux/BUILD.gn index 366605c5181a83..de0be92c3cb8a8 100644 --- a/examples/ota-provider-app/linux/BUILD.gn +++ b/examples/ota-provider-app/linux/BUILD.gn @@ -35,3 +35,7 @@ executable("chip-ota-provider-app") { group("linux") { deps = [ ":chip-ota-provider-app" ] } + +group("default") { + deps = [ ":linux" ] +} diff --git a/examples/ota-requestor-app/linux/BUILD.gn b/examples/ota-requestor-app/linux/BUILD.gn index 2d698377703640..9122ce765031a6 100644 --- a/examples/ota-requestor-app/linux/BUILD.gn +++ b/examples/ota-requestor-app/linux/BUILD.gn @@ -33,3 +33,7 @@ executable("chip-ota-requestor-app") { group("linux") { deps = [ ":chip-ota-requestor-app" ] } + +group("default") { + deps = [ ":linux" ] +} diff --git a/examples/persistent-storage/linux/BUILD.gn b/examples/persistent-storage/linux/BUILD.gn index 33e0cc449a779b..e01cc757180484 100644 --- a/examples/persistent-storage/linux/BUILD.gn +++ b/examples/persistent-storage/linux/BUILD.gn @@ -32,3 +32,7 @@ executable("persistent_storage") { group("linux") { deps = [ ":persistent_storage" ] } + +group("default") { + deps = [ ":linux" ] +} diff --git a/examples/placeholder/linux/BUILD.gn b/examples/placeholder/linux/BUILD.gn index 6b956056c3bc98..92c568d5ffc744 100644 --- a/examples/placeholder/linux/BUILD.gn +++ b/examples/placeholder/linux/BUILD.gn @@ -70,3 +70,7 @@ executable("chip-${chip_tests_zap_config}") { group("linux") { deps = [ ":chip-${chip_tests_zap_config}" ] } + +group("default") { + deps = [ ":linux" ] +} diff --git a/examples/platform/silabs/SiWx917/BaseApplication.cpp b/examples/platform/silabs/SiWx917/BaseApplication.cpp index 86b60da581ee77..081bbfa1055419 100644 --- a/examples/platform/silabs/SiWx917/BaseApplication.cpp +++ b/examples/platform/silabs/SiWx917/BaseApplication.cpp @@ -25,6 +25,10 @@ #include "AppEvent.h" #include "AppTask.h" +#ifdef ENABLE_WSTK_LEDS +#include "LEDWidget.h" +#endif // ENABLE_WSTK_LEDS + #ifdef DISPLAY_ENABLED #include "lcd.h" #ifdef QR_CODE_ENABLED @@ -60,6 +64,9 @@ #define APP_TASK_PRIORITY 2 #define APP_EVENT_QUEUE_SIZE 10 #define EXAMPLE_VENDOR_ID 0xcafe +#ifdef ENABLE_WSTK_LEDS +#define APP_STATE_LED 0 +#endif // ENABLE_WSTK_LEDS using namespace chip; using namespace ::chip::DeviceLayer; @@ -76,6 +83,10 @@ TimerHandle_t sLightTimer; TaskHandle_t sAppTaskHandle; QueueHandle_t sAppEventQueue; +#ifdef ENABLE_WSTK_LEDS +LEDWidget sStatusLED; +#endif // ENABLE_WSTK_LEDS + #ifdef SL_WIFI app::Clusters::NetworkCommissioning::Instance sWiFiNetworkCommissioningInstance(0 /* Endpoint Id */, &(NetworkCommissioning::SlWiFiDriver::GetInstance())); @@ -188,6 +199,10 @@ CHIP_ERROR BaseApplication::Init(Identify * identifyObj) SILABS_LOG("Current Software Version: %s", CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING); +#ifdef ENABLE_WSTK_LEDS + sStatusLED.Init(APP_STATE_LED); +#endif // ENABLE_WSTK_LEDS + ConfigurationMgr().LogDeviceConfig(); // Create buffer for QR code that can fit max size and null terminator. @@ -243,6 +258,13 @@ void BaseApplication::FunctionEventHandler(AppEvent * aEvent) #endif // CHIP_DEVICE_CONFIG_ENABLE_SED mFunction = kFunction_FactoryReset; + +#ifdef ENABLE_WSTK_LEDS + // Turn off LED before starting blink to make sure blink is + // co-ordinated. + sStatusLED.Set(false); + sStatusLED.Blink(500); +#endif // ENABLE_WSTK_LEDS } else if (mFunctionTimerActive && mFunction == kFunction_FactoryReset) { @@ -294,6 +316,106 @@ void BaseApplication::LightEventHandler() // the LEDs at an even rate of 100ms. // // Otherwise, blink the LED ON for a very short time. +#ifdef ENABLE_WSTK_LEDS + if (mFunction != kFunction_FactoryReset) + { + if ((gIdentifyptr != nullptr) && (gIdentifyptr->mActive)) + { + sStatusLED.Blink(250, 250); + } + else if (sIdentifyEffect != EMBER_ZCL_IDENTIFY_EFFECT_IDENTIFIER_STOP_EFFECT) + { + if (sIdentifyEffect == EMBER_ZCL_IDENTIFY_EFFECT_IDENTIFIER_BLINK) + { + sStatusLED.Blink(50, 50); + } + if (sIdentifyEffect == EMBER_ZCL_IDENTIFY_EFFECT_IDENTIFIER_BREATHE) + { + sStatusLED.Blink(1000, 1000); + } + if (sIdentifyEffect == EMBER_ZCL_IDENTIFY_EFFECT_IDENTIFIER_OKAY) + { + sStatusLED.Blink(300, 700); + } + } +#if !(defined(CHIP_DEVICE_CONFIG_ENABLE_SED) && CHIP_DEVICE_CONFIG_ENABLE_SED) + else if (sIsProvisioned && sIsEnabled) + { + if (sIsAttached) + { + sStatusLED.Set(true); + } + else + { + sStatusLED.Blink(950, 50); + } + } + else if (sHaveBLEConnections) + { + sStatusLED.Blink(100, 100); + } + else + { + sStatusLED.Blink(50, 950); + } +#endif // CHIP_DEVICE_CONFIG_ENABLE_SED + } + + sStatusLED.Animate(); +#endif // ENABLE_WSTK_LEDS +} + +void BaseApplication::ButtonHandler(AppEvent * aEvent) +{ + // To trigger software update: press the APP_FUNCTION_BUTTON button briefly (< + // FACTORY_RESET_TRIGGER_TIMEOUT) To initiate factory reset: press the + // APP_FUNCTION_BUTTON for FACTORY_RESET_TRIGGER_TIMEOUT + + // FACTORY_RESET_CANCEL_WINDOW_TIMEOUT All LEDs start blinking after + // FACTORY_RESET_TRIGGER_TIMEOUT to signal factory reset has been initiated. + // To cancel factory reset: release the APP_FUNCTION_BUTTON once all LEDs + // start blinking within the FACTORY_RESET_CANCEL_WINDOW_TIMEOUT + if (aEvent->ButtonEvent.Action == SL_SIMPLE_BUTTON_PRESSED) + { + if (!mFunctionTimerActive && mFunction == kFunction_NoneSelected) + { + StartFunctionTimer(FACTORY_RESET_TRIGGER_TIMEOUT); + mFunction = kFunction_StartBleAdv; + } + } + else + { + // If the button was released before factory reset got initiated, start BLE advertissement in fast mode + if (mFunctionTimerActive && mFunction == kFunction_StartBleAdv) + { + CancelFunctionTimer(); + mFunction = kFunction_NoneSelected; + +#ifdef SL_WIFI + if (!ConnectivityMgr().IsWiFiStationProvisioned()) +#else + if (!ConnectivityMgr().IsThreadProvisioned()) +#endif /* !SL_WIFI */ + { + // Enable BLE advertisements + ConnectivityMgr().SetBLEAdvertisingEnabled(true); + ConnectivityMgr().SetBLEAdvertisingMode(ConnectivityMgr().kFastAdvertising); + } + else { SILABS_LOG("Network is already provisioned, Ble advertissement not enabled"); } + } + else if (mFunctionTimerActive && mFunction == kFunction_FactoryReset) + { + CancelFunctionTimer(); + +#if CHIP_DEVICE_CONFIG_ENABLE_SED == 1 + StopStatusLEDTimer(); +#endif + + // Change the function to none selected since factory reset has been + // canceled. + mFunction = kFunction_NoneSelected; + SILABS_LOG("Factory Reset has been Canceled"); + } + } } void BaseApplication::CancelFunctionTimer() @@ -338,6 +460,9 @@ void BaseApplication::StartStatusLEDTimer() void BaseApplication::StopStatusLEDTimer() { +#ifdef ENABLE_WSTK_LEDS + sStatusLED.Set(false); +#endif // ENABLE_WSTK_LEDS if (xTimerStop(sLightTimer, 100) != pdPASS) { diff --git a/examples/platform/silabs/SiWx917/LEDWidget.cpp b/examples/platform/silabs/SiWx917/LEDWidget.cpp index 10ffcac363520d..bb80fa3f9dfcd1 100644 --- a/examples/platform/silabs/SiWx917/LEDWidget.cpp +++ b/examples/platform/silabs/SiWx917/LEDWidget.cpp @@ -19,45 +19,32 @@ #include "LEDWidget.h" -extern "C" { -#include "sl_simple_led_instances.h" -} - #include using namespace ::chip::System; -void LEDWidget::InitGpio(void) -{ - // Sets gpio pin mode for ALL board Leds. - sl_simple_led_init_instances(); -} - -void LEDWidget::Init(const sl_led_t * led) +void LEDWidget::Init(int led) { mLastChangeTimeMS = 0; mBlinkOnTimeMS = 0; mBlinkOffTimeMS = 0; mLed = led; + mLedStatus = false; Set(false); } void LEDWidget::Invert(void) { - if (mLed) - { - sl_led_toggle(mLed); - } + RSI_Board_LED_Toggle(mLed); + mLedStatus = !mLedStatus; } void LEDWidget::Set(bool state) { mLastChangeTimeMS = mBlinkOnTimeMS = mBlinkOffTimeMS = 0; - if (mLed) - { - state ? sl_led_turn_on(mLed) : sl_led_turn_off(mLed); - } + state ? RSI_Board_LED_Set(mLed, true) : RSI_Board_LED_Set(mLed, false); + mLedStatus = state; } void LEDWidget::Blink(uint32_t changeRateMS) @@ -77,7 +64,7 @@ void LEDWidget::Animate() if (mBlinkOnTimeMS != 0 && mBlinkOffTimeMS != 0) { uint64_t nowMS = chip::System::SystemClock().GetMonotonicMilliseconds64().count(); - uint64_t stateDurMS = sl_led_get_state(mLed) ? mBlinkOnTimeMS : mBlinkOffTimeMS; + uint64_t stateDurMS = mLedStatus ? mBlinkOnTimeMS : mBlinkOffTimeMS; uint64_t nextChangeTimeMS = mLastChangeTimeMS + stateDurMS; if (nextChangeTimeMS < nowMS) diff --git a/examples/platform/silabs/SiWx917/LEDWidget.h b/examples/platform/silabs/SiWx917/LEDWidget.h index d779cb9d3ef4b6..44fb1937ee0f33 100644 --- a/examples/platform/silabs/SiWx917/LEDWidget.h +++ b/examples/platform/silabs/SiWx917/LEDWidget.h @@ -19,14 +19,16 @@ #pragma once -#include "sl_led.h" #include +extern "C" void RSI_Board_LED_Set(int, bool); +extern "C" void RSI_Board_LED_Toggle(int); +extern "C" bool RSI_Board_LED_GetState(int); + class LEDWidget { public: - static void InitGpio(void); - void Init(const sl_led_t * led); + void Init(int led); void Set(bool state); void Invert(void); void Blink(uint32_t changeRateMS); @@ -37,5 +39,7 @@ class LEDWidget uint64_t mLastChangeTimeMS; uint32_t mBlinkOnTimeMS; uint32_t mBlinkOffTimeMS; - const sl_led_t * mLed; + int mLed; + // created a temporary mLedStatus since Led status is not updating from the platform API(RSI_EGPIO_GetPin) + bool mLedStatus; }; diff --git a/examples/platform/silabs/SiWx917/OTAConfig.h b/examples/platform/silabs/SiWx917/OTAConfig.h index a4f8ac4369e175..cdd2163a10084e 100644 --- a/examples/platform/silabs/SiWx917/OTAConfig.h +++ b/examples/platform/silabs/SiWx917/OTAConfig.h @@ -22,7 +22,7 @@ #include #include #include -#include +#include class OTAConfig { diff --git a/examples/platform/silabs/SiWx917/SiWx917/hal/rsi_hal_mcu_m4.c b/examples/platform/silabs/SiWx917/SiWx917/hal/rsi_hal_mcu_m4.c new file mode 100644 index 00000000000000..87d998e0e0ddbb --- /dev/null +++ b/examples/platform/silabs/SiWx917/SiWx917/hal/rsi_hal_mcu_m4.c @@ -0,0 +1,302 @@ +/* + * + * Copyright (c) 2022 Project CHIP Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "rsi_board.h" +#include "rsi_chip.h" +#include "rsi_driver.h" +#include "rsi_m4.h" +#ifdef COMMON_FLASH_EN +#include "rsi_power_save.h" +#endif + +rsi_m4ta_desc_t tx_desc[2]; +rsi_m4ta_desc_t rx_desc[2]; + +uint8_t btn0 = 1; +uint8_t btn1 = 1; + +void sl_button_on_change(uint8_t btn, uint8_t btnAction); + +uint32_t NVIC_GetIRQEnable(IRQn_Type IRQn) +{ + return ((NVIC->ICER[((uint32_t)(IRQn) >> 5)] & (1 << ((uint32_t)(IRQn) &0x1F))) ? 1 : 0); +} + +void rsi_assertion(uint16_t assertion_val, const char * string) +{ + uint16_t i; + if (assertion_val == 0) + { + for (i = 0; i < strlen(string); i++) + { +#ifdef DEBUG_UART +#ifdef DEBUG_ASSERTION + Board_UARTPutChar(string[i]); +#endif +#endif + } + + return; + } + else + { + for (i = 0; i < strlen(string); i++) + { +#ifdef DEBUG_UART +#ifdef DEBUG_ASSERTION + Board_UARTPutChar(string[i]); +#endif +#endif + } + + while (1) + ; + } +} + +void IRQ074_Handler(void) +{ + ROM_WL_rsi_m4_interrupt_isr(global_cb_p); +} + +void IRQ021_Handler(void) +{ + // TODO: Replace with rsi_delay once that is fixed + for (int i = 0; i < 10000; i++) + __asm__("nop;"); + /* clear NPSS GPIO interrupt*/ + RSI_NPSSGPIO_ClrIntr(NPSS_GPIO_0_INTR); + RSI_NPSSGPIO_ClrIntr(NPSS_GPIO_2_INTR); + // if the btn is not pressed setting the state to 1 + if (RSI_NPSSGPIO_GetPin(NPSS_GPIO_2)) + { + btn1 = 1; + } + // geting the state of the gpio 2 pin and checking if the btn is already pressed or not + if (!RSI_NPSSGPIO_GetPin(NPSS_GPIO_2) && btn1) + { + btn1 = 0; + sl_button_on_change(1, 1); + } + if (RSI_NPSSGPIO_GetPin(NPSS_GPIO_0)) + { + btn0 = 1; + } + if (!RSI_NPSSGPIO_GetPin(NPSS_GPIO_0) && btn0) + { + btn0 = 0; + sl_button_on_change(0, 1); + } +} + +/*==============================================*/ +/** + * @fn void rsi_raise_pkt_pending_interrupt_to_ta() + * @brief This function raises the packet pending interrupt to TA + * @param[in] none + * @param[out] none + * @return none + * @section description + * This function raises the packet pending interrupt to TA + * + * + */ +void rsi_m4_ta_interrupt_init(void) +{ + //! Unmask the interrupt + unmask_ta_interrupt(TX_PKT_TRANSFER_DONE_INTERRUPT | RX_PKT_TRANSFER_DONE_INTERRUPT); + + P2P_STATUS_REG |= M4_is_active; + + *(volatile uint32_t *) 0xE000E108 = 0x00000400; + +#ifdef RSI_WITH_OS + //! Set P2P Intr priority + NVIC_SetPriority(TASS_P2P_IRQn, TASS_P2P_INTR_PRI); +#endif + + return; +} + +void mask_ta_interrupt(uint32_t interrupt_no) +{ +#ifdef ROM_WIRELESS + ROMAPI_WL->mask_ta_interrupt(interrupt_no); +#else + api_wl->mask_ta_interrupt(interrupt_no); +#endif +} + +void unmask_ta_interrupt(uint32_t interrupt_no) +{ +#ifdef ROM_WIRELESS + ROMAPI_WL->unmask_ta_interrupt(interrupt_no); +#else + api_wl->unmask_ta_interrupt(interrupt_no); +#endif +} + +int rsi_submit_rx_pkt(void) +{ +#ifdef ROM_WIRELESS + return ROMAPI_WL->rsi_submit_rx_pkt(global_cb_p); +#else + return api_wl->rsi_submit_rx_pkt(global_cb_p); +#endif +} + +/*====================================================*/ +/** + * @fn int16_t rsi_frame_read(uint8_t *pkt_buffer) + * @brief This function is used to read the response from module. + * @param[in] uint8_t *pkt_buffer, pointer to the buffer to which packet has to read + * which is used to store the response from the module + * @param[out] none + * @return errCode + * -1 = SPI busy / Timeout + * -2 = SPI Failure + * 0 = SUCCESS + * @section description + * This is a common function to read response for all the command and data from Wi-Fi module. + */ + +rsi_pkt_t * rsi_frame_read(void) +{ +#ifdef ROM_WIRELESS + return ROMAPI_WL->rsi_frame_read(global_cb_p); +#else + return api_wl->rsi_frame_read(global_cb_p); +#endif +} + +/*====================================================*/ +/** + * @fn int16_t rsi_frame_write(rsi_frame_desc_t *uFrameDscFrame,uint8_t *payloadparam,uint16_t size_param) + * @brief Common function for all the commands. + * @param[in] uFrameDsc uFrameDscFrame, frame descriptor + * @param[in] uint8_t *payloadparam, pointer to the command payload parameter structure + * @param[in] uint16_t size_param, size of the payload for the command + * @return errCode + * -1 = SPI busy / Timeout + * -2 = SPI Failure + * 0 = SUCCESS + * @section description + * This is a common function used to process a command to the Wi-Fi module. + */ + +int16_t rsi_frame_write(rsi_frame_desc_t * uFrameDscFrame, uint8_t * payloadparam, uint16_t size_param) +{ +#ifdef ROM_WIRELESS + return ROMAPI_WL->rsi_frame_write(global_cb_p, uFrameDscFrame, payloadparam, size_param); +#else + return api_wl->rsi_frame_write(global_cb_p, uFrameDscFrame, payloadparam, size_param); +#endif +} +/*==============================================*/ +/** + * @fn void rsi_update_tx_dma_desc(uint8 skip_dma_valid) + * @brief This function updates the TX DMA descriptor address + * @param[in] skip_dma_valid + * @param[out] none + * @return none + * @section description + * This function updates the TX DMA descriptor address + * + * + */ + +void rsi_update_tx_dma_desc(uint8_t skip_dma_valid) +{ + if (!skip_dma_valid) + { +#ifdef COMMON_FLASH_EN + if (!(M4_ULP_SLP_STATUS_REG & MCU_ULP_WAKEUP)) +#endif + { + while (M4_TX_DMA_DESC_REG & DMA_DESC_REG_VALID) + ; + } + } + M4_TX_DMA_DESC_REG = (uint32_t) &tx_desc; +} + +/*==============================================*/ +/** + * @fn void rsi_update_rx_dma_desc() + * @brief This function updates the RX DMA descriptor address + * @param[in] none + * @param[out] none + * @return none + * @section description + * This function updates the RX DMA descriptor address + * + * + */ +void rsi_update_rx_dma_desc(void) +{ + M4_RX_DMA_DESC_REG = (uint32_t) &rx_desc; +} + +/*==============================================*/ +/** + * @fn void rsi_config_m4_dma_desc_on_reset() + * @brief This function updates the RX DMA and TX DMA descriptor address after reset + * @param[in] none + * @param[out] none + * @return none + * @section description + * This function updates the RX DMA and TX DMA descriptor address + * + * + */ +void rsi_config_m4_dma_desc_on_reset(void) +{ + //! Wait for TA to go to sleep + while (P2P_STATUS_REG & TA_is_active) + ; + //! Wait for TA to wakeup and should be in bootloader + while (!(P2P_STATUS_REG & TA_is_active)) + ; + //! UPdate M4 TX and RX dma descriptors + M4_TX_DMA_DESC_REG = (uint32_t) &tx_desc; + M4_RX_DMA_DESC_REG = (uint32_t) &rx_desc; +} + +/*==================================================*/ +/** + * @fn int16_t rsi_device_interrupt_status(uint8_t *int_status) + * @brief Returns the value of the Interrupt register + * @param[in] status + * @param[out] buffer full status reg value + * @return errorcode + * 0 = Success + * -2 = Reg read failure + */ +int16_t rsi_device_interrupt_status(uint8_t * int_status) +{ + + //! Check for TA active .If it is not active Buffer full status is not valid, + //! SO return fail from here + if (!(P2P_STATUS_REG & TA_is_active)) + { + return RSI_FAIL; + } + //! copy buffer full status reg value + *int_status = (uint8_t) HOST_INTR_STATUS_REG; + + return RSI_SUCCESS; +} diff --git a/examples/platform/silabs/SiWx917/SiWx917/hal/rsi_hal_mcu_platform_init.c b/examples/platform/silabs/SiWx917/SiWx917/hal/rsi_hal_mcu_platform_init.c index b2effb5997f388..1cf672c1508dc1 100644 --- a/examples/platform/silabs/SiWx917/SiWx917/hal/rsi_hal_mcu_platform_init.c +++ b/examples/platform/silabs/SiWx917/SiWx917/hal/rsi_hal_mcu_platform_init.c @@ -27,7 +27,7 @@ #define SOC_PLL_REF_FREQUENCY 32000000 /* PLL input REFERENCE clock 32MHZ */ // Note: Change this macro to required PLL frequency in hertz -#define PS4_SOC_FREQ 80000000 /* PLL out clock 80MHz */ +#define PS4_SOC_FREQ 180000000 /* PLL out clock 180MHz */ #define SWITCH_QSPI_TO_SOC_PLL #define ICACHE_DISABLE #define DEBUG_DISABLE @@ -83,6 +83,80 @@ int soc_pll_config(void) return 0; } +/*==============================================*/ +/** + * @fn void RSI_Wakeupsw_config() + * @brief This function Initializes the platform + * @param[in] none + * @param[out] none + * @return none + * @section description + * This function initializes the platform + * + */ +void RSI_Wakeupsw_config(void) +{ + /*Enable the REN*/ + RSI_NPSSGPIO_InputBufferEn(NPSS_GPIO_2, 1); + + /*Configure the NPSS GPIO mode to wake up */ + RSI_NPSSGPIO_SetPinMux(NPSS_GPIO_2, 2); + + /*Configure the NPSS GPIO direction to input */ + RSI_NPSSGPIO_SetDir(NPSS_GPIO_2, NPSS_GPIO_DIR_OUTPUT); + + /* Enables rise edge interrupt detection for UULP_VBAT_GPIO_0 */ + RSI_NPSSGPIO_SetIntLevelLowEnable(NPSS_GPIO_2_INTR); + + /* Un mask the NPSS GPIO interrupt*/ + RSI_NPSSGPIO_IntrUnMask(NPSS_GPIO_2_INTR); + + /*Select wake up sources */ + RSI_PS_SetWkpSources(GPIO_BASED_WAKEUP); + + /* clear NPSS GPIO interrupt*/ + RSI_NPSSGPIO_ClrIntr(NPSS_GPIO_2_INTR); + + /*Enable the NPSS GPIO interrupt slot*/ + NVIC_EnableIRQ(21); + + NVIC_SetPriority(21, 7); +} + +void RSI_Wakeupsw_config_gpio0(void) +{ + /*Configure the NPSS GPIO mode to wake up */ + RSI_NPSSGPIO_SetPinMux(NPSS_GPIO_0, NPSSGPIO_PIN_MUX_MODE2); + + /*Configure the NPSS GPIO direction to input */ + RSI_NPSSGPIO_SetDir(NPSS_GPIO_0, NPSS_GPIO_DIR_INPUT); + + /*Configure the NPSS GPIO interrupt polarity */ + RSI_NPSSGPIO_SetPolarity(NPSS_GPIO_0, NPSS_GPIO_INTR_HIGH); + + /*Enable the REN*/ + RSI_NPSSGPIO_InputBufferEn(NPSS_GPIO_0, 1); + + /* Set the GPIO to wake from deep sleep */ + RSI_NPSSGPIO_SetWkpGpio(NPSS_GPIO_0_INTR); + + /* Enables rise edge interrupt detection for UULP_VBAT_GPIO_0 */ + RSI_NPSSGPIO_SetIntLevelLowEnable(NPSS_GPIO_0_INTR); + + /* Un mask the NPSS GPIO interrupt*/ + RSI_NPSSGPIO_IntrUnMask(NPSS_GPIO_0_INTR); + + /*Select wake up sources */ + RSI_PS_SetWkpSources(GPIO_BASED_WAKEUP); + + /* clear NPSS GPIO interrupt*/ + RSI_NPSSGPIO_ClrIntr(NPSS_GPIO_0_INTR); + + // 21 being the NPSS_TO_MCU_GPIO_INTR_IRQn + NVIC_EnableIRQ(21); + NVIC_SetPriority(21, 7); +} + /*==============================================*/ /** * @fn void rsi_hal_board_init() @@ -98,6 +172,9 @@ void rsi_hal_board_init(void) { SystemCoreClockUpdate(); + // initialize the LED pins + RSI_Board_Init(); + /* configure clock for SiWx917 SoC */ soc_pll_config(); SILABS_LOG("%s, soc_pll_config, SystemCoreClock=%d\n", __func__, SystemCoreClock); diff --git a/examples/platform/silabs/SiWx917/SiWx917/rs911x.gni b/examples/platform/silabs/SiWx917/SiWx917/rs911x.gni index 0cca17540074ab..7730c98efc5bd8 100644 --- a/examples/platform/silabs/SiWx917/SiWx917/rs911x.gni +++ b/examples/platform/silabs/SiWx917/SiWx917/rs911x.gni @@ -14,9 +14,9 @@ rs911x_src_plat = [ "${examples_plat_dir}/SiWx917/hal/rsi_hal_mcu_timer.c", "${examples_plat_dir}/SiWx917/hal/rsi_hal_mcu_platform_init.c", + "${examples_plat_dir}/SiWx917/hal/rsi_hal_mcu_m4.c", "${wiseconnect_sdk_root}/platforms/si91x/hal/src/rsi_bootup_config.c", - "${wiseconnect_sdk_root}/platforms/si91x/hal/src/rsi_hal_mcu_m4.c", "${wiseconnect_sdk_root}/platforms/si91x/hal/src/rsi_hal_mcu_m4_rom.c", "${wiseconnect_sdk_root}/platforms/si91x/hal/src/rsi_hal_mcu_interrupt.c", ] diff --git a/examples/platform/silabs/SiWx917/init_ccpPlatform.cpp b/examples/platform/silabs/SiWx917/init_ccpPlatform.cpp index 0d5bb78bea9e7c..3723d72f090c5b 100644 --- a/examples/platform/silabs/SiWx917/init_ccpPlatform.cpp +++ b/examples/platform/silabs/SiWx917/init_ccpPlatform.cpp @@ -33,9 +33,16 @@ extern "C" { void initAntenna(void); +/* GPIO button config */ +void RSI_Wakeupsw_config(void); +void RSI_Wakeupsw_config_gpio0(void); + void init_ccpPlatform(void) { + RSI_Wakeupsw_config(); + + RSI_Wakeupsw_config_gpio0(); #if SILABS_LOG_ENABLED silabsInitLog(); #endif diff --git a/examples/platform/silabs/efr32/BUILD.gn b/examples/platform/silabs/efr32/BUILD.gn index a6106d3ac94c73..7ae3c82e428991 100644 --- a/examples/platform/silabs/efr32/BUILD.gn +++ b/examples/platform/silabs/efr32/BUILD.gn @@ -55,7 +55,7 @@ assert(!(use_wf200 && chip_enable_openthread)) if (chip_enable_wifi) { assert(use_rs911x || use_wf200) enable_openthread_cli = false - import("${chip_root}/src/platform/silabs/EFR32/wifi_args.gni") + import("${chip_root}/src/platform/silabs/efr32/wifi_args.gni") if (use_rs911x) { wiseconnect_sdk_root = diff --git a/examples/platform/silabs/efr32/OTAConfig.h b/examples/platform/silabs/efr32/OTAConfig.h index a4f8ac4369e175..cdd2163a10084e 100644 --- a/examples/platform/silabs/efr32/OTAConfig.h +++ b/examples/platform/silabs/efr32/OTAConfig.h @@ -22,7 +22,7 @@ #include #include #include -#include +#include class OTAConfig { diff --git a/examples/platform/silabs/efr32/matter_config.cpp b/examples/platform/silabs/efr32/matter_config.cpp index 942f19c57ad91e..ecce0c8a0457d9 100644 --- a/examples/platform/silabs/efr32/matter_config.cpp +++ b/examples/platform/silabs/efr32/matter_config.cpp @@ -49,7 +49,7 @@ using namespace ::chip::DeviceLayer; // If building with the EFR32-provided crypto backend, we can use the // opaque keystore #if CHIP_CRYPTO_PLATFORM -#include +#include static chip::DeviceLayer::Internal::Efr32PsaOperationalKeystore gOperationalKeystore; #endif diff --git a/examples/platform/silabs/efr32/rs911x/rs911x.gni b/examples/platform/silabs/efr32/rs911x/rs911x.gni index 40e6412cc8648a..0c305ce810abd1 100644 --- a/examples/platform/silabs/efr32/rs911x/rs911x.gni +++ b/examples/platform/silabs/efr32/rs911x/rs911x.gni @@ -1,7 +1,7 @@ import("//build_overrides/chip.gni") examples_plat_dir = "${chip_root}/examples/platform/silabs/efr32" -wifi_sdk_dir = "${chip_root}/src/platform/silabs/EFR32/wifi" +wifi_sdk_dir = "${chip_root}/src/platform/silabs/efr32/wifi" wiseconnect_sdk_root = "${chip_root}/third_party/silabs/wiseconnect-wifi-bt-sdk" rs911x_src_plat = [ diff --git a/examples/platform/silabs/efr32/wf200/wf200.gni b/examples/platform/silabs/efr32/wf200/wf200.gni index 2c0ac803c3c443..372b1d0c8f3b31 100644 --- a/examples/platform/silabs/efr32/wf200/wf200.gni +++ b/examples/platform/silabs/efr32/wf200/wf200.gni @@ -1,7 +1,7 @@ import("//build_overrides/chip.gni") examples_plat_dir = "${chip_root}/examples/platform/silabs/efr32" -wifi_sdk_dir = "${chip_root}/src/platform/silabs/EFR32/wifi" +wifi_sdk_dir = "${chip_root}/src/platform/silabs/efr32/wifi" wf200_plat_incs = [ "${examples_plat_dir}/wf200" ] wf200_plat_src = [ diff --git a/examples/thermostat/linux/BUILD.gn b/examples/thermostat/linux/BUILD.gn index 2d1d13374a9dc1..89d24bff8a0835 100644 --- a/examples/thermostat/linux/BUILD.gn +++ b/examples/thermostat/linux/BUILD.gn @@ -36,3 +36,7 @@ executable("thermostat-app") { group("linux") { deps = [ ":thermostat-app" ] } + +group("default") { + deps = [ ":linux" ] +} diff --git a/examples/thermostat/silabs/efr32/BUILD.gn b/examples/thermostat/silabs/efr32/BUILD.gn index 02efb6b8bc3e7e..c67e7f005014c8 100644 --- a/examples/thermostat/silabs/efr32/BUILD.gn +++ b/examples/thermostat/silabs/efr32/BUILD.gn @@ -53,7 +53,7 @@ efr32_sdk("sdk") { ] include_dirs = [ - "${chip_root}/src/platform/silabs/EFR32", + "${chip_root}/src/platform/silabs/efr32", "${efr32_project_dir}/include", "${examples_plat_dir}", "${chip_root}/src/lib", diff --git a/examples/thermostat/silabs/efr32/args.gni b/examples/thermostat/silabs/efr32/args.gni index 542ac00f3e41b2..938707c94a4f81 100644 --- a/examples/thermostat/silabs/efr32/args.gni +++ b/examples/thermostat/silabs/efr32/args.gni @@ -14,7 +14,7 @@ import("//build_overrides/chip.gni") import("${chip_root}/config/standalone/args.gni") -import("${chip_root}/src/platform/silabs/EFR32/args.gni") +import("${chip_root}/src/platform/silabs/efr32/args.gni") efr32_sdk_target = get_label_info(":sdk", "label_no_toolchain") diff --git a/examples/thermostat/silabs/efr32/build_for_wifi_args.gni b/examples/thermostat/silabs/efr32/build_for_wifi_args.gni index 0124f6a2f0f455..e284ff4ec53d63 100644 --- a/examples/thermostat/silabs/efr32/build_for_wifi_args.gni +++ b/examples/thermostat/silabs/efr32/build_for_wifi_args.gni @@ -16,7 +16,7 @@ import("${chip_root}/config/standalone/args.gni") efr32_sdk_target = get_label_info(":sdk", "label_no_toolchain") chip_enable_openthread = false -import("${chip_root}/src/platform/silabs/EFR32/wifi_args.gni") +import("${chip_root}/src/platform/silabs/efr32/wifi_args.gni") chip_enable_ota_requestor = true app_data_model = "${chip_root}/examples/thermostat/thermostat-common" diff --git a/examples/tv-app/linux/BUILD.gn b/examples/tv-app/linux/BUILD.gn index 945473c835c1b4..6485f72d9b05dd 100644 --- a/examples/tv-app/linux/BUILD.gn +++ b/examples/tv-app/linux/BUILD.gn @@ -94,3 +94,7 @@ executable("chip-tv-app") { group("linux") { deps = [ ":chip-tv-app" ] } + +group("default") { + deps = [ ":linux" ] +} diff --git a/examples/tv-casting-app/linux/BUILD.gn b/examples/tv-casting-app/linux/BUILD.gn index df8cac35cd5a3d..0f6f12c50dd022 100644 --- a/examples/tv-casting-app/linux/BUILD.gn +++ b/examples/tv-casting-app/linux/BUILD.gn @@ -54,3 +54,7 @@ executable("chip-tv-casting-app") { group("linux") { deps = [ ":chip-tv-casting-app" ] } + +group("default") { + deps = [ ":linux" ] +} diff --git a/examples/window-app/silabs/SiWx917/BUILD.gn b/examples/window-app/silabs/SiWx917/BUILD.gn index 007831481970b7..1aa89a1e00be5a 100644 --- a/examples/window-app/silabs/SiWx917/BUILD.gn +++ b/examples/window-app/silabs/SiWx917/BUILD.gn @@ -193,7 +193,7 @@ efr32_executable("window_app") { ] if (use_wstk_leds) { - #sources += [ "${examples_plat_dir}/LEDWidget.cpp" ] + sources += [ "${examples_plat_dir}/LEDWidget.cpp" ] } if (chip_build_libshell || enable_openthread_cli || use_wf200 || use_rs911x) { diff --git a/examples/window-app/silabs/SiWx917/include/WindowAppImpl.h b/examples/window-app/silabs/SiWx917/include/WindowAppImpl.h index 86158e3d4da14b..a486de4f5dcb08 100644 --- a/examples/window-app/silabs/SiWx917/include/WindowAppImpl.h +++ b/examples/window-app/silabs/SiWx917/include/WindowAppImpl.h @@ -21,7 +21,6 @@ #ifdef ENABLE_WSTK_LEDS #include "LEDWidget.h" -#include "sl_simple_led_instances.h" #endif // ENABLE_WSTK_LEDS #include diff --git a/examples/window-app/silabs/SiWx917/src/WindowAppImpl.cpp b/examples/window-app/silabs/SiWx917/src/WindowAppImpl.cpp index 8cb6774f9d8da4..a0582a4dd6e4f8 100644 --- a/examples/window-app/silabs/SiWx917/src/WindowAppImpl.cpp +++ b/examples/window-app/silabs/SiWx917/src/WindowAppImpl.cpp @@ -32,9 +32,6 @@ #include #endif // QR_CODE_ENABLED -#ifdef ENABLE_WSTK_LEDS -#include -#endif // ENABLE_WSTK_LEDS extern "C" void sl_button_on_change(); #ifdef SL_WIFI @@ -58,8 +55,8 @@ SilabsLCD slLCD; using namespace chip::app::Clusters::WindowCovering; using namespace chip; using namespace ::chip::DeviceLayer; -#define APP_STATE_LED &sl_led_led0 -#define APP_ACTION_LED &sl_led_led1 +#define APP_STATE_LED 0 +#define APP_ACTION_LED 1 #ifdef SL_WIFI chip::app::Clusters::NetworkCommissioning::Instance @@ -207,7 +204,6 @@ CHIP_ERROR WindowAppImpl::Init() // Initialize LEDs #ifdef ENABLE_WSTK_LEDS - LEDWidget::InitGpio(); mStatusLED.Init(APP_STATE_LED); mActionLED.Init(APP_ACTION_LED); #endif // ENABLE_WSTK_LEDS diff --git a/examples/window-app/silabs/efr32/BUILD.gn b/examples/window-app/silabs/efr32/BUILD.gn index 7bc1bc4133727f..13adc95ad89414 100644 --- a/examples/window-app/silabs/efr32/BUILD.gn +++ b/examples/window-app/silabs/efr32/BUILD.gn @@ -43,7 +43,7 @@ efr32_sdk("sdk") { ] include_dirs = [ - "${chip_root}/src/platform/silabs/EFR32", + "${chip_root}/src/platform/silabs/efr32", "${efr32_project_dir}/include", "${examples_plat_dir}", "${chip_root}/src/lib", diff --git a/examples/window-app/silabs/efr32/args.gni b/examples/window-app/silabs/efr32/args.gni index 979b3fda6ce2dd..1631579c3da2d6 100644 --- a/examples/window-app/silabs/efr32/args.gni +++ b/examples/window-app/silabs/efr32/args.gni @@ -14,7 +14,7 @@ import("//build_overrides/chip.gni") import("${chip_root}/config/standalone/args.gni") -import("${chip_root}/src/platform/silabs/EFR32/args.gni") +import("${chip_root}/src/platform/silabs/efr32/args.gni") efr32_sdk_target = get_label_info(":sdk", "label_no_toolchain") diff --git a/examples/window-app/silabs/efr32/build_for_wifi_args.gni b/examples/window-app/silabs/efr32/build_for_wifi_args.gni index 0110df318f0955..1b86ebd8007bc8 100644 --- a/examples/window-app/silabs/efr32/build_for_wifi_args.gni +++ b/examples/window-app/silabs/efr32/build_for_wifi_args.gni @@ -15,7 +15,7 @@ import("//build_overrides/chip.gni") efr32_sdk_target = get_label_info(":sdk", "label_no_toolchain") chip_enable_openthread = false -import("${chip_root}/src/platform/silabs/EFR32/wifi_args.gni") +import("${chip_root}/src/platform/silabs/efr32/wifi_args.gni") chip_enable_ota_requestor = true app_data_model = "${chip_root}/examples/window-app/common:window-common" diff --git a/scripts/rules.matterlint b/scripts/rules.matterlint index 21609bd813f5ca..6ff42137e757d3 100644 --- a/scripts/rules.matterlint +++ b/scripts/rules.matterlint @@ -92,7 +92,7 @@ endpoint 0 { // Identifiers for clusters are loaded from XML files // The required clusters are from the spec for RootNode (section 2.1.5 at the moment): - require server cluster Basic; + require server cluster BasicInformation; require server cluster AccessControl; require server cluster GroupKeyManagement; require server cluster GeneralCommissioning; diff --git a/scripts/tests/chiptest/__init__.py b/scripts/tests/chiptest/__init__.py index aecdf0cf0336f2..eefdee8012e6d0 100644 --- a/scripts/tests/chiptest/__init__.py +++ b/scripts/tests/chiptest/__init__.py @@ -22,7 +22,7 @@ from typing import Iterator, Set from . import linux, runner -from .test_definition import ApplicationPaths, TestDefinition, TestTarget +from .test_definition import ApplicationPaths, TestDefinition, TestRunTime, TestTag, TestTarget _DEFAULT_CHIP_ROOT = os.path.abspath( os.path.join(os.path.dirname(__file__), "..", "..", "..")) @@ -39,60 +39,43 @@ class ManualTest: INVALID_TESTS = { "tests.yaml", # certification/tests.yaml is not a real test "PICS.yaml", # certification/PICS.yaml is not a real test + + # The items below are examples and will never work (likely) + # completely exclude them + "Config_Example.yaml", + "Config_Variables_Example.yaml", + "PICS_Example.yaml", + "Response_Example.yaml", + "Test_Example.yaml", } -def _LoadManualTestsJson(json_file_path: str) -> Iterator[ManualTest]: +def _IsValidYamlTest(name: str) -> bool: + """Check if the given file name is a valid YAML test. + + This returns invalid for examples, simulated and other specific tests. + """ + + # Simulated tests are not runnable by repl tests, need + # separate infrastructure. Exclude them completely (they are + # not even manual) + if name.endswith('_Simulated.yaml'): + return False + + return name not in INVALID_TESTS + + +def _LoadManualTestsJson(json_file_path: str) -> Iterator[str]: with open(json_file_path, 'rt') as f: data = json.load(f) for c in data["collection"]: for name in data[c]: - yield ManualTest(yaml="%s.yaml" % name, reason=json_file_path) + yield f"{name}.yaml" -def _GetManualTests() -> Set[ManualTest]: +def _GetManualTests() -> Set[str]: manualtests = set() - # TODO: - # - # These are NOT manual tests, but rather "tests that fail in yaml and - # for this reason are marked as manual". - # - # We are working to get this list down to 0. - manualtests.add(ManualTest(yaml="Test_TC_ACL_2_10.yaml", reason="TODO Event Not Supported Yet")) - manualtests.add(ManualTest(yaml="Test_TC_ACL_2_7.yaml", reason="TODO Event Not Supported Yet")) - manualtests.add(ManualTest(yaml="Test_TC_ACL_2_8.yaml", reason="TODO Event Not Supported Yet")) - manualtests.add(ManualTest(yaml="Test_TC_ACL_2_9.yaml", reason="TODO Event Not Supported Yet")) - manualtests.add(ManualTest(yaml="TestEvents.yaml", reason="TODO Event Not Supported Yet")) - - manualtests.add(ManualTest(yaml="Test_TC_ACE_1_1.yaml", reason="TODO GetCommissionerNodeId Not Supported Yet")) - manualtests.add(ManualTest(yaml="Test_TC_ACE_1_5.yaml", reason="TODO GetCommissionerNodeId Not Supported Yet")) - manualtests.add(ManualTest(yaml="Test_TC_SC_5_1.yaml", reason="TODO GetCommissionerNodeId Not Supported Yet")) - manualtests.add(ManualTest(yaml="Test_TC_SC_5_2.yaml", reason="TODO GetCommissionerNodeId Not Supported Yet")) - manualtests.add(ManualTest(yaml="TestCommissionerNodeId.yaml", reason="TODO GetCommissionerNodeId Not Supported Yet")) - - manualtests.add(ManualTest(yaml="TestClusterMultiFabric.yaml", reason="TODO Enum Mismatch")) - manualtests.add(ManualTest(yaml="TestGroupMessaging.yaml", reason="TODO Group Message Not Supported in chip-repl yet")) - manualtests.add(ManualTest(yaml="TestMultiAdmin.yaml", reason="TODO chip-repl hangs on command expected to fail")) - - # Failing, unclear why. Likely repl specific, used to pass however first - # failure point seems unrelated. Historically this seems (very?) flaky - # in repl. - manualtests.add(ManualTest(yaml="Test_TC_OO_2_4.yaml", reason="Flaky")) - - # Examples: - # - # Currently these are not in ciTests.json, however yaml logic currently - # does NOT use allowlist json but rather finds all yaml files. - # - # This is on purpose for now to make it harder to orphan files, however - # we can reconsider as things evolve. - manualtests.add(ManualTest(yaml="Config_Example.yaml", reason="Example")) - manualtests.add(ManualTest(yaml="Config_Variables_Example.yaml", reason="Example")) - manualtests.add(ManualTest(yaml="PICS_Example.yaml", reason="Example")) - manualtests.add(ManualTest(yaml="Response_Example.yaml", reason="Example")) - manualtests.add(ManualTest(yaml="Test_Example.yaml", reason="Example")) - # Flagged as manual from: src/app/tests/suites/manualTests.json for item in _LoadManualTestsJson(os.path.join(_YAML_TEST_SUITE_PATH, "manualTests.json")): manualtests.add(item) @@ -100,6 +83,74 @@ def _GetManualTests() -> Set[ManualTest]: return manualtests +def _GetFlakyTests() -> Set[str]: + """List of flaky tests, ideally this list should become empty.""" + return { + "Test_TC_OO_2_4.yaml" + } + + +def _GetSlowTests() -> Set[str]: + """Generally tests using sleep() a bit too freely. + + 10s seems like a good threshold to consider something slow + """ + return { + "DL_LockUnlock.yaml", # ~ 10 seconds + "TestSubscribe_AdministratorCommissioning.yaml", # ~ 15 seconds + "Test_TC_CC_5_1.yaml", # ~ 30 seconds + "Test_TC_CC_5_2.yaml", # ~ 30 seconds + "Test_TC_CC_5_3.yaml", # ~ 25 seconds + "Test_TC_CC_6_1.yaml", # ~ 35 seconds + "Test_TC_CC_6_2.yaml", # ~ 60 seconds + "Test_TC_CC_6_3.yaml", # ~ 50 seconds + "Test_TC_CC_7_2.yaml", # ~ 65 seconds + "Test_TC_CC_7_3.yaml", # ~ 70 seconds + "Test_TC_CC_7_4.yaml", # ~ 25 seconds + "Test_TC_CC_8_1.yaml", # ~ 60 seconds + "Test_TC_DRLK_2_4.yaml", # ~ 60 seconds + "Test_TC_I_2_2.yaml", # ~ 15 seconds + "Test_TC_LVL_3_1.yaml", # ~ 35 seconds + "Test_TC_LVL_4_1.yaml", # ~ 55 seconds + "Test_TC_LVL_5_1.yaml", # ~ 35 seconds + "Test_TC_LVL_6_1.yaml", # ~ 10 seconds + "Test_TC_WNCV_3_1.yaml", # ~ 20 seconds + "Test_TC_WNCV_3_2.yaml", # ~ 20 seconds + "Test_TC_WNCV_3_3.yaml", # ~ 15 seconds + "Test_TC_WNCV_3_4.yaml", # ~ 10 seconds + "Test_TC_WNCV_3_5.yaml", # ~ 10 seconds + "Test_TC_WNCV_4_1.yaml", # ~ 20 seconds + "Test_TC_WNCV_4_2.yaml", # ~ 20 seconds + "Test_TC_WNCV_4_5.yaml", # ~ 12 seconds + } + + +def _GetInDevelopmentTests() -> Set[str]: + """Tests that fail in YAML for some reason. + + Goal is for this set to become empty. + """ + return { + # TODO: Event not yet supported: + "Test_TC_ACL_2_10.yaml", + "Test_TC_ACL_2_7.yaml", + "Test_TC_ACL_2_8.yaml", + "Test_TC_ACL_2_9.yaml", + "TestEvents.yaml", + + # TODO: CommissionerNodeId not yet supported: + "Test_TC_ACE_1_1.yaml", + "Test_TC_ACE_1_5.yaml", + "Test_TC_SC_5_1.yaml", + "Test_TC_SC_5_2.yaml", + "TestCommissionerNodeId.yaml", + + "TestClusterMultiFabric.yaml", # Enum mismatch + "TestGroupMessaging.yaml", # Needs group support in repl + "TestMultiAdmin.yaml", # chip-repl hang on command expeted to fail + } + + def _AllYamlTests(): yaml_test_suite_path = Path(_YAML_TEST_SUITE_PATH) @@ -111,12 +162,6 @@ def _AllYamlTests(): if not path.is_file(): continue - if path.name.endswith('_Simulated.yaml'): - # Simulated tests are not runnable by repl tests, need - # separate infrastructure. Exclude theml completely (they are - # not even manual) - continue - yield path @@ -142,6 +187,10 @@ def tests_with_command(chip_tool: str, is_manual: bool): result = subprocess.run([chip_tool, "tests", cmd], capture_output=True) + test_tags = set() + if is_manual: + test_tags.add(TestTag.MANUAL) + for name in result.stdout.decode("utf8").split("\n"): if not name: continue @@ -149,34 +198,49 @@ def tests_with_command(chip_tool: str, is_manual: bool): target = target_for_name(name) yield TestDefinition( - run_name=name, name=name, target=target, is_manual=is_manual + run_name=name, name=name, target=target, tags=test_tags ) # TODO We will move away from hardcoded list of yamltests to run all file when yamltests # parser/runner reaches parity with the code gen version. def _hardcoded_python_yaml_tests(): - manual_tests = set([b.yaml for b in _GetManualTests()]) + manual_tests = _GetManualTests() + flaky_tests = _GetFlakyTests() + slow_tests = _GetSlowTests() + in_development_tests = _GetInDevelopmentTests() for path in _AllYamlTests(): - if path.name in INVALID_TESTS: + if not _IsValidYamlTest(path.name): continue + tags = set() + if path.name in manual_tests: + tags.add(TestTag.MANUAL) + + if path.name in flaky_tests: + tags.add(TestTag.FLAKY) + + if path.name in slow_tests: + tags.add(TestTag.SLOW) + + if path.name in in_development_tests: + tags.add(TestTag.IN_DEVELOPMENT) + yield TestDefinition( run_name=str(path), name=path.stem, # `path.stem` converts "some/path/Test_ABC_1.2.yaml" to "Test_ABC.1.2" target=target_for_name(path.name), - is_manual=path.name in manual_tests, - use_chip_repl_yaml_tester=True + tags=tags, ) -def AllTests(chip_tool: str, run_yamltests_with_chip_repl: bool): - if run_yamltests_with_chip_repl: - for test in _hardcoded_python_yaml_tests(): - yield test - return +def AllYamlTests(): + for test in _hardcoded_python_yaml_tests(): + yield test + +def AllChipToolTests(chip_tool: str): for test in tests_with_command(chip_tool, is_manual=False): yield test diff --git a/scripts/tests/chiptest/test_definition.py b/scripts/tests/chiptest/test_definition.py index 6cbfe2abc0c0e2..52238719e7a211 100644 --- a/scripts/tests/chiptest/test_definition.py +++ b/scripts/tests/chiptest/test_definition.py @@ -19,7 +19,7 @@ import threading import time import typing -from dataclasses import dataclass +from dataclasses import dataclass, field from datetime import datetime from enum import Enum, auto from random import randrange @@ -210,15 +210,48 @@ def LogContents(self): logging.error('================ CAPTURED LOG END ====================') +class TestTag(Enum): + MANUAL = auto() # requires manual input. Generally not run automatically + SLOW = auto() # test uses Sleep and is generally slow (>=10s is a typical threshold) + FLAKY = auto() # test is considered flaky (usually a bug/time dependent issue) + IN_DEVELOPMENT = auto() # test may not pass or undergoes changes + + def to_s(self): + for (k, v) in TestTag.__members__.items(): + if self == v: + return k + raise Exception("Unknown tag: %r" % self) + + +class TestRunTime(Enum): + CHIP_TOOL_BUILTIN = auto() # run via chip-tool built-in test commands + PYTHON_YAML = auto() # use the python yaml test runner + + @dataclass class TestDefinition: name: str run_name: str target: TestTarget - is_manual: bool - use_chip_repl_yaml_tester: bool = False + tags: typing.Set[TestTag] = field(default_factory=set) + + @property + def is_manual(self) -> bool: + return TestTag.MANUAL in self.tags + + @property + def is_slow(self) -> bool: + return TestTag.SLOW in self.tags + + @property + def is_flaky(self) -> bool: + return TestTag.FLAKY in self.tags + + def tags_str(self) -> str: + """Get a human readable list of tags applied to this test""" + return ", ".join([t.to_s() for t in self.tags]) - def Run(self, runner, apps_register, paths: ApplicationPaths, pics_file: str, timeout_seconds: typing.Optional[int], dry_run=False): + def Run(self, runner, apps_register, paths: ApplicationPaths, pics_file: str, timeout_seconds: typing.Optional[int], dry_run=False, test_runtime: TestRunTime = TestRunTime.CHIP_TOOL_BUILTIN): """ Executes the given test case using the provided runner for execution. """ @@ -280,7 +313,7 @@ def Run(self, runner, apps_register, paths: ApplicationPaths, pics_file: str, ti if dry_run: logging.info(" ".join(pairing_cmd)) logging.info(" ".join(test_cmd)) - elif self.use_chip_repl_yaml_tester: + elif test_runtime == TestRunTime.PYTHON_YAML: chip_repl_yaml_tester_cmd = paths.chip_repl_yaml_tester_cmd python_cmd = chip_repl_yaml_tester_cmd + \ ['--setup-code', app.setupCode] + ['--yaml-path', self.run_name] + ["--pics-file", pics_file] diff --git a/scripts/tests/run_test_suite.py b/scripts/tests/run_test_suite.py index 3984e641fbcd9d..ba3deb1899f112 100755 --- a/scripts/tests/run_test_suite.py +++ b/scripts/tests/run_test_suite.py @@ -20,7 +20,7 @@ import sys import time import typing -from dataclasses import dataclass +from dataclasses import dataclass, field from pathlib import Path import chiptest @@ -28,6 +28,7 @@ import coloredlogs from chiptest.accessories import AppsRegister from chiptest.glob_matcher import GlobMatcher +from chiptest.test_definition import TestRunTime, TestTag DEFAULT_CHIP_ROOT = os.path.abspath( os.path.join(os.path.dirname(__file__), '..', '..')) @@ -67,7 +68,13 @@ class RunContext: in_unshare: bool chip_tool: str dry_run: bool - manual_handling: ManualHandling + runtime: TestRunTime + + # If not empty, include only the specified test tags + include_tags: set(TestTag) = field(default_factory={}) + + # If not empty, exclude tests tagged with these tags + exclude_tags: set(TestTag) = field(default_factory={}) @click.group(chain=True) @@ -114,11 +121,16 @@ class RunContext: help='Internal flag for running inside a unshared environment' ) @click.option( - '--manual', - type=click.Choice(['skip', 'only', 'include'], case_sensitive=False), - default='skip', - show_default=True, - help='Internal flag to determine how to handle manual tests. ONLY for "all" test choice.', + '--include-tags', + type=click.Choice(TestTag.__members__.keys(), case_sensitive=False), + multiple=True, + help='What test tags to include when running. Equivalent to "exlcude all except these" for priority purpuses.', +) +@click.option( + '--exclude-tags', + type=click.Choice(TestTag.__members__.keys(), case_sensitive=False), + multiple=True, + help='What test tags to exclude when running. Exclude options takes precedence over include.', ) @click.option( '--run-yamltests-with-chip-repl', @@ -130,7 +142,7 @@ class RunContext: help='Binary path of chip tool app to use to run the test') @click.pass_context def main(context, dry_run, log_level, target, target_glob, target_skip_glob, - no_log_timestamps, root, internal_inside_unshare, manual, run_yamltests_with_chip_repl, chip_tool): + no_log_timestamps, root, internal_inside_unshare, include_tags, exclude_tags, run_yamltests_with_chip_repl, chip_tool): # Ensures somewhat pretty logging of what is going on log_fmt = '%(asctime)s.%(msecs)03d %(levelname)-7s %(message)s' if no_log_timestamps: @@ -141,21 +153,28 @@ def main(context, dry_run, log_level, target, target_glob, target_skip_glob, # non yaml tests REQUIRE chip-tool. Yaml tests should not require chip-tool chip_tool = FindBinaryPath('chip-tool') + if include_tags: + include_tags = set([TestTag.__members__[t] for t in include_tags]) + + if exclude_tags: + exclude_tags = set([TestTag.__members__[t] for t in exclude_tags]) + # Figures out selected test that match the given name(s) - all_tests = [test for test in chiptest.AllTests(chip_tool, run_yamltests_with_chip_repl)] + if run_yamltests_with_chip_repl: + all_tests = [test for test in chiptest.AllYamlTests()] + else: + all_tests = [test for test in chiptest.AllChipToolTests(chip_tool)] tests = all_tests - # Default to only non-manual tests unless explicit targets are specified. - if 'all' in target: - if manual == 'skip': - manual_handling = ManualHandling.SKIP - elif manual == 'only': - manual_handling = ManualHandling.ONLY - else: - manual_handling = ManualHandling.INCLUDE - else: - manual_handling = ManualHandling.INCLUDE + # If just defaults specified, do not run manual and in development + # Specific target basically includes everything + if 'all' in target and not include_tags: + exclude_tags = { + TestTag.MANUAL, + TestTag.IN_DEVELOPMENT, + TestTag.FLAKY, + } if 'all' not in target: tests = [] @@ -186,7 +205,9 @@ def main(context, dry_run, log_level, target, target_glob, target_skip_glob, context.obj = RunContext(root=root, tests=tests, in_unshare=internal_inside_unshare, chip_tool=chip_tool, dry_run=dry_run, - manual_handling=manual_handling) + runtime=TestRunTime.PYTHON_YAML if run_yamltests_with_chip_repl else TestRunTime.CHIP_TOOL_BUILTIN, + include_tags=include_tags, + exclude_tags=exclude_tags) @main.command( @@ -194,10 +215,11 @@ def main(context, dry_run, log_level, target, target_glob, target_skip_glob, @click.pass_context def cmd_list(context): for test in context.obj.tests: - if test.is_manual: - print("%s (MANUAL TEST)" % test.name) - else: - print(test.name) + tags = test.tags_str() + if tags: + tags = f" ({tags})" + + print("%s%s" % (test.name, tags)) @main.command( @@ -294,11 +316,14 @@ def cmd_run(context, iterations, all_clusters_app, lock_app, ota_provider_app, o for i in range(iterations): logging.info("Starting iteration %d" % (i+1)) for test in context.obj.tests: - if test.is_manual: - if context.obj.manual_handling == ManualHandling.SKIP: + if context.obj.include_tags: + if not (test.tags & context.obj.include_tags): + logging.debug("Test %s not included" % test.name) continue - else: - if context.obj.manual_handling == ManualHandling.ONLY: + + if context.obj.exclude_tags: + if test.tags & context.obj.exclude_tags: + logging.debug("Test %s excluded" % test.name) continue test_start = time.monotonic() @@ -308,7 +333,9 @@ def cmd_run(context, iterations, all_clusters_app, lock_app, ota_provider_app, o continue logging.info('%-20s - Starting test' % (test.name)) - test.Run(runner, apps_register, paths, pics_file, test_timeout_seconds, context.obj.dry_run) + test.Run( + runner, apps_register, paths, pics_file, test_timeout_seconds, context.obj.dry_run, + test_runtime=context.obj.runtime) test_end = time.monotonic() logging.info('%-30s - Completed in %0.2f seconds' % (test.name, (test_end - test_start))) diff --git a/scripts/tools/zap_regen_all.py b/scripts/tools/zap_regen_all.py index b5bfae13730278..1a4e5768bb209a 100755 --- a/scripts/tools/zap_regen_all.py +++ b/scripts/tools/zap_regen_all.py @@ -374,7 +374,7 @@ def getTargets(type, test_target): targets = [] if type & TargetType.TESTS: - targets.extend(getTestsTemplatesTargets('all')) + targets.extend(getTestsTemplatesTargets(test_target)) if type & TargetType.GLOBAL: targets.extend(getGlobalTemplatesTargets()) diff --git a/src/app/common/templates/weak-enum-list.yaml b/src/app/common/templates/weak-enum-list.yaml index 6f847783db7340..515e30bde00831 100644 --- a/src/app/common/templates/weak-enum-list.yaml +++ b/src/app/common/templates/weak-enum-list.yaml @@ -31,7 +31,6 @@ - SaturationMoveMode - SaturationStepMode - SecurityType -- StartUpOnOffValue - StatusCode - StepMode - TemperatureDisplayMode diff --git a/src/app/tests/suites/certification/Test_TC_ACL_2_10.yaml b/src/app/tests/suites/certification/Test_TC_ACL_2_10.yaml index d3c0b880bc077c..5c94764acd696d 100644 --- a/src/app/tests/suites/certification/Test_TC_ACL_2_10.yaml +++ b/src/app/tests/suites/certification/Test_TC_ACL_2_10.yaml @@ -211,7 +211,7 @@ tests: - label: "Step 10:TH1 writes DUT Endpoint 0 AccessControl cluster ACL attribute" PICS: ACL.S.A0000 - command: "readAttribute" + command: "writeAttribute" attribute: "ACL" arguments: value: @@ -233,13 +233,13 @@ tests: ] - label: - "Step 11:TH1 resds DUT Endpoint 0 AccessControl cluster Extension + "Step 11:TH1 reads DUT Endpoint 0 AccessControl cluster Extension attribute, value is list of AccessControlExtensionStruct containing 1 element" PICS: ACL.S.A0001 command: "readAttribute" attribute: "Extension" - arguments: + response: value: [{ Data: D_OK_EMPTY, FabricIndex: TH1FabricIndex }] - label: @@ -333,8 +333,8 @@ tests: PICS: ACL.S.A0001 command: "readAttribute" attribute: "Extension" - arguments: - value: [{ Data: D_OK_EMPTY, FabricIndex: CurrentFabricIndex }] + response: + value: [{ Data: D_OK_EMPTY, FabricIndex: TH1FabricIndex }] - label: "Step 18: If DUT is an app on host, examine persistent storage in diff --git a/src/app/tests/suites/certification/Test_TC_ACL_2_8.yaml b/src/app/tests/suites/certification/Test_TC_ACL_2_8.yaml index 77fe085a0d0fc2..fe69b83182997d 100644 --- a/src/app/tests/suites/certification/Test_TC_ACL_2_8.yaml +++ b/src/app/tests/suites/certification/Test_TC_ACL_2_8.yaml @@ -99,8 +99,8 @@ tests: value: [ { - Privilege: "5", - AuthMode: "2", + Privilege: 5, + AuthMode: 2, Subjects: [TH1CommissionerNodeId, 1111], Targets: null, FabricIndex: TH1FabricIndex, @@ -116,8 +116,8 @@ tests: value: [ { - Privilege: "5", - AuthMode: "2", + Privilege: 5, + AuthMode: 2, Subjects: [TH2CommissionerNodeId, 2222], Targets: null, FabricIndex: TH2FabricIndex, @@ -128,12 +128,12 @@ tests: PICS: ACL.S.A0000 command: "readAttribute" attribute: "ACL" - arguments: + response: value: [ { - Privilege: "5", - AuthMode: "2", + Privilege: 5, + AuthMode: 2, Subjects: [TH1CommissionerNodeId, 1111], Targets: null, FabricIndex: TH1FabricIndex, @@ -145,12 +145,12 @@ tests: identity: "beta" command: "readAttribute" attribute: "ACL" - arguments: + response: value: [ { - Privilege: "5", - AuthMode: "2", + Privilege: 5, + AuthMode: 2, Subjects: [TH2CommissionerNodeId, 2222], Targets: null, FabricIndex: TH2FabricIndex, diff --git a/src/app/zap-templates/zcl/data-model/silabs/types-silabs.xml b/src/app/zap-templates/zcl/data-model/silabs/types-silabs.xml index 5d0be8324e2bd1..f9bd26ee5fce10 100644 --- a/src/app/zap-templates/zcl/data-model/silabs/types-silabs.xml +++ b/src/app/zap-templates/zcl/data-model/silabs/types-silabs.xml @@ -21,10 +21,6 @@ limitations under the License. - - - - @@ -47,22 +43,6 @@ limitations under the License. - - - - - - - - - - - - - - - - @@ -218,45 +198,4 @@ limitations under the License. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/controller/python/ChipDeviceController-Discovery.cpp b/src/controller/python/ChipDeviceController-Discovery.cpp index 98a82815d3bd2f..833ff84a4dff3a 100644 --- a/src/controller/python/ChipDeviceController-Discovery.cpp +++ b/src/controller/python/ChipDeviceController-Discovery.cpp @@ -139,6 +139,11 @@ void pychip_DeviceController_IterateDiscoveredCommissionableNodes(Controller::De } jsonVal["addresses"] = addresses; } + if (dnsSdInfo->commissionData.rotatingIdLen > 0) + { + jsonVal["rotatingId"] = std::string(reinterpret_cast(dnsSdInfo->commissionData.rotatingId), + dnsSdInfo->commissionData.rotatingIdLen); + } { auto str = jsonVal.toStyledString(); diff --git a/src/controller/python/chip/discovery/__init__.py b/src/controller/python/chip/discovery/__init__.py index b18467933f97fa..e6a03466090c1c 100644 --- a/src/controller/python/chip/discovery/__init__.py +++ b/src/controller/python/chip/discovery/__init__.py @@ -19,7 +19,7 @@ import threading import time from dataclasses import dataclass -from typing import Callable, List, Set +from typing import Callable, List, Optional, Set from chip.discovery.library_handle import _GetDiscoveryLibraryHandle from chip.discovery.types import DiscoverFailureCallback_t, DiscoverSuccessCallback_t @@ -87,6 +87,7 @@ class CommissionableNode(): mrpRetryIntervalActive: int = None supportsTcp: bool = None addresses: List[str] = None + rotatingId: Optional[str] = None # Milliseconds to wait for additional results onece a single result has diff --git a/src/controller/python/chip/yaml/runner.py b/src/controller/python/chip/yaml/runner.py index f86255d8008f45..6f5704a6e418d9 100644 --- a/src/controller/python/chip/yaml/runner.py +++ b/src/controller/python/chip/yaml/runner.py @@ -754,23 +754,6 @@ def decode(self, result: _ActionResult): return decoded_response if isinstance(response, chip.discovery.CommissionableNode): - # CommissionableNode( - # instanceName='04DD55352DD2AC53', - # hostName='E6A32C6DBA8D0000', - # port=5540, - # longDiscriminator=3840, - # vendorId=65521, - # productId=32769, - # commissioningMode=1, - # deviceType=0, - # deviceName='', - # pairingInstruction='', - # pairingHint=36, - # mrpRetryIntervalIdle=None, - # mrpRetryIntervalActive=None, - # supportsTcp=True, - # addresses=['fd00:0:1:1::3', '10.10.10.1'] - # ), ... decoded_response['value'] = { 'instanceName': response.instanceName, 'hostName': response.hostName, @@ -787,11 +770,10 @@ def decode(self, result: _ActionResult): 'mrpRetryIntervalActive': response.mrpRetryIntervalActive, 'supportsTcp': response.supportsTcp, 'addresses': response.addresses, - - # TODO: NOT AVAILABLE - 'rotatingIdLen': 0, + 'rotatingId': response.rotatingId, # derived values + 'rotatingIdLen': 0 if not response.rotatingId else len(response.rotatingId), 'numIPs': len(response.addresses), } diff --git a/src/platform/BUILD.gn b/src/platform/BUILD.gn index b9f75555e02cd8..1d2a9665f97abf 100644 --- a/src/platform/BUILD.gn +++ b/src/platform/BUILD.gn @@ -419,7 +419,7 @@ if (chip_device_platform != "none") { } else if (chip_device_platform == "darwin") { _platform_target = "Darwin" } else if (chip_device_platform == "efr32") { - _platform_target = "silabs/EFR32" + _platform_target = "silabs/efr32" } else if (chip_device_platform == "SiWx917") { _platform_target = "silabs/SiWx917" } else if (chip_device_platform == "esp32") { diff --git a/src/platform/silabs/SiWx917/bluetooth/rsi_ble_config.h b/src/platform/silabs/SiWx917/bluetooth/rsi_ble_config.h index 7849747dd28152..078a050f470cc6 100644 --- a/src/platform/silabs/SiWx917/bluetooth/rsi_ble_config.h +++ b/src/platform/silabs/SiWx917/bluetooth/rsi_ble_config.h @@ -104,8 +104,10 @@ #define RSI_BLE_ADV_DIR_ADDR_TYPE LE_PUBLIC_ADDRESS #define RSI_BLE_ADV_DIR_ADDR "00:15:83:6A:64:17" -#define RSI_BLE_ADV_INT_MIN 0x100 -#define RSI_BLE_ADV_INT_MAX 0x200 +//! Reduced the BLE adv interval time to match with EFR BLE +#define RSI_BLE_ADV_INT_MIN 0x20 +#define RSI_BLE_ADV_INT_MAX 0x20 + #define RSI_BLE_ADV_CHANNEL_MAP 0x07 //! Advertise status diff --git a/src/platform/silabs/EFR32/BLEManagerImpl.cpp b/src/platform/silabs/efr32/BLEManagerImpl.cpp similarity index 100% rename from src/platform/silabs/EFR32/BLEManagerImpl.cpp rename to src/platform/silabs/efr32/BLEManagerImpl.cpp diff --git a/src/platform/silabs/EFR32/BUILD.gn b/src/platform/silabs/efr32/BUILD.gn similarity index 99% rename from src/platform/silabs/EFR32/BUILD.gn rename to src/platform/silabs/efr32/BUILD.gn index e47ed30848a072..1bb87672f493cc 100644 --- a/src/platform/silabs/EFR32/BUILD.gn +++ b/src/platform/silabs/efr32/BUILD.gn @@ -45,7 +45,7 @@ config("efr32-platform-wifi-config") { } } -static_library("EFR32") { +static_library("efr32") { sources = [ "${silabs_platform_dir}/BLEManagerImpl.h", "${silabs_platform_dir}/BlePlatformConfig.h", diff --git a/src/platform/silabs/EFR32/CHIPCryptoPALPsaEfr32.cpp b/src/platform/silabs/efr32/CHIPCryptoPALPsaEfr32.cpp similarity index 100% rename from src/platform/silabs/EFR32/CHIPCryptoPALPsaEfr32.cpp rename to src/platform/silabs/efr32/CHIPCryptoPALPsaEfr32.cpp diff --git a/src/platform/silabs/EFR32/ConfigurationManagerImpl.cpp b/src/platform/silabs/efr32/ConfigurationManagerImpl.cpp similarity index 100% rename from src/platform/silabs/EFR32/ConfigurationManagerImpl.cpp rename to src/platform/silabs/efr32/ConfigurationManagerImpl.cpp diff --git a/src/platform/silabs/EFR32/ConnectivityManagerImpl.cpp b/src/platform/silabs/efr32/ConnectivityManagerImpl.cpp similarity index 100% rename from src/platform/silabs/EFR32/ConnectivityManagerImpl.cpp rename to src/platform/silabs/efr32/ConnectivityManagerImpl.cpp diff --git a/src/platform/silabs/EFR32/Efr32OpaqueKeypair.h b/src/platform/silabs/efr32/Efr32OpaqueKeypair.h similarity index 100% rename from src/platform/silabs/EFR32/Efr32OpaqueKeypair.h rename to src/platform/silabs/efr32/Efr32OpaqueKeypair.h diff --git a/src/platform/silabs/EFR32/Efr32PsaOpaqueKeypair.cpp b/src/platform/silabs/efr32/Efr32PsaOpaqueKeypair.cpp similarity index 100% rename from src/platform/silabs/EFR32/Efr32PsaOpaqueKeypair.cpp rename to src/platform/silabs/efr32/Efr32PsaOpaqueKeypair.cpp diff --git a/src/platform/silabs/EFR32/Efr32PsaOperationalKeystore.cpp b/src/platform/silabs/efr32/Efr32PsaOperationalKeystore.cpp similarity index 100% rename from src/platform/silabs/EFR32/Efr32PsaOperationalKeystore.cpp rename to src/platform/silabs/efr32/Efr32PsaOperationalKeystore.cpp diff --git a/src/platform/silabs/EFR32/Efr32PsaOperationalKeystore.h b/src/platform/silabs/efr32/Efr32PsaOperationalKeystore.h similarity index 100% rename from src/platform/silabs/EFR32/Efr32PsaOperationalKeystore.h rename to src/platform/silabs/efr32/Efr32PsaOperationalKeystore.h diff --git a/src/platform/silabs/EFR32/KeyValueStoreManagerImpl.cpp b/src/platform/silabs/efr32/KeyValueStoreManagerImpl.cpp similarity index 100% rename from src/platform/silabs/EFR32/KeyValueStoreManagerImpl.cpp rename to src/platform/silabs/efr32/KeyValueStoreManagerImpl.cpp diff --git a/src/platform/silabs/EFR32/OTAImageProcessorImpl.cpp b/src/platform/silabs/efr32/OTAImageProcessorImpl.cpp similarity index 100% rename from src/platform/silabs/EFR32/OTAImageProcessorImpl.cpp rename to src/platform/silabs/efr32/OTAImageProcessorImpl.cpp diff --git a/src/platform/silabs/EFR32/OTAImageProcessorImpl.h b/src/platform/silabs/efr32/OTAImageProcessorImpl.h similarity index 100% rename from src/platform/silabs/EFR32/OTAImageProcessorImpl.h rename to src/platform/silabs/efr32/OTAImageProcessorImpl.h diff --git a/src/platform/silabs/EFR32/PlatformManagerImpl.cpp b/src/platform/silabs/efr32/PlatformManagerImpl.cpp similarity index 100% rename from src/platform/silabs/EFR32/PlatformManagerImpl.cpp rename to src/platform/silabs/efr32/PlatformManagerImpl.cpp diff --git a/src/platform/silabs/EFR32/ThreadStackManagerImpl.cpp b/src/platform/silabs/efr32/ThreadStackManagerImpl.cpp similarity index 100% rename from src/platform/silabs/EFR32/ThreadStackManagerImpl.cpp rename to src/platform/silabs/efr32/ThreadStackManagerImpl.cpp diff --git a/src/platform/silabs/EFR32/args.gni b/src/platform/silabs/efr32/args.gni similarity index 100% rename from src/platform/silabs/EFR32/args.gni rename to src/platform/silabs/efr32/args.gni diff --git a/src/platform/silabs/EFR32/efr32-chip-mbedtls-config.h b/src/platform/silabs/efr32/efr32-chip-mbedtls-config.h similarity index 100% rename from src/platform/silabs/EFR32/efr32-chip-mbedtls-config.h rename to src/platform/silabs/efr32/efr32-chip-mbedtls-config.h diff --git a/src/platform/silabs/EFR32/psa_crypto_config.h b/src/platform/silabs/efr32/psa_crypto_config.h similarity index 100% rename from src/platform/silabs/EFR32/psa_crypto_config.h rename to src/platform/silabs/efr32/psa_crypto_config.h diff --git a/src/platform/silabs/EFR32/wifi/dhcp_client.cpp b/src/platform/silabs/efr32/wifi/dhcp_client.cpp similarity index 100% rename from src/platform/silabs/EFR32/wifi/dhcp_client.cpp rename to src/platform/silabs/efr32/wifi/dhcp_client.cpp diff --git a/src/platform/silabs/EFR32/wifi/dhcp_client.h b/src/platform/silabs/efr32/wifi/dhcp_client.h similarity index 100% rename from src/platform/silabs/EFR32/wifi/dhcp_client.h rename to src/platform/silabs/efr32/wifi/dhcp_client.h diff --git a/src/platform/silabs/EFR32/wifi/ethernetif.cpp b/src/platform/silabs/efr32/wifi/ethernetif.cpp similarity index 100% rename from src/platform/silabs/EFR32/wifi/ethernetif.cpp rename to src/platform/silabs/efr32/wifi/ethernetif.cpp diff --git a/src/platform/silabs/EFR32/wifi/ethernetif.h b/src/platform/silabs/efr32/wifi/ethernetif.h similarity index 100% rename from src/platform/silabs/EFR32/wifi/ethernetif.h rename to src/platform/silabs/efr32/wifi/ethernetif.h diff --git a/src/platform/silabs/EFR32/wifi/lwip_netif.cpp b/src/platform/silabs/efr32/wifi/lwip_netif.cpp similarity index 100% rename from src/platform/silabs/EFR32/wifi/lwip_netif.cpp rename to src/platform/silabs/efr32/wifi/lwip_netif.cpp diff --git a/src/platform/silabs/EFR32/wifi/wfx_host_events.h b/src/platform/silabs/efr32/wifi/wfx_host_events.h similarity index 100% rename from src/platform/silabs/EFR32/wifi/wfx_host_events.h rename to src/platform/silabs/efr32/wifi/wfx_host_events.h diff --git a/src/platform/silabs/EFR32/wifi/wfx_msgs.h b/src/platform/silabs/efr32/wifi/wfx_msgs.h similarity index 100% rename from src/platform/silabs/EFR32/wifi/wfx_msgs.h rename to src/platform/silabs/efr32/wifi/wfx_msgs.h diff --git a/src/platform/silabs/EFR32/wifi/wfx_notify.cpp b/src/platform/silabs/efr32/wifi/wfx_notify.cpp similarity index 100% rename from src/platform/silabs/EFR32/wifi/wfx_notify.cpp rename to src/platform/silabs/efr32/wifi/wfx_notify.cpp diff --git a/src/platform/silabs/EFR32/wifi/wifi_config.h b/src/platform/silabs/efr32/wifi/wifi_config.h similarity index 100% rename from src/platform/silabs/EFR32/wifi/wifi_config.h rename to src/platform/silabs/efr32/wifi/wifi_config.h diff --git a/src/platform/silabs/EFR32/wifi_args.gni b/src/platform/silabs/efr32/wifi_args.gni similarity index 100% rename from src/platform/silabs/EFR32/wifi_args.gni rename to src/platform/silabs/efr32/wifi_args.gni diff --git a/src/test_driver/efr32/BUILD.gn b/src/test_driver/efr32/BUILD.gn index 56f89dd3128390..3df645747b2b15 100644 --- a/src/test_driver/efr32/BUILD.gn +++ b/src/test_driver/efr32/BUILD.gn @@ -49,7 +49,7 @@ efr32_sdk("sdk") { ] include_dirs = [ - "${chip_root}/src/platform/silabs/EFR32", + "${chip_root}/src/platform/silabs/efr32", "${efr32_project_dir}/include", "${examples_plat_dir}", "${examples_common_plat_dir}", diff --git a/src/test_driver/efr32/args.gni b/src/test_driver/efr32/args.gni index a62432284c74a2..4f8910d8e4a31e 100644 --- a/src/test_driver/efr32/args.gni +++ b/src/test_driver/efr32/args.gni @@ -16,7 +16,7 @@ import("//build_overrides/chip.gni") import("//build_overrides/pigweed.gni") import("${chip_root}/config/efr32/lib/pw_rpc/pw_rpc.gni") import("${chip_root}/examples/platform/silabs/efr32/args.gni") -import("${chip_root}/src/platform/silabs/EFR32/args.gni") +import("${chip_root}/src/platform/silabs/efr32/args.gni") efr32_sdk_target = get_label_info(":sdk", "label_no_toolchain") diff --git a/third_party/mbedtls/repo b/third_party/mbedtls/repo index 27276fcb970c7d..c87dc5f0155e8e 160000 --- a/third_party/mbedtls/repo +++ b/third_party/mbedtls/repo @@ -1 +1 @@ -Subproject commit 27276fcb970c7d4ab82744baf518085ca73a561f +Subproject commit c87dc5f0155e8e00851f00210cb029e061d776f5 diff --git a/third_party/openthread/repo b/third_party/openthread/repo index 25506997f286fd..eb6377f1d7bf6b 160000 --- a/third_party/openthread/repo +++ b/third_party/openthread/repo @@ -1 +1 @@ -Subproject commit 25506997f286fdbfa72725f4cee78c922c896255 +Subproject commit eb6377f1d7bf6bc7038a76e903af0bdf77c6f99f diff --git a/third_party/silabs/SiWx917_sdk.gni b/third_party/silabs/SiWx917_sdk.gni index 7bcc4638879ca6..c01bef488d55e1 100644 --- a/third_party/silabs/SiWx917_sdk.gni +++ b/third_party/silabs/SiWx917_sdk.gni @@ -145,6 +145,11 @@ template("efr32_sdk") { defines += board_defines + # Enabling led interface + if (use_wstk_leds) { + defines += [ "ENABLE_WSTK_LEDS" ] + } + if (defined(invoker.enable_sleepy_device)) { if (invoker.enable_sleepy_device) { defines += [ diff --git a/third_party/silabs/efr32_sdk.gni b/third_party/silabs/efr32_sdk.gni index ac2737f8fee378..b2734d272ee3ac 100644 --- a/third_party/silabs/efr32_sdk.gni +++ b/third_party/silabs/efr32_sdk.gni @@ -212,7 +212,7 @@ template("efr32_sdk") { } if (use_wf200 || !use_rs911x_sockets) { - import("${chip_root}/src/platform/silabs/EFR32/wifi_args.gni") + import("${chip_root}/src/platform/silabs/efr32/wifi_args.gni") defines += [ "LWIP_NETIF_API=1" ] if (lwip_ipv4) { @@ -297,7 +297,7 @@ template("efr32_sdk") { if ((defined(invoker.chip_enable_pw_rpc) && invoker.chip_enable_pw_rpc) || chip_build_libshell || enable_openthread_cli || (defined(invoker.chip_enable_wifi) && invoker.chip_enable_wifi) || - show_qr_code || disable_lcd || use_external_flash) { + show_qr_code || !disable_lcd || use_external_flash) { defines += [ "CONFIG_ENABLE_UART" ] if (use_external_flash) { @@ -455,8 +455,8 @@ template("efr32_sdk") { # system to recompile mbedTLS (= the SDK) when the mbedTLS config gets # edited. sources = [ - "${chip_root}/src/platform/silabs/EFR32/efr32-chip-mbedtls-config.h", - "${chip_root}/src/platform/silabs/EFR32/psa_crypto_config.h", + "${chip_root}/src/platform/silabs/efr32/efr32-chip-mbedtls-config.h", + "${chip_root}/src/platform/silabs/efr32/psa_crypto_config.h", ] public_deps = [ "${chip_root}/src/crypto:crypto_buildconfig" ] diff --git a/zzz_generated/app-common/app-common/zap-generated/enums.h b/zzz_generated/app-common/app-common/zap-generated/enums.h index e54d42ba5d6843..d76f9ff69bdd32 100644 --- a/zzz_generated/app-common/app-common/zap-generated/enums.h +++ b/zzz_generated/app-common/app-common/zap-generated/enums.h @@ -281,14 +281,6 @@ enum EmberAfSecurityType : uint8_t EMBER_ZCL_SECURITY_TYPE_WPA3 = 5, }; -// Enum for StartUpOnOffValue -enum EmberAfStartUpOnOffValue : uint8_t -{ - EMBER_ZCL_START_UP_ON_OFF_VALUE_SET_TO_OFF = 0, - EMBER_ZCL_START_UP_ON_OFF_VALUE_SET_TO_ON = 1, - EMBER_ZCL_START_UP_ON_OFF_VALUE_SET_TO_TOGGLE = 2, -}; - // Enum for StatusCode enum EmberAfStatusCode : uint8_t { @@ -322,10 +314,6 @@ enum EmberAfWiFiVersionType : uint8_t EMBER_ZCL_WI_FI_VERSION_TYPE_AX = 5, }; -#define EMBER_AF_ALARM_MASK_GENERAL_HW_FAULT (1) -#define EMBER_AF_ALARM_MASK_GENERAL_HW_FAULT_OFFSET (0) -#define EMBER_AF_ALARM_MASK_GENERAL_SW_FAULT (2) -#define EMBER_AF_ALARM_MASK_GENERAL_SW_FAULT_OFFSET (1) #define EMBER_AF_APPLICATION_LAUNCHER_FEATURE_APPLICATION_PLATFORM (1) #define EMBER_AF_APPLICATION_LAUNCHER_FEATURE_APPLICATION_PLATFORM_OFFSET (0) #define EMBER_AF_AUDIO_OUTPUT_FEATURE_NAME_UPDATES (1) diff --git a/zzz_generated/chip-tool/zap-generated/test/Commands.h b/zzz_generated/chip-tool/zap-generated/test/Commands.h index a307cd0827e0ea..50406d3e4632fc 100644 --- a/zzz_generated/chip-tool/zap-generated/test/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/test/Commands.h @@ -6014,6 +6014,28 @@ class Test_TC_ACL_2_8Suite : public TestCommand chip::app::Clusters::AccessControl::Structs::AccessControlEntryStruct::DecodableType> value; VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.begin(); + VerifyOrReturn(CheckNextListItemDecodes("acl", iter_0, 0)); + VerifyOrReturn(CheckValue("acl[0].privilege", iter_0.GetValue().privilege, 5U)); + VerifyOrReturn(CheckValue("acl[0].authMode", iter_0.GetValue().authMode, 2U)); + VerifyOrReturn(CheckValueNonNull("acl[0].subjects", iter_0.GetValue().subjects)); + { + auto iter_3 = iter_0.GetValue().subjects.Value().begin(); + VerifyOrReturn(CheckNextListItemDecodes( + "acl[0].subjects.Value()", iter_3, 0)); + VerifyOrReturn(CheckValue("acl[0].subjects.Value()[0]", iter_3.GetValue(), + mTH1CommissionerNodeId.HasValue() ? mTH1CommissionerNodeId.Value() : 112233ULL)); + VerifyOrReturn(CheckNextListItemDecodes( + "acl[0].subjects.Value()", iter_3, 1)); + VerifyOrReturn(CheckValue("acl[0].subjects.Value()[1]", iter_3.GetValue(), 1111ULL)); + VerifyOrReturn(CheckNoMoreListItems("acl[0].subjects.Value()", + iter_3, 2)); + } + VerifyOrReturn(CheckValueNull("acl[0].targets", iter_0.GetValue().targets)); + VerifyOrReturn(CheckValue("acl[0].fabricIndex", iter_0.GetValue().fabricIndex, TH1FabricIndex)); + VerifyOrReturn(CheckNoMoreListItems("acl", iter_0, 1)); + } } break; case 9: @@ -6023,6 +6045,28 @@ class Test_TC_ACL_2_8Suite : public TestCommand chip::app::Clusters::AccessControl::Structs::AccessControlEntryStruct::DecodableType> value; VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.begin(); + VerifyOrReturn(CheckNextListItemDecodes("acl", iter_0, 0)); + VerifyOrReturn(CheckValue("acl[0].privilege", iter_0.GetValue().privilege, 5U)); + VerifyOrReturn(CheckValue("acl[0].authMode", iter_0.GetValue().authMode, 2U)); + VerifyOrReturn(CheckValueNonNull("acl[0].subjects", iter_0.GetValue().subjects)); + { + auto iter_3 = iter_0.GetValue().subjects.Value().begin(); + VerifyOrReturn(CheckNextListItemDecodes( + "acl[0].subjects.Value()", iter_3, 0)); + VerifyOrReturn(CheckValue("acl[0].subjects.Value()[0]", iter_3.GetValue(), + mTH2CommissionerNodeId.HasValue() ? mTH2CommissionerNodeId.Value() : 112233ULL)); + VerifyOrReturn(CheckNextListItemDecodes( + "acl[0].subjects.Value()", iter_3, 1)); + VerifyOrReturn(CheckValue("acl[0].subjects.Value()[1]", iter_3.GetValue(), 2222ULL)); + VerifyOrReturn(CheckNoMoreListItems("acl[0].subjects.Value()", + iter_3, 2)); + } + VerifyOrReturn(CheckValueNull("acl[0].targets", iter_0.GetValue().targets)); + VerifyOrReturn(CheckValue("acl[0].fabricIndex", iter_0.GetValue().fabricIndex, TH2FabricIndex)); + VerifyOrReturn(CheckNoMoreListItems("acl", iter_0, 1)); + } } break; case 10: @@ -6797,12 +6841,6 @@ class Test_TC_ACL_2_10Suite : public TestCommand break; case 14: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::DecodableList< - chip::app::Clusters::AccessControl::Structs::AccessControlEntryStruct::DecodableType> - value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - } break; case 15: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); @@ -6811,6 +6849,15 @@ class Test_TC_ACL_2_10Suite : public TestCommand chip::app::Clusters::AccessControl::Structs::AccessControlExtensionStruct::DecodableType> value; VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.begin(); + VerifyOrReturn(CheckNextListItemDecodes("extension", iter_0, 0)); + VerifyOrReturn(CheckValueAsString( + "extension[0].data", iter_0.GetValue().data, + mDOkEmpty.HasValue() ? mDOkEmpty.Value() : chip::ByteSpan(chip::Uint8::from_const_char("\x17\x18"), 2))); + VerifyOrReturn(CheckValue("extension[0].fabricIndex", iter_0.GetValue().fabricIndex, TH1FabricIndex)); + VerifyOrReturn(CheckNoMoreListItems("extension", iter_0, 1)); + } } break; case 16: @@ -6882,6 +6929,15 @@ class Test_TC_ACL_2_10Suite : public TestCommand chip::app::Clusters::AccessControl::Structs::AccessControlExtensionStruct::DecodableType> value; VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.begin(); + VerifyOrReturn(CheckNextListItemDecodes("extension", iter_0, 0)); + VerifyOrReturn(CheckValueAsString( + "extension[0].data", iter_0.GetValue().data, + mDOkEmpty.HasValue() ? mDOkEmpty.Value() : chip::ByteSpan(chip::Uint8::from_const_char("\x17\x18"), 2))); + VerifyOrReturn(CheckValue("extension[0].fabricIndex", iter_0.GetValue().fabricIndex, TH1FabricIndex)); + VerifyOrReturn(CheckNoMoreListItems("extension", iter_0, 1)); + } } break; case 22: @@ -7129,12 +7185,54 @@ class Test_TC_ACL_2_10Suite : public TestCommand case 14: { LogStep(14, "Step 10:TH1 writes DUT Endpoint 0 AccessControl cluster ACL attribute"); VerifyOrDo(!ShouldSkip("ACL.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id, true, - chip::NullOptional); + ListFreer listFreer; + chip::app::DataModel::List value; + + { + auto * listHolder_0 = + new ListHolder(2); + listFreer.add(listHolder_0); + + listHolder_0->mList[0].privilege = + static_cast(5); + listHolder_0->mList[0].authMode = + static_cast(2); + listHolder_0->mList[0].subjects.SetNonNull(); + + { + auto * listHolder_3 = new ListHolder(2); + listFreer.add(listHolder_3); + listHolder_3->mList[0] = mTH1CommissionerNodeId.HasValue() ? mTH1CommissionerNodeId.Value() : 112233ULL; + listHolder_3->mList[1] = 1111ULL; + listHolder_0->mList[0].subjects.Value() = chip::app::DataModel::List(listHolder_3->mList, 2); + } + listHolder_0->mList[0].targets.SetNull(); + listHolder_0->mList[0].fabricIndex = TH1FabricIndex; + + listHolder_0->mList[1].privilege = + static_cast(3); + listHolder_0->mList[1].authMode = + static_cast(3); + listHolder_0->mList[1].subjects.SetNonNull(); + + { + auto * listHolder_3 = new ListHolder(1); + listFreer.add(listHolder_3); + listHolder_3->mList[0] = 3333ULL; + listHolder_0->mList[1].subjects.Value() = chip::app::DataModel::List(listHolder_3->mList, 1); + } + listHolder_0->mList[1].targets.SetNull(); + listHolder_0->mList[1].fabricIndex = TH1FabricIndex; + + value = chip::app::DataModel::List( + listHolder_0->mList, 2); + } + return WriteAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id, value, + chip::NullOptional, chip::NullOptional); } case 15: { LogStep(15, - "Step 11:TH1 resds DUT Endpoint 0 AccessControl cluster Extension attribute, value is list of " + "Step 11:TH1 reads DUT Endpoint 0 AccessControl cluster Extension attribute, value is list of " "AccessControlExtensionStruct containing 1 element"); VerifyOrDo(!ShouldSkip("ACL.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); return ReadAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Extension::Id, true,