diff --git a/Demo/PPC405_Xilinx_Virtex4_GCC/RTOSDemo/FreeRTOSConfig.h b/Demo/PPC405_Xilinx_Virtex4_GCC/RTOSDemo/FreeRTOSConfig.h
new file mode 100644
index 000000000..47e556786
--- /dev/null
+++ b/Demo/PPC405_Xilinx_Virtex4_GCC/RTOSDemo/FreeRTOSConfig.h
@@ -0,0 +1,99 @@
+/*
+ FreeRTOS.org V4.8.0 - Copyright (C) 2003-2008 Richard Barry.
+
+ This file is part of the FreeRTOS.org distribution.
+
+ FreeRTOS.org is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ FreeRTOS.org is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with FreeRTOS.org; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+ A special exception to the GPL can be applied should you wish to distribute
+ a combined work that includes FreeRTOS.org, without being obliged to provide
+ the source code for any proprietary components. See the licensing section
+ of http://www.FreeRTOS.org for full details of how and when the exception
+ can be applied.
+
+ ***************************************************************************
+ ***************************************************************************
+ * *
+ * SAVE TIME AND MONEY! We can port FreeRTOS.org to your own hardware, *
+ * and even write all or part of your application on your behalf. *
+ * See http://www.OpenRTOS.com for details of the services we provide to *
+ * expedite your project. *
+ * *
+ ***************************************************************************
+ ***************************************************************************
+
+ Please ensure to read the configuration and relevant port sections of the
+ online documentation.
+
+ http://www.FreeRTOS.org - Documentation, latest information, license and
+ contact details.
+
+ http://www.SafeRTOS.com - A version that is certified for use in safety
+ critical systems.
+
+ http://www.OpenRTOS.com - Commercial support, development, porting,
+ licensing and training services.
+*/
+
+#ifndef FREERTOS_CONFIG_H
+#define FREERTOS_CONFIG_H
+
+/*-----------------------------------------------------------
+ * Application specific definitions.
+ *
+ * These definitions should be adjusted for your particular hardware and
+ * application requirements.
+ *
+ * THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE
+ * FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.
+ *----------------------------------------------------------*/
+#define configUSE_PREEMPTION 1
+#define configUSE_IDLE_HOOK 0
+#define configUSE_TICK_HOOK 0
+#define configMINIMAL_STACK_SIZE ( ( unsigned portSHORT ) 250 )
+#define configCPU_CLOCK_HZ ( ( unsigned portLONG ) 100000000 ) /* Clock setup from start.asm in the demo application. */
+#define configTICK_RATE_HZ ( (portTickType) 1000 )
+#define configMAX_PRIORITIES ( ( unsigned portBASE_TYPE ) 6 )
+#define configTOTAL_HEAP_SIZE ( (size_t) (80 * 1024) )
+#define configMAX_TASK_NAME_LEN ( 20 )
+#define configUSE_16_BIT_TICKS 1
+#define configIDLE_SHOULD_YIELD 1
+#define configUSE_MUTEXES 1
+#define configUSE_TRACE_FACILITY 0
+#define configCHECK_FOR_STACK_OVERFLOW 2
+#define configUSE_COUNTING_SEMAPHORES 1
+
+
+/* Co-routine definitions. */
+#define configUSE_CO_ROUTINES 0
+#define configMAX_CO_ROUTINE_PRIORITIES ( 4 )
+
+/* Set the following definitions to 1 to include the API function, or zero
+to exclude the API function. */
+#define INCLUDE_vTaskPrioritySet 1
+#define INCLUDE_uxTaskPriorityGet 1
+#define INCLUDE_vTaskDelete 1
+#define INCLUDE_vTaskCleanUpResources 1
+#define INCLUDE_vTaskSuspend 1
+#define INCLUDE_vResumeFromISR 1
+#define INCLUDE_vTaskDelayUntil 1
+#define INCLUDE_vTaskDelay 1
+#define INCLUDE_xTaskGetSchedulerState 1
+#define INCLUDE_xTaskGetCurrentTaskHandle 1
+#define INCLUDE_uxTaskGetStackHighWaterMark 1
+#define configUSE_RECURSIVE_MUTEXES 1
+
+
+#endif /* FREERTOS_CONFIG_H */
diff --git a/Demo/PPC405_Xilinx_Virtex4_GCC/RTOSDemo/RTOSDemo_linker_script.ld b/Demo/PPC405_Xilinx_Virtex4_GCC/RTOSDemo/RTOSDemo_linker_script.ld
new file mode 100644
index 000000000..84040a576
--- /dev/null
+++ b/Demo/PPC405_Xilinx_Virtex4_GCC/RTOSDemo/RTOSDemo_linker_script.ld
@@ -0,0 +1,224 @@
+/*******************************************************************/
+/* */
+/* This file is automatically generated by linker script generator.*/
+/* */
+/* Version: Xilinx EDK 10.1 EDK_K.15 */
+/* */
+/* Copyright (c) 2004 Xilinx, Inc. All rights reserved. */
+/* */
+/* Description : PowerPC405 Linker Script */
+/* */
+/*******************************************************************/
+
+_STACK_SIZE = DEFINED(_STACK_SIZE) ? _STACK_SIZE : 0x400;
+_HEAP_SIZE = DEFINED(_HEAP_SIZE) ? _HEAP_SIZE : 0x400;
+
+/* Define Memories in the system */
+
+MEMORY
+{
+ SRAM_C_MEM0_BASEADDR : ORIGIN = 0xFFF00000, LENGTH = 0x000FFFEC
+}
+
+/* Specify the default entry point to the program */
+
+ENTRY(_boot)
+STARTUP(boot.o)
+
+/* Define the sections, and where they are mapped in memory */
+
+SECTIONS
+{
+.vectors : {
+ __vectors_start = .;
+ *(.vectors)
+ __vectors_end = .;
+} > SRAM_C_MEM0_BASEADDR
+
+.text : {
+ *(.text)
+ *(.text.*)
+ *(.gnu.linkonce.t.*)
+} > SRAM_C_MEM0_BASEADDR
+
+.init : {
+ KEEP (*(.init))
+} > SRAM_C_MEM0_BASEADDR
+
+.fini : {
+ KEEP (*(.fini))
+} > SRAM_C_MEM0_BASEADDR
+
+.rodata : {
+ __rodata_start = .;
+ *(.rodata)
+ *(.rodata.*)
+ *(.gnu.linkonce.r.*)
+ __rodata_end = .;
+} > SRAM_C_MEM0_BASEADDR
+
+.rodata1 : {
+ __rodata1_start = .;
+ *(.rodata1)
+ *(.rodata1.*)
+ __rodata1_end = .;
+} > SRAM_C_MEM0_BASEADDR
+
+.sdata2 : {
+ __sdata2_start = .;
+ *(.sdata2)
+ *(.sdata2.*)
+ *(.gnu.linkonce.s2.*)
+ __sdata2_end = .;
+} > SRAM_C_MEM0_BASEADDR
+
+.sbss2 : {
+ __sbss2_start = .;
+ *(.sbss2)
+ *(.sbss2.*)
+ *(.gnu.linkonce.sb2.*)
+ __sbss2_end = .;
+} > SRAM_C_MEM0_BASEADDR
+
+.data : {
+ __data_start = .;
+ *(.data)
+ *(.data.*)
+ *(.gnu.linkonce.d.*)
+ __data_end = .;
+} > SRAM_C_MEM0_BASEADDR
+
+.data1 : {
+ __data1_start = .;
+ *(.data1)
+ *(.data1.*)
+ __data1_end = .;
+} > SRAM_C_MEM0_BASEADDR
+
+.got : {
+ *(.got)
+} > SRAM_C_MEM0_BASEADDR
+
+.got1 : {
+ *(.got1)
+} > SRAM_C_MEM0_BASEADDR
+
+.got2 : {
+ *(.got2)
+} > SRAM_C_MEM0_BASEADDR
+
+.ctors : {
+ __CTOR_LIST__ = .;
+ ___CTORS_LIST___ = .;
+ KEEP (*crtbegin.o(.ctors))
+ KEEP (*(EXCLUDE_FILE(*crtend.o) .ctors))
+ KEEP (*(SORT(.ctors.*)))
+ KEEP (*(.ctors))
+ __CTOR_END__ = .;
+ ___CTORS_END___ = .;
+} > SRAM_C_MEM0_BASEADDR
+
+.dtors : {
+ __DTOR_LIST__ = .;
+ ___DTORS_LIST___ = .;
+ KEEP (*crtbegin.o(.dtors))
+ KEEP (*(EXCLUDE_FILE(*crtend.o) .dtors))
+ KEEP (*(SORT(.dtors.*)))
+ KEEP (*(.dtors))
+ __DTOR_END__ = .;
+ ___DTORS_END___ = .;
+} > SRAM_C_MEM0_BASEADDR
+
+.fixup : {
+ __fixup_start = .;
+ *(.fixup)
+ __fixup_end = .;
+} > SRAM_C_MEM0_BASEADDR
+
+.eh_frame : {
+ *(.eh_frame)
+} > SRAM_C_MEM0_BASEADDR
+
+.jcr : {
+ *(.jcr)
+} > SRAM_C_MEM0_BASEADDR
+
+.gcc_except_table : {
+ *(.gcc_except_table)
+} > SRAM_C_MEM0_BASEADDR
+
+.sdata : {
+ __sdata_start = .;
+ *(.sdata)
+ *(.sdata.*)
+ *(.gnu.linkonce.s.*)
+ __sdata_end = .;
+} > SRAM_C_MEM0_BASEADDR
+
+.sbss : {
+ __sbss_start = .;
+ *(.sbss)
+ *(.sbss.*)
+ *(.gnu.linkonce.sb.*)
+ *(.scommon)
+ __sbss_end = .;
+} > SRAM_C_MEM0_BASEADDR
+
+.tdata : {
+ __tdata_start = .;
+ *(.tdata)
+ *(.tdata.*)
+ *(.gnu.linkonce.td.*)
+ __tdata_end = .;
+} > SRAM_C_MEM0_BASEADDR
+
+.tbss : {
+ __tbss_start = .;
+ *(.tbss)
+ *(.tbss.*)
+ *(.gnu.linkonce.tb.*)
+ __tbss_end = .;
+} > SRAM_C_MEM0_BASEADDR
+
+.bss : {
+ __bss_start = .;
+ *(.bss)
+ *(.bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ . = ALIGN(4);
+ __bss_end = .;
+} > SRAM_C_MEM0_BASEADDR
+
+.boot0 0xFFFFFFEC : {
+ __boot0_start = .;
+ *(.boot0)
+ __boot0_end = .;
+}
+
+.boot 0xFFFFFFFC : {
+ __boot_start = .;
+ *(.boot)
+ __boot_end = .;
+}
+
+/* Generate Stack and Heap Sections */
+
+.stack : {
+ _stack_end = .;
+ . += _STACK_SIZE;
+ . = ALIGN(16);
+ __stack = .;
+} > SRAM_C_MEM0_BASEADDR
+
+.heap : {
+ . = ALIGN(16);
+ _heap_start = .;
+ . += _HEAP_SIZE;
+ . = ALIGN(16);
+ _heap_end = .;
+ _end = .;
+} > SRAM_C_MEM0_BASEADDR
+
+}
+
diff --git a/Demo/PPC405_Xilinx_Virtex4_GCC/RTOSDemo/main.c b/Demo/PPC405_Xilinx_Virtex4_GCC/RTOSDemo/main.c
new file mode 100644
index 000000000..5033e1c77
--- /dev/null
+++ b/Demo/PPC405_Xilinx_Virtex4_GCC/RTOSDemo/main.c
@@ -0,0 +1,670 @@
+/*
+ FreeRTOS.org V4.8.0 - Copyright (C) 2003-2008 Richard Barry.
+
+ This file is part of the FreeRTOS.org distribution.
+
+ FreeRTOS.org is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ FreeRTOS.org is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with FreeRTOS.org; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+ A special exception to the GPL can be applied should you wish to distribute
+ a combined work that includes FreeRTOS.org, without being obliged to provide
+ the source code for any proprietary components. See the licensing section
+ of http://www.FreeRTOS.org for full details of how and when the exception
+ can be applied.
+
+ ***************************************************************************
+ ***************************************************************************
+ * *
+ * SAVE TIME AND MONEY! We can port FreeRTOS.org to your own hardware, *
+ * and even write all or part of your application on your behalf. *
+ * See http://www.OpenRTOS.com for details of the services we provide to *
+ * expedite your project. *
+ * *
+ ***************************************************************************
+ ***************************************************************************
+
+ Please ensure to read the configuration and relevant port sections of the
+ online documentation.
+
+ http://www.FreeRTOS.org - Documentation, latest information, license and
+ contact details.
+
+ http://www.SafeRTOS.com - A version that is certified for use in safety
+ critical systems.
+
+ http://www.OpenRTOS.com - Commercial support, development, porting,
+ licensing and training services.
+*/
+
+/*
+ * Creates all the demo application tasks, then starts the scheduler. The WEB
+ * documentation provides more details of the demo application tasks.
+ *
+ * In addition to the standard demo tasks, the follow demo specific tasks are
+ * create:
+ *
+ * The "Check" task. This only executes every three seconds but has the highest
+ * priority so is guaranteed to get processor time. Its main function is to
+ * check that all the other tasks are still operational. Most tasks maintain
+ * a unique count that is incremented each time the task successfully completes
+ * its function. Should any error occur within such a task the count is
+ * permanently halted. The check task inspects the count of each task to ensure
+ * it has changed since the last time the check task executed. If all the count
+ * variables have changed all the tasks are still executing error free, and the
+ * check task toggles the onboard LED. Should any task contain an error at any time
+ * the LED toggle rate will change from 3 seconds to 500ms.
+ *
+ * The "Register Check" tasks. These tasks fill the CPU registers with known
+ * values, then check that each register still contains the expected value, the
+ * discovery of an unexpected value being indicative of an error in the RTOS
+ * context switch mechanism. The register check tasks operate at low priority
+ * so are switched in and out frequently.
+ *
+ */
+
+/* Scheduler includes. */
+#include "FreeRTOS.h"
+#include "task.h"
+
+/* Xilinx library includes. */
+#include "xcache_l.h"
+#include "xintc.h"
+
+/* Demo application includes. */
+#include "flash.h"
+#include "integer.h"
+#include "comtest2.h"
+#include "semtest.h"
+#include "BlockQ.h"
+#include "dynamic.h"
+#include "flop.h"
+#include "GenQTest.h"
+#include "QPeek.h"
+#include "blocktim.h"
+#include "death.h"
+#include "partest.h"
+#include "countsem.h"
+#include "recmutex.h"
+
+/* Priorities assigned to the demo tasks. */
+#define mainCHECK_TASK_PRIORITY ( tskIDLE_PRIORITY + 4 )
+#define mainSEM_TEST_PRIORITY ( tskIDLE_PRIORITY + 2 )
+#define mainCOM_TEST_PRIORITY ( tskIDLE_PRIORITY + 1 )
+#define mainQUEUE_BLOCK_PRIORITY ( tskIDLE_PRIORITY + 1 )
+#define mainDEATH_PRIORITY ( tskIDLE_PRIORITY + 1 )
+#define mainLED_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 )
+#define mainGENERIC_QUEUE_PRIORITY ( tskIDLE_PRIORITY )
+#define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 1 )
+
+/* The first LED used by the COM test and check tasks respectively. */
+#define mainCOM_TEST_LED ( 4 )
+#define mainCHECK_TEST_LED ( 3 )
+
+/* The baud rate used by the comtest tasks is set by the hardware, so the
+baud rate parameters passed into the comtest initialisation has no effect. */
+#define mainBAUD_SET_IN_HARDWARE ( 0 )
+
+/* Delay periods used by the check task. If no errors have been found then
+the check LED will toggle every mainNO_ERROR_CHECK_DELAY milliseconds. If an
+error has been found at any time then the toggle rate will increase to
+mainERROR_CHECK_DELAY milliseconds. */
+#define mainNO_ERROR_CHECK_DELAY ( ( portTickType ) 3000 / portTICK_RATE_MS )
+#define mainERROR_CHECK_DELAY ( ( portTickType ) 500 / portTICK_RATE_MS )
+
+
+/*
+ * The tasks defined within this file - described within the comments at the
+ * head of this page.
+ */
+static void prvRegTestTask1( void *pvParameters );
+static void prvRegTestTask2( void *pvParameters );
+static void prvErrorChecks( void *pvParameters );
+
+/*
+ * Called by the 'check' task to inspect all the standard demo tasks within
+ * the system, as described within the comments at the head of this page.
+ */
+static portSHORT prvCheckOtherTasksAreStillRunning( void );
+
+/*
+ * Perform any hardware initialisation required by the demo application.
+ */
+static void prvSetupHardware( void );
+
+/*-----------------------------------------------------------*/
+
+/* xRegTestStatus will get set to pdFAIL by the regtest tasks if they
+discover an unexpected value. */
+static unsigned portBASE_TYPE xRegTestStatus = pdPASS;
+
+/* Counters used to ensure the regtest tasks are still running. */
+static volatile unsigned portLONG ulRegTest1Counter = 0UL, ulRegTest2Counter = 0UL;
+
+/*-----------------------------------------------------------*/
+
+int main( void )
+{
+ /* Must be called prior to installing any interrupt handlers! */
+ vPortSetupInterruptController();
+
+ /* In this case prvSetupHardware() just enables the caches and and
+ configures the IO ports for the LED outputs. */
+ prvSetupHardware();
+
+ /* Start the standard demo application tasks. Note that the baud rate used
+ by the comtest tasks is set by the hardware, so the baud rate parameter
+ passed has no effect. */
+ vStartLEDFlashTasks( mainLED_TASK_PRIORITY );
+ vStartIntegerMathTasks( tskIDLE_PRIORITY );
+ vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainBAUD_SET_IN_HARDWARE, mainCOM_TEST_LED );
+ vStartSemaphoreTasks( mainSEM_TEST_PRIORITY );
+ vStartBlockingQueueTasks ( mainQUEUE_BLOCK_PRIORITY );
+ vStartDynamicPriorityTasks();
+ vStartMathTasks( tskIDLE_PRIORITY );
+ vStartGenericQueueTasks( mainGENERIC_QUEUE_PRIORITY );
+ vStartQueuePeekTasks();
+ vCreateBlockTimeTasks();
+ vStartCountingSemaphoreTasks();
+ vStartRecursiveMutexTasks();
+
+ /* Create the tasks defined within this file. */
+ xTaskCreate( prvRegTestTask1, "Regtest1", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );
+ xTaskCreate( prvRegTestTask2, "Regtest2", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );
+ xTaskCreate( prvErrorChecks, "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL );
+
+ /* The suicide tasks must be started last as they record the number of other
+ tasks that exist within the system. The value is then used to ensure at run
+ time the number of tasks that exists is within expected bounds. */
+ vCreateSuicidalTasks( mainDEATH_PRIORITY );
+
+ /* Now start the scheduler. Following this call the created tasks should
+ be executing. */
+ vTaskStartScheduler( );
+
+ /* vTaskStartScheduler() will only return if an error occurs while the
+ idle task is being created. */
+ for( ;; );
+
+ return 0;
+}
+/*-----------------------------------------------------------*/
+
+static portSHORT prvCheckOtherTasksAreStillRunning( void )
+{
+portBASE_TYPE lReturn = pdPASS;
+static unsigned portLONG ulLastRegTest1Counter= 0UL, ulLastRegTest2Counter = 0UL;
+
+ /* The demo tasks maintain a count that increments every cycle of the task
+ provided that the task has never encountered an error. This function
+ checks the counts maintained by the tasks to ensure they are still being
+ incremented. A count remaining at the same value between calls therefore
+ indicates that an error has been detected. */
+
+ if( xAreIntegerMathsTaskStillRunning() != pdTRUE )
+ {
+ lReturn = pdFAIL;
+ }
+
+ if( xAreComTestTasksStillRunning() != pdTRUE )
+ {
+ lReturn = pdFAIL;
+ }
+
+ if( xAreSemaphoreTasksStillRunning() != pdTRUE )
+ {
+ lReturn = pdFAIL;
+ }
+
+ if( xAreBlockingQueuesStillRunning() != pdTRUE )
+ {
+ lReturn = pdFAIL;
+ }
+
+ if( xAreDynamicPriorityTasksStillRunning() != pdTRUE )
+ {
+ lReturn = pdFAIL;
+ }
+
+ if( xAreMathsTaskStillRunning() != pdTRUE )
+ {
+ lReturn = pdFAIL;
+ }
+
+ if( xIsCreateTaskStillRunning() != pdTRUE )
+ {
+ lReturn = pdFAIL;
+ }
+
+ if( xAreBlockTimeTestTasksStillRunning() != pdTRUE )
+ {
+ lReturn = pdFAIL;
+ }
+
+ if( xAreGenericQueueTasksStillRunning() != pdTRUE )
+ {
+ lReturn = pdFAIL;
+ }
+
+ if( xAreQueuePeekTasksStillRunning() != pdTRUE )
+ {
+ lReturn = pdFAIL;
+ }
+
+ if( xAreCountingSemaphoreTasksStillRunning() != pdTRUE )
+ {
+ lReturn = pdFAIL;
+ }
+
+ if( xAreRecursiveMutexTasksStillRunning() != pdTRUE )
+ {
+ lReturn = pdFAIL;
+ }
+
+ /* Have the register test tasks found any errors? */
+ if( xRegTestStatus != pdPASS )
+ {
+ lReturn = pdFAIL;
+ }
+
+ /* Are the register test tasks still looping? */
+ if( ulLastRegTest1Counter == ulRegTest1Counter )
+ {
+ lReturn = pdFAIL;
+ }
+ else
+ {
+ ulLastRegTest1Counter = ulRegTest1Counter;
+ }
+
+ if( ulLastRegTest2Counter == ulRegTest2Counter )
+ {
+ lReturn = pdFAIL;
+ }
+ else
+ {
+ ulLastRegTest2Counter = ulRegTest2Counter;
+ }
+
+ return lReturn;
+}
+/*-----------------------------------------------------------*/
+
+
+static void prvErrorChecks( void *pvParameters )
+{
+portTickType xDelayPeriod = mainNO_ERROR_CHECK_DELAY, xLastExecutionTime;
+volatile unsigned portBASE_TYPE uxFreeStack;
+
+ /* This call is just to demonstrate the use of the function - nothing is
+ done with the value. You would expect the stack high water mark to be
+ lower (the function to return a larger value) here at function entry than
+ later following calls to other functions. */
+ uxFreeStack = uxTaskGetStackHighWaterMark( NULL );
+
+ /* Initialise xLastExecutionTime so the first call to vTaskDelayUntil()
+ works correctly. */
+ xLastExecutionTime = xTaskGetTickCount();
+
+ /* Cycle for ever, delaying then checking all the other tasks are still
+ operating without error. */
+ for( ;; )
+ {
+ /* Again just for demo purposes - uxFreeStack should have a lower value
+ here than following the call to uxTaskGetStackHighWaterMark() on the
+ task entry. */
+ uxFreeStack = uxTaskGetStackHighWaterMark( NULL );
+
+ /* Wait until it is time to check again. The time we wait here depends
+ on whether an error has been detected or not. When an error is
+ detected the time is shortened resulting in a faster LED flash rate. */
+ vTaskDelayUntil( &xLastExecutionTime, xDelayPeriod );
+
+ /* See if the other tasks are all ok. */
+ if( prvCheckOtherTasksAreStillRunning() != pdPASS )
+ {
+ /* An error occurred in one of the tasks so shorten the delay
+ period - which has the effect of increasing the frequency of the
+ LED toggle. */
+ xDelayPeriod = mainERROR_CHECK_DELAY;
+ }
+
+ /* Flash! */
+ vParTestToggleLED( mainCHECK_TEST_LED );
+ }
+}
+/*-----------------------------------------------------------*/
+
+static void prvSetupHardware( void )
+{
+ XCache_EnableICache( 0x80000000 );
+ XCache_EnableDCache( 0x80000000 );
+
+ /* Setup the IO port for use with the LED outputs. */
+ vParTestInitialise();
+}
+/*-----------------------------------------------------------*/
+
+void prvRegTest1Pass( void )
+{
+ /* Called from the inline assembler - this cannot be static
+ otherwise it can get optimised away. */
+ ulRegTest1Counter++;
+}
+/*-----------------------------------------------------------*/
+
+void prvRegTest2Pass( void )
+{
+ /* Called from the inline assembler - this cannot be static
+ otherwise it can get optimised away. */
+ ulRegTest2Counter++;
+}
+/*-----------------------------------------------------------*/
+
+void prvRegTestFail( void )
+{
+ /* Called from the inline assembler - this cannot be static
+ otherwise it can get optimised away. */
+ xRegTestStatus = pdFAIL;
+}
+/*-----------------------------------------------------------*/
+
+static void prvRegTestTask1( void *pvParameters )
+{
+ /* The first register test task as described at the top of this file. The
+ values used in the registers are different to those use in the second
+ register test task. Also, unlike the second register test task, this task
+ yields between setting the register values and subsequently checking the
+ register values. */
+ asm volatile
+ (
+ "RegTest1Start: \n\t" \
+ " \n\t" \
+ " li 0, 301 \n\t" \
+ " mtspr 256, 0 #USPRG0 \n\t" \
+ " li 0, 501 \n\t" \
+ " mtspr 8, 0 #LR \n\t" \
+ " li 0, 4 \n\t" \
+ " mtspr 1, 0 #XER \n\t" \
+ " \n\t" \
+ " li 0, 1 \n\t" \
+ " li 2, 2 \n\t" \
+ " li 3, 3 \n\t" \
+ " li 4, 4 \n\t" \
+ " li 5, 5 \n\t" \
+ " li 6, 6 \n\t" \
+ " li 7, 7 \n\t" \
+ " li 8, 8 \n\t" \
+ " li 9, 9 \n\t" \
+ " li 10, 10 \n\t" \
+ " li 11, 11 \n\t" \
+ " li 12, 12 \n\t" \
+ " li 13, 13 \n\t" \
+ " li 14, 14 \n\t" \
+ " li 15, 15 \n\t" \
+ " li 16, 16 \n\t" \
+ " li 17, 17 \n\t" \
+ " li 18, 18 \n\t" \
+ " li 19, 19 \n\t" \
+ " li 20, 20 \n\t" \
+ " li 21, 21 \n\t" \
+ " li 22, 22 \n\t" \
+ " li 23, 23 \n\t" \
+ " li 24, 24 \n\t" \
+ " li 25, 25 \n\t" \
+ " li 26, 26 \n\t" \
+ " li 27, 27 \n\t" \
+ " li 28, 28 \n\t" \
+ " li 29, 29 \n\t" \
+ " li 30, 30 \n\t" \
+ " li 31, 31 \n\t" \
+ " \n\t" \
+ " sc \n\t" \
+ " nop \n\t" \
+ " \n\t" \
+ " cmpwi 0, 1 \n\t" \
+ " bne RegTest1Fail \n\t" \
+ " cmpwi 2, 2 \n\t" \
+ " bne RegTest1Fail \n\t" \
+ " cmpwi 3, 3 \n\t" \
+ " bne RegTest1Fail \n\t" \
+ " cmpwi 4, 4 \n\t" \
+ " bne RegTest1Fail \n\t" \
+ " cmpwi 5, 5 \n\t" \
+ " bne RegTest1Fail \n\t" \
+ " cmpwi 6, 6 \n\t" \
+ " bne RegTest1Fail \n\t" \
+ " cmpwi 7, 7 \n\t" \
+ " bne RegTest1Fail \n\t" \
+ " cmpwi 8, 8 \n\t" \
+ " bne RegTest1Fail \n\t" \
+ " cmpwi 9, 9 \n\t" \
+ " bne RegTest1Fail \n\t" \
+ " cmpwi 10, 10 \n\t" \
+ " bne RegTest1Fail \n\t" \
+ " cmpwi 11, 11 \n\t" \
+ " bne RegTest1Fail \n\t" \
+ " cmpwi 12, 12 \n\t" \
+ " bne RegTest1Fail \n\t" \
+ " cmpwi 13, 13 \n\t" \
+ " bne RegTest1Fail \n\t" \
+ " cmpwi 14, 14 \n\t" \
+ " bne RegTest1Fail \n\t" \
+ " cmpwi 15, 15 \n\t" \
+ " bne RegTest1Fail \n\t" \
+ " cmpwi 16, 16 \n\t" \
+ " bne RegTest1Fail \n\t" \
+ " cmpwi 17, 17 \n\t" \
+ " bne RegTest1Fail \n\t" \
+ " cmpwi 18, 18 \n\t" \
+ " bne RegTest1Fail \n\t" \
+ " cmpwi 19, 19 \n\t" \
+ " bne RegTest1Fail \n\t" \
+ " cmpwi 20, 20 \n\t" \
+ " bne RegTest1Fail \n\t" \
+ " cmpwi 21, 21 \n\t" \
+ " bne RegTest1Fail \n\t" \
+ " cmpwi 22, 22 \n\t" \
+ " bne RegTest1Fail \n\t" \
+ " cmpwi 23, 23 \n\t" \
+ " bne RegTest1Fail \n\t" \
+ " cmpwi 24, 24 \n\t" \
+ " bne RegTest1Fail \n\t" \
+ " cmpwi 25, 25 \n\t" \
+ " bne RegTest1Fail \n\t" \
+ " cmpwi 26, 26 \n\t" \
+ " bne RegTest1Fail \n\t" \
+ " cmpwi 27, 27 \n\t" \
+ " bne RegTest1Fail \n\t" \
+ " cmpwi 28, 28 \n\t" \
+ " bne RegTest1Fail \n\t" \
+ " cmpwi 29, 29 \n\t" \
+ " bne RegTest1Fail \n\t" \
+ " cmpwi 30, 30 \n\t" \
+ " bne RegTest1Fail \n\t" \
+ " cmpwi 31, 31 \n\t" \
+ " bne RegTest1Fail \n\t" \
+ " \n\t" \
+ " mfspr 0, 256 #USPRG0 \n\t" \
+ " cmpwi 0, 301 \n\t" \
+ " bne RegTest1Fail \n\t" \
+ " mfspr 0, 8 #LR \n\t" \
+ " cmpwi 0, 501 \n\t" \
+ " bne RegTest1Fail \n\t" \
+ " mfspr 0, 1 #XER \n\t" \
+ " cmpwi 0, 4 \n\t" \
+ " bne RegTest1Fail \n\t" \
+ " \n\t" \
+ " bl prvRegTest1Pass \n\t" \
+ " b RegTest1Start \n\t" \
+ " \n\t" \
+ "RegTest1Fail: \n\t" \
+ " \n\t" \
+ " \n\t" \
+ " bl prvRegTestFail \n\t" \
+ " b RegTest1Start \n\t" \
+ );
+}
+/*-----------------------------------------------------------*/
+
+static void prvRegTestTask2( void *pvParameters )
+{
+ /* The second register test task as described at the top of this file.
+ Note that this task fills the registers with different values to the
+ first register test task. */
+ asm volatile
+ (
+ "RegTest2Start: \n\t" \
+ " \n\t" \
+ " li 0, 300 \n\t" \
+ " mtspr 256, 0 #USPRG0 \n\t" \
+ " li 0, 500 \n\t" \
+ " mtspr 8, 0 #LR \n\t" \
+ " li 0, 4 \n\t" \
+ " mtspr 1, 0 #XER \n\t" \
+ " \n\t" \
+ " li 0, 11 \n\t" \
+ " li 2, 12 \n\t" \
+ " li 3, 13 \n\t" \
+ " li 4, 14 \n\t" \
+ " li 5, 15 \n\t" \
+ " li 6, 16 \n\t" \
+ " li 7, 17 \n\t" \
+ " li 8, 18 \n\t" \
+ " li 9, 19 \n\t" \
+ " li 10, 110 \n\t" \
+ " li 11, 111 \n\t" \
+ " li 12, 112 \n\t" \
+ " li 13, 113 \n\t" \
+ " li 14, 114 \n\t" \
+ " li 15, 115 \n\t" \
+ " li 16, 116 \n\t" \
+ " li 17, 117 \n\t" \
+ " li 18, 118 \n\t" \
+ " li 19, 119 \n\t" \
+ " li 20, 120 \n\t" \
+ " li 21, 121 \n\t" \
+ " li 22, 122 \n\t" \
+ " li 23, 123 \n\t" \
+ " li 24, 124 \n\t" \
+ " li 25, 125 \n\t" \
+ " li 26, 126 \n\t" \
+ " li 27, 127 \n\t" \
+ " li 28, 128 \n\t" \
+ " li 29, 129 \n\t" \
+ " li 30, 130 \n\t" \
+ " li 31, 131 \n\t" \
+ " \n\t" \
+ " cmpwi 0, 11 \n\t" \
+ " bne RegTest2Fail \n\t" \
+ " cmpwi 2, 12 \n\t" \
+ " bne RegTest2Fail \n\t" \
+ " cmpwi 3, 13 \n\t" \
+ " bne RegTest2Fail \n\t" \
+ " cmpwi 4, 14 \n\t" \
+ " bne RegTest2Fail \n\t" \
+ " cmpwi 5, 15 \n\t" \
+ " bne RegTest2Fail \n\t" \
+ " cmpwi 6, 16 \n\t" \
+ " bne RegTest2Fail \n\t" \
+ " cmpwi 7, 17 \n\t" \
+ " bne RegTest2Fail \n\t" \
+ " cmpwi 8, 18 \n\t" \
+ " bne RegTest2Fail \n\t" \
+ " cmpwi 9, 19 \n\t" \
+ " bne RegTest2Fail \n\t" \
+ " cmpwi 10, 110 \n\t" \
+ " bne RegTest2Fail \n\t" \
+ " cmpwi 11, 111 \n\t" \
+ " bne RegTest2Fail \n\t" \
+ " cmpwi 12, 112 \n\t" \
+ " bne RegTest2Fail \n\t" \
+ " cmpwi 13, 113 \n\t" \
+ " bne RegTest2Fail \n\t" \
+ " cmpwi 14, 114 \n\t" \
+ " bne RegTest2Fail \n\t" \
+ " cmpwi 15, 115 \n\t" \
+ " bne RegTest2Fail \n\t" \
+ " cmpwi 16, 116 \n\t" \
+ " bne RegTest2Fail \n\t" \
+ " cmpwi 17, 117 \n\t" \
+ " bne RegTest2Fail \n\t" \
+ " cmpwi 18, 118 \n\t" \
+ " bne RegTest2Fail \n\t" \
+ " cmpwi 19, 119 \n\t" \
+ " bne RegTest2Fail \n\t" \
+ " cmpwi 20, 120 \n\t" \
+ " bne RegTest2Fail \n\t" \
+ " cmpwi 21, 121 \n\t" \
+ " bne RegTest2Fail \n\t" \
+ " cmpwi 22, 122 \n\t" \
+ " bne RegTest2Fail \n\t" \
+ " cmpwi 23, 123 \n\t" \
+ " bne RegTest2Fail \n\t" \
+ " cmpwi 24, 124 \n\t" \
+ " bne RegTest2Fail \n\t" \
+ " cmpwi 25, 125 \n\t" \
+ " bne RegTest2Fail \n\t" \
+ " cmpwi 26, 126 \n\t" \
+ " bne RegTest2Fail \n\t" \
+ " cmpwi 27, 127 \n\t" \
+ " bne RegTest2Fail \n\t" \
+ " cmpwi 28, 128 \n\t" \
+ " bne RegTest2Fail \n\t" \
+ " cmpwi 29, 129 \n\t" \
+ " bne RegTest2Fail \n\t" \
+ " cmpwi 30, 130 \n\t" \
+ " bne RegTest2Fail \n\t" \
+ " cmpwi 31, 131 \n\t" \
+ " bne RegTest2Fail \n\t" \
+ " \n\t" \
+ " mfspr 0, 256 #USPRG0 \n\t" \
+ " cmpwi 0, 300 \n\t" \
+ " bne RegTest2Fail \n\t" \
+ " mfspr 0, 8 #LR \n\t" \
+ " cmpwi 0, 500 \n\t" \
+ " bne RegTest2Fail \n\t" \
+ " mfspr 0, 1 #XER \n\t" \
+ " cmpwi 0, 4 \n\t" \
+ " bne RegTest2Fail \n\t" \
+ " \n\t" \
+ " bl prvRegTest2Pass \n\t" \
+ " b RegTest2Start \n\t" \
+ " \n\t" \
+ "RegTest2Fail: \n\t" \
+ " \n\t" \
+ " \n\t" \
+ " bl prvRegTestFail \n\t" \
+ " b RegTest2Start \n\t" \
+ );
+}
+/*-----------------------------------------------------------*/
+
+/* This hook function will get called if there is a suspected stack overflow.
+An overflow can cause the task name to be corrupted, in which case the task
+handle needs to be used to determine the offending task. */
+void vApplicationStackOverflowHook( xTaskHandle xTask, signed portCHAR *pcTaskName );
+void vApplicationStackOverflowHook( xTaskHandle xTask, signed portCHAR *pcTaskName )
+{
+ /* The following three calls are simply to stop compiler warnings about the
+ functions not being used - they are called from the inline assembly. */
+ prvRegTest1Pass();
+ prvRegTest2Pass();
+ prvRegTestFail();
+
+ for( ;; );
+}
+
+
+
+
diff --git a/Demo/PPC405_Xilinx_Virtex4_GCC/RTOSDemo/partest/partest.c b/Demo/PPC405_Xilinx_Virtex4_GCC/RTOSDemo/partest/partest.c
new file mode 100644
index 000000000..0d8d9c129
--- /dev/null
+++ b/Demo/PPC405_Xilinx_Virtex4_GCC/RTOSDemo/partest/partest.c
@@ -0,0 +1,167 @@
+/*
+ FreeRTOS.org V4.8.0 - Copyright (C) 2003-2008 Richard Barry.
+
+ This file is part of the FreeRTOS.org distribution.
+
+ FreeRTOS.org is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ FreeRTOS.org is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with FreeRTOS.org; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+ A special exception to the GPL can be applied should you wish to distribute
+ a combined work that includes FreeRTOS.org, without being obliged to provide
+ the source code for any proprietary components. See the licensing section
+ of http://www.FreeRTOS.org for full details of how and when the exception
+ can be applied.
+
+ ***************************************************************************
+ ***************************************************************************
+ * *
+ * SAVE TIME AND MONEY! We can port FreeRTOS.org to your own hardware, *
+ * and even write all or part of your application on your behalf. *
+ * See http://www.OpenRTOS.com for details of the services we provide to *
+ * expedite your project. *
+ * *
+ ***************************************************************************
+ ***************************************************************************
+
+ Please ensure to read the configuration and relevant port sections of the
+ online documentation.
+
+ http://www.FreeRTOS.org - Documentation, latest information, license and
+ contact details.
+
+ http://www.SafeRTOS.com - A version that is certified for use in safety
+ critical systems.
+
+ http://www.OpenRTOS.com - Commercial support, development, porting,
+ licensing and training services.
+*/
+
+
+/* Scheduler includes. */
+#include "FreeRTOS.h"
+
+/* Demo application includes. */
+#include "partest.h"
+
+/* Library includes. */
+#include "xparameters.h"
+#include "xgpio_l.h"
+
+/* Misc hardware specific definitions. */
+#define partstALL_AS_OUTPUT 0x00
+#define partstCHANNEL_1 0x01
+#define partstMAX_4BIT_LED 0x03
+
+/* The outputs are split into two IO sections, these variables maintain the
+current value of either section. */
+static unsigned portBASE_TYPE uxCurrentOutput4Bit, uxCurrentOutput5Bit;
+
+/*-----------------------------------------------------------*/
+/*
+ * Setup the IO for the LED outputs.
+ */
+void vParTestInitialise( void )
+{
+ /* Set both sets of LED's on the demo board to outputs. */
+ XGpio_mSetDataDirection( XPAR_LEDS_4BIT_BASEADDR, partstCHANNEL_1, partstALL_AS_OUTPUT );
+ XGpio_mSetDataDirection( XPAR_LEDS_POSITIONS_BASEADDR, partstCHANNEL_1, partstALL_AS_OUTPUT );
+
+ /* Start with all outputs off. */
+ uxCurrentOutput4Bit = 0;
+ XGpio_mSetDataReg( XPAR_LEDS_4BIT_BASEADDR, partstCHANNEL_1, 0x00 );
+ uxCurrentOutput5Bit = 0;
+ XGpio_mSetDataReg( XPAR_LEDS_POSITIONS_BASEADDR, partstCHANNEL_1, 0x00 );
+}
+/*-----------------------------------------------------------*/
+
+void vParTestSetLED( unsigned portBASE_TYPE uxLED, signed portBASE_TYPE xValue )
+{
+unsigned portBASE_TYPE uxBaseAddress, *puxCurrentValue;
+
+ portENTER_CRITICAL();
+ {
+ /* Which IO section does the LED being set/cleared belong to? The
+ 4 bit or 5 bit outputs? */
+ if( uxLED <= partstMAX_4BIT_LED )
+ {
+ uxBaseAddress = XPAR_LEDS_4BIT_BASEADDR;
+ puxCurrentValue = &uxCurrentOutput4Bit;
+ }
+ else
+ {
+ uxBaseAddress = XPAR_LEDS_POSITIONS_BASEADDR;
+ puxCurrentValue = &uxCurrentOutput5Bit;
+ uxLED -= partstMAX_4BIT_LED;
+ }
+
+ /* Setup the bit mask accordingly. */
+ uxLED = 0x01 << uxLED;
+
+ /* Maintain the current output value. */
+ if( xValue )
+ {
+ *puxCurrentValue |= uxLED;
+ }
+ else
+ {
+ *puxCurrentValue &= ~uxLED;
+ }
+
+ /* Write the value to the port. */
+ XGpio_mSetDataReg( uxBaseAddress, partstCHANNEL_1, *puxCurrentValue );
+ }
+ portEXIT_CRITICAL();
+}
+/*-----------------------------------------------------------*/
+
+void vParTestToggleLED( unsigned portBASE_TYPE uxLED )
+{
+unsigned portBASE_TYPE uxBaseAddress, *puxCurrentValue;
+
+ portENTER_CRITICAL();
+ {
+ /* Which IO section does the LED being toggled belong to? The
+ 4 bit or 5 bit outputs? */
+ if( uxLED <= partstMAX_4BIT_LED )
+ {
+ uxBaseAddress = XPAR_LEDS_4BIT_BASEADDR;
+ puxCurrentValue = &uxCurrentOutput4Bit;
+ }
+ else
+ {
+ uxBaseAddress = XPAR_LEDS_POSITIONS_BASEADDR;
+ puxCurrentValue = &uxCurrentOutput5Bit;
+ uxLED -= partstMAX_4BIT_LED;
+ }
+
+ /* Setup the bit mask accordingly. */
+ uxLED = 0x01 << uxLED;
+
+ /* Maintain the current output value. */
+ if( *puxCurrentValue & uxLED )
+ {
+ *puxCurrentValue &= ~uxLED;
+ }
+ else
+ {
+ *puxCurrentValue |= uxLED;
+ }
+
+ /* Write the value to the port. */
+ XGpio_mSetDataReg(uxBaseAddress, partstCHANNEL_1, *puxCurrentValue );
+ }
+ portEXIT_CRITICAL();
+}
+
+
diff --git a/Demo/PPC405_Xilinx_Virtex4_GCC/RTOSDemo/serial/serial.c b/Demo/PPC405_Xilinx_Virtex4_GCC/RTOSDemo/serial/serial.c
new file mode 100644
index 000000000..a610822d7
--- /dev/null
+++ b/Demo/PPC405_Xilinx_Virtex4_GCC/RTOSDemo/serial/serial.c
@@ -0,0 +1,227 @@
+/*
+ FreeRTOS.org V4.8.0 - Copyright (C) 2003-2008 Richard Barry.
+
+ This file is part of the FreeRTOS.org distribution.
+
+ FreeRTOS.org is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ FreeRTOS.org is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with FreeRTOS.org; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+ A special exception to the GPL can be applied should you wish to distribute
+ a combined work that includes FreeRTOS.org, without being obliged to provide
+ the source code for any proprietary components. See the licensing section
+ of http://www.FreeRTOS.org for full details of how and when the exception
+ can be applied.
+
+ ***************************************************************************
+ ***************************************************************************
+ * *
+ * SAVE TIME AND MONEY! We can port FreeRTOS.org to your own hardware, *
+ * and even write all or part of your application on your behalf. *
+ * See http://www.OpenRTOS.com for details of the services we provide to *
+ * expedite your project. *
+ * *
+ ***************************************************************************
+ ***************************************************************************
+
+ Please ensure to read the configuration and relevant port sections of the
+ online documentation.
+
+ http://www.FreeRTOS.org - Documentation, latest information, license and
+ contact details.
+
+ http://www.SafeRTOS.com - A version that is certified for use in safety
+ critical systems.
+
+ http://www.OpenRTOS.com - Commercial support, development, porting,
+ licensing and training services.
+*/
+
+
+/*
+ BASIC INTERRUPT DRIVEN SERIAL PORT DRIVER FOR UART
+*/
+
+/* Scheduler includes. */
+#include "FreeRTOS.h"
+#include "queue.h"
+#include "task.h"
+
+/* Demo application includes. */
+#include "serial.h"
+
+/* Library includes. */
+#include "xparameters.h"
+#include "xuartlite.h"
+#include "xuartlite_l.h"
+
+/*-----------------------------------------------------------*/
+
+/* Queues used to hold received characters, and characters waiting to be
+transmitted. */
+static xQueueHandle xRxedChars;
+static xQueueHandle xCharsForTx;
+
+/* Structure that maintains information on the UART being used. */
+static XUartLite xUART;
+
+/*
+ * Sample UART interrupt handler. Note this is used to demonstrate the kernel
+ * features and test the port - it is not intended to represent an efficient
+ * implementation.
+ */
+static void vSerialISR( XUartLite *pxUART );
+
+/*-----------------------------------------------------------*/
+
+xComPortHandle xSerialPortInitMinimal( unsigned portLONG ulWantedBaud, unsigned portBASE_TYPE uxQueueLength )
+{
+ /* NOTE: The baud rate used by this driver is determined by the hardware
+ parameterization of the UART Lite peripheral, and the baud value passed to
+ this function has no effect. */
+ ( void ) ulWantedBaud;
+
+ /* Create the queues used to hold Rx and Tx characters. */
+ xRxedChars = xQueueCreate( uxQueueLength, ( unsigned portBASE_TYPE ) sizeof( signed portCHAR ) );
+ xCharsForTx = xQueueCreate( uxQueueLength + 1, ( unsigned portBASE_TYPE ) sizeof( signed portCHAR ) );
+
+ /* Only initialise the UART if the queues were created correctly. */
+ if( ( xRxedChars != NULL ) && ( xCharsForTx != NULL ) )
+ {
+
+ XUartLite_Initialize( &xUART, XPAR_RS232_UART_DEVICE_ID );
+ XUartLite_ResetFifos( &xUART );
+ XUartLite_DisableInterrupt( &xUART );
+
+ if( xPortInstallInterruptHandler( XPAR_XPS_INTC_0_RS232_UART_INTERRUPT_INTR, ( XInterruptHandler )vSerialISR, (void *)&xUART ) == pdPASS )
+ {
+ /* xPortInstallInterruptHandler() could fail if
+ vPortSetupInterruptController() has not been called prior to this
+ function. */
+ XUartLite_EnableInterrupt( &xUART );
+ }
+ }
+
+ /* There is only one port so the handle is not used. */
+ return ( xComPortHandle ) 0;
+}
+/*-----------------------------------------------------------*/
+
+signed portBASE_TYPE xSerialGetChar( xComPortHandle pxPort, signed portCHAR *pcRxedChar, portTickType xBlockTime )
+{
+ /* The port handle is not required as this driver only supports one UART. */
+ ( void ) pxPort;
+
+ /* Get the next character from the buffer. Return false if no characters
+ are available, or arrive before xBlockTime expires. */
+ if( xQueueReceive( xRxedChars, pcRxedChar, xBlockTime ) )
+ {
+ return pdTRUE;
+ }
+ else
+ {
+ return pdFALSE;
+ }
+}
+/*-----------------------------------------------------------*/
+
+signed portBASE_TYPE xSerialPutChar( xComPortHandle pxPort, signed portCHAR cOutChar, portTickType xBlockTime )
+{
+portBASE_TYPE xReturn = pdTRUE;
+
+ portENTER_CRITICAL();
+ {
+ /* If the UART FIFO is full we can block posting the new data on the
+ Tx queue. */
+ if( XUartLite_mIsTransmitFull( XPAR_RS232_UART_BASEADDR ) )
+ {
+ if( xQueueSend( xCharsForTx, &cOutChar, xBlockTime ) != pdPASS )
+ {
+ xReturn = pdFAIL;
+ }
+ }
+ /* Otherwise, if there is data already in the queue we should add the
+ new data to the back of the queue to ensure the sequencing is
+ maintained. */
+ else if( uxQueueMessagesWaiting( xCharsForTx ) )
+ {
+ if( xQueueSend( xCharsForTx, &cOutChar, xBlockTime ) != pdPASS )
+ {
+ xReturn = pdFAIL;
+ }
+ }
+ /* If the UART FIFO is not full and there is no data already in the
+ queue we can write directly to the FIFO without disrupting the
+ sequence. */
+ else
+ {
+ XIo_Out32( XPAR_RS232_UART_BASEADDR + XUL_TX_FIFO_OFFSET, cOutChar );
+ }
+ }
+ portEXIT_CRITICAL();
+
+ return xReturn;
+}
+/*-----------------------------------------------------------*/
+
+void vSerialClose( xComPortHandle xPort )
+{
+ /* Not supported as not required by the demo application. */
+ ( void ) xPort;
+}
+/*-----------------------------------------------------------*/
+
+static void vSerialISR( XUartLite *pxUART )
+{
+unsigned portLONG ulISRStatus;
+portBASE_TYPE xTaskWokenByTx = pdFALSE, xTaskWokenByRx = pdFALSE, lDidSomething;
+portCHAR cChar;
+
+ do
+ {
+ lDidSomething = pdFALSE;
+
+ ulISRStatus = XIo_In32( XPAR_RS232_UART_BASEADDR + XUL_STATUS_REG_OFFSET );
+
+ if( ( ulISRStatus & XUL_SR_RX_FIFO_VALID_DATA ) != 0 )
+ {
+ /* A character is available - place it in the queue of received
+ characters. This might wake a task that was blocked waiting for
+ data. */
+ cChar = ( portCHAR ) XIo_In32( XPAR_RS232_UART_BASEADDR + XUL_RX_FIFO_OFFSET );
+ xTaskWokenByRx = xQueueSendFromISR( xRxedChars, &cChar, xTaskWokenByRx );
+ lDidSomething = pdTRUE;
+ }
+
+ if( ( ulISRStatus & XUL_SR_TX_FIFO_EMPTY ) != 0 )
+ {
+ /* There is space in the FIFO - if there are any characters queue for
+ transmission they can be sent to the UART now. This might unblock a
+ task that was waiting for space to become available on the Tx queue. */
+ if( xQueueReceiveFromISR( xCharsForTx, &cChar, &xTaskWokenByTx ) == pdTRUE )
+ {
+ XIo_Out32( XPAR_RS232_UART_BASEADDR + XUL_TX_FIFO_OFFSET, cChar );
+ lDidSomething = pdTRUE;
+ }
+ }
+ } while( lDidSomething == pdTRUE );
+
+ /* If we woke any tasks we may require a context switch. */
+ if( xTaskWokenByTx || xTaskWokenByRx )
+ {
+ portYIELD_FROM_ISR();
+ }
+}
+
+
+
diff --git a/Demo/PPC405_Xilinx_Virtex4_GCC/TestApp_Peripheral/executable.elf b/Demo/PPC405_Xilinx_Virtex4_GCC/TestApp_Peripheral/executable.elf
new file mode 100644
index 000000000..b7d9312ec
Binary files /dev/null and b/Demo/PPC405_Xilinx_Virtex4_GCC/TestApp_Peripheral/executable.elf differ
diff --git a/Demo/PPC405_Xilinx_Virtex4_GCC/TestApp_Peripheral/src/TestApp_Peripheral.c b/Demo/PPC405_Xilinx_Virtex4_GCC/TestApp_Peripheral/src/TestApp_Peripheral.c
new file mode 100644
index 000000000..c352d1b33
--- /dev/null
+++ b/Demo/PPC405_Xilinx_Virtex4_GCC/TestApp_Peripheral/src/TestApp_Peripheral.c
@@ -0,0 +1,107 @@
+/*
+ *
+ * Xilinx, Inc.
+ * XILINX IS PROVIDING THIS DESIGN, CODE, OR INFORMATION "AS IS" AS A
+ * COURTESY TO YOU. BY PROVIDING THIS DESIGN, CODE, OR INFORMATION AS
+ * ONE POSSIBLE IMPLEMENTATION OF THIS FEATURE, APPLICATION OR
+ * STANDARD, XILINX IS MAKING NO REPRESENTATION THAT THIS IMPLEMENTATION
+ * IS FREE FROM ANY CLAIMS OF INFRINGEMENT, AND YOU ARE RESPONSIBLE
+ * FOR OBTAINING ANY RIGHTS YOU MAY REQUIRE FOR YOUR IMPLEMENTATION
+ * XILINX EXPRESSLY DISCLAIMS ANY WARRANTY WHATSOEVER WITH RESPECT TO
+ * THE ADEQUACY OF THE IMPLEMENTATION, INCLUDING BUT NOT LIMITED TO
+ * ANY WARRANTIES OR REPRESENTATIONS THAT THIS IMPLEMENTATION IS FREE
+ * FROM CLAIMS OF INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY
+ * AND FITNESS FOR A PARTICULAR PURPOSE.
+ */
+
+/*
+ * Xilinx EDK 10.1 EDK_K.15
+ *
+ * This file is a sample test application
+ *
+ * This application is intended to test and/or illustrate some
+ * functionality of your system. The contents of this file may
+ * vary depending on the IP in your system and may use existing
+ * IP driver functions. These drivers will be generated in your
+ * XPS project when you run the "Generate Libraries" menu item
+ * in XPS.
+ *
+ * Your XPS project directory is at:
+ * C:\E\Dev\FreeRTOS\WorkingCopy2\Demo\PPC405_Xilinx_Virtex4_GCC\
+ */
+
+
+// Located in: ppc405_0/include/xparameters.h
+#include "xparameters.h"
+
+#include "xcache_l.h"
+
+#include "xintc.h"
+#include "xexception_l.h"
+#include "intc_header.h"
+#include "xuartlite.h"
+#include "uartlite_header.h"
+#include "uartlite_intr_header.h"
+#include "xbasic_types.h"
+#include "xgpio.h"
+#include "gpio_header.h"
+
+//====================================================
+
+int main (void) {
+
+
+ static XIntc intc;
+
+ XCache_EnableICache(0x00000001);
+ XCache_EnableDCache(0x00000001);
+ static XUartLite RS232_Uart_UartLite;
+
+
+ {
+ XStatus status;
+
+// status = IntcSelfTestExample(XPAR_XPS_INTC_0_DEVICE_ID);
+
+ }
+
+ {
+ XStatus Status;
+
+// Status = IntcInterruptSetup(&intc, XPAR_XPS_INTC_0_DEVICE_ID);
+
+ }
+
+
+ {
+ XStatus status;
+
+ // status = UartLiteSelfTestExample(XPAR_RS232_UART_DEVICE_ID);
+ }
+
+ {
+ XStatus Status;
+// Status = UartLiteIntrExample(&intc, &RS232_Uart_UartLite, \
+// XPAR_RS232_UART_DEVICE_ID, \
+// XPAR_XPS_INTC_0_RS232_UART_INTERRUPT_INTR);
+ }
+
+
+ {
+ XStatus status;
+
+ status = GpioOutputExample(XPAR_LEDS_4BIT_DEVICE_ID,4);
+ }
+
+
+ {
+ XStatus status;
+
+ status = GpioOutputExample(XPAR_LEDS_POSITIONS_DEVICE_ID,5);
+ }
+
+ XCache_DisableDCache();
+ XCache_DisableICache();
+ return 0;
+}
+
diff --git a/Demo/PPC405_Xilinx_Virtex4_GCC/TestApp_Peripheral/src/TestApp_Peripheral_LinkScr.ld b/Demo/PPC405_Xilinx_Virtex4_GCC/TestApp_Peripheral/src/TestApp_Peripheral_LinkScr.ld
new file mode 100644
index 000000000..39fbb5494
--- /dev/null
+++ b/Demo/PPC405_Xilinx_Virtex4_GCC/TestApp_Peripheral/src/TestApp_Peripheral_LinkScr.ld
@@ -0,0 +1,224 @@
+/*******************************************************************/
+/* */
+/* This file is automatically generated by linker script generator.*/
+/* */
+/* Version: Xilinx EDK 10.1 EDK_K.15 */
+/* */
+/* Copyright (c) 2004 Xilinx, Inc. All rights reserved. */
+/* */
+/* Description : PowerPC405 Linker Script */
+/* */
+/*******************************************************************/
+
+_STACK_SIZE = DEFINED(_STACK_SIZE) ? _STACK_SIZE : 0x2000;
+_HEAP_SIZE = DEFINED(_HEAP_SIZE) ? _HEAP_SIZE : 0x2000;
+
+/* Define Memories in the system */
+
+MEMORY
+{
+ SRAM_C_MEM0_BASEADDR : ORIGIN = 0xFFF00000, LENGTH = 0x000FFFEC
+}
+
+/* Specify the default entry point to the program */
+
+ENTRY(_boot)
+STARTUP(boot.o)
+
+/* Define the sections, and where they are mapped in memory */
+
+SECTIONS
+{
+.vectors : {
+ __vectors_start = .;
+ *(.vectors)
+ __vectors_end = .;
+} > SRAM_C_MEM0_BASEADDR
+
+.text : {
+ *(.text)
+ *(.text.*)
+ *(.gnu.linkonce.t.*)
+} > SRAM_C_MEM0_BASEADDR
+
+.init : {
+ KEEP (*(.init))
+} > SRAM_C_MEM0_BASEADDR
+
+.fini : {
+ KEEP (*(.fini))
+} > SRAM_C_MEM0_BASEADDR
+
+.rodata : {
+ __rodata_start = .;
+ *(.rodata)
+ *(.rodata.*)
+ *(.gnu.linkonce.r.*)
+ __rodata_end = .;
+} > SRAM_C_MEM0_BASEADDR
+
+.rodata1 : {
+ __rodata1_start = .;
+ *(.rodata1)
+ *(.rodata1.*)
+ __rodata1_end = .;
+} > SRAM_C_MEM0_BASEADDR
+
+.sdata2 : {
+ __sdata2_start = .;
+ *(.sdata2)
+ *(.sdata2.*)
+ *(.gnu.linkonce.s2.*)
+ __sdata2_end = .;
+} > SRAM_C_MEM0_BASEADDR
+
+.sbss2 : {
+ __sbss2_start = .;
+ *(.sbss2)
+ *(.sbss2.*)
+ *(.gnu.linkonce.sb2.*)
+ __sbss2_end = .;
+} > SRAM_C_MEM0_BASEADDR
+
+.data : {
+ __data_start = .;
+ *(.data)
+ *(.data.*)
+ *(.gnu.linkonce.d.*)
+ __data_end = .;
+} > SRAM_C_MEM0_BASEADDR
+
+.data1 : {
+ __data1_start = .;
+ *(.data1)
+ *(.data1.*)
+ __data1_end = .;
+} > SRAM_C_MEM0_BASEADDR
+
+.got : {
+ *(.got)
+} > SRAM_C_MEM0_BASEADDR
+
+.got1 : {
+ *(.got1)
+} > SRAM_C_MEM0_BASEADDR
+
+.got2 : {
+ *(.got2)
+} > SRAM_C_MEM0_BASEADDR
+
+.ctors : {
+ __CTOR_LIST__ = .;
+ ___CTORS_LIST___ = .;
+ KEEP (*crtbegin.o(.ctors))
+ KEEP (*(EXCLUDE_FILE(*crtend.o) .ctors))
+ KEEP (*(SORT(.ctors.*)))
+ KEEP (*(.ctors))
+ __CTOR_END__ = .;
+ ___CTORS_END___ = .;
+} > SRAM_C_MEM0_BASEADDR
+
+.dtors : {
+ __DTOR_LIST__ = .;
+ ___DTORS_LIST___ = .;
+ KEEP (*crtbegin.o(.dtors))
+ KEEP (*(EXCLUDE_FILE(*crtend.o) .dtors))
+ KEEP (*(SORT(.dtors.*)))
+ KEEP (*(.dtors))
+ __DTOR_END__ = .;
+ ___DTORS_END___ = .;
+} > SRAM_C_MEM0_BASEADDR
+
+.fixup : {
+ __fixup_start = .;
+ *(.fixup)
+ __fixup_end = .;
+} > SRAM_C_MEM0_BASEADDR
+
+.eh_frame : {
+ *(.eh_frame)
+} > SRAM_C_MEM0_BASEADDR
+
+.jcr : {
+ *(.jcr)
+} > SRAM_C_MEM0_BASEADDR
+
+.gcc_except_table : {
+ *(.gcc_except_table)
+} > SRAM_C_MEM0_BASEADDR
+
+.sdata : {
+ __sdata_start = .;
+ *(.sdata)
+ *(.sdata.*)
+ *(.gnu.linkonce.s.*)
+ __sdata_end = .;
+} > SRAM_C_MEM0_BASEADDR
+
+.sbss : {
+ __sbss_start = .;
+ *(.sbss)
+ *(.sbss.*)
+ *(.gnu.linkonce.sb.*)
+ *(.scommon)
+ __sbss_end = .;
+} > SRAM_C_MEM0_BASEADDR
+
+.tdata : {
+ __tdata_start = .;
+ *(.tdata)
+ *(.tdata.*)
+ *(.gnu.linkonce.td.*)
+ __tdata_end = .;
+} > SRAM_C_MEM0_BASEADDR
+
+.tbss : {
+ __tbss_start = .;
+ *(.tbss)
+ *(.tbss.*)
+ *(.gnu.linkonce.tb.*)
+ __tbss_end = .;
+} > SRAM_C_MEM0_BASEADDR
+
+.bss : {
+ __bss_start = .;
+ *(.bss)
+ *(.bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ . = ALIGN(4);
+ __bss_end = .;
+} > SRAM_C_MEM0_BASEADDR
+
+.boot0 0xFFFFFFEC : {
+ __boot0_start = .;
+ *(.boot0)
+ __boot0_end = .;
+}
+
+.boot 0xFFFFFFFC : {
+ __boot_start = .;
+ *(.boot)
+ __boot_end = .;
+}
+
+/* Generate Stack and Heap Sections */
+
+.stack : {
+ _stack_end = .;
+ . += _STACK_SIZE;
+ . = ALIGN(16);
+ __stack = .;
+} > SRAM_C_MEM0_BASEADDR
+
+.heap : {
+ . = ALIGN(16);
+ _heap_start = .;
+ . += _HEAP_SIZE;
+ . = ALIGN(16);
+ _heap_end = .;
+ _end = .;
+} > SRAM_C_MEM0_BASEADDR
+
+}
+
diff --git a/Demo/PPC405_Xilinx_Virtex4_GCC/TestApp_Peripheral/src/gpio_header.h b/Demo/PPC405_Xilinx_Virtex4_GCC/TestApp_Peripheral/src/gpio_header.h
new file mode 100644
index 000000000..1582a545e
--- /dev/null
+++ b/Demo/PPC405_Xilinx_Virtex4_GCC/TestApp_Peripheral/src/gpio_header.h
@@ -0,0 +1,12 @@
+#define TESTAPP_GEN
+
+/* $Id: gpio_header.h,v 1.1 2007/05/15 06:49:42 mta Exp $ */
+
+
+#include "xbasic_types.h"
+#include "xstatus.h"
+
+XStatus GpioOutputExample(Xuint16 DeviceId, Xuint32 GpioWidth);
+XStatus GpioInputExample(Xuint16 DeviceId, Xuint32 *DataRead);
+
+
diff --git a/Demo/PPC405_Xilinx_Virtex4_GCC/TestApp_Peripheral/src/intc_header.h b/Demo/PPC405_Xilinx_Virtex4_GCC/TestApp_Peripheral/src/intc_header.h
new file mode 100644
index 000000000..08a6f8b96
--- /dev/null
+++ b/Demo/PPC405_Xilinx_Virtex4_GCC/TestApp_Peripheral/src/intc_header.h
@@ -0,0 +1,12 @@
+#define TESTAPP_GEN
+
+/* $Id: intc_header.h,v 1.1 2007/05/15 07:08:08 mta Exp $ */
+
+
+#include "xbasic_types.h"
+#include "xstatus.h"
+
+XStatus IntcSelfTestExample(Xuint16 DeviceId);
+XStatus IntcInterruptSetup(XIntc *IntcInstancePtr, Xuint16 DeviceId);
+
+
diff --git a/Demo/PPC405_Xilinx_Virtex4_GCC/TestApp_Peripheral/src/uartlite_header.h b/Demo/PPC405_Xilinx_Virtex4_GCC/TestApp_Peripheral/src/uartlite_header.h
new file mode 100644
index 000000000..cb5cbeffc
--- /dev/null
+++ b/Demo/PPC405_Xilinx_Virtex4_GCC/TestApp_Peripheral/src/uartlite_header.h
@@ -0,0 +1,11 @@
+#define TESTAPP_GEN
+
+/* $Id: uartlite_header.h,v 1.1 2007/05/15 07:00:27 mta Exp $ */
+
+
+#include "xbasic_types.h"
+#include "xstatus.h"
+
+XStatus UartLiteSelfTestExample(Xuint16 DeviceId);
+
+
diff --git a/Demo/PPC405_Xilinx_Virtex4_GCC/TestApp_Peripheral/src/uartlite_intr_header.h b/Demo/PPC405_Xilinx_Virtex4_GCC/TestApp_Peripheral/src/uartlite_intr_header.h
new file mode 100644
index 000000000..93a099901
--- /dev/null
+++ b/Demo/PPC405_Xilinx_Virtex4_GCC/TestApp_Peripheral/src/uartlite_intr_header.h
@@ -0,0 +1,14 @@
+#define TESTAPP_GEN
+
+/* $Id: uartlite_intr_header.h,v 1.1 2007/05/15 07:00:27 mta Exp $ */
+
+
+#include "xbasic_types.h"
+#include "xstatus.h"
+
+XStatus UartLiteIntrExample(XIntc* IntcInstancePtr, \
+ XUartLite* UartLiteInstancePtr, \
+ Xuint16 UartLiteDeviceId, \
+ Xuint16 UartLiteIntrId);
+
+
diff --git a/Demo/PPC405_Xilinx_Virtex4_GCC/TestApp_Peripheral/src/xgpio_tapp_example.c b/Demo/PPC405_Xilinx_Virtex4_GCC/TestApp_Peripheral/src/xgpio_tapp_example.c
new file mode 100644
index 000000000..e5f199a56
--- /dev/null
+++ b/Demo/PPC405_Xilinx_Virtex4_GCC/TestApp_Peripheral/src/xgpio_tapp_example.c
@@ -0,0 +1,311 @@
+#define TESTAPP_GEN
+
+/* $Id: xgpio_tapp_example.c,v 1.1 2007/05/15 06:49:42 mta Exp $ */
+/******************************************************************************
+*
+* XILINX IS PROVIDING THIS DESIGN, CODE, OR INFORMATION "AS IS"
+* AS A COURTESY TO YOU, SOLELY FOR USE IN DEVELOPING PROGRAMS AND
+* SOLUTIONS FOR XILINX DEVICES. BY PROVIDING THIS DESIGN, CODE,
+* OR INFORMATION AS ONE POSSIBLE IMPLEMENTATION OF THIS FEATURE,
+* APPLICATION OR STANDARD, XILINX IS MAKING NO REPRESENTATION
+* THAT THIS IMPLEMENTATION IS FREE FROM ANY CLAIMS OF INFRINGEMENT,
+* AND YOU ARE RESPONSIBLE FOR OBTAINING ANY RIGHTS YOU MAY REQUIRE
+* FOR YOUR IMPLEMENTATION. XILINX EXPRESSLY DISCLAIMS ANY
+* WARRANTY WHATSOEVER WITH RESPECT TO THE ADEQUACY OF THE
+* IMPLEMENTATION, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OR
+* REPRESENTATIONS THAT THIS IMPLEMENTATION IS FREE FROM CLAIMS OF
+* INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+* FOR A PARTICULAR PURPOSE.
+*
+* (c) Copyright 2005 Xilinx Inc.
+* All rights reserved.
+*
+******************************************************************************/
+/*****************************************************************************/
+/**
+* @file xgpio_tapp_example.c
+*
+* This file contains a example for using GPIO hardware and driver.
+* This example assumes that there is a UART Device or STDIO Device in the
+* hardware system.
+*
+* This example can be run on the Xilinx ML300 board with either the PowerPC or
+* the MicroBlaze processor using the Prototype Pins & LEDs of the board
+* connected to the GPIO and the Push Buttons connected.
+*
+* @note
+*
+* None
+*
+*
+* MODIFICATION HISTORY:
+*
+* Ver Who Date Changes
+* ----- ---- -------- -----------------------------------------------
+* 1.00a sv 04/15/05 Initial release for TestApp integration.
+*
+*
+*****************************************************************************/
+
+/***************************** Include Files ********************************/
+
+#include "xparameters.h"
+#include "xgpio.h"
+#include "stdio.h"
+#include "xstatus.h"
+
+/************************** Constant Definitions ****************************/
+
+/*
+ * The following constant is used to wait after an LED is turned on to make
+ * sure that it is visible to the human eye. This constant might need to be
+ * tuned for faster or slower processor speeds.
+ */
+#define LED_DELAY 1000000
+
+/* following constant is used to determine which channel of the GPIO is
+ * used if there are 2 channels supported in the GPIO.
+ */
+#define LED_CHANNEL 1
+
+#define LED_MAX_BLINK 0x1 /* Number of times the LED Blinks */
+
+#define GPIO_BITWIDTH 16 /* This is the width of the GPIO */
+
+#define printf xil_printf /* A smaller footprint printf */
+
+/*
+ * The following constants map to the XPAR parameters created in the
+ * xparameters.h file. They are defined here such that a user can easily
+ * change all the needed parameters in one place.
+ */
+#ifndef TESTAPP_GEN
+#define GPIO_OUTPUT_DEVICE_ID XPAR_LEDS_4BIT_DEVICE_ID
+#define GPIO_INPUT_DEVICE_ID XPAR_LEDS_4BIT_DEVICE_ID
+#endif /* TESTAPP_GEN */
+
+/**************************** Type Definitions ******************************/
+
+
+/***************** Macros (Inline Functions) Definitions *******************/
+
+
+/************************** Function Prototypes ****************************/
+
+XStatus GpioOutputExample(Xuint16 DeviceId, Xuint32 GpioWidth);
+
+XStatus GpioInputExample(Xuint16 DeviceId, Xuint32 *DataRead);
+
+void GpioDriverHandler(void *CallBackRef);
+
+
+
+/************************** Variable Definitions **************************/
+
+/*
+ * The following are declared globally so they are zeroed and so they are
+ * easily accessible from a debugger
+ */
+XGpio GpioOutput; /* The driver instance for GPIO Device configured as O/P */
+XGpio GpioInput; /* The driver instance for GPIO Device configured as I/P */
+
+
+/*****************************************************************************/
+/**
+* Main function to call the example.This function is not included if the
+* example is generated from the TestAppGen test tool.
+*
+* @param None
+*
+* @return XST_SUCCESS if successful, XST_FAILURE if unsuccessful
+*
+* @note None
+*
+******************************************************************************/
+#ifndef TESTAPP_GEN
+int main(void)
+{
+ XStatus Status;
+ Xuint32 InputData;
+
+ Status = GpioOutputExample(GPIO_OUTPUT_DEVICE_ID, GPIO_BITWIDTH);
+ if (Status != XST_SUCCESS)
+ {
+ return XST_FAILURE;
+ }
+
+ Status = GpioInputExample(GPIO_INPUT_DEVICE_ID, &InputData);
+ if (Status != XST_SUCCESS)
+ {
+ return XST_FAILURE;
+ }
+
+ printf("Data read from GPIO Input is 0x%x \n", (int)InputData);
+
+ return XST_SUCCESS;
+}
+#endif
+
+
+/*****************************************************************************/
+/**
+*
+* This function does a minimal test on the GPIO device configured as OUTPUT
+* and driver as a example.
+*
+*
+* @param DeviceId is the XPAR__DEVICE_ID value from
+* xparameters.h
+* @param GpioWidth is the width of the GPIO
+*
+* @return XST_SUCCESS if successful, XST_FAILURE if unsuccessful
+*
+* @note None
+*
+****************************************************************************/
+XStatus GpioOutputExample(Xuint16 DeviceId, Xuint32 GpioWidth)
+{
+ Xuint32 Data;
+ volatile int Delay;
+ Xuint32 LedBit;
+ Xuint32 LedLoop;
+ XStatus Status;
+
+ /*
+ * Initialize the GPIO driver so that it's ready to use,
+ * specify the device ID that is generated in xparameters.h
+ */
+ Status = XGpio_Initialize(&GpioOutput, DeviceId);
+ if (Status != XST_SUCCESS)
+ {
+ return XST_FAILURE;
+ }
+
+
+ /*
+ * Set the direction for all signals to be outputs
+ */
+ XGpio_SetDataDirection(&GpioOutput, LED_CHANNEL, 0x0);
+
+ /*
+ * Set the GPIO outputs to low
+ */
+ XGpio_DiscreteWrite(&GpioOutput, LED_CHANNEL, 0x0);
+
+ for (LedBit = 0x0; LedBit < GpioWidth; LedBit++)
+ {
+
+ for (LedLoop = 0; LedLoop < LED_MAX_BLINK; LedLoop++)
+ {
+
+ /*
+ * Set the GPIO Output to High
+ */
+ XGpio_DiscreteWrite(&GpioOutput, LED_CHANNEL, 1 << LedBit);
+
+#ifndef __SIM__
+ /*
+ * Wait a small amount of time so the LED is visible
+ */
+ for (Delay = 0; Delay < LED_DELAY; Delay++);
+
+#endif
+ /*
+ * Read the state of the data so that it can be verified
+ */
+ /* Data = XGpio_DiscreteRead(&GpioOutput, LED_CHANNEL); */
+
+
+ /*
+ * If the data read back is not the same as the data
+ * written then return FAILURE
+ */
+ /*if (Data != (1 << LedBit))
+ {
+ return XST_FAILURE;
+ }*/
+
+
+ /*
+ * Clear the GPIO Output
+ */
+ XGpio_DiscreteClear(&GpioOutput, LED_CHANNEL, 1 << LedBit);
+
+
+ /*
+ * Read the state of the data so that it can be verified
+ */
+ /* Data = XGpio_DiscreteRead(&GpioOutput, LED_CHANNEL);*/
+
+
+ /*
+ * If the data read back is not the same as the data
+ * written then return FAILURE
+ */
+ /* if (Data & ( 1 << LedBit))
+ {
+ return XST_FAILURE;
+ }*/
+
+
+#ifndef __SIM__
+ /*
+ * Wait a small amount of time so the LED is visible
+ */
+ for (Delay = 0; Delay < LED_DELAY; Delay++);
+#endif
+
+ }
+
+ }
+
+ return XST_SUCCESS;
+
+}
+
+
+/******************************************************************************/
+/**
+*
+* This function performs a test on the GPIO driver/device with the GPIO
+* configured as INPUT
+*
+* @param DeviceId is the XPAR__DEVICE_ID value from
+* xparameters.h
+* @param DataRead is the pointer where the data read from GPIO Input is
+* returned
+*
+* @return XST_SUCCESS if the Test is successful, otherwise XST_FAILURE
+*
+* @note None.
+*
+******************************************************************************/
+XStatus GpioInputExample(Xuint16 DeviceId, Xuint32 *DataRead)
+{
+ XStatus Status;
+
+ /*
+ * Initialize the GPIO driver so that it's ready to use,
+ * specify the device ID that is generated in xparameters.h
+ */
+ Status = XGpio_Initialize(&GpioInput, DeviceId);
+ if (Status != XST_SUCCESS)
+ {
+ return XST_FAILURE;
+ }
+
+ /*
+ * Set the direction for all signals to be inputs
+ */
+ XGpio_SetDataDirection(&GpioInput, LED_CHANNEL, 0xFFFFFFFF);
+
+ /*
+ * Read the state of the data so that it can be verified
+ */
+ *DataRead = XGpio_DiscreteRead(&GpioInput, LED_CHANNEL);
+
+ return XST_SUCCESS;
+
+}
+
+
diff --git a/Demo/PPC405_Xilinx_Virtex4_GCC/TestApp_Peripheral/src/xintc_tapp_example.c b/Demo/PPC405_Xilinx_Virtex4_GCC/TestApp_Peripheral/src/xintc_tapp_example.c
new file mode 100644
index 000000000..de77eac89
--- /dev/null
+++ b/Demo/PPC405_Xilinx_Virtex4_GCC/TestApp_Peripheral/src/xintc_tapp_example.c
@@ -0,0 +1,263 @@
+#define TESTAPP_GEN
+
+
+/* $Id: xintc_tapp_example.c,v 1.1 2007/05/15 07:08:09 mta Exp $ */
+/******************************************************************************
+*
+* XILINX IS PROVIDING THIS DESIGN, CODE, OR INFORMATION "AS IS"
+* AS A COURTESY TO YOU, SOLELY FOR USE IN DEVELOPING PROGRAMS AND
+* SOLUTIONS FOR XILINX DEVICES. BY PROVIDING THIS DESIGN, CODE,
+* OR INFORMATION AS ONE POSSIBLE IMPLEMENTATION OF THIS FEATURE,
+* APPLICATION OR STANDARD, XILINX IS MAKING NO REPRESENTATION
+* THAT THIS IMPLEMENTATION IS FREE FROM ANY CLAIMS OF INFRINGEMENT,
+* AND YOU ARE RESPONSIBLE FOR OBTAINING ANY RIGHTS YOU MAY REQUIRE
+* FOR YOUR IMPLEMENTATION. XILINX EXPRESSLY DISCLAIMS ANY
+* WARRANTY WHATSOEVER WITH RESPECT TO THE ADEQUACY OF THE
+* IMPLEMENTATION, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OR
+* REPRESENTATIONS THAT THIS IMPLEMENTATION IS FREE FROM CLAIMS OF
+* INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+* FOR A PARTICULAR PURPOSE.
+*
+* (c) Copyright 2002-2006 Xilinx Inc.
+* All rights reserved.
+*
+*******************************************************************************/
+/******************************************************************************/
+/**
+*
+* @file xintc_tapp_example.c
+*
+* This file contains a self test example using the Interrupt Controller driver
+* (XIntc) and hardware device. Please reference other device driver examples to
+* see more examples of how the intc and interrupts can be used by a software
+* application.
+*
+* This example shows the use of the Interrupt Controller both with a PowerPC405
+* and MicroBlaze processor.
+*
+* The TestApp Gen utility uses this file to perform the self test and setup
+* of intc for interrupts.
+*
+* @note
+*
+* None
+*
+*
+*
+* MODIFICATION HISTORY:
+*
+* Ver Who Date Changes
+* ----- ---- -------- --------------------------------------------------------
+* 1.00a sv 06/29/05 Created for Test App Integration
+* 1.00c sn 05/09/06 Added Interrupt Setup Function
+*
+******************************************************************************/
+
+/***************************** Include Files *********************************/
+
+#include "xparameters.h"
+#include "xstatus.h"
+#include "xintc.h"
+#ifdef __MICROBLAZE__
+#include "mb_interface.h"
+#endif
+#ifdef __PPC__
+#include "xexception_l.h"
+#endif
+
+
+/************************** Constant Definitions *****************************/
+
+/*
+ * The following constants map to the XPAR parameters created in the
+ * xparameters.h file. They are defined here such that a user can easily
+ * change all the needed parameters in one place. This definition is not
+ * included if the example is generated from the TestAppGen test tool.
+ */
+#ifndef TESTAPP_GEN
+#define INTC_DEVICE_ID XPAR_OPB_INTC_0_DEVICE_ID
+#endif
+
+/**************************** Type Definitions *******************************/
+
+
+/***************** Macros (Inline Functions) Definitions *********************/
+
+
+/************************** Function Prototypes ******************************/
+
+XStatus IntcSelfTestExample(Xuint16 DeviceId);
+XStatus IntcInterruptSetup(XIntc *IntcInstancePtr, Xuint16 DeviceId);
+
+/************************** Variable Definitions *****************************/
+
+static XIntc InterruptController; /* Instance of the Interrupt Controller */
+
+
+/*****************************************************************************/
+/**
+*
+* This is the main function for the Interrupt Controller example. This
+* function is not included if the example is generated from the TestAppGen test
+* tool.
+*
+* @param None.
+*
+* @return XST_SUCCESS to indicate success, otherwise XST_FAILURE.
+*
+* @note None.
+*
+******************************************************************************/
+#ifndef TESTAPP_GEN
+int main(void)
+{
+ XStatus Status;
+
+ /*
+ * Run the Intc example , specify the Device ID generated in xparameters.h
+ */
+ Status = IntcSelfTestExample(INTC_DEVICE_ID);
+ if (Status != XST_SUCCESS)
+ {
+ return XST_FAILURE;
+ }
+
+ return XST_SUCCESS;
+
+}
+#endif
+
+/*****************************************************************************/
+/**
+*
+* This function runs a self-test on the driver/device. This is a destructive
+* test. This function is an example of how to use the interrupt controller
+* driver component (XIntc) and the hardware device. This function is designed
+* to work without any hardware devices to cause interrupts. It may not return
+* if the interrupt controller is not properly connected to the processor in
+* either software or hardware.
+*
+* This function relies on the fact that the interrupt controller hardware
+* has come out of the reset state such that it will allow interrupts to be
+* simulated by the software.
+*
+* @param DeviceId is device ID of the Interrupt Controller Device , typically
+* XPAR__DEVICE_ID value from xparameters.h
+*
+* @return XST_SUCCESS to indicate success, otherwise XST_FAILURE
+*
+* @note None.
+*
+******************************************************************************/
+XStatus IntcSelfTestExample(Xuint16 DeviceId)
+{
+ XStatus Status;
+
+ /*
+ * Initialize the interrupt controller driver so that it is ready to use.
+ */
+ Status = XIntc_Initialize(&InterruptController, DeviceId);
+ if (Status != XST_SUCCESS)
+ {
+ return XST_FAILURE;
+ }
+
+
+ /*
+ * Perform a self-test to ensure that the hardware was built correctly
+ */
+ Status = XIntc_SelfTest(&InterruptController);
+ if (Status != XST_SUCCESS)
+ {
+ return XST_FAILURE;
+ }
+
+ return XST_SUCCESS;
+
+}
+
+
+/*****************************************************************************/
+/**
+*
+* This function is used by the TestAppGen generated application to setup
+* the interrupt controller.
+*
+* @param IntcInstancePtr is the reference to the Interrupt Controller
+* instance.
+* @param DeviceId is device ID of the Interrupt Controller Device , typically
+* XPAR__DEVICE_ID value from xparameters.h
+*
+* @return XST_SUCCESS to indicate success, otherwise XST_FAILURE
+*
+* @note None.
+*
+******************************************************************************/
+XStatus IntcInterruptSetup(XIntc *IntcInstancePtr, Xuint16 DeviceId)
+{
+
+ XStatus Status;
+
+ /*
+ * Initialize the interrupt controller driver so that it is ready to use.
+ */
+ Status = XIntc_Initialize(IntcInstancePtr, DeviceId);
+ if (Status != XST_SUCCESS)
+ {
+ return XST_FAILURE;
+ }
+
+ /*
+ * Perform a self-test to ensure that the hardware was built correctly.
+ */
+ Status = XIntc_SelfTest(IntcInstancePtr);
+ if (Status != XST_SUCCESS)
+ {
+ return XST_FAILURE;
+ }
+
+
+#ifdef __MICROBLAZE__
+ /*
+ * Enable the microblaze Interrupts
+ */
+ microblaze_enable_interrupts();
+#endif
+
+#ifdef __PPC__ /*PPC*/
+
+ /*
+ * Initialize the PPC405 exception table
+ */
+ XExc_Init();
+
+ /*
+ * Register the interrupt controller handler with the exception table
+ */
+ XExc_RegisterHandler(XEXC_ID_NON_CRITICAL_INT,
+ (XExceptionHandler)XIntc_DeviceInterruptHandler,
+ (void*) 0);
+
+ /*
+ * Enable non-critical exceptions
+ */
+ XExc_mEnableExceptions(XEXC_NON_CRITICAL);
+#endif
+
+
+ /*
+ * Start the interrupt controller such that interrupts are enabled for
+ * all devices that cause interrupts.
+ */
+ Status = XIntc_Start(IntcInstancePtr, XIN_REAL_MODE);
+ if (Status != XST_SUCCESS)
+ {
+ return XST_FAILURE;
+ }
+
+ return XST_SUCCESS;
+
+}
+
+
+
diff --git a/Demo/PPC405_Xilinx_Virtex4_GCC/TestApp_Peripheral/src/xuartlite_intr_tapp_example.c b/Demo/PPC405_Xilinx_Virtex4_GCC/TestApp_Peripheral/src/xuartlite_intr_tapp_example.c
new file mode 100644
index 000000000..09109b82e
--- /dev/null
+++ b/Demo/PPC405_Xilinx_Virtex4_GCC/TestApp_Peripheral/src/xuartlite_intr_tapp_example.c
@@ -0,0 +1,461 @@
+#define TESTAPP_GEN
+
+/* $Id: xuartlite_intr_tapp_example.c,v 1.1 2007/05/15 07:00:27 mta Exp $ */
+/*****************************************************************************
+*
+* XILINX IS PROVIDING THIS DESIGN, CODE, OR INFORMATION "AS IS"
+* AS A COURTESY TO YOU, SOLELY FOR USE IN DEVELOPING PROGRAMS AND
+* SOLUTIONS FOR XILINX DEVICES. BY PROVIDING THIS DESIGN, CODE,
+* OR INFORMATION AS ONE POSSIBLE IMPLEMENTATION OF THIS FEATURE,
+* APPLICATION OR STANDARD, XILINX IS MAKING NO REPRESENTATION
+* THAT THIS IMPLEMENTATION IS FREE FROM ANY CLAIMS OF INFRINGEMENT,
+* AND YOU ARE RESPONSIBLE FOR OBTAINING ANY RIGHTS YOU MAY REQUIRE
+* FOR YOUR IMPLEMENTATION. XILINX EXPRESSLY DISCLAIMS ANY
+* WARRANTY WHATSOEVER WITH RESPECT TO THE ADEQUACY OF THE
+* IMPLEMENTATION, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OR
+* REPRESENTATIONS THAT THIS IMPLEMENTATION IS FREE FROM CLAIMS OF
+* INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+* FOR A PARTICULAR PURPOSE.
+*
+* (c) Copyright 2002-2006 Xilinx Inc.
+* All rights reserved.
+*
+*******************************************************************************/
+/******************************************************************************/
+/**
+*
+* @file xuartlite_intr_tapp_example.c
+*
+* This file contains a design example using the UartLite driver and
+* hardware device using the interrupt mode for transmission of data.
+*
+* This example works with a PPC processor. Refer the examples of Interrupt
+* controller for an example of using interrupts with the MicroBlaze processor.
+*
+* @note
+*
+* None.
+*
+*
+* MODIFICATION HISTORY:
+*
+* Ver Who Date Changes
+* ----- ---- -------- -----------------------------------------------
+* 1.00b sv 06/08/06 Created for supporting Test App Interrupt examples
+*
+******************************************************************************/
+
+/***************************** Include Files *********************************/
+
+#include "xparameters.h"
+#include "xuartlite.h"
+#include "xintc.h"
+
+#ifdef __MICROBLAZE__
+#include "mb_interface.h"
+#else
+#include "xexception_l.h"
+#endif
+
+
+/************************** Constant Definitions *****************************/
+
+/*
+ * The following constants map to the XPAR parameters created in the
+ * xparameters.h file. They are defined here such that a user can easily
+ * change all the needed parameters in one place.
+ */
+#ifndef TESTAPP_GEN
+#define UARTLITE_DEVICE_ID XPAR_RS232_UART_DEVICE_ID
+#define INTC_DEVICE_ID XPAR_OPB_INTC_0_DEVICE_ID
+#define UARTLITE_IRPT_INTR XPAR_OPB_INTC_0_RS232_UART_INTERRUPT_INTR
+#endif
+
+/*
+ * The following constant controls the length of the buffers to be sent
+ * and received with the UartLite device.
+ */
+#define TEST_BUFFER_SIZE 100
+
+
+/**************************** Type Definitions *******************************/
+
+
+/***************** Macros (Inline Functions) Definitions *********************/
+
+
+/************************** Function Prototypes ******************************/
+
+XStatus UartLiteIntrExample(XIntc *IntcInstancePtr,
+ XUartLite *UartLiteInstancePtr,
+ Xuint16 UartLiteDeviceId,
+ Xuint16 UartLiteIntrId);
+
+
+static void UartLiteSendHandler(void *CallBackRef, unsigned int EventData);
+
+static void UartLiteRecvHandler(void *CallBackRef, unsigned int EventData);
+
+
+static XStatus UartLiteSetupIntrSystem(XIntc *IntcInstancePtr,
+ XUartLite *UartLiteInstancePtr,
+ Xuint16 UartLiteIntrId);
+
+static void UartLiteDisableIntrSystem(XIntc *IntrInstancePtr,
+ Xuint16 UartLiteIntrId);
+
+
+/************************** Variable Definitions *****************************/
+
+/*
+ * The instances to support the device drivers are global such that the
+ * are initialized to zero each time the program runs.
+ */
+#ifndef TESTAPP_GEN
+static XIntc IntcInstance; /* The instance of the Interrupt Controller */
+static XUartLite UartLiteInst; /* The instance of the UartLite Device */
+#endif
+
+
+
+/*
+ * The following variables are shared between non-interrupt processing and
+ * interrupt processing such that they must be global.
+ */
+
+/*
+ * The following buffers are used in this example to send and receive data
+ * with the UartLite.
+ */
+Xuint8 SendBuffer[TEST_BUFFER_SIZE];
+Xuint8 ReceiveBuffer[TEST_BUFFER_SIZE];
+
+/*
+ * The following counter is used to determine when the entire buffer has
+ * been sent.
+ */
+static volatile int TotalSentCount;
+
+
+/******************************************************************************/
+/**
+*
+* Main function to call the UartLite interrupt example.
+*
+* @param None.
+*
+* @return XST_SUCCESS if successful, else XST_FAILURE.
+*
+* @note None
+*
+*******************************************************************************/
+#ifndef TESTAPP_GEN
+int main(void)
+{
+ XStatus Status;
+
+ /*
+ * Run the UartLite Interrupt example , specify the Device ID that is
+ * generated in xparameters.h.
+ */
+ Status = UartLiteIntrExample(&IntcInstance,
+ &UartLiteInst,
+ UARTLITE_DEVICE_ID,
+ UARTLITE_IRPT_INTR);
+ if (Status != XST_SUCCESS)
+ {
+ return XST_FAILURE;
+ }
+
+ return XST_SUCCESS;
+}
+#endif
+
+/****************************************************************************/
+/**
+*
+* This function does a minimal test on the UartLite device and driver as a
+* design example. The purpose of this function is to illustrate how to use
+* the XUartLite component.
+*
+* This function sends data and expects to receive the same data through the
+* UartLite. The user must provide a physical loopback such that data which
+* is transmitted will be received.
+*
+* This function uses the interrupt driver mode of the UartLite. The calls to
+* the UartLite driver in the interrupt handlers, should only use the
+* non-blocking calls.
+*
+* @param IntcInstancePtr is a pointer to the instance of the INTC component.
+* @param UartLiteInstPtr is a pointer to the instance of UartLite component.
+* @param UartLiteDeviceId is the Device ID of the UartLite Device and is the
+* XPAR__DEVICE_ID value from xparameters.h.
+* @param UartLiteIntrId is the Interrupt ID and is typically
+* XPAR___IP2INTC_IRPT_INTR
+* value from xparameters.h.
+*
+* @return XST_SUCCESS if successful, otherwise XST_FAILURE.
+*
+* @note
+*
+* This function contains an infinite loop such that if interrupts are not
+* working it may never return.
+*
+****************************************************************************/
+XStatus UartLiteIntrExample(XIntc *IntcInstancePtr,
+ XUartLite *UartLiteInstPtr,
+ Xuint16 UartLiteDeviceId,
+ Xuint16 UartLiteIntrId)
+
+{
+ XStatus Status;
+ Xuint32 Index;
+
+ /*
+ * Initialize the UartLite driver so that it's ready to use.
+ */
+ Status = XUartLite_Initialize(UartLiteInstPtr, UartLiteDeviceId);
+ if (Status != XST_SUCCESS)
+ {
+ return XST_FAILURE;
+ }
+
+ /*
+ * Perform a self-test to ensure that the hardware was built correctly.
+ */
+ Status = XUartLite_SelfTest(UartLiteInstPtr);
+ if (Status != XST_SUCCESS)
+ {
+ return XST_FAILURE;
+ }
+
+ /*
+ * Connect the UartLite to the interrupt subsystem such that interrupts can
+ * occur. This function is application specific.
+ */
+ Status = UartLiteSetupIntrSystem(IntcInstancePtr,
+ UartLiteInstPtr,
+ UartLiteIntrId);
+ if (Status != XST_SUCCESS)
+ {
+ return XST_FAILURE;
+ }
+
+ /*
+ * Setup the handlers for the UartLite that will be called from the
+ * interrupt context when data has been sent and received,
+ * specify a pointer to the UartLite driver instance as the callback
+ * reference so the handlers are able to access the instance data.
+ */
+ XUartLite_SetSendHandler(UartLiteInstPtr, UartLiteSendHandler,
+ UartLiteInstPtr);
+ XUartLite_SetRecvHandler(UartLiteInstPtr, UartLiteRecvHandler,
+ UartLiteInstPtr);
+
+ /*
+ * Enable the interrupt of the UartLite so that the interrupts will occur.
+ */
+ XUartLite_EnableInterrupt(UartLiteInstPtr);
+
+ /*
+ * Initialize the send buffer bytes with a pattern to send.
+ */
+ for (Index = 0; Index < TEST_BUFFER_SIZE; Index++)
+ {
+ SendBuffer[Index] = Index;
+ }
+
+ /*
+ * Send the buffer using the UartLite.
+ */
+ XUartLite_Send(UartLiteInstPtr, SendBuffer, TEST_BUFFER_SIZE);
+
+ /*
+ * Wait for the entire buffer to be transmitted, the function may get
+ * locked up in this loop if the interrupts are not working correctly.
+ */
+ while ((TotalSentCount != TEST_BUFFER_SIZE))
+ {
+ }
+
+
+ UartLiteDisableIntrSystem(IntcInstancePtr, UartLiteIntrId);
+
+ return XST_SUCCESS;
+}
+
+/*****************************************************************************/
+/**
+*
+* This function is the handler which performs processing to send data to the
+* UartLite. It is called from an interrupt context such that the amount of
+* processing performed should be minimized. It is called when the transmit
+* FIFO of the UartLite is empty and more data can be sent through the UartLite.
+*
+* This handler provides an example of how to handle data for the UartLite, but
+* is application specific.
+*
+* @param CallBackRef contains a callback reference from the driver.
+* In this case it is the instance pointer for the UartLite driver.
+* @param EventData contains the number of bytes sent or received for sent and
+* receive events.
+*
+* @return None.
+*
+* @note None.
+*
+****************************************************************************/
+static void UartLiteSendHandler(void *CallBackRef, unsigned int EventData)
+{
+ TotalSentCount = EventData;
+}
+
+/****************************************************************************/
+/**
+*
+* This function is the handler which performs processing to receive data from
+* the UartLite. It is called from an interrupt context such that the amount of
+* processing performed should be minimized. It is called when any data is
+* present in the receive FIFO of the UartLite such that the data can be
+* retrieved from the UartLite. The amount of data present in the FIFO is not
+* known when this function is called.
+*
+* This handler provides an example of how to handle data for the UartLite, but
+* is application specific.
+*
+* @param CallBackRef contains a callback reference from the driver, in this
+* case it is the instance pointer for the UartLite driver.
+* @param EventData contains the number of bytes sent or received for sent and
+* receive events.
+*
+* @return None.
+*
+* @note None.
+*
+****************************************************************************/
+static void UartLiteRecvHandler(void *CallBackRef, unsigned int EventData)
+{
+
+}
+
+/****************************************************************************/
+/**
+*
+* This function setups the interrupt system such that interrupts can occur
+* for the UartLite. This function is application specific since the actual
+* system may or may not have an interrupt controller. The UartLite could be
+* directly connected to a processor without an interrupt controller. The
+* user should modify this function to fit the application.
+*
+* @param IntcInstancePtr is a pointer to the instance of the INTC component.
+* @param UartLiteInstPtr is a pointer to the instance of UartLite component.
+* XPAR__DEVICE_ID value from xparameters.h.
+* @param UartLiteIntrId is the Interrupt ID and is typically
+* XPAR___IP2INTC_IRPT_INTR
+* value from xparameters.h.
+*
+* @return XST_SUCCESS if successful, otherwise XST_FAILURE.
+*
+* @note None.
+*
+****************************************************************************/
+XStatus UartLiteSetupIntrSystem(XIntc *IntcInstancePtr,
+ XUartLite *UartLiteInstPtr,
+ Xuint16 UartLiteIntrId)
+{
+ XStatus Status;
+
+#ifndef TESTAPP_GEN
+ /*
+ * Initialize the interrupt controller driver so that it is ready to use.
+ */
+ Status = XIntc_Initialize(IntcInstancePtr, INTC_DEVICE_ID);
+ if (Status != XST_SUCCESS)
+ {
+ return XST_FAILURE;
+ }
+#endif
+
+ /*
+ * Connect a device driver handler that will be called when an interrupt
+ * for the device occurs, the device driver handler performs the specific
+ * interrupt processing for the device.
+ */
+ Status = XIntc_Connect(IntcInstancePtr, UartLiteIntrId,
+ (XInterruptHandler)XUartLite_InterruptHandler,
+ (void *)UartLiteInstPtr);
+ if (Status != XST_SUCCESS)
+ {
+ return XST_FAILURE;
+ }
+
+#ifndef TESTAPP_GEN
+ /*
+ * Start the interrupt controller such that interrupts are enabled for
+ * all devices that cause interrupts, specific real mode so that
+ * the UART can cause interrupts thru the interrupt controller.
+ */
+ Status = XIntc_Start(IntcInstancePtr, XIN_REAL_MODE);
+ if (Status != XST_SUCCESS)
+ {
+ return XST_FAILURE;
+ }
+#endif
+
+ /*
+ * Enable the interrupt for the UartLite.
+ */
+ XIntc_Enable(IntcInstancePtr, UartLiteIntrId);
+
+#ifndef TESTAPP_GEN
+
+ /*
+ * Initialize the PPC exception table.
+ */
+ XExc_Init();
+
+ /*
+ * Register the interrupt controller handler with the exception table.
+ */
+ XExc_RegisterHandler(XEXC_ID_NON_CRITICAL_INT,
+ (XExceptionHandler)XIntc_InterruptHandler,
+ IntcInstancePtr);
+
+ /*
+ * Enable non-critical exceptions.
+ */
+ XExc_mEnableExceptions(XEXC_NON_CRITICAL);
+
+
+#endif /* TESTAPP_GEN */
+
+ return XST_SUCCESS;
+}
+
+/*****************************************************************************/
+/**
+*
+* This function disables the interrupts that occur for the UartLite.
+*
+* @param IntcInstancePtr is a pointer to the instance of the INTC component.
+* @param UartLiteIntrId is the Interrupt ID and is typically
+* XPAR___IP2INTC_IRPT_INTR
+* value from xparameters.h.
+*
+* @return None.
+*
+* @note None.
+*
+******************************************************************************/
+static void UartLiteDisableIntrSystem(XIntc *IntcInstancePtr,
+ Xuint16 UartLiteIntrId)
+{
+
+ /*
+ * Disconnect and disable the interrupt for the UartLite
+ */
+ XIntc_Disconnect(IntcInstancePtr, UartLiteIntrId);
+
+}
+
+
diff --git a/Demo/PPC405_Xilinx_Virtex4_GCC/TestApp_Peripheral/src/xuartlite_selftest_example.c b/Demo/PPC405_Xilinx_Virtex4_GCC/TestApp_Peripheral/src/xuartlite_selftest_example.c
new file mode 100644
index 000000000..c4340633f
--- /dev/null
+++ b/Demo/PPC405_Xilinx_Virtex4_GCC/TestApp_Peripheral/src/xuartlite_selftest_example.c
@@ -0,0 +1,147 @@
+#define TESTAPP_GEN
+
+/* $Id: xuartlite_selftest_example.c,v 1.1 2007/05/15 07:00:27 mta Exp $ */
+/*****************************************************************************
+*
+* XILINX IS PROVIDING THIS DESIGN, CODE, OR INFORMATION "AS IS"
+* AS A COURTESY TO YOU, SOLELY FOR USE IN DEVELOPING PROGRAMS AND
+* SOLUTIONS FOR XILINX DEVICES. BY PROVIDING THIS DESIGN, CODE,
+* OR INFORMATION AS ONE POSSIBLE IMPLEMENTATION OF THIS FEATURE,
+* APPLICATION OR STANDARD, XILINX IS MAKING NO REPRESENTATION
+* THAT THIS IMPLEMENTATION IS FREE FROM ANY CLAIMS OF INFRINGEMENT,
+* AND YOU ARE RESPONSIBLE FOR OBTAINING ANY RIGHTS YOU MAY REQUIRE
+* FOR YOUR IMPLEMENTATION. XILINX EXPRESSLY DISCLAIMS ANY
+* WARRANTY WHATSOEVER WITH RESPECT TO THE ADEQUACY OF THE
+* IMPLEMENTATION, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OR
+* REPRESENTATIONS THAT THIS IMPLEMENTATION IS FREE FROM CLAIMS OF
+* INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+* FOR A PARTICULAR PURPOSE.
+*
+* (c) Copyright 2005 Xilinx Inc.
+* All rights reserved.
+*
+*****************************************************************************/
+/****************************************************************************/
+/**
+*
+* @file xuartlite_selftest_example.c
+*
+* This file contains a design example using the UartLite driver (XUartLite) and
+* hardware device.
+*
+* @note
+*
+* None
+*
+* MODIFICATION HISTORY:
+*
+* Ver Who Date Changes
+* ----- ---- -------- -----------------------------------------------
+* 1.00a ecm 01/25/04 First Release.
+* 1.00a sv 06/13/05 Minor changes to comply to Doxygen and Coding guidelines
+*
+******************************************************************************/
+
+/***************************** Include Files *********************************/
+
+#include "xparameters.h"
+#include "xuartlite.h"
+
+/************************** Constant Definitions *****************************/
+
+/*
+ * The following constants map to the XPAR parameters created in the
+ * xparameters.h file. They are defined here such that a user can easily
+ * change all the needed parameters in one place.
+ */
+#define UARTLITE_DEVICE_ID XPAR_RS232_UART_DEVICE_ID
+
+
+/**************************** Type Definitions *******************************/
+
+
+/***************** Macros (Inline Functions) Definitions *********************/
+
+
+/************************** Function Prototypes ******************************/
+
+XStatus UartLiteSelfTestExample(Xuint16 DeviceId);
+
+/************************** Variable Definitions *****************************/
+
+XUartLite UartLite; /* Instance of the UartLite device */
+
+/*****************************************************************************/
+/**
+*
+* Main function to call the example. This function is not included if the
+* example is generated from the TestAppGen test tool.
+*
+* @param None.
+*
+* @return XST_SUCCESS if succesful, otherwise XST_FAILURE.
+*
+* @note None.
+*
+******************************************************************************/
+#ifndef TESTAPP_GEN
+int main(void)
+{
+ XStatus Status;
+
+ /*
+ * Run the UartLite self test example, specify the the Device ID that is
+ * generated in xparameters.h
+ */
+ Status = UartLiteSelfTestExample(UARTLITE_DEVICE_ID);
+ if (Status != XST_SUCCESS)
+ {
+ return XST_FAILURE;
+ }
+
+ return XST_SUCCESS;
+
+}
+#endif
+
+/*****************************************************************************/
+/**
+*
+* This function does a minimal test on the UartLite device and driver as a
+* design example. The purpose of this function is to illustrate
+* how to use the XUartLite component.
+*
+*
+* @param DeviceId is the XPAR__DEVICE_ID value from
+* xparameters.h.
+*
+* @return XST_SUCCESS if succesful, otherwise XST_FAILURE.
+*
+* @note None.
+*
+****************************************************************************/
+XStatus UartLiteSelfTestExample(Xuint16 DeviceId)
+{
+ XStatus Status;
+
+ /*
+ * Initialize the UartLite driver so that it is ready to use.
+ */
+ Status = XUartLite_Initialize(&UartLite, DeviceId);
+ if (Status != XST_SUCCESS)
+ {
+ return XST_FAILURE;
+ }
+
+ /*
+ * Perform a self-test to ensure that the hardware was built correctly.
+ */
+ Status = XUartLite_SelfTest(&UartLite);
+ if (Status != XST_SUCCESS)
+ {
+ return XST_FAILURE;
+ }
+
+ return XST_SUCCESS;
+}
+
diff --git a/Demo/PPC405_Xilinx_Virtex4_GCC/__xps/.dswkshop/IMG_LicensedCore.bmp b/Demo/PPC405_Xilinx_Virtex4_GCC/__xps/.dswkshop/IMG_LicensedCore.bmp
new file mode 100644
index 000000000..739605f2c
Binary files /dev/null and b/Demo/PPC405_Xilinx_Virtex4_GCC/__xps/.dswkshop/IMG_LicensedCore.bmp differ
diff --git a/Demo/PPC405_Xilinx_Virtex4_GCC/__xps/.dswkshop/IMG_closeBranch.gif b/Demo/PPC405_Xilinx_Virtex4_GCC/__xps/.dswkshop/IMG_closeBranch.gif
new file mode 100644
index 000000000..554be6694
Binary files /dev/null and b/Demo/PPC405_Xilinx_Virtex4_GCC/__xps/.dswkshop/IMG_closeBranch.gif differ
diff --git a/Demo/PPC405_Xilinx_Virtex4_GCC/__xps/.dswkshop/IMG_openBranch.gif b/Demo/PPC405_Xilinx_Virtex4_GCC/__xps/.dswkshop/IMG_openBranch.gif
new file mode 100644
index 000000000..d9e7ef561
Binary files /dev/null and b/Demo/PPC405_Xilinx_Virtex4_GCC/__xps/.dswkshop/IMG_openBranch.gif differ
diff --git a/Demo/PPC405_Xilinx_Virtex4_GCC/__xps/.dswkshop/MdtXdsGen_HTMLDatasheet.css b/Demo/PPC405_Xilinx_Virtex4_GCC/__xps/.dswkshop/MdtXdsGen_HTMLDatasheet.css
new file mode 100644
index 000000000..c1b40cf88
--- /dev/null
+++ b/Demo/PPC405_Xilinx_Virtex4_GCC/__xps/.dswkshop/MdtXdsGen_HTMLDatasheet.css
@@ -0,0 +1,119 @@
+ text.busintlabel {
+ fill: #810017;
+ stroke: none;
+ font-size: 7pt;
+ font-style: italic;
+ font-weight: 900;
+ text-anchor: middle;
+ font-family: Verdana Arial Helvetica sans-serif;
+ }
+
+ text.buslabel {
+ fill: #CC3333;
+ stroke: none;
+ font-size: 8pt;
+ font-style: italic;
+ font-weight: bold;
+ text-anchor: middle;
+ font-family: Verdana Arial Helvetica sans-serif;
+ }
+
+ text.iplabel {
+ fill: #000000;
+ stroke: none;
+ font-size: 7pt;
+ font-style: italic;
+ font-weight: 900;
+ text-anchor: middle;
+ font-family: Arial Helvetica sans-serif;
+ }
+
+ text.iptype {
+ fill: #AA0017;
+ stroke: none;
+ font-size: 8pt;
+ font-style: italic;
+ font-weight: bold;
+ text-anchor: middle;
+ font-family: Verdana Arial Helvetica sans-serif;
+ }
+
+ text.portlabel {
+ fill: #000000;
+ stroke: none;
+ font-size: 8pt;
+ font-style: normal;
+ font-weight: bold;
+ text-anchor: middle;
+ font-family: Verdana Arial Helvetica sans-serif;
+ }
+
+ text.mmMHeader {
+ fill: #FFFFFF;
+ stroke: none;
+ font-size: 10pt;
+ font-style: normal;
+ font-weight: bold;
+ text-anchor: middle;
+ font-family: Verdana Arial Helvetica sans-serif;
+ }
+
+ text.mmSHeader {
+ fill: #810017;
+ stroke: none;
+ font-size: 10pt;
+ font-style: normal;
+ font-weight: bold;
+ text-anchor: middle;
+ font-family: Verdana Arial Helvetica sans-serif;
+ }
+
+ text.proclabel {
+ fill: #810017;
+ stroke: none;
+ font-size: 14pt;
+ font-style: normal;
+ font-weight: bold;
+ text-anchor: middle;
+ font-family: Verdana Arial Helvetica sans-serif;
+ }
+
+ text.opblabel {
+ fill: #339900;
+ stroke: none;
+ font-size: 11pt;
+ font-style: normal;
+ font-weight: 900;
+ text-anchor: middle;
+ font-family: Arial Helvetica sans-serif;
+ }
+
+ text.lmblabel {
+ fill: #9999FF;
+ stroke: none;
+ font-size: 11pt;
+ font-style: normal;
+ font-weight: 900;
+ text-anchor: middle;
+ font-family: Arial Helvetica sans-serif;
+ }
+
+ text.dbglabel {
+ fill: #555555;
+ stroke: none;
+ font-size: 8pt;
+ font-style: normal;
+ font-weight: 900;
+ text-anchor: middle;
+ font-family: Times Arial Helvetica sans-serif;
+ }
+
+ text.iopnumb {
+ fill: #555555;
+ stroke: none;
+ font-size: 10pt;
+ font-style: normal;
+ font-weight: 900;
+ text-anchor: middle;
+ font-family: Verdana Arial Helvetica sans-serif;
+ }
diff --git a/Demo/PPC405_Xilinx_Virtex4_GCC/__xps/.dswkshop/MdtXdsGen_HTMLDatasheet.xsl b/Demo/PPC405_Xilinx_Virtex4_GCC/__xps/.dswkshop/MdtXdsGen_HTMLDatasheet.xsl
new file mode 100644
index 000000000..f91415383
--- /dev/null
+++ b/Demo/PPC405_Xilinx_Virtex4_GCC/__xps/.dswkshop/MdtXdsGen_HTMLDatasheet.xsl
@@ -0,0 +1,1211 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Table of Contents
+
+
+
+
+
+
+
+
+
+
+
+
+
+EDK Project Report
+
+
+
+
+
+
+
+Block Diagram
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ EDK PROJECT REPORT
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ These are the external ports defined in the MHS file.
+
+
+
+
+
+ Attributes Key
+
+ The attributes are obtained from the SIGIS and IOB_STATE parameters set on the PORT in the MHS file
+
+ CLK
+ indicates Clock ports, (SIGIS = CLK)
+
+ INTR
+ indicates Interrupt ports,(SIGIS = INTR)
+
+ RESET
+ indicates Reset ports, (SIGIS = RST)
+
+ BUF or REG
+ Indicates ports that instantiate or infer IOB primitives, (IOB_STATE = BUF or REG)
+
+
+ No clocks could be identified in the design. Run platgen to generate synthesis information.
+
+
+
+
+
+
+ These are the post synthesis clock frequencies. The critical frequencies are marked with
+
+
+ green.
+
+
+
+ The values reported here are post synthesis estimates calculated for each individual module. These values will change after place and route is performed on the entire system.
+
+
+
+ These are parameters set for this module.
+
+ Refer to the IP documentation for complete information about module parameters.
+
+
+
+
+ Parameters marked with
+
+ yellow
+
+ indicate parameters set by the user.
+
+
+
+ Parameters marked with
+
+ blue
+
+ indicate parameters set by the system.
+
+
+
+ Device utilization information is not available for this IP. Run platgen to generate synthesis information.
+
+
+
+
+
+
Resource Type
+
Used
+
Available
+
Percent
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
PORT LIST
+
+
+
+ The ports listed here are only those connected in the MHS file.
+
+ Refer to the IP documentation for complete information about module ports.
+
+
+
+
+ The paramaters listed here are only those set in the MHS file. Refer to the IP
+ documentation for complete information about module parameters.
+
+
+
+
Name
+
Value
+
+
+
+
+
+
+
Device Utilization
+
+
+
+
+
+ Device utilization information is not available for this IP.
+
+
+
+
+
Resource Type
+
Used
+
Available
+
Percent
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
PINOUT
+
+
+
+ The ports listed here are only those connected in the MHS file. Refer to the IP
+ documentation for complete information about module ports.
+
+
+ These are the external ports defined in the MHS file.
+
+
+
+Attributes Key The attributes are obtained from the SIGIS and IOB_STATE parameters set on the PORT in the MHS file CLK indicates Clock ports, (SIGIS = CLK) INTR indicates Interrupt ports,(SIGIS = INTR) RESET indicates Reset ports, (SIGIS = RST) BUF or REG Indicates ports that instantiate or infer IOB primitives, (IOB_STATE = BUF or REG)
+