Skip to content

Commit

Permalink
fixing the build for rs9116
Browse files Browse the repository at this point in the history
  • Loading branch information
chirag-silabs committed Aug 29, 2024
1 parent 702136e commit 1061569
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 38 deletions.
40 changes: 24 additions & 16 deletions examples/platform/silabs/efr32/rs911x/rsi_if.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,17 @@

#define WFX_QUEUE_SIZE 10

/* Rsi driver Task will use as its stack */
StackType_t driverRsiTaskStack[WFX_RSI_WLAN_TASK_SZ] = { 0 };

/* Structure that will hold the TCB of the wfxRsi Task being created. */
StaticTask_t driverRsiTaskBuffer;

/* Declare a variable to hold the data associated with the created event group. */
StaticEventGroup_t rsiDriverEventGroup;
#define kDrvTaskSize 2048 // Example size, adjust as needed

static uint8_t drvStack[kDrvTaskSize];
static osThread_t sDrvTaskControlBlock;
osThreadAttr_t kDrvTaskAttr = { .name = "drv_rsi",
.attr_bits = osThreadDetached,
.cb_mem = &sDrvTaskControlBlock,
.cb_size = osThreadCbSize,
.stack_mem = drvStack,
.stack_size = kDrvTaskSize,
.priority = osPriorityHigh };

bool hasNotifiedIPV6 = false;
#if (CHIP_DEVICE_CONFIG_ENABLE_IPV4)
Expand All @@ -83,6 +86,10 @@ static osMessageQueueId_t sWifiEventQueue = NULL;
static uint8_t wfx_rsi_drv_buf[WFX_RSI_BUF_SZ];
static wfx_wifi_scan_ext_t temp_reset;

static void rsi_wireless_driver_task_wrapper(void *argument) {
rsi_wireless_driver_task();
}

static void DHCPTimerEventHandler(void * arg)
{
WfxEvent_t event;
Expand Down Expand Up @@ -359,15 +366,16 @@ static int32_t wfx_rsi_init(void)
}
SILABS_LOG("wfx_rsi_init: start wireless drv task", __func__);
/*
* Create the driver task
* Create the driver thread
*/
wfx_rsi.drv_task = xTaskCreateStatic((TaskFunction_t) rsi_wireless_driver_task, "rsi_drv", WFX_RSI_WLAN_TASK_SZ, NULL,
WLAN_TASK_PRIORITY, driverRsiTaskStack, &driverRsiTaskBuffer);
if (NULL == wfx_rsi.drv_task)
{
SILABS_LOG("wfx_rsi_init: error: rsi_wireless_driver_task failed", __func__);
return RSI_ERROR_INVALID_PARAM;
}
wfx_rsi.drv_thread = osThreadNew(rsi_wireless_driver_task_wrapper, NULL, &kDrvTaskAttr);
// wfx_rsi.drv_task = xTaskCreateStatic((TaskFunction_t) rsi_wireless_driver_task, "rsi_drv", WFX_RSI_WLAN_TASK_SZ, NULL,
// WLAN_TASK_PRIORITY, driverRsiTaskStack, &driverRsiTaskBuffer);
// if (NULL == wfx_rsi.drv_task)
// {
// SILABS_LOG("wfx_rsi_init: error: rsi_wireless_driver_task failed", __func__);
// return RSI_ERROR_INVALID_PARAM;
// }

#if (RSI_BLE_ENABLE)
if ((status = rsi_wireless_init(OPER_MODE_0, RSI_OPERMODE_WLAN_BLE)) != RSI_SUCCESS)
Expand Down
43 changes: 21 additions & 22 deletions examples/platform/silabs/efr32/rs911x/wfx_rsi_host.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,27 +19,27 @@
#include <stdlib.h>
#include <string.h>

#include "em_bus.h"
#include "em_cmu.h"
#include "em_gpio.h"
#include "em_ldma.h"
#include "em_usart.h"
#include "sl_status.h"

#include "silabs_utils.h"

#include "FreeRTOS.h"
#include "event_groups.h"
#include "silabs_utils.h"
#include "sl_status.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 };
#include <platform/CHIPDeviceLayer.h>

/* Structure that will hold the TCB of the wfxRsi Task being created. */
StaticTask_t wfxRsiTaskBuffer;
// Thread for the WLAN RSI
constexpr uint32_t kWlanTaskSize = 2048;
static uint8_t wlanStack[kWlanTaskSize];
static osThread_t sWlanTaskControlBlock;
constexpr osThreadAttr_t kWlanTaskAttr = { .name = "wlan_rsi",
.attr_bits = osThreadDetached,
.cb_mem = &sWlanTaskControlBlock,
.cb_size = osThreadCbSize,
.stack_mem = wlanStack,
.stack_size = kWlanTaskSize,
.priority = osPriorityAboveNormal7 };

/*********************************************************************
* @fn sl_status_t wfx_wifi_start(void)
Expand All @@ -52,21 +52,20 @@ StaticTask_t wfxRsiTaskBuffer;
***********************************************************************/
sl_status_t wfx_wifi_start(void)
{
if (wfx_rsi.dev_state & WFX_RSI_ST_STARTED)
{
if (wfx_rsi.dev_state & WFX_RSI_ST_STARTED) {
return SL_STATUS_OK;
}
wfx_rsi.dev_state |= WFX_RSI_ST_STARTED;
SILABS_LOG("%s: starting..", __func__);

/*
* Create the Wifi driver task
*/
wfx_rsi.wlan_task = xTaskCreateStatic(wfx_rsi_task, "wfx_rsi", WFX_RSI_TASK_SZ, NULL, WLAN_DRIVER_TASK_PRIORITY,
wfxRsiTaskStack, &wfxRsiTaskBuffer);
// Creating a Wi-Fi driver thread
wfx_rsi.wlan_thread = osThreadNew(wfx_rsi_task, NULL, &kWlanTaskAttr);

VerifyOrReturnError(wfx_rsi.wlan_thread != NULL, SL_STATUS_FAIL);

if (NULL == wfx_rsi.wlan_task)
{
return SL_STATUS_FAIL;
}
return SL_STATUS_OK;
}

Expand Down

0 comments on commit 1061569

Please sign in to comment.