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

wiseconnect: Use static allocation for threads #92

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
@@ -61,6 +61,16 @@
#ifndef SL_SI91X_EVENT_HANDLER_STACK_SIZE
#define SL_SI91X_EVENT_HANDLER_STACK_SIZE 1536
#endif

/**
* Stack size of the bus thread.
* Override by defining SL_SI91X_BUS_THREAD_STACK_SIZE in your project
* or add -DSL_SI91X_BUS_THREAD_STACK_SIZE=<new value> to compiler options.
*/
#ifndef SL_SI91X_BUS_THREAD_STACK_SIZE
#define SL_SI91X_BUS_THREAD_STACK_SIZE 1636
#endif

typedef bool (*sli_si91x_wifi_buffer_comparator)(const sl_wifi_buffer_t *buffer, const void *userdata);

typedef struct {
Original file line number Diff line number Diff line change
@@ -37,6 +37,7 @@
#include "sl_wifi_types.h"
#include "sl_rsi_utility.h"
#include "cmsis_os2.h" // CMSIS RTOS2
#include "cmsis_types.h"
#include "sl_si91x_types.h"
#include "sl_si91x_core_utilities.h"
#ifdef SLI_SI91X_OFFLOAD_NETWORK_STACK
@@ -90,6 +91,12 @@
/// Task register ID to save firmware status
#define SLI_FW_STATUS_STORAGE_INVALID_INDEX 0xFF // Invalid index for firmware status storage

static uint8_t __aligned(8) bus_thread_stack[SL_SI91X_BUS_THREAD_STACK_SIZE];
static uint8_t __aligned(8) event_handler_stack[SL_SI91X_EVENT_HANDLER_STACK_SIZE];

static struct cmsis_rtos_thread_cb bus_thread_cb;
static struct cmsis_rtos_thread_cb event_thread_cb;

/******************************************************
* Local Type Declarations
******************************************************/
@@ -1055,10 +1062,10 @@ sl_status_t sl_si91x_platform_init(void)

.name = "si91x_bus",
.priority = osPriorityRealtime,
.stack_mem = 0,
.stack_size = 1636,
.cb_mem = 0,
.cb_size = 0,
.stack_mem = bus_thread_stack,
.stack_size = SL_SI91X_BUS_THREAD_STACK_SIZE,
.cb_mem = &bus_thread_cb,
.cb_size = sizeof(bus_thread_cb),
.attr_bits = 0u,
.tz_module = 0u,
};
@@ -1070,10 +1077,10 @@ sl_status_t sl_si91x_platform_init(void)
const osThreadAttr_t attr = {
.name = "si91x_event",
.priority = osPriorityRealtime1,
.stack_mem = 0,
.stack_mem = event_handler_stack,
.stack_size = SL_SI91X_EVENT_HANDLER_STACK_SIZE,
.cb_mem = 0,
.cb_size = 0,
.cb_mem = &event_thread_cb,
.cb_size = sizeof(event_thread_cb),
.attr_bits = 0u,
.tz_module = 0u,
};