Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SILABS] [RS917] Added support for Wi-Fi SDK 3.1.0 for 917 NCP #28943

Merged
Merged
Show file tree
Hide file tree
Changes from 30 commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
0d3a72e
Added changes for 917 NCP brignup
shgutte Aug 8, 2023
934d23a
Added changes for 917 ncp
shgutte Aug 8, 2023
6b128c0
Resolved build errors for 917 NCP
bhmanda-silabs Aug 9, 2023
e7a13a4
Resolved build errors for 917 NCP
bhmanda-silabs Aug 9, 2023
0f93645
added changes in efr32_sdk.gni for wifi sdk
bhmanda-silabs Aug 9, 2023
d128bf9
Build errors resolved
bhmanda-silabs Aug 9, 2023
e6d0d68
Fixed NCP build errors
bhmanda-silabs Aug 9, 2023
8703929
Added fix for sl wifi init
bhmanda-silabs Aug 11, 2023
55d61ad
Added BLE defines in efr32_sdk.gni
bhmanda-silabs Aug 11, 2023
2ffa513
Added changes for the 917 NCP
shgutte Aug 18, 2023
75024fd
Added changes 917 NCP
shgutte Aug 22, 2023
bd735f0
Added chnages for NCP rx buffer
shgutte Aug 28, 2023
63c3af3
changes for 917 NCP mode
shgutte Aug 29, 2023
d58dad9
Updated wifi sdk commit
shgutte Aug 29, 2023
5ac7537
removed the commented code
shgutte Aug 29, 2023
5a1aa25
Removed the commented code and required changes for SDk 3.0
shgutte Aug 30, 2023
d7662b2
Merge branch 'master' of https://github.com/project-chip/connectedhom…
shgutte Aug 30, 2023
7269e98
Added changes for RS9116 build
shgutte Aug 31, 2023
b6f9282
Added fix for RS9116 build issue
shgutte Aug 31, 2023
5eb7794
Removed the unused code
shgutte Sep 1, 2023
fde6f95
Fixed warning changes for the 917 ncp
shgutte Sep 1, 2023
5a60ced
Added licence for the file
shgutte Sep 1, 2023
0a493b8
Merge branch 'master' of https://github.com/project-chip/connectedhom…
shgutte Sep 4, 2023
e48741d
Merge branch 'master' of https://github.com/project-chip/connectedhom…
shgutte Sep 5, 2023
7f6a3ea
Added changes for the SOC and NCP
shgutte Sep 5, 2023
06c49ea
Removed the sl_wifi_if duplicate file
shgutte Sep 7, 2023
1c3b7c8
Added changes related to efr32_sdk
shgutte Sep 7, 2023
7fd0c16
Added changes for define
shgutte Sep 7, 2023
ad8a2b9
Added changes for rs9116 and SOC error
shgutte Sep 7, 2023
94e9181
Added wifi component for 917 NCP
shgutte Sep 8, 2023
5c041a4
Fixeed the hardfault for 917 NCP
shgutte Sep 12, 2023
333f965
Removed EFR32 MG12 for the SI917
shgutte Sep 12, 2023
1ebe2f5
Restyled by whitespace
restyled-commits Sep 12, 2023
d070155
Added changes for the comments
shgutte Sep 12, 2023
c6bd8a5
Added chnages for sdk 3.1.0
shgutte Sep 14, 2023
e3469dd
Adds wifi-sdk 3.1.0 and required changes for it
silabs-srishylam Sep 13, 2023
6bc8d39
Added SOC and Common flash fixes
shgutte Sep 15, 2023
d251ac9
Added changes for retyle commit
shgutte Sep 18, 2023
dd51bfb
Added restyle changes
shgutte Sep 18, 2023
d696a13
Added changes for the third party silabs sdk
shgutte Sep 18, 2023
c09210f
Restyled by gn
restyled-commits Sep 18, 2023
10a7122
Merge branch 'master' of https://github.com/project-chip/connectedhom…
shgutte Sep 18, 2023
1d1cbcc
Added changes for the rs9117 NCP file
shgutte Sep 18, 2023
e015daf
Added changes according to CSA comment
shgutte Sep 18, 2023
a55a75d
Restyled by gn
restyled-commits Sep 18, 2023
3a7cf30
Added func return type
shgutte Sep 18, 2023
995bb23
Added micro changes for the command buffer time
shgutte Sep 18, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
262 changes: 133 additions & 129 deletions examples/platform/silabs/SiWx917/SiWx917/sl_wifi_if.c

Large diffs are not rendered by default.

8 changes: 5 additions & 3 deletions examples/platform/silabs/efr32/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,12 @@ if (chip_enable_wifi) {
assert(use_rs9116 || use_wf200 || use_SiWx917)
import("${chip_root}/src/platform/silabs/wifi_args.gni")

if (use_rs9116 || use_SiWx917) {
wiseconnect_sdk_root =
"${chip_root}/third_party/silabs/wiseconnect-wifi-bt-sdk"
if (use_rs9116 ) {
wiseconnect_sdk_root = "${chip_root}/third_party/silabs/wiseconnect-wifi-bt-sdk"
import("rs911x/rs911x.gni")
} else if (use_SiWx917) {
wifi_sdk_root = "${chip_root}/third_party/silabs/wifi_sdk"
import("rs911x/rs9117.gni")
}
if (use_wf200) {
import("wf200/wf200.gni")
Expand Down
52 changes: 50 additions & 2 deletions examples/platform/silabs/efr32/rs911x/hal/efx_spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,26 @@
#include "wfx_host_events.h"
#include "wfx_rsi.h"

#ifdef CHIP_9117
#include "sl_si91x_driver.h"
#include "cmsis_os2.h"
#include "sl_net.h"
#include "sl_board_configuration.h"
#include "sl_wifi_types.h"
#include "sl_si91x_types.h"
#include "sl_wifi_callback_framework.h"
#include "sl_wifi_constants.h"
#else
#include "rsi_board_configuration.h"
#include "rsi_driver.h"
#endif

#include "sl_device_init_dpll.h"
#include "sl_device_init_hfxo.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
Expand All @@ -72,6 +87,8 @@ StaticSemaphore_t xEfxSpiIntfSemaBuffer;
static SemaphoreHandle_t spiTransferLock;
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;
Expand Down Expand Up @@ -174,6 +191,19 @@ 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
}


#if defined(EFR32MG24)

void SPIDRV_SetBaudrate(uint32_t baudrate)
Expand Down Expand Up @@ -342,11 +372,12 @@ int16_t rsi_spi_transfer(uint8_t * tx_buf, uint8_t * rx_buf, uint16_t xlen, uint
*/
if (xlen <= MIN_XLEN || (tx_buf == NULL && rx_buf == NULL))
{
return RSI_ERROR_INVALID_PARAM;
rx_buf = (uint8_t *)&dummy_buffer;
shgutte marked this conversation as resolved.
Show resolved Hide resolved
shgutte marked this conversation as resolved.
Show resolved Hide resolved
tx_buf = (uint8_t *)&dummy_buffer;
}

(void) mode; // currently not used;
rsi_error_t rsiError = RSI_ERROR_NONE;
error_t rsiError = RSI_ERROR_NONE;

xSemaphoreTake(spiTransferLock, portMAX_DELAY);

Expand Down Expand Up @@ -398,3 +429,20 @@ int16_t rsi_spi_transfer(uint8_t * tx_buf, uint8_t * rx_buf, uint16_t xlen, uint
#endif /* EFR32MG24 */
return rsiError;
}


/*********************************************************************
* @fn int16_t rsi_spi_transfer(uint8_t *tx_buf, uint8_t *rx_buf, uint16_t xlen, uint8_t mode)
* @brief
* Do a SPI transfer - Mode is 8/16 bit - But every 8 bit is aligned
* @param[in] tx_buf:
* @param[in] rx_buf:
* @param[in] xlen:
* @param[in] mode:
* @return
* None
**************************************************************************/
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, DEFAULT_SPI_TRASFER_MODE));
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,16 @@
#include "wfx_host_events.h"
#include "wfx_rsi.h"

#if (SIWX_917 | EXP_BOARD)
#include "sl_board_configuration.h"

#include "sl_si91x_host_interface.h"

void gpio_interrupt(uint8_t interrupt_number);
#else
#include "rsi_board_configuration.h"
#include "rsi_driver.h"
#endif

typedef void (*UserIntCallBack_t)(void);
UserIntCallBack_t call_back, gpio_callback;
Expand All @@ -52,9 +60,13 @@ void rsi_gpio_irq_cb(uint8_t irqnum)
{
if (irqnum != SL_WFX_HOST_PINOUT_SPI_IRQ)
return;
#if (SIWX_917 | EXP_BOARD)
sl_si91x_host_set_bus_event(NCP_HOST_BUS_RX_EVENT);
#else
GPIO_IntClear(1 << SL_WFX_HOST_PINOUT_SPI_IRQ);
if (call_back != NULL)
(*call_back)();
#endif
}

/*===================================================*/
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/*
shgutte marked this conversation as resolved.
Show resolved Hide resolved
*
* 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.
*/

#ifndef _RSI_BOARD_CONFIGURATION_H_
#define _RSI_BOARD_CONFIGURATION_H_

typedef struct
{
unsigned char port;
unsigned char pin;
} sl_pin_t;

#define PIN(port_id, pin_id) \
(sl_pin_t) \
{ \
.port = gpioPort##port_id, .pin = pin_id \
}

#define PACKET_PENDING_INT_PRI 3

#if defined(EFR32MG12_BRD4161A) || defined(BRD4161A) || defined(EFR32MG12_BRD4162A) || defined(BRD4162A) || \
defined(EFR32MG12_BRD4163A) || defined(BRD4163A) || defined(EFR32MG12_BRD4164A) || defined(BRD4164A) || \
defined(EFR32MG12_BRD4170A) || defined(BRD4170A)
// BRD4161-63-64 are pin to pin compatible for SPI
#include "brd4161a.h"
shgutte marked this conversation as resolved.
Show resolved Hide resolved
#elif defined(EFR32MG24_BRD4186C) || defined(BRD4186C)
#include "brd4186c.h"
#elif defined(EFR32MG24_BRD4187C) || defined(BRD4187C)
#include "brd4187c.h"
#else
#error "Need SPI Pins"
#endif /* EFR32MG12_BRD4161A */
#if EXP_BOARD && (defined(EFR32MG24_BRD4187C) || defined(BRD4187C) || defined(EFR32MG24_BRD4186C) || defined(BRD4186C))
shgutte marked this conversation as resolved.
Show resolved Hide resolved
#define RESET_PIN PIN(A, 6)
#define INTERRUPT_PIN PIN(A, 7)
#define SLEEP_CONFIRM_PIN PIN(A, 5) /* Exp hdr 7 */
#define SL_WFX_HOST_PINOUT_SPI_IRQ 5
#endif


#define NETWORK_INTERFACE_VALID(x) \
(x == SL_NET_DEFAULT_WIFI_CLIENT_INTERFACE) || (x == SL_NET_DEFAULT_WIFI_AP_INTERFACE)
#endif /* _RSI_BOARD_CONFIGURATION_H_ */
103 changes: 57 additions & 46 deletions examples/platform/silabs/efr32/rs911x/rs9117.gni
Original file line number Diff line number Diff line change
Expand Up @@ -2,63 +2,74 @@ import("//build_overrides/chip.gni")

examples_plat_dir = "${chip_root}/examples/platform/silabs/efr32"
wifi_sdk_dir = "${chip_root}/src/platform/silabs/efr32/wifi"
wisemcu_sdk_root = "${chip_root}/third_party/silabs/wisemcu-wifi-bt-sdk"
wifi_sdk_root = "${chip_root}/third_party/silabs/wifi_sdk"

rs911x_src_plat = [
"${examples_plat_dir}/rs911x/rsi_if.c",
"${examples_plat_dir}/rs911x/sl_wifi_if.c",
"${examples_plat_dir}/rs911x/wfx_rsi_host.c",
"${examples_plat_dir}/rs911x/hal/rsi_hal_mcu_interrupt.c",
"${examples_plat_dir}/rs911x/hal/rsi_hal_mcu_ioports.c",
"${examples_plat_dir}/rs911x/hal/rsi_hal_mcu_timer.c",
"${examples_plat_dir}/rs911x/hal/efx_spi.c",
"${wifi_sdk_dir}/wfx_notify.cpp",
]

rs911x_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",
"${wifi_sdk_root}/components/si91x/memory",
"${wifi_sdk_root}/components/si91x/sl_net/inc",
#
# All the stuff from wiseconnect
#
rs911x_src_sapi = [
"${wisemcu_sdk_root}/sapi/wlan/rsi_wlan_apis.c",
"${wisemcu_sdk_root}/sapi/common/rsi_apis_non_rom.c",
"${wisemcu_sdk_root}/sapi/common/rsi_apis_rom.c",
"${wisemcu_sdk_root}/sapi/common/rsi_common_apis.c",
"${wisemcu_sdk_root}/sapi/common/rsi_device_init_apis.c",
"${wisemcu_sdk_root}/sapi/driver/device_interface/spi/rsi_spi_frame_rd_wr.c",
"${wisemcu_sdk_root}/sapi/driver/device_interface/spi/rsi_spi_functs.c",
"${wisemcu_sdk_root}/sapi/driver/device_interface/spi/rsi_spi_iface_init.c",
"${wisemcu_sdk_root}/sapi/driver/device_interface/spi/rsi_spi_mem_rd_wr.c",
"${wisemcu_sdk_root}/sapi/driver/device_interface/spi/rsi_spi_reg_rd_wr.c",
"${wisemcu_sdk_root}/sapi/driver/rsi_common.c",
"${wisemcu_sdk_root}/sapi/driver/rsi_device_init.c",
"${wisemcu_sdk_root}/sapi/driver/rsi_driver_event_handlers.c",
"${wisemcu_sdk_root}/sapi/driver/rsi_driver.c",
"${wisemcu_sdk_root}/sapi/driver/rsi_events_rom.c",
"${wisemcu_sdk_root}/sapi/driver/rsi_events.c",
"${wisemcu_sdk_root}/sapi/driver/rsi_iap.c",
"${wisemcu_sdk_root}/sapi/driver/rsi_nwk_rom.c",
"${wisemcu_sdk_root}/sapi/driver/rsi_nwk.c",
"${wisemcu_sdk_root}/sapi/driver/rsi_pkt_mgmt_rom.c",
"${wisemcu_sdk_root}/sapi/driver/rsi_pkt_mgmt.c",
"${wisemcu_sdk_root}/sapi/driver/rsi_queue_rom.c",
"${wisemcu_sdk_root}/sapi/driver/rsi_queue.c",
"${wisemcu_sdk_root}/sapi/driver/rsi_scheduler_rom.c",
"${wisemcu_sdk_root}/sapi/driver/rsi_scheduler.c",
"${wisemcu_sdk_root}/sapi/driver/rsi_setregion_countryinfo.c",
"${wisemcu_sdk_root}/sapi/driver/rsi_timer.c",
"${wisemcu_sdk_root}/sapi/driver/rsi_utils_rom.c",
"${wisemcu_sdk_root}/sapi/driver/rsi_utils.c",
"${wisemcu_sdk_root}/sapi/driver/rsi_wlan.c",
"${wisemcu_sdk_root}/sapi/rtos/freertos_wrapper/rsi_os_wrapper.c",
# # siwx917_soc component
shgutte marked this conversation as resolved.
Show resolved Hide resolved
# "${wifi_sdk_root}/components/siwx917_soc/inc",
# "${wifi_sdk_root}/components/siwx917_soc/wifi_inc",

# wifi component
"${wifi_sdk_root}/components/protocol/wifi/inc",

# si91x_support component
"${wifi_sdk_root}/components/si91x_support/inc",

# wifi_resources component
"${wifi_sdk_root}/resources/certificates",
"${wifi_sdk_root}/resources/defaults",
"${wifi_sdk_root}/resources/other",

# Apparently - the rsi library needs this (though we may not use use it)
"${wisemcu_sdk_root}/sapi/network/socket/rsi_socket.c",
"${wisemcu_sdk_root}/sapi/network/socket/rsi_socket_rom.c",
# network_manager component
"${wifi_sdk_root}/components/service/network_manager/inc",

# nvm3
"${wifi_sdk_root}/components/siwx917_soc/drivers/middleware/nvm3/inc",
shgutte marked this conversation as resolved.
Show resolved Hide resolved
"${wifi_sdk_root}/components/protocol/wifi/si91x",
]

rs911x_cflags = [ "-Wno-empty-body" ]

rs911x_inc_plat = [
"${examples_plat_dir}/rs911x",
"${examples_plat_dir}/rs911x/hal",
"${wisemcu_sdk_root}/sapi/include",
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",
# wifi component
"${wifi_sdk_root}/components/protocol/wifi/src/sl_wifi_callback_framework.c",
"${wifi_sdk_root}/components/protocol/wifi/si91x/sl_wifi.c",
# basic_network_manager component
"${wifi_sdk_root}/components/service/network_manager/src/sl_net_basic_credentials.c",
"${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",
# si91x_support component
"${wifi_sdk_root}/components/si91x_support/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",
]



1 change: 1 addition & 0 deletions examples/platform/silabs/efr32/rs911x/sl_wifi_if.c
Loading