Skip to content
Closed
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
25 changes: 22 additions & 3 deletions src/nimble/porting/npl/freertos/src/nimble_port_freertos.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@
#include "../../../nimble/include/nimble/nimble_port.h"
#ifdef ESP_PLATFORM
#include "esp_bt.h"

#ifdef CONFIG_BT_NIMBLE_HOST_TASK_PRIORITY
# define NIMBLE_HOST_TASK_PRIORITY (CONFIG_BT_NIMBLE_HOST_TASK_PRIORITY)
#else
# define NIMBLE_HOST_TASK_PRIORITY (configMAX_PRIORITIES - 4)
#endif
#endif

#ifndef ESP_PLATFORM
Expand Down Expand Up @@ -58,7 +64,7 @@ esp_err_t esp_nimble_enable(void *host_task)
* default queue it is just easier to make separate task which does this.
*/
xTaskCreatePinnedToCore(host_task, "nimble_host", NIMBLE_HS_STACK_SIZE,
NULL, (configMAX_PRIORITIES - 4), &host_task_h, NIMBLE_CORE);
NULL, NIMBLE_HOST_TASK_PRIORITY, &host_task_h, NIMBLE_CORE);
return ESP_OK;

}
Expand Down Expand Up @@ -101,6 +107,19 @@ nimble_port_freertos_deinit(void)

#else // !ESP_PLATFORM

// configMAX_PRIORITIES - 1 is Tmr builtin task
#ifdef CONFIG_BT_NIMBLE_LL_TASK_PRIORITY
# define NIMBLE_LL_TASK_PRIORITY (CONFIG_BT_NIMBLE_LL_TASK_PRIORITY)
#else
# define NIMBLE_LL_TASK_PRIORITY (configMAX_PRIORITIES - 1)
#endif

#ifdef CONFIG_BT_NIMBLE_HOST_TASK_PRIORITY
# define NIMBLE_HOST_TASK_PRIORITY (CONFIG_BT_NIMBLE_HOST_TASK_PRIORITY)
#else
# define NIMBLE_HOST_TASK_PRIORITY (configMAX_PRIORITIES - 2)
#endif

void
nimble_port_freertos_init(TaskFunction_t host_task_fn)
{
Expand All @@ -112,15 +131,15 @@ nimble_port_freertos_init(TaskFunction_t host_task_fn)
* since it has compatible prototype.
*/
ll_task_h = xTaskCreateStatic(nimble_port_ll_task_func, "ll", NIMBLE_LL_STACK_SIZE,
NULL, configMAX_PRIORITIES, ll_xStack, &ll_xTaskBuffer);
NULL, NIMBLE_LL_TASK_PRIORITY, ll_stack, &ll_task_buffer);
#endif
/*
* Create task where NimBLE host will run. It is not strictly necessary to
* have separate task for NimBLE host, but since something needs to handle
* default queue it is just easier to make separate task which does this.
*/
host_task_h = xTaskCreateStatic(host_task_fn, "ble", NIMBLE_HS_STACK_SIZE,
NULL, (configMAX_PRIORITIES - 1), hs_xStack, &hs_xTaskBuffer);
NULL, NIMBLE_HOST_TASK_PRIORITY, hs_xStack, &hs_xTaskBuffer);
}

void
Expand Down
Loading