copy ..\..\..\..\Source\portable\MemMang\heap_2.c FreeRTOS_Source\portable\MemMang\r
\r
REM Copy the files that define the common demo tasks.\r
- copy ..\Common\minimal\dynamic.c Demo_Source\Common_Demo_Files\r
- copy ..\Common\minimal\comtest.c Demo_Source\Common_Demo_Files\r
- copy ..\Common\minimal\GenQTest.c Demo_Source\Common_Demo_Files\r
- copy ..\Common\minimal\TimerDemo.c Demo_Source\Common_Demo_Files\r
- copy ..\Common\minimal\countsem.c Demo_Source\Common_Demo_Files\r
+ copy ..\..\..\Common\minimal\dynamic.c Demo_Source\Common_Demo_Files\r
+ copy ..\..\..\Common\minimal\comtest.c Demo_Source\Common_Demo_Files\r
+ copy ..\..\..\Common\minimal\GenQTest.c Demo_Source\Common_Demo_Files\r
+ copy ..\..\..\Common\minimal\TimerDemo.c Demo_Source\Common_Demo_Files\r
+ copy ..\..\..\Common\minimal\countsem.c Demo_Source\Common_Demo_Files\r
\r
REM Copy the common demo file headers.\r
- copy ..\Common\include\dynamic.h Demo_Source\Common_Demo_Files\include\r
- copy ..\Common\include\comtest.h Demo_Source\Common_Demo_Files\include\r
- copy ..\Common\include\comtest2.h Demo_Source\Common_Demo_Files\include\r
- copy ..\Common\include\GenQTest.h Demo_Source\Common_Demo_Files\include\r
- copy ..\Common\include\serial.h Demo_Source\Common_Demo_Files\include\r
- copy ..\Common\include\partest.h Demo_Source\Common_Demo_Files\include\r
- copy ..\Common\include\TimerDemo.h Demo_Source\Common_Demo_Files\include\r
- copy ..\Common\include\countsem.h Demo_Source\Common_Demo_Files\include\r
+ copy ..\..\..\Common\include\dynamic.h Demo_Source\Common_Demo_Files\include\r
+ copy ..\..\..\Common\include\comtest.h Demo_Source\Common_Demo_Files\include\r
+ copy ..\..\..\Common\include\comtest2.h Demo_Source\Common_Demo_Files\include\r
+ copy ..\..\..\Common\include\GenQTest.h Demo_Source\Common_Demo_Files\include\r
+ copy ..\..\..\Common\include\serial.h Demo_Source\Common_Demo_Files\include\r
+ copy ..\..\..\Common\include\partest.h Demo_Source\Common_Demo_Files\include\r
+ copy ..\..\..\Common\include\TimerDemo.h Demo_Source\Common_Demo_Files\include\r
+ copy ..\..\..\Common\include\countsem.h Demo_Source\Common_Demo_Files\include\r
+ copy ..\..\..\Common\include\partest.h Demo_Source\Common_Demo_Files\include\r
\r
: END\r
#define INCLUDE_vTaskDelayUntil 1\r
#define INCLUDE_vTaskDelay 1\r
\r
-#define configASSERT( x ) if( ( x ) == 0 ) { taskDISABLE_INTERRUPTS(); for( ;; ); } \r
+#define configASSERT( x ) if( ( x ) == 0 ) { portDISABLE_INTERRUPTS(); for( ;; ); }\r
\r
#define configINTERRUPT_CONTROLLER_TO_USE XPAR_INTC_SINGLE_DEVICE_ID\r
\r
--- /dev/null
+/*\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
#include "xtmrctr.h"\r
#include "xil_exception.h"\r
#include "microblaze_exceptions_g.h"\r
+#include "xgpio.h"\r
\r
/* Priorities at which the tasks are created. */\r
#define mainQUEUE_RECEIVE_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 )\r
static xTimerHandle xLEDTimer = NULL;\r
\r
/* Maintains the current LED output state. */\r
-static volatile unsigned long ulGPIOState = 0UL;\r
+static volatile unsigned char ucGPIOState = 0U;\r
\r
/*-----------------------------------------------------------*/\r
\r
static XTmrCtr xTimer0Instance;\r
+static XGpio xOutputGPIOInstance;\r
+static const unsigned portBASE_TYPE uxGPIOOutputChannel = 1UL;\r
\r
/*-----------------------------------------------------------*/\r
-#define JUST_TESTING\r
+#define NOT_JUST_TESTING\r
#ifdef JUST_TESTING\r
volatile unsigned long ul1 = 0, ul2 = 0;\r
\r
{\r
prvSetupHardware();\r
\r
+ XGpio_DiscreteWrite( &xOutputGPIOInstance, uxGPIOOutputChannel, 1 << 0 );\r
+ XGpio_DiscreteWrite( &xOutputGPIOInstance, uxGPIOOutputChannel, 1 << 1 );\r
+ XGpio_DiscreteWrite( &xOutputGPIOInstance, uxGPIOOutputChannel, 1 << 2 );\r
+ XGpio_DiscreteWrite( &xOutputGPIOInstance, uxGPIOOutputChannel, 1 << 3 );\r
+\r
+\r
xTaskCreate( vTemp1, ( signed char * ) "Test1", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY + 1, NULL );\r
xTaskCreate( vTemp2, ( signed char * ) "Test2", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY + 1, NULL );\r
\r
a critical section because it is accessed from multiple tasks, and the\r
button interrupt - in this trivial case, for simplicity, the critical\r
section is omitted. */\r
- ulGPIOState |= mainTIMER_CONTROLLED_LED;\r
-//_RB_ MSS_GPIO_set_outputs( ulGPIOState );\r
+ ucGPIOState |= mainTIMER_CONTROLLED_LED;\r
+ XGpio_DiscreteWrite( &xOutputGPIOInstance, uxGPIOOutputChannel, ucGPIOState );\r
}\r
/*-----------------------------------------------------------*/\r
\r
/* The button was pushed, so ensure the LED is on before resetting the\r
LED timer. The LED timer will turn the LED off if the button is not\r
pushed within 5000ms. */\r
- ulGPIOState &= ~mainTIMER_CONTROLLED_LED;\r
-//_RB_ MSS_GPIO_set_outputs( ulGPIOState );\r
+ ucGPIOState &= ~mainTIMER_CONTROLLED_LED;\r
+ XGpio_DiscreteWrite( &xOutputGPIOInstance, uxGPIOOutputChannel, ucGPIOState );\r
\r
/* This interrupt safe FreeRTOS function can be called from this interrupt\r
because the interrupt priority is below the\r
because it is accessed from multiple tasks, and the button interrupt\r
- in this trivial case, for simplicity, the critical section is\r
omitted. */\r
- if( ( ulGPIOState & mainTASK_CONTROLLED_LED ) != 0 )\r
+ if( ( ucGPIOState & mainTASK_CONTROLLED_LED ) != 0 )\r
{\r
- ulGPIOState &= ~mainTASK_CONTROLLED_LED;\r
+ ucGPIOState &= ~mainTASK_CONTROLLED_LED;\r
}\r
else\r
{\r
- ulGPIOState |= mainTASK_CONTROLLED_LED;\r
+ ucGPIOState |= mainTASK_CONTROLLED_LED;\r
}\r
-//_RB_ MSS_GPIO_set_outputs( ulGPIOState );\r
+\r
+ XGpio_DiscreteWrite( &xOutputGPIOInstance, uxGPIOOutputChannel, ucGPIOState );\r
}\r
}\r
}\r
\r
static void prvSetupHardware( 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
+ ucGPIOState = 0U;\r
+ XGpio_DiscreteWrite( &xOutputGPIOInstance, uxGPIOOutputChannel, ucGPIOState );\r
+ }\r
+\r
+ configASSERT( ( xStatus == XST_SUCCESS ) );\r
+\r
#ifdef MICROBLAZE_EXCEPTIONS_ENABLED\r
microblaze_enable_exceptions();\r
#endif\r
\r
configASSERT( ( xStatus == pdPASS ) );\r
}\r
-\r
+/*-----------------------------------------------------------*/\r
\r
void vApplicationClearTimerInterrupt( void )\r
{\r