Added INCLUDE_xSemaphoreGetMutexHolder() default.

Changed eTaskStateGet() to eTaskGetState() and added #define to ensure backward compatibility.
Added configEXPECTED_IDLE_TIME_BEFORE_SLEEP definition - was previously hard coded to 2.
Slight change to the default CM3 tickless sleep function to allow the idle time to be set to zero in the pre-sleep processing macro.
Changed stack alignment for the FreeRTOS-MPU port to ensure it didn't trigger the assert() in the generic create function.
pull/1/head
Richard Barry 12 years ago
parent 4e7b460eaf
commit ac78adae4b

@ -139,4 +139,6 @@ version of the Win32 simulator projects. It will be ignored in the GCC
version. */
#define configUSE_PORT_OPTIMISED_TASK_SELECTION 1
#define configUSE_QUEUE_SETS 1
#endif /* FREERTOS_CONFIG_H */

@ -161,6 +161,10 @@ typedef portBASE_TYPE (*pdTASK_HOOK_CODE)( void * );
#define INCLUDE_xQueueGetMutexHolder 0
#endif
#ifndef INCLUDE_xSemaphoreGetMutexHolder
#define INCLUDE_xSemaphoreGetMutexHolder INCLUDE_xQueueGetMutexHolder
#endif
#ifndef INCLUDE_pcTaskGetTaskName
#define INCLUDE_pcTaskGetTaskName 0
#endif
@ -173,8 +177,8 @@ typedef portBASE_TYPE (*pdTASK_HOOK_CODE)( void * );
#define INCLUDE_uxTaskGetStackHighWaterMark 0
#endif
#ifndef INCLUDE_eTaskStateGet
#define INCLUDE_eTaskStateGet 0
#ifndef INCLUDE_eTaskGetState
#define INCLUDE_eTaskGetState 0
#endif
#ifndef configUSE_RECURSIVE_MUTEXES
@ -534,6 +538,14 @@ typedef portBASE_TYPE (*pdTASK_HOOK_CODE)( void * );
#define portSUPPRESS_TICKS_AND_SLEEP( xExpectedIdleTime )
#endif
#ifndef configEXPECTED_IDLE_TIME_BEFORE_SLEEP
#define configEXPECTED_IDLE_TIME_BEFORE_SLEEP 2
#endif
#if configEXPECTED_IDLE_TIME_BEFORE_SLEEP < 2
#error configEXPECTED_IDLE_TIME_BEFORE_SLEEP must not be less than 2
#endif
#ifndef configUSE_TICKLESS_IDLE
#define configUSE_TICKLESS_IDLE 0
#endif
@ -546,5 +558,9 @@ typedef portBASE_TYPE (*pdTASK_HOOK_CODE)( void * );
#define configPOST_SLEEP_PROCESSING( x )
#endif
/* For backward compatability. */
#define eTaskStateGet eTaskGetState
#define INCLUDE_eTaskStateGet INCLUDE_eTaskGetState
#endif /* INC_FREERTOS_H */

@ -85,7 +85,7 @@ only for ports that are using the MPU. */
#define vTaskDelay MPU_vTaskDelay
#define uxTaskPriorityGet MPU_uxTaskPriorityGet
#define vTaskPrioritySet MPU_vTaskPrioritySet
#define eTaskStateGet MPU_eTaskStateGet
#define eTaskGetState MPU_eTaskGetState
#define vTaskSuspend MPU_vTaskSuspend
#define xTaskIsTaskSuspended MPU_xTaskIsTaskSuspended
#define vTaskResume MPU_vTaskResume

@ -131,7 +131,7 @@ typedef struct xTASK_PARAMTERS
xMemoryRegion xRegions[ portNUM_CONFIGURABLE_REGIONS ];
} xTaskParameters;
/* Task states returned by eTaskStateGet. */
/* Task states returned by eTaskGetState. */
typedef enum
{
eRunning = 0, /* A task is querying the state of itself, so must be running. */
@ -613,9 +613,9 @@ unsigned portBASE_TYPE uxTaskPriorityGet( xTaskHandle pxTask ) PRIVILEGED_FUNCTI
/**
* task. h
* <pre>eTaskState eTaskStateGet( xTaskHandle pxTask );</pre>
* <pre>eTaskState eTaskGetState( xTaskHandle pxTask );</pre>
*
* INCLUDE_eTaskStateGet must be defined as 1 for this function to be available.
* INCLUDE_eTaskGetState must be defined as 1 for this function to be available.
* See the configuration section for more information.
*
* Obtain the state of any task. States are encoded by the eTaskState
@ -627,7 +627,7 @@ unsigned portBASE_TYPE uxTaskPriorityGet( xTaskHandle pxTask ) PRIVILEGED_FUNCTI
* state of the task might change between the function being called, and the
* functions return value being tested by the calling task.
*/
eTaskState eTaskStateGet( xTaskHandle pxTask ) PRIVILEGED_FUNCTION;
eTaskState eTaskGetState( xTaskHandle pxTask ) PRIVILEGED_FUNCTION;
/**
* task. h

@ -367,6 +367,7 @@ void xPortSysTickHandler( void )
__attribute__((weak)) void vPortSuppressTicksAndSleep( portTickType xExpectedIdleTime )
{
unsigned long ulReloadValue, ulCompleteTickPeriods, ulCompletedSysTickIncrements;
portTickType xModifiableIdleTime;
/* Make sure the SysTick reload value does not overflow the counter. */
if( xExpectedIdleTime > xMaximumPossibleSuppressedTicks )
@ -412,9 +413,14 @@ void xPortSysTickHandler( void )
/* Restart SysTick. */
portNVIC_SYSTICK_CTRL_REG = portNVIC_SYSTICK_CLK_BIT | portNVIC_SYSTICK_INT_BIT | portNVIC_SYSTICK_ENABLE_BIT;
/* Sleep until something happens. */
configPRE_SLEEP_PROCESSING( xExpectedIdleTime );
if( xExpectedIdleTime > 0 )
/* Sleep until something happens. configPRE_SLEEP_PROCESSING() can
set its parameter to 0 to indicate that its implementation contains
its own wait for interrupt or wait for event instruction, and so wfi
should not be executed again. However, the original expected idle
time variable must remain unmodified, so a copy is taken. */
xModifiableIdleTime = xExpectedIdleTime;
configPRE_SLEEP_PROCESSING( xModifiableIdleTime );
if( xModifiableIdleTime > 0 )
{
__asm volatile( "wfi" );
}

@ -180,7 +180,7 @@ void MPU_vTaskDelayUntil( portTickType * const pxPreviousWakeTime, portTickType
void MPU_vTaskDelay( portTickType xTicksToDelay );
unsigned portBASE_TYPE MPU_uxTaskPriorityGet( xTaskHandle pxTask );
void MPU_vTaskPrioritySet( xTaskHandle pxTask, unsigned portBASE_TYPE uxNewPriority );
eTaskState MPU_eTaskStateGet( xTaskHandle pxTask );
eTaskState MPU_eTaskGetState( xTaskHandle pxTask );
void MPU_vTaskSuspend( xTaskHandle pxTaskToSuspend );
signed portBASE_TYPE MPU_xTaskIsTaskSuspended( xTaskHandle xTask );
void MPU_vTaskResume( xTaskHandle pxTaskToResume );
@ -223,6 +223,7 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE
/* Simulate the stack frame as it would be created by a context switch
interrupt. */
pxTopOfStack--; /* Offset added to account for the way the MCU uses the stack on entry/exit of interrupts. */
pxTopOfStack--; /* Offset added to ensure 8-byte alignment is maintained. */
*pxTopOfStack = portINITIAL_XPSR; /* xPSR */
pxTopOfStack--;
*pxTopOfStack = ( portSTACK_TYPE ) pxCode; /* PC */
@ -736,13 +737,13 @@ portBASE_TYPE xRunningPrivileged = prvRaisePrivilege();
#endif
/*-----------------------------------------------------------*/
#if ( INCLUDE_eTaskStateGet == 1 )
eTaskState MPU_eTaskStateGet( xTaskHandle pxTask )
#if ( INCLUDE_eTaskGetState == 1 )
eTaskState MPU_eTaskGetState( xTaskHandle pxTask )
{
portBASE_TYPE xRunningPrivileged = prvRaisePrivilege();
eTaskState eReturn;
eReturn = eTaskStateGet( pxTask );
eReturn = eTaskGetState( pxTask );
portRESET_PRIVILEGE( xRunningPrivileged );
return eReturn;
}

@ -399,6 +399,7 @@ void xPortSysTickHandler( void )
__attribute__((weak)) void vPortSuppressTicksAndSleep( portTickType xExpectedIdleTime )
{
unsigned long ulReloadValue, ulCompleteTickPeriods, ulCompletedSysTickIncrements;
portTickType xModifiableIdleTime;
/* Make sure the SysTick reload value does not overflow the counter. */
if( xExpectedIdleTime > xMaximumPossibleSuppressedTicks )
@ -444,9 +445,14 @@ void xPortSysTickHandler( void )
/* Restart SysTick. */
portNVIC_SYSTICK_CTRL_REG = portNVIC_SYSTICK_CLK_BIT | portNVIC_SYSTICK_INT_BIT | portNVIC_SYSTICK_ENABLE_BIT;
/* Sleep until something happens. */
configPRE_SLEEP_PROCESSING( xExpectedIdleTime );
if( xExpectedIdleTime > 0 )
/* Sleep until something happens. configPRE_SLEEP_PROCESSING() can
set its parameter to 0 to indicate that its implementation contains
its own wait for interrupt or wait for event instruction, and so wfi
should not be executed again. However, the original expected idle
time variable must remain unmodified, so a copy is taken. */
xModifiableIdleTime = xExpectedIdleTime;
configPRE_SLEEP_PROCESSING( xModifiableIdleTime );
if( xModifiableIdleTime > 0 )
{
__asm volatile( "wfi" );
}

@ -265,6 +265,7 @@ void xPortSysTickHandler( void )
__weak void vPortSuppressTicksAndSleep( portTickType xExpectedIdleTime )
{
unsigned long ulReloadValue, ulCompleteTickPeriods, ulCompletedSysTickIncrements;
portTickType xModifiableIdleTime;
/* Make sure the SysTick reload value does not overflow the counter. */
if( xExpectedIdleTime > xMaximumPossibleSuppressedTicks )
@ -310,9 +311,14 @@ void xPortSysTickHandler( void )
/* Restart SysTick. */
portNVIC_SYSTICK_CTRL_REG = portNVIC_SYSTICK_CLK_BIT | portNVIC_SYSTICK_INT_BIT | portNVIC_SYSTICK_ENABLE_BIT;
/* Sleep until something happens. */
configPRE_SLEEP_PROCESSING( xExpectedIdleTime );
if( xExpectedIdleTime > 0 )
/* Sleep until something happens. configPRE_SLEEP_PROCESSING() can
set its parameter to 0 to indicate that its implementation contains
its own wait for interrupt or wait for event instruction, and so wfi
should not be executed again. However, the original expected idle
time variable must remain unmodified, so a copy is taken. */
xModifiableIdleTime = xExpectedIdleTime;
configPRE_SLEEP_PROCESSING( xModifiableIdleTime );
if( xModifiableIdleTime > 0 )
{
__WFI();
}

@ -290,6 +290,7 @@ void xPortSysTickHandler( void )
__weak void vPortSuppressTicksAndSleep( portTickType xExpectedIdleTime )
{
unsigned long ulReloadValue, ulCompleteTickPeriods, ulCompletedSysTickIncrements;
portTickType xModifiableIdleTime;
/* Make sure the SysTick reload value does not overflow the counter. */
if( xExpectedIdleTime > xMaximumPossibleSuppressedTicks )
@ -335,9 +336,14 @@ void xPortSysTickHandler( void )
/* Restart SysTick. */
portNVIC_SYSTICK_CTRL_REG = portNVIC_SYSTICK_CLK_BIT | portNVIC_SYSTICK_INT_BIT | portNVIC_SYSTICK_ENABLE_BIT;
/* Sleep until something happens. */
configPRE_SLEEP_PROCESSING( xExpectedIdleTime );
if( xExpectedIdleTime > 0 )
/* Sleep until something happens. configPRE_SLEEP_PROCESSING() can
set its parameter to 0 to indicate that its implementation contains
its own wait for interrupt or wait for event instruction, and so wfi
should not be executed again. However, the original expected idle
time variable must remain unmodified, so a copy is taken. */
xModifiableIdleTime = xExpectedIdleTime;
configPRE_SLEEP_PROCESSING( xModifiableIdleTime );
if( xModifiableIdleTime > 0 )
{
__WFI();
}

@ -339,6 +339,7 @@ void xPortSysTickHandler( void )
__weak void vPortSuppressTicksAndSleep( portTickType xExpectedIdleTime )
{
unsigned long ulReloadValue, ulCompleteTickPeriods, ulCompletedSysTickIncrements;
portTickType xModifiableIdleTime;
/* Make sure the SysTick reload value does not overflow the counter. */
if( xExpectedIdleTime > xMaximumPossibleSuppressedTicks )
@ -384,9 +385,14 @@ void xPortSysTickHandler( void )
/* Restart SysTick. */
portNVIC_SYSTICK_CTRL_REG = portNVIC_SYSTICK_CLK_BIT | portNVIC_SYSTICK_INT_BIT | portNVIC_SYSTICK_ENABLE_BIT;
/* Sleep until something happens. */
configPRE_SLEEP_PROCESSING( xExpectedIdleTime );
if( xExpectedIdleTime > 0 )
/* Sleep until something happens. configPRE_SLEEP_PROCESSING() can
set its parameter to 0 to indicate that its implementation contains
its own wait for interrupt or wait for event instruction, and so wfi
should not be executed again. However, the original expected idle
time variable must remain unmodified, so a copy is taken. */
xModifiableIdleTime = xExpectedIdleTime;
configPRE_SLEEP_PROCESSING( xModifiableIdleTime );
if( xModifiableIdleTime > 0 )
{
__wfi();
}

@ -402,6 +402,7 @@ void xPortSysTickHandler( void )
__weak void vPortSuppressTicksAndSleep( portTickType xExpectedIdleTime )
{
unsigned long ulReloadValue, ulCompleteTickPeriods, ulCompletedSysTickIncrements;
portTickType xModifiableIdleTime;
/* Make sure the SysTick reload value does not overflow the counter. */
if( xExpectedIdleTime > xMaximumPossibleSuppressedTicks )
@ -447,9 +448,14 @@ void xPortSysTickHandler( void )
/* Restart SysTick. */
portNVIC_SYSTICK_CTRL_REG = portNVIC_SYSTICK_CLK_BIT | portNVIC_SYSTICK_INT_BIT | portNVIC_SYSTICK_ENABLE_BIT;
/* Sleep until something happens. */
configPRE_SLEEP_PROCESSING( xExpectedIdleTime );
if( xExpectedIdleTime > 0 )
/* Sleep until something happens. configPRE_SLEEP_PROCESSING() can
set its parameter to 0 to indicate that its implementation contains
its own wait for interrupt or wait for event instruction, and so wfi
should not be executed again. However, the original expected idle
time variable must remain unmodified, so a copy is taken. */
xModifiableIdleTime = xExpectedIdleTime;
configPRE_SLEEP_PROCESSING( xModifiableIdleTime );
if( xModifiableIdleTime > 0 )
{
__wfi();
}

@ -840,9 +840,9 @@ tskTCB * pxNewTCB;
#endif
/*-----------------------------------------------------------*/
#if ( INCLUDE_eTaskStateGet == 1 )
#if ( INCLUDE_eTaskGetState == 1 )
eTaskState eTaskStateGet( xTaskHandle pxTask )
eTaskState eTaskGetState( xTaskHandle pxTask )
{
eTaskState eReturn;
xList *pxStateList;
@ -1322,7 +1322,7 @@ void vTaskSuspendAll( void )
#if ( configUSE_TICKLESS_IDLE != 0 )
portTickType prvGetExpectedIdleTime( void )
static portTickType prvGetExpectedIdleTime( void )
{
portTickType xReturn;
@ -1645,7 +1645,7 @@ implementations require configUSE_TICKLESS_IDLE to be set to a value other than
void vTaskStepTick( portTickType xTicksToJump )
{
configASSERT( xTicksToJump <= xNextTaskUnblockTime );
configASSERT( ( xTickCount + xTicksToJump ) <= xNextTaskUnblockTime );
xTickCount += xTicksToJump;
}
@ -2165,13 +2165,6 @@ static portTASK_FUNCTION( prvIdleTask, pvParameters )
#if ( configUSE_TICKLESS_IDLE != 0 )
{
portTickType xExpectedIdleTime;
/* If the expected idle time is 1 then the idle time would end at
the end of the current time slice. The idle time must be at least
2 to ensure any pended ticks between this point and the tick being
stopped can be legitimately stepped over when the tick suppression
routines returns. */
const portTickType xMinimumExpectedIdleTime = ( portTickType ) 2;
/* It is not desirable to suspend then resume the scheduler on
each iteration of the idle task. Therefore, a preliminary
test of the expected idle time is performed without the
@ -2179,7 +2172,7 @@ static portTASK_FUNCTION( prvIdleTask, pvParameters )
valid. */
xExpectedIdleTime = prvGetExpectedIdleTime();
if( xExpectedIdleTime >= xMinimumExpectedIdleTime )
if( xExpectedIdleTime >= configEXPECTED_IDLE_TIME_BEFORE_SLEEP )
{
vTaskSuspendAll();
{
@ -2189,7 +2182,7 @@ static portTASK_FUNCTION( prvIdleTask, pvParameters )
configASSERT( xNextTaskUnblockTime >= xTickCount );
xExpectedIdleTime = prvGetExpectedIdleTime();
if( xExpectedIdleTime >= xMinimumExpectedIdleTime )
if( xExpectedIdleTime >= configEXPECTED_IDLE_TIME_BEFORE_SLEEP )
{
portSUPPRESS_TICKS_AND_SLEEP( xExpectedIdleTime );
}

Loading…
Cancel
Save