summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrichardbarry <richardbarry@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>2008-10-19 18:51:16 +0000
committerrichardbarry <richardbarry@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>2008-10-19 18:51:16 +0000
commit79e0b787043805c39d9339255866d926a44f291d (patch)
tree9f4942c57063f1e897ecebfcea8bc6dd9f5fef16
parenta8e6f8cd44f5550dfd069e675d441a801878600b (diff)
downloadfreertos-79e0b787043805c39d9339255866d926a44f291d.tar.gz
freertos-79e0b787043805c39d9339255866d926a44f291d.tar.bz2
freertos-79e0b787043805c39d9339255866d926a44f291d.tar.xz
Add code to the idle hook to test low power mode operation.
git-svn-id: https://freertos.svn.sourceforge.net/svnroot/freertos/trunk@505 1d2547de-c912-0410-9cb9-b8ca96c0e9e2
-rw-r--r--Demo/msp430_GCC/FreeRTOSConfig.h2
-rw-r--r--Demo/msp430_GCC/main.c20
-rw-r--r--Demo/msp430_GCC/serial/serial.c8
3 files changed, 25 insertions, 5 deletions
diff --git a/Demo/msp430_GCC/FreeRTOSConfig.h b/Demo/msp430_GCC/FreeRTOSConfig.h
index 048aaaea..aa004a23 100644
--- a/Demo/msp430_GCC/FreeRTOSConfig.h
+++ b/Demo/msp430_GCC/FreeRTOSConfig.h
@@ -65,7 +65,7 @@
*----------------------------------------------------------*/
#define configUSE_PREEMPTION 1
-#define configUSE_IDLE_HOOK 0
+#define configUSE_IDLE_HOOK 1
#define configUSE_TICK_HOOK 0
#define configCPU_CLOCK_HZ ( ( unsigned portLONG ) 7995392 ) /* Clock setup from main.c in the demo application. */
#define configTICK_RATE_HZ ( ( portTickType ) 1000 )
diff --git a/Demo/msp430_GCC/main.c b/Demo/msp430_GCC/main.c
index 6cd95e0a..0b106ea4 100644
--- a/Demo/msp430_GCC/main.c
+++ b/Demo/msp430_GCC/main.c
@@ -132,6 +132,9 @@ static portSHORT prvCheckOtherTasksAreStillRunning( void );
*/
static void prvSetupHardware( void );
+/* Used to detect the idle hook function stalling. */
+static volatile unsigned portLONG ulIdleLoops = 0UL;
+
/*-----------------------------------------------------------*/
/*
@@ -201,6 +204,7 @@ portTickType xDelayPeriod = mainNO_ERROR_CHECK_DELAY;
static portSHORT prvCheckOtherTasksAreStillRunning( void )
{
static portSHORT sNoErrorFound = pdTRUE;
+static unsigned portLONG ulLastIdleLoops = 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
@@ -223,6 +227,13 @@ static portSHORT sNoErrorFound = pdTRUE;
{
sNoErrorFound = pdFALSE;
}
+
+ if( ulLastIdleLoops == ulIdleLoops )
+ {
+ sNoErrorFound = pdFALSE;
+ }
+
+ ulLastIdleLoops = ulIdleLoops;
return sNoErrorFound;
}
@@ -251,6 +262,15 @@ static void prvSetupHardware( void )
}
/*-----------------------------------------------------------*/
+void vApplicationIdleHook( void );
+void vApplicationIdleHook( void )
+{
+ /* Simple put the CPU into lowpower mode. */
+ _BIS_SR( LPM3_bits );
+ ulIdleLoops++;
+}
+/*-----------------------------------------------------------*/
+
diff --git a/Demo/msp430_GCC/serial/serial.c b/Demo/msp430_GCC/serial/serial.c
index e78d9082..268dd5a2 100644
--- a/Demo/msp430_GCC/serial/serial.c
+++ b/Demo/msp430_GCC/serial/serial.c
@@ -83,8 +83,8 @@ static xQueueHandle xCharsForTx;
static volatile portSHORT sTHREEmpty;
/* Interrupt service routines. */
-interrupt (UART1RX_VECTOR) vRxISR( void );
-interrupt (UART1TX_VECTOR) vTxISR( void );
+interrupt (UART1RX_VECTOR) wakeup vRxISR( void );
+interrupt (UART1TX_VECTOR) wakeup vTxISR( void );
/*-----------------------------------------------------------*/
@@ -208,7 +208,7 @@ signed portBASE_TYPE xReturn;
/*
* UART RX interrupt service routine.
*/
-interrupt (UART1RX_VECTOR) vRxISR( void )
+interrupt (UART1RX_VECTOR) wakeup vRxISR( void )
{
signed portCHAR cChar;
portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
@@ -232,7 +232,7 @@ portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
/*
* UART Tx interrupt service routine.
*/
-interrupt (UART1TX_VECTOR) vTxISR( void )
+interrupt (UART1TX_VECTOR) wakeup vTxISR( void )
{
signed portCHAR cChar;
portBASE_TYPE xTaskWoken = pdFALSE;