Skip to content

Commit

Permalink
Merge branch 'feature/freertos_enable_app_task_tag' into 'master'
Browse files Browse the repository at this point in the history
feat(freertos): Add application task tag support

Closes IDF-6410

See merge request espressif/esp-idf!29514
  • Loading branch information
Dazza0 committed Mar 12, 2024
2 parents d0b97fb + 1332f29 commit eeb71ca
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 0 deletions.
7 changes: 7 additions & 0 deletions components/freertos/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,13 @@ menu "FreeRTOS"
esp_pm_dump_locks, if the proportion of rejected sleeps is too high, please increase
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

menu "Port"
Expand Down
4 changes: 4 additions & 0 deletions components/freertos/config/include/freertos/FreeRTOSConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,10 @@
#endif /* CONFIG_FREERTOS_SMP */
#endif /* def __ASSEMBLER__ */

#if CONFIG_FREERTOS_USE_APPLICATION_TASK_TAG
#define configUSE_APPLICATION_TASK_TAG 1
#endif // CONFIG_FREERTOS_USE_APPLICATION_TASK_TAG

/* -------------- List Data Integrity Checks --------------- */
#define configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES CONFIG_FREERTOS_USE_LIST_DATA_INTEGRITY_CHECK_BYTES

Expand Down
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ CONFIG_FREERTOS_USE_LIST_DATA_INTEGRITY_CHECK_BYTES=y
CONFIG_FREERTOS_TIMER_TASK_AFFINITY_CPU1=y
CONFIG_FREERTOS_USE_TICK_HOOK=y
CONFIG_FREERTOS_USE_IDLE_HOOK=y
CONFIG_FREERTOS_USE_APPLICATION_TASK_TAG=y

0 comments on commit eeb71ca

Please sign in to comment.