Skip to content

Commit

Permalink
Added changes for new wifi sdk 917 NCP
Browse files Browse the repository at this point in the history
  • Loading branch information
shgutte committed Dec 14, 2023
1 parent 8e3d98c commit 7eb43ac
Show file tree
Hide file tree
Showing 19 changed files with 177 additions and 87 deletions.
12 changes: 11 additions & 1 deletion examples/platform/silabs/efr32/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,9 @@ source_set("efr32-common") {
}

if (chip_enable_wifi) {
if (use_rs9116 || use_SiWx917) {


if (use_rs9116) {
sources += rs911x_src_plat

# All the stuff from wiseconnect
Expand All @@ -290,6 +292,14 @@ source_set("efr32-common") {

#add compilation flags for rs991x build. This will be addressed directly in wiseconnect sdk in the next version release of that sdk
cflags = rs911x_cflags
} else if (use_SiWx917) {
sources += rs911x_src_plat

# All the stuff from wiseconnect
sources += rs9117_src_sapi
include_dirs += rs9117_inc_plat

#add compilation flags for rs991x build. This will be addressed directly in wiseconnect sdk in the next version release of that sdk
} else if (use_wf200) {
sources += wf200_plat_src
include_dirs += wf200_plat_incs
Expand Down
58 changes: 18 additions & 40 deletions examples/platform/silabs/efr32/rs911x/hal/efx_spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
#include "spidrv.h"

#include "sl_device_init_clocks.h"
#include "sl_device_init_dpll.h"
#include "sl_device_init_hfxo.h"
#include "sl_spidrv_instances.h"
#include "sl_status.h"
Expand All @@ -48,27 +47,15 @@
#include "wfx_host_events.h"
#include "wfx_rsi.h"

#define DEFAULT_SPI_TRASFER_MODE 0
// Macro to drive semaphore block minimun timer in milli seconds
#define RSI_SEM_BLOCK_MIN_TIMER_VALUE_MS (50)
#if defined(SL_CATALOG_POWER_MANAGER_PRESENT)
#include "sl_power_manager.h"
#endif

#ifdef CHIP_9117
#include "cmsis_os2.h"
#include "sl_board_configuration.h"
#include "sl_net.h"
#include "sl_si91x_driver.h"
#include "sl_si91x_types.h"
#include "sl_wifi_callback_framework.h"
#include "sl_wifi_constants.h"
#include "sl_wifi_types.h"

// macro to drive semaphore block minimum timer in milli seconds
// ported from rsi_hal.h (rs911x)
#define RSI_SEM_BLOCK_MIN_TIMER_VALUE_MS (50)
#else
#include "rsi_board_configuration.h"
#include "rsi_driver.h"
#endif // CHIP_9117

#if SL_BTLCTRL_MUX
#include "btl_interface.h"
Expand Down Expand Up @@ -110,6 +97,16 @@ static TaskHandle_t spiInitiatorTaskHandle = NULL;

static uint32_t dummy_buffer; /* Used for DMA - when results don't matter */

#if defined(EFR32MG12)
#include "sl_spidrv_exp_config.h"
extern SPIDRV_Handle_t sl_spidrv_exp_handle;
#define SL_SPIDRV_HANDLE sl_spidrv_exp_handle
#elif defined(EFR32MG24)
#include "spi_multiplex.h"
#else
#error "Unknown platform"
#endif

// variable to identify spi configured for expansion header
// EUSART configuration available on the SPIDRV
static bool spi_enabled = false;
Expand Down Expand Up @@ -174,6 +171,11 @@ void sl_wfx_host_reset_chip(void)
vTaskDelay(pdMS_TO_TICKS(3));
}

void gpio_interrupt(uint8_t interrupt_number)
{
UNUSED_PARAMETER(interrupt_number);
}

/*****************************************************************
* @fn void rsi_hal_board_init(void)
* @brief
Expand Down Expand Up @@ -202,13 +204,6 @@ void rsi_hal_board_init(void)
sl_wfx_host_reset_chip();
}

// wifi-sdk
sl_status_t sl_si91x_host_bus_init(void)
{
rsi_hal_board_init();
return SL_STATUS_OK;
}

void sl_si91x_host_enable_high_speed_bus()
{
// dummy function for wifi-sdk
Expand Down Expand Up @@ -461,20 +456,3 @@ int16_t rsi_spi_transfer(uint8_t * tx_buf, uint8_t * rx_buf, uint16_t xlen, uint
#endif // SL_SPICTRL_MUX
return rsiError;
}

#ifdef CHIP_9117
/*********************************************************************
* @fn int16_t sl_si91x_host_spi_transfer(uint8_t *tx_buf, uint8_t *rx_buf, uint16_t xlen)
* @param[in] uint8_t *tx_buff, pointer to the buffer with the data to be transferred
* @param[in] uint8_t *rx_buff, pointer to the buffer to store the data received
* @param[in] uint16_t transfer_length, Number of bytes to send and receive
* @param[out] None
* @return 0, 0=success
* @section description
* This API is used to transfer/receive data to the Wi-Fi module through the SPI interface.
**************************************************************************/
sl_status_t sl_si91x_host_spi_transfer(const void * tx_buf, void * rx_buf, uint16_t xlen)
{
return (rsi_spi_transfer((uint8_t *) tx_buf, rx_buf, xlen, RSI_MODE_8BIT));
}
#endif // CHIP_9117
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
#if (SIWX_917 | EXP_BOARD)
#include "sl_board_configuration.h"

#include "sl_rsi_utility.h"
#include "sl_si91x_host_interface.h"

void gpio_interrupt(uint8_t interrupt_number);
Expand Down
37 changes: 21 additions & 16 deletions examples/platform/silabs/efr32/rs911x/rs9117.gni
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,17 @@ rs911x_src_plat = [
"${silabs_plat_efr32_wifi_dir}/wfx_notify.cpp",
]

rs911x_inc_plat = [
rs9117_inc_plat = [
"${examples_plat_dir}/rs911x",
"${examples_plat_dir}/rs911x/hal",
"${wifi_sdk_root}/components/si91x/ble/inc",

# si91x component
"${wifi_sdk_root}/components/si91x/inc",
# si91x component
"${wifi_sdk_root}/components/device/silabs/si91x/wireless/ble/inc",
"${wifi_sdk_root}/components/device/silabs/si91x/wireless/inc",
"${wifi_sdk_root}/components/common/inc",
"${wifi_sdk_root}/components/si91x/memory",
"${wifi_sdk_root}/components/si91x/sl_net/inc",
"${wifi_sdk_root}/components/device/silabs/si91x/wireless/sl_net/inc",

# wifi component
"${wifi_sdk_root}/components/protocol/wifi/inc",
Expand All @@ -38,15 +40,18 @@ rs911x_inc_plat = [
]

rs911x_cflags = [ "-Wno-empty-body" ]
rs911x_src_sapi = [
"${wifi_sdk_root}/components/si91x/src/sl_si91x_driver.c",
"${wifi_sdk_root}/components/si91x/spi_interface/sl_si91x_spi_driver.c",
"${wifi_sdk_root}/components/si91x/src/sl_rsi_utility.c",
"${wifi_sdk_root}/components/si91x/src/sl_si91x_callback_framework.c",
"${wifi_sdk_root}/components/si91x/threading/sli_si91x_multithreaded.c",
"${wifi_sdk_root}/components/si91x/sl_net/src/sl_net_si91x.c",
"${wifi_sdk_root}/components/si91x/sl_net/src/sl_net_rsi_utility.c",
"${wifi_sdk_root}/components/si91x/sl_net/src/sl_net_si91x_integration_handler.c",
rs9117_src_sapi = [
# sl_si91x_wireless component
"${wifi_sdk_root}/components/device/silabs/si91x/wireless/src/sl_si91x_driver.c",
"${wifi_sdk_root}/components/device/silabs/si91x/wireless/src/sl_rsi_utility.c",
"${wifi_sdk_root}/components/device/silabs/si91x/wireless/src/sl_si91x_callback_framework.c",
"${wifi_sdk_root}/components/device/silabs/si91x/wireless/threading/sli_si91x_multithreaded.c",
"${wifi_sdk_root}/components/device/silabs/si91x/wireless/sl_net/src/sl_net_rsi_utility.c",
"${wifi_sdk_root}/components/device/silabs/si91x/wireless/sl_net/src/sl_net_si91x_integration_handler.c",
"${wifi_sdk_root}/components/device/silabs/si91x/wireless/sl_net/src/sl_si91x_net_credentials.c",
"${wifi_sdk_root}/components/device/silabs/si91x/wireless/spi_interface/sl_si91x_spi_driver.c",

#"${wifi_sdk_root}/components/si91x/sl_net/src/sl_net_si91x.c",

# wifi component
"${wifi_sdk_root}/components/protocol/wifi/src/sl_wifi_callback_framework.c",
Expand All @@ -57,13 +62,13 @@ rs911x_src_sapi = [
"${wifi_sdk_root}/components/service/network_manager/src/sl_net_basic_profiles.c",

# si91x_basic_buffers component
"${wifi_sdk_root}/components/si91x/memory/malloc_buffers.c",
"${wifi_sdk_root}/components/device/silabs/si91x/wireless/memory/malloc_buffers.c",

# si91x_support component
"${wifi_sdk_root}/components/si91x_support/src/sl_utility.c",
"${wifi_sdk_root}/components/common/src/sl_utility.c",

# network_manager component
"${wifi_sdk_root}/components/service/network_manager/src/sl_net_basic_certificate_store.c",
"${wifi_sdk_root}/components/service/network_manager/src/sl_net.c",
"${wifi_sdk_root}/components/si91x/platforms/efx32/efx32_ncp_host.c",
#"${wifi_sdk_root}/components/device/silabs/si91x/wireless/host_mcu/efx32/efx32_ncp_host.c",
]
13 changes: 13 additions & 0 deletions examples/platform/silabs/efr32/rs911x/rsi_if.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@
#include "wfx_host_events.h"
#include "wfx_rsi.h"

// SLC-FIX
#include "sl_matter_wifi_config.h"

// TODO convert this file to cpp and use CodeUtils.h
#ifndef MIN
#define MIN(a, b) ((a) < (b) ? (a) : (b))
Expand Down Expand Up @@ -123,6 +126,10 @@ int32_t wfx_rsi_get_ap_info(wfx_wifi_scan_result_t * ap)
*********************************************************************/
int32_t wfx_rsi_get_ap_ext(wfx_wifi_scan_ext_t * extra_info)
{
// TODO: Need to remove this condition once wisemcu SDK supports RSI_WLAN_EXT_STATS
#if CHIP_9117
return 0;
#else
int32_t status;
uint8_t buff[RSI_RESPONSE_MAX_SIZE] = { 0 };
status = rsi_wlan_get(RSI_WLAN_EXT_STATS, buff, sizeof(buff));
Expand All @@ -142,6 +149,7 @@ int32_t wfx_rsi_get_ap_ext(wfx_wifi_scan_ext_t * extra_info)
extra_info->overrun_count = test->overrun_count - temp_reset->overrun_count;
}
return status;
#endif
}

/******************************************************************
Expand All @@ -154,6 +162,10 @@ int32_t wfx_rsi_get_ap_ext(wfx_wifi_scan_ext_t * extra_info)
*********************************************************************/
int32_t wfx_rsi_reset_count()
{
// TODO: Need to remove this condition once wisemcu SDK supports RSI_WLAN_EXT_STATS
#if CHIP_9117
return 0;
#else
int32_t status;
uint8_t buff[RSI_RESPONSE_MAX_SIZE] = { 0 };
status = rsi_wlan_get(RSI_WLAN_EXT_STATS, buff, sizeof(buff));
Expand All @@ -173,6 +185,7 @@ int32_t wfx_rsi_reset_count()
temp_reset->overrun_count = test->overrun_count;
}
return status;
#endif
}

/******************************************************************
Expand Down
3 changes: 3 additions & 0 deletions examples/platform/silabs/efr32/rs911x/rsi_wlan_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@

#include "rsi_wlan_defines.h"

// SLC-FIX
#include "sl_matter_wifi_config.h"

//! Enable feature
#define RSI_ENABLE 1
//! Disable feature
Expand Down
8 changes: 4 additions & 4 deletions examples/platform/silabs/efr32/rs911x/sl_wlan_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ static const sl_wifi_device_configuration_t config = {
.boot_config = { .oper_mode = SL_SI91X_CLIENT_MODE,
.coex_mode = SL_SI91X_WLAN_BLE_MODE,
.feature_bit_map =
#ifdef RSI_M4_INTERFACE
#ifdef SLI_SI91X_MCU_INTERFACE
(SL_SI91X_FEAT_SECURITY_OPEN | SL_SI91X_FEAT_WPS_DISABLE),
#else
(SL_SI91X_FEAT_SECURITY_OPEN | SL_SI91X_FEAT_AGGREGATION),
Expand All @@ -45,12 +45,12 @@ static const sl_wifi_device_configuration_t config = {
| SL_SI91X_TCP_IP_FEAT_DHCPV6_CLIENT | SL_SI91X_TCP_IP_FEAT_IPV6
#endif
| SL_SI91X_TCP_IP_FEAT_ICMP | SL_SI91X_TCP_IP_FEAT_EXTENSION_VALID),
.custom_feature_bit_map = (SL_SI91X_FEAT_CUSTOM_FEAT_EXTENTION_VALID | RSI_CUSTOM_FEATURE_BIT_MAP),
.custom_feature_bit_map = (SL_SI91X_CUSTOM_FEAT_EXTENTION_VALID | RSI_CUSTOM_FEATURE_BIT_MAP),
.ext_custom_feature_bit_map = (
#ifdef CHIP_917
#ifdef SLI_SI917
(RSI_EXT_CUSTOM_FEATURE_BIT_MAP)
#else // defaults
#ifdef RSI_M4_INTERFACE
#ifdef SLI_SI91X_MCU_INTERFACE
(SL_SI91X_EXT_FEAT_256K_MODE | RSI_EXT_CUSTOM_FEATURE_BIT_MAP)
#else
(SL_SI91X_EXT_FEAT_384K_MODE | RSI_EXT_CUSTOM_FEATURE_BIT_MAP)
Expand Down
2 changes: 1 addition & 1 deletion examples/platform/silabs/efr32/rs911x/wfx_rsi_host.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@
#include "FreeRTOS.h"
#include "event_groups.h"
#include "task.h"

#include "wfx_host_events.h"
#include "wfx_rsi.h"


/* wfxRsi Task will use as its stack */
StackType_t wfxRsiTaskStack[WFX_RSI_TASK_SZ] = { 0 };

Expand Down
2 changes: 1 addition & 1 deletion src/platform/silabs/efr32/BLEManagerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1053,7 +1053,7 @@ extern "C" void sl_bt_on_event(sl_bt_msg_t * evt)
evt->data.evt_gatt_server_characteristic_status.connection);
}
else if ((evt->data.evt_gatt_server_characteristic_status.characteristic == gattdb_CHIPoBLEChar_Tx) &&
(evt->data.evt_gatt_server_characteristic_status.status_flags == gatt_server_client_config))
(evt->data.evt_gatt_server_characteristic_status.status_flags == sl_bt_gatt_server_client_config))
{
chip::DeviceLayer::Internal::BLEMgrImpl().HandleTXCharCCCDWrite(evt);
}
Expand Down
1 change: 0 additions & 1 deletion src/platform/silabs/efr32/wifi/ethernetif.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
extern "C" {
#endif
#include "cmsis_os2.h"
#include "sl_board_configuration.h"
#include "sl_net.h"
#include "sl_si91x_driver.h"
#include "sl_si91x_host_interface.h"
Expand Down
2 changes: 2 additions & 0 deletions src/platform/silabs/efr32/wifi/wfx_host_events.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ typedef struct __attribute__((__packed__)) sl_wfx_mib_req_s
#include "lwip/netifapi.h"
#include "lwip/tcpip.h"

// SLC-FIX
#include "sl_matter_wifi_config.h"
/* Wi-Fi bitmask events - for the task */
#define SL_WFX_CONNECT (1 << 1)
#define SL_WFX_DISCONNECT (1 << 2)
Expand Down
3 changes: 3 additions & 0 deletions src/platform/silabs/efr32/wifi/wfx_notify.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@
#include <app/server/Dnssd.h>
#include <app/server/Server.h>

// SLC-FIX
#include "sl_matter_wifi_config.h"

using namespace ::chip;
using namespace ::chip::DeviceLayer;

Expand Down
Loading

0 comments on commit 7eb43ac

Please sign in to comment.