]> git.sur5r.net Git - freertos/commitdiff
git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@186 1d2547de-c912-0410...
authorrichardbarry <richardbarry@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Wed, 13 Feb 2008 13:53:24 +0000 (13:53 +0000)
committerrichardbarry <richardbarry@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Wed, 13 Feb 2008 13:53:24 +0000 (13:53 +0000)
Demo/MB91460_Softune/SRC/partest/partest.c

index 6ea629b9f8820de7fb1b8f50e5eb3963f7cf4056..852e3ff570f047548806e1ab6114bd373c0f8d11 100644 (file)
@@ -40,8 +40,6 @@
        ***************************************************************************\r
 */\r
 \r
-/* Hardware specific includes. */\r
-#include "mb91467d.h"\r
 \r
 /* Scheduler includes. */\r
 #include "FreeRTOS.h"\r
 \r
 #define partstNUM_LEDs 8\r
 \r
-static unsigned portSHORT sState[ partstNUM_LEDs ] = { pdFALSE };\r
+static unsigned portCHAR sState[ 2 ] = { 0xFF, 0xFF };\r
 \r
 /*-----------------------------------------------------------*/\r
 void vParTestInitialise( void )\r
 {\r
-       /* Set port for LED outputs. */\r
-       DDR16 = 0xFF;\r
-\r
-       /* Start with LEDs off. */\r
-       PDR25 = 0x00;\r
+       DDR00 = 0xFF;\r
+       PDR00 = 0xFF;\r
+       DDR09 = 0xFF;\r
+       PDR09 = 0xFF;\r
 }\r
 /*-----------------------------------------------------------*/\r
 \r
@@ -66,21 +63,40 @@ void vParTestToggleLED( unsigned portBASE_TYPE uxLED )
 {\r
        if( uxLED < partstNUM_LEDs )\r
        {\r
-               taskENTER_CRITICAL();\r
-               \r
+               vTaskSuspendAll();\r
+\r
                /* Toggle the state of the single genuine on board LED. */\r
-               if( sState[ uxLED ])    \r
+               if( ( sState[ 0 ] & ( ( unsigned portCHAR ) ( 1 << uxLED ) ) ) == 0 )\r
                {\r
-                       PDR25 |= ( 1 << uxLED );\r
+                       PDR09 |= ( 1 << uxLED );\r
+                       sState[ 0 ] |= ( 1 << uxLED );\r
                }\r
                else\r
                {\r
-                       PDR25 &= ~( 1 << uxLED );\r
+                       PDR09 &= ~( 1 << uxLED );\r
+                       sState[ 0 ] &= ~( 1 << uxLED );\r
                }\r
-       \r
-               sState[ uxLED ] = !( sState[ uxLED ] );\r
-               \r
-               taskEXIT_CRITICAL();\r
+\r
+               xTaskResumeAll();\r
+       }\r
+       else\r
+       {\r
+               vTaskSuspendAll();\r
+\r
+               uxLED -= partstNUM_LEDs;\r
+\r
+               if( ( sState[ 1 ] & ( ( unsigned portCHAR ) ( 1 << uxLED ) ) ) == 0 )\r
+               {\r
+                       PDR00 |= ( 1 << uxLED );\r
+                       sState[ 1 ] |= ( 1 << uxLED );\r
+               }\r
+               else\r
+               {\r
+                       PDR00 &= ~( 1 << uxLED );\r
+                       sState[ 1 ] &= ~( 1 << uxLED );\r
+               }\r
+\r
+               xTaskResumeAll();\r
        }\r
 }\r
 /*-----------------------------------------------------------*/\r
@@ -90,21 +106,39 @@ void vParTestSetLED( unsigned portBASE_TYPE uxLED, signed portBASE_TYPE xValue )
        /* Set or clear the output [in this case show or hide the '*' character. */\r
        if( uxLED < partstNUM_LEDs )\r
        {\r
-               taskENTER_CRITICAL();\r
+               vTaskSuspendAll();\r
                {\r
                        if( xValue )\r
                        {\r
-                               PDR25 |= ( 1 << uxLED );\r
-                               sState[ uxLED ] = 1;\r
+                               PDR09 &= ~( 1 << uxLED );\r
+                               sState[ 0 ] &= ~( 1 << uxLED );\r
                        }\r
                        else\r
                        {\r
-                               PDR25 &= ~( 1 << uxLED );\r
-                               sState[ uxLED ] = 0;\r
+                               PDR09 |= ( 1 << uxLED );\r
+                               sState[ 0 ] |= ( 1 << uxLED );\r
                        }\r
                }\r
-               taskEXIT_CRITICAL();\r
+\r
+               xTaskResumeAll();\r
+       }\r
+       else\r
+       {\r
+               vTaskSuspendAll();\r
+               {\r
+                       if( xValue )\r
+                       {\r
+                               PDR00 &= ~( 1 << uxLED );\r
+                               sState[ 1 ] &= ~( 1 << uxLED );\r
+                       }\r
+                       else\r
+                       {\r
+                               PDR00 |= ( 1 << uxLED );\r
+                               sState[ 1 ] |= ( 1 << uxLED );\r
+                       }\r
+               }\r
+\r
+               xTaskResumeAll();\r
        }\r
 }\r
-/*-----------------------------------------------------------*/\r
 \r