#include "QPeek.h"\r
#include "recmutex.h"\r
#include "TimerDemo.h"\r
-#include "comtest2.h"\r
#include "PollQ.h"\r
#include "countsem.h"\r
#include "dynamic.h"\r
#define mainLED0 0UL\r
#define mainLED1 1UL\r
\r
-/* The LED used by the comtest tasks. See the comtest.c file for more\r
-information. In this case, the LED is deliberatly out of the valid range as\r
-all the available LEDs are already used by other tasks and timers. */\r
-#define mainCOM_TEST_LED ( 4 )\r
-\r
/* Constant used by the standard timer test functions. */\r
#define mainTIMER_TEST_PERIOD ( 50 )\r
\r
/* A block time of zero simply means "don't block". */\r
#define mainDONT_BLOCK ( 0UL )\r
\r
-/* Baud rate used by the comtest tasks. */\r
-#define mainCOM_TEST_BAUD_RATE ( 115200UL )\r
-\r
/* The vector used by the GPIO port E. Button SW2 is configured to generate\r
an interrput on this port. */\r
#define mainGPIO_E_VECTOR ( 107 - 16 )\r
to make debugging easier. */\r
static const char *pcStatusMessage = NULL;\r
\r
+/* Used in the run time stats calculation. */\r
+static unsigned long ulClocksPer10thOfAMilliSecond = 0UL;\r
/*-----------------------------------------------------------*/\r
\r
void main( void )\r
vStartQueuePeekTasks();\r
vStartRecursiveMutexTasks();\r
vStartTimerDemoTask( mainTIMER_TEST_PERIOD );\r
-//_RB_ vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainCOM_TEST_BAUD_RATE, mainCOM_TEST_LED );\r
vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY );\r
vStartCountingSemaphoreTasks();\r
vStartDynamicPriorityTasks();\r
pcStatusMessage = "Error: RecMutex\n";\r
}\r
\r
-if( 0 )//_RB_ if( xAreComTestTasksStillRunning() != pdPASS )\r
- {\r
- pcStatusMessage = "Error: ComTest\n";\r
- }\r
- \r
if( xAreTimerDemoTasksStillRunning( ( mainCHECK_TIMER_PERIOD_MS ) ) != pdTRUE )\r
{\r
pcStatusMessage = "Error: TimerDemo\n";\r
}\r
}\r
/*-----------------------------------------------------------*/\r
+\r
+void vMainConfigureTimerForRunTimeStats( void )\r
+{\r
+ /* How many clocks are there per tenth of a millisecond? */\r
+ ulClocksPer10thOfAMilliSecond = configCPU_CLOCK_HZ / 10000UL;\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+unsigned long ulMainGetRunTimeCounterValue( void )\r
+{\r
+unsigned long ulSysTickCounts, ulTickCount, ulReturn;\r
+const unsigned long ulSysTickReloadValue = ( configCPU_CLOCK_HZ / configTICK_RATE_HZ ) - 1UL;\r
+volatile unsigned long * const pulCurrentSysTickCount = ( ( volatile unsigned long *) 0xe000e018 );\r
+volatile unsigned long * const pulInterruptCTRLState = ( ( volatile unsigned long *) 0xe000ed04 );\r
+const unsigned long ulSysTickPendingBit = 0x04000000UL;\r
+\r
+ /* NOTE: There are potentially race conditions here. It is ok to keep\r
+ things simple, without using any additional timer peripherals. */\r
+\r
+\r
+ /* The SysTick is a down counter. How many clocks have passed since it was\r
+ last reloaded? */\r
+ ulSysTickCounts = ulSysTickReloadValue - *pulCurrentSysTickCount;\r
+ \r
+ /* How many times has it overflowed? */\r
+ ulTickCount = xTaskGetTickCountFromISR();\r
+ \r
+ /* Is there a SysTick interrupt pending? */\r
+ if( ( *pulInterruptCTRLState & ulSysTickPendingBit ) != 0UL )\r
+ {\r
+ /* There is a SysTick interrupt pending, so the SysTick has overflowed\r
+ but the tick count not yet incremented. */\r
+ ulTickCount++;\r
+ \r
+ /* Read the SysTick again, as the overflow might have occurred since\r
+ it was read last. */\r
+ ulSysTickCounts = ulSysTickReloadValue - *pulCurrentSysTickCount;\r
+ } \r
+ \r
+ /* Convert the tick count into tenths of a millisecond. */\r
+ ulReturn = ( ulTickCount * 10UL ) ;\r
+ \r
+ /* Add on the number of tenths of a millisecond that have passed since the\r
+ tick count last got updated. */\r
+ ulReturn += ( ulSysTickCounts / ulClocksPer10thOfAMilliSecond );\r
+ \r
+ return ulReturn; \r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
0x3e, 0xd, 0xa, 0x3c, 0x62, 0x3e, 0x4c, 0x45, 0x44, 0x20, \r
0x61, 0x6e, 0x64, 0x20, 0x4c, 0x43, 0x44, 0x20, 0x49, 0x4f, \r
0x3c, 0x2f, 0x62, 0x3e, 0x3c, 0x62, 0x72, 0x3e, 0xd, 0xa, \r
- 0xd, 0xa, 0x3c, 0x70, 0x3e, 0xd, 0xa, 0xd, 0xa, 0x55, \r
- 0x73, 0x65, 0x20, 0x74, 0x68, 0x65, 0x20, 0x63, 0x68, 0x65, \r
- 0x63, 0x6b, 0x20, 0x62, 0x6f, 0x78, 0x20, 0x74, 0x6f, 0x20, \r
- 0x74, 0x75, 0x72, 0x6e, 0x20, 0x6f, 0x6e, 0x20, 0x6f, 0x72, \r
- 0x20, 0x6f, 0x66, 0x66, 0x20, 0x4c, 0x45, 0x44, 0x20, 0x34, \r
- 0x2c, 0x20, 0x74, 0x68, 0x65, 0x6e, 0x20, 0x63, 0x6c, 0x69, \r
- 0x63, 0x6b, 0x20, 0x22, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, \r
- 0x20, 0x49, 0x4f, 0x22, 0x2e, 0xd, 0xa, 0xd, 0xa, 0xd, \r
- 0xa, 0x3c, 0x70, 0x3e, 0xd, 0xa, 0x3c, 0x66, 0x6f, 0x72, \r
- 0x6d, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22, 0x61, 0x46, \r
- 0x6f, 0x72, 0x6d, 0x22, 0x20, 0x61, 0x63, 0x74, 0x69, 0x6f, \r
- 0x6e, 0x3d, 0x22, 0x2f, 0x69, 0x6f, 0x2e, 0x73, 0x68, 0x74, \r
- 0x6d, 0x6c, 0x22, 0x20, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, \r
- 0x3d, 0x22, 0x67, 0x65, 0x74, 0x22, 0x3e, 0xd, 0xa, 0x25, \r
- 0x21, 0x20, 0x6c, 0x65, 0x64, 0x2d, 0x69, 0x6f, 0xd, 0xa, \r
- 0x3c, 0x70, 0x3e, 0xd, 0xa, 0x3c, 0x69, 0x6e, 0x70, 0x75, \r
- 0x74, 0x20, 0x74, 0x79, 0x70, 0x65, 0x3d, 0x22, 0x73, 0x75, \r
- 0x62, 0x6d, 0x69, 0x74, 0x22, 0x20, 0x76, 0x61, 0x6c, 0x75, \r
- 0x65, 0x3d, 0x22, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x20, \r
- 0x49, 0x4f, 0x22, 0x3e, 0xd, 0xa, 0x3c, 0x2f, 0x66, 0x6f, \r
- 0x72, 0x6d, 0x3e, 0xd, 0xa, 0x3c, 0x62, 0x72, 0x3e, 0x3c, \r
- 0x70, 0x3e, 0xd, 0xa, 0x3c, 0x2f, 0x66, 0x6f, 0x6e, 0x74, \r
- 0x3e, 0xd, 0xa, 0x3c, 0x2f, 0x62, 0x6f, 0x64, 0x79, 0x3e, \r
- 0xd, 0xa, 0x3c, 0x2f, 0x68, 0x74, 0x6d, 0x6c, 0x3e, 0xd, \r
- 0xa, 0xd, 0xa, 0};\r
+ 0xd, 0xa, 0x3c, 0x70, 0x3e, 0xd, 0xa, 0xd, 0xa, 0x54, \r
+ 0x68, 0x65, 0x20, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x20, 0x62, \r
+ 0x6f, 0x78, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x22, 0x55, 0x70, \r
+ 0x64, 0x61, 0x74, 0x65, 0x20, 0x49, 0x4f, 0x22, 0x20, 0x62, \r
+ 0x75, 0x74, 0x74, 0x6f, 0x6e, 0x20, 0x63, 0x61, 0x6e, 0x20, \r
+ 0x61, 0x6c, 0x73, 0x6f, 0x20, 0x62, 0x65, 0x20, 0x75, 0x73, \r
+ 0x65, 0x64, 0x20, 0x74, 0x6f, 0x20, 0x74, 0x75, 0x72, 0x6e, \r
+ 0x20, 0x74, 0x68, 0x65, 0x20, 0x79, 0x65, 0x6c, 0x6c, 0x6f, \r
+ 0x77, 0x20, 0x4c, 0x45, 0x44, 0x20, 0x6f, 0x6e, 0x20, 0x61, \r
+ 0x6e, 0x64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\r
\r
static const char data_logo_jpg[] = {\r
/* /logo.jpg */\r