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
0463a4814b
commit
549dcfa148
|
@ -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 )
|
||||
|
|
|
@ -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
|
||||
|
@ -224,6 +228,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++;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue