]> git.sur5r.net Git - freertos/blobdiff - Demo/ARM7_STR75x_IAR/ParTest/ParTest.c
Ready for V5.1.1 release.
[freertos] / Demo / ARM7_STR75x_IAR / ParTest / ParTest.c
index eaf16a1e7d59ce43c844a68b07b3f07c0c3ac48e..8aa38e3ddfa2e3d0b57b41e569e485c5e0ddae67 100644 (file)
@@ -1,5 +1,5 @@
 /*\r
-       FreeRTOS.org V4.1.2 - Copyright (C) 2003-2006 Richard Barry.\r
+       FreeRTOS.org V5.1.1 - Copyright (C) 2003-2008 Richard Barry.\r
 \r
        This file is part of the FreeRTOS.org distribution.\r
 \r
        of http://www.FreeRTOS.org for full details of how and when the exception\r
        can be applied.\r
 \r
-       ***************************************************************************\r
-       See http://www.FreeRTOS.org for documentation, latest information, license\r
-       and contact details.  Please ensure to read the configuration and relevant\r
-       port sections of the online documentation.\r
-       ***************************************************************************\r
+    ***************************************************************************\r
+    ***************************************************************************\r
+    *                                                                         *\r
+    * SAVE TIME AND MONEY!  We can port FreeRTOS.org to your own hardware,    *\r
+    * and even write all or part of your application on your behalf.          *\r
+    * See http://www.OpenRTOS.com for details of the services we provide to   *\r
+    * expedite your project.                                                  *\r
+    *                                                                         *\r
+    ***************************************************************************\r
+    ***************************************************************************\r
+\r
+       Please ensure to read the configuration and relevant port sections of the\r
+       online documentation.\r
+\r
+       http://www.FreeRTOS.org - Documentation, latest information, license and \r
+       contact details.\r
+\r
+       http://www.SafeRTOS.com - A version that is certified for use in safety \r
+       critical systems.\r
+\r
+       http://www.OpenRTOS.com - Commercial support, development, porting, \r
+       licensing and training services.\r
 */\r
 \r
 /* Library includes. */\r
 #include "partest.h"\r
 \r
 /*-----------------------------------------------------------\r
- * Simple parallel port IO routines for the LED's - which are\r
- * connected to the second nibble of GPIO port 1.\r
+ * Simple parallel port IO routines for the LED's \r
  *-----------------------------------------------------------*/\r
 \r
-#define partstLED_3            0x0080\r
-#define partstLED_2            0x0040\r
-#define partstLED_1            0x0020\r
-#define partstLED_0            0x0010\r
-#define partstON_BOARD 0x0100  /* The LED built onto the KickStart board. */\r
-\r
-#define partstALL_LEDs ( partstLED_0 | partstLED_1 | partstLED_2 | partstLED_3 | partstON_BOARD )\r
-\r
-#define partstFIRST_LED_BIT 4\r
-\r
-/* This demo application uses files that are common to all port demo\r
-applications.  These files assume 6 LED's are available, whereas I have\r
-only 5 (including the LED built onto the development board).  To prevent\r
-two tasks trying to use the same LED a bit of remapping is performed.\r
-The ComTest tasks will try and use LED's 6 and 7.  LED 6 is ignored and\r
-has no effect, LED 7 is mapped to LED3.   The LED usage is described in\r
-the port documentation available from the FreeRTOS.org WEB site. */\r
-#define partstCOM_TEST_LED     7\r
-#define partstRX_CHAR_LED      3\r
-\r
 #define partstNUM_LEDS 4\r
 \r
 typedef struct GPIOMAP\r
@@ -79,26 +75,29 @@ static GPIO_MAP xLEDMap[ partstNUM_LEDS ] =
        { ( GPIO_TypeDef        * )GPIO1_BASE, GPIO_Pin_1, 0UL },\r
        { ( GPIO_TypeDef        * )GPIO0_BASE, GPIO_Pin_16, 0UL },\r
        { ( GPIO_TypeDef        * )GPIO2_BASE, GPIO_Pin_18, 0UL },      \r
-       { ( GPIO_TypeDef        * )GPIO2_BASE, GPIO_Pin_19, 0UL }\r
-       \r
+       { ( GPIO_TypeDef        * )GPIO2_BASE, GPIO_Pin_19, 0UL }       \r
 };\r
 \r
 /*-----------------------------------------------------------*/\r
-GPIO_InitTypeDef    GPIO_InitStructure ;\r
 \r
 void vParTestInitialise( void )\r
 {      \r
+GPIO_InitTypeDef GPIO_InitStructure ;\r
+\r
     /* Configure the bits used to flash LED's on port 1 as output. */\r
-  /* Configure LED3 */\r
-  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;\r
-  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_16;\r
-  GPIO_Init(GPIO0,&GPIO_InitStructure);\r
-  /* Configure LED2 */\r
-  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_1;\r
-  GPIO_Init(GPIO1, &GPIO_InitStructure);\r
-  /* Configure LED4 and LED5 */\r
-  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_18 | GPIO_Pin_19;\r
-  GPIO_Init(GPIO2, &GPIO_InitStructure);\r
+\r
+       /* Configure LED3 */\r
+       GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;\r
+       GPIO_InitStructure.GPIO_Pin = GPIO_Pin_16;\r
+       GPIO_Init(GPIO0,&GPIO_InitStructure);\r
+\r
+       /* Configure LED2 */\r
+       GPIO_InitStructure.GPIO_Pin = GPIO_Pin_1;\r
+       GPIO_Init(GPIO1, &GPIO_InitStructure);\r
+\r
+       /* Configure LED4 and LED5 */\r
+       GPIO_InitStructure.GPIO_Pin = GPIO_Pin_18 | GPIO_Pin_19;\r
+       GPIO_Init(GPIO2, &GPIO_InitStructure);\r
 \r
        vParTestSetLED( 0, 0 );\r
        vParTestSetLED( 1, 0 );\r
@@ -111,16 +110,20 @@ void vParTestSetLED( unsigned portBASE_TYPE uxLED, signed portBASE_TYPE xValue )
 {\r
        if( uxLED < partstNUM_LEDS )\r
        {\r
-               if( xValue )\r
+               portENTER_CRITICAL();\r
                {\r
-                       GPIO_WriteBit( xLEDMap[ uxLED ].pxPort, xLEDMap[ uxLED ].ulPin, Bit_RESET );\r
-                       xLEDMap[ uxLED ].ulValue = 0;\r
-               }\r
-               else\r
-               {\r
-                       GPIO_WriteBit( xLEDMap[ uxLED ].pxPort, xLEDMap[ uxLED ].ulPin, Bit_SET );\r
-                       xLEDMap[ uxLED ].ulValue = 1;                   \r
+                       if( xValue )\r
+                       {\r
+                               GPIO_WriteBit( xLEDMap[ uxLED ].pxPort, xLEDMap[ uxLED ].ulPin, Bit_RESET );\r
+                               xLEDMap[ uxLED ].ulValue = 0;\r
+                       }\r
+                       else\r
+                       {\r
+                               GPIO_WriteBit( xLEDMap[ uxLED ].pxPort, xLEDMap[ uxLED ].ulPin, Bit_SET );\r
+                               xLEDMap[ uxLED ].ulValue = 1;                   \r
+                       }\r
                }\r
+               portEXIT_CRITICAL();\r
        }\r
 }\r
 /*-----------------------------------------------------------*/\r
@@ -129,16 +132,20 @@ void vParTestToggleLED( unsigned portBASE_TYPE uxLED )
 {\r
        if( uxLED < partstNUM_LEDS )\r
        {\r
-               if( xLEDMap[ uxLED ].ulValue == 1 )\r
-               {\r
-                       GPIO_WriteBit( xLEDMap[ uxLED ].pxPort, xLEDMap[ uxLED ].ulPin, Bit_RESET );\r
-                       xLEDMap[ uxLED ].ulValue = 0;\r
-               }\r
-               else\r
+               portENTER_CRITICAL();\r
                {\r
-                       GPIO_WriteBit( xLEDMap[ uxLED ].pxPort, xLEDMap[ uxLED ].ulPin, Bit_SET );\r
-                       xLEDMap[ uxLED ].ulValue = 1;                   \r
+                       if( xLEDMap[ uxLED ].ulValue == 1 )\r
+                       {\r
+                               GPIO_WriteBit( xLEDMap[ uxLED ].pxPort, xLEDMap[ uxLED ].ulPin, Bit_RESET );\r
+                               xLEDMap[ uxLED ].ulValue = 0;\r
+                       }\r
+                       else\r
+                       {\r
+                               GPIO_WriteBit( xLEDMap[ uxLED ].pxPort, xLEDMap[ uxLED ].ulPin, Bit_SET );\r
+                               xLEDMap[ uxLED ].ulValue = 1;                   \r
+                       }\r
                }\r
+               portEXIT_CRITICAL();\r
        }\r
 }\r
 \r