Merge pull request #8 from flyinggorilla/main
adding menuconfig options for defining Task to core affinity as well as task priority
This commit is contained in:
commit
deeb89f1ea
|
|
@ -101,6 +101,62 @@ menu "esp32_BNO08x"
|
||||||
Stack size of task responsible for calling shtp_service() when HINT is asserted,
|
Stack size of task responsible for calling shtp_service() when HINT is asserted,
|
||||||
to dispatch any sh2 HAL lib callbacks.
|
to dispatch any sh2 HAL lib callbacks.
|
||||||
|
|
||||||
|
config ESP32_BNO08X_CB_TASK_AFFINITY
|
||||||
|
int "Callback task core affinity"
|
||||||
|
range -1 1
|
||||||
|
default -1
|
||||||
|
help
|
||||||
|
Core to which the callback task is pinned.
|
||||||
|
-1 = No specific core (tskNO_AFFINITY)
|
||||||
|
0 = Core 0
|
||||||
|
1 = Core 1
|
||||||
|
|
||||||
|
config ESP32_BNO08X_CB_TASK_PRIORITY
|
||||||
|
int "Callback task priority"
|
||||||
|
range 0 25
|
||||||
|
default 5
|
||||||
|
help
|
||||||
|
Priority of the callback task.
|
||||||
|
0 is lowest priority, 25 is highest priority.
|
||||||
|
|
||||||
|
config ESP32_BNO08X_DATA_PROC_TASK_AFFINITY
|
||||||
|
int "Data processing task core affinity"
|
||||||
|
range -1 1
|
||||||
|
default -1
|
||||||
|
help
|
||||||
|
Core to which the data processing task is pinned.
|
||||||
|
-1 = No specific core (tskNO_AFFINITY)
|
||||||
|
0 = Core 0
|
||||||
|
1 = Core 1
|
||||||
|
|
||||||
|
config ESP32_BNO08X_DATA_PROC_TASK_PRIORITY
|
||||||
|
int "Data processing task priority"
|
||||||
|
range 0 25
|
||||||
|
default 6
|
||||||
|
help
|
||||||
|
Priority of the data processing task.
|
||||||
|
0 is lowest priority, 25 is highest priority.
|
||||||
|
|
||||||
|
config ESP32_BNO08X_SH2_HAL_SERVICE_TASK_AFFINITY
|
||||||
|
int "SH2 HAL service task core affinity"
|
||||||
|
range -1 1
|
||||||
|
default -1
|
||||||
|
help
|
||||||
|
Core to which the SH2 HAL service task is pinned.
|
||||||
|
-1 = No specific core (tskNO_AFFINITY)
|
||||||
|
0 = Core 0
|
||||||
|
1 = Core 1
|
||||||
|
|
||||||
|
config ESP32_BNO08X_SH2_HAL_SERVICE_TASK_PRIORITY
|
||||||
|
int "SH2 HAL service task priority"
|
||||||
|
range 0 25
|
||||||
|
default 7
|
||||||
|
help
|
||||||
|
Priority of the SH2 HAL service task.
|
||||||
|
0 is lowest priority, 25 is highest priority.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
endmenu #Tasks
|
endmenu #Tasks
|
||||||
|
|
||||||
menu "Callbacks"
|
menu "Callbacks"
|
||||||
|
|
|
||||||
|
|
@ -150,6 +150,19 @@ class BNO08x
|
||||||
static void cb_task_trampoline(void* arg);
|
static void cb_task_trampoline(void* arg);
|
||||||
void cb_task();
|
void cb_task();
|
||||||
|
|
||||||
|
static const constexpr BaseType_t CB_TASK_AFFINITY =
|
||||||
|
CONFIG_ESP32_BNO08X_CB_TASK_AFFINITY < 0 ? tskNO_AFFINITY : CONFIG_ESP32_BNO08X_CB_TASK_AFFINITY ; /// tskNO_AFFINITY if not pinned to a core, 0 or 1
|
||||||
|
static const constexpr UBaseType_t CB_TASK_PRIORITY = CONFIG_ESP32_BNO08X_CB_TASK_PRIORITY; /// 5 per default, Priority of the callback task, 0-25, 0 is lowest priority, 25 is highest priority
|
||||||
|
|
||||||
|
static const constexpr BaseType_t DATA_PROC_TASK_AFFINITY =
|
||||||
|
CONFIG_ESP32_BNO08X_DATA_PROC_TASK_AFFINITY < 0 ? tskNO_AFFINITY : CONFIG_ESP32_BNO08X_DATA_PROC_TASK_AFFINITY; /// tskNO_AFFINITY if not pinned to a core, 0 or 1
|
||||||
|
static const constexpr UBaseType_t DATA_PROC_TASK_PRIORITY = CONFIG_ESP32_BNO08X_DATA_PROC_TASK_PRIORITY; /// 6 per default, Priority of the data processing task, 0-25, 0 is lowest priority, 25 is highest priority
|
||||||
|
|
||||||
|
static const constexpr BaseType_t SH2_HAL_SERVICE_TASK_AFFINITY =
|
||||||
|
CONFIG_ESP32_BNO08X_SH2_HAL_SERVICE_TASK_AFFINITY < 0 ? tskNO_AFFINITY : CONFIG_ESP32_BNO08X_SH2_HAL_SERVICE_TASK_AFFINITY; /// tskNO_AFFINITY if not pinned to a core, 0 or 1
|
||||||
|
static const constexpr UBaseType_t SH2_HAL_SERVICE_TASK_PRIORITY = CONFIG_ESP32_BNO08X_SH2_HAL_SERVICE_TASK_PRIORITY; /// 7 per default, Priority of the sh2 HAL service task, 0-25, 0 is lowest priority, 25 is highest priority
|
||||||
|
|
||||||
|
|
||||||
SemaphoreHandle_t sem_kill_tasks; ///<Counting Semaphore to count amount of killed tasks.
|
SemaphoreHandle_t sem_kill_tasks; ///<Counting Semaphore to count amount of killed tasks.
|
||||||
|
|
||||||
void lock_sh2_HAL();
|
void lock_sh2_HAL();
|
||||||
|
|
|
||||||
|
|
@ -636,9 +636,14 @@ esp_err_t BNO08x::init_tasks()
|
||||||
|
|
||||||
xEventGroupSetBits(sync_ctx.evt_grp_task, EVT_GRP_BNO08x_TASKS_RUNNING);
|
xEventGroupSetBits(sync_ctx.evt_grp_task, EVT_GRP_BNO08x_TASKS_RUNNING);
|
||||||
|
|
||||||
// launch data processing task
|
// launch data processing task 6
|
||||||
task_created = xTaskCreate(
|
task_created = xTaskCreatePinnedToCore(
|
||||||
&data_proc_task_trampoline, "bno08x_data_processing_task", DATA_PROC_TASK_SZ, this, 6, &data_proc_task_hdl);
|
&data_proc_task_trampoline, "bno08x_data_processing_task",
|
||||||
|
DATA_PROC_TASK_SZ,
|
||||||
|
this,
|
||||||
|
DATA_PROC_TASK_PRIORITY,
|
||||||
|
&data_proc_task_hdl,
|
||||||
|
DATA_PROC_TASK_AFFINITY);
|
||||||
|
|
||||||
if (task_created != pdTRUE)
|
if (task_created != pdTRUE)
|
||||||
{
|
{
|
||||||
|
|
@ -655,8 +660,13 @@ esp_err_t BNO08x::init_tasks()
|
||||||
init_status.data_proc_task = true;
|
init_status.data_proc_task = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// launch cb task
|
// launch cb task 5
|
||||||
task_created = xTaskCreate(&cb_task_trampoline, "bno08x_cb_task", CB_TASK_SZ, this, 5, &cb_task_hdl);
|
task_created = xTaskCreatePinnedToCore(&cb_task_trampoline, "bno08x_cb_task",
|
||||||
|
CB_TASK_SZ,
|
||||||
|
this,
|
||||||
|
CB_TASK_PRIORITY,
|
||||||
|
&cb_task_hdl,
|
||||||
|
CB_TASK_AFFINITY);
|
||||||
|
|
||||||
if (task_created != pdTRUE)
|
if (task_created != pdTRUE)
|
||||||
{
|
{
|
||||||
|
|
@ -673,9 +683,13 @@ esp_err_t BNO08x::init_tasks()
|
||||||
init_status.cb_task = true;
|
init_status.cb_task = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// launch sh2 hal service task
|
// launch sh2 hal service task 7
|
||||||
task_created = xTaskCreate(&sh2_HAL_service_task_trampoline, "bno08x_sh2_HAL_service_task", SH2_HAL_SERVICE_TASK_SZ, this, 7,
|
task_created = xTaskCreatePinnedToCore(&sh2_HAL_service_task_trampoline, "bno08x_sh2_HAL_service_task",
|
||||||
&sh2_HAL_service_task_hdl);
|
SH2_HAL_SERVICE_TASK_SZ,
|
||||||
|
this,
|
||||||
|
SH2_HAL_SERVICE_TASK_PRIORITY,
|
||||||
|
&sh2_HAL_service_task_hdl,
|
||||||
|
SH2_HAL_SERVICE_TASK_AFFINITY);
|
||||||
|
|
||||||
if (task_created != pdTRUE)
|
if (task_created != pdTRUE)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue