mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-12-07 13:45:00 -05:00
Merge branch 'main' into update_MPU_ports
This commit is contained in:
commit
cd752eb053
8 changed files with 101 additions and 146 deletions
|
|
@ -30,7 +30,7 @@
|
||||||
#include "task.h"
|
#include "task.h"
|
||||||
#include "croutine.h"
|
#include "croutine.h"
|
||||||
|
|
||||||
/* Remove the whole file is co-routines are not being used. */
|
/* Remove the whole file if co-routines are not being used. */
|
||||||
#if ( configUSE_CO_ROUTINES != 0 )
|
#if ( configUSE_CO_ROUTINES != 0 )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
||||||
|
|
@ -283,10 +283,9 @@
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
/* configKERNEL_INTERRUPT_PRIORITY sets the priority of the tick and context
|
/* configKERNEL_INTERRUPT_PRIORITY sets the priority of the tick and context
|
||||||
* switch performing interrupts. The default value is set to the highest interrupt
|
* switch performing interrupts. Not supported by all FreeRTOS ports. See
|
||||||
* priority (0). Not supported by all FreeRTOS ports. See
|
* https://www.freertos.org/RTOS-Cortex-M3-M4.html for information specific to
|
||||||
* https://www.freertos.org/RTOS-Cortex-M3-M4.html for information specific to ARM
|
* ARM Cortex-M devices. */
|
||||||
* Cortex-M devices. */
|
|
||||||
#define configKERNEL_INTERRUPT_PRIORITY 0
|
#define configKERNEL_INTERRUPT_PRIORITY 0
|
||||||
|
|
||||||
/* configMAX_SYSCALL_INTERRUPT_PRIORITY sets the interrupt priority above which
|
/* configMAX_SYSCALL_INTERRUPT_PRIORITY sets the interrupt priority above which
|
||||||
|
|
|
||||||
|
|
@ -298,10 +298,6 @@
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef configUSE_DAEMON_TASK_STARTUP_HOOK
|
|
||||||
#define configUSE_DAEMON_TASK_STARTUP_HOOK 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef configUSE_APPLICATION_TASK_TAG
|
#ifndef configUSE_APPLICATION_TASK_TAG
|
||||||
#define configUSE_APPLICATION_TASK_TAG 0
|
#define configUSE_APPLICATION_TASK_TAG 0
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -322,6 +318,16 @@
|
||||||
#define configUSE_TIMERS 0
|
#define configUSE_TIMERS 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef configUSE_DAEMON_TASK_STARTUP_HOOK
|
||||||
|
#define configUSE_DAEMON_TASK_STARTUP_HOOK 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if ( configUSE_DAEMON_TASK_STARTUP_HOOK != 0 )
|
||||||
|
#if ( configUSE_TIMERS == 0 )
|
||||||
|
#error configUSE_DAEMON_TASK_STARTUP_HOOK is set, but the daemon task is not created because configUSE_TIMERS is 0.
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef configUSE_COUNTING_SEMAPHORES
|
#ifndef configUSE_COUNTING_SEMAPHORES
|
||||||
#define configUSE_COUNTING_SEMAPHORES 0
|
#define configUSE_COUNTING_SEMAPHORES 0
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -282,7 +282,8 @@ typedef struct xLIST
|
||||||
* \page listGET_OWNER_OF_NEXT_ENTRY listGET_OWNER_OF_NEXT_ENTRY
|
* \page listGET_OWNER_OF_NEXT_ENTRY listGET_OWNER_OF_NEXT_ENTRY
|
||||||
* \ingroup LinkedList
|
* \ingroup LinkedList
|
||||||
*/
|
*/
|
||||||
#define listGET_OWNER_OF_NEXT_ENTRY( pxTCB, pxList ) \
|
#if ( configNUMBER_OF_CORES == 1 )
|
||||||
|
#define listGET_OWNER_OF_NEXT_ENTRY( pxTCB, pxList ) \
|
||||||
do { \
|
do { \
|
||||||
List_t * const pxConstList = ( pxList ); \
|
List_t * const pxConstList = ( pxList ); \
|
||||||
/* Increment the index to the next item and return the item, ensuring */ \
|
/* Increment the index to the next item and return the item, ensuring */ \
|
||||||
|
|
@ -294,6 +295,13 @@ typedef struct xLIST
|
||||||
} \
|
} \
|
||||||
( pxTCB ) = ( pxConstList )->pxIndex->pvOwner; \
|
( pxTCB ) = ( pxConstList )->pxIndex->pvOwner; \
|
||||||
} while( 0 )
|
} while( 0 )
|
||||||
|
#else /* #if ( configNUMBER_OF_CORES == 1 ) */
|
||||||
|
|
||||||
|
/* This function is not required in SMP. FreeRTOS SMP scheduler doesn't use
|
||||||
|
* pxIndex and it should always point to the xListEnd. Not defining this macro
|
||||||
|
* here to prevent updating pxIndex.
|
||||||
|
*/
|
||||||
|
#endif /* #if ( configNUMBER_OF_CORES == 1 ) */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Version of uxListRemove() that does not return a value. Provided as a slight
|
* Version of uxListRemove() that does not return a value. Provided as a slight
|
||||||
|
|
|
||||||
|
|
@ -246,8 +246,19 @@ StackType_t * pxPortInitialiseStack( StackType_t * pxTopOfStack,
|
||||||
FALSE, /* Start not signalled. */
|
FALSE, /* Start not signalled. */
|
||||||
NULL ); /* No name. */
|
NULL ); /* No name. */
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __GNUC__
|
||||||
|
/* GCC reports the warning for the cast operation from TaskFunction_t to LPTHREAD_START_ROUTINE. */
|
||||||
|
/* Disable this warning here by the #pragma option. */
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Wcast-function-type"
|
||||||
|
#endif
|
||||||
/* Create the thread itself. */
|
/* Create the thread itself. */
|
||||||
pxThreadState->pvThread = CreateThread( NULL, xStackSize, ( LPTHREAD_START_ROUTINE ) pxCode, pvParameters, CREATE_SUSPENDED | STACK_SIZE_PARAM_IS_A_RESERVATION, NULL );
|
pxThreadState->pvThread = CreateThread( NULL, xStackSize, ( LPTHREAD_START_ROUTINE ) pxCode, pvParameters, CREATE_SUSPENDED | STACK_SIZE_PARAM_IS_A_RESERVATION, NULL );
|
||||||
|
#ifdef __GNUC__
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
|
#endif
|
||||||
|
|
||||||
configASSERT( pxThreadState->pvThread ); /* See comment where TerminateThread() is called. */
|
configASSERT( pxThreadState->pvThread ); /* See comment where TerminateThread() is called. */
|
||||||
SetThreadAffinityMask( pxThreadState->pvThread, 0x01 );
|
SetThreadAffinityMask( pxThreadState->pvThread, 0x01 );
|
||||||
SetThreadPriorityBoost( pxThreadState->pvThread, TRUE );
|
SetThreadPriorityBoost( pxThreadState->pvThread, TRUE );
|
||||||
|
|
|
||||||
|
|
@ -72,9 +72,18 @@ typedef portSTACK_TYPE StackType_t;
|
||||||
typedef uint32_t TickType_t;
|
typedef uint32_t TickType_t;
|
||||||
#define portMAX_DELAY ( TickType_t ) 0xffffffffUL
|
#define portMAX_DELAY ( TickType_t ) 0xffffffffUL
|
||||||
|
|
||||||
/* 32/64-bit tick type on a 32/64-bit architecture, so reads of the tick
|
/* 32-bit tick type on a 32/64-bit architecture, so reads of the tick
|
||||||
* count do not need to be guarded with a critical section. */
|
* count do not need to be guarded with a critical section. */
|
||||||
#define portTICK_TYPE_IS_ATOMIC 1
|
#define portTICK_TYPE_IS_ATOMIC 1
|
||||||
|
#elif ( configTICK_TYPE_WIDTH_IN_BITS == TICK_TYPE_WIDTH_64_BITS )
|
||||||
|
typedef uint64_t TickType_t;
|
||||||
|
#define portMAX_DELAY ( TickType_t ) 0xffffffffffffffffULL
|
||||||
|
|
||||||
|
#if defined( __x86_64__ ) || defined( _M_X64 )
|
||||||
|
/* 64-bit tick type on a 64-bit architecture, so reads of the tick
|
||||||
|
* count do not need to be guarded with a critical section. */
|
||||||
|
#define portTICK_TYPE_IS_ATOMIC 1
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
#error configTICK_TYPE_WIDTH_IN_BITS set to unsupported tick type width.
|
#error configTICK_TYPE_WIDTH_IN_BITS set to unsupported tick type width.
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -278,7 +278,7 @@ static inline void vPortRecursiveLock( uint32_t ulLockNum,
|
||||||
#define portTASK_FUNCTION_PROTO( vFunction, pvParameters ) void vFunction( void * pvParameters )
|
#define portTASK_FUNCTION_PROTO( vFunction, pvParameters ) void vFunction( void * pvParameters )
|
||||||
#define portTASK_FUNCTION( vFunction, pvParameters ) void vFunction( void * pvParameters )
|
#define portTASK_FUNCTION( vFunction, pvParameters ) void vFunction( void * pvParameters )
|
||||||
|
|
||||||
#define portNOP()
|
#define portNOP() __asm volatile ( "nop" )
|
||||||
|
|
||||||
#define portMEMORY_BARRIER() __asm volatile ( "" ::: "memory" )
|
#define portMEMORY_BARRIER() __asm volatile ( "" ::: "memory" )
|
||||||
|
|
||||||
|
|
|
||||||
190
tasks.c
190
tasks.c
|
|
@ -4177,147 +4177,72 @@ char * pcTaskGetName( TaskHandle_t xTaskToQuery )
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
#if ( INCLUDE_xTaskGetHandle == 1 )
|
#if ( INCLUDE_xTaskGetHandle == 1 )
|
||||||
|
static TCB_t * prvSearchForNameWithinSingleList( List_t * pxList,
|
||||||
|
const char pcNameToQuery[] )
|
||||||
|
{
|
||||||
|
TCB_t * pxReturn = NULL;
|
||||||
|
UBaseType_t x;
|
||||||
|
char cNextChar;
|
||||||
|
BaseType_t xBreakLoop;
|
||||||
|
const ListItem_t * pxEndMarker = listGET_END_MARKER( pxList );
|
||||||
|
ListItem_t * pxIterator;
|
||||||
|
|
||||||
#if ( configNUMBER_OF_CORES == 1 )
|
/* This function is called with the scheduler suspended. */
|
||||||
static TCB_t * prvSearchForNameWithinSingleList( List_t * pxList,
|
|
||||||
const char pcNameToQuery[] )
|
if( listCURRENT_LIST_LENGTH( pxList ) > ( UBaseType_t ) 0 )
|
||||||
{
|
{
|
||||||
TCB_t * pxNextTCB;
|
for( pxIterator = listGET_HEAD_ENTRY( pxList ); pxIterator != pxEndMarker; pxIterator = listGET_NEXT( pxIterator ) )
|
||||||
TCB_t * pxFirstTCB;
|
|
||||||
TCB_t * pxReturn = NULL;
|
|
||||||
UBaseType_t x;
|
|
||||||
char cNextChar;
|
|
||||||
BaseType_t xBreakLoop;
|
|
||||||
|
|
||||||
/* This function is called with the scheduler suspended. */
|
|
||||||
|
|
||||||
if( listCURRENT_LIST_LENGTH( pxList ) > ( UBaseType_t ) 0 )
|
|
||||||
{
|
{
|
||||||
/* MISRA Ref 11.5.3 [Void pointer assignment] */
|
/* MISRA Ref 11.5.3 [Void pointer assignment] */
|
||||||
/* More details at: https://github.com/FreeRTOS/FreeRTOS-Kernel/blob/main/MISRA.md#rule-115 */
|
/* More details at: https://github.com/FreeRTOS/FreeRTOS-Kernel/blob/main/MISRA.md#rule-115 */
|
||||||
/* coverity[misra_c_2012_rule_11_5_violation] */
|
/* coverity[misra_c_2012_rule_11_5_violation] */
|
||||||
listGET_OWNER_OF_NEXT_ENTRY( pxFirstTCB, pxList );
|
TCB_t * pxTCB = listGET_LIST_ITEM_OWNER( pxIterator );
|
||||||
|
|
||||||
do
|
/* Check each character in the name looking for a match or
|
||||||
|
* mismatch. */
|
||||||
|
xBreakLoop = pdFALSE;
|
||||||
|
|
||||||
|
for( x = ( UBaseType_t ) 0; x < ( UBaseType_t ) configMAX_TASK_NAME_LEN; x++ )
|
||||||
{
|
{
|
||||||
/* MISRA Ref 11.5.3 [Void pointer assignment] */
|
cNextChar = pxTCB->pcTaskName[ x ];
|
||||||
/* More details at: https://github.com/FreeRTOS/FreeRTOS-Kernel/blob/main/MISRA.md#rule-115 */
|
|
||||||
/* coverity[misra_c_2012_rule_11_5_violation] */
|
|
||||||
listGET_OWNER_OF_NEXT_ENTRY( pxNextTCB, pxList );
|
|
||||||
|
|
||||||
/* Check each character in the name looking for a match or
|
if( cNextChar != pcNameToQuery[ x ] )
|
||||||
* mismatch. */
|
|
||||||
xBreakLoop = pdFALSE;
|
|
||||||
|
|
||||||
for( x = ( UBaseType_t ) 0; x < ( UBaseType_t ) configMAX_TASK_NAME_LEN; x++ )
|
|
||||||
{
|
{
|
||||||
cNextChar = pxNextTCB->pcTaskName[ x ];
|
/* Characters didn't match. */
|
||||||
|
xBreakLoop = pdTRUE;
|
||||||
if( cNextChar != pcNameToQuery[ x ] )
|
}
|
||||||
{
|
else if( cNextChar == ( char ) 0x00 )
|
||||||
/* Characters didn't match. */
|
{
|
||||||
xBreakLoop = pdTRUE;
|
/* Both strings terminated, a match must have been
|
||||||
}
|
* found. */
|
||||||
else if( cNextChar == ( char ) 0x00 )
|
pxReturn = pxTCB;
|
||||||
{
|
xBreakLoop = pdTRUE;
|
||||||
/* Both strings terminated, a match must have been
|
}
|
||||||
* found. */
|
else
|
||||||
pxReturn = pxNextTCB;
|
{
|
||||||
xBreakLoop = pdTRUE;
|
mtCOVERAGE_TEST_MARKER();
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mtCOVERAGE_TEST_MARKER();
|
|
||||||
}
|
|
||||||
|
|
||||||
if( xBreakLoop != pdFALSE )
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if( pxReturn != NULL )
|
if( xBreakLoop != pdFALSE )
|
||||||
{
|
{
|
||||||
/* The handle has been found. */
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} while( pxNextTCB != pxFirstTCB );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mtCOVERAGE_TEST_MARKER();
|
|
||||||
}
|
|
||||||
|
|
||||||
return pxReturn;
|
|
||||||
}
|
|
||||||
#else /* if ( configNUMBER_OF_CORES == 1 ) */
|
|
||||||
static TCB_t * prvSearchForNameWithinSingleList( List_t * pxList,
|
|
||||||
const char pcNameToQuery[] )
|
|
||||||
{
|
|
||||||
TCB_t * pxReturn = NULL;
|
|
||||||
UBaseType_t x;
|
|
||||||
char cNextChar;
|
|
||||||
BaseType_t xBreakLoop;
|
|
||||||
const ListItem_t * pxEndMarker = listGET_END_MARKER( pxList );
|
|
||||||
ListItem_t * pxIterator;
|
|
||||||
|
|
||||||
/* This function is called with the scheduler suspended. */
|
|
||||||
|
|
||||||
if( listCURRENT_LIST_LENGTH( pxList ) > ( UBaseType_t ) 0 )
|
|
||||||
{
|
|
||||||
for( pxIterator = listGET_HEAD_ENTRY( pxList ); pxIterator != pxEndMarker; pxIterator = listGET_NEXT( pxIterator ) )
|
|
||||||
{
|
|
||||||
/* MISRA Ref 11.5.3 [Void pointer assignment] */
|
|
||||||
/* More details at: https://github.com/FreeRTOS/FreeRTOS-Kernel/blob/main/MISRA.md#rule-115 */
|
|
||||||
/* coverity[misra_c_2012_rule_11_5_violation] */
|
|
||||||
TCB_t * pxTCB = listGET_LIST_ITEM_OWNER( pxIterator );
|
|
||||||
|
|
||||||
/* Check each character in the name looking for a match or
|
|
||||||
* mismatch. */
|
|
||||||
xBreakLoop = pdFALSE;
|
|
||||||
|
|
||||||
for( x = ( UBaseType_t ) 0; x < ( UBaseType_t ) configMAX_TASK_NAME_LEN; x++ )
|
|
||||||
{
|
|
||||||
cNextChar = pxTCB->pcTaskName[ x ];
|
|
||||||
|
|
||||||
if( cNextChar != pcNameToQuery[ x ] )
|
|
||||||
{
|
|
||||||
/* Characters didn't match. */
|
|
||||||
xBreakLoop = pdTRUE;
|
|
||||||
}
|
|
||||||
else if( cNextChar == ( char ) 0x00 )
|
|
||||||
{
|
|
||||||
/* Both strings terminated, a match must have been
|
|
||||||
* found. */
|
|
||||||
pxReturn = pxTCB;
|
|
||||||
xBreakLoop = pdTRUE;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mtCOVERAGE_TEST_MARKER();
|
|
||||||
}
|
|
||||||
|
|
||||||
if( xBreakLoop != pdFALSE )
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if( pxReturn != NULL )
|
|
||||||
{
|
|
||||||
/* The handle has been found. */
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mtCOVERAGE_TEST_MARKER();
|
|
||||||
}
|
|
||||||
|
|
||||||
return pxReturn;
|
if( pxReturn != NULL )
|
||||||
|
{
|
||||||
|
/* The handle has been found. */
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif /* #if ( configNUMBER_OF_CORES == 1 ) */
|
else
|
||||||
|
{
|
||||||
|
mtCOVERAGE_TEST_MARKER();
|
||||||
|
}
|
||||||
|
|
||||||
|
return pxReturn;
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* INCLUDE_xTaskGetHandle */
|
#endif /* INCLUDE_xTaskGetHandle */
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
@ -6330,30 +6255,27 @@ static void prvCheckTasksWaitingTermination( void )
|
||||||
List_t * pxList,
|
List_t * pxList,
|
||||||
eTaskState eState )
|
eTaskState eState )
|
||||||
{
|
{
|
||||||
configLIST_VOLATILE TCB_t * pxNextTCB;
|
configLIST_VOLATILE TCB_t * pxTCB;
|
||||||
configLIST_VOLATILE TCB_t * pxFirstTCB;
|
|
||||||
UBaseType_t uxTask = 0;
|
UBaseType_t uxTask = 0;
|
||||||
|
const ListItem_t * pxEndMarker = listGET_END_MARKER( pxList );
|
||||||
|
ListItem_t * pxIterator;
|
||||||
|
|
||||||
if( listCURRENT_LIST_LENGTH( pxList ) > ( UBaseType_t ) 0 )
|
if( listCURRENT_LIST_LENGTH( pxList ) > ( UBaseType_t ) 0 )
|
||||||
{
|
{
|
||||||
/* MISRA Ref 11.5.3 [Void pointer assignment] */
|
|
||||||
/* More details at: https://github.com/FreeRTOS/FreeRTOS-Kernel/blob/main/MISRA.md#rule-115 */
|
|
||||||
/* coverity[misra_c_2012_rule_11_5_violation] */
|
|
||||||
listGET_OWNER_OF_NEXT_ENTRY( pxFirstTCB, pxList );
|
|
||||||
|
|
||||||
/* Populate an TaskStatus_t structure within the
|
/* Populate an TaskStatus_t structure within the
|
||||||
* pxTaskStatusArray array for each task that is referenced from
|
* pxTaskStatusArray array for each task that is referenced from
|
||||||
* pxList. See the definition of TaskStatus_t in task.h for the
|
* pxList. See the definition of TaskStatus_t in task.h for the
|
||||||
* meaning of each TaskStatus_t structure member. */
|
* meaning of each TaskStatus_t structure member. */
|
||||||
do
|
for( pxIterator = listGET_HEAD_ENTRY( pxList ); pxIterator != pxEndMarker; pxIterator = listGET_NEXT( pxIterator ) )
|
||||||
{
|
{
|
||||||
/* MISRA Ref 11.5.3 [Void pointer assignment] */
|
/* MISRA Ref 11.5.3 [Void pointer assignment] */
|
||||||
/* More details at: https://github.com/FreeRTOS/FreeRTOS-Kernel/blob/main/MISRA.md#rule-115 */
|
/* More details at: https://github.com/FreeRTOS/FreeRTOS-Kernel/blob/main/MISRA.md#rule-115 */
|
||||||
/* coverity[misra_c_2012_rule_11_5_violation] */
|
/* coverity[misra_c_2012_rule_11_5_violation] */
|
||||||
listGET_OWNER_OF_NEXT_ENTRY( pxNextTCB, pxList );
|
pxTCB = listGET_LIST_ITEM_OWNER( pxIterator );
|
||||||
vTaskGetInfo( ( TaskHandle_t ) pxNextTCB, &( pxTaskStatusArray[ uxTask ] ), pdTRUE, eState );
|
|
||||||
|
vTaskGetInfo( ( TaskHandle_t ) pxTCB, &( pxTaskStatusArray[ uxTask ] ), pdTRUE, eState );
|
||||||
uxTask++;
|
uxTask++;
|
||||||
} while( pxNextTCB != pxFirstTCB );
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue