\r
This file is part of the FreeRTOS.org distribution.\r
\r
- FreeRTOS.org is free software; you can redistribute it and/or modify it \r
+ FreeRTOS.org is free software; you can redistribute it and/or modify it\r
under the terms of the GNU General Public License (version 2) as published\r
by the Free Software Foundation and modified by the FreeRTOS exception.\r
\r
FreeRTOS.org is distributed in the hope that it will be useful, but WITHOUT\r
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or \r
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for \r
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or\r
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for\r
more details.\r
\r
- You should have received a copy of the GNU General Public License along \r
- with FreeRTOS.org; if not, write to the Free Software Foundation, Inc., 59 \r
+ You should have received a copy of the GNU General Public License along\r
+ with FreeRTOS.org; if not, write to the Free Software Foundation, Inc., 59\r
Temple Place, Suite 330, Boston, MA 02111-1307 USA.\r
\r
- A special exception to the GPL is included to allow you to distribute a \r
+ A special exception to the GPL is included to allow you to distribute a\r
combined work that includes FreeRTOS.org without being obliged to provide\r
the source code for any proprietary components. See the licensing section\r
of http://www.FreeRTOS.org for full details.\r
void Timer0IntHandler( void );\r
\r
/* Stores the value of the maximum recorded jitter between interrupts. */\r
-volatile unsigned portLONG ulMaxJitter = 0;\r
+volatile unsigned portLONG ulMaxJitter = 0UL;\r
\r
+/* Counts the total number of times that the high frequency timer has 'ticked'.\r
+This value is used by the run time stats function to work out what percentage\r
+of CPU time each task is taking. */
+volatile unsigned portLONG ulHighFrequencyTimerTicks = 0UL;\r
/*-----------------------------------------------------------*/\r
\r
void vSetupHighFrequencyTimer( void )\r
SysCtlPeripheralEnable( SYSCTL_PERIPH_TIMER1 );\r
TimerConfigure( TIMER0_BASE, TIMER_CFG_32_BIT_PER );\r
TimerConfigure( TIMER1_BASE, TIMER_CFG_32_BIT_PER );\r
- \r
+\r
/* Set the timer interrupt to be above the kernel - highest. */\r
IntPrioritySet( INT_TIMER0A, timerHIGHEST_PRIORITY );\r
\r
/* Just used to measure time. */\r
TimerLoadSet(TIMER1_BASE, TIMER_A, timerMAX_32BIT_VALUE );\r
- \r
+\r
/* Ensure interrupts do not start until the scheduler is running. */\r
portDISABLE_INTERRUPTS();\r
- \r
+\r
/* The rate at which the timer will interrupt. */\r
- ulFrequency = configCPU_CLOCK_HZ / timerINTERRUPT_FREQUENCY; \r
+ ulFrequency = configCPU_CLOCK_HZ / timerINTERRUPT_FREQUENCY;\r
TimerLoadSet( TIMER0_BASE, TIMER_A, ulFrequency );\r
IntEnable( INT_TIMER0A );\r
TimerIntEnable( TIMER0_BASE, TIMER_TIMA_TIMEOUT );\r
\r
- /* Enable both timers. */ \r
+ /* Enable both timers. */\r
TimerEnable( TIMER0_BASE, TIMER_A );\r
TimerEnable( TIMER1_BASE, TIMER_A );\r
}\r
ulCurrentCount = timerTIMER_1_COUNT_VALUE;\r
\r
TimerIntClear( TIMER0_BASE, TIMER_TIMA_TIMEOUT );\r
- \r
+\r
if( ulCurrentCount < ulLastCount )\r
- { \r
+ {\r
/* How many times has timer 1 counted since the last interrupt? */\r
ulDifference = ulLastCount - ulCurrentCount;\r
- \r
+\r
/* Is this the largest difference we have measured yet? */\r
if( ulDifference > ulMaxDifference )\r
{\r
ulMaxJitter = ulMaxDifference - timerEXPECTED_DIFFERENCE_VALUE;\r
}\r
}\r
- \r
+\r
ulLastCount = ulCurrentCount;\r
+\r
+ /* Keep a count of the total number of 20KHz ticks. This is used by the\r
+ run time stats functionality to calculate how much CPU time is used by\r
+ each task. */\r
+ ulHighFrequencyTimerTicks++;
}\r
\r
\r