23
23
#include "../../../nimble/include/nimble/nimble_port.h"
24
24
#ifdef ESP_PLATFORM
25
25
#include "esp_bt.h"
26
+
27
+ #ifdef CONFIG_BT_NIMBLE_HOST_TASK_PRIORITY
28
+ # define NIMBLE_HOST_TASK_PRIORITY (CONFIG_BT_NIMBLE_HOST_TASK_PRIORITY)
29
+ #else
30
+ # define NIMBLE_HOST_TASK_PRIORITY (configMAX_PRIORITIES - 4)
31
+ #endif
26
32
#endif
27
33
28
34
#ifndef ESP_PLATFORM
@@ -41,17 +47,6 @@ static StackType_t hs_xStack[ NIMBLE_HS_STACK_SIZE ];
41
47
static StaticTask_t hs_xTaskBuffer ;
42
48
#endif
43
49
44
- // configMAX_PRIORITIES - 1 is Tmr builtin task
45
- #ifndef NIMBLE_LL_PRIORITY
46
- #define NIMBLE_LL_PRIORITY (configMAX_PRIORITIES - 2)
47
- #endif
48
- #ifndef NIMBLE_BLE_PRIORITY
49
- #define NIMBLE_BLE_PRIORITY (configMAX_PRIORITIES - 3)
50
- #endif
51
- #ifndef NIMBLE_HOST_PRIORITY
52
- #define NIMBLE_HOST_PRIORITY (configMAX_PRIORITIES - 4)
53
- #endif
54
-
55
50
static TaskHandle_t host_task_h = NULL ;
56
51
57
52
#ifdef ESP_PLATFORM
@@ -69,7 +64,7 @@ esp_err_t esp_nimble_enable(void *host_task)
69
64
* default queue it is just easier to make separate task which does this.
70
65
*/
71
66
xTaskCreatePinnedToCore (host_task , "nimble_host" , NIMBLE_HS_STACK_SIZE ,
72
- NULL , NIMBLE_HOST_PRIORITY , & host_task_h , NIMBLE_CORE );
67
+ NULL , NIMBLE_HOST_TASK_PRIORITY , & host_task_h , NIMBLE_CORE );
73
68
return ESP_OK ;
74
69
75
70
}
@@ -112,6 +107,19 @@ nimble_port_freertos_deinit(void)
112
107
113
108
#else // !ESP_PLATFORM
114
109
110
+ // configMAX_PRIORITIES - 1 is Tmr builtin task
111
+ #ifdef CONFIG_BT_NIMBLE_LL_TASK_PRIORITY
112
+ # define NIMBLE_LL_TASK_PRIORITY (CONFIG_BT_NIMBLE_LL_TASK_PRIORITY)
113
+ #else
114
+ # define NIMBLE_LL_TASK_PRIORITY (configMAX_PRIORITIES - 1)
115
+ #endif
116
+
117
+ #ifdef CONFIG_BT_NIMBLE_HOST_TASK_PRIORITY
118
+ # define NIMBLE_HOST_TASK_PRIORITY (CONFIG_BT_NIMBLE_HOST_TASK_PRIORITY)
119
+ #else
120
+ # define NIMBLE_HOST_TASK_PRIORITY (configMAX_PRIORITIES - 2)
121
+ #endif
122
+
115
123
void
116
124
nimble_port_freertos_init (TaskFunction_t host_task_fn )
117
125
{
@@ -123,15 +131,15 @@ nimble_port_freertos_init(TaskFunction_t host_task_fn)
123
131
* since it has compatible prototype.
124
132
*/
125
133
ll_task_h = xTaskCreateStatic (nimble_port_ll_task_func , "ll" , NIMBLE_LL_STACK_SIZE ,
126
- NULL , NIMBLE_LL_PRIORITY , ll_xStack , & ll_xTaskBuffer );
134
+ NULL , NIMBLE_LL_TASK_PRIORITY , ll_stack , & ll_task_buffer );
127
135
#endif
128
136
/*
129
137
* Create task where NimBLE host will run. It is not strictly necessary to
130
138
* have separate task for NimBLE host, but since something needs to handle
131
139
* default queue it is just easier to make separate task which does this.
132
140
*/
133
141
host_task_h = xTaskCreateStatic (host_task_fn , "ble" , NIMBLE_HS_STACK_SIZE ,
134
- NULL , NIMBLE_BLE_PRIORITY , hs_xStack , & hs_xTaskBuffer );
142
+ NULL , NIMBLE_HOST_TASK_PRIORITY , hs_xStack , & hs_xTaskBuffer );
135
143
}
136
144
137
145
void
0 commit comments