mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-08 12:10:59 +00:00
freertos: Move IDF API additions to seperate files
This commit moves the IDF API additions from task.h/task.c to seperate header/source files. - Declarations moved to "idf_additions.h" - Definitions moved to "freertos_task_c_additions.h" The API descriptions have also been updated.
This commit is contained in:
@@ -6468,65 +6468,6 @@ static void prvAddCurrentTaskToDelayedList( TickType_t xTicksToWait,
|
||||
|
||||
#ifdef ESP_PLATFORM
|
||||
|
||||
BaseType_t xTaskCreatePinnedToCore( TaskFunction_t pxTaskCode,
|
||||
const char * const pcName,
|
||||
const uint32_t usStackDepth,
|
||||
void * const pvParameters,
|
||||
UBaseType_t uxPriority,
|
||||
TaskHandle_t * const pxCreatedTask,
|
||||
const BaseType_t xCoreID)
|
||||
{
|
||||
BaseType_t ret;
|
||||
#if ( ( configUSE_CORE_AFFINITY == 1 ) && ( configNUM_CORES > 1 ) )
|
||||
{
|
||||
// Convert xCoreID into an affinity mask
|
||||
UBaseType_t uxCoreAffinityMask;
|
||||
if (xCoreID == tskNO_AFFINITY) {
|
||||
uxCoreAffinityMask = tskNO_AFFINITY;
|
||||
} else {
|
||||
uxCoreAffinityMask = (1 << xCoreID);
|
||||
}
|
||||
ret = xTaskCreateAffinitySet(pxTaskCode, pcName, usStackDepth, pvParameters, uxPriority, uxCoreAffinityMask, pxCreatedTask);
|
||||
}
|
||||
#else /* ( ( configUSE_CORE_AFFINITY == 1 ) && ( configNUM_CORES > 1 ) ) */
|
||||
{
|
||||
ret = xTaskCreate(pxTaskCode, pcName, usStackDepth, pvParameters, uxPriority, pxCreatedTask);
|
||||
}
|
||||
#endif /* ( ( configUSE_CORE_AFFINITY == 1 ) && ( configNUM_CORES > 1 ) ) */
|
||||
return ret;
|
||||
}
|
||||
|
||||
#if ( configSUPPORT_STATIC_ALLOCATION == 1 )
|
||||
TaskHandle_t xTaskCreateStaticPinnedToCore( TaskFunction_t pxTaskCode,
|
||||
const char * const pcName,
|
||||
const uint32_t ulStackDepth,
|
||||
void * const pvParameters,
|
||||
UBaseType_t uxPriority,
|
||||
StackType_t * const puxStackBuffer,
|
||||
StaticTask_t * const pxTaskBuffer,
|
||||
const BaseType_t xCoreID)
|
||||
{
|
||||
TaskHandle_t ret;
|
||||
#if ( ( configUSE_CORE_AFFINITY == 1 ) && ( configNUM_CORES > 1 ) )
|
||||
{
|
||||
// Convert xCoreID into an affinity mask
|
||||
UBaseType_t uxCoreAffinityMask;
|
||||
if (xCoreID == tskNO_AFFINITY) {
|
||||
uxCoreAffinityMask = tskNO_AFFINITY;
|
||||
} else {
|
||||
uxCoreAffinityMask = (1 << xCoreID);
|
||||
}
|
||||
ret = xTaskCreateStaticAffinitySet(pxTaskCode, pcName, ulStackDepth, pvParameters, uxPriority, puxStackBuffer, pxTaskBuffer, uxCoreAffinityMask);
|
||||
}
|
||||
#else /* ( ( configUSE_CORE_AFFINITY == 1 ) && ( configNUM_CORES > 1 ) ) */
|
||||
{
|
||||
ret = xTaskCreateStatic(pxTaskCode, pcName, ulStackDepth, pvParameters, uxPriority, puxStackBuffer, pxTaskBuffer);
|
||||
}
|
||||
#endif /* ( ( configUSE_CORE_AFFINITY == 1 ) && ( configNUM_CORES > 1 ) ) */
|
||||
return ret;
|
||||
}
|
||||
#endif /* configSUPPORT_STATIC_ALLOCATION */
|
||||
|
||||
#if ( configTHREAD_LOCAL_STORAGE_DELETE_CALLBACKS )
|
||||
void vTaskSetThreadLocalStoragePointerAndDelCallback( TaskHandle_t xTaskToSet, BaseType_t xIndex, void *pvValue , TlsDeleteCallbackFunction_t xDelCallback)
|
||||
{
|
||||
@@ -6539,44 +6480,6 @@ TaskHandle_t xTaskCreateStaticPinnedToCore( TaskFunction_t pxTaskCode,
|
||||
}
|
||||
#endif
|
||||
|
||||
TaskHandle_t xTaskGetCurrentTaskHandleForCPU( BaseType_t cpuid )
|
||||
{
|
||||
TaskHandle_t xTaskHandleTemp;
|
||||
assert(cpuid >= 0 && cpuid < configNUM_CORES);
|
||||
taskENTER_CRITICAL();
|
||||
xTaskHandleTemp = (TaskHandle_t) pxCurrentTCBs[cpuid];
|
||||
taskEXIT_CRITICAL();
|
||||
return xTaskHandleTemp;
|
||||
}
|
||||
|
||||
TaskHandle_t xTaskGetIdleTaskHandleForCPU( BaseType_t cpuid )
|
||||
{
|
||||
assert(cpuid >= 0 && cpuid < configNUM_CORES);
|
||||
return (TaskHandle_t) xIdleTaskHandle[cpuid];
|
||||
}
|
||||
|
||||
BaseType_t xTaskGetAffinity( TaskHandle_t xTask )
|
||||
{
|
||||
taskENTER_CRITICAL();
|
||||
UBaseType_t uxCoreAffinityMask;
|
||||
#if ( configUSE_CORE_AFFINITY == 1 && configNUM_CORES > 1 )
|
||||
TCB_t *pxTCB = prvGetTCBFromHandle( xTask );
|
||||
uxCoreAffinityMask = pxTCB->uxCoreAffinityMask;
|
||||
#else
|
||||
uxCoreAffinityMask = tskNO_AFFINITY;
|
||||
#endif
|
||||
taskEXIT_CRITICAL();
|
||||
BaseType_t ret;
|
||||
if (uxCoreAffinityMask == tskNO_AFFINITY) {
|
||||
ret = tskNO_AFFINITY;
|
||||
} else {
|
||||
int index_plus_one = __builtin_ffs(uxCoreAffinityMask);
|
||||
assert(index_plus_one >= 1);
|
||||
ret = index_plus_one - 1;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
#if ( configUSE_NEWLIB_REENTRANT == 1 )
|
||||
//Return global reent struct if FreeRTOS isn't running,
|
||||
struct _reent* __getreent(void) {
|
||||
|
Reference in New Issue
Block a user