diff --git a/.gitignore b/.gitignore index 6f9bc786ed260a..a53e0ca21a4fd8 100644 --- a/.gitignore +++ b/.gitignore @@ -61,3 +61,6 @@ compile_commands.json # backup files, usually created by the ZAP tool *~ + +# log files +*.log \ No newline at end of file diff --git a/examples/platform/efr32/matter_config.cpp b/examples/platform/efr32/matter_config.cpp index 876d0ce58a7959..12bfbc5b8117d7 100644 --- a/examples/platform/efr32/matter_config.cpp +++ b/examples/platform/efr32/matter_config.cpp @@ -27,7 +27,7 @@ #ifdef SL_WIFI #include "wfx_host_events.h" -#endif /* RS911X_WIFI */ +#endif /* SL_WIFI */ #if PW_RPC_ENABLED #include "Rpc.h" diff --git a/src/lwip/efr32/lwipopts-rs911x.h b/src/lwip/efr32/lwipopts-rs911x.h index 9be70a784da48c..5f84181387a69f 100644 --- a/src/lwip/efr32/lwipopts-rs911x.h +++ b/src/lwip/efr32/lwipopts-rs911x.h @@ -124,8 +124,8 @@ #define MEMP_SEPARATE_POOLS (1) #define LWIP_PBUF_FROM_CUSTOM_POOLS (0) #define MEMP_USE_CUSTOM_POOLS (0) -#define PBUF_POOL_SIZE (8) -#define PBUF_POOL_BUFSIZE (1280) +#define PBUF_POOL_SIZE (16) +#define PBUF_POOL_BUFSIZE (1280) // IPv6 path MTU #define PBUF_CUSTOM_POOL_IDX_START (MEMP_PBUF_POOL_SMALL) #define PBUF_CUSTOM_POOL_IDX_END (MEMP_PBUF_POOL_LARGE) #endif diff --git a/src/lwip/efr32/lwipopts-wf200.h b/src/lwip/efr32/lwipopts-wf200.h index 31dbf793c3b8c9..60844a749f3e99 100644 --- a/src/lwip/efr32/lwipopts-wf200.h +++ b/src/lwip/efr32/lwipopts-wf200.h @@ -124,7 +124,7 @@ #define MEMP_SEPARATE_POOLS (1) #define LWIP_PBUF_FROM_CUSTOM_POOLS (0) #define MEMP_USE_CUSTOM_POOLS (0) -#define PBUF_POOL_SIZE (8) +#define PBUF_POOL_SIZE (16) #define PBUF_POOL_BUFSIZE (1280) #define PBUF_CUSTOM_POOL_IDX_START (MEMP_PBUF_POOL_SMALL) #define PBUF_CUSTOM_POOL_IDX_END (MEMP_PBUF_POOL_LARGE) diff --git a/src/platform/EFR32/CHIPDevicePlatformConfig.h b/src/platform/EFR32/CHIPDevicePlatformConfig.h index 38a264727588a2..3ed54b28e03221 100644 --- a/src/platform/EFR32/CHIPDevicePlatformConfig.h +++ b/src/platform/EFR32/CHIPDevicePlatformConfig.h @@ -48,17 +48,15 @@ #define CHIP_DEVICE_CONFIG_ENABLE_CHIP_TIME_SERVICE_TIME_SYNC 0 -#if defined(RS911X_WIFI) +#if defined(SL_WIFI) #if defined(WIFI_IPV4_DISABLED) #define CHIP_DEVICE_CONFIG_ENABLE_IPV4 0 -#define CHIP_DEVICE_CONFIG_ENABLE_IPV6 1 -#else +#else /* !WIFI_IPV4_DISABLED */ #define CHIP_DEVICE_CONFIG_ENABLE_IPV4 1 -#define CHIP_DEVICE_CONFIG_ENABLE_IPV6 1 -#endif +#endif /* WIFI_IPV4_DISABLED */ -#endif +#endif /* SL_WIFI */ // ========== Platform-specific Configuration ========= diff --git a/src/platform/EFR32/ConnectivityManagerImpl_WIFI.cpp b/src/platform/EFR32/ConnectivityManagerImpl_WIFI.cpp index 3b74a88274a83f..45b8b744cdd374 100644 --- a/src/platform/EFR32/ConnectivityManagerImpl_WIFI.cpp +++ b/src/platform/EFR32/ConnectivityManagerImpl_WIFI.cpp @@ -139,6 +139,7 @@ void ConnectivityManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) } } } + ConnectivityManager::WiFiStationMode ConnectivityManagerImpl::_GetWiFiStationMode(void) { if (mWiFiStationMode != kWiFiStationMode_ApplicationControlled) @@ -236,7 +237,7 @@ void ConnectivityManagerImpl::DriveStationState() // Ensure that the WFX is started. if ((serr = wfx_wifi_start()) != SL_STATUS_OK) { - ChipLogError(DeviceLayer, "WFX_wifi_start: FAIL: %s", chip::ErrorStr(err)); + ChipLogError(DeviceLayer, "wfx_wifi_start() failed: %s", chip::ErrorStr(err)); return; } // Ensure that station mode is enabled in the WFX WiFi layer. @@ -314,7 +315,7 @@ void ConnectivityManagerImpl::DriveStationState() ChipLogProgress(DeviceLayer, "Attempting to connect WiFi"); if ((serr = wfx_connect_to_ap()) != SL_STATUS_OK) { - ChipLogError(DeviceLayer, "wfx_connect_to_ap failed"); + ChipLogError(DeviceLayer, "wfx_connect_to_ap() failed."); } SuccessOrExit(serr); @@ -368,6 +369,7 @@ void ConnectivityManagerImpl::OnStationDisconnected() UpdateInternetConnectivityState(); } + void ConnectivityManagerImpl::DriveStationState(::chip::System::Layer * aLayer, void * aAppState) { sInstance.DriveStationState(); @@ -394,60 +396,10 @@ void ConnectivityManagerImpl::UpdateInternetConnectivityState(void) // If the WiFi station is currently in the connected state... if (mWiFiStationState == kWiFiStationState_Connected) { -#if 1 //! defined (SL_WF200) || (SL_WF200 == 0) +#if CHIP_DEVICE_CONFIG_ENABLE_IPV4 haveIPv4Conn = wfx_have_ipv4_addr(SL_WFX_STA_INTERFACE); -#if (CHIP_DEVICE_CONFIG_ENABLE_IPV6) +#endif /* CHIP_DEVICE_CONFIG_ENABLE_IPV4 */ haveIPv6Conn = wfx_have_ipv6_addr(SL_WFX_STA_INTERFACE); -#endif - /* TODO - haveIPv6Conn */ -#else /* Old code that needed LWIP and its internals */ - // Get the LwIP netif for the WiFi station interface. - struct netif * netif = Internal::WFXUtils::GetStationNetif(); - - // If the WiFi station interface is up... - if (netif != NULL && netif_is_up(netif) && netif_is_link_up(netif)) - { - // // Check if a DNS server is currently configured. If so... - // TODO - // ip_addr_t dnsServerAddr = *dns_getserver(0); - // if (!ip_addr_isany_val(dnsServerAddr)) - if (1) - { - // If the station interface has been assigned an IPv4 address, and has - // an IPv4 gateway, then presume that the device has IPv4 Internet - // connectivity. - if (!ip4_addr_isany_val(*netif_ip4_addr(netif)) && !ip4_addr_isany_val(*netif_ip4_gw(netif))) - { - haveIPv4Conn = true; - char addrStr[INET_ADDRSTRLEN]; - // TODO: change the code to using IPv6 address - sprintf(addrStr, "%d.%d.%d.%d", (int) (netif->ip_addr.u_addr.ip4.addr & 0xff), - (int) ((netif->ip_addr.u_addr.ip4.addr >> 8) & 0xff), - (int) ((netif->ip_addr.u_addr.ip4.addr >> 16) & 0xff), - (int) ((netif->ip_addr.u_addr.ip4.addr >> 24) & 0xff)); - IPAddress::FromString(addrStr, addr); - } - - // TODO - // Search among the IPv6 addresses assigned to the interface for a Global Unicast - // address (2000::/3) that is in the valid state. If such an address is found... - // for (uint8_t i = 0; i < LWIP_IPV6_NUM_ADDRESSES; i++) - // { - // if (ip6_addr_isglobal(netif_ip6_addr(netif, i)) && ip6_addr_isvalid(netif_ip6_addr_state(netif, i))) - // { - // // Determine if there is a default IPv6 router that is currently reachable - // // via the station interface. If so, presume for now that the device has - // // IPv6 connectivity. - // struct netif * found_if = nd6_find_route(IP6_ADDR_ANY6); - // if (found_if && netif->num == found_if->num) - // { - // haveIPv6Conn = true; - // } - // } - // } - } - } -#endif /* OLD-Code */ } // If the internet connectivity state has changed... diff --git a/third_party/efr32_sdk/.clang-format b/third_party/efr32_sdk/.clang-format new file mode 100644 index 00000000000000..d3c683f959ed73 --- /dev/null +++ b/third_party/efr32_sdk/.clang-format @@ -0,0 +1,72 @@ +--- +AlignAfterOpenBracket: Align +AlignConsecutiveAssignments: true +AlignConsecutiveDeclarations: false +AlignConsecutiveMacros: true +AlignEscapedNewlines: Left +AlignOperands: true +AlignTrailingComments: true +AllowAllParametersOfDeclarationOnNextLine: false +AllowAllArgumentsOnNextLine: false +AllowShortBlocksOnASingleLine: Never +AllowShortCaseLabelsOnASingleLine: false +AllowShortFunctionsOnASingleLine: None +AllowShortIfStatementsOnASingleLine: Never +AllowShortLambdasOnASingleLine: None +AllowShortLoopsOnASingleLine: false +AlwaysBreakAfterReturnType: None +AlwaysBreakBeforeMultilineStrings: false +BinPackArguments: false +BinPackParameters: false +BraceWrapping: + AfterCaseLabel: false + AfterControlStatement: Never + AfterEnum: false + AfterExternBlock: false + AfterFunction: true + AfterNamespace: false + AfterStruct: false + AfterUnion: false + BeforeCatch: false + BeforeElse: false +BreakBeforeBinaryOperators: NonAssignment +BreakBeforeBraces: Custom +BreakBeforeTernaryOperators: true +BreakStringLiterals: true +ColumnLimit: 120 +ContinuationIndentWidth: 2 +Cpp11BracedListStyle: false +DeriveLineEnding: true +DerivePointerAlignment: false +IncludeBlocks: Preserve +IndentCaseLabels: true +IndentGotoLabels: false +IndentPPDirectives: None +IndentWidth: 2 +IndentWrappedFunctionNames: false +Language: Cpp +MaxEmptyLinesToKeep: 1 +PenaltyBreakAssignment: 10 +PenaltyBreakBeforeFirstCallParameter: 1 +PenaltyReturnTypeOnItsOwnLine: 1000000 +PointerAlignment: Right +ReflowComments: false +SortIncludes: false +SpaceAfterCStyleCast: false +SpaceAfterLogicalNot: false +SpaceBeforeAssignmentOperators: true +SpaceBeforeParens: ControlStatements +SpaceBeforeRangeBasedForLoopColon: false +SpaceBeforeSquareBrackets: false +SpaceInEmptyBlock: false +SpaceInEmptyParentheses: false +SpacesBeforeTrailingComments: 1 +SpacesInAngles: false +SpacesInCStyleCastParentheses: false +SpacesInConditionalStatement: false +SpacesInContainerLiterals: false +SpacesInParentheses: false +SpacesInSquareBrackets: false +TabWidth: 2 +UseCRLF: true +UseTab: Never diff --git a/third_party/efr32_sdk/repo b/third_party/efr32_sdk/repo index c48b8de1bed36c..5b35fdb24024ec 160000 --- a/third_party/efr32_sdk/repo +++ b/third_party/efr32_sdk/repo @@ -1 +1 @@ -Subproject commit c48b8de1bed36cc57dd8caba94ecda8a7352524c +Subproject commit 5b35fdb24024ecc9f0af6cb8e38674c60c84dde4