*----------------------------------------------------------*/\r
\r
#define configUSE_PREEMPTION 1\r
-#define configUSE_IDLE_HOOK 0\r
+#define configUSE_IDLE_HOOK 1\r
#define configUSE_TICK_HOOK 0\r
#define configCPU_CLOCK_HZ ( ( unsigned portLONG ) 7995392 ) /* Clock setup from main.c in the demo application. */\r
#define configTICK_RATE_HZ ( ( portTickType ) 1000 )\r
*/\r
static void prvSetupHardware( void );\r
\r
+/* Used to detect the idle hook function stalling. */\r
+static volatile unsigned portLONG ulIdleLoops = 0UL;\r
+\r
/*-----------------------------------------------------------*/\r
\r
/*\r
static portSHORT prvCheckOtherTasksAreStillRunning( void )\r
{\r
static portSHORT sNoErrorFound = pdTRUE;\r
+static unsigned portLONG ulLastIdleLoops = 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
{\r
sNoErrorFound = pdFALSE;\r
}\r
+\r
+ if( ulLastIdleLoops == ulIdleLoops )\r
+ {\r
+ sNoErrorFound = pdFALSE;\r
+ }\r
+\r
+ ulLastIdleLoops = ulIdleLoops;\r
\r
return sNoErrorFound;\r
}\r
}\r
/*-----------------------------------------------------------*/\r
\r
+void vApplicationIdleHook( void );\r
+void vApplicationIdleHook( void )\r
+{\r
+ /* Simple put the CPU into lowpower mode. */\r
+ _BIS_SR( LPM3_bits );\r
+ ulIdleLoops++;\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
\r
\r
\r
static volatile portSHORT sTHREEmpty;\r
\r
/* Interrupt service routines. */\r
-interrupt (UART1RX_VECTOR) vRxISR( void );\r
-interrupt (UART1TX_VECTOR) vTxISR( void );\r
+interrupt (UART1RX_VECTOR) wakeup vRxISR( void );\r
+interrupt (UART1TX_VECTOR) wakeup vTxISR( void );\r
\r
/*-----------------------------------------------------------*/\r
\r
/*\r
* UART RX interrupt service routine.\r
*/\r
-interrupt (UART1RX_VECTOR) vRxISR( void )\r
+interrupt (UART1RX_VECTOR) wakeup vRxISR( void )\r
{\r
signed portCHAR cChar;\r
portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;\r
/*\r
* UART Tx interrupt service routine.\r
*/\r
-interrupt (UART1TX_VECTOR) vTxISR( void )\r
+interrupt (UART1TX_VECTOR) wakeup vTxISR( void )\r
{\r
signed portCHAR cChar;\r
portBASE_TYPE xTaskWoken = pdFALSE;\r