Get web server and run time stats working in the Kinetis K60 demo.

This commit is contained in:
Richard Barry 2011-07-10 21:10:11 +00:00
parent 326b6a2c95
commit dcb8df1fce
10 changed files with 147 additions and 185 deletions

View file

@ -529,6 +529,9 @@ unsigned long usReturn = 0;
void vEMAC_TxISRHandler( void )
{
/* Clear the interrupt. */
ENET_EIR = ENET_EIR_TXF_MASK;
/* Check the buffers have not already been freed in the first of the
two Tx interrupts - which could potentially happen if the second Tx completed
during the interrupt for the first Tx. */
@ -554,6 +557,9 @@ const unsigned long ulRxEvent = uipETHERNET_RX_EVENT;
long lHigherPriorityTaskWoken = pdFALSE;
extern xQueueHandle xEMACEventQueue;
/* Clear the interrupt. */
ENET_EIR = ENET_EIR_RXF_MASK;
/* An Ethernet Rx event has occurred. */
xQueueSendFromISR( xEMACEventQueue, &ulRxEvent, &lHigherPriorityTaskWoken );
portEND_SWITCHING_ISR( lHigherPriorityTaskWoken );
@ -562,59 +568,13 @@ extern xQueueHandle xEMACEventQueue;
void vEMAC_ErrorISRHandler( void )
{
portDISABLE_INTERRUPTS();
for( ;; );
/* Clear the interrupt. */
ENET_EIR = ENET_EIR & ENET_EIMR;
/* Attempt recovery. Not very sophisticated. */
prvInitialiseDescriptors();
ENET_RDAR = ENET_RDAR_RDAR_MASK;
}
/*-----------------------------------------------------------*/
volatile unsigned long ulEvent, ulMask;
void vEMAC_ISRHandler( void )
{
//unsigned long ulEvent;
long lHigherPriorityTaskWoken = pdFALSE;
const unsigned long ulRxEvent = uipETHERNET_RX_EVENT;
extern xQueueHandle xEMACEventQueue;
/* What caused the interrupt? */
ulMask = ENET_EIMR;
ulEvent = ENET_EIR;
ulEvent &= ulMask;
ENET_EIR = ulEvent;
if( ( ulEvent & ENET_EIR_TXF_MASK ) != 0UL )
{
/* Transmit complete.
Check the buffers have not already been freed in the first of the
two Tx interrupts - which could potentially happen if the second Tx completed
during the interrupt for the first Tx. */
if( xTxDescriptors[ 0 ].data != NULL )
{
if( ( ( xTxDescriptors[ 0 ].status & TX_BD_R ) == 0 ) && ( ( xTxDescriptors[ 0 ].status & TX_BD_R ) == 0 ) )
{
configASSERT( xTxDescriptors[ 0 ].data == xTxDescriptors[ 1 ].data );
xTxDescriptors[ 0 ].data = ( uint8_t* ) __REV( ( unsigned long ) xTxDescriptors[ 0 ].data );
prvReturnBuffer( xTxDescriptors[ 0 ].data );
/* Just to mark the fact that the buffer has already been released. */
xTxDescriptors[ 0 ].data = NULL;
}
}
}
if( ( ulEvent & ENET_EIR_RXF_MASK ) != 0UL )
{
/* Packet Rxed. */
xQueueSendFromISR( xEMACEventQueue, &ulRxEvent, &lHigherPriorityTaskWoken );
portEND_SWITCHING_ISR( lHigherPriorityTaskWoken );
}
if( ulEvent & ( ENET_EIR_UN_MASK | ENET_EIR_RL_MASK | ENET_EIR_LC_MASK | ENET_EIR_EBERR_MASK | ENET_EIR_BABT_MASK | ENET_EIR_BABR_MASK | ENET_EIR_EBERR_MASK ) )
{
/* Error. */
prvInitialiseDescriptors();
ENET_RDAR = ENET_RDAR_RDAR_MASK;
}
}

View file

@ -210,9 +210,10 @@ static unsigned short generate_io_state( void *arg )
{
extern long lParTestGetLEDState( unsigned long ulLED );
( void ) arg;
const unsigned long ulYellowLED = 2UL;
/* Are the dynamically setable LEDs currently on or off? */
if( lParTestGetLEDState( 8 ) )
if( lParTestGetLEDState( ulYellowLED ) == pdTRUE )
{
pcStatus = "checked";
}
@ -228,27 +229,12 @@ static unsigned short generate_io_state( void *arg )
/*---------------------------------------------------------------------------*/
extern void vTaskGetRunTimeStats( signed char *pcWriteBuffer );
extern unsigned short usMaxJitter;
static char cJitterBuffer[ 200 ];
static unsigned short generate_runtime_stats( void *arg )
{
( void ) arg;
lRefreshCount++;
sprintf( cCountBuf, "<p><br>Refresh count = %d", ( int ) lRefreshCount );
#ifdef INCLUDE_HIGH_FREQUENCY_TIMER_TEST
{
sprintf( cJitterBuffer, "<p><br>Max high frequency timer jitter = %d peripheral clock periods.<p><br>", ( int ) usMaxJitter );
vTaskGetRunTimeStats( uip_appdata );
strcat( uip_appdata, cJitterBuffer );
}
#else
{
( void ) cJitterBuffer;
strcpy( uip_appdata, "<p>Run time stats are only available in the debug_with_optimisation build configuration.<p>" );
}
#endif
vTaskGetRunTimeStats( uip_appdata );
strcat( uip_appdata, cCountBuf );
return strlen( uip_appdata );

View file

@ -12,7 +12,8 @@
<p>
Use the check box to turn on or off LED 4, then click "Update IO".
The check box and "Update IO" button can also be used to turn the yellow LED on and off.
<p>

View file

@ -220,31 +220,33 @@ static const char data_io_shtml[] = {
0x3e, 0xd, 0xa, 0x3c, 0x62, 0x3e, 0x4c, 0x45, 0x44, 0x20,
0x61, 0x6e, 0x64, 0x20, 0x4c, 0x43, 0x44, 0x20, 0x49, 0x4f,
0x3c, 0x2f, 0x62, 0x3e, 0x3c, 0x62, 0x72, 0x3e, 0xd, 0xa,
0xd, 0xa, 0x3c, 0x70, 0x3e, 0xd, 0xa, 0xd, 0xa, 0x55,
0x73, 0x65, 0x20, 0x74, 0x68, 0x65, 0x20, 0x63, 0x68, 0x65,
0x63, 0x6b, 0x20, 0x62, 0x6f, 0x78, 0x20, 0x74, 0x6f, 0x20,
0x74, 0x75, 0x72, 0x6e, 0x20, 0x6f, 0x6e, 0x20, 0x6f, 0x72,
0x20, 0x6f, 0x66, 0x66, 0x20, 0x4c, 0x45, 0x44, 0x20, 0x34,
0x2c, 0x20, 0x74, 0x68, 0x65, 0x6e, 0x20, 0x63, 0x6c, 0x69,
0x63, 0x6b, 0x20, 0x22, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65,
0x20, 0x49, 0x4f, 0x22, 0x2e, 0xd, 0xa, 0xd, 0xa, 0xd,
0xa, 0x3c, 0x70, 0x3e, 0xd, 0xa, 0x3c, 0x66, 0x6f, 0x72,
0x6d, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22, 0x61, 0x46,
0x6f, 0x72, 0x6d, 0x22, 0x20, 0x61, 0x63, 0x74, 0x69, 0x6f,
0x6e, 0x3d, 0x22, 0x2f, 0x69, 0x6f, 0x2e, 0x73, 0x68, 0x74,
0x6d, 0x6c, 0x22, 0x20, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64,
0x3d, 0x22, 0x67, 0x65, 0x74, 0x22, 0x3e, 0xd, 0xa, 0x25,
0x21, 0x20, 0x6c, 0x65, 0x64, 0x2d, 0x69, 0x6f, 0xd, 0xa,
0x3c, 0x70, 0x3e, 0xd, 0xa, 0x3c, 0x69, 0x6e, 0x70, 0x75,
0x74, 0x20, 0x74, 0x79, 0x70, 0x65, 0x3d, 0x22, 0x73, 0x75,
0x62, 0x6d, 0x69, 0x74, 0x22, 0x20, 0x76, 0x61, 0x6c, 0x75,
0x65, 0x3d, 0x22, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x20,
0x49, 0x4f, 0x22, 0x3e, 0xd, 0xa, 0x3c, 0x2f, 0x66, 0x6f,
0x72, 0x6d, 0x3e, 0xd, 0xa, 0x3c, 0x62, 0x72, 0x3e, 0x3c,
0x70, 0x3e, 0xd, 0xa, 0x3c, 0x2f, 0x66, 0x6f, 0x6e, 0x74,
0x3e, 0xd, 0xa, 0x3c, 0x2f, 0x62, 0x6f, 0x64, 0x79, 0x3e,
0xd, 0xa, 0x3c, 0x2f, 0x68, 0x74, 0x6d, 0x6c, 0x3e, 0xd,
0xa, 0xd, 0xa, 0};
0xd, 0xa, 0x3c, 0x70, 0x3e, 0xd, 0xa, 0xd, 0xa, 0x54,
0x68, 0x65, 0x20, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x20, 0x62,
0x6f, 0x78, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x22, 0x55, 0x70,
0x64, 0x61, 0x74, 0x65, 0x20, 0x49, 0x4f, 0x22, 0x20, 0x62,
0x75, 0x74, 0x74, 0x6f, 0x6e, 0x20, 0x63, 0x61, 0x6e, 0x20,
0x61, 0x6c, 0x73, 0x6f, 0x20, 0x62, 0x65, 0x20, 0x75, 0x73,
0x65, 0x64, 0x20, 0x74, 0x6f, 0x20, 0x74, 0x75, 0x72, 0x6e,
0x20, 0x74, 0x68, 0x65, 0x20, 0x79, 0x65, 0x6c, 0x6c, 0x6f,
0x77, 0x20, 0x4c, 0x45, 0x44, 0x20, 0x6f, 0x6e, 0x20, 0x61,
0x6e, 0x64, 0x20, 0x6f, 0x66, 0x66, 0x2e, 0xd, 0xa, 0xd,
0xa, 0xd, 0xa, 0xd, 0xa, 0x3c, 0x70, 0x3e, 0xd, 0xa,
0x3c, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x6e, 0x61, 0x6d, 0x65,
0x3d, 0x22, 0x61, 0x46, 0x6f, 0x72, 0x6d, 0x22, 0x20, 0x61,
0x63, 0x74, 0x69, 0x6f, 0x6e, 0x3d, 0x22, 0x2f, 0x69, 0x6f,
0x2e, 0x73, 0x68, 0x74, 0x6d, 0x6c, 0x22, 0x20, 0x6d, 0x65,
0x74, 0x68, 0x6f, 0x64, 0x3d, 0x22, 0x67, 0x65, 0x74, 0x22,
0x3e, 0xd, 0xa, 0x25, 0x21, 0x20, 0x6c, 0x65, 0x64, 0x2d,
0x69, 0x6f, 0xd, 0xa, 0x3c, 0x70, 0x3e, 0xd, 0xa, 0x3c,
0x69, 0x6e, 0x70, 0x75, 0x74, 0x20, 0x74, 0x79, 0x70, 0x65,
0x3d, 0x22, 0x73, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x22, 0x20,
0x76, 0x61, 0x6c, 0x75, 0x65, 0x3d, 0x22, 0x55, 0x70, 0x64,
0x61, 0x74, 0x65, 0x20, 0x49, 0x4f, 0x22, 0x3e, 0xd, 0xa,
0x3c, 0x2f, 0x66, 0x6f, 0x72, 0x6d, 0x3e, 0xd, 0xa, 0x3c,
0x62, 0x72, 0x3e, 0x3c, 0x70, 0x3e, 0xd, 0xa, 0x3c, 0x2f,
0x66, 0x6f, 0x6e, 0x74, 0x3e, 0xd, 0xa, 0x3c, 0x2f, 0x62,
0x6f, 0x64, 0x79, 0x3e, 0xd, 0xa, 0x3c, 0x2f, 0x68, 0x74,
0x6d, 0x6c, 0x3e, 0xd, 0xa, 0xd, 0xa, 0};
static const char data_logo_jpg[] = {
/* /logo.jpg */