mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-04-24 15:31:56 -04:00
Minor changes to the TriCore port made during test/validation.
This commit is contained in:
parent
dd10b91fc4
commit
70cfbda2e8
|
@ -226,6 +226,9 @@ typedef portBASE_TYPE (*pdTASK_HOOK_CODE)( void * );
|
||||||
#define portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedStatusValue ) ( void ) uxSavedStatusValue
|
#define portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedStatusValue ) ( void ) uxSavedStatusValue
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef portCLEAN_UP_TCB
|
||||||
|
#define portCLEAN_UP_TCB( pxTCB ) ( void ) pxTCB
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef configQUEUE_REGISTRY_SIZE
|
#ifndef configQUEUE_REGISTRY_SIZE
|
||||||
#define configQUEUE_REGISTRY_SIZE 0U
|
#define configQUEUE_REGISTRY_SIZE 0U
|
||||||
|
|
|
@ -75,6 +75,7 @@
|
||||||
|
|
||||||
#define portINITIAL_SYSCON ( (unsigned portBASE_TYPE) 0x00000000 ) /* MPU Disable. */
|
#define portINITIAL_SYSCON ( (unsigned portBASE_TYPE) 0x00000000 ) /* MPU Disable. */
|
||||||
|
|
||||||
|
/* This macro should be used when the MPU is being used. */
|
||||||
#define portSELECT_PROGRAM_STATUS_WORD( xRunPrivileged ) ( ( xRunPrivileged ) ? portINITIAL_PRIVILEGED_PROGRAM_STATUS_WORD : portINITIAL_UNPRIVILEGED_PROGRAM_STATUS_WORD )
|
#define portSELECT_PROGRAM_STATUS_WORD( xRunPrivileged ) ( ( xRunPrivileged ) ? portINITIAL_PRIVILEGED_PROGRAM_STATUS_WORD : portINITIAL_UNPRIVILEGED_PROGRAM_STATUS_WORD )
|
||||||
|
|
||||||
/* CSA manipulation macros. */
|
/* CSA manipulation macros. */
|
||||||
|
@ -173,7 +174,7 @@ unsigned portBASE_TYPE *pxLowerCSA = NULL;
|
||||||
|
|
||||||
/* Upper Context. */
|
/* Upper Context. */
|
||||||
pxUpperCSA[ 2 ] = (unsigned portBASE_TYPE)pxTopOfStack; /* A10; Stack Return aka Stack Pointer */
|
pxUpperCSA[ 2 ] = (unsigned portBASE_TYPE)pxTopOfStack; /* A10; Stack Return aka Stack Pointer */
|
||||||
pxUpperCSA[ 1 ] = portSELECT_PROGRAM_STATUS_WORD( pdTRUE ); /* PSW */
|
pxUpperCSA[ 1 ] = portSYSTEM_PROGRAM_STATUS_WORD; /* PSW */
|
||||||
|
|
||||||
/* Clear the CSA. */
|
/* Clear the CSA. */
|
||||||
memset( pxLowerCSA, 0, 16 * sizeof( unsigned portBASE_TYPE ) );
|
memset( pxLowerCSA, 0, 16 * sizeof( unsigned portBASE_TYPE ) );
|
||||||
|
@ -318,50 +319,57 @@ void vPortSystemTickHandler( int iArg )
|
||||||
void vPortReclaimCSA( unsigned portBASE_TYPE *pxTCB )
|
void vPortReclaimCSA( unsigned portBASE_TYPE *pxTCB )
|
||||||
{
|
{
|
||||||
unsigned portBASE_TYPE pxHeadCSA, pxTailCSA, pxFreeCSA;
|
unsigned portBASE_TYPE pxHeadCSA, pxTailCSA, pxFreeCSA;
|
||||||
|
unsigned portBASE_TYPE *pulNextCSA;
|
||||||
|
|
||||||
/* The first element in a TCB is the Last Used CSA.
|
/* A pointer to the first CSA in the list of CSAs consumed by the task is
|
||||||
* These simply need to be free'd to add them back to
|
stored in the first element of the tasks TCB structure (where the stack
|
||||||
* the global pool of CSAs.
|
pointer would be on a traditional stack based architecture). */
|
||||||
*/
|
|
||||||
|
|
||||||
/* Lookup the first element from the TCB. */
|
|
||||||
pxHeadCSA = ( *pxTCB ) & portCSA_FCX_MASK;
|
pxHeadCSA = ( *pxTCB ) & portCSA_FCX_MASK;
|
||||||
|
|
||||||
/* If there is something to reclaim. */
|
/* Mask off everything in the CSA link field other than the address. If
|
||||||
if ( 0UL != ( pxHeadCSA & portCSA_FCX_MASK ) )
|
the address is NULL, then the CSA is not linking anywhere and there is
|
||||||
|
nothing to do. */
|
||||||
|
pxTailCSA = pxHeadCSA;
|
||||||
|
|
||||||
|
/* Convert the link value to contain just a raw address and store this
|
||||||
|
in a local variable. */
|
||||||
|
pulNextCSA = portCSA_TO_ADDRESS( pxTailCSA );
|
||||||
|
|
||||||
|
/* Iterate over the CSAs that were consumed as part of the task. The
|
||||||
|
first field in the CSA is the pointer to then next CSA. Mask off
|
||||||
|
everything in the pointer to the next CSA, other than the link address.
|
||||||
|
If this is NULL, then the CSA currently being pointed to is the last in
|
||||||
|
the chain. */
|
||||||
|
while( 0UL != ( pulNextCSA[ 0 ] & portCSA_FCX_MASK ) )
|
||||||
{
|
{
|
||||||
/* Iterate over the CSAs that were consumed as part of the task. */
|
/* Clear all bits of the pointer to the next in the chain, other
|
||||||
pxTailCSA = pxHeadCSA;
|
than the address bits themselves. */
|
||||||
while ( 0UL != ( portCSA_TO_ADDRESS( pxTailCSA )[ 0 ] & portCSA_FCX_MASK ) )
|
pulNextCSA[ 0 ] = pulNextCSA[ 0 ] & portCSA_FCX_MASK;
|
||||||
{
|
|
||||||
/* Clear any extra bits from the link words. */
|
|
||||||
portCSA_TO_ADDRESS( pxTailCSA )[ 0 ] = pxTailCSA & portCSA_FCX_MASK;
|
|
||||||
|
|
||||||
/* Iterate to the next CSA. */
|
/* Move the pointer to point to the next CSA in the list. */
|
||||||
pxTailCSA = portCSA_TO_ADDRESS( pxTailCSA )[ 0 ];
|
pxTailCSA = pulNextCSA[ 0 ];
|
||||||
}
|
|
||||||
|
|
||||||
/* pxHeadCSA points to the first in the chain
|
/* Update the local pointer to the CSA. */
|
||||||
* pxNextCSA points to the Head or the last in the chain.
|
pulNextCSA = portCSA_TO_ADDRESS( pxTailCSA );
|
||||||
*/
|
|
||||||
|
|
||||||
portENTER_CRITICAL();
|
|
||||||
{
|
|
||||||
/* Look up the current free CSA. */
|
|
||||||
_dsync();
|
|
||||||
pxFreeCSA = _mfcr( $FCX );
|
|
||||||
|
|
||||||
/* Join the current Free onto the Tail of what is being reclaimed. */
|
|
||||||
portCSA_TO_ADDRESS( pxTailCSA )[ 0 ] = pxFreeCSA;
|
|
||||||
|
|
||||||
/* Move the head of the reclaimed into the Free. */
|
|
||||||
_dsync();
|
|
||||||
_mtcr( $FCX, pxHeadCSA );
|
|
||||||
/* ISync to commit the change to the FCX. */
|
|
||||||
_isync();
|
|
||||||
}
|
|
||||||
portEXIT_CRITICAL();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
taskENTER_CRITICAL();
|
||||||
|
{
|
||||||
|
/* Look up the current free CSA head. */
|
||||||
|
_dsync();
|
||||||
|
pxFreeCSA = _mfcr( $FCX );
|
||||||
|
|
||||||
|
/* Join the current Free onto the Tail of what is being reclaimed. */
|
||||||
|
portCSA_TO_ADDRESS( pxTailCSA )[ 0 ] = pxFreeCSA;
|
||||||
|
|
||||||
|
/* Move the head of the reclaimed into the Free. */
|
||||||
|
_dsync();
|
||||||
|
_mtcr( $FCX, pxHeadCSA );
|
||||||
|
|
||||||
|
/* ISync to commit the change to the FCX. */
|
||||||
|
_isync();
|
||||||
|
}
|
||||||
|
taskEXIT_CRITICAL();
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
|
@ -187,6 +187,13 @@ unsigned portBASE_TYPE xUpperCSA = 0UL; \
|
||||||
#define portTASK_FUNCTION( vFunction, pvParameters ) void vFunction( void *pvParameters )
|
#define portTASK_FUNCTION( vFunction, pvParameters ) void vFunction( void *pvParameters )
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Port specific clean up macro required to free the CSAs that were consumed by
|
||||||
|
* a task that has since been deleted.
|
||||||
|
*/
|
||||||
|
void vPortReclaimCSA( unsigned portBASE_TYPE *pxTCB );
|
||||||
|
#define portCLEAN_UP_TCB( pxTCB ) vPortReclaimCSA( ( unsigned portBASE_TYPE *) ( pxTCB ) )
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -2347,6 +2347,10 @@ tskTCB *pxNewTCB;
|
||||||
|
|
||||||
static void prvDeleteTCB( tskTCB *pxTCB )
|
static void prvDeleteTCB( tskTCB *pxTCB )
|
||||||
{
|
{
|
||||||
|
/* This call is required specifically for the TriCore port. It must be
|
||||||
|
above the vPortFree() calls. */
|
||||||
|
portCLEAN_UP_TCB( pxTCB );
|
||||||
|
|
||||||
/* Free up the memory allocated by the scheduler for the task. It is up to
|
/* Free up the memory allocated by the scheduler for the task. It is up to
|
||||||
the task to free any memory allocated at the application level. */
|
the task to free any memory allocated at the application level. */
|
||||||
vPortFreeAligned( pxTCB->pxStack );
|
vPortFreeAligned( pxTCB->pxStack );
|
||||||
|
|
Loading…
Reference in a new issue