mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-04-19 21:11:57 -04:00
Add code to the idle hook to test low power mode operation.
This commit is contained in:
parent
86edfb7dd4
commit
0463a4814b
|
@ -140,6 +140,7 @@ static void prvSetupHardware( void );
|
|||
|
||||
|
||||
portBASE_TYPE xLocalError = pdFALSE;
|
||||
volatile unsigned portLONG ulIdleLoops = 0UL;
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
|
@ -201,6 +202,7 @@ portTickType xDelayPeriod = mainNO_ERROR_CHECK_DELAY;
|
|||
static portSHORT prvCheckOtherTasksAreStillRunning( void )
|
||||
{
|
||||
static portSHORT sNoErrorFound = pdTRUE;
|
||||
static unsigned portLONG ulLastIdleLoopCount = 0UL;
|
||||
|
||||
/* The demo tasks maintain a count that increments every cycle of the task
|
||||
provided that the task has never encountered an error. This function
|
||||
|
@ -229,6 +231,15 @@ static portSHORT sNoErrorFound = pdTRUE;
|
|||
sNoErrorFound = pdFALSE;
|
||||
}
|
||||
|
||||
if( ulIdleLoops == ulLastIdleLoopCount )
|
||||
{
|
||||
sNoErrorFound = pdFALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
ulLastIdleLoopCount = ulIdleLoops;
|
||||
}
|
||||
|
||||
return sNoErrorFound;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
@ -301,6 +312,11 @@ volatile signed portBASE_TYPE *pxTaskHasExecuted;
|
|||
taskYIELD();
|
||||
}
|
||||
#endif
|
||||
|
||||
ulIdleLoops++;
|
||||
|
||||
/* Place the processor into low power mode. */
|
||||
LPM3;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue