1 // Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 /* Notes: 16 * 1. Put all task priority and stack size definition in this file 17 * 2. If the task priority is less than 10, use ESP_TASK_PRIO_MIN + X style, 18 * otherwise use ESP_TASK_PRIO_MAX - X style 19 * 3. If this is a daemon task, the macro prefix is ESP_TASKD_, otherwise 20 * it's ESP_TASK_ 21 * 4. If the configMAX_PRIORITIES is modified, please make all priority are 22 * greater than 0 23 * 5. Make sure esp_task.h is consistent between wifi lib and idf 24 */ 25 26 #ifndef _ESP_TASK_H_ 27 #define _ESP_TASK_H_ 28 29 #include "sdkconfig.h" 30 #include "esp_osal/esp_osal.h" 31 #include "esp_osal/osal_config.h" 32 33 #define ESP_TASK_PRIO_MAX (configMAX_PRIORITIES) 34 #define ESP_TASK_PRIO_MIN (0) 35 36 /* Bt contoller Task */ 37 /* controller */ 38 #define ESP_TASK_BT_CONTROLLER_PRIO (ESP_TASK_PRIO_MAX - 2) 39 #ifdef CONFIG_NEWLIB_NANO_FORMAT 40 #define TASK_EXTRA_STACK_SIZE (0) 41 #else 42 #define TASK_EXTRA_STACK_SIZE (512) 43 #endif 44 45 #define BT_TASK_EXTRA_STACK_SIZE TASK_EXTRA_STACK_SIZE 46 #define ESP_TASK_BT_CONTROLLER_STACK (3584 + TASK_EXTRA_STACK_SIZE) 47 48 49 /* idf task */ 50 #define ESP_TASK_TIMER_PRIO (ESP_TASK_PRIO_MAX - 3) 51 #define ESP_TASK_TIMER_STACK (CONFIG_ESP_TIMER_TASK_STACK_SIZE + TASK_EXTRA_STACK_SIZE) 52 #define ESP_TASKD_EVENT_PRIO (ESP_TASK_PRIO_MAX - 5) 53 #define ESP_TASKD_EVENT_STACK (CONFIG_ESP_SYSTEM_EVENT_TASK_STACK_SIZE + TASK_EXTRA_STACK_SIZE) 54 #define ESP_TASK_TCPIP_PRIO (ESP_TASK_PRIO_MAX - 7) 55 #define ESP_TASK_TCPIP_STACK (CONFIG_LWIP_TCPIP_TASK_STACK_SIZE + TASK_EXTRA_STACK_SIZE) 56 #define ESP_TASK_MAIN_PRIO (ESP_TASK_PRIO_MIN + 1) 57 #define ESP_TASK_MAIN_STACK (CONFIG_ESP_MAIN_TASK_STACK_SIZE + TASK_EXTRA_STACK_SIZE) 58 59 #endif 60