-
Notifications
You must be signed in to change notification settings - Fork 7.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feature/freertos_enable_app_task_tag' into 'master'
feat(freertos): Add application task tag support Closes IDF-6410 See merge request espressif/esp-idf!29514
- Loading branch information
Showing
4 changed files
with
47 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
components/freertos/test_apps/freertos/kernel/tasks/test_app_task_tag.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters