FreeRTOS/Source/tasks.c for limitations. */\r
#define configUSE_STATS_FORMATTING_FUNCTIONS 1\r
\r
-/* portCONFIGURE_TIMER_FOR_RUN_TIME_STATS is not required because the time base\r
-comes from the ulHighFrequencyTimerCounts variable which is incremented in a\r
-high frequency timer that is already being started as part of the interrupt\r
-nesting test. */\r
-#define configGENERATE_RUN_TIME_STATS 1\r
-extern volatile uint32_t ulHighFrequencyTimerCounts;\r
-#define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS()\r
-#define portGET_RUN_TIME_COUNTER_VALUE() ulHighFrequencyTimerCounts\r
+/* The private watchdog is used to generate run time stats. */\r
+#include "xscuwdt.h"\r
+extern XScuWdt xWatchDogInstance;\r
+extern void vInitialiseTimerForRunTimeStats( void );\r
+#define configGENERATE_RUN_TIME_STATS 1\r
+#define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS() vInitialiseTimerForRunTimeStats()\r
+#define portGET_RUN_TIME_COUNTER_VALUE() ( 0xffffffffUL - XScuWdt_ReadReg( xWatchDogInstance.Config.BaseAddr, XSCUWDT_COUNTER_OFFSET ) )\r
\r
/* The size of the global output buffer that is available for use when there\r
are multiple command interpreters running at once (for example, one on a UART\r
\r
\r
\r
-/****** Network configuration settings. ***************************************/\r
+/****** Network configuration settings - only used when the lwIP example is\r
+built. See the page that documents this demo on the http://www.FreeRTOS.org\r
+website for more information. ***********************************************/\r
\r
+/* The priority for the task that unblocked by the MAC interrupt to process\r
+received packets. */\r
#define configMAC_INPUT_TASK_PRIORITY ( configMAX_PRIORITIES - 1 )\r
+\r
+/* The priority of the task that runs the lwIP stack. */\r
#define configLWIP_TASK_PRIORITY ( configMAX_PRIORITIES - 2 )\r
\r
+/* The priority of the task that uses lwIP sockets to provide a simple command\r
+line interface. */\r
+#define configCLI_TASK_PRIORITY ( tskIDLE_PRIORITY )\r
+\r
/* MAC address configuration. */\r
#define configMAC_ADDR0 0x00\r
#define configMAC_ADDR1 0x13\r
extern uint32_t ulPortInterruptNesting;\r
static uint32_t ulMaxRecordedNesting = 0;\r
\r
-/* For convenience the high frequency timer increments a variable that is then\r
-used as the time base for the run time stats. */\r
-volatile uint32_t ulHighFrequencyTimerCounts = 0;\r
+/* Used to ensure the high frequency timer is running at the expected\r
+frequency. */\r
+static volatile uint32_t ulHighFrequencyTimerCounts = 0;\r
\r
/*-----------------------------------------------------------*/\r
\r
}\r
else\r
{\r
- /* The high frequency timer is also used to generate the time base for\r
- the run time state. */\r
+ /* Used to check the timer is running at the expected frequency. */\r
ulHighFrequencyTimerCounts++;\r
\r
/* Latch the highest interrupt nesting count detected. */\r
char cInChar;\r
static char cInputString[ cmdMAX_INPUT_SIZE ], cOutputString[ cmdMAX_OUTPUT_SIZE ];\r
portBASE_TYPE xReturned;\r
+extern void vRegisterSampleCLICommands( void );\r
\r
( void ) pvParameters;\r
\r
+ /* Register the standard CLI commands. */\r
+ vRegisterSampleCLICommands();\r
+\r
lSocket = lwip_socket(AF_INET, SOCK_STREAM, 0);\r
\r
if( lSocket >= 0 )\r
use of the lwIP raw API. */\r
httpd_init();\r
\r
- sys_thread_new( "lwIP Input", xemacif_input_thread, &xNetIf, configMINIMAL_STACK_SIZE, configMAC_INPUT_TASK_PRIORITY );\r
+ sys_thread_new( "lwIP_In", xemacif_input_thread, &xNetIf, configMINIMAL_STACK_SIZE, configMAC_INPUT_TASK_PRIORITY );\r
\r
/* Create the FreeRTOS defined basic command server. This demonstrates use\r
of the lwIP sockets API. */\r
-#warning Commented out CLI\r
-// xTaskCreate( vBasicSocketsCommandInterpreterTask, "CmdInt", configMINIMAL_STACK_SIZE * 10, NULL, configMAX_PRIORITIES - 2, NULL );\r
+ xTaskCreate( vBasicSocketsCommandInterpreterTask, "CmdInt", configMINIMAL_STACK_SIZE * 5, NULL, configCLI_TASK_PRIORITY, NULL );\r
}\r
/*-----------------------------------------------------------*/\r
\r
pq_queue_t *q = NULL;
if (i >= NUM_QUEUES) {
- xil_printf("ERR: Max Queues allocated\n\r");
+ //xil_printf("ERR: Max Queues allocated\n\r");
return q;
}
vParTestToggleLED( mainTIMER_LED );\r
}\r
\r
-\r
+/*-----------------------------------------------------------*/\r
\r
/* Standard includes. */\r
#include <stdio.h>\r
+#include <limits.h>\r
\r
/* Scheduler include files. */\r
#include "FreeRTOS.h"\r
*\r
* When mainSELECTED_APPLICATION is set to 2 the lwIP example will be run.\r
*/\r
-#define mainSELECTED_APPLICATION 0\r
+#define mainSELECTED_APPLICATION 2\r
\r
/*-----------------------------------------------------------*/\r
\r
void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName );\r
void vApplicationTickHook( void );\r
\r
+/* The private watchdog is used as the timer that generates run time\r
+stats. This frequency means it will overflow quite quickly. */\r
+XScuWdt xWatchDogInstance;\r
+\r
/*-----------------------------------------------------------*/\r
\r
/* The interrupt controller is initialised in this file, and made available to\r
\r
return ulBytes - x;\r
}\r
+/*-----------------------------------------------------------*/\r
+\r
+void vInitialiseTimerForRunTimeStats( void )\r
+{\r
+XScuWdt_Config *pxWatchDogInstance;\r
+uint32_t ulValue;\r
+const uint32_t ulMaxDivisor = 0xff, ulDivisorShift = 0x08;\r
+\r
+ pxWatchDogInstance = XScuWdt_LookupConfig( XPAR_SCUWDT_0_DEVICE_ID );\r
+ XScuWdt_CfgInitialize( &xWatchDogInstance, pxWatchDogInstance, pxWatchDogInstance->BaseAddr );\r
+\r
+ ulValue = XScuWdt_GetControlReg( &xWatchDogInstance );\r
+ ulValue |= ulMaxDivisor << ulDivisorShift;\r
+ XScuWdt_SetControlReg( &xWatchDogInstance, ulValue );\r
+\r
+ XScuWdt_LoadWdt( &xWatchDogInstance, UINT_MAX );\r
+ XScuWdt_SetTimerMode( &xWatchDogInstance );\r
+ XScuWdt_Start( &xWatchDogInstance );\r
+}\r
+\r
\r
\r