+/*\r
+ FreeRTOS V7.0.1 - Copyright (C) 2011 Real Time Engineers Ltd.\r
+ \r
+\r
+ ***************************************************************************\r
+ * *\r
+ * FreeRTOS tutorial books are available in pdf and paperback. *\r
+ * Complete, revised, and edited pdf reference manuals are also *\r
+ * available. *\r
+ * *\r
+ * Purchasing FreeRTOS documentation will not only help you, by *\r
+ * ensuring you get running as quickly as possible and with an *\r
+ * in-depth knowledge of how to use FreeRTOS, it will also help *\r
+ * the FreeRTOS project to continue with its mission of providing *\r
+ * professional grade, cross platform, de facto standard solutions *\r
+ * for microcontrollers - completely free of charge! *\r
+ * *\r
+ * >>> See http://www.FreeRTOS.org/Documentation for details. <<< *\r
+ * *\r
+ * Thank you for using FreeRTOS, and thank you for your support! *\r
+ * *\r
+ ***************************************************************************\r
+\r
+\r
+ This file is part of the FreeRTOS distribution.\r
+\r
+ FreeRTOS is free software; you can redistribute it and/or modify it under\r
+ the terms of the GNU General Public License (version 2) as published by the\r
+ Free Software Foundation AND MODIFIED BY the FreeRTOS exception.\r
+ >>>NOTE<<< The modification to the GPL is included to allow you to\r
+ distribute a combined work that includes FreeRTOS without being obliged to\r
+ provide the source code for proprietary components outside of the FreeRTOS\r
+ kernel. FreeRTOS is distributed in the hope that it will be useful, but\r
+ WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY\r
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for\r
+ more details. You should have received a copy of the GNU General Public\r
+ License and the FreeRTOS license exception along with FreeRTOS; if not it\r
+ can be viewed here: http://www.freertos.org/a00114.html and also obtained\r
+ by writing to Richard Barry, contact details for whom are available on the\r
+ FreeRTOS WEB site.\r
+\r
+ 1 tab == 4 spaces!\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
+/*-----------------------------------------------------------\r
+ * Simple parallel port IO routines.\r
+ *-----------------------------------------------------------*/\r
+\r
+/* Kernel includes. */\r
+#include "FreeRTOS.h"\r
+\r
+/* Demo application includes. */\r
+#include "partest.h"\r
+\r
+/* Library includes. */\r
+#include "xgpio.h"\r
+\r
+/*-----------------------------------------------------------*/\r
+\r
+static XGpio xOutputGPIOInstance;\r
+static const unsigned portBASE_TYPE uxGPIOOutputChannel = 1UL;\r
+static ucCurrentLEDState = 0U;\r
+\r
+/*\r
+ * Setup the IO for the LED outputs.\r
+ */\r
+void vParTestInitialise( void )\r
+{\r
+portBASE_TYPE xStatus;\r
+const unsigned char ucSetToOutput = 0U;\r
+\r
+ /* Initialize the GPIO. */\r
+ xStatus = XGpio_Initialize( &xOutputGPIOInstance, XPAR_LEDS_4BITS_DEVICE_ID ); \r
+ if( xStatus == XST_SUCCESS )\r
+ {\r
+ /* All LEDs on this channel are going to be outputs. */\r
+ XGpio_SetDataDirection( &xOutputGPIOInstance, uxGPIOOutputChannel, ucSetToOutput );\r
+ \r
+ /* Start with all LEDs off. */\r
+ ucCurrentLEDState = 0U;\r
+ XGpio_DiscreteWrite( &xOutputGPIOInstance, uxGPIOOutputChannel, ucCurrentLEDState );\r
+ }\r
+ \r
+ configASSERT( ( xStatus == XST_SUCCESS ) );\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+void vParTestSetLED( unsigned portBASE_TYPE uxLED, signed portBASE_TYPE xValue )\r
+{\r
+#if 0\r
+unsigned portBASE_TYPE uxBaseAddress, *puxCurrentValue;\r
+\r
+ portENTER_CRITICAL();\r
+ {\r
+ /* Which IO section does the LED being set/cleared belong to? The\r
+ 4 bit or 5 bit outputs? */\r
+ if( uxLED <= partstMAX_4BIT_LED )\r
+ {\r
+ uxBaseAddress = XPAR_LEDS_4BIT_BASEADDR;\r
+ puxCurrentValue = &uxCurrentOutput4Bit;\r
+ } \r
+ else\r
+ {\r
+ uxBaseAddress = XPAR_LEDS_POSITIONS_BASEADDR;\r
+ puxCurrentValue = &uxCurrentOutput5Bit;\r
+ uxLED -= partstMAX_4BIT_LED;\r
+ }\r
+\r
+ /* Setup the bit mask accordingly. */\r
+ uxLED = 0x01 << uxLED;\r
+\r
+ /* Maintain the current output value. */\r
+ if( xValue )\r
+ {\r
+ *puxCurrentValue |= uxLED;\r
+ }\r
+ else\r
+ {\r
+ *puxCurrentValue &= ~uxLED;\r
+ }\r
+\r
+ /* Write the value to the port. */\r
+ XGpio_mSetDataReg( uxBaseAddress, partstCHANNEL_1, *puxCurrentValue );\r
+ }\r
+ portEXIT_CRITICAL();\r
+#endif\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+void vParTestToggleLED( unsigned portBASE_TYPE uxLED )\r
+{\r
+#if 0\r
+unsigned portBASE_TYPE uxBaseAddress, *puxCurrentValue;\r
+\r
+ portENTER_CRITICAL();\r
+ {\r
+ /* Which IO section does the LED being toggled belong to? The\r
+ 4 bit or 5 bit outputs? */\r
+ if( uxLED <= partstMAX_4BIT_LED )\r
+ {\r
+ uxBaseAddress = XPAR_LEDS_4BIT_BASEADDR;\r
+ puxCurrentValue = &uxCurrentOutput4Bit;\r
+ } \r
+ else\r
+ {\r
+ uxBaseAddress = XPAR_LEDS_POSITIONS_BASEADDR;\r
+ puxCurrentValue = &uxCurrentOutput5Bit;\r
+ uxLED -= partstMAX_4BIT_LED;\r
+ }\r
+\r
+ /* Setup the bit mask accordingly. */\r
+ uxLED = 0x01 << uxLED;\r
+\r
+ /* Maintain the current output value. */\r
+ if( *puxCurrentValue & uxLED )\r
+ {\r
+ *puxCurrentValue &= ~uxLED;\r
+ }\r
+ else\r
+ {\r
+ *puxCurrentValue |= uxLED;\r
+ }\r
+\r
+ /* Write the value to the port. */\r
+ XGpio_mSetDataReg(uxBaseAddress, partstCHANNEL_1, *puxCurrentValue );\r
+ }\r
+ portEXIT_CRITICAL();\r
+#endif\r
+}\r
+\r
+\r
+\r