* how to use the FreeRTOS API. In addition to the standard demo tasks, the \r
* following tasks and tests are defined and/or created within this file:\r
*\r
+ * Webserver ("uIP") task - This serves a number of dynamically generated WEB\r
+ * pages to a standard WEB browser. The IP and MAC addresses are configured by\r
+ * constants defined at the bottom of FreeRTOSConfig.h. Use either a standard\r
+ * Ethernet cable to connect through a hug, or a cross over (point to point)\r
+ * cable to connect directly. Ensure the IP address used is compatible with the\r
+ * IP address of the machine running the browser - the easiest way to achieve\r
+ * this is to ensure the first three octets of the IP addresses are the same.\r
+ *\r
* "Reg test" tasks - These fill the registers with known values, then check\r
* that each register still contains its expected value. Each task uses\r
* different values. The tasks run with very low priority so get preempted very\r
* those tasks that require it (those for which xPortUsesFloatingPoint() has\r
* been called).\r
* \r
- * *NOTE 5* Any task that can cause a context switch requires an asm wrapper\r
- * and must be assigned an interrupt priority of portKERNEL_INTERRUPT_PRIORITY.\r
+ * *NOTE 5* Any interrupt that can cause a context switch requires an asm \r
+ * wrapper and must be assigned an interrupt priority of \r
+ * portKERNEL_INTERRUPT_PRIORITY.\r
+ *\r
+ * *NOTE 6* vSetupClockForRunTimeStats() is called by the kernel (via the \r
+ * portCONFIGURE_TIMER_FOR_RUN_TIME_STATS()) macro to configure an MTU channel\r
+ * to produce a time base that is used to log how much processor time each task\r
+ * is consuming. The MTU is used to generate a high(ish) frequency interrupt,\r
+ * and so also provides an example of how interrupts that don't make use of the\r
+ * FreeRTOS kernel can be assigned a priority above any priority used by the\r
+ * kernel itself.\r
*/\r
\r
/* Kernel includes. */\r
#define mainGEN_QUEUE_TASK_PRIORITY ( tskIDLE_PRIORITY )\r
#define mainFLOP_TASK_PRIORITY ( tskIDLE_PRIORITY )\r
\r
+/* The WEB server uses string handling functions, which in turn use a bit more\r
+stack than most of the other tasks. */\r
#define mainuIP_STACK_SIZE ( configMINIMAL_STACK_SIZE * 3 )\r
\r
-/* The LED toggle by the check task. */\r
+/* The LED toggled by the check task. */\r
#define mainCHECK_LED ( 5 )\r
\r
/* The rate at which mainCHECK_LED will toggle when all the tasks are running\r
*/\r
extern void vuIP_Task( void *pvParameters );\r
\r
+/*\r
+ * The interrupt handler for the MTU - which is used to maintain the time base\r
+ * used by the run time stats.\r
+ */\r
+#pragma interrupt MTU_Match\r
+void MTU_Match( void );\r
+\r
/*-----------------------------------------------------------*/\r
\r
/* Variables that are incremented on each iteration of the reg test tasks - \r
\r
void vApplicationTickHook( void )\r
{\r
- /* Clear the inerrupt. */\r
+ /* Clear the tick inerrupt. This is called from an interrupt context. */\r
CMT0.CMCSR.BIT.CMF = 0;\r
}\r
/*-----------------------------------------------------------*/\r
\r
void vSetupClockForRunTimeStats( void )\r
{\r
+ /* Configure an MTU channel to generate a periodic interrupt that is used\r
+ as the run time stats time base. The run time stats keep a track of how\r
+ much processing time each task is using. */\r
+\r
/* Turn the MTU2 on. */\r
STB.CR3.BIT._MTU2 = 0;\r
\r
}\r
/*-----------------------------------------------------------*/\r
\r
-#pragma interrupt MTU_Match\r
-void MTU_Match( void );\r
-\r
void MTU_Match( void )\r
{\r
volatile unsigned char ucStatus;\r
\r
char *pcGetTaskStatusMessage( void )\r
{\r
- /* Not bothered about a critical section here. */\r
+ /* Not bothered about a critical section here. This just returns a string\r
+ that is displaed on the "Task Stats" WEB page served by this demo. */\r
return pcStatusMessage;\r
}\r
/*-----------------------------------------------------------*/\r