From 0e57bb7526e1d5a8c9baad59ccd8fa53474f6760 Mon Sep 17 00:00:00 2001 From: richardbarry Date: Sun, 19 Oct 2008 18:11:38 +0000 Subject: [PATCH] Add code to the idle hook to test low power mode operation. git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@504 1d2547de-c912-0410-9cb9-b8ca96c0e9e2 --- Demo/msp430_CrossWorks/main.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Demo/msp430_CrossWorks/main.c b/Demo/msp430_CrossWorks/main.c index 02b17733e..08de0afb2 100644 --- a/Demo/msp430_CrossWorks/main.c +++ b/Demo/msp430_CrossWorks/main.c @@ -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 @@ -228,6 +230,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; } } -- 2.39.5