Merge branch 'feature/freertos_enable_app_task_tag_v5.2' into 'release/v5.2'

feat(freertos): Add application task tag support (V5.2)

See merge request espressif/esp-idf!29587
This commit is contained in:
Marius Vikhammer 2024-04-01 11:20:04 +08:00
commit 23540fa90d
4 changed files with 47 additions and 0 deletions

View File

@ -293,6 +293,13 @@ menu "FreeRTOS"
esp_pm_dump_locks, if the proportion of rejected sleeps is too high, please increase esp_pm_dump_locks, if the proportion of rejected sleeps is too high, please increase
this value to improve scheduling efficiency this value to improve scheduling efficiency
config FREERTOS_USE_APPLICATION_TASK_TAG
bool "configUSE_APPLICATION_TASK_TAG"
default n
help
Enables task tagging functionality and its associated API (see configUSE_APPLICATION_TASK_TAG
documentation for more details).
endmenu # Kernel endmenu # Kernel
menu "Port" menu "Port"

View File

@ -251,6 +251,10 @@
#endif /* CONFIG_FREERTOS_SMP */ #endif /* CONFIG_FREERTOS_SMP */
#endif /* def __ASSEMBLER__ */ #endif /* def __ASSEMBLER__ */
#if CONFIG_FREERTOS_USE_APPLICATION_TASK_TAG
#define configUSE_APPLICATION_TASK_TAG 1
#endif // CONFIG_FREERTOS_USE_APPLICATION_TASK_TAG
/* ----------------------------------------------- Amazon SMP FreeRTOS ------------------------------------------------- /* ----------------------------------------------- Amazon SMP FreeRTOS -------------------------------------------------
* - All Amazon SMP FreeRTOS specific configurations * - All Amazon SMP FreeRTOS specific configurations
* ------------------------------------------------------------------------------------------------------------------ */ * ------------------------------------------------------------------------------------------------------------------ */

View File

@ -0,0 +1,35 @@
/*
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#include "sdkconfig.h"
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "unity.h"
#include "test_utils.h"
#if CONFIG_FREERTOS_USE_APPLICATION_TASK_TAG
static BaseType_t tag_cb(void *arg)
{
BaseType_t *tag_cb_called = (BaseType_t *)arg;
*tag_cb_called = pdTRUE;
return pdTRUE;
}
TEST_CASE("Test application task tag", "[freertos]")
{
BaseType_t tag_cb_called = pdFALSE;
// Set the app task tag for current task
vTaskSetApplicationTaskTag(NULL, tag_cb);
// Check app task tag is correct
TEST_ASSERT_EQUAL(tag_cb, xTaskGetApplicationTaskTag(NULL));
// Test the app task tag by calling it
TEST_ASSERT_EQUAL(pdTRUE, xTaskCallApplicationTaskHook(NULL, (void *)&tag_cb_called));
TEST_ASSERT_EQUAL(pdTRUE, tag_cb_called);
}
#endif // CONFIG_FREERTOS_USE_APPLICATION_TASK_TAG

View File

@ -19,3 +19,4 @@ CONFIG_FREERTOS_FPU_IN_ISR=y
CONFIG_FREERTOS_TASK_NOTIFICATION_ARRAY_ENTRIES=2 CONFIG_FREERTOS_TASK_NOTIFICATION_ARRAY_ENTRIES=2
CONFIG_FREERTOS_USE_TICK_HOOK=y CONFIG_FREERTOS_USE_TICK_HOOK=y
CONFIG_FREERTOS_USE_IDLE_HOOK=y CONFIG_FREERTOS_USE_IDLE_HOOK=y
CONFIG_FREERTOS_USE_APPLICATION_TASK_TAG=y