mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
freertos: Move private API additions to "freertos_idf_additions_priv.h"
Previously, some IDF FreeRTOS API additions that were meant to be private were exposed through the same "idf_additions.h" header. This commit moves those functions to a separate header included via "esp_private/freertos_idf_additions_priv.h" so that they are not mistaken as public API by users. This commit also fixes some missing include and C++ guards in idf_additions.h
This commit is contained in:
parent
0c21d59716
commit
3d2e674326
@ -37,6 +37,8 @@ set(include_dirs
|
||||
"esp_additions/include/freertos" # For files with #include "FreeRTOSConfig.h"
|
||||
"esp_additions/include" # For files with #include "freertos/FreeRTOSConfig.h"
|
||||
# or #include "freertos/task_snapshot.h"
|
||||
# or #include "freertos/idf_additions.h"
|
||||
# or #include "esp_private/freertos_idf_additions_priv.h"
|
||||
"esp_additions/arch/${arch}/include") # For #include "freertos/FreeRTOSConfig_arch.h"
|
||||
|
||||
set(private_include_dirs
|
||||
|
@ -7,7 +7,8 @@
|
||||
#pragma once
|
||||
|
||||
#include "sdkconfig.h"
|
||||
#include "idf_additions_inc.h"
|
||||
#include "idf_additions.h"
|
||||
#include "esp_private/freertos_idf_additions_priv.h"
|
||||
|
||||
/**
|
||||
* This file will be included in `tasks.c` file, thus, it is treated as a source
|
||||
|
@ -0,0 +1,99 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
/*
|
||||
* This file is like "idf_additions.h" but for private API (i.e., only meant to
|
||||
* be called by other internally by other
|
||||
* ESP-IDF components.
|
||||
*/
|
||||
|
||||
#include "sdkconfig.h"
|
||||
#include "freertos/FreeRTOS.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* Priority Raise/Restore
|
||||
* - Special functions to forcefully raise and restore a task's priority
|
||||
* - Used by cache_utils.c when disabling/enabling the cache
|
||||
* -------------------------------------------------------------------------- */
|
||||
|
||||
#if ( INCLUDE_vTaskPrioritySet == 1 )
|
||||
|
||||
typedef struct
|
||||
{
|
||||
UBaseType_t uxPriority;
|
||||
#if ( configUSE_MUTEXES == 1 )
|
||||
UBaseType_t uxBasePriority;
|
||||
#endif
|
||||
} prvTaskSavedPriority_t;
|
||||
|
||||
/**
|
||||
* INCLUDE_vTaskPrioritySet must be defined as 1 for this function to be
|
||||
* available. See the configuration section for more information.
|
||||
*
|
||||
* Saves the current priority and current base priority of a task, then
|
||||
* raises the task's current and base priority to uxNewPriority if
|
||||
* uxNewPriority is of a higher priority.
|
||||
*
|
||||
* Once a task's priority has been raised with this function, the priority
|
||||
* can be restored by calling prvTaskPriorityRestore()
|
||||
*
|
||||
* - Note that this function differs from vTaskPrioritySet() as the task's
|
||||
* current priority will be modified even if the task has already
|
||||
* inherited a priority.
|
||||
* - This function is intended for special circumstance where a task must be
|
||||
* forced immediately to a higher priority.
|
||||
*
|
||||
* For configUSE_MUTEXES == 0: A context switch will occur before the
|
||||
* function returns if the priority being set is higher than the currently
|
||||
* executing task.
|
||||
*
|
||||
* @note This functions is private and should only be called internally
|
||||
* within various IDF components. Users should never call this function from
|
||||
* their application.
|
||||
*
|
||||
* @note vTaskPrioritySet() should not be called while a task's priority is
|
||||
* already raised via this function
|
||||
*
|
||||
* @param pxSavedPriority returns base and current priorities
|
||||
*
|
||||
* @param uxNewPriority The priority to which the task's priority will be
|
||||
* set.
|
||||
*/
|
||||
void prvTaskPriorityRaise( prvTaskSavedPriority_t * pxSavedPriority,
|
||||
UBaseType_t uxNewPriority );
|
||||
|
||||
/**
|
||||
* INCLUDE_vTaskPrioritySet must be defined as 1 for this function to be
|
||||
* available.
|
||||
* See the configuration section for more information.
|
||||
*
|
||||
* Restore a task's priority that was previously raised by
|
||||
* prvTaskPriorityRaise().
|
||||
*
|
||||
* For configUSE_MUTEXES == 0: A context switch will occur before the function
|
||||
* returns if the priority
|
||||
* being set is higher than the currently executing task.
|
||||
*
|
||||
* @note This functions is private and should only be called internally within
|
||||
* various IDF components. Users should never call this function from their
|
||||
* application.
|
||||
*
|
||||
* @param pxSavedPriority previously saved base and current priorities that need
|
||||
* to be restored
|
||||
*/
|
||||
void prvTaskPriorityRestore( prvTaskSavedPriority_t * pxSavedPriority );
|
||||
|
||||
#endif // ( INCLUDE_vTaskPrioritySet == 1)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
@ -1,20 +1,34 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
/*
|
||||
This file contains exposes the function prototypes of ESP-IDF specific API additions to the FreeRTOS kernel. These API
|
||||
additions are not part of Vanilla (i.e., upstream) FreeRTOS and include things such as....
|
||||
- Various helper functions
|
||||
- API for ESP-IDF feature additions to FreeRTOS (such as TSLP deletion call backs)
|
||||
*/
|
||||
|
||||
#include "sdkconfig.h"
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/task.h"
|
||||
#include "idf_additions_inc.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* --------------------------------------------------- SMP Related -----------------------------------------------------
|
||||
* - SMP related API additions to FreeRTOS
|
||||
*
|
||||
* Todo: Move IDF FreeRTOS SMP related additions to this header as well (see IDF-7201)
|
||||
* ------------------------------------------------------------------------------------------------------------------ */
|
||||
|
||||
#if CONFIG_FREERTOS_SMP || __DOXYGEN__
|
||||
|
||||
/* ------------------------------------------------ Helper Functions ---------------------------------------------------
|
||||
*
|
||||
* ------------------------------------------------------------------------------------------------------------------ */
|
||||
|
||||
/**
|
||||
* @brief Create a new task that is pinned to a particular core
|
||||
*
|
||||
@ -104,6 +118,16 @@ TaskHandle_t xTaskGetIdleTaskHandleForCPU( BaseType_t xCoreID );
|
||||
*/
|
||||
BaseType_t xTaskGetAffinity( TaskHandle_t xTask );
|
||||
|
||||
#endif // CONFIG_FREERTOS_SMP || __DOXYGEN__
|
||||
|
||||
/* --------------------------------------------- TLSP Deletion Callbacks -----------------------------------------------
|
||||
* - API additions for the TLSP deletion callback feature
|
||||
*
|
||||
* Todo: Move IDF FreeRTOS TLSP deletion callback additions to this header as well (see IDF-7201)
|
||||
* ------------------------------------------------------------------------------------------------------------------ */
|
||||
|
||||
#if CONFIG_FREERTOS_SMP || __DOXYGEN__
|
||||
|
||||
#if ( CONFIG_FREERTOS_TLSP_DELETION_CALLBACKS )
|
||||
|
||||
/**
|
||||
@ -143,49 +167,6 @@ BaseType_t xTaskGetAffinity( TaskHandle_t xTask );
|
||||
|
||||
#endif // CONFIG_FREERTOS_SMP || __DOXYGEN__
|
||||
|
||||
#if ( INCLUDE_vTaskPrioritySet == 1 )
|
||||
|
||||
/**
|
||||
* INCLUDE_vTaskPrioritySet must be defined as 1 for this function to be available.
|
||||
* See the configuration section for more information.
|
||||
*
|
||||
* Saves the current priority and current base priority of a task, then raises the tasks
|
||||
* current and base priority to uxNewPriority if uxNewPriority is of a higher priority.
|
||||
* Once a task's priority has been raised with this function, the priority can be restored
|
||||
* by calling prvTaskPriorityRestore()
|
||||
* - Note that this function differs from vTaskPrioritySet() as the task's current priority
|
||||
* will be modified even if the task has already inherited a priority.
|
||||
* - This function is intended for special circumstance where a task must be forced immediately
|
||||
* to a higher priority.
|
||||
*
|
||||
* For configUSE_MUTEXES == 0: A context switch will occur before the function returns if the priority
|
||||
* being set is higher than the currently executing task.
|
||||
*
|
||||
* @note This functions is private is only be called internally within various IDF components.
|
||||
* Users should never call this function from their application.
|
||||
*
|
||||
* @note vTaskPrioritySet() should not be called while a task's priority is already raised via this function
|
||||
*
|
||||
* @param pxSavedPriority returns base and current priorities
|
||||
*
|
||||
* @param uxNewPriority The priority to which the task will be set.
|
||||
*/
|
||||
void prvTaskPriorityRaise( prvTaskSavedPriority_t * pxSavedPriority, UBaseType_t uxNewPriority );
|
||||
|
||||
/**
|
||||
* INCLUDE_vTaskPrioritySet must be defined as 1 for this function to be available.
|
||||
* See the configuration section for more information.
|
||||
*
|
||||
* Restore a task's priority that was previously raised by prvTaskPriorityRaise().
|
||||
*
|
||||
* For configUSE_MUTEXES == 0: A context switch will occur before the function returns if the priority
|
||||
* being set is higher than the currently executing task.
|
||||
*
|
||||
* @note This functions is private is only be called internally within various IDF components.
|
||||
* Users should never call this function from their application.
|
||||
*
|
||||
* @param pxSavedPriority previously saved base and current priorities that need to be restored
|
||||
*/
|
||||
void prvTaskPriorityRestore( prvTaskSavedPriority_t * pxSavedPriority );
|
||||
|
||||
#endif // ( INCLUDE_vTaskPrioritySet == 1)
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -1,33 +0,0 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
|
||||
#ifndef FREERTOS_ADDITITIONS_INC_H_
|
||||
#define FREERTOS_ADDITITIONS_INC_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "sdkconfig.h"
|
||||
#include "freertos/FreeRTOS.h"
|
||||
|
||||
#if ( INCLUDE_vTaskPrioritySet == 1 )
|
||||
|
||||
typedef struct {
|
||||
UBaseType_t uxPriority;
|
||||
#if ( configUSE_MUTEXES == 1 )
|
||||
UBaseType_t uxBasePriority;
|
||||
#endif
|
||||
} prvTaskSavedPriority_t;
|
||||
|
||||
#endif // ( INCLUDE_vTaskPrioritySet == 1)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif //FREERTOS_ADDITITIONS_INC_H_
|
@ -11,7 +11,6 @@
|
||||
|
||||
#include <freertos/FreeRTOS.h>
|
||||
#include <freertos/task.h>
|
||||
#include <freertos/idf_additions.h>
|
||||
#include <freertos/semphr.h>
|
||||
#if CONFIG_IDF_TARGET_ESP32
|
||||
#include "soc/dport_reg.h"
|
||||
@ -57,6 +56,7 @@
|
||||
#include "spi_flash_mmap.h"
|
||||
#include "spi_flash_override.h"
|
||||
#include "esp_private/spi_flash_os.h"
|
||||
#include "esp_private/freertos_idf_additions_priv.h"
|
||||
#include "esp_log.h"
|
||||
#include "esp_cpu.h"
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user