X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=Demo%2FCORTEX_LM3Sxxxx_IAR_Keil%2Ftimertest.c;h=6e46bb4b7105ced95cce0734a503f774de86f518;hb=baa9ed196e2945d39b1487fbd47e7f089a534ee5;hp=1a88989d5cd5fa1ab6ee4045d3473a0fa79e8dbd;hpb=f6abf70e60051c8dc271e329eeef65028ba3126b;p=freertos diff --git a/Demo/CORTEX_LM3Sxxxx_IAR_Keil/timertest.c b/Demo/CORTEX_LM3Sxxxx_IAR_Keil/timertest.c index 1a88989d5..6e46bb4b7 100644 --- a/Demo/CORTEX_LM3Sxxxx_IAR_Keil/timertest.c +++ b/Demo/CORTEX_LM3Sxxxx_IAR_Keil/timertest.c @@ -68,7 +68,7 @@ zero. */ void Timer0IntHandler( void ); /* Stores the value of the maximum recorded jitter between interrupts. */ -unsigned portLONG ulMaxJitter = 0; +volatile unsigned portLONG ulMaxJitter = 0; /*-----------------------------------------------------------*/ @@ -89,6 +89,9 @@ unsigned long ulFrequency; /* Just used to measure time. */ TimerLoadSet(TIMER1_BASE, TIMER_A, timerMAX_32BIT_VALUE ); + /* Ensure interrupts do not start until the scheduler is running. */ + portDISABLE_INTERRUPTS(); + /* The rate at which the timer will interrupt. */ ulFrequency = configCPU_CLOCK_HZ / timerINTERRUPT_FREQUENCY; TimerLoadSet( TIMER0_BASE, TIMER_A, ulFrequency ); @@ -103,7 +106,8 @@ unsigned long ulFrequency; void Timer0IntHandler( void ) { -unsigned portLONG ulDifference, ulCurrentCount; +unsigned portLONG ulDifference; +volatile unsigned portLONG ulCurrentCount; static portLONG ulMaxDifference = 0, ulLastCount = 0; /* We use the timer 1 counter value to measure the clock cycles between