整理任务使用的cpu
新增配置: CONFIG_TQ_NETWORK_TASK_CORE=0 CONFIG_TQ_LOCAL_TASK_CORE=1 网络类任务默认固定到 Core 0: cp_ws_wait cp_wifi_state cp_fortune mm_autostart mm_watchdog mm_ws_ordered mm_ws_stop lan_http 本地类任务默认固定到 Core 1: cp_model_cmd cp_direction cp_lcd_render cp_task_monitor cp_system_event cp_key_input factory_cli mm_local_evt 已有音频任务保持现有配置: CONFIG_MULTIMODAL_AUDIO_TASK_CORE=1
This commit is contained in:
@@ -94,10 +94,14 @@
|
||||
#define CONFIG_MULTIMODAL_AUDIO_TASK_CORE 1
|
||||
#endif
|
||||
|
||||
#if CONFIG_MULTIMODAL_AUDIO_TASK_CORE < 0
|
||||
#define MULTIMODAL_AUDIO_CORE_ID tskNO_AFFINITY
|
||||
#ifndef CONFIG_TQ_NETWORK_TASK_CORE
|
||||
#define CONFIG_TQ_NETWORK_TASK_CORE 0
|
||||
#endif
|
||||
|
||||
#if CONFIG_TQ_NETWORK_TASK_CORE < 0
|
||||
#define MULTIMODAL_WS_CORE_ID tskNO_AFFINITY
|
||||
#else
|
||||
#define MULTIMODAL_AUDIO_CORE_ID ((BaseType_t)CONFIG_MULTIMODAL_AUDIO_TASK_CORE)
|
||||
#define MULTIMODAL_WS_CORE_ID ((BaseType_t)CONFIG_TQ_NETWORK_TASK_CORE)
|
||||
#endif
|
||||
|
||||
#define WS_OPCODE_TEXT 0x1
|
||||
|
||||
@@ -368,7 +368,7 @@ static esp_err_t ws_start_async_stop(void)
|
||||
5,
|
||||
&task,
|
||||
true,
|
||||
tskNO_AFFINITY);
|
||||
MULTIMODAL_WS_CORE_ID);
|
||||
if (ok != pdPASS) {
|
||||
ws_set_async_stop_task(NULL);
|
||||
ESP_LOGE(TAG, "Create WebSocket async stop task failed");
|
||||
|
||||
@@ -641,7 +641,7 @@ static esp_err_t create_worker_pipeline(void)
|
||||
CONFIG_MULTIMODAL_WEBSOCKET_TASK_PRIORITY,
|
||||
&s_ws_dispatch_task,
|
||||
true,
|
||||
tskNO_AFFINITY) != pdPASS) {
|
||||
MULTIMODAL_WS_CORE_ID) != pdPASS) {
|
||||
(void)destroy_worker_pipeline_until(
|
||||
ws_stop_deadline_from_timeout(MULTIMODAL_WS_WORKER_STOP_WAIT_MS));
|
||||
return ESP_ERR_NO_MEM;
|
||||
|
||||
@@ -35,6 +35,16 @@
|
||||
#define LAN_HTTP_START_TIMEOUT_MS 1500
|
||||
#define LAN_HTTP_STOP_POLL_MS 20
|
||||
|
||||
#ifndef CONFIG_TQ_NETWORK_TASK_CORE
|
||||
#define CONFIG_TQ_NETWORK_TASK_CORE 0
|
||||
#endif
|
||||
|
||||
#if CONFIG_TQ_NETWORK_TASK_CORE < 0
|
||||
#define LAN_HTTP_TASK_CORE tskNO_AFFINITY
|
||||
#else
|
||||
#define LAN_HTTP_TASK_CORE ((BaseType_t)CONFIG_TQ_NETWORK_TASK_CORE)
|
||||
#endif
|
||||
|
||||
#if (configSUPPORT_STATIC_ALLOCATION == 1) && \
|
||||
((defined(CONFIG_FREERTOS_TASK_CREATE_ALLOW_EXT_MEM) && CONFIG_FREERTOS_TASK_CREATE_ALLOW_EXT_MEM) || \
|
||||
defined(CONFIG_SPIRAM_ALLOW_STACK_EXTERNAL_MEMORY))
|
||||
@@ -111,7 +121,7 @@ static BaseType_t lan_http_create_task(TaskHandle_t *out_handle)
|
||||
NULL,
|
||||
LAN_HTTP_TASK_PRIORITY,
|
||||
out_handle,
|
||||
tskNO_AFFINITY,
|
||||
LAN_HTTP_TASK_CORE,
|
||||
MALLOC_CAP_SPIRAM | MALLOC_CAP_8BIT);
|
||||
if (created == pdPASS) {
|
||||
return pdPASS;
|
||||
@@ -124,15 +134,16 @@ static BaseType_t lan_http_create_task(TaskHandle_t *out_handle)
|
||||
NULL,
|
||||
LAN_HTTP_TASK_PRIORITY,
|
||||
out_handle,
|
||||
tskNO_AFFINITY,
|
||||
LAN_HTTP_TASK_CORE,
|
||||
MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT);
|
||||
#else
|
||||
return xTaskCreate(server_task,
|
||||
"lan_http",
|
||||
LAN_HTTP_TASK_STACK_SIZE,
|
||||
NULL,
|
||||
LAN_HTTP_TASK_PRIORITY,
|
||||
out_handle);
|
||||
return xTaskCreatePinnedToCore(server_task,
|
||||
"lan_http",
|
||||
LAN_HTTP_TASK_STACK_SIZE,
|
||||
NULL,
|
||||
LAN_HTTP_TASK_PRIORITY,
|
||||
out_handle,
|
||||
LAN_HTTP_TASK_CORE);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user