esp_task.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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. // http://www.apache.org/licenses/LICENSE-2.0
  7. //
  8. // Unless required by applicable law or agreed to in writing, software
  9. // distributed under the License is distributed on an "AS IS" BASIS,
  10. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  11. // See the License for the specific language governing permissions and
  12. // limitations under the License.
  13. /* Notes:
  14. * 1. Put all task priority and stack size definition in this file
  15. * 2. If the task priority is less than 10, use ESP_TASK_PRIO_MIN + X style,
  16. * otherwise use ESP_TASK_PRIO_MAX - X style
  17. * 3. If this is a daemon task, the macro prefix is ESP_TASKD_, otherwise
  18. * it's ESP_TASK_
  19. * 4. If the configMAX_PRIORITIES is modified, please make all priority are
  20. * greater than 0
  21. * 5. Make sure esp_task.h is consistent between wifi lib and idf
  22. */
  23. #ifndef _ESP_TASK_H_
  24. #define _ESP_TASK_H_
  25. #include "sdkconfig.h"
  26. #include "freertos/FreeRTOS.h"
  27. #include "freertos/FreeRTOSConfig.h"
  28. #define ESP_TASK_PRIO_MAX (configMAX_PRIORITIES)
  29. #define ESP_TASK_PRIO_MIN (0)
  30. /* Bt contoller Task */
  31. /* controller */
  32. #define ESP_TASK_BT_CONTROLLER_PRIO (ESP_TASK_PRIO_MAX - 2)
  33. #ifdef CONFIG_NEWLIB_NANO_FORMAT
  34. #define TASK_EXTRA_STACK_SIZE (0)
  35. #else
  36. #define TASK_EXTRA_STACK_SIZE (512)
  37. #endif
  38. #define BT_TASK_EXTRA_STACK_SIZE TASK_EXTRA_STACK_SIZE
  39. #define ESP_TASK_BT_CONTROLLER_STACK (3584 + TASK_EXTRA_STACK_SIZE)
  40. /* idf task */
  41. #define ESP_TASK_TIMER_PRIO (ESP_TASK_PRIO_MAX - 3)
  42. #define ESP_TASK_TIMER_STACK (CONFIG_ESP_TIMER_TASK_STACK_SIZE + TASK_EXTRA_STACK_SIZE)
  43. #define ESP_TASKD_EVENT_PRIO (ESP_TASK_PRIO_MAX - 5)
  44. #define ESP_TASKD_EVENT_STACK (CONFIG_ESP_SYSTEM_EVENT_TASK_STACK_SIZE + TASK_EXTRA_STACK_SIZE)
  45. #define ESP_TASK_TCPIP_PRIO (ESP_TASK_PRIO_MAX - 7)
  46. #define ESP_TASK_TCPIP_STACK (CONFIG_LWIP_TCPIP_TASK_STACK_SIZE + TASK_EXTRA_STACK_SIZE)
  47. #define ESP_TASK_MAIN_PRIO (ESP_TASK_PRIO_MIN + 1)
  48. #define ESP_TASK_MAIN_STACK (CONFIG_ESP_MAIN_TASK_STACK_SIZE + TASK_EXTRA_STACK_SIZE)
  49. #endif