kopia lustrzana https://github.com/espressif/esp-idf
Merge branch 'feature/adjust_task_priority' into 'master'
task priority: adjust task priority of lwip/event/wifi task 1. Modify lwip core task priority to configMAX_PRIORITIES-7 2. Modify wifi startup task priority to configMAX_PRIORITIES-7 3. Modify event task priority to configMAX_PRIORITIES-4 See merge request !42pull/21/head
commit
fb64393f63
|
@ -24,19 +24,19 @@ config WIFI_AUTO_CONNECT
|
||||||
If station is enabled, and station config is set, this will enable WiFi
|
If station is enabled, and station config is set, this will enable WiFi
|
||||||
station auto connect when WiFi startup.
|
station auto connect when WiFi startup.
|
||||||
|
|
||||||
config WIFI_ENENT_QUEUE_SIZE
|
config SYSTEM_EVENT_QUEUE_SIZE
|
||||||
int "WiFi event queue size"
|
int "system event queue size"
|
||||||
default 32
|
default 32
|
||||||
depends on WIFI_ENABLED
|
depends on WIFI_ENABLED
|
||||||
help
|
help
|
||||||
Config WiFi event queue size in different application.
|
Config system event queue size in different application.
|
||||||
|
|
||||||
config WIFI_EVENT_TASK_STACK_SIZE
|
config SYSTEM_EVENT_TASK_STACK_SIZE
|
||||||
int "WiFi event task stack size"
|
int "system event task stack size"
|
||||||
default 2048
|
default 2048
|
||||||
depends on WIFI_ENABLED
|
depends on WIFI_ENABLED
|
||||||
help
|
help
|
||||||
Config WiFi event task stack size in different application.
|
Config system event task stack size in different application.
|
||||||
|
|
||||||
|
|
||||||
config NEWLIB_STDOUT_ADDCR
|
config NEWLIB_STDOUT_ADDCR
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
#include "esp_err.h"
|
#include "esp_err.h"
|
||||||
#include "esp_wifi.h"
|
#include "esp_wifi.h"
|
||||||
#include "esp_event.h"
|
#include "esp_event.h"
|
||||||
|
#include "esp_task.h"
|
||||||
|
|
||||||
#include "freertos/FreeRTOS.h"
|
#include "freertos/FreeRTOS.h"
|
||||||
#include "freertos/task.h"
|
#include "freertos/task.h"
|
||||||
|
@ -357,9 +358,9 @@ esp_err_t esp_event_init(system_event_cb_t cb, void *ctx)
|
||||||
g_event_handler_cb = cb;
|
g_event_handler_cb = cb;
|
||||||
g_event_ctx = ctx;
|
g_event_ctx = ctx;
|
||||||
|
|
||||||
g_event_handler = xQueueCreate(CONFIG_WIFI_ENENT_QUEUE_SIZE, sizeof(system_event_t));
|
g_event_handler = xQueueCreate(CONFIG_SYSTEM_EVENT_QUEUE_SIZE, sizeof(system_event_t));
|
||||||
|
|
||||||
xTaskCreatePinnedToCore(esp_system_event_task, "eventTask", CONFIG_WIFI_EVENT_TASK_STACK_SIZE, NULL, 5, NULL, 0); // TODO: rearrange task priority
|
xTaskCreatePinnedToCore(esp_system_event_task, "eventTask", ESP_TASKD_EVENT_STACK, NULL, ESP_TASKD_EVENT_PRIO, NULL, 0);
|
||||||
return ESP_OK;
|
return ESP_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,54 @@
|
||||||
|
// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
/* Notes:
|
||||||
|
* 1. Put all task priority and stack size definition in this file
|
||||||
|
* 2. If the task priority is less than 10, use ESP_TASK_PRIO_MIN + X style,
|
||||||
|
* otherwise use ESP_TASK_PRIO_MIN - X style
|
||||||
|
* 3. If this is a daemon task, the macro prifix is ESP_TASKD_, otherwise
|
||||||
|
* it's ESP_TASK_
|
||||||
|
* 4. If the configMAX_PRIORITIES is modified, please make all prority are
|
||||||
|
* greater than 0
|
||||||
|
* 5. Make sure esp_task.h is consistent between wifi lib and idf
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _ESP_TASK_H_
|
||||||
|
#define _ESP_TASK_H_
|
||||||
|
|
||||||
|
#include "sdkconfig.h"
|
||||||
|
|
||||||
|
#define ESP_TASK_PRIO_MAX (configMAX_PRIORITIES)
|
||||||
|
#define ESP_TASK_PRIO_MIN (0)
|
||||||
|
|
||||||
|
/* Wifi library task */
|
||||||
|
#define ESP_TASKD_WATCHDOG_PRIO (ESP_TASK_PRIO_MAX - 1)
|
||||||
|
#define ESP_TASKD_WATCHDOG_STACK 2048
|
||||||
|
#define ESP_TASK_WPA2_PRIO (ESP_TASK_PRIO_MAX - 1)
|
||||||
|
#define ESP_TASK_WPA2_STACK 2048
|
||||||
|
#define ESP_TASKD_WIFI_PRIO (ESP_TASK_PRIO_MAX - 2)
|
||||||
|
#define ESP_TASKD_WIFI_STACK 8196
|
||||||
|
#define ESP_TASKD_WIFI_TIMER_PRIO (ESP_TASK_PRIO_MAX - 3)
|
||||||
|
#define ESP_TASKD_WIFI_TIMER_STACK 2048
|
||||||
|
#define ESP_TASK_WPS_PRIO (ESP_TASK_PRIO_MIN + 2)
|
||||||
|
#define ESP_TASK_WPS_STACK 2048
|
||||||
|
|
||||||
|
/* idf task */
|
||||||
|
#define ESP_TASKD_EVENT_PRIO (ESP_TASK_PRIO_MAX - 5)
|
||||||
|
#define ESP_TASKD_EVENT_STACK CONFIG_SYSTEM_EVENT_TASK_STACK_SIZE
|
||||||
|
#define ESP_TASK_WIFI_STARTUP_PRIO (ESP_TASK_PRIO_MAX - 7)
|
||||||
|
#define ESP_TASK_WIFI_STARTUP_STACK 4096
|
||||||
|
#define ESP_TASK_TCPIP_PRIO (ESP_TASK_PRIO_MAX - 7)
|
||||||
|
#define ESP_TASK_TCPIP_STACK 2048
|
||||||
|
|
||||||
|
#endif
|
|
@ -19,6 +19,7 @@
|
||||||
#include "esp_err.h"
|
#include "esp_err.h"
|
||||||
#include "esp_wifi.h"
|
#include "esp_wifi.h"
|
||||||
#include "esp_event.h"
|
#include "esp_event.h"
|
||||||
|
#include "esp_task.h"
|
||||||
|
|
||||||
#include "freertos/FreeRTOS.h"
|
#include "freertos/FreeRTOS.h"
|
||||||
#include "freertos/task.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_cb = cb;
|
||||||
startup_ctx = ctx;
|
startup_ctx = ctx;
|
||||||
|
|
||||||
xTaskCreatePinnedToCore(esp_wifi_task, "wifiTask", 4096, NULL, 5, NULL, 0);// TODO: rearrange task priority
|
xTaskCreatePinnedToCore(esp_wifi_task, "wifiTask", ESP_TASK_WIFI_STARTUP_STACK, NULL, ESP_TASK_WIFI_STARTUP_PRIO, NULL, 0);
|
||||||
|
|
||||||
return ESP_OK;
|
return ESP_OK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,6 +33,7 @@
|
||||||
#define __LWIPOPTS_H__
|
#define __LWIPOPTS_H__
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include "esp_task.h"
|
||||||
|
|
||||||
/* Enable all Espressif-only options */
|
/* Enable all Espressif-only options */
|
||||||
#define LWIP_ESP8266
|
#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
|
* The stack size value itself is platform-dependent, but is passed to
|
||||||
* sys_thread_new() when the thread is created.
|
* sys_thread_new() when the thread is created.
|
||||||
*/
|
*/
|
||||||
#define TCPIP_THREAD_STACKSIZE 2048 //not ok:384
|
#define TCPIP_THREAD_STACKSIZE ESP_TASK_TCPIP_STACK
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TCPIP_THREAD_PRIO: The priority assigned to the main tcpip thread.
|
* TCPIP_THREAD_PRIO: The priority assigned to the main tcpip thread.
|
||||||
* The priority value itself is platform-dependent, but is passed to
|
* The priority value itself is platform-dependent, but is passed to
|
||||||
* sys_thread_new() when the thread is created.
|
* sys_thread_new() when the thread is created.
|
||||||
*/
|
*/
|
||||||
#define TCPIP_THREAD_PRIO (configMAX_PRIORITIES-5)
|
#define TCPIP_THREAD_PRIO ESP_TASK_TCPIP_PRIO
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TCPIP_MBOX_SIZE: The mailbox size for the tcpip thread messages
|
* TCPIP_MBOX_SIZE: The mailbox size for the tcpip thread messages
|
||||||
|
|
Ładowanie…
Reference in New Issue