Switch to using the private watchdog as the run time stats timer in the Zynq demo.

pull/1/head
Richard Barry 11 years ago
parent 2f6cb8a86c
commit 7fa64efeeb

@ -159,14 +159,13 @@ readable ASCII form. See the notes in the implementation of vTaskList() within
FreeRTOS/Source/tasks.c for limitations. */
#define configUSE_STATS_FORMATTING_FUNCTIONS 1
/* portCONFIGURE_TIMER_FOR_RUN_TIME_STATS is not required because the time base
comes from the ulHighFrequencyTimerCounts variable which is incremented in a
high frequency timer that is already being started as part of the interrupt
nesting test. */
#define configGENERATE_RUN_TIME_STATS 1
extern volatile uint32_t ulHighFrequencyTimerCounts;
#define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS()
#define portGET_RUN_TIME_COUNTER_VALUE() ulHighFrequencyTimerCounts
/* The private watchdog is used to generate run time stats. */
#include "xscuwdt.h"
extern XScuWdt xWatchDogInstance;
extern void vInitialiseTimerForRunTimeStats( void );
#define configGENERATE_RUN_TIME_STATS 1
#define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS() vInitialiseTimerForRunTimeStats()
#define portGET_RUN_TIME_COUNTER_VALUE() ( 0xffffffffUL - XScuWdt_ReadReg( xWatchDogInstance.Config.BaseAddr, XSCUWDT_COUNTER_OFFSET ) )
/* The size of the global output buffer that is available for use when there
are multiple command interpreters running at once (for example, one on a UART
@ -205,11 +204,21 @@ Zynq MPU. */
/****** Network configuration settings. ***************************************/
/****** Network configuration settings - only used when the lwIP example is
built. See the page that documents this demo on the http://www.FreeRTOS.org
website for more information. ***********************************************/
/* The priority for the task that unblocked by the MAC interrupt to process
received packets. */
#define configMAC_INPUT_TASK_PRIORITY ( configMAX_PRIORITIES - 1 )
/* The priority of the task that runs the lwIP stack. */
#define configLWIP_TASK_PRIORITY ( configMAX_PRIORITIES - 2 )
/* The priority of the task that uses lwIP sockets to provide a simple command
line interface. */
#define configCLI_TASK_PRIORITY ( tskIDLE_PRIORITY )
/* MAC address configuration. */
#define configMAC_ADDR0 0x00
#define configMAC_ADDR1 0x13

@ -148,9 +148,9 @@ actually being reached. */
extern uint32_t ulPortInterruptNesting;
static uint32_t ulMaxRecordedNesting = 0;
/* For convenience the high frequency timer increments a variable that is then
used as the time base for the run time stats. */
volatile uint32_t ulHighFrequencyTimerCounts = 0;
/* Used to ensure the high frequency timer is running at the expected
frequency. */
static volatile uint32_t ulHighFrequencyTimerCounts = 0;
/*-----------------------------------------------------------*/
@ -238,8 +238,7 @@ BaseType_t xYieldRequired;
}
else
{
/* The high frequency timer is also used to generate the time base for
the run time state. */
/* Used to check the timer is running at the expected frequency. */
ulHighFrequencyTimerCounts++;
/* Latch the highest interrupt nesting count detected. */

@ -83,9 +83,13 @@ const char *pcWelcomeMessage = "FreeRTOS command server - connection accepted.\r
char cInChar;
static char cInputString[ cmdMAX_INPUT_SIZE ], cOutputString[ cmdMAX_OUTPUT_SIZE ];
portBASE_TYPE xReturned;
extern void vRegisterSampleCLICommands( void );
( void ) pvParameters;
/* Register the standard CLI commands. */
vRegisterSampleCLICommands();
lSocket = lwip_socket(AF_INET, SOCK_STREAM, 0);
if( lSocket >= 0 )

@ -165,12 +165,11 @@ static struct netif xNetIf;
use of the lwIP raw API. */
httpd_init();
sys_thread_new( "lwIP Input", xemacif_input_thread, &xNetIf, configMINIMAL_STACK_SIZE, configMAC_INPUT_TASK_PRIORITY );
sys_thread_new( "lwIP_In", xemacif_input_thread, &xNetIf, configMINIMAL_STACK_SIZE, configMAC_INPUT_TASK_PRIORITY );
/* Create the FreeRTOS defined basic command server. This demonstrates use
of the lwIP sockets API. */
#warning Commented out CLI
// xTaskCreate( vBasicSocketsCommandInterpreterTask, "CmdInt", configMINIMAL_STACK_SIZE * 10, NULL, configMAX_PRIORITIES - 2, NULL );
xTaskCreate( vBasicSocketsCommandInterpreterTask, "CmdInt", configMINIMAL_STACK_SIZE * 5, NULL, configCLI_TASK_PRIORITY, NULL );
}
/*-----------------------------------------------------------*/

@ -31,7 +31,7 @@ pq_create_queue()
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;
}

@ -156,4 +156,4 @@ static void prvLEDToggleTimer( TimerHandle_t pxTimer )
vParTestToggleLED( mainTIMER_LED );
}
/*-----------------------------------------------------------*/

@ -93,6 +93,7 @@
/* Standard includes. */
#include <stdio.h>
#include <limits.h>
/* Scheduler include files. */
#include "FreeRTOS.h"
@ -123,7 +124,7 @@
*
* When mainSELECTED_APPLICATION is set to 2 the lwIP example will be run.
*/
#define mainSELECTED_APPLICATION 0
#define mainSELECTED_APPLICATION 2
/*-----------------------------------------------------------*/
@ -161,6 +162,10 @@ void vApplicationIdleHook( void );
void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName );
void vApplicationTickHook( void );
/* The private watchdog is used as the timer that generates run time
stats. This frequency means it will overflow quite quickly. */
XScuWdt xWatchDogInstance;
/*-----------------------------------------------------------*/
/* The interrupt controller is initialised in this file, and made available to
@ -359,5 +364,25 @@ size_t x;
return ulBytes - x;
}
/*-----------------------------------------------------------*/
void vInitialiseTimerForRunTimeStats( void )
{
XScuWdt_Config *pxWatchDogInstance;
uint32_t ulValue;
const uint32_t ulMaxDivisor = 0xff, ulDivisorShift = 0x08;
pxWatchDogInstance = XScuWdt_LookupConfig( XPAR_SCUWDT_0_DEVICE_ID );
XScuWdt_CfgInitialize( &xWatchDogInstance, pxWatchDogInstance, pxWatchDogInstance->BaseAddr );
ulValue = XScuWdt_GetControlReg( &xWatchDogInstance );
ulValue |= ulMaxDivisor << ulDivisorShift;
XScuWdt_SetControlReg( &xWatchDogInstance, ulValue );
XScuWdt_LoadWdt( &xWatchDogInstance, UINT_MAX );
XScuWdt_SetTimerMode( &xWatchDogInstance );
XScuWdt_Start( &xWatchDogInstance );
}

Loading…
Cancel
Save