From 98488baced40fde672c2eb3fda65dc9431bcd47c Mon Sep 17 00:00:00 2001 From: richardbarry Date: Wed, 27 Apr 2011 15:11:42 +0000 Subject: [PATCH] Update the IO page served by the A2F web server to use the correct LED for the A2F-EVAL-KIT hardware. git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@1392 1d2547de-c912-0410-9cb9-b8ca96c0e9e2 --- .../mss_ethernet_mac/mss_ethernet_mac.c | 59 +- .../mss_ethernet_mac/mss_ethernet_mac.h | 2 +- Demo/CORTEX_A2F200_IAR_and_Keil/ParTest.c | 1 + .../RTOSDemo_IAR.ewd | 834 +++++++++++++++++ .../RTOSDemo_IAR.ewp | 870 ++++++++++++++++++ .../WebServer/httpd-cgi.c | 2 +- Demo/CORTEX_A2F200_IAR_and_Keil/main-full.c | 2 +- Demo/CORTEX_A2F200_IAR_and_Keil/uIP_Task.c | 93 +- 8 files changed, 1769 insertions(+), 94 deletions(-) diff --git a/Demo/CORTEX_A2F200_IAR_and_Keil/MicroSemi_Code/drivers/mss_ethernet_mac/mss_ethernet_mac.c b/Demo/CORTEX_A2F200_IAR_and_Keil/MicroSemi_Code/drivers/mss_ethernet_mac/mss_ethernet_mac.c index a13849249..891cb888c 100644 --- a/Demo/CORTEX_A2F200_IAR_and_Keil/MicroSemi_Code/drivers/mss_ethernet_mac/mss_ethernet_mac.c +++ b/Demo/CORTEX_A2F200_IAR_and_Keil/MicroSemi_Code/drivers/mss_ethernet_mac/mss_ethernet_mac.c @@ -10,8 +10,12 @@ ******************************************************************************/ /* - * NOTE: This driver has been roughly modified specifically for use with the - * uIP stack. It is no longer a generic driver. + * + * + * NOTE: This driver has been modified specifically for use with the* uIP stack. + * It is no longer a generic driver. + * + * */ #ifdef __cplusplus @@ -59,7 +63,7 @@ extern "C" { /* Allocating this many buffers will always ensure there is one free as, even though TX_RING_SIZE is set to two, the two Tx descriptors will only ever point to the same buffer. */ -#define macNUM_BUFFERS RX_RING_SIZE + TX_RING_SIZE + 2 +#define macNUM_BUFFERS RX_RING_SIZE + TX_RING_SIZE + 1 #define macBUFFER_SIZE 1488 /***************************************************************/ @@ -207,13 +211,14 @@ MSS_MAC_init /* Start general-purpose */ MAC->CSR11 = (MAC->CSR11 & ~CSR11_TIM_MASK) | (0x0000FFFFuL << CSR11_TIM_SHIFT); - /* Disable transmit interrupt mitigation. */ - MAC->CSR11 = ( MAC->CSR11 & ~CSR11_TT_MASK ); - MAC->CSR11 = ( MAC->CSR11 & ~CSR11_NTP_MASK ); - - /* Automatic Tx descriptor polling. */ - MAC->CSR0 = ( MAC->CSR0 & ~CSR0_TAP_MASK ); - MAC->CSR0 = ( MAC->CSR0 | ( 0x01 << CSR0_TAP_SHIFT ) ); + /* Ensure promiscous mode is off (it should be by default anyway). */ + MAC_BITBAND->CSR6_PR = 0; + + /* Perfect filter. */ + MAC_BITBAND->CSR6_HP = 1; + + /* Pass multcast. */ + MAC_BITBAND->CSR6_PM = 1; /* Set descriptors */ MAC->CSR3 = (uint32_t)&(g_mss_mac.rx_descriptors[0].descriptor_0); @@ -420,10 +425,6 @@ MSS_MAC_tx_packet if( ( ( (g_mss_mac.tx_descriptors[ 0 ].descriptor_0) & TDES0_OWN) == TDES0_OWN ) || ( ( (g_mss_mac.tx_descriptors[ 1 ].descriptor_0) & TDES0_OWN) == TDES0_OWN ) ) { error = MAC_BUFFER_IS_FULL; - - /* Check the buffers pointed to by the Tx descriptors, just in case a Tx - interrupt has been missed and a free buffer remains marked as in use. */ - MSS_MAC_CheckTxBufferStatus(); } @@ -1424,30 +1425,16 @@ static void MAC_memcpy(uint8_t *dest, const uint8_t *src, uint32_t n) } /***************************************************************************//** - * Check the buffers assigned to the Tx descriptors to ensure that none remain - * marked as in use even though the Tx has completed. This could happen if a - * Tx interrupt was missed. + * Tx has completed, mark the buffers that were assigned to the Tx descriptors + * as free again. * */ -void MSS_MAC_CheckTxBufferStatus( void ) +void MSS_MAC_FreeTxBuffers( void ) { -unsigned char *pxTransmittedBuffer; -long lDescriptor, lIndex; - - for( lDescriptor = 1; lDescriptor < TX_RING_SIZE; lDescriptor++ ) + if( ( ( (g_mss_mac.tx_descriptors[ 0 ].descriptor_0) & TDES0_OWN) == 0 ) && ( ( (g_mss_mac.tx_descriptors[ 1 ].descriptor_0) & TDES0_OWN) == 0 ) ) { - if( ( g_mss_mac.tx_descriptors[ lDescriptor ].descriptor_0 & TDES0_OWN ) == 0UL ) - { - pxTransmittedBuffer = ( unsigned char * ) g_mss_mac.tx_descriptors[ lDescriptor ].buffer_1; - - for( lIndex = 0; lIndex < macNUM_BUFFERS; lIndex++ ) - { - if( pxTransmittedBuffer == &( xMACBuffers.ucBuffer[ lIndex ][ 0 ] ) ) - { - ucMACBufferInUse[ lIndex ] = pdFALSE; - } - } - } + MAC_release_buffer( ( unsigned char * ) g_mss_mac.tx_descriptors[ 0 ].buffer_1 ); + MAC_release_buffer( ( unsigned char * ) g_mss_mac.tx_descriptors[ 1 ].buffer_1 ); } } @@ -1499,10 +1486,6 @@ long lIndex; } } - /* Check the buffers pointed to by the Tx descriptors, just in case a Tx - interrupt has been missed and a free buffer remains marked as in use. */ - MSS_MAC_CheckTxBufferStatus(); - configASSERT( lIndex < macNUM_BUFFERS ); } diff --git a/Demo/CORTEX_A2F200_IAR_and_Keil/MicroSemi_Code/drivers/mss_ethernet_mac/mss_ethernet_mac.h b/Demo/CORTEX_A2F200_IAR_and_Keil/MicroSemi_Code/drivers/mss_ethernet_mac/mss_ethernet_mac.h index 65ac8ee3c..9482bb762 100644 --- a/Demo/CORTEX_A2F200_IAR_and_Keil/MicroSemi_Code/drivers/mss_ethernet_mac/mss_ethernet_mac.h +++ b/Demo/CORTEX_A2F200_IAR_and_Keil/MicroSemi_Code/drivers/mss_ethernet_mac/mss_ethernet_mac.h @@ -564,7 +564,7 @@ MSS_MAC_get_statistics * The double Tx has completed. Hand back the Tx buffer to the control of * the MAC hardware. */ -void MSS_MAC_CheckTxBufferStatus( void ); +void MSS_MAC_FreeTxBuffers( void ); #ifdef __cplusplus } #endif diff --git a/Demo/CORTEX_A2F200_IAR_and_Keil/ParTest.c b/Demo/CORTEX_A2F200_IAR_and_Keil/ParTest.c index 4689074a0..c1af98967 100644 --- a/Demo/CORTEX_A2F200_IAR_and_Keil/ParTest.c +++ b/Demo/CORTEX_A2F200_IAR_and_Keil/ParTest.c @@ -172,6 +172,7 @@ long lReturn = pdFALSE; lReturn = pdTRUE; } } + taskEXIT_CRITICAL(); } return lReturn; diff --git a/Demo/CORTEX_A2F200_IAR_and_Keil/RTOSDemo_IAR.ewd b/Demo/CORTEX_A2F200_IAR_and_Keil/RTOSDemo_IAR.ewd index 2a764fcc4..e08d21176 100644 --- a/Demo/CORTEX_A2F200_IAR_and_Keil/RTOSDemo_IAR.ewd +++ b/Demo/CORTEX_A2F200_IAR_and_Keil/RTOSDemo_IAR.ewd @@ -1670,6 +1670,840 @@ + + Full-with-optimisation + + ARM + + 1 + + C-SPY + 2 + + 22 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ARMSIM_ID + 2 + + 1 + 1 + 1 + + + + + + + + ANGEL_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + + GDBSERVER_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + IARROM_ID + 2 + + 1 + 1 + 1 + + + + + + + + + JLINK_ID + 2 + + 12 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + LMIFTDI_ID + 2 + + 2 + 1 + 1 + + + + + + + + + + MACRAIGOR_ID + 2 + + 3 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + PEMICRO_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + + + + + + + RDI_ID + 2 + + 1 + 1 + 1 + + + + + + + + + + + + + + + + + STLINK_ID + 2 + + 1 + 1 + 1 + + + + + + + THIRDPARTY_ID + 2 + + 0 + 1 + 1 + + + + + + + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CmxArmPlugin.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyArmPlugin.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\MQX\MQXRtosPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\OpenRTOS\OpenRTOSPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\PowerPac\PowerPacRTOS.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\Quadros\Quadros_EWB6_Plugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\SafeRTOS\SafeRTOSPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-286-KA-CSpy.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin + 0 + + + $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\FreeRTOS\FreeRTOSPlugin.ewplugin + 0 + + + $EW_DIR$\common\plugins\OpenRTOS\OpenRTOSPlugin.ewplugin + 0 + + + $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin + 0 + + + $EW_DIR$\common\plugins\Stack\Stack.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\SymList\SymList.ENU.ewplugin + 1 + + + diff --git a/Demo/CORTEX_A2F200_IAR_and_Keil/RTOSDemo_IAR.ewp b/Demo/CORTEX_A2F200_IAR_and_Keil/RTOSDemo_IAR.ewp index a0e516dd6..d5dbf4de7 100644 --- a/Demo/CORTEX_A2F200_IAR_and_Keil/RTOSDemo_IAR.ewp +++ b/Demo/CORTEX_A2F200_IAR_and_Keil/RTOSDemo_IAR.ewp @@ -1732,6 +1732,875 @@ + + Full-with-optimisation + + ARM + + 1 + + General + 3 + + 18 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ICCARM + 2 + + 26 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AARM + 2 + + 8 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + OBJCOPY + 0 + + 1 + 1 + 1 + + + + + + + + + CUSTOM + 3 + + + + + + + BICOMP + 0 + + + + BUILDACTION + 1 + + + + + + + ILINK + 0 + + 11 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + IARCHIVE + 0 + + 0 + 1 + 1 + + + + + + + BILINK + 0 + + + Common_Demo_Source @@ -1889,6 +2758,7 @@ $PROJ_DIR$\main-blinky.c Full + Full-with-optimisation diff --git a/Demo/CORTEX_A2F200_IAR_and_Keil/WebServer/httpd-cgi.c b/Demo/CORTEX_A2F200_IAR_and_Keil/WebServer/httpd-cgi.c index 369236e41..38ea41fa2 100644 --- a/Demo/CORTEX_A2F200_IAR_and_Keil/WebServer/httpd-cgi.c +++ b/Demo/CORTEX_A2F200_IAR_and_Keil/WebServer/httpd-cgi.c @@ -212,7 +212,7 @@ static unsigned short generate_io_state( void *arg ) ( void ) arg; /* Are the dynamically setable LEDs currently on or off? */ - if( lParTestGetLEDState( 8 ) ) + if( lParTestGetLEDState( 3 ) ) { pcStatus = "checked"; } diff --git a/Demo/CORTEX_A2F200_IAR_and_Keil/main-full.c b/Demo/CORTEX_A2F200_IAR_and_Keil/main-full.c index 0dfeff1b6..cb7eb25ae 100644 --- a/Demo/CORTEX_A2F200_IAR_and_Keil/main-full.c +++ b/Demo/CORTEX_A2F200_IAR_and_Keil/main-full.c @@ -123,7 +123,7 @@ * is ever discovered. The check timer callback toggles the LED defined by * the mainCHECK_LED definition each time it executes. Therefore, if LED * mainCHECK_LED is toggling every three seconds, then no error have been found. - * If LED mainCHECK_LED is toggling every 500ms, then at least one error has + * If LED mainCHECK_LED is toggling every 500ms, then at least one errors has * been found. The task in which the error was discovered is displayed at the * bottom of the "task stats" page that is served by the embedded web server. * diff --git a/Demo/CORTEX_A2F200_IAR_and_Keil/uIP_Task.c b/Demo/CORTEX_A2F200_IAR_and_Keil/uIP_Task.c index 5f35cf532..3a6ea91e6 100644 --- a/Demo/CORTEX_A2F200_IAR_and_Keil/uIP_Task.c +++ b/Demo/CORTEX_A2F200_IAR_and_Keil/uIP_Task.c @@ -269,49 +269,6 @@ struct uip_eth_addr xAddr; } /*-----------------------------------------------------------*/ -void vApplicationProcessFormInput( char *pcInputString ) -{ -char *c; - - /* Only interested in processing form input if this is the IO page. */ - c = strstr( pcInputString, "io.shtml" ); - - if( c ) - { - /* Is there a command in the string? */ - c = strstr( pcInputString, "?" ); - if( c ) - { - /* Turn the LED's on or off in accordance with the check box status. */ - if( strstr( c, "LED0=1" ) != NULL ) - { - /* Turn the LEDs on. */ - vParTestSetLED( 7, 1 ); - vParTestSetLED( 8, 1 ); - vParTestSetLED( 9, 1 ); - vParTestSetLED( 10, 1 ); - } - else - { - /* Turn the LEDs off. */ - vParTestSetLED( 7, 0 ); - vParTestSetLED( 8, 0 ); - vParTestSetLED( 9, 0 ); - vParTestSetLED( 10, 0 ); - } - } - else - { - /* Commands to turn LEDs off are not always explicit. */ - vParTestSetLED( 7, 0 ); - vParTestSetLED( 8, 0 ); - vParTestSetLED( 9, 0 ); - vParTestSetLED( 10, 0 ); - } - } -} -/*-----------------------------------------------------------*/ - static void prvInitialise_uIP( void ) { uip_ipaddr_t xIPAddr; @@ -357,7 +314,7 @@ xTimerHandle xARPTimer, xPeriodicTimer; static void prvEMACEventListener( unsigned long ulISREvents ) { long lHigherPriorityTaskWoken = pdFALSE; -unsigned long ulUIPEvents = 0UL; +const unsigned long ulRxEvent = uipETHERNET_RX_EVENT; /* Sanity check that the event queue was indeed created. */ configASSERT( xEMACEventQueue ); @@ -365,20 +322,13 @@ unsigned long ulUIPEvents = 0UL; if( ( ulISREvents & MSS_MAC_EVENT_PACKET_SEND ) != 0UL ) { /* An Ethernet Tx event has occurred. */ - MSS_MAC_CheckTxBufferStatus(); + MSS_MAC_FreeTxBuffers(); } if( ( ulISREvents & MSS_MAC_EVENT_PACKET_RECEIVED ) != 0UL ) { /* An Ethernet Rx event has occurred. */ - ulUIPEvents |= uipETHERNET_RX_EVENT; - } - - if( ulUIPEvents != 0UL ) - { - /* Send any events that have occurred to the uIP stack (the uIP task in - this case). */ - xQueueSendFromISR( xEMACEventQueue, &ulUIPEvents, &lHigherPriorityTaskWoken ); + xQueueSendFromISR( xEMACEventQueue, &ulRxEvent, &lHigherPriorityTaskWoken ); } portEND_SWITCHING_ISR( lHigherPriorityTaskWoken ); @@ -447,3 +397,40 @@ static const unsigned long ulPeriodicTimerExpired = uipPERIODIC_TIMER_EVENT; } } /*-----------------------------------------------------------*/ + +void vApplicationProcessFormInput( char *pcInputString ) +{ +char *c; + + /* Only interested in processing form input if this is the IO page. */ + c = strstr( pcInputString, "io.shtml" ); + + if( c ) + { + /* Is there a command in the string? */ + c = strstr( pcInputString, "?" ); + if( c ) + { + /* Turn the LED's on or off in accordance with the check box status. */ + if( strstr( c, "LED0=1" ) != NULL ) + { + /* Turn the LEDs on. */ + vParTestSetLED( 3, 1 ); + vParTestSetLED( 4, 1 ); + } + else + { + /* Turn the LEDs off. */ + vParTestSetLED( 3, 0 ); + vParTestSetLED( 4, 0 ); + } + } + else + { + /* Commands to turn LEDs off are not always explicit. */ + vParTestSetLED( 3, 0 ); + vParTestSetLED( 4, 0 ); + } + } +} +/*-----------------------------------------------------------*/ -- 2.39.2