Skip to content

Commit 3e70e5f

Browse files
CuRahmanmykrupp
authored andcommitted
Changes necessary for WiFi SDK lwip component usage vs. source/header file reference
1 parent b88ac27 commit 3e70e5f

File tree

6 files changed

+15
-5
lines changed

6 files changed

+15
-5
lines changed

examples/platform/silabs/efr32/rs911x/rsi_if.c

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#include "em_usart.h"
2727

2828
#include "sl_status.h"
29+
#include "FreeRTOS.h"
2930
#include <cmsis_os2.h>
3031
// TODO Fix include order issue #33120
3132
#include "wfx_host_events.h"

src/platform/silabs/PlatformManagerImpl.cpp

+9-2
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,19 @@ namespace DeviceLayer {
4747
PlatformManagerImpl PlatformManagerImpl::sInstance;
4848

4949
#if defined(SL_MBEDTLS_USE_TINYCRYPT)
50-
sys_mutex_t PlatformManagerImpl::rngMutexHandle = NULL;
50+
sys_mutex_t PlatformManagerImpl::rngMutexHandle = nullptr;
5151

5252
int PlatformManagerImpl::uECC_RNG_Function(uint8_t * dest, unsigned int size)
5353
{
54+
<<<<<<< HEAD:src/platform/silabs/PlatformManagerImpl.cpp
5455
sys_mutex_lock(&rngMutexHandle);
5556
int res = (chip::Crypto::DRBG_get_bytes(dest, size) == CHIP_NO_ERROR) ? size : 0;
5657
sys_mutex_unlock(&rngMutexHandle);
58+
=======
59+
osMutexAcquire(rngMutexHandle, osWaitForever);
60+
int res = (chip::Crypto::DRBG_get_bytes(dest, size) == CHIP_NO_ERROR) ? size : 0;
61+
osMutexRelease(rngMutexHandle);
62+
>>>>>>> 1f2c99eff4 (Changes necessary for WiFi SDK lwip component usage vs. source/header file reference):src/platform/silabs/SiWx917/PlatformManagerImpl.cpp
5763

5864
return res;
5965
}
@@ -97,7 +103,8 @@ CHIP_ERROR PlatformManagerImpl::_InitChipStack(void)
97103
ReturnErrorOnFailure(chip::Crypto::add_entropy_source(app_entropy_source, NULL, 16));
98104
#endif // !SLI_SI91X_MCU_INTERFACE
99105
/* Set RNG function for tinycrypt operations. */
100-
VerifyOrExit(sys_mutex_new(&rngMutexHandle) == ERR_OK, err = CHIP_ERROR_NO_MEMORY);
106+
rngMutexHandle = osMutexNew(nullptr);
107+
VerifyOrExit((&rngMutexHandle != nullptr), err = CHIP_ERROR_NO_MEMORY);
101108
uECC_set_rng(PlatformManagerImpl::uECC_RNG_Function);
102109
#endif // SL_MBEDTLS_USE_TINYCRYPT
103110

src/platform/silabs/PlatformManagerImpl.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#if CHIP_DEVICE_CONFIG_ENABLE_WIFI_STATION
2929
#include "wfx_host_events.h"
3030
#endif
31+
#include <cmsis_os2.h>
3132

3233
namespace chip {
3334
namespace DeviceLayer {
@@ -45,7 +46,7 @@ class PlatformManagerImpl final : public PlatformManager, public Internal::Gener
4546
// Since the RNG callback will be called from multiple threads,
4647
// use this mutex to lock/unlock the call to Matter RNG API, which
4748
// uses some global variables.
48-
static sys_mutex_t rngMutexHandle;
49+
static osMutexId_t rngMutexHandle;
4950

5051
// Callback used by tinycrypt to generate random numbers.
5152
// It must be set before calling any sign operations,

src/platform/silabs/SiWx917/wifi/ethernetif.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include <stdio.h>
2121
#include <stdlib.h>
2222
#include <string.h>
23+
#include <FreeRTOS.h>
2324

2425
#include "wfx_host_events.h"
2526
#include "wifi_config.h"

src/platform/silabs/SiWx917/wifi/wfx_host_events.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
#include "wfx_msgs.h"
2424

2525
/* LwIP includes. */
26-
#include "lwip/apps/httpd.h"
26+
// #include "lwip/apps/httpd.h" // Do we need ?
2727
#include "lwip/ip_addr.h"
2828
#include "lwip/netif.h"
2929
#include "lwip/netifapi.h"

src/platform/silabs/efr32/wifi/wfx_host_events.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ typedef struct __attribute__((__packed__)) sl_wfx_mib_req_s
117117
#endif /* WF200 */
118118

119119
/* LwIP includes. */
120-
#include "lwip/apps/httpd.h"
120+
// #include "lwip/apps/httpd.h" Needed ?
121121
#include "lwip/ip_addr.h"
122122
#include "lwip/netif.h"
123123
#include "lwip/netifapi.h"

0 commit comments

Comments
 (0)