]> git.sur5r.net Git - freertos/commitdiff
Add code to the idle hook to test low power mode operation.
authorrichardbarry <richardbarry@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Sun, 19 Oct 2008 18:11:38 +0000 (18:11 +0000)
committerrichardbarry <richardbarry@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Sun, 19 Oct 2008 18:11:38 +0000 (18:11 +0000)
git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@504 1d2547de-c912-0410-9cb9-b8ca96c0e9e2

Demo/msp430_CrossWorks/main.c

index 02b17733e4082d76cb09ef34cf2cadca58ab1a60..08de0afb292f38b43d462a9183cfb1f986178b70 100644 (file)
@@ -140,6 +140,7 @@ static void prvSetupHardware( void );
 \r
 \r
 portBASE_TYPE xLocalError = pdFALSE;\r
+volatile unsigned portLONG ulIdleLoops = 0UL;\r
 \r
 /*-----------------------------------------------------------*/\r
 \r
@@ -201,6 +202,7 @@ portTickType xDelayPeriod = mainNO_ERROR_CHECK_DELAY;
 static portSHORT prvCheckOtherTasksAreStillRunning( void )\r
 {\r
 static portSHORT sNoErrorFound = pdTRUE;\r
+static unsigned portLONG ulLastIdleLoopCount = 0UL;\r
 \r
        /* The demo tasks maintain a count that increments every cycle of the task\r
        provided that the task has never encountered an error.  This function \r
@@ -228,6 +230,15 @@ static portSHORT sNoErrorFound = pdTRUE;
        {\r
                sNoErrorFound = pdFALSE;\r
        }\r
+\r
+    if( ulIdleLoops == ulLastIdleLoopCount )\r
+    {\r
+        sNoErrorFound = pdFALSE;\r
+    }\r
+    else\r
+    {\r
+        ulLastIdleLoopCount = ulIdleLoops;\r
+    }\r
        \r
        return sNoErrorFound;\r
 }\r
@@ -301,6 +312,11 @@ volatile signed portBASE_TYPE *pxTaskHasExecuted;
                        taskYIELD();\r
                }\r
                #endif\r
+\r
+        ulIdleLoops++;\r
+\r
+        /* Place the processor into low power mode. */\r
+        LPM3;\r
        }\r
 }\r
 \r