From 9cf997a6fcddd959b26e0113b781e2d38504fa4f Mon Sep 17 00:00:00 2001 From: liuzhifu Date: Thu, 1 Sep 2016 14:09:21 +0800 Subject: [PATCH] components: esp32/lwip Add esp_task.h for placing all task priority/stack size macro definition --- components/esp32/event.c | 3 ++- components/esp32/wifi.c | 3 ++- components/lwip/include/lwip/port/lwipopts.h | 5 +++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/components/esp32/event.c b/components/esp32/event.c index 366d0371f..213d7f361 100644 --- a/components/esp32/event.c +++ b/components/esp32/event.c @@ -19,6 +19,7 @@ #include "esp_err.h" #include "esp_wifi.h" #include "esp_event.h" +#include "esp_task.h" #include "freertos/FreeRTOS.h" #include "freertos/task.h" @@ -359,7 +360,7 @@ esp_err_t esp_event_init(system_event_cb_t cb, void *ctx) g_event_handler = xQueueCreate(CONFIG_WIFI_ENENT_QUEUE_SIZE, sizeof(system_event_t)); - xTaskCreatePinnedToCore(esp_system_event_task, "eventTask", CONFIG_WIFI_EVENT_TASK_STACK_SIZE, NULL, configMAX_PRIORITIES-4, NULL, 0); + xTaskCreatePinnedToCore(esp_system_event_task, "eventTask", ESP_TASKD_EVENT_STACK, NULL, ESP_TASKD_EVENT_PRIO, NULL, 0); return ESP_OK; } diff --git a/components/esp32/wifi.c b/components/esp32/wifi.c index a9d898101..fd44d30d0 100644 --- a/components/esp32/wifi.c +++ b/components/esp32/wifi.c @@ -19,6 +19,7 @@ #include "esp_err.h" #include "esp_wifi.h" #include "esp_event.h" +#include "esp_task.h" #include "freertos/FreeRTOS.h" #include "freertos/task.h" @@ -107,7 +108,7 @@ esp_err_t esp_wifi_startup(wifi_startup_cb_t cb, void *ctx) startup_cb = cb; startup_ctx = ctx; - xTaskCreatePinnedToCore(esp_wifi_task, "wifiTask", 4096, NULL, configMAX_PRIORITIES-7, NULL, 0); + xTaskCreatePinnedToCore(esp_wifi_task, "wifiTask", ESP_TASK_WIFI_STARTUP_STACK, NULL, ESP_TASK_WIFI_STARTUP_PRIO, NULL, 0); return ESP_OK; } diff --git a/components/lwip/include/lwip/port/lwipopts.h b/components/lwip/include/lwip/port/lwipopts.h index 9fe047fab..2dbb1b2f3 100755 --- a/components/lwip/include/lwip/port/lwipopts.h +++ b/components/lwip/include/lwip/port/lwipopts.h @@ -33,6 +33,7 @@ #define __LWIPOPTS_H__ #include +#include "esp_task.h" /* Enable all Espressif-only options */ #define LWIP_ESP8266 @@ -323,14 +324,14 @@ extern unsigned char misc_prof_get_tcp_snd_buf(void); * The stack size value itself is platform-dependent, but is passed to * sys_thread_new() when the thread is created. */ -#define TCPIP_THREAD_STACKSIZE 2048 //not ok:384 +#define TCPIP_THREAD_STACKSIZE ESP_TASKD_LWIP_STACK /** * TCPIP_THREAD_PRIO: The priority assigned to the main tcpip thread. * The priority value itself is platform-dependent, but is passed to * sys_thread_new() when the thread is created. */ -#define TCPIP_THREAD_PRIO (configMAX_PRIORITIES-7) +#define TCPIP_THREAD_PRIO ESP_TASKD_LWIP_PRIO /** * TCPIP_MBOX_SIZE: The mailbox size for the tcpip thread messages