Skip to content

Commit 5f49424

Browse files
bhmanda-silabsshgutte
authored andcommitted
[Silabs] [EFR32] Adds RS9116 BLE enabled for all applications (#24914)
* Added changes for RS9116 BLE * Resolved build errors for EFR ble * Added changes rs916 ble manager * Added inlcude path of rs911x BLE * Added change for ble indication * Added change for ble indication * Reduced the rs9116 ble advertisingg interval * Resolved review comments * Adds namespace for the BLE function call * Resolved review comments * Added changes for remove RS91X_BLE_ENABLE define and used the SAPI RSI_BLE_ENABLE define * Adds changes for the clear * Adds changes for RS9116 ble config file path * Adds fixes for EFR32 BLE build * Restyling the PR --------- Co-authored-by: shgutte <[email protected]>
1 parent ee5ada1 commit 5f49424

File tree

20 files changed

+1981
-32
lines changed

20 files changed

+1981
-32
lines changed

examples/light-switch-app/silabs/efr32/BUILD.gn

+12
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ assert(current_os == "freertos")
3434
efr32_project_dir = "${chip_root}/examples/light-switch-app/silabs/efr32"
3535
examples_plat_dir = "${chip_root}/examples/platform/silabs/efr32"
3636
examples_common_plat_dir = "${chip_root}/examples/platform/silabs"
37+
if (chip_enable_ble_rs911x) {
38+
src_plat_dir = "${chip_root}/src/platform/silabs/efr32"
39+
}
3740

3841
import("${examples_plat_dir}/args.gni")
3942

@@ -62,6 +65,15 @@ efr32_sdk("sdk") {
6265
include_dirs += [ "${examples_plat_dir}/wf200" ]
6366
}
6467

68+
if (chip_enable_ble_rs911x) {
69+
# TODO efr32_sdk should not need a header from this location
70+
include_dirs += [
71+
"${src_plat_dir}/rs911x",
72+
"${examples_plat_dir}/rs911x",
73+
"${examples_plat_dir}/rs911x/hal",
74+
]
75+
}
76+
6577
defines = []
6678
if (chip_enable_pw_rpc) {
6779
defines += [

examples/lighting-app/silabs/efr32/BUILD.gn

+13
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ efr32_project_dir = "${chip_root}/examples/lighting-app/silabs/efr32"
3535
examples_plat_dir = "${chip_root}/examples/platform/silabs/efr32"
3636
examples_common_plat_dir = "${chip_root}/examples/platform/silabs"
3737

38+
if (chip_enable_ble_rs911x) {
39+
src_plat_dir = "${chip_root}/src/platform/silabs/efr32"
40+
}
41+
3842
import("${examples_plat_dir}/args.gni")
3943

4044
declare_args() {
@@ -61,6 +65,15 @@ efr32_sdk("sdk") {
6165
include_dirs += [ "${examples_plat_dir}/wf200" ]
6266
}
6367

68+
if (chip_enable_ble_rs911x) {
69+
# TODO efr32_sdk should not need a header from this location
70+
include_dirs += [
71+
"${src_plat_dir}/rs911x",
72+
"${examples_plat_dir}/rs911x",
73+
"${examples_plat_dir}/rs911x/hal",
74+
]
75+
}
76+
6477
defines = []
6578
if (chip_enable_pw_rpc) {
6679
defines += [

examples/lock-app/silabs/efr32/BUILD.gn

+13
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ efr32_project_dir = "${chip_root}/examples/lock-app/silabs/efr32"
3535
examples_plat_dir = "${chip_root}/examples/platform/silabs/efr32"
3636
examples_common_plat_dir = "${chip_root}/examples/platform/silabs"
3737

38+
if (chip_enable_ble_rs911x) {
39+
src_plat_dir = "${chip_root}/src/platform/silabs/efr32"
40+
}
41+
3842
import("${examples_plat_dir}/args.gni")
3943

4044
declare_args() {
@@ -61,6 +65,15 @@ efr32_sdk("sdk") {
6165
include_dirs += [ "${examples_plat_dir}/wf200" ]
6266
}
6367

68+
if (chip_enable_ble_rs911x) {
69+
# TODO efr32_sdk should not need a header from this location
70+
include_dirs += [
71+
"${src_plat_dir}/rs911x",
72+
"${examples_plat_dir}/rs911x",
73+
"${examples_plat_dir}/rs911x/hal",
74+
]
75+
}
76+
6477
defines = []
6578
if (chip_enable_pw_rpc) {
6679
defines += [

examples/platform/silabs/SiWx917/SiWx917/rsi_if.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ bool hasNotifiedIPV4 = false;
6969
#endif /* CHIP_DEVICE_CONFIG_ENABLE_IPV4 */
7070
bool hasNotifiedWifiConnectivity = false;
7171

72-
extern rsi_semaphore_handle_t sl_ble_init_sem;
72+
extern rsi_semaphore_handle_t sl_rs_ble_init_sem;
7373
/*
7474
* This file implements the interface to the RSI SAPIs
7575
*/
@@ -340,7 +340,7 @@ static int32_t wfx_rsi_init(void)
340340
}
341341
#endif
342342
wfx_rsi.dev_state |= WFX_RSI_ST_DEV_READY;
343-
rsi_semaphore_post(&sl_ble_init_sem);
343+
rsi_semaphore_post(&sl_rs_ble_init_sem);
344344
WFX_RSI_LOG("%s: RSI: OK", __func__);
345345
return RSI_SUCCESS;
346346
}

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

+16-4
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,10 @@ bool is_wifi_disconnection_event = false;
7373
/* Declare a variable to hold connection time intervals */
7474
uint32_t retryInterval = WLAN_MIN_RETRY_TIMER_MS;
7575

76+
#if (RSI_BLE_ENABLE)
77+
extern rsi_semaphore_handle_t sl_rs_ble_init_sem;
78+
#endif
79+
7680
/*
7781
* This file implements the interface to the RSI SAPIs
7882
*/
@@ -317,7 +321,7 @@ static int32_t wfx_rsi_init(void)
317321
status = rsi_driver_init(wfx_rsi_drv_buf, WFX_RSI_BUF_SZ);
318322
if ((status < RSI_DRIVER_STATUS) || (status > WFX_RSI_BUF_SZ))
319323
{
320-
WFX_RSI_LOG("%s: error: RSI drv init failed with status: %02x", __func__, status);
324+
WFX_RSI_LOG("%s: error: RSI Driver initialization failed with status: %02x", __func__, status);
321325
return status;
322326
}
323327

@@ -340,11 +344,14 @@ static int32_t wfx_rsi_init(void)
340344
return RSI_ERROR_INVALID_PARAM;
341345
}
342346

343-
/* Initialize WiSeConnect or Module features. */
344-
WFX_RSI_LOG("%s: rsi_wireless_init", __func__);
347+
#if (RSI_BLE_ENABLE)
348+
if ((status = rsi_wireless_init(OPER_MODE_0, RSI_OPERMODE_WLAN_BLE)) != RSI_SUCCESS)
349+
{
350+
#else
345351
if ((status = rsi_wireless_init(OPER_MODE_0, COEX_MODE_0)) != RSI_SUCCESS)
346352
{
347-
WFX_RSI_LOG("%s: error: rsi_wireless_init failed with status: %02x", __func__, status);
353+
#endif
354+
WFX_RSI_LOG("%s: error: Initialize WiSeConnect failed with status: %02x", __func__, status);
348355
return status;
349356
}
350357

@@ -397,6 +404,11 @@ static int32_t wfx_rsi_init(void)
397404
return status;
398405
}
399406
#endif
407+
408+
#if (RSI_BLE_ENABLE)
409+
rsi_semaphore_post(&sl_rs_ble_init_sem);
410+
#endif
411+
400412
wfx_rsi.dev_state |= WFX_RSI_ST_DEV_READY;
401413
WFX_RSI_LOG("%s: RSI: OK", __func__);
402414
return RSI_SUCCESS;

examples/platform/silabs/efr32/rs911x/wfx_rsi.h

+3
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ struct wfx_rsi
5757
EventGroupHandle_t events;
5858
TaskHandle_t drv_task;
5959
TaskHandle_t wlan_task;
60+
#ifdef RSI_BLE_ENABLE
61+
TaskHandle_t ble_task;
62+
#endif
6063
uint16_t dev_state;
6164
uint16_t ap_chan; /* The chan our STA is using */
6265
wfx_wifi_provision_t sec;

examples/thermostat/silabs/efr32/BUILD.gn

+12
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ assert(current_os == "freertos")
3434
efr32_project_dir = "${chip_root}/examples/thermostat/silabs/efr32"
3535
examples_plat_dir = "${chip_root}/examples/platform/silabs/efr32"
3636
examples_common_plat_dir = "${chip_root}/examples/platform/silabs"
37+
if (chip_enable_ble_rs911x) {
38+
src_plat_dir = "${chip_root}/src/platform/silabs/efr32"
39+
}
3740

3841
import("${examples_plat_dir}/args.gni")
3942

@@ -65,6 +68,15 @@ efr32_sdk("sdk") {
6568
include_dirs += [ "${examples_plat_dir}/wf200" ]
6669
}
6770

71+
if (chip_enable_ble_rs911x) {
72+
# TODO efr32_sdk should not need a header from this location
73+
include_dirs += [
74+
"${src_plat_dir}/rs911x",
75+
"${examples_plat_dir}/rs911x",
76+
"${examples_plat_dir}/rs911x/hal",
77+
]
78+
}
79+
6880
defines = []
6981
if (chip_enable_pw_rpc) {
7082
defines += [

examples/window-app/silabs/efr32/BUILD.gn

+12
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ project_dir = "${chip_root}/examples/window-app"
2828
efr32_project_dir = "${project_dir}/silabs/efr32"
2929
examples_plat_dir = "${chip_root}/examples/platform/silabs/efr32"
3030
examples_common_plat_dir = "${chip_root}/examples/platform/silabs"
31+
if (chip_enable_ble_rs911x) {
32+
src_plat_dir = "${chip_root}/src/platform/silabs/efr32"
33+
}
3134

3235
import("${examples_plat_dir}/args.gni")
3336

@@ -54,6 +57,15 @@ efr32_sdk("sdk") {
5457
# TODO efr32_sdk should not need a header from this location
5558
include_dirs += [ "${examples_plat_dir}/wf200" ]
5659
}
60+
61+
if (chip_enable_ble_rs911x) {
62+
# TODO efr32_sdk should not need a header from this location
63+
include_dirs += [
64+
"${src_plat_dir}/rs911x",
65+
"${examples_plat_dir}/rs911x",
66+
"${examples_plat_dir}/rs911x/hal",
67+
]
68+
}
5769
}
5870

5971
efr32_executable("window_app") {

src/platform/silabs/BLEManagerImpl.h

+7-7
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
#include "FreeRTOS.h"
2929
#include "timers.h"
30-
#ifdef RS91X_BLE_ENABLE
30+
#ifdef RSI_BLE_ENABLE
3131
#ifdef __cplusplus
3232
extern "C" {
3333
#endif
@@ -41,7 +41,7 @@ extern "C" {
4141
#include "gatt_db.h"
4242
#include "sl_bgapi.h"
4343
#include "sl_bt_api.h"
44-
#endif // RS91X_BLE_ENABLE
44+
#endif // RSI_BLE_ENABLE
4545

4646
namespace chip {
4747
namespace DeviceLayer {
@@ -58,7 +58,7 @@ class BLEManagerImpl final : public BLEManager, private BleLayer, private BlePla
5858
public:
5959
void HandleBootEvent(void);
6060

61-
#ifdef RS91X_BLE_ENABLE
61+
#ifdef RSI_BLE_ENABLE
6262
void HandleConnectEvent(void);
6363
void HandleConnectionCloseEvent(uint16_t reason);
6464
void HandleWriteEvent(rsi_ble_event_write_t evt);
@@ -76,10 +76,10 @@ class BLEManagerImpl final : public BLEManager, private BleLayer, private BlePla
7676
void HandleTXCharCCCDWrite(volatile sl_bt_msg_t * evt);
7777
void HandleSoftTimerEvent(volatile sl_bt_msg_t * evt);
7878
CHIP_ERROR StartAdvertising(void);
79-
#endif // RS91X_BLE_ENABLE
79+
#endif // RSI_BLE_ENABLE
8080

8181
#if CHIP_ENABLE_ADDITIONAL_DATA_ADVERTISING
82-
#ifdef RS91X_BLE_ENABLE
82+
#ifdef RSI_BLE_ENABLE
8383
static void HandleC3ReadRequest(void);
8484
#else
8585
#if CHIP_ENABLE_ADDITIONAL_DATA_ADVERTISING
@@ -156,7 +156,7 @@ class BLEManagerImpl final : public BLEManager, private BleLayer, private BlePla
156156

157157
struct CHIPoBLEConState
158158
{
159-
#ifndef RS91X_BLE_ENABLE
159+
#ifndef RSI_BLE_ENABLE
160160
bd_addr address;
161161
#endif
162162
uint16_t mtu : 10;
@@ -186,7 +186,7 @@ class BLEManagerImpl final : public BLEManager, private BleLayer, private BlePla
186186
CHIP_ERROR EncodeAdditionalDataTlv();
187187
#endif
188188

189-
#ifdef RS91X_BLE_ENABLE
189+
#ifdef RSI_BLE_ENABLE
190190
void HandleRXCharWrite(rsi_ble_event_write_t * evt);
191191
#else
192192
void HandleRXCharWrite(volatile sl_bt_msg_t * evt);

src/platform/silabs/SiWx917/BLEManagerImpl.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ extern rsi_ble_event_conn_status_t conn_event_to_app;
5959
extern sl_wfx_msg_t event_msg;
6060

6161
StaticTask_t rsiBLETaskStruct;
62-
rsi_semaphore_handle_t sl_ble_init_sem;
62+
rsi_semaphore_handle_t sl_rs_ble_init_sem;
6363
rsi_semaphore_handle_t sl_ble_event_sem;
6464

6565
/* wfxRsi Task will use as its stack */
@@ -99,9 +99,9 @@ void sl_ble_event_handling_task(void)
9999
int32_t event_id;
100100

101101
WFX_RSI_LOG("%s starting", __func__);
102-
rsi_semaphore_create(&sl_ble_init_sem, 0);
102+
rsi_semaphore_create(&sl_rs_ble_init_sem, 0);
103103
//! This semaphore is waiting for wifi module initialization.
104-
rsi_semaphore_wait(&sl_ble_init_sem, 0);
104+
rsi_semaphore_wait(&sl_rs_ble_init_sem, 0);
105105

106106
sl_ble_init();
107107

src/platform/silabs/SiWx917/bluetooth/wfx_sl_ble_init.c

-1
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,6 @@ void rsi_ble_on_disconnect_event(rsi_ble_event_disconnect_t * resp_disconnect, u
143143
{
144144
WFX_RSI_LOG("%s: starting", __func__);
145145
event_msg.reason = reason;
146-
memcpy(event_msg.resp_disconnect, resp_disconnect, sizeof(rsi_ble_event_disconnect_t));
147146
rsi_ble_app_set_event(RSI_BLE_DISCONN_EVENT);
148147
}
149148

src/platform/silabs/efr32/BUILD.gn

+12-3
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,9 @@
1414

1515
import("//build_overrides/chip.gni")
1616

17-
import("${chip_root}/src/platform/device.gni")
18-
1917
import("${chip_root}/build/chip/buildconfig_header.gni")
2018
import("${chip_root}/src/crypto/crypto.gni")
19+
import("${chip_root}/src/platform/device.gni")
2120
import("${chip_root}/third_party/silabs/silabs_board.gni")
2221

2322
silabs_platform_dir = "${chip_root}/src/platform/silabs"
@@ -66,12 +65,22 @@ static_library("efr32") {
6665
"${silabs_platform_dir}/SystemPlatformConfig.h",
6766
"../../FreeRTOS/SystemTimeSupport.cpp",
6867
"../../SingletonConfigurationManager.cpp",
69-
"BLEManagerImpl.cpp",
7068
"ConfigurationManagerImpl.cpp",
7169
"KeyValueStoreManagerImpl.cpp",
7270
"PlatformManagerImpl.cpp",
7371
]
7472

73+
if (chip_enable_ble_rs911x) {
74+
sources += [
75+
"rs911x/BLEManagerImpl.cpp",
76+
"rs911x/rsi_ble_config.h",
77+
"rs911x/wfx_sl_ble_init.c",
78+
"rs911x/wfx_sl_ble_init.h",
79+
]
80+
} else {
81+
sources += [ "BLEManagerImpl.cpp" ]
82+
}
83+
7584
if (chip_enable_ota_requestor) {
7685
sources += [
7786
"OTAImageProcessorImpl.cpp",

0 commit comments

Comments
 (0)