mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-04-20 05:21:59 -04:00
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.
This commit is contained in:
parent
4e7b460eaf
commit
ac78adae4b
|
@ -139,4 +139,6 @@ version of the Win32 simulator projects. It will be ignored in the GCC
|
||||||
version. */
|
version. */
|
||||||
#define configUSE_PORT_OPTIMISED_TASK_SELECTION 1
|
#define configUSE_PORT_OPTIMISED_TASK_SELECTION 1
|
||||||
|
|
||||||
|
#define configUSE_QUEUE_SETS 1
|
||||||
|
|
||||||
#endif /* FREERTOS_CONFIG_H */
|
#endif /* FREERTOS_CONFIG_H */
|
||||||
|
|
Binary file not shown.
|
@ -161,6 +161,10 @@ typedef portBASE_TYPE (*pdTASK_HOOK_CODE)( void * );
|
||||||
#define INCLUDE_xQueueGetMutexHolder 0
|
#define INCLUDE_xQueueGetMutexHolder 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef INCLUDE_xSemaphoreGetMutexHolder
|
||||||
|
#define INCLUDE_xSemaphoreGetMutexHolder INCLUDE_xQueueGetMutexHolder
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef INCLUDE_pcTaskGetTaskName
|
#ifndef INCLUDE_pcTaskGetTaskName
|
||||||
#define INCLUDE_pcTaskGetTaskName 0
|
#define INCLUDE_pcTaskGetTaskName 0
|
||||||
#endif
|
#endif
|
||||||
|
@ -173,8 +177,8 @@ typedef portBASE_TYPE (*pdTASK_HOOK_CODE)( void * );
|
||||||
#define INCLUDE_uxTaskGetStackHighWaterMark 0
|
#define INCLUDE_uxTaskGetStackHighWaterMark 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef INCLUDE_eTaskStateGet
|
#ifndef INCLUDE_eTaskGetState
|
||||||
#define INCLUDE_eTaskStateGet 0
|
#define INCLUDE_eTaskGetState 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef configUSE_RECURSIVE_MUTEXES
|
#ifndef configUSE_RECURSIVE_MUTEXES
|
||||||
|
@ -534,6 +538,14 @@ typedef portBASE_TYPE (*pdTASK_HOOK_CODE)( void * );
|
||||||
#define portSUPPRESS_TICKS_AND_SLEEP( xExpectedIdleTime )
|
#define portSUPPRESS_TICKS_AND_SLEEP( xExpectedIdleTime )
|
||||||
#endif
|
#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
|
#ifndef configUSE_TICKLESS_IDLE
|
||||||
#define configUSE_TICKLESS_IDLE 0
|
#define configUSE_TICKLESS_IDLE 0
|
||||||
#endif
|
#endif
|
||||||
|
@ -546,5 +558,9 @@ typedef portBASE_TYPE (*pdTASK_HOOK_CODE)( void * );
|
||||||
#define configPOST_SLEEP_PROCESSING( x )
|
#define configPOST_SLEEP_PROCESSING( x )
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* For backward compatability. */
|
||||||
|
#define eTaskStateGet eTaskGetState
|
||||||
|
#define INCLUDE_eTaskStateGet INCLUDE_eTaskGetState
|
||||||
|
|
||||||
#endif /* INC_FREERTOS_H */
|
#endif /* INC_FREERTOS_H */
|
||||||
|
|
||||||
|
|
|
@ -85,7 +85,7 @@ only for ports that are using the MPU. */
|
||||||
#define vTaskDelay MPU_vTaskDelay
|
#define vTaskDelay MPU_vTaskDelay
|
||||||
#define uxTaskPriorityGet MPU_uxTaskPriorityGet
|
#define uxTaskPriorityGet MPU_uxTaskPriorityGet
|
||||||
#define vTaskPrioritySet MPU_vTaskPrioritySet
|
#define vTaskPrioritySet MPU_vTaskPrioritySet
|
||||||
#define eTaskStateGet MPU_eTaskStateGet
|
#define eTaskGetState MPU_eTaskGetState
|
||||||
#define vTaskSuspend MPU_vTaskSuspend
|
#define vTaskSuspend MPU_vTaskSuspend
|
||||||
#define xTaskIsTaskSuspended MPU_xTaskIsTaskSuspended
|
#define xTaskIsTaskSuspended MPU_xTaskIsTaskSuspended
|
||||||
#define vTaskResume MPU_vTaskResume
|
#define vTaskResume MPU_vTaskResume
|
||||||
|
|
|
@ -131,7 +131,7 @@ typedef struct xTASK_PARAMTERS
|
||||||
xMemoryRegion xRegions[ portNUM_CONFIGURABLE_REGIONS ];
|
xMemoryRegion xRegions[ portNUM_CONFIGURABLE_REGIONS ];
|
||||||
} xTaskParameters;
|
} xTaskParameters;
|
||||||
|
|
||||||
/* Task states returned by eTaskStateGet. */
|
/* Task states returned by eTaskGetState. */
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
eRunning = 0, /* A task is querying the state of itself, so must be running. */
|
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
|
* 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.
|
* See the configuration section for more information.
|
||||||
*
|
*
|
||||||
* Obtain the state of any task. States are encoded by the eTaskState
|
* 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
|
* state of the task might change between the function being called, and the
|
||||||
* functions return value being tested by the calling task.
|
* functions return value being tested by the calling task.
|
||||||
*/
|
*/
|
||||||
eTaskState eTaskStateGet( xTaskHandle pxTask ) PRIVILEGED_FUNCTION;
|
eTaskState eTaskGetState( xTaskHandle pxTask ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* task. h
|
* task. h
|
||||||
|
|
|
@ -367,6 +367,7 @@ void xPortSysTickHandler( void )
|
||||||
__attribute__((weak)) void vPortSuppressTicksAndSleep( portTickType xExpectedIdleTime )
|
__attribute__((weak)) void vPortSuppressTicksAndSleep( portTickType xExpectedIdleTime )
|
||||||
{
|
{
|
||||||
unsigned long ulReloadValue, ulCompleteTickPeriods, ulCompletedSysTickIncrements;
|
unsigned long ulReloadValue, ulCompleteTickPeriods, ulCompletedSysTickIncrements;
|
||||||
|
portTickType xModifiableIdleTime;
|
||||||
|
|
||||||
/* Make sure the SysTick reload value does not overflow the counter. */
|
/* Make sure the SysTick reload value does not overflow the counter. */
|
||||||
if( xExpectedIdleTime > xMaximumPossibleSuppressedTicks )
|
if( xExpectedIdleTime > xMaximumPossibleSuppressedTicks )
|
||||||
|
@ -412,9 +413,14 @@ void xPortSysTickHandler( void )
|
||||||
/* Restart SysTick. */
|
/* Restart SysTick. */
|
||||||
portNVIC_SYSTICK_CTRL_REG = portNVIC_SYSTICK_CLK_BIT | portNVIC_SYSTICK_INT_BIT | portNVIC_SYSTICK_ENABLE_BIT;
|
portNVIC_SYSTICK_CTRL_REG = portNVIC_SYSTICK_CLK_BIT | portNVIC_SYSTICK_INT_BIT | portNVIC_SYSTICK_ENABLE_BIT;
|
||||||
|
|
||||||
/* Sleep until something happens. */
|
/* Sleep until something happens. configPRE_SLEEP_PROCESSING() can
|
||||||
configPRE_SLEEP_PROCESSING( xExpectedIdleTime );
|
set its parameter to 0 to indicate that its implementation contains
|
||||||
if( xExpectedIdleTime > 0 )
|
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" );
|
__asm volatile( "wfi" );
|
||||||
}
|
}
|
||||||
|
|
|
@ -180,7 +180,7 @@ void MPU_vTaskDelayUntil( portTickType * const pxPreviousWakeTime, portTickType
|
||||||
void MPU_vTaskDelay( portTickType xTicksToDelay );
|
void MPU_vTaskDelay( portTickType xTicksToDelay );
|
||||||
unsigned portBASE_TYPE MPU_uxTaskPriorityGet( xTaskHandle pxTask );
|
unsigned portBASE_TYPE MPU_uxTaskPriorityGet( xTaskHandle pxTask );
|
||||||
void MPU_vTaskPrioritySet( xTaskHandle pxTask, unsigned portBASE_TYPE uxNewPriority );
|
void MPU_vTaskPrioritySet( xTaskHandle pxTask, unsigned portBASE_TYPE uxNewPriority );
|
||||||
eTaskState MPU_eTaskStateGet( xTaskHandle pxTask );
|
eTaskState MPU_eTaskGetState( xTaskHandle pxTask );
|
||||||
void MPU_vTaskSuspend( xTaskHandle pxTaskToSuspend );
|
void MPU_vTaskSuspend( xTaskHandle pxTaskToSuspend );
|
||||||
signed portBASE_TYPE MPU_xTaskIsTaskSuspended( xTaskHandle xTask );
|
signed portBASE_TYPE MPU_xTaskIsTaskSuspended( xTaskHandle xTask );
|
||||||
void MPU_vTaskResume( xTaskHandle pxTaskToResume );
|
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
|
/* Simulate the stack frame as it would be created by a context switch
|
||||||
interrupt. */
|
interrupt. */
|
||||||
pxTopOfStack--; /* Offset added to account for the way the MCU uses the stack on entry/exit of interrupts. */
|
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 = portINITIAL_XPSR; /* xPSR */
|
||||||
pxTopOfStack--;
|
pxTopOfStack--;
|
||||||
*pxTopOfStack = ( portSTACK_TYPE ) pxCode; /* PC */
|
*pxTopOfStack = ( portSTACK_TYPE ) pxCode; /* PC */
|
||||||
|
@ -736,13 +737,13 @@ portBASE_TYPE xRunningPrivileged = prvRaisePrivilege();
|
||||||
#endif
|
#endif
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
#if ( INCLUDE_eTaskStateGet == 1 )
|
#if ( INCLUDE_eTaskGetState == 1 )
|
||||||
eTaskState MPU_eTaskStateGet( xTaskHandle pxTask )
|
eTaskState MPU_eTaskGetState( xTaskHandle pxTask )
|
||||||
{
|
{
|
||||||
portBASE_TYPE xRunningPrivileged = prvRaisePrivilege();
|
portBASE_TYPE xRunningPrivileged = prvRaisePrivilege();
|
||||||
eTaskState eReturn;
|
eTaskState eReturn;
|
||||||
|
|
||||||
eReturn = eTaskStateGet( pxTask );
|
eReturn = eTaskGetState( pxTask );
|
||||||
portRESET_PRIVILEGE( xRunningPrivileged );
|
portRESET_PRIVILEGE( xRunningPrivileged );
|
||||||
return eReturn;
|
return eReturn;
|
||||||
}
|
}
|
||||||
|
|
|
@ -399,6 +399,7 @@ void xPortSysTickHandler( void )
|
||||||
__attribute__((weak)) void vPortSuppressTicksAndSleep( portTickType xExpectedIdleTime )
|
__attribute__((weak)) void vPortSuppressTicksAndSleep( portTickType xExpectedIdleTime )
|
||||||
{
|
{
|
||||||
unsigned long ulReloadValue, ulCompleteTickPeriods, ulCompletedSysTickIncrements;
|
unsigned long ulReloadValue, ulCompleteTickPeriods, ulCompletedSysTickIncrements;
|
||||||
|
portTickType xModifiableIdleTime;
|
||||||
|
|
||||||
/* Make sure the SysTick reload value does not overflow the counter. */
|
/* Make sure the SysTick reload value does not overflow the counter. */
|
||||||
if( xExpectedIdleTime > xMaximumPossibleSuppressedTicks )
|
if( xExpectedIdleTime > xMaximumPossibleSuppressedTicks )
|
||||||
|
@ -444,9 +445,14 @@ void xPortSysTickHandler( void )
|
||||||
/* Restart SysTick. */
|
/* Restart SysTick. */
|
||||||
portNVIC_SYSTICK_CTRL_REG = portNVIC_SYSTICK_CLK_BIT | portNVIC_SYSTICK_INT_BIT | portNVIC_SYSTICK_ENABLE_BIT;
|
portNVIC_SYSTICK_CTRL_REG = portNVIC_SYSTICK_CLK_BIT | portNVIC_SYSTICK_INT_BIT | portNVIC_SYSTICK_ENABLE_BIT;
|
||||||
|
|
||||||
/* Sleep until something happens. */
|
/* Sleep until something happens. configPRE_SLEEP_PROCESSING() can
|
||||||
configPRE_SLEEP_PROCESSING( xExpectedIdleTime );
|
set its parameter to 0 to indicate that its implementation contains
|
||||||
if( xExpectedIdleTime > 0 )
|
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" );
|
__asm volatile( "wfi" );
|
||||||
}
|
}
|
||||||
|
|
|
@ -265,6 +265,7 @@ void xPortSysTickHandler( void )
|
||||||
__weak void vPortSuppressTicksAndSleep( portTickType xExpectedIdleTime )
|
__weak void vPortSuppressTicksAndSleep( portTickType xExpectedIdleTime )
|
||||||
{
|
{
|
||||||
unsigned long ulReloadValue, ulCompleteTickPeriods, ulCompletedSysTickIncrements;
|
unsigned long ulReloadValue, ulCompleteTickPeriods, ulCompletedSysTickIncrements;
|
||||||
|
portTickType xModifiableIdleTime;
|
||||||
|
|
||||||
/* Make sure the SysTick reload value does not overflow the counter. */
|
/* Make sure the SysTick reload value does not overflow the counter. */
|
||||||
if( xExpectedIdleTime > xMaximumPossibleSuppressedTicks )
|
if( xExpectedIdleTime > xMaximumPossibleSuppressedTicks )
|
||||||
|
@ -310,9 +311,14 @@ void xPortSysTickHandler( void )
|
||||||
/* Restart SysTick. */
|
/* Restart SysTick. */
|
||||||
portNVIC_SYSTICK_CTRL_REG = portNVIC_SYSTICK_CLK_BIT | portNVIC_SYSTICK_INT_BIT | portNVIC_SYSTICK_ENABLE_BIT;
|
portNVIC_SYSTICK_CTRL_REG = portNVIC_SYSTICK_CLK_BIT | portNVIC_SYSTICK_INT_BIT | portNVIC_SYSTICK_ENABLE_BIT;
|
||||||
|
|
||||||
/* Sleep until something happens. */
|
/* Sleep until something happens. configPRE_SLEEP_PROCESSING() can
|
||||||
configPRE_SLEEP_PROCESSING( xExpectedIdleTime );
|
set its parameter to 0 to indicate that its implementation contains
|
||||||
if( xExpectedIdleTime > 0 )
|
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();
|
__WFI();
|
||||||
}
|
}
|
||||||
|
|
|
@ -290,6 +290,7 @@ void xPortSysTickHandler( void )
|
||||||
__weak void vPortSuppressTicksAndSleep( portTickType xExpectedIdleTime )
|
__weak void vPortSuppressTicksAndSleep( portTickType xExpectedIdleTime )
|
||||||
{
|
{
|
||||||
unsigned long ulReloadValue, ulCompleteTickPeriods, ulCompletedSysTickIncrements;
|
unsigned long ulReloadValue, ulCompleteTickPeriods, ulCompletedSysTickIncrements;
|
||||||
|
portTickType xModifiableIdleTime;
|
||||||
|
|
||||||
/* Make sure the SysTick reload value does not overflow the counter. */
|
/* Make sure the SysTick reload value does not overflow the counter. */
|
||||||
if( xExpectedIdleTime > xMaximumPossibleSuppressedTicks )
|
if( xExpectedIdleTime > xMaximumPossibleSuppressedTicks )
|
||||||
|
@ -335,9 +336,14 @@ void xPortSysTickHandler( void )
|
||||||
/* Restart SysTick. */
|
/* Restart SysTick. */
|
||||||
portNVIC_SYSTICK_CTRL_REG = portNVIC_SYSTICK_CLK_BIT | portNVIC_SYSTICK_INT_BIT | portNVIC_SYSTICK_ENABLE_BIT;
|
portNVIC_SYSTICK_CTRL_REG = portNVIC_SYSTICK_CLK_BIT | portNVIC_SYSTICK_INT_BIT | portNVIC_SYSTICK_ENABLE_BIT;
|
||||||
|
|
||||||
/* Sleep until something happens. */
|
/* Sleep until something happens. configPRE_SLEEP_PROCESSING() can
|
||||||
configPRE_SLEEP_PROCESSING( xExpectedIdleTime );
|
set its parameter to 0 to indicate that its implementation contains
|
||||||
if( xExpectedIdleTime > 0 )
|
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();
|
__WFI();
|
||||||
}
|
}
|
||||||
|
|
|
@ -339,6 +339,7 @@ void xPortSysTickHandler( void )
|
||||||
__weak void vPortSuppressTicksAndSleep( portTickType xExpectedIdleTime )
|
__weak void vPortSuppressTicksAndSleep( portTickType xExpectedIdleTime )
|
||||||
{
|
{
|
||||||
unsigned long ulReloadValue, ulCompleteTickPeriods, ulCompletedSysTickIncrements;
|
unsigned long ulReloadValue, ulCompleteTickPeriods, ulCompletedSysTickIncrements;
|
||||||
|
portTickType xModifiableIdleTime;
|
||||||
|
|
||||||
/* Make sure the SysTick reload value does not overflow the counter. */
|
/* Make sure the SysTick reload value does not overflow the counter. */
|
||||||
if( xExpectedIdleTime > xMaximumPossibleSuppressedTicks )
|
if( xExpectedIdleTime > xMaximumPossibleSuppressedTicks )
|
||||||
|
@ -384,9 +385,14 @@ void xPortSysTickHandler( void )
|
||||||
/* Restart SysTick. */
|
/* Restart SysTick. */
|
||||||
portNVIC_SYSTICK_CTRL_REG = portNVIC_SYSTICK_CLK_BIT | portNVIC_SYSTICK_INT_BIT | portNVIC_SYSTICK_ENABLE_BIT;
|
portNVIC_SYSTICK_CTRL_REG = portNVIC_SYSTICK_CLK_BIT | portNVIC_SYSTICK_INT_BIT | portNVIC_SYSTICK_ENABLE_BIT;
|
||||||
|
|
||||||
/* Sleep until something happens. */
|
/* Sleep until something happens. configPRE_SLEEP_PROCESSING() can
|
||||||
configPRE_SLEEP_PROCESSING( xExpectedIdleTime );
|
set its parameter to 0 to indicate that its implementation contains
|
||||||
if( xExpectedIdleTime > 0 )
|
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();
|
__wfi();
|
||||||
}
|
}
|
||||||
|
|
|
@ -402,6 +402,7 @@ void xPortSysTickHandler( void )
|
||||||
__weak void vPortSuppressTicksAndSleep( portTickType xExpectedIdleTime )
|
__weak void vPortSuppressTicksAndSleep( portTickType xExpectedIdleTime )
|
||||||
{
|
{
|
||||||
unsigned long ulReloadValue, ulCompleteTickPeriods, ulCompletedSysTickIncrements;
|
unsigned long ulReloadValue, ulCompleteTickPeriods, ulCompletedSysTickIncrements;
|
||||||
|
portTickType xModifiableIdleTime;
|
||||||
|
|
||||||
/* Make sure the SysTick reload value does not overflow the counter. */
|
/* Make sure the SysTick reload value does not overflow the counter. */
|
||||||
if( xExpectedIdleTime > xMaximumPossibleSuppressedTicks )
|
if( xExpectedIdleTime > xMaximumPossibleSuppressedTicks )
|
||||||
|
@ -447,9 +448,14 @@ void xPortSysTickHandler( void )
|
||||||
/* Restart SysTick. */
|
/* Restart SysTick. */
|
||||||
portNVIC_SYSTICK_CTRL_REG = portNVIC_SYSTICK_CLK_BIT | portNVIC_SYSTICK_INT_BIT | portNVIC_SYSTICK_ENABLE_BIT;
|
portNVIC_SYSTICK_CTRL_REG = portNVIC_SYSTICK_CLK_BIT | portNVIC_SYSTICK_INT_BIT | portNVIC_SYSTICK_ENABLE_BIT;
|
||||||
|
|
||||||
/* Sleep until something happens. */
|
/* Sleep until something happens. configPRE_SLEEP_PROCESSING() can
|
||||||
configPRE_SLEEP_PROCESSING( xExpectedIdleTime );
|
set its parameter to 0 to indicate that its implementation contains
|
||||||
if( xExpectedIdleTime > 0 )
|
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();
|
__wfi();
|
||||||
}
|
}
|
||||||
|
|
|
@ -840,9 +840,9 @@ tskTCB * pxNewTCB;
|
||||||
#endif
|
#endif
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
#if ( INCLUDE_eTaskStateGet == 1 )
|
#if ( INCLUDE_eTaskGetState == 1 )
|
||||||
|
|
||||||
eTaskState eTaskStateGet( xTaskHandle pxTask )
|
eTaskState eTaskGetState( xTaskHandle pxTask )
|
||||||
{
|
{
|
||||||
eTaskState eReturn;
|
eTaskState eReturn;
|
||||||
xList *pxStateList;
|
xList *pxStateList;
|
||||||
|
@ -1322,7 +1322,7 @@ void vTaskSuspendAll( void )
|
||||||
|
|
||||||
#if ( configUSE_TICKLESS_IDLE != 0 )
|
#if ( configUSE_TICKLESS_IDLE != 0 )
|
||||||
|
|
||||||
portTickType prvGetExpectedIdleTime( void )
|
static portTickType prvGetExpectedIdleTime( void )
|
||||||
{
|
{
|
||||||
portTickType xReturn;
|
portTickType xReturn;
|
||||||
|
|
||||||
|
@ -1645,7 +1645,7 @@ implementations require configUSE_TICKLESS_IDLE to be set to a value other than
|
||||||
|
|
||||||
void vTaskStepTick( portTickType xTicksToJump )
|
void vTaskStepTick( portTickType xTicksToJump )
|
||||||
{
|
{
|
||||||
configASSERT( xTicksToJump <= xNextTaskUnblockTime );
|
configASSERT( ( xTickCount + xTicksToJump ) <= xNextTaskUnblockTime );
|
||||||
xTickCount += xTicksToJump;
|
xTickCount += xTicksToJump;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2165,13 +2165,6 @@ static portTASK_FUNCTION( prvIdleTask, pvParameters )
|
||||||
#if ( configUSE_TICKLESS_IDLE != 0 )
|
#if ( configUSE_TICKLESS_IDLE != 0 )
|
||||||
{
|
{
|
||||||
portTickType xExpectedIdleTime;
|
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
|
/* It is not desirable to suspend then resume the scheduler on
|
||||||
each iteration of the idle task. Therefore, a preliminary
|
each iteration of the idle task. Therefore, a preliminary
|
||||||
test of the expected idle time is performed without the
|
test of the expected idle time is performed without the
|
||||||
|
@ -2179,7 +2172,7 @@ static portTASK_FUNCTION( prvIdleTask, pvParameters )
|
||||||
valid. */
|
valid. */
|
||||||
xExpectedIdleTime = prvGetExpectedIdleTime();
|
xExpectedIdleTime = prvGetExpectedIdleTime();
|
||||||
|
|
||||||
if( xExpectedIdleTime >= xMinimumExpectedIdleTime )
|
if( xExpectedIdleTime >= configEXPECTED_IDLE_TIME_BEFORE_SLEEP )
|
||||||
{
|
{
|
||||||
vTaskSuspendAll();
|
vTaskSuspendAll();
|
||||||
{
|
{
|
||||||
|
@ -2189,7 +2182,7 @@ static portTASK_FUNCTION( prvIdleTask, pvParameters )
|
||||||
configASSERT( xNextTaskUnblockTime >= xTickCount );
|
configASSERT( xNextTaskUnblockTime >= xTickCount );
|
||||||
xExpectedIdleTime = prvGetExpectedIdleTime();
|
xExpectedIdleTime = prvGetExpectedIdleTime();
|
||||||
|
|
||||||
if( xExpectedIdleTime >= xMinimumExpectedIdleTime )
|
if( xExpectedIdleTime >= configEXPECTED_IDLE_TIME_BEFORE_SLEEP )
|
||||||
{
|
{
|
||||||
portSUPPRESS_TICKS_AND_SLEEP( xExpectedIdleTime );
|
portSUPPRESS_TICKS_AND_SLEEP( xExpectedIdleTime );
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue