]> git.sur5r.net Git - freertos/commitdiff
git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@208 1d2547de-c912-0410...
authorrichardbarry <richardbarry@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Sun, 17 Feb 2008 20:06:24 +0000 (20:06 +0000)
committerrichardbarry <richardbarry@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Sun, 17 Feb 2008 20:06:24 +0000 (20:06 +0000)
Demo/MB91460_Softune/SRC/partest/partest.c [new file with mode: 0644]

diff --git a/Demo/MB91460_Softune/SRC/partest/partest.c b/Demo/MB91460_Softune/SRC/partest/partest.c
new file mode 100644 (file)
index 0000000..fbbb484
--- /dev/null
@@ -0,0 +1,153 @@
+/*\r
+       FreeRTOS.org V4.7.1 - Copyright (C) 2003-2008 Richard Barry.\r
+\r
+       This file is part of the FreeRTOS.org distribution.\r
+\r
+       FreeRTOS.org is free software; you can redistribute it and/or modify\r
+       it under the terms of the GNU General Public License as published by\r
+       the Free Software Foundation; either version 2 of the License, or\r
+       (at your option) any later version.\r
+\r
+       FreeRTOS.org is distributed in the hope that it will be useful,\r
+       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+       GNU General Public License for more details.\r
+\r
+       You should have received a copy of the GNU General Public License\r
+       along with FreeRTOS.org; if not, write to the Free Software\r
+       Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
+\r
+       A special exception to the GPL can be applied should you wish to distribute\r
+       a combined work that includes FreeRTOS.org, without being obliged to provide\r
+       the source code for any proprietary components.  See the licensing section\r
+       of http://www.FreeRTOS.org for full details of how and when the exception\r
+       can be applied.\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 +++\r
+       Documentation, latest information, license and contact details.  \r
+\r
+       +++ http://www.SafeRTOS.com +++\r
+       A version that is certified for use in safety critical systems.\r
+\r
+       +++ http://www.OpenRTOS.com +++\r
+       Commercial support, development, porting, licensing and training services.\r
+\r
+       ***************************************************************************\r
+*/\r
+\r
+\r
+/* Scheduler includes. */\r
+#include "FreeRTOS.h"\r
+#include "task.h"\r
+\r
+#define partstNUM_LEDs 8\r
+\r
+static unsigned portCHAR sState[ partstNUM_LEDs ] = { pdFALSE };\r
+static unsigned portCHAR sState1[ partstNUM_LEDs ] = { pdFALSE };\r
+\r
+\r
+/*-----------------------------------------------------------*/\r
+void vParTestInitialise( void )\r
+{\r
+       /* Set port for LED outputs. */\r
+       DDR16 = 0xFF;\r
+       DDR25 = 0xFF;\r
+\r
+       /* Start with LEDs off. */\r
+       PDR25 = 0x00;\r
+       PDR16 = 0x00;\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+void vParTestToggleLED( unsigned portBASE_TYPE uxLED )\r
+{\r
+       if( uxLED < partstNUM_LEDs )\r
+       {\r
+               taskENTER_CRITICAL();\r
+               {               \r
+                       /* Toggle the state of the single genuine on board LED. */\r
+                       if( sState[ uxLED ] )\r
+                       {\r
+                               PDR25 |= ( 1 << uxLED );\r
+                       }\r
+                       else\r
+                       {\r
+                               PDR25 &= ~( 1 << uxLED );\r
+                       }\r
+               \r
+                       sState[uxLED] = !( sState[ uxLED ] );\r
+               }               \r
+               taskEXIT_CRITICAL();\r
+       }\r
+       else\r
+       {\r
+               uxLED -= partstNUM_LEDs;\r
+\r
+               if( uxLED < partstNUM_LEDs )\r
+               {               \r
+                       taskENTER_CRITICAL();\r
+                       {               \r
+                               /* Toggle the state of the single genuine on board LED. */\r
+                               if( sState1[uxLED])     \r
+                               {\r
+                                       PDR16 |= ( 1 << uxLED );\r
+                               }\r
+                               else\r
+                               {\r
+                                       PDR16 &= ~( 1 << uxLED );\r
+                               }\r
+                       \r
+                               sState1[ uxLED ] = !( sState1[ uxLED ] );\r
+                       }\r
+                       taskEXIT_CRITICAL();\r
+               }\r
+       }\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+void vParTestSetLED( unsigned portBASE_TYPE uxLED, signed portBASE_TYPE xValue )\r
+{\r
+       /* Set or clear the output [in this case show or hide the '*' character. */\r
+       if( uxLED < partstNUM_LEDs )\r
+       {\r
+               taskENTER_CRITICAL();\r
+               {\r
+                       if( xValue )\r
+                       {\r
+                               PDR25 |= ( 1 << uxLED );\r
+                               sState[ uxLED ] = 1;\r
+                       }\r
+                       else\r
+                       {\r
+                               PDR25 &= ~( 1 << uxLED );\r
+                               sState[ uxLED ] = 0;\r
+                       }\r
+               }\r
+               taskEXIT_CRITICAL();\r
+       }\r
+       else \r
+       {\r
+               uxLED -= partstNUM_LEDs;\r
+\r
+               taskENTER_CRITICAL();\r
+               {\r
+                       if( xValue )\r
+                       {\r
+                               PDR16 |= ( 1 << uxLED );\r
+                               sState1[ uxLED ] = 1;\r
+                       }\r
+                       else\r
+                       {\r
+                               PDR16 &= ~( 1 << uxLED );\r
+                               sState1[ uxLED ] = 0;\r
+                       }\r
+               }\r
+               taskEXIT_CRITICAL();\r
+       }\r
+}\r
+\r