* executed from within CCS4! Once it has been executed, re-open or refresh \r
* the CCS4 project and remove the #error line below.\r
*/\r
-#error Ensure CreateProjectDirectoryStructure.bat has been executed before building. See comment immediately above.\r
+//#error Ensure CreateProjectDirectoryStructure.bat has been executed before building. See comment immediately above.\r
\r
\r
#ifndef FREERTOS_CONFIG_H\r
case configTICK_VECTOR is set to TIMER0_A0_VECTOR. */\r
#define configTICK_VECTOR TIMER0_A0_VECTOR\r
\r
-extern void vConfigureTimerForRunTimeStats( void );\r
-extern unsigned long ulGetRunTimeStatsTime( void );\r
-extern volatile unsigned long ulStatsOverflowCount;\r
+ extern void vConfigureTimerForRunTimeStats( void );\r
+ extern volatile unsigned long ulStatsOverflowCount;\r
\r
+/* Configure a 16 bit timer to generate the time base for the run time stats.\r
+The timer is configured to interrupt each time it overflows so a count of\r
+overflows can be kept - that way a 32 bit time value can be constructed from\r
+the timers current count value and the number of overflows. */\r
#define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS() vConfigureTimerForRunTimeStats()\r
-#define portGET_RUN_TIME_COUNTER_VALUE() ulGetRunTimeStatsTime()\r
-\r
+ \r
+/* Construct a 32 bit time value for use as the run time stats time base. This\r
+comes from the current value of a 16 bit timer combined with the number of times\r
+the timer has overflowed. */\r
+#define portALT_GET_RUN_TIME_COUNTER_VALUE( ulCountValue ) \\r
+ { \\r
+ /* Stop the counter counting temporarily. */ \\r
+ TA1CTL &= ~MC__CONTINOUS; \\r
+ \\r
+ /* Check to see if any counter overflow interrupts are pending. */ \\r
+ if( ( TA1CTL & TAIFG ) != 0 ) \\r
+ { \\r
+ /* An overflow has occurred but not yet been processed. */ \\r
+ ulStatsOverflowCount++; \\r
+ \\r
+ /* Clear the interrupt. */ \\r
+ TA1CTL &= ~TAIFG; \\r
+ } \\r
+ \\r
+ /* Generate a 32 bit counter value by combinging the current peripheral \\r
+ counter value with the number of overflows. */ \\r
+ ulCountValue = ( ulStatsOverflowCount << 16UL ); \\r
+ ulCountValue |= ( unsigned long ) TA1R; \\r
+ TA1CTL |= MC__CONTINOUS; \\r
+ }\r
#endif /* FREERTOS_CONFIG_H */\r
\r
}\r
/*-----------------------------------------------------------*/\r
\r
-unsigned long ulGetRunTimeStatsTime( void )\r
-{\r
-unsigned long ulReturn;\r
-unsigned short usCounterSnapshot;\r
-\r
- TA1CTL &= ~MC__CONTINOUS;\r
- _nop();\r
- _nop();\r
- ulReturn = ( ulStatsOverflowCount << 16UL );\r
- usCounterSnapshot = TA1R;\r
- ulReturn |= ( unsigned long ) usCounterSnapshot;\r
- TA1CTL |= MC__CONTINOUS;\r
- \r
- return ulReturn;\r
-}\r
-/*-----------------------------------------------------------*/\r