copied over all of the custom pcb stuff and switched connectors + added PWM headers to the power board

git-svn-id: https://robotics.mvla.net/svn/frc971/2013/trunk/src@4029 f308d9b7-e957-4cde-b6ac-9a88185e7312
diff --git a/gyro_board/src/usb/CommonDemoTasks/BlockQ.c b/gyro_board/src/usb/CommonDemoTasks/BlockQ.c
new file mode 100644
index 0000000..e05af05
--- /dev/null
+++ b/gyro_board/src/usb/CommonDemoTasks/BlockQ.c
@@ -0,0 +1,293 @@
+/*
+    FreeRTOS V6.0.5 - Copyright (C) 2010 Real Time Engineers Ltd.
+
+    ***************************************************************************
+    *                                                                         *
+    * If you are:                                                             *
+    *                                                                         *
+    *    + New to FreeRTOS,                                                   *
+    *    + Wanting to learn FreeRTOS or multitasking in general quickly       *
+    *    + Looking for basic training,                                        *
+    *    + Wanting to improve your FreeRTOS skills and productivity           *
+    *                                                                         *
+    * then take a look at the FreeRTOS eBook                                  *
+    *                                                                         *
+    *        "Using the FreeRTOS Real Time Kernel - a Practical Guide"        *
+    *                  http://www.FreeRTOS.org/Documentation                  *
+    *                                                                         *
+    * A pdf reference manual is also available.  Both are usually delivered   *
+    * to your inbox within 20 minutes to two hours when purchased between 8am *
+    * and 8pm GMT (although please allow up to 24 hours in case of            *
+    * exceptional circumstances).  Thank you for your support!                *
+    *                                                                         *
+    ***************************************************************************
+
+    This file is part of the FreeRTOS distribution.
+
+    FreeRTOS is free software; you can redistribute it and/or modify it under
+    the terms of the GNU General Public License (version 2) as published by the
+    Free Software Foundation AND MODIFIED BY the FreeRTOS exception.
+    ***NOTE*** The exception to the GPL is included to allow you to distribute
+    a combined work that includes FreeRTOS without being obliged to provide the
+    source code for proprietary components outside of the FreeRTOS kernel.
+    FreeRTOS 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 and the FreeRTOS license exception along with FreeRTOS; if not it
+    can be viewed here: http://www.freertos.org/a00114.html and also obtained
+    by writing to Richard Barry, contact details for whom are available on the
+    FreeRTOS WEB site.
+
+    1 tab == 4 spaces!
+
+    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 six tasks that operate on three queues as follows:
+ *
+ * The first two tasks send and receive an incrementing number to/from a queue.
+ * One task acts as a producer and the other as the consumer.  The consumer is a
+ * higher priority than the producer and is set to block on queue reads.  The queue
+ * only has space for one item - as soon as the producer posts a message on the
+ * queue the consumer will unblock, pre-empt the producer, and remove the item.
+ *
+ * The second two tasks work the other way around.  Again the queue used only has
+ * enough space for one item.  This time the consumer has a lower priority than the
+ * producer.  The producer will try to post on the queue blocking when the queue is
+ * full.  When the consumer wakes it will remove the item from the queue, causing
+ * the producer to unblock, pre-empt the consumer, and immediately re-fill the
+ * queue.
+ *
+ * The last two tasks use the same queue producer and consumer functions.  This time the queue has
+ * enough space for lots of items and the tasks operate at the same priority.  The
+ * producer will execute, placing items into the queue.  The consumer will start
+ * executing when either the queue becomes full (causing the producer to block) or
+ * a context switch occurs (tasks of the same priority will time slice).
+ *
+ */
+
+/*
+
+Changes from V4.1.1
+
+	+ The second set of tasks were created the wrong way around.  This has been
+	  corrected.
+*/
+
+
+#include <stdlib.h>
+
+/* Scheduler include files. */
+#include "FreeRTOS.h"
+#include "task.h"
+#include "queue.h"
+
+/* Demo program include files. */
+#include "BlockQ.h"
+
+#define blckqSTACK_SIZE		configMINIMAL_STACK_SIZE
+#define blckqNUM_TASK_SETS	( 3 )
+
+/* Structure used to pass parameters to the blocking queue tasks. */
+typedef struct BLOCKING_QUEUE_PARAMETERS {
+	xQueueHandle xQueue;					/*< The queue to be used by the task. */
+	portTickType xBlockTime;				/*< The block time to use on queue reads/writes. */
+	volatile short *psCheckVariable;	/*< Incremented on each successful cycle to check the task is still running. */
+} xBlockingQueueParameters;
+
+/* Task function that creates an incrementing number and posts it on a queue. */
+static portTASK_FUNCTION_PROTO(vBlockingQueueProducer, pvParameters);
+
+/* Task function that removes the incrementing number from a queue and checks that
+it is the expected number. */
+static portTASK_FUNCTION_PROTO(vBlockingQueueConsumer, pvParameters);
+
+/* Variables which are incremented each time an item is removed from a queue, and
+found to be the expected value.
+These are used to check that the tasks are still running. */
+static volatile short sBlockingConsumerCount[ blckqNUM_TASK_SETS ] = {(unsigned short) 0, (unsigned short) 0, (unsigned short) 0 };
+
+/* Variable which are incremented each time an item is posted on a queue.   These
+are used to check that the tasks are still running. */
+static volatile short sBlockingProducerCount[ blckqNUM_TASK_SETS ] = {(unsigned short) 0, (unsigned short) 0, (unsigned short) 0 };
+
+/*-----------------------------------------------------------*/
+
+void vStartBlockingQueueTasks(unsigned portBASE_TYPE uxPriority)
+{
+	xBlockingQueueParameters *pxQueueParameters1, *pxQueueParameters2;
+	xBlockingQueueParameters *pxQueueParameters3, *pxQueueParameters4;
+	xBlockingQueueParameters *pxQueueParameters5, *pxQueueParameters6;
+	const unsigned portBASE_TYPE uxQueueSize1 = 1, uxQueueSize5 = 5;
+	const portTickType xBlockTime = (portTickType) 1000 / portTICK_RATE_MS;
+	const portTickType xDontBlock = (portTickType) 0;
+
+	/* Create the first two tasks as described at the top of the file. */
+
+	/* First create the structure used to pass parameters to the consumer tasks. */
+	pxQueueParameters1 = (xBlockingQueueParameters *) pvPortMalloc(sizeof(xBlockingQueueParameters));
+
+	/* Create the queue used by the first two tasks to pass the incrementing number.
+	Pass a pointer to the queue in the parameter structure. */
+	pxQueueParameters1->xQueue = xQueueCreate(uxQueueSize1, (unsigned portBASE_TYPE) sizeof(unsigned short));
+
+	/* The consumer is created first so gets a block time as described above. */
+	pxQueueParameters1->xBlockTime = xBlockTime;
+
+	/* Pass in the variable that this task is going to increment so we can check it
+	is still running. */
+	pxQueueParameters1->psCheckVariable = &(sBlockingConsumerCount[ 0 ]);
+
+	/* Create the structure used to pass parameters to the producer task. */
+	pxQueueParameters2 = (xBlockingQueueParameters *) pvPortMalloc(sizeof(xBlockingQueueParameters));
+
+	/* Pass the queue to this task also, using the parameter structure. */
+	pxQueueParameters2->xQueue = pxQueueParameters1->xQueue;
+
+	/* The producer is not going to block - as soon as it posts the consumer will
+	wake and remove the item so the producer should always have room to post. */
+	pxQueueParameters2->xBlockTime = xDontBlock;
+
+	/* Pass in the variable that this task is going to increment so we can check
+	it is still running. */
+	pxQueueParameters2->psCheckVariable = &(sBlockingProducerCount[ 0 ]);
+
+
+	/* Note the producer has a lower priority than the consumer when the tasks are
+	spawned. */
+	xTaskCreate(vBlockingQueueConsumer, (signed char *) "QConsB1", blckqSTACK_SIZE, (void *) pxQueueParameters1, uxPriority, NULL);
+	xTaskCreate(vBlockingQueueProducer, (signed char *) "QProdB2", blckqSTACK_SIZE, (void *) pxQueueParameters2, tskIDLE_PRIORITY, NULL);
+
+
+
+	/* Create the second two tasks as described at the top of the file.   This uses
+	the same mechanism but reverses the task priorities. */
+
+	pxQueueParameters3 = (xBlockingQueueParameters *) pvPortMalloc(sizeof(xBlockingQueueParameters));
+	pxQueueParameters3->xQueue = xQueueCreate(uxQueueSize1, (unsigned portBASE_TYPE) sizeof(unsigned short));
+	pxQueueParameters3->xBlockTime = xDontBlock;
+	pxQueueParameters3->psCheckVariable = &(sBlockingProducerCount[ 1 ]);
+
+	pxQueueParameters4 = (xBlockingQueueParameters *) pvPortMalloc(sizeof(xBlockingQueueParameters));
+	pxQueueParameters4->xQueue = pxQueueParameters3->xQueue;
+	pxQueueParameters4->xBlockTime = xBlockTime;
+	pxQueueParameters4->psCheckVariable = &(sBlockingConsumerCount[ 1 ]);
+
+	xTaskCreate(vBlockingQueueConsumer, (signed char *) "QProdB3", blckqSTACK_SIZE, (void *) pxQueueParameters3, tskIDLE_PRIORITY, NULL);
+	xTaskCreate(vBlockingQueueProducer, (signed char *) "QConsB4", blckqSTACK_SIZE, (void *) pxQueueParameters4, uxPriority, NULL);
+
+
+
+	/* Create the last two tasks as described above.  The mechanism is again just
+	the same.  This time both parameter structures are given a block time. */
+	pxQueueParameters5 = (xBlockingQueueParameters *) pvPortMalloc(sizeof(xBlockingQueueParameters));
+	pxQueueParameters5->xQueue = xQueueCreate(uxQueueSize5, (unsigned portBASE_TYPE) sizeof(unsigned short));
+	pxQueueParameters5->xBlockTime = xBlockTime;
+	pxQueueParameters5->psCheckVariable = &(sBlockingProducerCount[ 2 ]);
+
+	pxQueueParameters6 = (xBlockingQueueParameters *) pvPortMalloc(sizeof(xBlockingQueueParameters));
+	pxQueueParameters6->xQueue = pxQueueParameters5->xQueue;
+	pxQueueParameters6->xBlockTime = xBlockTime;
+	pxQueueParameters6->psCheckVariable = &(sBlockingConsumerCount[ 2 ]);
+
+	xTaskCreate(vBlockingQueueProducer, (signed char *) "QProdB5", blckqSTACK_SIZE, (void *) pxQueueParameters5, tskIDLE_PRIORITY, NULL);
+	xTaskCreate(vBlockingQueueConsumer, (signed char *) "QConsB6", blckqSTACK_SIZE, (void *) pxQueueParameters6, tskIDLE_PRIORITY, NULL);
+}
+/*-----------------------------------------------------------*/
+
+static portTASK_FUNCTION(vBlockingQueueProducer, pvParameters)
+{
+	unsigned short usValue = 0;
+	xBlockingQueueParameters *pxQueueParameters;
+	short sErrorEverOccurred = pdFALSE;
+
+	pxQueueParameters = (xBlockingQueueParameters *) pvParameters;
+
+	for (;;) {
+		if (xQueueSend(pxQueueParameters->xQueue, (void *) &usValue, pxQueueParameters->xBlockTime) != pdPASS) {
+			sErrorEverOccurred = pdTRUE;
+		} else {
+			/* We have successfully posted a message, so increment the variable
+			used to check we are still running. */
+			if (sErrorEverOccurred == pdFALSE) {
+				(*pxQueueParameters->psCheckVariable)++;
+			}
+
+			/* Increment the variable we are going to post next time round.  The
+			consumer will expect the numbers to	follow in numerical order. */
+			++usValue;
+		}
+	}
+}
+/*-----------------------------------------------------------*/
+
+static portTASK_FUNCTION(vBlockingQueueConsumer, pvParameters)
+{
+	unsigned short usData, usExpectedValue = 0;
+	xBlockingQueueParameters *pxQueueParameters;
+	short sErrorEverOccurred = pdFALSE;
+
+	pxQueueParameters = (xBlockingQueueParameters *) pvParameters;
+
+	for (;;) {
+		if (xQueueReceive(pxQueueParameters->xQueue, &usData, pxQueueParameters->xBlockTime) == pdPASS) {
+			if (usData != usExpectedValue) {
+				/* Catch-up. */
+				usExpectedValue = usData;
+
+				sErrorEverOccurred = pdTRUE;
+			} else {
+				/* We have successfully received a message, so increment the
+				variable used to check we are still running. */
+				if (sErrorEverOccurred == pdFALSE) {
+					(*pxQueueParameters->psCheckVariable)++;
+				}
+
+				/* Increment the value we expect to remove from the queue next time
+				round. */
+				++usExpectedValue;
+			}
+		}
+	}
+}
+/*-----------------------------------------------------------*/
+
+/* This is called to check that all the created tasks are still running. */
+portBASE_TYPE xAreBlockingQueuesStillRunning(void)
+{
+	static short sLastBlockingConsumerCount[ blckqNUM_TASK_SETS ] = {(unsigned short) 0, (unsigned short) 0, (unsigned short) 0 };
+	static short sLastBlockingProducerCount[ blckqNUM_TASK_SETS ] = {(unsigned short) 0, (unsigned short) 0, (unsigned short) 0 };
+	portBASE_TYPE xReturn = pdPASS, xTasks;
+
+	/* Not too worried about mutual exclusion on these variables as they are 16
+	bits and we are only reading them. We also only care to see if they have
+	changed or not.
+
+	Loop through each check variable to and return pdFALSE if any are found not
+	to have changed since the last call. */
+
+	for (xTasks = 0; xTasks < blckqNUM_TASK_SETS; xTasks++) {
+		if (sBlockingConsumerCount[ xTasks ] == sLastBlockingConsumerCount[ xTasks ]) {
+			xReturn = pdFALSE;
+		}
+		sLastBlockingConsumerCount[ xTasks ] = sBlockingConsumerCount[ xTasks ];
+
+
+		if (sBlockingProducerCount[ xTasks ] == sLastBlockingProducerCount[ xTasks ]) {
+			xReturn = pdFALSE;
+		}
+		sLastBlockingProducerCount[ xTasks ] = sBlockingProducerCount[ xTasks ];
+	}
+
+	return xReturn;
+}
+
diff --git a/gyro_board/src/usb/CommonDemoTasks/GenQTest.c b/gyro_board/src/usb/CommonDemoTasks/GenQTest.c
new file mode 100644
index 0000000..1b486ba
--- /dev/null
+++ b/gyro_board/src/usb/CommonDemoTasks/GenQTest.c
@@ -0,0 +1,525 @@
+/*
+    FreeRTOS V6.0.5 - Copyright (C) 2010 Real Time Engineers Ltd.
+
+    ***************************************************************************
+    *                                                                         *
+    * If you are:                                                             *
+    *                                                                         *
+    *    + New to FreeRTOS,                                                   *
+    *    + Wanting to learn FreeRTOS or multitasking in general quickly       *
+    *    + Looking for basic training,                                        *
+    *    + Wanting to improve your FreeRTOS skills and productivity           *
+    *                                                                         *
+    * then take a look at the FreeRTOS eBook                                  *
+    *                                                                         *
+    *        "Using the FreeRTOS Real Time Kernel - a Practical Guide"        *
+    *                  http://www.FreeRTOS.org/Documentation                  *
+    *                                                                         *
+    * A pdf reference manual is also available.  Both are usually delivered   *
+    * to your inbox within 20 minutes to two hours when purchased between 8am *
+    * and 8pm GMT (although please allow up to 24 hours in case of            *
+    * exceptional circumstances).  Thank you for your support!                *
+    *                                                                         *
+    ***************************************************************************
+
+    This file is part of the FreeRTOS distribution.
+
+    FreeRTOS is free software; you can redistribute it and/or modify it under
+    the terms of the GNU General Public License (version 2) as published by the
+    Free Software Foundation AND MODIFIED BY the FreeRTOS exception.
+    ***NOTE*** The exception to the GPL is included to allow you to distribute
+    a combined work that includes FreeRTOS without being obliged to provide the
+    source code for proprietary components outside of the FreeRTOS kernel.
+    FreeRTOS 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 and the FreeRTOS license exception along with FreeRTOS; if not it
+    can be viewed here: http://www.freertos.org/a00114.html and also obtained
+    by writing to Richard Barry, contact details for whom are available on the
+    FreeRTOS WEB site.
+
+    1 tab == 4 spaces!
+
+    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.
+*/
+
+
+/*
+ * Tests the extra queue functionality introduced in FreeRTOS.org V4.5.0 -
+ * including xQueueSendToFront(), xQueueSendToBack(), xQueuePeek() and
+ * mutex behaviour.
+ *
+ * See the comments above the prvSendFrontAndBackTest() and
+ * prvLowPriorityMutexTask() prototypes below for more information.
+ */
+
+
+#include <stdlib.h>
+
+/* Scheduler include files. */
+#include "FreeRTOS.h"
+#include "task.h"
+#include "queue.h"
+#include "semphr.h"
+
+/* Demo program include files. */
+#include "GenQTest.h"
+
+#define genqQUEUE_LENGTH		( 5 )
+#define genqNO_BLOCK			( 0 )
+
+#define genqMUTEX_LOW_PRIORITY		( tskIDLE_PRIORITY )
+#define genqMUTEX_TEST_PRIORITY		( tskIDLE_PRIORITY + 1 )
+#define genqMUTEX_MEDIUM_PRIORITY	( tskIDLE_PRIORITY + 2 )
+#define genqMUTEX_HIGH_PRIORITY		( tskIDLE_PRIORITY + 3 )
+
+/*-----------------------------------------------------------*/
+
+/*
+ * Tests the behaviour of the xQueueSendToFront() and xQueueSendToBack()
+ * macros by using both to fill a queue, then reading from the queue to
+ * check the resultant queue order is as expected.  Queue data is also
+ * peeked.
+ */
+static void prvSendFrontAndBackTest(void *pvParameters);
+
+/*
+ * The following three tasks are used to demonstrate the mutex behaviour.
+ * Each task is given a different priority to demonstrate the priority
+ * inheritance mechanism.
+ *
+ * The low priority task obtains a mutex.  After this a high priority task
+ * attempts to obtain the same mutex, causing its priority to be inherited
+ * by the low priority task.  The task with the inherited high priority then
+ * resumes a medium priority task to ensure it is not blocked by the medium
+ * priority task while it holds the inherited high priority.  Once the mutex
+ * is returned the task with the inherited priority returns to its original
+ * low priority, and is therefore immediately preempted by first the high
+ * priority task and then the medium prioroity task before it can continue.
+ */
+static void prvLowPriorityMutexTask(void *pvParameters);
+static void prvMediumPriorityMutexTask(void *pvParameters);
+static void prvHighPriorityMutexTask(void *pvParameters);
+
+/*-----------------------------------------------------------*/
+
+/* Flag that will be latched to pdTRUE should any unexpected behaviour be
+detected in any of the tasks. */
+static portBASE_TYPE xErrorDetected = pdFALSE;
+
+/* Counters that are incremented on each cycle of a test.  This is used to
+detect a stalled task - a test that is no longer running. */
+static volatile unsigned portLONG ulLoopCounter = 0;
+static volatile unsigned portLONG ulLoopCounter2 = 0;
+
+/* The variable that is guarded by the mutex in the mutex demo tasks. */
+static volatile unsigned portLONG ulGuardedVariable = 0;
+
+/* Handles used in the mutext test to suspend and resume the high and medium
+priority mutex test tasks. */
+static xTaskHandle xHighPriorityMutexTask, xMediumPriorityMutexTask;
+
+/*-----------------------------------------------------------*/
+
+void vStartGenericQueueTasks(unsigned portBASE_TYPE uxPriority)
+{
+	xQueueHandle xQueue;
+	xSemaphoreHandle xMutex;
+
+	/* Create the queue that we are going to use for the
+	prvSendFrontAndBackTest demo. */
+	xQueue = xQueueCreate(genqQUEUE_LENGTH, sizeof(unsigned portLONG));
+
+	/* vQueueAddToRegistry() adds the queue to the queue registry, if one is
+	in use.  The queue registry is provided as a means for kernel aware
+	debuggers to locate queues and has no purpose if a kernel aware debugger
+	is not being used.  The call to vQueueAddToRegistry() will be removed
+	by the pre-processor if configQUEUE_REGISTRY_SIZE is not defined or is
+	defined to be less than 1. */
+	vQueueAddToRegistry(xQueue, (signed portCHAR *) "Gen_Queue_Test");
+
+	/* Create the demo task and pass it the queue just created.  We are
+	passing the queue handle by value so it does not matter that it is
+	declared on the stack here. */
+	xTaskCreate(prvSendFrontAndBackTest, (signed portCHAR *)"GenQ", configMINIMAL_STACK_SIZE, (void *) xQueue, uxPriority, NULL);
+
+	/* Create the mutex used by the prvMutexTest task. */
+	xMutex = xSemaphoreCreateMutex();
+
+	/* vQueueAddToRegistry() adds the mutex to the registry, if one is
+	in use.  The registry is provided as a means for kernel aware
+	debuggers to locate mutexes and has no purpose if a kernel aware debugger
+	is not being used.  The call to vQueueAddToRegistry() will be removed
+	by the pre-processor if configQUEUE_REGISTRY_SIZE is not defined or is
+	defined to be less than 1. */
+	vQueueAddToRegistry((xQueueHandle) xMutex, (signed portCHAR *) "Gen_Queue_Mutex");
+
+	/* Create the mutex demo tasks and pass it the mutex just created.  We are
+	passing the mutex handle by value so it does not matter that it is declared
+	on the stack here. */
+	xTaskCreate(prvLowPriorityMutexTask, (signed portCHAR *)"MuLow", configMINIMAL_STACK_SIZE, (void *) xMutex, genqMUTEX_LOW_PRIORITY, NULL);
+	xTaskCreate(prvMediumPriorityMutexTask, (signed portCHAR *)"MuMed", configMINIMAL_STACK_SIZE, NULL, genqMUTEX_MEDIUM_PRIORITY, &xMediumPriorityMutexTask);
+	xTaskCreate(prvHighPriorityMutexTask, (signed portCHAR *)"MuHigh", configMINIMAL_STACK_SIZE, (void *) xMutex, genqMUTEX_HIGH_PRIORITY, &xHighPriorityMutexTask);
+}
+/*-----------------------------------------------------------*/
+
+static void prvSendFrontAndBackTest(void *pvParameters)
+{
+	unsigned portLONG ulData, ulData2;
+	xQueueHandle xQueue;
+
+#ifdef USE_STDIO
+	void vPrintDisplayMessage(const portCHAR * const * ppcMessageToSend);
+
+	const portCHAR * const pcTaskStartMsg = "Queue SendToFront/SendToBack/Peek test started.\r\n";
+
+	/* Queue a message for printing to say the task has started. */
+	vPrintDisplayMessage(&pcTaskStartMsg);
+#endif
+
+	xQueue = (xQueueHandle) pvParameters;
+
+	for (;;) {
+		/* The queue is empty, so sending an item to the back of the queue
+		should have the same efect as sending it to the front of the queue.
+
+		First send to the front and check everything is as expected. */
+		xQueueSendToFront(xQueue, (void *) &ulLoopCounter, genqNO_BLOCK);
+
+		if (uxQueueMessagesWaiting(xQueue) != 1) {
+			xErrorDetected = pdTRUE;
+		}
+
+		if (xQueueReceive(xQueue, (void *) &ulData, genqNO_BLOCK) != pdPASS) {
+			xErrorDetected = pdTRUE;
+		}
+
+		/* The data we sent to the queue should equal the data we just received
+		from the queue. */
+		if (ulLoopCounter != ulData) {
+			xErrorDetected = pdTRUE;
+		}
+
+		/* Then do the same, sending the data to the back, checking everything
+		is as expected. */
+		if (uxQueueMessagesWaiting(xQueue) != 0) {
+			xErrorDetected = pdTRUE;
+		}
+
+		xQueueSendToBack(xQueue, (void *) &ulLoopCounter, genqNO_BLOCK);
+
+		if (uxQueueMessagesWaiting(xQueue) != 1) {
+			xErrorDetected = pdTRUE;
+		}
+
+		if (xQueueReceive(xQueue, (void *) &ulData, genqNO_BLOCK) != pdPASS) {
+			xErrorDetected = pdTRUE;
+		}
+
+		if (uxQueueMessagesWaiting(xQueue) != 0) {
+			xErrorDetected = pdTRUE;
+		}
+
+		/* The data we sent to the queue should equal the data we just received
+		from the queue. */
+		if (ulLoopCounter != ulData) {
+			xErrorDetected = pdTRUE;
+		}
+
+#if configUSE_PREEMPTION == 0
+		taskYIELD();
+#endif
+
+
+
+		/* Place 2, 3, 4 into the queue, adding items to the back of the queue. */
+		for (ulData = 2; ulData < 5; ulData++) {
+			xQueueSendToBack(xQueue, (void *) &ulData, genqNO_BLOCK);
+		}
+
+		/* Now the order in the queue should be 2, 3, 4, with 2 being the first
+		thing to be read out.  Now add 1 then 0 to the front of the queue. */
+		if (uxQueueMessagesWaiting(xQueue) != 3) {
+			xErrorDetected = pdTRUE;
+		}
+		ulData = 1;
+		xQueueSendToFront(xQueue, (void *) &ulData, genqNO_BLOCK);
+		ulData = 0;
+		xQueueSendToFront(xQueue, (void *) &ulData, genqNO_BLOCK);
+
+		/* Now the queue should be full, and when we read the data out we
+		should receive 0, 1, 2, 3, 4. */
+		if (uxQueueMessagesWaiting(xQueue) != 5) {
+			xErrorDetected = pdTRUE;
+		}
+
+		if (xQueueSendToFront(xQueue, (void *) &ulData, genqNO_BLOCK) != errQUEUE_FULL) {
+			xErrorDetected = pdTRUE;
+		}
+
+		if (xQueueSendToBack(xQueue, (void *) &ulData, genqNO_BLOCK) != errQUEUE_FULL) {
+			xErrorDetected = pdTRUE;
+		}
+
+#if configUSE_PREEMPTION == 0
+		taskYIELD();
+#endif
+
+		/* Check the data we read out is in the expected order. */
+		for (ulData = 0; ulData < genqQUEUE_LENGTH; ulData++) {
+			/* Try peeking the data first. */
+			if (xQueuePeek(xQueue, &ulData2, genqNO_BLOCK) != pdPASS) {
+				xErrorDetected = pdTRUE;
+			}
+
+			if (ulData != ulData2) {
+				xErrorDetected = pdTRUE;
+			}
+
+
+			/* Now try receiving the data for real.  The value should be the
+			same.  Clobber the value first so we know we really received it. */
+			ulData2 = ~ulData2;
+			if (xQueueReceive(xQueue, &ulData2, genqNO_BLOCK) != pdPASS) {
+				xErrorDetected = pdTRUE;
+			}
+
+			if (ulData != ulData2) {
+				xErrorDetected = pdTRUE;
+			}
+		}
+
+		/* The queue should now be empty again. */
+		if (uxQueueMessagesWaiting(xQueue) != 0) {
+			xErrorDetected = pdTRUE;
+		}
+
+#if configUSE_PREEMPTION == 0
+		taskYIELD();
+#endif
+
+
+		/* Our queue is empty once more, add 10, 11 to the back. */
+		ulData = 10;
+		if (xQueueSend(xQueue, &ulData, genqNO_BLOCK) != pdPASS) {
+			xErrorDetected = pdTRUE;
+		}
+		ulData = 11;
+		if (xQueueSend(xQueue, &ulData, genqNO_BLOCK) != pdPASS) {
+			xErrorDetected = pdTRUE;
+		}
+
+		if (uxQueueMessagesWaiting(xQueue) != 2) {
+			xErrorDetected = pdTRUE;
+		}
+
+		/* Now we should have 10, 11 in the queue.  Add 7, 8, 9 to the
+		front. */
+		for (ulData = 9; ulData >= 7; ulData--) {
+			if (xQueueSendToFront(xQueue, (void *) &ulData, genqNO_BLOCK) != pdPASS) {
+				xErrorDetected = pdTRUE;
+			}
+		}
+
+		/* Now check that the queue is full, and that receiving data provides
+		the expected sequence of 7, 8, 9, 10, 11. */
+		if (uxQueueMessagesWaiting(xQueue) != 5) {
+			xErrorDetected = pdTRUE;
+		}
+
+		if (xQueueSendToFront(xQueue, (void *) &ulData, genqNO_BLOCK) != errQUEUE_FULL) {
+			xErrorDetected = pdTRUE;
+		}
+
+		if (xQueueSendToBack(xQueue, (void *) &ulData, genqNO_BLOCK) != errQUEUE_FULL) {
+			xErrorDetected = pdTRUE;
+		}
+
+#if configUSE_PREEMPTION == 0
+		taskYIELD();
+#endif
+
+		/* Check the data we read out is in the expected order. */
+		for (ulData = 7; ulData < (7 + genqQUEUE_LENGTH); ulData++) {
+			if (xQueueReceive(xQueue, &ulData2, genqNO_BLOCK) != pdPASS) {
+				xErrorDetected = pdTRUE;
+			}
+
+			if (ulData != ulData2) {
+				xErrorDetected = pdTRUE;
+			}
+		}
+
+		if (uxQueueMessagesWaiting(xQueue) != 0) {
+			xErrorDetected = pdTRUE;
+		}
+
+		ulLoopCounter++;
+	}
+}
+/*-----------------------------------------------------------*/
+
+static void prvLowPriorityMutexTask(void *pvParameters)
+{
+	xSemaphoreHandle xMutex = (xSemaphoreHandle) pvParameters;
+
+#ifdef USE_STDIO
+	void vPrintDisplayMessage(const portCHAR * const * ppcMessageToSend);
+
+	const portCHAR * const pcTaskStartMsg = "Mutex with priority inheritance test started.\r\n";
+
+	/* Queue a message for printing to say the task has started. */
+	vPrintDisplayMessage(&pcTaskStartMsg);
+#endif
+
+	for (;;) {
+		/* Take the mutex.  It should be available now. */
+		if (xSemaphoreTake(xMutex, genqNO_BLOCK) != pdPASS) {
+			xErrorDetected = pdTRUE;
+		}
+
+		/* Set our guarded variable to a known start value. */
+		ulGuardedVariable = 0;
+
+		/* Our priority should be as per that assigned when the task was
+		created. */
+		if (uxTaskPriorityGet(NULL) != genqMUTEX_LOW_PRIORITY) {
+			xErrorDetected = pdTRUE;
+		}
+
+		/* Now unsuspend the high priority task.  This will attempt to take the
+		mutex, and block when it finds it cannot obtain it. */
+		vTaskResume(xHighPriorityMutexTask);
+
+		/* We should now have inherited the prioritoy of the high priority task,
+		as by now it will have attempted to get the mutex. */
+		if (uxTaskPriorityGet(NULL) != genqMUTEX_HIGH_PRIORITY) {
+			xErrorDetected = pdTRUE;
+		}
+
+		/* We can attempt to set our priority to the test priority - between the
+		idle priority and the medium/high test priorities, but our actual
+		prioroity should remain at the high priority. */
+		vTaskPrioritySet(NULL, genqMUTEX_TEST_PRIORITY);
+		if (uxTaskPriorityGet(NULL) != genqMUTEX_HIGH_PRIORITY) {
+			xErrorDetected = pdTRUE;
+		}
+
+		/* Now unsuspend the medium priority task.  This should not run as our
+		inherited priority is above that of the medium priority task. */
+		vTaskResume(xMediumPriorityMutexTask);
+
+		/* If the did run then it will have incremented our guarded variable. */
+		if (ulGuardedVariable != 0) {
+			xErrorDetected = pdTRUE;
+		}
+
+		/* When we give back the semaphore our priority should be disinherited
+		back to the priority to which we attempted to set ourselves.  This means
+		that when the high priority task next blocks, the medium priority task
+		should execute and increment the guarded variable.   When we next run
+		both the high and medium priority tasks will have been suspended again. */
+		if (xSemaphoreGive(xMutex) != pdPASS) {
+			xErrorDetected = pdTRUE;
+		}
+
+		/* Check that the guarded variable did indeed increment... */
+		if (ulGuardedVariable != 1) {
+			xErrorDetected = pdTRUE;
+		}
+
+		/* ... and that our priority has been disinherited to
+		genqMUTEX_TEST_PRIORITY. */
+		if (uxTaskPriorityGet(NULL) != genqMUTEX_TEST_PRIORITY) {
+			xErrorDetected = pdTRUE;
+		}
+
+		/* Set our priority back to our original priority ready for the next
+		loop around this test. */
+		vTaskPrioritySet(NULL, genqMUTEX_LOW_PRIORITY);
+
+		/* Just to show we are still running. */
+		ulLoopCounter2++;
+
+#if configUSE_PREEMPTION == 0
+		taskYIELD();
+#endif
+	}
+}
+/*-----------------------------------------------------------*/
+
+static void prvMediumPriorityMutexTask(void *pvParameters)
+{
+	(void) pvParameters;
+
+	for (;;) {
+		/* The medium priority task starts by suspending itself.  The low
+		priority task will unsuspend this task when required. */
+		vTaskSuspend(NULL);
+
+		/* When this task unsuspends all it does is increment the guarded
+		variable, this is so the low priority task knows that it has
+		executed. */
+		ulGuardedVariable++;
+	}
+}
+/*-----------------------------------------------------------*/
+
+static void prvHighPriorityMutexTask(void *pvParameters)
+{
+	xSemaphoreHandle xMutex = (xSemaphoreHandle) pvParameters;
+
+	for (;;) {
+		/* The high priority task starts by suspending itself.  The low
+		priority task will unsuspend this task when required. */
+		vTaskSuspend(NULL);
+
+		/* When this task unsuspends all it does is attempt to obtain
+		the mutex.  It should find the mutex is not available so a
+		block time is specified. */
+		if (xSemaphoreTake(xMutex, portMAX_DELAY) != pdPASS) {
+			xErrorDetected = pdTRUE;
+		}
+
+		/* When we eventually obtain the mutex we just give it back then
+		return to suspend ready for the next test. */
+		if (xSemaphoreGive(xMutex) != pdPASS) {
+			xErrorDetected = pdTRUE;
+		}
+	}
+}
+/*-----------------------------------------------------------*/
+
+/* This is called to check that all the created tasks are still running. */
+portBASE_TYPE xAreGenericQueueTasksStillRunning(void)
+{
+	static unsigned portLONG ulLastLoopCounter = 0, ulLastLoopCounter2 = 0;
+
+	/* If the demo task is still running then we expect the loopcounters to
+	have incremented since this function was last called. */
+	if (ulLastLoopCounter == ulLoopCounter) {
+		xErrorDetected = pdTRUE;
+	}
+
+	if (ulLastLoopCounter2 == ulLoopCounter2) {
+		xErrorDetected = pdTRUE;
+	}
+
+	ulLastLoopCounter = ulLoopCounter;
+	ulLastLoopCounter2 = ulLoopCounter2;
+
+	/* Errors detected in the task itself will have latched xErrorDetected
+	to true. */
+
+	return !xErrorDetected;
+}
+
+
diff --git a/gyro_board/src/usb/CommonDemoTasks/PollQ.c b/gyro_board/src/usb/CommonDemoTasks/PollQ.c
new file mode 100644
index 0000000..5428693
--- /dev/null
+++ b/gyro_board/src/usb/CommonDemoTasks/PollQ.c
@@ -0,0 +1,230 @@
+/*
+    FreeRTOS V6.0.5 - Copyright (C) 2010 Real Time Engineers Ltd.
+
+    ***************************************************************************
+    *                                                                         *
+    * If you are:                                                             *
+    *                                                                         *
+    *    + New to FreeRTOS,                                                   *
+    *    + Wanting to learn FreeRTOS or multitasking in general quickly       *
+    *    + Looking for basic training,                                        *
+    *    + Wanting to improve your FreeRTOS skills and productivity           *
+    *                                                                         *
+    * then take a look at the FreeRTOS eBook                                  *
+    *                                                                         *
+    *        "Using the FreeRTOS Real Time Kernel - a Practical Guide"        *
+    *                  http://www.FreeRTOS.org/Documentation                  *
+    *                                                                         *
+    * A pdf reference manual is also available.  Both are usually delivered   *
+    * to your inbox within 20 minutes to two hours when purchased between 8am *
+    * and 8pm GMT (although please allow up to 24 hours in case of            *
+    * exceptional circumstances).  Thank you for your support!                *
+    *                                                                         *
+    ***************************************************************************
+
+    This file is part of the FreeRTOS distribution.
+
+    FreeRTOS is free software; you can redistribute it and/or modify it under
+    the terms of the GNU General Public License (version 2) as published by the
+    Free Software Foundation AND MODIFIED BY the FreeRTOS exception.
+    ***NOTE*** The exception to the GPL is included to allow you to distribute
+    a combined work that includes FreeRTOS without being obliged to provide the
+    source code for proprietary components outside of the FreeRTOS kernel.
+    FreeRTOS 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 and the FreeRTOS license exception along with FreeRTOS; if not it
+    can be viewed here: http://www.freertos.org/a00114.html and also obtained
+    by writing to Richard Barry, contact details for whom are available on the
+    FreeRTOS WEB site.
+
+    1 tab == 4 spaces!
+
+    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.
+*/
+
+/*
+ * This version of PollQ. c is for use on systems that have limited stack
+ * space and no display facilities.  The complete version can be found in
+ * the Demo/Common/Full directory.
+ *
+ * Creates two tasks that communicate over a single queue.  One task acts as a
+ * producer, the other a consumer.
+ *
+ * The producer loops for three iteration, posting an incrementing number onto the
+ * queue each cycle.  It then delays for a fixed period before doing exactly the
+ * same again.
+ *
+ * The consumer loops emptying the queue.  Each item removed from the queue is
+ * checked to ensure it contains the expected value.  When the queue is empty it
+ * blocks for a fixed period, then does the same again.
+ *
+ * All queue access is performed without blocking.  The consumer completely empties
+ * the queue each time it runs so the producer should never find the queue full.
+ *
+ * An error is flagged if the consumer obtains an unexpected value or the producer
+ * find the queue is full.
+ */
+
+/*
+Changes from V2.0.0
+
+	+ Delay periods are now specified using variables and constants of
+	  portTickType rather than unsigned long.
+*/
+
+#include <stdlib.h>
+
+/* Scheduler include files. */
+#include "FreeRTOS.h"
+#include "task.h"
+#include "queue.h"
+
+/* Demo program include files. */
+#include "PollQ.h"
+
+#define pollqSTACK_SIZE			configMINIMAL_STACK_SIZE
+#define pollqQUEUE_SIZE			( 10 )
+#define pollqPRODUCER_DELAY		( ( portTickType ) 200 / portTICK_RATE_MS )
+#define pollqCONSUMER_DELAY		( pollqPRODUCER_DELAY - ( portTickType ) ( 20 / portTICK_RATE_MS ) )
+#define pollqNO_DELAY			( ( portTickType ) 0 )
+#define pollqVALUES_TO_PRODUCE	( ( signed portBASE_TYPE ) 3 )
+#define pollqINITIAL_VALUE		( ( signed portBASE_TYPE ) 0 )
+
+/* The task that posts the incrementing number onto the queue. */
+static portTASK_FUNCTION_PROTO(vPolledQueueProducer, pvParameters);
+
+/* The task that empties the queue. */
+static portTASK_FUNCTION_PROTO(vPolledQueueConsumer, pvParameters);
+
+/* Variables that are used to check that the tasks are still running with no
+errors. */
+static volatile signed portBASE_TYPE xPollingConsumerCount = pollqINITIAL_VALUE, xPollingProducerCount = pollqINITIAL_VALUE;
+
+/*-----------------------------------------------------------*/
+
+void vStartPolledQueueTasks(unsigned portBASE_TYPE uxPriority)
+{
+	static xQueueHandle xPolledQueue;
+
+	/* Create the queue used by the producer and consumer. */
+	xPolledQueue = xQueueCreate(pollqQUEUE_SIZE, (unsigned portBASE_TYPE) sizeof(unsigned short));
+
+	/* vQueueAddToRegistry() adds the queue to the queue registry, if one is
+	in use.  The queue registry is provided as a means for kernel aware
+	debuggers to locate queues and has no purpose if a kernel aware debugger
+	is not being used.  The call to vQueueAddToRegistry() will be removed
+	by the pre-processor if configQUEUE_REGISTRY_SIZE is not defined or is
+	defined to be less than 1. */
+	vQueueAddToRegistry(xPolledQueue, (signed char *) "Poll_Test_Queue");
+
+	/* Spawn the producer and consumer. */
+	xTaskCreate(vPolledQueueConsumer, (signed char *) "QConsNB", pollqSTACK_SIZE, (void *) &xPolledQueue, uxPriority, (xTaskHandle *) NULL);
+	xTaskCreate(vPolledQueueProducer, (signed char *) "QProdNB", pollqSTACK_SIZE, (void *) &xPolledQueue, uxPriority, (xTaskHandle *) NULL);
+}
+/*-----------------------------------------------------------*/
+
+static portTASK_FUNCTION(vPolledQueueProducer, pvParameters)
+{
+	unsigned short usValue = (unsigned short) 0;
+	signed portBASE_TYPE xError = pdFALSE, xLoop;
+
+	for (;;) {
+		for (xLoop = 0; xLoop < pollqVALUES_TO_PRODUCE; xLoop++) {
+			/* Send an incrementing number on the queue without blocking. */
+			if (xQueueSend(*((xQueueHandle *) pvParameters), (void *) &usValue, pollqNO_DELAY) != pdPASS) {
+				/* We should never find the queue full so if we get here there
+				has been an error. */
+				xError = pdTRUE;
+			} else {
+				if (xError == pdFALSE) {
+					/* If an error has ever been recorded we stop incrementing the
+					check variable. */
+					portENTER_CRITICAL();
+					xPollingProducerCount++;
+					portEXIT_CRITICAL();
+				}
+
+				/* Update the value we are going to post next time around. */
+				usValue++;
+			}
+		}
+
+		/* Wait before we start posting again to ensure the consumer runs and
+		empties the queue. */
+		vTaskDelay(pollqPRODUCER_DELAY);
+	}
+}  /*lint !e818 Function prototype must conform to API. */
+/*-----------------------------------------------------------*/
+
+static portTASK_FUNCTION(vPolledQueueConsumer, pvParameters)
+{
+	unsigned short usData, usExpectedValue = (unsigned short) 0;
+	signed portBASE_TYPE xError = pdFALSE;
+
+	for (;;) {
+		/* Loop until the queue is empty. */
+		while (uxQueueMessagesWaiting(*((xQueueHandle *) pvParameters))) {
+			if (xQueueReceive(*((xQueueHandle *) pvParameters), &usData, pollqNO_DELAY) == pdPASS) {
+				if (usData != usExpectedValue) {
+					/* This is not what we expected to receive so an error has
+					occurred. */
+					xError = pdTRUE;
+
+					/* Catch-up to the value we received so our next expected
+					value should again be correct. */
+					usExpectedValue = usData;
+				} else {
+					if (xError == pdFALSE) {
+						/* Only increment the check variable if no errors have
+						occurred. */
+						portENTER_CRITICAL();
+						xPollingConsumerCount++;
+						portEXIT_CRITICAL();
+					}
+				}
+
+				/* Next time round we would expect the number to be one higher. */
+				usExpectedValue++;
+			}
+		}
+
+		/* Now the queue is empty we block, allowing the producer to place more
+		items in the queue. */
+		vTaskDelay(pollqCONSUMER_DELAY);
+	}
+} /*lint !e818 Function prototype must conform to API. */
+/*-----------------------------------------------------------*/
+
+/* This is called to check that all the created tasks are still running with no errors. */
+portBASE_TYPE xArePollingQueuesStillRunning(void)
+{
+	portBASE_TYPE xReturn;
+
+	/* Check both the consumer and producer poll count to check they have both
+	been changed since out last trip round.  We do not need a critical section
+	around the check variables as this is called from a higher priority than
+	the other tasks that access the same variables. */
+	if ((xPollingConsumerCount == pollqINITIAL_VALUE) ||
+	                (xPollingProducerCount == pollqINITIAL_VALUE)
+	   ) {
+		xReturn = pdFALSE;
+	} else {
+		xReturn = pdTRUE;
+	}
+
+	/* Set the check variables back down so we know if they have been
+	incremented the next time around. */
+	xPollingConsumerCount = pollqINITIAL_VALUE;
+	xPollingProducerCount = pollqINITIAL_VALUE;
+
+	return xReturn;
+}
diff --git a/gyro_board/src/usb/CommonDemoTasks/QPeek.c b/gyro_board/src/usb/CommonDemoTasks/QPeek.c
new file mode 100644
index 0000000..6aa2f78
--- /dev/null
+++ b/gyro_board/src/usb/CommonDemoTasks/QPeek.c
@@ -0,0 +1,416 @@
+/*
+    FreeRTOS V6.0.5 - Copyright (C) 2010 Real Time Engineers Ltd.
+
+    ***************************************************************************
+    *                                                                         *
+    * If you are:                                                             *
+    *                                                                         *
+    *    + New to FreeRTOS,                                                   *
+    *    + Wanting to learn FreeRTOS or multitasking in general quickly       *
+    *    + Looking for basic training,                                        *
+    *    + Wanting to improve your FreeRTOS skills and productivity           *
+    *                                                                         *
+    * then take a look at the FreeRTOS eBook                                  *
+    *                                                                         *
+    *        "Using the FreeRTOS Real Time Kernel - a Practical Guide"        *
+    *                  http://www.FreeRTOS.org/Documentation                  *
+    *                                                                         *
+    * A pdf reference manual is also available.  Both are usually delivered   *
+    * to your inbox within 20 minutes to two hours when purchased between 8am *
+    * and 8pm GMT (although please allow up to 24 hours in case of            *
+    * exceptional circumstances).  Thank you for your support!                *
+    *                                                                         *
+    ***************************************************************************
+
+    This file is part of the FreeRTOS distribution.
+
+    FreeRTOS is free software; you can redistribute it and/or modify it under
+    the terms of the GNU General Public License (version 2) as published by the
+    Free Software Foundation AND MODIFIED BY the FreeRTOS exception.
+    ***NOTE*** The exception to the GPL is included to allow you to distribute
+    a combined work that includes FreeRTOS without being obliged to provide the
+    source code for proprietary components outside of the FreeRTOS kernel.
+    FreeRTOS 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 and the FreeRTOS license exception along with FreeRTOS; if not it
+    can be viewed here: http://www.freertos.org/a00114.html and also obtained
+    by writing to Richard Barry, contact details for whom are available on the
+    FreeRTOS WEB site.
+
+    1 tab == 4 spaces!
+
+    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.
+*/
+
+
+/*
+ * Tests the behaviour when data is peeked from a queue when there are
+ * multiple tasks blocked on the queue.
+ */
+
+
+#include <stdlib.h>
+
+/* Scheduler include files. */
+#include "FreeRTOS.h"
+#include "task.h"
+#include "queue.h"
+#include "semphr.h"
+
+/* Demo program include files. */
+#include "QPeek.h"
+
+#define qpeekQUEUE_LENGTH		( 5 )
+#define qpeekNO_BLOCK			( 0 )
+#define qpeekSHORT_DELAY		( 10 )
+
+#define qpeekLOW_PRIORITY			( tskIDLE_PRIORITY + 0 )
+#define qpeekMEDIUM_PRIORITY		( tskIDLE_PRIORITY + 1 )
+#define qpeekHIGH_PRIORITY			( tskIDLE_PRIORITY + 2 )
+#define qpeekHIGHEST_PRIORITY		( tskIDLE_PRIORITY + 3 )
+
+/*-----------------------------------------------------------*/
+
+/*
+ * The following three tasks are used to demonstrate the peeking behaviour.
+ * Each task is given a different priority to demonstrate the order in which
+ * tasks are woken as data is peeked from a queue.
+ */
+static void prvLowPriorityPeekTask(void *pvParameters);
+static void prvMediumPriorityPeekTask(void *pvParameters);
+static void prvHighPriorityPeekTask(void *pvParameters);
+static void prvHighestPriorityPeekTask(void *pvParameters);
+
+/*-----------------------------------------------------------*/
+
+/* Flag that will be latched to pdTRUE should any unexpected behaviour be
+detected in any of the tasks. */
+static volatile portBASE_TYPE xErrorDetected = pdFALSE;
+
+/* Counter that is incremented on each cycle of a test.  This is used to
+detect a stalled task - a test that is no longer running. */
+static volatile unsigned portLONG ulLoopCounter = 0;
+
+/* Handles to the test tasks. */
+xTaskHandle xMediumPriorityTask, xHighPriorityTask, xHighestPriorityTask;
+/*-----------------------------------------------------------*/
+
+void vStartQueuePeekTasks(void)
+{
+	xQueueHandle xQueue;
+
+	/* Create the queue that we are going to use for the test/demo. */
+	xQueue = xQueueCreate(qpeekQUEUE_LENGTH, sizeof(unsigned portLONG));
+
+	/* vQueueAddToRegistry() adds the queue to the queue registry, if one is
+	in use.  The queue registry is provided as a means for kernel aware
+	debuggers to locate queues and has no purpose if a kernel aware debugger
+	is not being used.  The call to vQueueAddToRegistry() will be removed
+	by the pre-processor if configQUEUE_REGISTRY_SIZE is not defined or is
+	defined to be less than 1. */
+	vQueueAddToRegistry(xQueue, (signed portCHAR *) "QPeek_Test_Queue");
+
+	/* Create the demo tasks and pass it the queue just created.  We are
+	passing the queue handle by value so it does not matter that it is declared
+	on the stack here. */
+	xTaskCreate(prvLowPriorityPeekTask, (signed portCHAR *)"PeekL", configMINIMAL_STACK_SIZE, (void *) xQueue, qpeekLOW_PRIORITY, NULL);
+	xTaskCreate(prvMediumPriorityPeekTask, (signed portCHAR *)"PeekM", configMINIMAL_STACK_SIZE, (void *) xQueue, qpeekMEDIUM_PRIORITY, &xMediumPriorityTask);
+	xTaskCreate(prvHighPriorityPeekTask, (signed portCHAR *)"PeekH1", configMINIMAL_STACK_SIZE, (void *) xQueue, qpeekHIGH_PRIORITY, &xHighPriorityTask);
+	xTaskCreate(prvHighestPriorityPeekTask, (signed portCHAR *)"PeekH2", configMINIMAL_STACK_SIZE, (void *) xQueue, qpeekHIGHEST_PRIORITY, &xHighestPriorityTask);
+}
+/*-----------------------------------------------------------*/
+
+static void prvHighestPriorityPeekTask(void *pvParameters)
+{
+	xQueueHandle xQueue = (xQueueHandle) pvParameters;
+	unsigned portLONG ulValue;
+
+#ifdef USE_STDIO
+	{
+		void vPrintDisplayMessage(const portCHAR * const * ppcMessageToSend);
+
+		const portCHAR * const pcTaskStartMsg = "Queue peek test started.\r\n";
+
+		/* Queue a message for printing to say the task has started. */
+		vPrintDisplayMessage(&pcTaskStartMsg);
+	}
+#endif
+
+	for (;;) {
+		/* Try peeking from the queue.  The queue should be empty so we will
+		block, allowing the high priority task to execute. */
+		if (xQueuePeek(xQueue, &ulValue, portMAX_DELAY) != pdPASS) {
+			/* We expected to have received something by the time we unblock. */
+			xErrorDetected = pdTRUE;
+		}
+
+		/* When we reach here the high and medium priority tasks should still
+		be blocked on the queue.  We unblocked because the low priority task
+		wrote a value to the queue, which we should have peeked.  Peeking the
+		data (rather than receiving it) will leave the data on the queue, so
+		the high priority task should then have also been unblocked, but not
+		yet executed. */
+		if (ulValue != 0x11223344) {
+			/* We did not receive the expected value. */
+			xErrorDetected = pdTRUE;
+		}
+
+		if (uxQueueMessagesWaiting(xQueue) != 1) {
+			/* The message should have been left on the queue. */
+			xErrorDetected = pdTRUE;
+		}
+
+		/* Now we are going to actually receive the data, so when the high
+		priority task runs it will find the queue empty and return to the
+		blocked state. */
+		ulValue = 0;
+		if (xQueueReceive(xQueue, &ulValue, qpeekNO_BLOCK) != pdPASS) {
+			/* We expected to receive the value. */
+			xErrorDetected = pdTRUE;
+		}
+
+		if (ulValue != 0x11223344) {
+			/* We did not receive the expected value - which should have been
+			the same value as was peeked. */
+			xErrorDetected = pdTRUE;
+		}
+
+		/* Now we will block again as the queue is once more empty.  The low
+		priority task can then execute again. */
+		if (xQueuePeek(xQueue, &ulValue, portMAX_DELAY) != pdPASS) {
+			/* We expected to have received something by the time we unblock. */
+			xErrorDetected = pdTRUE;
+		}
+
+		/* When we get here the low priority task should have again written to the
+		queue. */
+		if (ulValue != 0x01234567) {
+			/* We did not receive the expected value. */
+			xErrorDetected = pdTRUE;
+		}
+
+		if (uxQueueMessagesWaiting(xQueue) != 1) {
+			/* The message should have been left on the queue. */
+			xErrorDetected = pdTRUE;
+		}
+
+		/* We only peeked the data, so suspending ourselves now should enable
+		the high priority task to also peek the data.  The high priority task
+		will have been unblocked when we peeked the data as we left the data
+		in the queue. */
+		vTaskSuspend(NULL);
+
+
+
+		/* This time we are going to do the same as the above test, but the
+		high priority task is going to receive the data, rather than peek it.
+		This means that the medium priority task should never peek the value. */
+		if (xQueuePeek(xQueue, &ulValue, portMAX_DELAY) != pdPASS) {
+			xErrorDetected = pdTRUE;
+		}
+
+		if (ulValue != 0xaabbaabb) {
+			xErrorDetected = pdTRUE;
+		}
+
+		vTaskSuspend(NULL);
+	}
+}
+/*-----------------------------------------------------------*/
+
+static void prvHighPriorityPeekTask(void *pvParameters)
+{
+	xQueueHandle xQueue = (xQueueHandle) pvParameters;
+	unsigned portLONG ulValue;
+
+	for (;;) {
+		/* Try peeking from the queue.  The queue should be empty so we will
+		block, allowing the medium priority task to execute.  Both the high
+		and highest priority tasks will then be blocked on the queue. */
+		if (xQueuePeek(xQueue, &ulValue, portMAX_DELAY) != pdPASS) {
+			/* We expected to have received something by the time we unblock. */
+			xErrorDetected = pdTRUE;
+		}
+
+		/* When we get here the highest priority task should have peeked the data
+		(unblocking this task) then suspended (allowing this task to also peek
+		the data). */
+		if (ulValue != 0x01234567) {
+			/* We did not receive the expected value. */
+			xErrorDetected = pdTRUE;
+		}
+
+		if (uxQueueMessagesWaiting(xQueue) != 1) {
+			/* The message should have been left on the queue. */
+			xErrorDetected = pdTRUE;
+		}
+
+		/* We only peeked the data, so suspending ourselves now should enable
+		the medium priority task to also peek the data.  The medium priority task
+		will have been unblocked when we peeked the data as we left the data
+		in the queue. */
+		vTaskSuspend(NULL);
+
+
+		/* This time we are going actually receive the value, so the medium
+		priority task will never peek the data - we removed it from the queue. */
+		if (xQueueReceive(xQueue, &ulValue, portMAX_DELAY) != pdPASS) {
+			xErrorDetected = pdTRUE;
+		}
+
+		if (ulValue != 0xaabbaabb) {
+			xErrorDetected = pdTRUE;
+		}
+
+		vTaskSuspend(NULL);
+	}
+}
+/*-----------------------------------------------------------*/
+
+static void prvMediumPriorityPeekTask(void *pvParameters)
+{
+	xQueueHandle xQueue = (xQueueHandle) pvParameters;
+	unsigned portLONG ulValue;
+
+	for (;;) {
+		/* Try peeking from the queue.  The queue should be empty so we will
+		block, allowing the low priority task to execute.  The highest, high
+		and medium priority tasks will then all be blocked on the queue. */
+		if (xQueuePeek(xQueue, &ulValue, portMAX_DELAY) != pdPASS) {
+			/* We expected to have received something by the time we unblock. */
+			xErrorDetected = pdTRUE;
+		}
+
+		/* When we get here the high priority task should have peeked the data
+		(unblocking this task) then suspended (allowing this task to also peek
+		the data). */
+		if (ulValue != 0x01234567) {
+			/* We did not receive the expected value. */
+			xErrorDetected = pdTRUE;
+		}
+
+		if (uxQueueMessagesWaiting(xQueue) != 1) {
+			/* The message should have been left on the queue. */
+			xErrorDetected = pdTRUE;
+		}
+
+		/* Just so we know the test is still running. */
+		ulLoopCounter++;
+
+		/* Now we can suspend ourselves so the low priority task can execute
+		again. */
+		vTaskSuspend(NULL);
+	}
+}
+/*-----------------------------------------------------------*/
+
+static void prvLowPriorityPeekTask(void *pvParameters)
+{
+	xQueueHandle xQueue = (xQueueHandle) pvParameters;
+	unsigned portLONG ulValue;
+
+	for (;;) {
+		/* Write some data to the queue.  This should unblock the highest
+		priority task that is waiting to peek data from the queue. */
+		ulValue = 0x11223344;
+		if (xQueueSendToBack(xQueue, &ulValue, qpeekNO_BLOCK) != pdPASS) {
+			/* We were expecting the queue to be empty so we should not of
+			had a problem writing to the queue. */
+			xErrorDetected = pdTRUE;
+		}
+
+		/* By the time we get here the data should have been removed from
+		the queue. */
+		if (uxQueueMessagesWaiting(xQueue) != 0) {
+			xErrorDetected = pdTRUE;
+		}
+
+		/* Write another value to the queue, again waking the highest priority
+		task that is blocked on the queue. */
+		ulValue = 0x01234567;
+		if (xQueueSendToBack(xQueue, &ulValue, qpeekNO_BLOCK) != pdPASS) {
+			/* We were expecting the queue to be empty so we should not of
+			had a problem writing to the queue. */
+			xErrorDetected = pdTRUE;
+		}
+
+		/* All the other tasks should now have successfully peeked the data.
+		The data is still in the queue so we should be able to receive it. */
+		ulValue = 0;
+		if (xQueueReceive(xQueue, &ulValue, qpeekNO_BLOCK) != pdPASS) {
+			/* We expected to receive the data. */
+			xErrorDetected = pdTRUE;
+		}
+
+		if (ulValue != 0x01234567) {
+			/* We did not receive the expected value. */
+		}
+
+		/* Lets just delay a while as this is an intensive test as we don't
+		want to starve other tests of processing time. */
+		vTaskDelay(qpeekSHORT_DELAY);
+
+		/* Unsuspend the other tasks so we can repeat the test - this time
+		however not all the other tasks will peek the data as the high
+		priority task is actually going to remove it from the queue.  Send
+		to front is used just to be different.  As the queue is empty it
+		makes no difference to the result. */
+		vTaskResume(xMediumPriorityTask);
+		vTaskResume(xHighPriorityTask);
+		vTaskResume(xHighestPriorityTask);
+
+		ulValue = 0xaabbaabb;
+		if (xQueueSendToFront(xQueue, &ulValue, qpeekNO_BLOCK) != pdPASS) {
+			/* We were expecting the queue to be empty so we should not of
+			had a problem writing to the queue. */
+			xErrorDetected = pdTRUE;
+		}
+
+		/* This time we should find that the queue is empty.  The high priority
+		task actually removed the data rather than just peeking it. */
+		if (xQueuePeek(xQueue, &ulValue, qpeekNO_BLOCK) != errQUEUE_EMPTY) {
+			/* We expected to receive the data. */
+			xErrorDetected = pdTRUE;
+		}
+
+		/* Unsuspend the highest and high priority tasks so we can go back
+		and repeat the whole thing.  The medium priority task should not be
+		suspended as it was not able to peek the data in this last case. */
+		vTaskResume(xHighPriorityTask);
+		vTaskResume(xHighestPriorityTask);
+
+		/* Lets just delay a while as this is an intensive test as we don't
+		want to starve other tests of processing time. */
+		vTaskDelay(qpeekSHORT_DELAY);
+	}
+}
+/*-----------------------------------------------------------*/
+
+/* This is called to check that all the created tasks are still running. */
+portBASE_TYPE xAreQueuePeekTasksStillRunning(void)
+{
+	static unsigned portLONG ulLastLoopCounter = 0;
+
+	/* If the demo task is still running then we expect the loopcounter to
+	have incremented since this function was last called. */
+	if (ulLastLoopCounter == ulLoopCounter) {
+		xErrorDetected = pdTRUE;
+	}
+
+	ulLastLoopCounter = ulLoopCounter;
+
+	/* Errors detected in the task itself will have latched xErrorDetected
+	to true. */
+
+	return !xErrorDetected;
+}
+
diff --git a/gyro_board/src/usb/CommonDemoTasks/blocktim.c b/gyro_board/src/usb/CommonDemoTasks/blocktim.c
new file mode 100644
index 0000000..0174cee
--- /dev/null
+++ b/gyro_board/src/usb/CommonDemoTasks/blocktim.c
@@ -0,0 +1,456 @@
+/*
+    FreeRTOS V6.0.5 - Copyright (C) 2010 Real Time Engineers Ltd.
+
+    ***************************************************************************
+    *                                                                         *
+    * If you are:                                                             *
+    *                                                                         *
+    *    + New to FreeRTOS,                                                   *
+    *    + Wanting to learn FreeRTOS or multitasking in general quickly       *
+    *    + Looking for basic training,                                        *
+    *    + Wanting to improve your FreeRTOS skills and productivity           *
+    *                                                                         *
+    * then take a look at the FreeRTOS eBook                                  *
+    *                                                                         *
+    *        "Using the FreeRTOS Real Time Kernel - a Practical Guide"        *
+    *                  http://www.FreeRTOS.org/Documentation                  *
+    *                                                                         *
+    * A pdf reference manual is also available.  Both are usually delivered   *
+    * to your inbox within 20 minutes to two hours when purchased between 8am *
+    * and 8pm GMT (although please allow up to 24 hours in case of            *
+    * exceptional circumstances).  Thank you for your support!                *
+    *                                                                         *
+    ***************************************************************************
+
+    This file is part of the FreeRTOS distribution.
+
+    FreeRTOS is free software; you can redistribute it and/or modify it under
+    the terms of the GNU General Public License (version 2) as published by the
+    Free Software Foundation AND MODIFIED BY the FreeRTOS exception.
+    ***NOTE*** The exception to the GPL is included to allow you to distribute
+    a combined work that includes FreeRTOS without being obliged to provide the
+    source code for proprietary components outside of the FreeRTOS kernel.
+    FreeRTOS 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 and the FreeRTOS license exception along with FreeRTOS; if not it
+    can be viewed here: http://www.freertos.org/a00114.html and also obtained
+    by writing to Richard Barry, contact details for whom are available on the
+    FreeRTOS WEB site.
+
+    1 tab == 4 spaces!
+
+    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.
+*/
+
+/*
+ * This file contains some test scenarios that ensure tasks do not exit queue
+ * send or receive functions prematurely.  A description of the tests is
+ * included within the code.
+ */
+
+/* Kernel includes. */
+#include "FreeRTOS.h"
+#include "task.h"
+#include "queue.h"
+
+/* Demo includes. */
+#include "blocktim.h"
+
+/* Task priorities.  Allow these to be overridden. */
+#ifndef bktPRIMARY_PRIORITY
+#define bktPRIMARY_PRIORITY			( 3 )
+#endif
+
+#ifndef bktSECONDARY_PRIORITY
+#define bktSECONDARY_PRIORITY		( 2 )
+#endif
+
+/* Task behaviour. */
+#define bktQUEUE_LENGTH				( 5 )
+#define bktSHORT_WAIT				( ( ( portTickType ) 20 ) / portTICK_RATE_MS )
+#define bktPRIMARY_BLOCK_TIME		( 10 )
+#define bktALLOWABLE_MARGIN			( 15 )
+#define bktTIME_TO_BLOCK			( 175 )
+#define bktDONT_BLOCK				( ( portTickType ) 0 )
+#define bktRUN_INDICATOR			( ( unsigned portBASE_TYPE ) 0x55 )
+
+/* The queue on which the tasks block. */
+static xQueueHandle xTestQueue;
+
+/* Handle to the secondary task is required by the primary task for calls
+to vTaskSuspend/Resume(). */
+static xTaskHandle xSecondary;
+
+/* Used to ensure that tasks are still executing without error. */
+static volatile portBASE_TYPE xPrimaryCycles = 0, xSecondaryCycles = 0;
+static volatile portBASE_TYPE xErrorOccurred = pdFALSE;
+
+/* Provides a simple mechanism for the primary task to know when the
+secondary task has executed. */
+static volatile unsigned portBASE_TYPE xRunIndicator;
+
+/* The two test tasks.  Their behaviour is commented within the files. */
+static void vPrimaryBlockTimeTestTask(void *pvParameters);
+static void vSecondaryBlockTimeTestTask(void *pvParameters);
+
+/*-----------------------------------------------------------*/
+
+void vCreateBlockTimeTasks(void)
+{
+	/* Create the queue on which the two tasks block. */
+	xTestQueue = xQueueCreate(bktQUEUE_LENGTH, sizeof(portBASE_TYPE));
+
+	/* vQueueAddToRegistry() adds the queue to the queue registry, if one is
+	in use.  The queue registry is provided as a means for kernel aware
+	debuggers to locate queues and has no purpose if a kernel aware debugger
+	is not being used.  The call to vQueueAddToRegistry() will be removed
+	by the pre-processor if configQUEUE_REGISTRY_SIZE is not defined or is
+	defined to be less than 1. */
+	vQueueAddToRegistry(xTestQueue, (signed char *) "Block_Time_Queue");
+
+	/* Create the two test tasks. */
+	xTaskCreate(vPrimaryBlockTimeTestTask, (signed char *)"BTest1", configMINIMAL_STACK_SIZE, NULL, bktPRIMARY_PRIORITY, NULL);
+	xTaskCreate(vSecondaryBlockTimeTestTask, (signed char *)"BTest2", configMINIMAL_STACK_SIZE, NULL, bktSECONDARY_PRIORITY, &xSecondary);
+}
+/*-----------------------------------------------------------*/
+
+static void vPrimaryBlockTimeTestTask(void *pvParameters)
+{
+	portBASE_TYPE xItem, xData;
+	portTickType xTimeWhenBlocking;
+	portTickType xTimeToBlock, xBlockedTime;
+
+	(void) pvParameters;
+
+	for (;;) {
+		/*********************************************************************
+		Test 1
+
+		Simple block time wakeup test on queue receives. */
+		for (xItem = 0; xItem < bktQUEUE_LENGTH; xItem++) {
+			/* The queue is empty. Attempt to read from the queue using a block
+			time.  When we wake, ensure the delta in time is as expected. */
+			xTimeToBlock = bktPRIMARY_BLOCK_TIME << xItem;
+
+			xTimeWhenBlocking = xTaskGetTickCount();
+
+			/* We should unblock after xTimeToBlock having not received
+			anything on the queue. */
+			if (xQueueReceive(xTestQueue, &xData, xTimeToBlock) != errQUEUE_EMPTY) {
+				xErrorOccurred = pdTRUE;
+			}
+
+			/* How long were we blocked for? */
+			xBlockedTime = xTaskGetTickCount() - xTimeWhenBlocking;
+
+			if (xBlockedTime < xTimeToBlock) {
+				/* Should not have blocked for less than we requested. */
+				xErrorOccurred = pdTRUE;
+			}
+
+			if (xBlockedTime > (xTimeToBlock + bktALLOWABLE_MARGIN)) {
+				/* Should not have blocked for longer than we requested,
+				although we would not necessarily run as soon as we were
+				unblocked so a margin is allowed. */
+				xErrorOccurred = pdTRUE;
+			}
+		}
+
+		/*********************************************************************
+		Test 2
+
+		Simple block time wakeup test on queue sends.
+
+		First fill the queue.  It should be empty so all sends should pass. */
+		for (xItem = 0; xItem < bktQUEUE_LENGTH; xItem++) {
+			if (xQueueSend(xTestQueue, &xItem, bktDONT_BLOCK) != pdPASS) {
+				xErrorOccurred = pdTRUE;
+			}
+
+#if configUSE_PREEMPTION == 0
+			taskYIELD();
+#endif
+		}
+
+		for (xItem = 0; xItem < bktQUEUE_LENGTH; xItem++) {
+			/* The queue is full. Attempt to write to the queue using a block
+			time.  When we wake, ensure the delta in time is as expected. */
+			xTimeToBlock = bktPRIMARY_BLOCK_TIME << xItem;
+
+			xTimeWhenBlocking = xTaskGetTickCount();
+
+			/* We should unblock after xTimeToBlock having not received
+			anything on the queue. */
+			if (xQueueSend(xTestQueue, &xItem, xTimeToBlock) != errQUEUE_FULL) {
+				xErrorOccurred = pdTRUE;
+			}
+
+			/* How long were we blocked for? */
+			xBlockedTime = xTaskGetTickCount() - xTimeWhenBlocking;
+
+			if (xBlockedTime < xTimeToBlock) {
+				/* Should not have blocked for less than we requested. */
+				xErrorOccurred = pdTRUE;
+			}
+
+			if (xBlockedTime > (xTimeToBlock + bktALLOWABLE_MARGIN)) {
+				/* Should not have blocked for longer than we requested,
+				although we would not necessarily run as soon as we were
+				unblocked so a margin is allowed. */
+				xErrorOccurred = pdTRUE;
+			}
+		}
+
+		/*********************************************************************
+		Test 3
+
+		Wake the other task, it will block attempting to post to the queue.
+		When we read from the queue the other task will wake, but before it
+		can run we will post to the queue again.  When the other task runs it
+		will find the queue still full, even though it was woken.  It should
+		recognise that its block time has not expired and return to block for
+		the remains of its block time.
+
+		Wake the other task so it blocks attempting to post to the already
+		full queue. */
+		xRunIndicator = 0;
+		vTaskResume(xSecondary);
+
+		/* We need to wait a little to ensure the other task executes. */
+		while (xRunIndicator != bktRUN_INDICATOR) {
+			/* The other task has not yet executed. */
+			vTaskDelay(bktSHORT_WAIT);
+		}
+		/* Make sure the other task is blocked on the queue. */
+		vTaskDelay(bktSHORT_WAIT);
+		xRunIndicator = 0;
+
+		for (xItem = 0; xItem < bktQUEUE_LENGTH; xItem++) {
+			/* Now when we make space on the queue the other task should wake
+			but not execute as this task has higher priority. */
+			if (xQueueReceive(xTestQueue, &xData, bktDONT_BLOCK) != pdPASS) {
+				xErrorOccurred = pdTRUE;
+			}
+
+			/* Now fill the queue again before the other task gets a chance to
+			execute.  If the other task had executed we would find the queue
+			full ourselves, and the other task have set xRunIndicator. */
+			if (xQueueSend(xTestQueue, &xItem, bktDONT_BLOCK) != pdPASS) {
+				xErrorOccurred = pdTRUE;
+			}
+
+			if (xRunIndicator == bktRUN_INDICATOR) {
+				/* The other task should not have executed. */
+				xErrorOccurred = pdTRUE;
+			}
+
+			/* Raise the priority of the other task so it executes and blocks
+			on the queue again. */
+			vTaskPrioritySet(xSecondary, bktPRIMARY_PRIORITY + 2);
+
+			/* The other task should now have re-blocked without exiting the
+			queue function. */
+			if (xRunIndicator == bktRUN_INDICATOR) {
+				/* The other task should not have executed outside of the
+				queue function. */
+				xErrorOccurred = pdTRUE;
+			}
+
+			/* Set the priority back down. */
+			vTaskPrioritySet(xSecondary, bktSECONDARY_PRIORITY);
+		}
+
+		/* Let the other task timeout.  When it unblockes it will check that it
+		unblocked at the correct time, then suspend itself. */
+		while (xRunIndicator != bktRUN_INDICATOR) {
+			vTaskDelay(bktSHORT_WAIT);
+		}
+		vTaskDelay(bktSHORT_WAIT);
+		xRunIndicator = 0;
+
+
+		/*********************************************************************
+		Test 4
+
+		As per test 3 - but with the send and receive the other way around.
+		The other task blocks attempting to read from the queue.
+
+		Empty the queue.  We should find that it is full. */
+		for (xItem = 0; xItem < bktQUEUE_LENGTH; xItem++) {
+			if (xQueueReceive(xTestQueue, &xData, bktDONT_BLOCK) != pdPASS) {
+				xErrorOccurred = pdTRUE;
+			}
+		}
+
+		/* Wake the other task so it blocks attempting to read from  the
+		already	empty queue. */
+		vTaskResume(xSecondary);
+
+		/* We need to wait a little to ensure the other task executes. */
+		while (xRunIndicator != bktRUN_INDICATOR) {
+			vTaskDelay(bktSHORT_WAIT);
+		}
+		vTaskDelay(bktSHORT_WAIT);
+		xRunIndicator = 0;
+
+		for (xItem = 0; xItem < bktQUEUE_LENGTH; xItem++) {
+			/* Now when we place an item on the queue the other task should
+			wake but not execute as this task has higher priority. */
+			if (xQueueSend(xTestQueue, &xItem, bktDONT_BLOCK) != pdPASS) {
+				xErrorOccurred = pdTRUE;
+			}
+
+			/* Now empty the queue again before the other task gets a chance to
+			execute.  If the other task had executed we would find the queue
+			empty ourselves, and the other task would be suspended. */
+			if (xQueueReceive(xTestQueue, &xData, bktDONT_BLOCK) != pdPASS) {
+				xErrorOccurred = pdTRUE;
+			}
+
+			if (xRunIndicator == bktRUN_INDICATOR) {
+				/* The other task should not have executed. */
+				xErrorOccurred = pdTRUE;
+			}
+
+			/* Raise the priority of the other task so it executes and blocks
+			on the queue again. */
+			vTaskPrioritySet(xSecondary, bktPRIMARY_PRIORITY + 2);
+
+			/* The other task should now have re-blocked without exiting the
+			queue function. */
+			if (xRunIndicator == bktRUN_INDICATOR) {
+				/* The other task should not have executed outside of the
+				queue function. */
+				xErrorOccurred = pdTRUE;
+			}
+			vTaskPrioritySet(xSecondary, bktSECONDARY_PRIORITY);
+		}
+
+		/* Let the other task timeout.  When it unblockes it will check that it
+		unblocked at the correct time, then suspend itself. */
+		while (xRunIndicator != bktRUN_INDICATOR) {
+			vTaskDelay(bktSHORT_WAIT);
+		}
+		vTaskDelay(bktSHORT_WAIT);
+
+		xPrimaryCycles++;
+	}
+}
+/*-----------------------------------------------------------*/
+
+static void vSecondaryBlockTimeTestTask(void *pvParameters)
+{
+	portTickType xTimeWhenBlocking, xBlockedTime;
+	portBASE_TYPE xData;
+
+	(void) pvParameters;
+
+	for (;;) {
+		/*********************************************************************
+		Test 1 and 2
+
+		This task does does not participate in these tests. */
+		vTaskSuspend(NULL);
+
+		/*********************************************************************
+		Test 3
+
+		The first thing we do is attempt to read from the queue.  It should be
+		full so we block.  Note the time before we block so we can check the
+		wake time is as per that expected. */
+		xTimeWhenBlocking = xTaskGetTickCount();
+
+		/* We should unblock after bktTIME_TO_BLOCK having not sent
+		anything to the queue. */
+		xData = 0;
+		xRunIndicator = bktRUN_INDICATOR;
+		if (xQueueSend(xTestQueue, &xData, bktTIME_TO_BLOCK) != errQUEUE_FULL) {
+			xErrorOccurred = pdTRUE;
+		}
+
+		/* How long were we inside the send function? */
+		xBlockedTime = xTaskGetTickCount() - xTimeWhenBlocking;
+
+		/* We should not have blocked for less time than bktTIME_TO_BLOCK. */
+		if (xBlockedTime < bktTIME_TO_BLOCK) {
+			xErrorOccurred = pdTRUE;
+		}
+
+		/* We should of not blocked for much longer than bktALLOWABLE_MARGIN
+		either.  A margin is permitted as we would not necessarily run as
+		soon as we unblocked. */
+		if (xBlockedTime > (bktTIME_TO_BLOCK + bktALLOWABLE_MARGIN)) {
+			xErrorOccurred = pdTRUE;
+		}
+
+		/* Suspend ready for test 3. */
+		xRunIndicator = bktRUN_INDICATOR;
+		vTaskSuspend(NULL);
+
+		/*********************************************************************
+		Test 4
+
+		As per test three, but with the send and receive reversed. */
+		xTimeWhenBlocking = xTaskGetTickCount();
+
+		/* We should unblock after bktTIME_TO_BLOCK having not received
+		anything on the queue. */
+		xRunIndicator = bktRUN_INDICATOR;
+		if (xQueueReceive(xTestQueue, &xData, bktTIME_TO_BLOCK) != errQUEUE_EMPTY) {
+			xErrorOccurred = pdTRUE;
+		}
+
+		xBlockedTime = xTaskGetTickCount() - xTimeWhenBlocking;
+
+		/* We should not have blocked for less time than bktTIME_TO_BLOCK. */
+		if (xBlockedTime < bktTIME_TO_BLOCK) {
+			xErrorOccurred = pdTRUE;
+		}
+
+		/* We should of not blocked for much longer than bktALLOWABLE_MARGIN
+		either.  A margin is permitted as we would not necessarily run as soon
+		as we unblocked. */
+		if (xBlockedTime > (bktTIME_TO_BLOCK + bktALLOWABLE_MARGIN)) {
+			xErrorOccurred = pdTRUE;
+		}
+
+		xRunIndicator = bktRUN_INDICATOR;
+
+		xSecondaryCycles++;
+	}
+}
+/*-----------------------------------------------------------*/
+
+portBASE_TYPE xAreBlockTimeTestTasksStillRunning(void)
+{
+	static portBASE_TYPE xLastPrimaryCycleCount = 0, xLastSecondaryCycleCount = 0;
+	portBASE_TYPE xReturn = pdPASS;
+
+	/* Have both tasks performed at least one cycle since this function was
+	last called? */
+	if (xPrimaryCycles == xLastPrimaryCycleCount) {
+		xReturn = pdFAIL;
+	}
+
+	if (xSecondaryCycles == xLastSecondaryCycleCount) {
+		xReturn = pdFAIL;
+	}
+
+	if (xErrorOccurred == pdTRUE) {
+		xReturn = pdFAIL;
+	}
+
+	xLastSecondaryCycleCount = xSecondaryCycles;
+	xLastPrimaryCycleCount = xPrimaryCycles;
+
+	return xReturn;
+}
diff --git a/gyro_board/src/usb/CommonDemoTasks/flash.c b/gyro_board/src/usb/CommonDemoTasks/flash.c
new file mode 100644
index 0000000..fadc899
--- /dev/null
+++ b/gyro_board/src/usb/CommonDemoTasks/flash.c
@@ -0,0 +1,146 @@
+/*
+    FreeRTOS V6.0.5 - Copyright (C) 2010 Real Time Engineers Ltd.
+
+    ***************************************************************************
+    *                                                                         *
+    * If you are:                                                             *
+    *                                                                         *
+    *    + New to FreeRTOS,                                                   *
+    *    + Wanting to learn FreeRTOS or multitasking in general quickly       *
+    *    + Looking for basic training,                                        *
+    *    + Wanting to improve your FreeRTOS skills and productivity           *
+    *                                                                         *
+    * then take a look at the FreeRTOS eBook                                  *
+    *                                                                         *
+    *        "Using the FreeRTOS Real Time Kernel - a Practical Guide"        *
+    *                  http://www.FreeRTOS.org/Documentation                  *
+    *                                                                         *
+    * A pdf reference manual is also available.  Both are usually delivered   *
+    * to your inbox within 20 minutes to two hours when purchased between 8am *
+    * and 8pm GMT (although please allow up to 24 hours in case of            *
+    * exceptional circumstances).  Thank you for your support!                *
+    *                                                                         *
+    ***************************************************************************
+
+    This file is part of the FreeRTOS distribution.
+
+    FreeRTOS is free software; you can redistribute it and/or modify it under
+    the terms of the GNU General Public License (version 2) as published by the
+    Free Software Foundation AND MODIFIED BY the FreeRTOS exception.
+    ***NOTE*** The exception to the GPL is included to allow you to distribute
+    a combined work that includes FreeRTOS without being obliged to provide the
+    source code for proprietary components outside of the FreeRTOS kernel.
+    FreeRTOS 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 and the FreeRTOS license exception along with FreeRTOS; if not it
+    can be viewed here: http://www.freertos.org/a00114.html and also obtained
+    by writing to Richard Barry, contact details for whom are available on the
+    FreeRTOS WEB site.
+
+    1 tab == 4 spaces!
+
+    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.
+*/
+
+/**
+ * This version of flash .c is for use on systems that have limited stack space
+ * and no display facilities.  The complete version can be found in the
+ * Demo/Common/Full directory.
+ *
+ * Three tasks are created, each of which flash an LED at a different rate.  The first
+ * LED flashes every 200ms, the second every 400ms, the third every 600ms.
+ *
+ * The LED flash tasks provide instant visual feedback.  They show that the scheduler
+ * is still operational.
+ *
+ */
+
+
+#include <stdlib.h>
+
+/* Scheduler include files. */
+#include "FreeRTOS.h"
+#include "task.h"
+
+/* Demo program include files. */
+#include "partest.h"
+#include "flash.h"
+
+#define ledSTACK_SIZE		configMINIMAL_STACK_SIZE
+#define ledNUMBER_OF_LEDS	( 3 )
+#define ledFLASH_RATE_BASE	( ( portTickType ) 333 )
+
+/* Variable used by the created tasks to calculate the LED number to use, and
+the rate at which they should flash the LED. */
+static volatile unsigned portBASE_TYPE uxFlashTaskNumber = 0;
+
+/* The task that is created three times. */
+static portTASK_FUNCTION_PROTO(vLEDFlashTask, pvParameters);
+
+/*-----------------------------------------------------------*/
+
+// To continually print out the serial output, run the following command.
+// while true; do [ `ls /dev/ttyACM* 2>/dev/null` ] && ls /dev/ttyACM* | python -c "import sys; x = sys.stdin.readline()[:-1].split(' ')[0]; sys.stderr.write('Connecting to %s\n' % (x,)); print x" | xargs cat || sleep 0.25;  done
+
+void vStartLEDFlashTasks(unsigned portBASE_TYPE uxPriority)
+{
+	signed portBASE_TYPE xLEDTask;
+
+	/* Create the three tasks. */
+	for (xLEDTask = 0; xLEDTask < ledNUMBER_OF_LEDS; ++xLEDTask) {
+		/* Spawn the task. */
+		xTaskCreate(vLEDFlashTask, (signed char *) "LEDx", ledSTACK_SIZE, NULL, uxPriority, (xTaskHandle *) NULL);
+	}
+}
+/*-----------------------------------------------------------*/
+
+static portTASK_FUNCTION(vLEDFlashTask, pvParameters)
+{
+	portTickType xFlashRate, xLastFlashTime;
+	unsigned portBASE_TYPE uxLED;
+
+	/* The parameters are not used. */
+	(void) pvParameters;
+
+	/* Calculate the LED and flash rate. */
+	portENTER_CRITICAL();
+	{
+		/* See which of the eight LED's we should use. */
+		uxLED = uxFlashTaskNumber;
+
+		/* Update so the next task uses the next LED. */
+		uxFlashTaskNumber++;
+	}
+	portEXIT_CRITICAL();
+
+	xFlashRate = ledFLASH_RATE_BASE + (ledFLASH_RATE_BASE * (portTickType) uxLED);
+	xFlashRate /= portTICK_RATE_MS;
+
+	/* We will turn the LED on and off again in the delay period, so each
+	delay is only half the total period. */
+	xFlashRate /= (portTickType) 2;
+
+	/* We need to initialise xLastFlashTime prior to the first call to
+	vTaskDelayUntil(). */
+	xLastFlashTime = xTaskGetTickCount();
+
+	for (;;) {
+		/* Delay for half the flash period then turn the LED on. */
+		vTaskDelayUntil(&xLastFlashTime, xFlashRate);
+		vParTestToggleLED(uxLED);
+
+		/* Delay for half the flash period then turn the LED off. */
+		vTaskDelayUntil(&xLastFlashTime, xFlashRate);
+		vParTestToggleLED(uxLED);
+	}
+} /*lint !e715 !e818 !e830 Function definition must be standard for task creation. */
+
diff --git a/gyro_board/src/usb/CommonDemoTasks/include/AltBlckQ.h b/gyro_board/src/usb/CommonDemoTasks/include/AltBlckQ.h
new file mode 100644
index 0000000..dad37ba
--- /dev/null
+++ b/gyro_board/src/usb/CommonDemoTasks/include/AltBlckQ.h
@@ -0,0 +1,62 @@
+/*
+    FreeRTOS V6.0.5 - Copyright (C) 2010 Real Time Engineers Ltd.
+
+    ***************************************************************************
+    *                                                                         *
+    * If you are:                                                             *
+    *                                                                         *
+    *    + New to FreeRTOS,                                                   *
+    *    + Wanting to learn FreeRTOS or multitasking in general quickly       *
+    *    + Looking for basic training,                                        *
+    *    + Wanting to improve your FreeRTOS skills and productivity           *
+    *                                                                         *
+    * then take a look at the FreeRTOS eBook                                  *
+    *                                                                         *
+    *        "Using the FreeRTOS Real Time Kernel - a Practical Guide"        *
+    *                  http://www.FreeRTOS.org/Documentation                  *
+    *                                                                         *
+    * A pdf reference manual is also available.  Both are usually delivered   *
+    * to your inbox within 20 minutes to two hours when purchased between 8am *
+    * and 8pm GMT (although please allow up to 24 hours in case of            *
+    * exceptional circumstances).  Thank you for your support!                *
+    *                                                                         *
+    ***************************************************************************
+
+    This file is part of the FreeRTOS distribution.
+
+    FreeRTOS is free software; you can redistribute it and/or modify it under
+    the terms of the GNU General Public License (version 2) as published by the
+    Free Software Foundation AND MODIFIED BY the FreeRTOS exception.
+    ***NOTE*** The exception to the GPL is included to allow you to distribute
+    a combined work that includes FreeRTOS without being obliged to provide the
+    source code for proprietary components outside of the FreeRTOS kernel.
+    FreeRTOS 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 and the FreeRTOS license exception along with FreeRTOS; if not it
+    can be viewed here: http://www.freertos.org/a00114.html and also obtained
+    by writing to Richard Barry, contact details for whom are available on the
+    FreeRTOS WEB site.
+
+    1 tab == 4 spaces!
+
+    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 ALT_BLOCK_Q_H
+#define ALT_BLOCK_Q_H
+
+void vStartAltBlockingQueueTasks(unsigned portBASE_TYPE uxPriority);
+portBASE_TYPE xAreAltBlockingQueuesStillRunning(void);
+
+#endif
+
+
diff --git a/gyro_board/src/usb/CommonDemoTasks/include/AltBlock.h b/gyro_board/src/usb/CommonDemoTasks/include/AltBlock.h
new file mode 100644
index 0000000..caa0516
--- /dev/null
+++ b/gyro_board/src/usb/CommonDemoTasks/include/AltBlock.h
@@ -0,0 +1,62 @@
+/*
+    FreeRTOS V6.0.5 - Copyright (C) 2010 Real Time Engineers Ltd.
+
+    ***************************************************************************
+    *                                                                         *
+    * If you are:                                                             *
+    *                                                                         *
+    *    + New to FreeRTOS,                                                   *
+    *    + Wanting to learn FreeRTOS or multitasking in general quickly       *
+    *    + Looking for basic training,                                        *
+    *    + Wanting to improve your FreeRTOS skills and productivity           *
+    *                                                                         *
+    * then take a look at the FreeRTOS eBook                                  *
+    *                                                                         *
+    *        "Using the FreeRTOS Real Time Kernel - a Practical Guide"        *
+    *                  http://www.FreeRTOS.org/Documentation                  *
+    *                                                                         *
+    * A pdf reference manual is also available.  Both are usually delivered   *
+    * to your inbox within 20 minutes to two hours when purchased between 8am *
+    * and 8pm GMT (although please allow up to 24 hours in case of            *
+    * exceptional circumstances).  Thank you for your support!                *
+    *                                                                         *
+    ***************************************************************************
+
+    This file is part of the FreeRTOS distribution.
+
+    FreeRTOS is free software; you can redistribute it and/or modify it under
+    the terms of the GNU General Public License (version 2) as published by the
+    Free Software Foundation AND MODIFIED BY the FreeRTOS exception.
+    ***NOTE*** The exception to the GPL is included to allow you to distribute
+    a combined work that includes FreeRTOS without being obliged to provide the
+    source code for proprietary components outside of the FreeRTOS kernel.
+    FreeRTOS 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 and the FreeRTOS license exception along with FreeRTOS; if not it
+    can be viewed here: http://www.freertos.org/a00114.html and also obtained
+    by writing to Richard Barry, contact details for whom are available on the
+    FreeRTOS WEB site.
+
+    1 tab == 4 spaces!
+
+    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 FAST_BLOCK_TIME_TEST_H
+#define FAST_BLOCK_TIME_TEST_H
+
+void vCreateAltBlockTimeTasks(void);
+portBASE_TYPE xAreAltBlockTimeTestTasksStillRunning(void);
+
+#endif
+
+
diff --git a/gyro_board/src/usb/CommonDemoTasks/include/AltPollQ.h b/gyro_board/src/usb/CommonDemoTasks/include/AltPollQ.h
new file mode 100644
index 0000000..66ac04e
--- /dev/null
+++ b/gyro_board/src/usb/CommonDemoTasks/include/AltPollQ.h
@@ -0,0 +1,62 @@
+/*
+    FreeRTOS V6.0.5 - Copyright (C) 2010 Real Time Engineers Ltd.
+
+    ***************************************************************************
+    *                                                                         *
+    * If you are:                                                             *
+    *                                                                         *
+    *    + New to FreeRTOS,                                                   *
+    *    + Wanting to learn FreeRTOS or multitasking in general quickly       *
+    *    + Looking for basic training,                                        *
+    *    + Wanting to improve your FreeRTOS skills and productivity           *
+    *                                                                         *
+    * then take a look at the FreeRTOS eBook                                  *
+    *                                                                         *
+    *        "Using the FreeRTOS Real Time Kernel - a Practical Guide"        *
+    *                  http://www.FreeRTOS.org/Documentation                  *
+    *                                                                         *
+    * A pdf reference manual is also available.  Both are usually delivered   *
+    * to your inbox within 20 minutes to two hours when purchased between 8am *
+    * and 8pm GMT (although please allow up to 24 hours in case of            *
+    * exceptional circumstances).  Thank you for your support!                *
+    *                                                                         *
+    ***************************************************************************
+
+    This file is part of the FreeRTOS distribution.
+
+    FreeRTOS is free software; you can redistribute it and/or modify it under
+    the terms of the GNU General Public License (version 2) as published by the
+    Free Software Foundation AND MODIFIED BY the FreeRTOS exception.
+    ***NOTE*** The exception to the GPL is included to allow you to distribute
+    a combined work that includes FreeRTOS without being obliged to provide the
+    source code for proprietary components outside of the FreeRTOS kernel.
+    FreeRTOS 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 and the FreeRTOS license exception along with FreeRTOS; if not it
+    can be viewed here: http://www.freertos.org/a00114.html and also obtained
+    by writing to Richard Barry, contact details for whom are available on the
+    FreeRTOS WEB site.
+
+    1 tab == 4 spaces!
+
+    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 ALT_POLLED_Q_H
+#define ALT_POLLED_Q_H
+
+void vStartAltPolledQueueTasks(unsigned portBASE_TYPE uxPriority);
+portBASE_TYPE xAreAltPollingQueuesStillRunning(void);
+
+#endif
+
+
diff --git a/gyro_board/src/usb/CommonDemoTasks/include/AltQTest.h b/gyro_board/src/usb/CommonDemoTasks/include/AltQTest.h
new file mode 100644
index 0000000..b8cc24d
--- /dev/null
+++ b/gyro_board/src/usb/CommonDemoTasks/include/AltQTest.h
@@ -0,0 +1,63 @@
+/*
+    FreeRTOS V6.0.5 - Copyright (C) 2010 Real Time Engineers Ltd.
+
+    ***************************************************************************
+    *                                                                         *
+    * If you are:                                                             *
+    *                                                                         *
+    *    + New to FreeRTOS,                                                   *
+    *    + Wanting to learn FreeRTOS or multitasking in general quickly       *
+    *    + Looking for basic training,                                        *
+    *    + Wanting to improve your FreeRTOS skills and productivity           *
+    *                                                                         *
+    * then take a look at the FreeRTOS eBook                                  *
+    *                                                                         *
+    *        "Using the FreeRTOS Real Time Kernel - a Practical Guide"        *
+    *                  http://www.FreeRTOS.org/Documentation                  *
+    *                                                                         *
+    * A pdf reference manual is also available.  Both are usually delivered   *
+    * to your inbox within 20 minutes to two hours when purchased between 8am *
+    * and 8pm GMT (although please allow up to 24 hours in case of            *
+    * exceptional circumstances).  Thank you for your support!                *
+    *                                                                         *
+    ***************************************************************************
+
+    This file is part of the FreeRTOS distribution.
+
+    FreeRTOS is free software; you can redistribute it and/or modify it under
+    the terms of the GNU General Public License (version 2) as published by the
+    Free Software Foundation AND MODIFIED BY the FreeRTOS exception.
+    ***NOTE*** The exception to the GPL is included to allow you to distribute
+    a combined work that includes FreeRTOS without being obliged to provide the
+    source code for proprietary components outside of the FreeRTOS kernel.
+    FreeRTOS 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 and the FreeRTOS license exception along with FreeRTOS; if not it
+    can be viewed here: http://www.freertos.org/a00114.html and also obtained
+    by writing to Richard Barry, contact details for whom are available on the
+    FreeRTOS WEB site.
+
+    1 tab == 4 spaces!
+
+    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 FAST_GEN_Q_TEST_H
+#define FAST_GEN_Q_TEST_H
+
+void vStartAltGenericQueueTasks(unsigned portBASE_TYPE uxPriority);
+portBASE_TYPE xAreAltGenericQueueTasksStillRunning(void);
+
+#endif /* GEN_Q_TEST_H */
+
+
+
diff --git a/gyro_board/src/usb/CommonDemoTasks/include/BlockQ.h b/gyro_board/src/usb/CommonDemoTasks/include/BlockQ.h
new file mode 100644
index 0000000..30ea0e1
--- /dev/null
+++ b/gyro_board/src/usb/CommonDemoTasks/include/BlockQ.h
@@ -0,0 +1,62 @@
+/*
+    FreeRTOS V6.0.5 - Copyright (C) 2010 Real Time Engineers Ltd.
+
+    ***************************************************************************
+    *                                                                         *
+    * If you are:                                                             *
+    *                                                                         *
+    *    + New to FreeRTOS,                                                   *
+    *    + Wanting to learn FreeRTOS or multitasking in general quickly       *
+    *    + Looking for basic training,                                        *
+    *    + Wanting to improve your FreeRTOS skills and productivity           *
+    *                                                                         *
+    * then take a look at the FreeRTOS eBook                                  *
+    *                                                                         *
+    *        "Using the FreeRTOS Real Time Kernel - a Practical Guide"        *
+    *                  http://www.FreeRTOS.org/Documentation                  *
+    *                                                                         *
+    * A pdf reference manual is also available.  Both are usually delivered   *
+    * to your inbox within 20 minutes to two hours when purchased between 8am *
+    * and 8pm GMT (although please allow up to 24 hours in case of            *
+    * exceptional circumstances).  Thank you for your support!                *
+    *                                                                         *
+    ***************************************************************************
+
+    This file is part of the FreeRTOS distribution.
+
+    FreeRTOS is free software; you can redistribute it and/or modify it under
+    the terms of the GNU General Public License (version 2) as published by the
+    Free Software Foundation AND MODIFIED BY the FreeRTOS exception.
+    ***NOTE*** The exception to the GPL is included to allow you to distribute
+    a combined work that includes FreeRTOS without being obliged to provide the
+    source code for proprietary components outside of the FreeRTOS kernel.
+    FreeRTOS 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 and the FreeRTOS license exception along with FreeRTOS; if not it
+    can be viewed here: http://www.freertos.org/a00114.html and also obtained
+    by writing to Richard Barry, contact details for whom are available on the
+    FreeRTOS WEB site.
+
+    1 tab == 4 spaces!
+
+    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 BLOCK_Q_H
+#define BLOCK_Q_H
+
+void vStartBlockingQueueTasks(unsigned portBASE_TYPE uxPriority);
+portBASE_TYPE xAreBlockingQueuesStillRunning(void);
+
+#endif
+
+
diff --git a/gyro_board/src/usb/CommonDemoTasks/include/GenQTest.h b/gyro_board/src/usb/CommonDemoTasks/include/GenQTest.h
new file mode 100644
index 0000000..32a2718
--- /dev/null
+++ b/gyro_board/src/usb/CommonDemoTasks/include/GenQTest.h
@@ -0,0 +1,63 @@
+/*
+    FreeRTOS V6.0.5 - Copyright (C) 2010 Real Time Engineers Ltd.
+
+    ***************************************************************************
+    *                                                                         *
+    * If you are:                                                             *
+    *                                                                         *
+    *    + New to FreeRTOS,                                                   *
+    *    + Wanting to learn FreeRTOS or multitasking in general quickly       *
+    *    + Looking for basic training,                                        *
+    *    + Wanting to improve your FreeRTOS skills and productivity           *
+    *                                                                         *
+    * then take a look at the FreeRTOS eBook                                  *
+    *                                                                         *
+    *        "Using the FreeRTOS Real Time Kernel - a Practical Guide"        *
+    *                  http://www.FreeRTOS.org/Documentation                  *
+    *                                                                         *
+    * A pdf reference manual is also available.  Both are usually delivered   *
+    * to your inbox within 20 minutes to two hours when purchased between 8am *
+    * and 8pm GMT (although please allow up to 24 hours in case of            *
+    * exceptional circumstances).  Thank you for your support!                *
+    *                                                                         *
+    ***************************************************************************
+
+    This file is part of the FreeRTOS distribution.
+
+    FreeRTOS is free software; you can redistribute it and/or modify it under
+    the terms of the GNU General Public License (version 2) as published by the
+    Free Software Foundation AND MODIFIED BY the FreeRTOS exception.
+    ***NOTE*** The exception to the GPL is included to allow you to distribute
+    a combined work that includes FreeRTOS without being obliged to provide the
+    source code for proprietary components outside of the FreeRTOS kernel.
+    FreeRTOS 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 and the FreeRTOS license exception along with FreeRTOS; if not it
+    can be viewed here: http://www.freertos.org/a00114.html and also obtained
+    by writing to Richard Barry, contact details for whom are available on the
+    FreeRTOS WEB site.
+
+    1 tab == 4 spaces!
+
+    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 GEN_Q_TEST_H
+#define GEN_Q_TEST_H
+
+void vStartGenericQueueTasks(unsigned portBASE_TYPE uxPriority);
+portBASE_TYPE xAreGenericQueueTasksStillRunning(void);
+
+#endif /* GEN_Q_TEST_H */
+
+
+
diff --git a/gyro_board/src/usb/CommonDemoTasks/include/IntQueue.h b/gyro_board/src/usb/CommonDemoTasks/include/IntQueue.h
new file mode 100644
index 0000000..514e458
--- /dev/null
+++ b/gyro_board/src/usb/CommonDemoTasks/include/IntQueue.h
@@ -0,0 +1,68 @@
+/*
+    FreeRTOS V6.0.5 - Copyright (C) 2010 Real Time Engineers Ltd.
+
+    ***************************************************************************
+    *                                                                         *
+    * If you are:                                                             *
+    *                                                                         *
+    *    + New to FreeRTOS,                                                   *
+    *    + Wanting to learn FreeRTOS or multitasking in general quickly       *
+    *    + Looking for basic training,                                        *
+    *    + Wanting to improve your FreeRTOS skills and productivity           *
+    *                                                                         *
+    * then take a look at the FreeRTOS eBook                                  *
+    *                                                                         *
+    *        "Using the FreeRTOS Real Time Kernel - a Practical Guide"        *
+    *                  http://www.FreeRTOS.org/Documentation                  *
+    *                                                                         *
+    * A pdf reference manual is also available.  Both are usually delivered   *
+    * to your inbox within 20 minutes to two hours when purchased between 8am *
+    * and 8pm GMT (although please allow up to 24 hours in case of            *
+    * exceptional circumstances).  Thank you for your support!                *
+    *                                                                         *
+    ***************************************************************************
+
+    This file is part of the FreeRTOS distribution.
+
+    FreeRTOS is free software; you can redistribute it and/or modify it under
+    the terms of the GNU General Public License (version 2) as published by the
+    Free Software Foundation AND MODIFIED BY the FreeRTOS exception.
+    ***NOTE*** The exception to the GPL is included to allow you to distribute
+    a combined work that includes FreeRTOS without being obliged to provide the
+    source code for proprietary components outside of the FreeRTOS kernel.
+    FreeRTOS 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 and the FreeRTOS license exception along with FreeRTOS; if not it
+    can be viewed here: http://www.freertos.org/a00114.html and also obtained
+    by writing to Richard Barry, contact details for whom are available on the
+    FreeRTOS WEB site.
+
+    1 tab == 4 spaces!
+
+    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 QUEUE_ACCESS_TEST
+#define QUEUE_ACCESS_TEST
+
+void vStartInterruptQueueTasks(void);
+portBASE_TYPE xAreIntQueueTasksStillRunning(void);
+portBASE_TYPE xFirstTimerHandler(void);
+portBASE_TYPE xSecondTimerHandler(void);
+
+#endif /* QUEUE_ACCESS_TEST */
+
+
+
+
+
+
diff --git a/gyro_board/src/usb/CommonDemoTasks/include/PollQ.h b/gyro_board/src/usb/CommonDemoTasks/include/PollQ.h
new file mode 100644
index 0000000..096b820
--- /dev/null
+++ b/gyro_board/src/usb/CommonDemoTasks/include/PollQ.h
@@ -0,0 +1,62 @@
+/*
+    FreeRTOS V6.0.5 - Copyright (C) 2010 Real Time Engineers Ltd.
+
+    ***************************************************************************
+    *                                                                         *
+    * If you are:                                                             *
+    *                                                                         *
+    *    + New to FreeRTOS,                                                   *
+    *    + Wanting to learn FreeRTOS or multitasking in general quickly       *
+    *    + Looking for basic training,                                        *
+    *    + Wanting to improve your FreeRTOS skills and productivity           *
+    *                                                                         *
+    * then take a look at the FreeRTOS eBook                                  *
+    *                                                                         *
+    *        "Using the FreeRTOS Real Time Kernel - a Practical Guide"        *
+    *                  http://www.FreeRTOS.org/Documentation                  *
+    *                                                                         *
+    * A pdf reference manual is also available.  Both are usually delivered   *
+    * to your inbox within 20 minutes to two hours when purchased between 8am *
+    * and 8pm GMT (although please allow up to 24 hours in case of            *
+    * exceptional circumstances).  Thank you for your support!                *
+    *                                                                         *
+    ***************************************************************************
+
+    This file is part of the FreeRTOS distribution.
+
+    FreeRTOS is free software; you can redistribute it and/or modify it under
+    the terms of the GNU General Public License (version 2) as published by the
+    Free Software Foundation AND MODIFIED BY the FreeRTOS exception.
+    ***NOTE*** The exception to the GPL is included to allow you to distribute
+    a combined work that includes FreeRTOS without being obliged to provide the
+    source code for proprietary components outside of the FreeRTOS kernel.
+    FreeRTOS 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 and the FreeRTOS license exception along with FreeRTOS; if not it
+    can be viewed here: http://www.freertos.org/a00114.html and also obtained
+    by writing to Richard Barry, contact details for whom are available on the
+    FreeRTOS WEB site.
+
+    1 tab == 4 spaces!
+
+    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 POLLED_Q_H
+#define POLLED_Q_H
+
+void vStartPolledQueueTasks(unsigned portBASE_TYPE uxPriority);
+portBASE_TYPE xArePollingQueuesStillRunning(void);
+
+#endif
+
+
diff --git a/gyro_board/src/usb/CommonDemoTasks/include/QPeek.h b/gyro_board/src/usb/CommonDemoTasks/include/QPeek.h
new file mode 100644
index 0000000..2666ebd
--- /dev/null
+++ b/gyro_board/src/usb/CommonDemoTasks/include/QPeek.h
@@ -0,0 +1,63 @@
+/*
+    FreeRTOS V6.0.5 - Copyright (C) 2010 Real Time Engineers Ltd.
+
+    ***************************************************************************
+    *                                                                         *
+    * If you are:                                                             *
+    *                                                                         *
+    *    + New to FreeRTOS,                                                   *
+    *    + Wanting to learn FreeRTOS or multitasking in general quickly       *
+    *    + Looking for basic training,                                        *
+    *    + Wanting to improve your FreeRTOS skills and productivity           *
+    *                                                                         *
+    * then take a look at the FreeRTOS eBook                                  *
+    *                                                                         *
+    *        "Using the FreeRTOS Real Time Kernel - a Practical Guide"        *
+    *                  http://www.FreeRTOS.org/Documentation                  *
+    *                                                                         *
+    * A pdf reference manual is also available.  Both are usually delivered   *
+    * to your inbox within 20 minutes to two hours when purchased between 8am *
+    * and 8pm GMT (although please allow up to 24 hours in case of            *
+    * exceptional circumstances).  Thank you for your support!                *
+    *                                                                         *
+    ***************************************************************************
+
+    This file is part of the FreeRTOS distribution.
+
+    FreeRTOS is free software; you can redistribute it and/or modify it under
+    the terms of the GNU General Public License (version 2) as published by the
+    Free Software Foundation AND MODIFIED BY the FreeRTOS exception.
+    ***NOTE*** The exception to the GPL is included to allow you to distribute
+    a combined work that includes FreeRTOS without being obliged to provide the
+    source code for proprietary components outside of the FreeRTOS kernel.
+    FreeRTOS 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 and the FreeRTOS license exception along with FreeRTOS; if not it
+    can be viewed here: http://www.freertos.org/a00114.html and also obtained
+    by writing to Richard Barry, contact details for whom are available on the
+    FreeRTOS WEB site.
+
+    1 tab == 4 spaces!
+
+    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 Q_PEEK_TEST_H
+#define Q_PEEK_TEST_H
+
+void vStartQueuePeekTasks(void);
+portBASE_TYPE xAreQueuePeekTasksStillRunning(void);
+
+#endif /* Q_PEEK_TEST_H */
+
+
+
diff --git a/gyro_board/src/usb/CommonDemoTasks/include/blocktim.h b/gyro_board/src/usb/CommonDemoTasks/include/blocktim.h
new file mode 100644
index 0000000..72fac90
--- /dev/null
+++ b/gyro_board/src/usb/CommonDemoTasks/include/blocktim.h
@@ -0,0 +1,62 @@
+/*
+    FreeRTOS V6.0.5 - Copyright (C) 2010 Real Time Engineers Ltd.
+
+    ***************************************************************************
+    *                                                                         *
+    * If you are:                                                             *
+    *                                                                         *
+    *    + New to FreeRTOS,                                                   *
+    *    + Wanting to learn FreeRTOS or multitasking in general quickly       *
+    *    + Looking for basic training,                                        *
+    *    + Wanting to improve your FreeRTOS skills and productivity           *
+    *                                                                         *
+    * then take a look at the FreeRTOS eBook                                  *
+    *                                                                         *
+    *        "Using the FreeRTOS Real Time Kernel - a Practical Guide"        *
+    *                  http://www.FreeRTOS.org/Documentation                  *
+    *                                                                         *
+    * A pdf reference manual is also available.  Both are usually delivered   *
+    * to your inbox within 20 minutes to two hours when purchased between 8am *
+    * and 8pm GMT (although please allow up to 24 hours in case of            *
+    * exceptional circumstances).  Thank you for your support!                *
+    *                                                                         *
+    ***************************************************************************
+
+    This file is part of the FreeRTOS distribution.
+
+    FreeRTOS is free software; you can redistribute it and/or modify it under
+    the terms of the GNU General Public License (version 2) as published by the
+    Free Software Foundation AND MODIFIED BY the FreeRTOS exception.
+    ***NOTE*** The exception to the GPL is included to allow you to distribute
+    a combined work that includes FreeRTOS without being obliged to provide the
+    source code for proprietary components outside of the FreeRTOS kernel.
+    FreeRTOS 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 and the FreeRTOS license exception along with FreeRTOS; if not it
+    can be viewed here: http://www.freertos.org/a00114.html and also obtained
+    by writing to Richard Barry, contact details for whom are available on the
+    FreeRTOS WEB site.
+
+    1 tab == 4 spaces!
+
+    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 BLOCK_TIME_TEST_H
+#define BLOCK_TIME_TEST_H
+
+void vCreateBlockTimeTasks(void);
+portBASE_TYPE xAreBlockTimeTestTasksStillRunning(void);
+
+#endif
+
+
diff --git a/gyro_board/src/usb/CommonDemoTasks/include/comtest.h b/gyro_board/src/usb/CommonDemoTasks/include/comtest.h
new file mode 100644
index 0000000..df974e2
--- /dev/null
+++ b/gyro_board/src/usb/CommonDemoTasks/include/comtest.h
@@ -0,0 +1,63 @@
+/*
+    FreeRTOS V6.0.5 - Copyright (C) 2010 Real Time Engineers Ltd.
+
+    ***************************************************************************
+    *                                                                         *
+    * If you are:                                                             *
+    *                                                                         *
+    *    + New to FreeRTOS,                                                   *
+    *    + Wanting to learn FreeRTOS or multitasking in general quickly       *
+    *    + Looking for basic training,                                        *
+    *    + Wanting to improve your FreeRTOS skills and productivity           *
+    *                                                                         *
+    * then take a look at the FreeRTOS eBook                                  *
+    *                                                                         *
+    *        "Using the FreeRTOS Real Time Kernel - a Practical Guide"        *
+    *                  http://www.FreeRTOS.org/Documentation                  *
+    *                                                                         *
+    * A pdf reference manual is also available.  Both are usually delivered   *
+    * to your inbox within 20 minutes to two hours when purchased between 8am *
+    * and 8pm GMT (although please allow up to 24 hours in case of            *
+    * exceptional circumstances).  Thank you for your support!                *
+    *                                                                         *
+    ***************************************************************************
+
+    This file is part of the FreeRTOS distribution.
+
+    FreeRTOS is free software; you can redistribute it and/or modify it under
+    the terms of the GNU General Public License (version 2) as published by the
+    Free Software Foundation AND MODIFIED BY the FreeRTOS exception.
+    ***NOTE*** The exception to the GPL is included to allow you to distribute
+    a combined work that includes FreeRTOS without being obliged to provide the
+    source code for proprietary components outside of the FreeRTOS kernel.
+    FreeRTOS 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 and the FreeRTOS license exception along with FreeRTOS; if not it
+    can be viewed here: http://www.freertos.org/a00114.html and also obtained
+    by writing to Richard Barry, contact details for whom are available on the
+    FreeRTOS WEB site.
+
+    1 tab == 4 spaces!
+
+    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 COMTEST_H
+#define COMTEST_H
+
+void vAltStartComTestTasks(unsigned portBASE_TYPE uxPriority, unsigned long ulBaudRate, unsigned portBASE_TYPE uxLED);
+void vStartComTestTasks(unsigned portBASE_TYPE uxPriority, eCOMPort ePort, eBaud eBaudRate);
+portBASE_TYPE xAreComTestTasksStillRunning(void);
+void vComTestUnsuspendTask(void);
+
+#endif
+
diff --git a/gyro_board/src/usb/CommonDemoTasks/include/comtest2.h b/gyro_board/src/usb/CommonDemoTasks/include/comtest2.h
new file mode 100644
index 0000000..18beab0
--- /dev/null
+++ b/gyro_board/src/usb/CommonDemoTasks/include/comtest2.h
@@ -0,0 +1,61 @@
+/*
+    FreeRTOS V6.0.5 - Copyright (C) 2010 Real Time Engineers Ltd.
+
+    ***************************************************************************
+    *                                                                         *
+    * If you are:                                                             *
+    *                                                                         *
+    *    + New to FreeRTOS,                                                   *
+    *    + Wanting to learn FreeRTOS or multitasking in general quickly       *
+    *    + Looking for basic training,                                        *
+    *    + Wanting to improve your FreeRTOS skills and productivity           *
+    *                                                                         *
+    * then take a look at the FreeRTOS eBook                                  *
+    *                                                                         *
+    *        "Using the FreeRTOS Real Time Kernel - a Practical Guide"        *
+    *                  http://www.FreeRTOS.org/Documentation                  *
+    *                                                                         *
+    * A pdf reference manual is also available.  Both are usually delivered   *
+    * to your inbox within 20 minutes to two hours when purchased between 8am *
+    * and 8pm GMT (although please allow up to 24 hours in case of            *
+    * exceptional circumstances).  Thank you for your support!                *
+    *                                                                         *
+    ***************************************************************************
+
+    This file is part of the FreeRTOS distribution.
+
+    FreeRTOS is free software; you can redistribute it and/or modify it under
+    the terms of the GNU General Public License (version 2) as published by the
+    Free Software Foundation AND MODIFIED BY the FreeRTOS exception.
+    ***NOTE*** The exception to the GPL is included to allow you to distribute
+    a combined work that includes FreeRTOS without being obliged to provide the
+    source code for proprietary components outside of the FreeRTOS kernel.
+    FreeRTOS 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 and the FreeRTOS license exception along with FreeRTOS; if not it
+    can be viewed here: http://www.freertos.org/a00114.html and also obtained
+    by writing to Richard Barry, contact details for whom are available on the
+    FreeRTOS WEB site.
+
+    1 tab == 4 spaces!
+
+    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 COMTEST_H
+#define COMTEST_H
+
+void vAltStartComTestTasks(unsigned portBASE_TYPE uxPriority, unsigned long ulBaudRate, unsigned portBASE_TYPE uxLED);
+portBASE_TYPE xAreComTestTasksStillRunning(void);
+
+#endif
+
diff --git a/gyro_board/src/usb/CommonDemoTasks/include/countsem.h b/gyro_board/src/usb/CommonDemoTasks/include/countsem.h
new file mode 100644
index 0000000..d08db7b
--- /dev/null
+++ b/gyro_board/src/usb/CommonDemoTasks/include/countsem.h
@@ -0,0 +1,61 @@
+/*
+    FreeRTOS V6.0.5 - Copyright (C) 2010 Real Time Engineers Ltd.
+
+    ***************************************************************************
+    *                                                                         *
+    * If you are:                                                             *
+    *                                                                         *
+    *    + New to FreeRTOS,                                                   *
+    *    + Wanting to learn FreeRTOS or multitasking in general quickly       *
+    *    + Looking for basic training,                                        *
+    *    + Wanting to improve your FreeRTOS skills and productivity           *
+    *                                                                         *
+    * then take a look at the FreeRTOS eBook                                  *
+    *                                                                         *
+    *        "Using the FreeRTOS Real Time Kernel - a Practical Guide"        *
+    *                  http://www.FreeRTOS.org/Documentation                  *
+    *                                                                         *
+    * A pdf reference manual is also available.  Both are usually delivered   *
+    * to your inbox within 20 minutes to two hours when purchased between 8am *
+    * and 8pm GMT (although please allow up to 24 hours in case of            *
+    * exceptional circumstances).  Thank you for your support!                *
+    *                                                                         *
+    ***************************************************************************
+
+    This file is part of the FreeRTOS distribution.
+
+    FreeRTOS is free software; you can redistribute it and/or modify it under
+    the terms of the GNU General Public License (version 2) as published by the
+    Free Software Foundation AND MODIFIED BY the FreeRTOS exception.
+    ***NOTE*** The exception to the GPL is included to allow you to distribute
+    a combined work that includes FreeRTOS without being obliged to provide the
+    source code for proprietary components outside of the FreeRTOS kernel.
+    FreeRTOS 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 and the FreeRTOS license exception along with FreeRTOS; if not it
+    can be viewed here: http://www.freertos.org/a00114.html and also obtained
+    by writing to Richard Barry, contact details for whom are available on the
+    FreeRTOS WEB site.
+
+    1 tab == 4 spaces!
+
+    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 COUNT_SEMAPHORE_TEST_H
+#define COUNT_SEMAPHORE_TEST_H
+
+void vStartCountingSemaphoreTasks(void);
+portBASE_TYPE xAreCountingSemaphoreTasksStillRunning(void);
+
+#endif
+
diff --git a/gyro_board/src/usb/CommonDemoTasks/include/crflash.h b/gyro_board/src/usb/CommonDemoTasks/include/crflash.h
new file mode 100644
index 0000000..6a5f715
--- /dev/null
+++ b/gyro_board/src/usb/CommonDemoTasks/include/crflash.h
@@ -0,0 +1,73 @@
+/*
+    FreeRTOS V6.0.5 - Copyright (C) 2010 Real Time Engineers Ltd.
+
+    ***************************************************************************
+    *                                                                         *
+    * If you are:                                                             *
+    *                                                                         *
+    *    + New to FreeRTOS,                                                   *
+    *    + Wanting to learn FreeRTOS or multitasking in general quickly       *
+    *    + Looking for basic training,                                        *
+    *    + Wanting to improve your FreeRTOS skills and productivity           *
+    *                                                                         *
+    * then take a look at the FreeRTOS eBook                                  *
+    *                                                                         *
+    *        "Using the FreeRTOS Real Time Kernel - a Practical Guide"        *
+    *                  http://www.FreeRTOS.org/Documentation                  *
+    *                                                                         *
+    * A pdf reference manual is also available.  Both are usually delivered   *
+    * to your inbox within 20 minutes to two hours when purchased between 8am *
+    * and 8pm GMT (although please allow up to 24 hours in case of            *
+    * exceptional circumstances).  Thank you for your support!                *
+    *                                                                         *
+    ***************************************************************************
+
+    This file is part of the FreeRTOS distribution.
+
+    FreeRTOS is free software; you can redistribute it and/or modify it under
+    the terms of the GNU General Public License (version 2) as published by the
+    Free Software Foundation AND MODIFIED BY the FreeRTOS exception.
+    ***NOTE*** The exception to the GPL is included to allow you to distribute
+    a combined work that includes FreeRTOS without being obliged to provide the
+    source code for proprietary components outside of the FreeRTOS kernel.
+    FreeRTOS 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 and the FreeRTOS license exception along with FreeRTOS; if not it
+    can be viewed here: http://www.freertos.org/a00114.html and also obtained
+    by writing to Richard Barry, contact details for whom are available on the
+    FreeRTOS WEB site.
+
+    1 tab == 4 spaces!
+
+    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 CRFLASH_LED_H
+#define CRFLASH_LED_H
+
+/*
+ * Create the co-routines used to flash the LED's at different rates.
+ *
+ * @param uxPriority The number of 'fixed delay' co-routines to create.  This
+ *		  also effects the number of LED's that will be utilised.  For example,
+ *		  passing in 3 will cause LED's 0 to 2 to be utilised.
+ */
+void vStartFlashCoRoutines(unsigned portBASE_TYPE uxPriority);
+
+/*
+ * Return pdPASS or pdFAIL depending on whether an error has been detected
+ * or not.
+ */
+portBASE_TYPE xAreFlashCoRoutinesStillRunning(void);
+
+#endif
+
diff --git a/gyro_board/src/usb/CommonDemoTasks/include/crhook.h b/gyro_board/src/usb/CommonDemoTasks/include/crhook.h
new file mode 100644
index 0000000..370677f
--- /dev/null
+++ b/gyro_board/src/usb/CommonDemoTasks/include/crhook.h
@@ -0,0 +1,69 @@
+/*
+    FreeRTOS V6.0.5 - Copyright (C) 2010 Real Time Engineers Ltd.
+
+    ***************************************************************************
+    *                                                                         *
+    * If you are:                                                             *
+    *                                                                         *
+    *    + New to FreeRTOS,                                                   *
+    *    + Wanting to learn FreeRTOS or multitasking in general quickly       *
+    *    + Looking for basic training,                                        *
+    *    + Wanting to improve your FreeRTOS skills and productivity           *
+    *                                                                         *
+    * then take a look at the FreeRTOS eBook                                  *
+    *                                                                         *
+    *        "Using the FreeRTOS Real Time Kernel - a Practical Guide"        *
+    *                  http://www.FreeRTOS.org/Documentation                  *
+    *                                                                         *
+    * A pdf reference manual is also available.  Both are usually delivered   *
+    * to your inbox within 20 minutes to two hours when purchased between 8am *
+    * and 8pm GMT (although please allow up to 24 hours in case of            *
+    * exceptional circumstances).  Thank you for your support!                *
+    *                                                                         *
+    ***************************************************************************
+
+    This file is part of the FreeRTOS distribution.
+
+    FreeRTOS is free software; you can redistribute it and/or modify it under
+    the terms of the GNU General Public License (version 2) as published by the
+    Free Software Foundation AND MODIFIED BY the FreeRTOS exception.
+    ***NOTE*** The exception to the GPL is included to allow you to distribute
+    a combined work that includes FreeRTOS without being obliged to provide the
+    source code for proprietary components outside of the FreeRTOS kernel.
+    FreeRTOS 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 and the FreeRTOS license exception along with FreeRTOS; if not it
+    can be viewed here: http://www.freertos.org/a00114.html and also obtained
+    by writing to Richard Barry, contact details for whom are available on the
+    FreeRTOS WEB site.
+
+    1 tab == 4 spaces!
+
+    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 CRHOOK_H
+#define CRHOOK_H
+
+/*
+ * Create the co-routines used to communicate wit the tick hook.
+ */
+void vStartHookCoRoutines(void);
+
+/*
+ * Return pdPASS or pdFAIL depending on whether an error has been detected
+ * or not.
+ */
+portBASE_TYPE xAreHookCoRoutinesStillRunning(void);
+
+#endif
+
diff --git a/gyro_board/src/usb/CommonDemoTasks/include/death.h b/gyro_board/src/usb/CommonDemoTasks/include/death.h
new file mode 100644
index 0000000..155f4f1
--- /dev/null
+++ b/gyro_board/src/usb/CommonDemoTasks/include/death.h
@@ -0,0 +1,62 @@
+/*
+    FreeRTOS V6.0.5 - Copyright (C) 2010 Real Time Engineers Ltd.
+
+    ***************************************************************************
+    *                                                                         *
+    * If you are:                                                             *
+    *                                                                         *
+    *    + New to FreeRTOS,                                                   *
+    *    + Wanting to learn FreeRTOS or multitasking in general quickly       *
+    *    + Looking for basic training,                                        *
+    *    + Wanting to improve your FreeRTOS skills and productivity           *
+    *                                                                         *
+    * then take a look at the FreeRTOS eBook                                  *
+    *                                                                         *
+    *        "Using the FreeRTOS Real Time Kernel - a Practical Guide"        *
+    *                  http://www.FreeRTOS.org/Documentation                  *
+    *                                                                         *
+    * A pdf reference manual is also available.  Both are usually delivered   *
+    * to your inbox within 20 minutes to two hours when purchased between 8am *
+    * and 8pm GMT (although please allow up to 24 hours in case of            *
+    * exceptional circumstances).  Thank you for your support!                *
+    *                                                                         *
+    ***************************************************************************
+
+    This file is part of the FreeRTOS distribution.
+
+    FreeRTOS is free software; you can redistribute it and/or modify it under
+    the terms of the GNU General Public License (version 2) as published by the
+    Free Software Foundation AND MODIFIED BY the FreeRTOS exception.
+    ***NOTE*** The exception to the GPL is included to allow you to distribute
+    a combined work that includes FreeRTOS without being obliged to provide the
+    source code for proprietary components outside of the FreeRTOS kernel.
+    FreeRTOS 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 and the FreeRTOS license exception along with FreeRTOS; if not it
+    can be viewed here: http://www.freertos.org/a00114.html and also obtained
+    by writing to Richard Barry, contact details for whom are available on the
+    FreeRTOS WEB site.
+
+    1 tab == 4 spaces!
+
+    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 SUICIDE_TASK_H
+#define SUICIDE_TASK_H
+
+void vCreateSuicidalTasks(unsigned portBASE_TYPE uxPriority);
+portBASE_TYPE xIsCreateTaskStillRunning(void);
+
+#endif
+
+
diff --git a/gyro_board/src/usb/CommonDemoTasks/include/dynamic.h b/gyro_board/src/usb/CommonDemoTasks/include/dynamic.h
new file mode 100644
index 0000000..b2bf281
--- /dev/null
+++ b/gyro_board/src/usb/CommonDemoTasks/include/dynamic.h
@@ -0,0 +1,62 @@
+/*
+    FreeRTOS V6.0.5 - Copyright (C) 2010 Real Time Engineers Ltd.
+
+    ***************************************************************************
+    *                                                                         *
+    * If you are:                                                             *
+    *                                                                         *
+    *    + New to FreeRTOS,                                                   *
+    *    + Wanting to learn FreeRTOS or multitasking in general quickly       *
+    *    + Looking for basic training,                                        *
+    *    + Wanting to improve your FreeRTOS skills and productivity           *
+    *                                                                         *
+    * then take a look at the FreeRTOS eBook                                  *
+    *                                                                         *
+    *        "Using the FreeRTOS Real Time Kernel - a Practical Guide"        *
+    *                  http://www.FreeRTOS.org/Documentation                  *
+    *                                                                         *
+    * A pdf reference manual is also available.  Both are usually delivered   *
+    * to your inbox within 20 minutes to two hours when purchased between 8am *
+    * and 8pm GMT (although please allow up to 24 hours in case of            *
+    * exceptional circumstances).  Thank you for your support!                *
+    *                                                                         *
+    ***************************************************************************
+
+    This file is part of the FreeRTOS distribution.
+
+    FreeRTOS is free software; you can redistribute it and/or modify it under
+    the terms of the GNU General Public License (version 2) as published by the
+    Free Software Foundation AND MODIFIED BY the FreeRTOS exception.
+    ***NOTE*** The exception to the GPL is included to allow you to distribute
+    a combined work that includes FreeRTOS without being obliged to provide the
+    source code for proprietary components outside of the FreeRTOS kernel.
+    FreeRTOS 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 and the FreeRTOS license exception along with FreeRTOS; if not it
+    can be viewed here: http://www.freertos.org/a00114.html and also obtained
+    by writing to Richard Barry, contact details for whom are available on the
+    FreeRTOS WEB site.
+
+    1 tab == 4 spaces!
+
+    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 DYNAMIC_MANIPULATION_H
+#define DYNAMIC_MANIPULATION_H
+
+void vStartDynamicPriorityTasks(void);
+portBASE_TYPE xAreDynamicPriorityTasksStillRunning(void);
+
+#endif
+
+
diff --git a/gyro_board/src/usb/CommonDemoTasks/include/fileIO.h b/gyro_board/src/usb/CommonDemoTasks/include/fileIO.h
new file mode 100644
index 0000000..9f3c7e0
--- /dev/null
+++ b/gyro_board/src/usb/CommonDemoTasks/include/fileIO.h
@@ -0,0 +1,62 @@
+/*
+    FreeRTOS V6.0.5 - Copyright (C) 2010 Real Time Engineers Ltd.
+
+    ***************************************************************************
+    *                                                                         *
+    * If you are:                                                             *
+    *                                                                         *
+    *    + New to FreeRTOS,                                                   *
+    *    + Wanting to learn FreeRTOS or multitasking in general quickly       *
+    *    + Looking for basic training,                                        *
+    *    + Wanting to improve your FreeRTOS skills and productivity           *
+    *                                                                         *
+    * then take a look at the FreeRTOS eBook                                  *
+    *                                                                         *
+    *        "Using the FreeRTOS Real Time Kernel - a Practical Guide"        *
+    *                  http://www.FreeRTOS.org/Documentation                  *
+    *                                                                         *
+    * A pdf reference manual is also available.  Both are usually delivered   *
+    * to your inbox within 20 minutes to two hours when purchased between 8am *
+    * and 8pm GMT (although please allow up to 24 hours in case of            *
+    * exceptional circumstances).  Thank you for your support!                *
+    *                                                                         *
+    ***************************************************************************
+
+    This file is part of the FreeRTOS distribution.
+
+    FreeRTOS is free software; you can redistribute it and/or modify it under
+    the terms of the GNU General Public License (version 2) as published by the
+    Free Software Foundation AND MODIFIED BY the FreeRTOS exception.
+    ***NOTE*** The exception to the GPL is included to allow you to distribute
+    a combined work that includes FreeRTOS without being obliged to provide the
+    source code for proprietary components outside of the FreeRTOS kernel.
+    FreeRTOS 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 and the FreeRTOS license exception along with FreeRTOS; if not it
+    can be viewed here: http://www.freertos.org/a00114.html and also obtained
+    by writing to Richard Barry, contact details for whom are available on the
+    FreeRTOS WEB site.
+
+    1 tab == 4 spaces!
+
+    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 FILE_IO_H
+#define FILE_OI_H
+
+void vDisplayMessage(const char * const pcMessageToPrint);
+void vWriteMessageToDisk(const char * const pcMessage);
+void vWriteBufferToDisk(const char * const pcBuffer, unsigned long ulBufferLength);
+
+#endif
+
diff --git a/gyro_board/src/usb/CommonDemoTasks/include/flash.h b/gyro_board/src/usb/CommonDemoTasks/include/flash.h
new file mode 100644
index 0000000..008df24
--- /dev/null
+++ b/gyro_board/src/usb/CommonDemoTasks/include/flash.h
@@ -0,0 +1,60 @@
+/*
+    FreeRTOS V6.0.5 - Copyright (C) 2010 Real Time Engineers Ltd.
+
+    ***************************************************************************
+    *                                                                         *
+    * If you are:                                                             *
+    *                                                                         *
+    *    + New to FreeRTOS,                                                   *
+    *    + Wanting to learn FreeRTOS or multitasking in general quickly       *
+    *    + Looking for basic training,                                        *
+    *    + Wanting to improve your FreeRTOS skills and productivity           *
+    *                                                                         *
+    * then take a look at the FreeRTOS eBook                                  *
+    *                                                                         *
+    *        "Using the FreeRTOS Real Time Kernel - a Practical Guide"        *
+    *                  http://www.FreeRTOS.org/Documentation                  *
+    *                                                                         *
+    * A pdf reference manual is also available.  Both are usually delivered   *
+    * to your inbox within 20 minutes to two hours when purchased between 8am *
+    * and 8pm GMT (although please allow up to 24 hours in case of            *
+    * exceptional circumstances).  Thank you for your support!                *
+    *                                                                         *
+    ***************************************************************************
+
+    This file is part of the FreeRTOS distribution.
+
+    FreeRTOS is free software; you can redistribute it and/or modify it under
+    the terms of the GNU General Public License (version 2) as published by the
+    Free Software Foundation AND MODIFIED BY the FreeRTOS exception.
+    ***NOTE*** The exception to the GPL is included to allow you to distribute
+    a combined work that includes FreeRTOS without being obliged to provide the
+    source code for proprietary components outside of the FreeRTOS kernel.
+    FreeRTOS 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 and the FreeRTOS license exception along with FreeRTOS; if not it
+    can be viewed here: http://www.freertos.org/a00114.html and also obtained
+    by writing to Richard Barry, contact details for whom are available on the
+    FreeRTOS WEB site.
+
+    1 tab == 4 spaces!
+
+    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 FLASH_LED_H
+#define FLASH_LED_H
+
+void vStartLEDFlashTasks(unsigned portBASE_TYPE uxPriority);
+
+#endif
+
diff --git a/gyro_board/src/usb/CommonDemoTasks/include/flop.h b/gyro_board/src/usb/CommonDemoTasks/include/flop.h
new file mode 100644
index 0000000..2e5fb79
--- /dev/null
+++ b/gyro_board/src/usb/CommonDemoTasks/include/flop.h
@@ -0,0 +1,62 @@
+/*
+    FreeRTOS V6.0.5 - Copyright (C) 2010 Real Time Engineers Ltd.
+
+    ***************************************************************************
+    *                                                                         *
+    * If you are:                                                             *
+    *                                                                         *
+    *    + New to FreeRTOS,                                                   *
+    *    + Wanting to learn FreeRTOS or multitasking in general quickly       *
+    *    + Looking for basic training,                                        *
+    *    + Wanting to improve your FreeRTOS skills and productivity           *
+    *                                                                         *
+    * then take a look at the FreeRTOS eBook                                  *
+    *                                                                         *
+    *        "Using the FreeRTOS Real Time Kernel - a Practical Guide"        *
+    *                  http://www.FreeRTOS.org/Documentation                  *
+    *                                                                         *
+    * A pdf reference manual is also available.  Both are usually delivered   *
+    * to your inbox within 20 minutes to two hours when purchased between 8am *
+    * and 8pm GMT (although please allow up to 24 hours in case of            *
+    * exceptional circumstances).  Thank you for your support!                *
+    *                                                                         *
+    ***************************************************************************
+
+    This file is part of the FreeRTOS distribution.
+
+    FreeRTOS is free software; you can redistribute it and/or modify it under
+    the terms of the GNU General Public License (version 2) as published by the
+    Free Software Foundation AND MODIFIED BY the FreeRTOS exception.
+    ***NOTE*** The exception to the GPL is included to allow you to distribute
+    a combined work that includes FreeRTOS without being obliged to provide the
+    source code for proprietary components outside of the FreeRTOS kernel.
+    FreeRTOS 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 and the FreeRTOS license exception along with FreeRTOS; if not it
+    can be viewed here: http://www.freertos.org/a00114.html and also obtained
+    by writing to Richard Barry, contact details for whom are available on the
+    FreeRTOS WEB site.
+
+    1 tab == 4 spaces!
+
+    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 FLOP_TASKS_H
+#define FLOP_TASKS_H
+
+void vStartMathTasks(unsigned portBASE_TYPE uxPriority);
+portBASE_TYPE xAreMathsTaskStillRunning(void);
+
+#endif
+
+
diff --git a/gyro_board/src/usb/CommonDemoTasks/include/integer.h b/gyro_board/src/usb/CommonDemoTasks/include/integer.h
new file mode 100644
index 0000000..0bdf620
--- /dev/null
+++ b/gyro_board/src/usb/CommonDemoTasks/include/integer.h
@@ -0,0 +1,62 @@
+/*
+    FreeRTOS V6.0.5 - Copyright (C) 2010 Real Time Engineers Ltd.
+
+    ***************************************************************************
+    *                                                                         *
+    * If you are:                                                             *
+    *                                                                         *
+    *    + New to FreeRTOS,                                                   *
+    *    + Wanting to learn FreeRTOS or multitasking in general quickly       *
+    *    + Looking for basic training,                                        *
+    *    + Wanting to improve your FreeRTOS skills and productivity           *
+    *                                                                         *
+    * then take a look at the FreeRTOS eBook                                  *
+    *                                                                         *
+    *        "Using the FreeRTOS Real Time Kernel - a Practical Guide"        *
+    *                  http://www.FreeRTOS.org/Documentation                  *
+    *                                                                         *
+    * A pdf reference manual is also available.  Both are usually delivered   *
+    * to your inbox within 20 minutes to two hours when purchased between 8am *
+    * and 8pm GMT (although please allow up to 24 hours in case of            *
+    * exceptional circumstances).  Thank you for your support!                *
+    *                                                                         *
+    ***************************************************************************
+
+    This file is part of the FreeRTOS distribution.
+
+    FreeRTOS is free software; you can redistribute it and/or modify it under
+    the terms of the GNU General Public License (version 2) as published by the
+    Free Software Foundation AND MODIFIED BY the FreeRTOS exception.
+    ***NOTE*** The exception to the GPL is included to allow you to distribute
+    a combined work that includes FreeRTOS without being obliged to provide the
+    source code for proprietary components outside of the FreeRTOS kernel.
+    FreeRTOS 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 and the FreeRTOS license exception along with FreeRTOS; if not it
+    can be viewed here: http://www.freertos.org/a00114.html and also obtained
+    by writing to Richard Barry, contact details for whom are available on the
+    FreeRTOS WEB site.
+
+    1 tab == 4 spaces!
+
+    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 INTEGER_TASKS_H
+#define INTEGER_TASKS_H
+
+void vStartIntegerMathTasks(unsigned portBASE_TYPE uxPriority);
+portBASE_TYPE xAreIntegerMathsTaskStillRunning(void);
+
+#endif
+
+
diff --git a/gyro_board/src/usb/CommonDemoTasks/include/mevents.h b/gyro_board/src/usb/CommonDemoTasks/include/mevents.h
new file mode 100644
index 0000000..5452d4b
--- /dev/null
+++ b/gyro_board/src/usb/CommonDemoTasks/include/mevents.h
@@ -0,0 +1,62 @@
+/*
+    FreeRTOS V6.0.5 - Copyright (C) 2010 Real Time Engineers Ltd.
+
+    ***************************************************************************
+    *                                                                         *
+    * If you are:                                                             *
+    *                                                                         *
+    *    + New to FreeRTOS,                                                   *
+    *    + Wanting to learn FreeRTOS or multitasking in general quickly       *
+    *    + Looking for basic training,                                        *
+    *    + Wanting to improve your FreeRTOS skills and productivity           *
+    *                                                                         *
+    * then take a look at the FreeRTOS eBook                                  *
+    *                                                                         *
+    *        "Using the FreeRTOS Real Time Kernel - a Practical Guide"        *
+    *                  http://www.FreeRTOS.org/Documentation                  *
+    *                                                                         *
+    * A pdf reference manual is also available.  Both are usually delivered   *
+    * to your inbox within 20 minutes to two hours when purchased between 8am *
+    * and 8pm GMT (although please allow up to 24 hours in case of            *
+    * exceptional circumstances).  Thank you for your support!                *
+    *                                                                         *
+    ***************************************************************************
+
+    This file is part of the FreeRTOS distribution.
+
+    FreeRTOS is free software; you can redistribute it and/or modify it under
+    the terms of the GNU General Public License (version 2) as published by the
+    Free Software Foundation AND MODIFIED BY the FreeRTOS exception.
+    ***NOTE*** The exception to the GPL is included to allow you to distribute
+    a combined work that includes FreeRTOS without being obliged to provide the
+    source code for proprietary components outside of the FreeRTOS kernel.
+    FreeRTOS 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 and the FreeRTOS license exception along with FreeRTOS; if not it
+    can be viewed here: http://www.freertos.org/a00114.html and also obtained
+    by writing to Richard Barry, contact details for whom are available on the
+    FreeRTOS WEB site.
+
+    1 tab == 4 spaces!
+
+    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 EVENTS_TEST_H
+#define EVENTS_TEST_H
+
+void vStartMultiEventTasks(void);
+portBASE_TYPE xAreMultiEventTasksStillRunning(void);
+
+#endif
+
+
diff --git a/gyro_board/src/usb/CommonDemoTasks/include/partest.h b/gyro_board/src/usb/CommonDemoTasks/include/partest.h
new file mode 100644
index 0000000..4318351
--- /dev/null
+++ b/gyro_board/src/usb/CommonDemoTasks/include/partest.h
@@ -0,0 +1,64 @@
+/*
+    FreeRTOS V6.0.5 - Copyright (C) 2010 Real Time Engineers Ltd.
+
+    ***************************************************************************
+    *                                                                         *
+    * If you are:                                                             *
+    *                                                                         *
+    *    + New to FreeRTOS,                                                   *
+    *    + Wanting to learn FreeRTOS or multitasking in general quickly       *
+    *    + Looking for basic training,                                        *
+    *    + Wanting to improve your FreeRTOS skills and productivity           *
+    *                                                                         *
+    * then take a look at the FreeRTOS eBook                                  *
+    *                                                                         *
+    *        "Using the FreeRTOS Real Time Kernel - a Practical Guide"        *
+    *                  http://www.FreeRTOS.org/Documentation                  *
+    *                                                                         *
+    * A pdf reference manual is also available.  Both are usually delivered   *
+    * to your inbox within 20 minutes to two hours when purchased between 8am *
+    * and 8pm GMT (although please allow up to 24 hours in case of            *
+    * exceptional circumstances).  Thank you for your support!                *
+    *                                                                         *
+    ***************************************************************************
+
+    This file is part of the FreeRTOS distribution.
+
+    FreeRTOS is free software; you can redistribute it and/or modify it under
+    the terms of the GNU General Public License (version 2) as published by the
+    Free Software Foundation AND MODIFIED BY the FreeRTOS exception.
+    ***NOTE*** The exception to the GPL is included to allow you to distribute
+    a combined work that includes FreeRTOS without being obliged to provide the
+    source code for proprietary components outside of the FreeRTOS kernel.
+    FreeRTOS 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 and the FreeRTOS license exception along with FreeRTOS; if not it
+    can be viewed here: http://www.freertos.org/a00114.html and also obtained
+    by writing to Richard Barry, contact details for whom are available on the
+    FreeRTOS WEB site.
+
+    1 tab == 4 spaces!
+
+    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 PARTEST_H
+#define PARTEST_H
+
+#define partstDEFAULT_PORT_ADDRESS		( ( unsigned short ) 0x378 )
+
+void vParTestInitialise(void);
+void vParTestSetLED(unsigned portBASE_TYPE uxLED, signed portBASE_TYPE xValue);
+void vParTestToggleLED(unsigned portBASE_TYPE uxLED);
+
+#endif
+
diff --git a/gyro_board/src/usb/CommonDemoTasks/include/print.h b/gyro_board/src/usb/CommonDemoTasks/include/print.h
new file mode 100644
index 0000000..f0242bd
--- /dev/null
+++ b/gyro_board/src/usb/CommonDemoTasks/include/print.h
@@ -0,0 +1,63 @@
+/*
+    FreeRTOS V6.0.5 - Copyright (C) 2010 Real Time Engineers Ltd.
+
+    ***************************************************************************
+    *                                                                         *
+    * If you are:                                                             *
+    *                                                                         *
+    *    + New to FreeRTOS,                                                   *
+    *    + Wanting to learn FreeRTOS or multitasking in general quickly       *
+    *    + Looking for basic training,                                        *
+    *    + Wanting to improve your FreeRTOS skills and productivity           *
+    *                                                                         *
+    * then take a look at the FreeRTOS eBook                                  *
+    *                                                                         *
+    *        "Using the FreeRTOS Real Time Kernel - a Practical Guide"        *
+    *                  http://www.FreeRTOS.org/Documentation                  *
+    *                                                                         *
+    * A pdf reference manual is also available.  Both are usually delivered   *
+    * to your inbox within 20 minutes to two hours when purchased between 8am *
+    * and 8pm GMT (although please allow up to 24 hours in case of            *
+    * exceptional circumstances).  Thank you for your support!                *
+    *                                                                         *
+    ***************************************************************************
+
+    This file is part of the FreeRTOS distribution.
+
+    FreeRTOS is free software; you can redistribute it and/or modify it under
+    the terms of the GNU General Public License (version 2) as published by the
+    Free Software Foundation AND MODIFIED BY the FreeRTOS exception.
+    ***NOTE*** The exception to the GPL is included to allow you to distribute
+    a combined work that includes FreeRTOS without being obliged to provide the
+    source code for proprietary components outside of the FreeRTOS kernel.
+    FreeRTOS 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 and the FreeRTOS license exception along with FreeRTOS; if not it
+    can be viewed here: http://www.freertos.org/a00114.html and also obtained
+    by writing to Richard Barry, contact details for whom are available on the
+    FreeRTOS WEB site.
+
+    1 tab == 4 spaces!
+
+    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 PRINT_H
+#define PRINT_H
+
+void vPrintInitialise(void);
+void vPrintDisplayMessage(const char * const * pcMessageToSend);
+const char *pcPrintGetNextMessage(portTickType xPrintRate);
+
+#endif
+
+
diff --git a/gyro_board/src/usb/CommonDemoTasks/include/recmutex.h b/gyro_board/src/usb/CommonDemoTasks/include/recmutex.h
new file mode 100644
index 0000000..856d6f8
--- /dev/null
+++ b/gyro_board/src/usb/CommonDemoTasks/include/recmutex.h
@@ -0,0 +1,61 @@
+/*
+    FreeRTOS V6.0.5 - Copyright (C) 2010 Real Time Engineers Ltd.
+
+    ***************************************************************************
+    *                                                                         *
+    * If you are:                                                             *
+    *                                                                         *
+    *    + New to FreeRTOS,                                                   *
+    *    + Wanting to learn FreeRTOS or multitasking in general quickly       *
+    *    + Looking for basic training,                                        *
+    *    + Wanting to improve your FreeRTOS skills and productivity           *
+    *                                                                         *
+    * then take a look at the FreeRTOS eBook                                  *
+    *                                                                         *
+    *        "Using the FreeRTOS Real Time Kernel - a Practical Guide"        *
+    *                  http://www.FreeRTOS.org/Documentation                  *
+    *                                                                         *
+    * A pdf reference manual is also available.  Both are usually delivered   *
+    * to your inbox within 20 minutes to two hours when purchased between 8am *
+    * and 8pm GMT (although please allow up to 24 hours in case of            *
+    * exceptional circumstances).  Thank you for your support!                *
+    *                                                                         *
+    ***************************************************************************
+
+    This file is part of the FreeRTOS distribution.
+
+    FreeRTOS is free software; you can redistribute it and/or modify it under
+    the terms of the GNU General Public License (version 2) as published by the
+    Free Software Foundation AND MODIFIED BY the FreeRTOS exception.
+    ***NOTE*** The exception to the GPL is included to allow you to distribute
+    a combined work that includes FreeRTOS without being obliged to provide the
+    source code for proprietary components outside of the FreeRTOS kernel.
+    FreeRTOS 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 and the FreeRTOS license exception along with FreeRTOS; if not it
+    can be viewed here: http://www.freertos.org/a00114.html and also obtained
+    by writing to Richard Barry, contact details for whom are available on the
+    FreeRTOS WEB site.
+
+    1 tab == 4 spaces!
+
+    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 RECURSIVE_MUTEX_TEST_H
+#define RECURSIVE_MUTEX_TEST_H
+
+void vStartRecursiveMutexTasks(void);
+portBASE_TYPE xAreRecursiveMutexTasksStillRunning(void);
+
+#endif
+
diff --git a/gyro_board/src/usb/CommonDemoTasks/include/semtest.h b/gyro_board/src/usb/CommonDemoTasks/include/semtest.h
new file mode 100644
index 0000000..04d5369
--- /dev/null
+++ b/gyro_board/src/usb/CommonDemoTasks/include/semtest.h
@@ -0,0 +1,61 @@
+/*
+    FreeRTOS V6.0.5 - Copyright (C) 2010 Real Time Engineers Ltd.
+
+    ***************************************************************************
+    *                                                                         *
+    * If you are:                                                             *
+    *                                                                         *
+    *    + New to FreeRTOS,                                                   *
+    *    + Wanting to learn FreeRTOS or multitasking in general quickly       *
+    *    + Looking for basic training,                                        *
+    *    + Wanting to improve your FreeRTOS skills and productivity           *
+    *                                                                         *
+    * then take a look at the FreeRTOS eBook                                  *
+    *                                                                         *
+    *        "Using the FreeRTOS Real Time Kernel - a Practical Guide"        *
+    *                  http://www.FreeRTOS.org/Documentation                  *
+    *                                                                         *
+    * A pdf reference manual is also available.  Both are usually delivered   *
+    * to your inbox within 20 minutes to two hours when purchased between 8am *
+    * and 8pm GMT (although please allow up to 24 hours in case of            *
+    * exceptional circumstances).  Thank you for your support!                *
+    *                                                                         *
+    ***************************************************************************
+
+    This file is part of the FreeRTOS distribution.
+
+    FreeRTOS is free software; you can redistribute it and/or modify it under
+    the terms of the GNU General Public License (version 2) as published by the
+    Free Software Foundation AND MODIFIED BY the FreeRTOS exception.
+    ***NOTE*** The exception to the GPL is included to allow you to distribute
+    a combined work that includes FreeRTOS without being obliged to provide the
+    source code for proprietary components outside of the FreeRTOS kernel.
+    FreeRTOS 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 and the FreeRTOS license exception along with FreeRTOS; if not it
+    can be viewed here: http://www.freertos.org/a00114.html and also obtained
+    by writing to Richard Barry, contact details for whom are available on the
+    FreeRTOS WEB site.
+
+    1 tab == 4 spaces!
+
+    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 SEMAPHORE_TEST_H
+#define SEMAPHORE_TEST_H
+
+void vStartSemaphoreTasks(unsigned portBASE_TYPE uxPriority);
+portBASE_TYPE xAreSemaphoreTasksStillRunning(void);
+
+#endif
+
diff --git a/gyro_board/src/usb/CommonDemoTasks/include/serial.h b/gyro_board/src/usb/CommonDemoTasks/include/serial.h
new file mode 100644
index 0000000..dcc76ea
--- /dev/null
+++ b/gyro_board/src/usb/CommonDemoTasks/include/serial.h
@@ -0,0 +1,119 @@
+/*
+    FreeRTOS V6.0.5 - Copyright (C) 2010 Real Time Engineers Ltd.
+
+    ***************************************************************************
+    *                                                                         *
+    * If you are:                                                             *
+    *                                                                         *
+    *    + New to FreeRTOS,                                                   *
+    *    + Wanting to learn FreeRTOS or multitasking in general quickly       *
+    *    + Looking for basic training,                                        *
+    *    + Wanting to improve your FreeRTOS skills and productivity           *
+    *                                                                         *
+    * then take a look at the FreeRTOS eBook                                  *
+    *                                                                         *
+    *        "Using the FreeRTOS Real Time Kernel - a Practical Guide"        *
+    *                  http://www.FreeRTOS.org/Documentation                  *
+    *                                                                         *
+    * A pdf reference manual is also available.  Both are usually delivered   *
+    * to your inbox within 20 minutes to two hours when purchased between 8am *
+    * and 8pm GMT (although please allow up to 24 hours in case of            *
+    * exceptional circumstances).  Thank you for your support!                *
+    *                                                                         *
+    ***************************************************************************
+
+    This file is part of the FreeRTOS distribution.
+
+    FreeRTOS is free software; you can redistribute it and/or modify it under
+    the terms of the GNU General Public License (version 2) as published by the
+    Free Software Foundation AND MODIFIED BY the FreeRTOS exception.
+    ***NOTE*** The exception to the GPL is included to allow you to distribute
+    a combined work that includes FreeRTOS without being obliged to provide the
+    source code for proprietary components outside of the FreeRTOS kernel.
+    FreeRTOS 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 and the FreeRTOS license exception along with FreeRTOS; if not it
+    can be viewed here: http://www.freertos.org/a00114.html and also obtained
+    by writing to Richard Barry, contact details for whom are available on the
+    FreeRTOS WEB site.
+
+    1 tab == 4 spaces!
+
+    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 SERIAL_COMMS_H
+#define SERIAL_COMMS_H
+
+typedef void * xComPortHandle;
+
+typedef enum {
+	serCOM1,
+	serCOM2,
+	serCOM3,
+	serCOM4,
+	serCOM5,
+	serCOM6,
+	serCOM7,
+	serCOM8
+} eCOMPort;
+
+typedef enum {
+	serNO_PARITY,
+	serODD_PARITY,
+	serEVEN_PARITY,
+	serMARK_PARITY,
+	serSPACE_PARITY
+} eParity;
+
+typedef enum {
+	serSTOP_1,
+	serSTOP_2
+} eStopBits;
+
+typedef enum {
+	serBITS_5,
+	serBITS_6,
+	serBITS_7,
+	serBITS_8
+} eDataBits;
+
+typedef enum {
+	ser50,
+	ser75,
+	ser110,
+	ser134,
+	ser150,
+	ser200,
+	ser300,
+	ser600,
+	ser1200,
+	ser1800,
+	ser2400,
+	ser4800,
+	ser9600,
+	ser19200,
+	ser38400,
+	ser57600,
+	ser115200
+} eBaud;
+
+xComPortHandle xSerialPortInitMinimal(unsigned long ulWantedBaud, unsigned portBASE_TYPE uxQueueLength);
+xComPortHandle xSerialPortInit(eCOMPort ePort, eBaud eWantedBaud, eParity eWantedParity, eDataBits eWantedDataBits, eStopBits eWantedStopBits, unsigned portBASE_TYPE uxBufferLength);
+void vSerialPutString(xComPortHandle pxPort, const signed char * const pcString, unsigned short usStringLength);
+signed portBASE_TYPE xSerialGetChar(xComPortHandle pxPort, signed char *pcRxedChar, portTickType xBlockTime);
+signed portBASE_TYPE xSerialPutChar(xComPortHandle pxPort, signed char cOutChar, portTickType xBlockTime);
+portBASE_TYPE xSerialWaitForSemaphore(xComPortHandle xPort);
+void vSerialClose(xComPortHandle xPort);
+
+#endif
+
diff --git a/gyro_board/src/usb/CommonDemoTasks/integer.c b/gyro_board/src/usb/CommonDemoTasks/integer.c
new file mode 100644
index 0000000..4e2db69
--- /dev/null
+++ b/gyro_board/src/usb/CommonDemoTasks/integer.c
@@ -0,0 +1,206 @@
+/*
+    FreeRTOS V6.0.5 - Copyright (C) 2010 Real Time Engineers Ltd.
+
+    ***************************************************************************
+    *                                                                         *
+    * If you are:                                                             *
+    *                                                                         *
+    *    + New to FreeRTOS,                                                   *
+    *    + Wanting to learn FreeRTOS or multitasking in general quickly       *
+    *    + Looking for basic training,                                        *
+    *    + Wanting to improve your FreeRTOS skills and productivity           *
+    *                                                                         *
+    * then take a look at the FreeRTOS eBook                                  *
+    *                                                                         *
+    *        "Using the FreeRTOS Real Time Kernel - a Practical Guide"        *
+    *                  http://www.FreeRTOS.org/Documentation                  *
+    *                                                                         *
+    * A pdf reference manual is also available.  Both are usually delivered   *
+    * to your inbox within 20 minutes to two hours when purchased between 8am *
+    * and 8pm GMT (although please allow up to 24 hours in case of            *
+    * exceptional circumstances).  Thank you for your support!                *
+    *                                                                         *
+    ***************************************************************************
+
+    This file is part of the FreeRTOS distribution.
+
+    FreeRTOS is free software; you can redistribute it and/or modify it under
+    the terms of the GNU General Public License (version 2) as published by the
+    Free Software Foundation AND MODIFIED BY the FreeRTOS exception.
+    ***NOTE*** The exception to the GPL is included to allow you to distribute
+    a combined work that includes FreeRTOS without being obliged to provide the
+    source code for proprietary components outside of the FreeRTOS kernel.
+    FreeRTOS 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 and the FreeRTOS license exception along with FreeRTOS; if not it
+    can be viewed here: http://www.freertos.org/a00114.html and also obtained
+    by writing to Richard Barry, contact details for whom are available on the
+    FreeRTOS WEB site.
+
+    1 tab == 4 spaces!
+
+    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.
+*/
+
+/*
+ * This version of integer. c is for use on systems that have limited stack
+ * space and no display facilities.  The complete version can be found in
+ * the Demo/Common/Full directory.
+ *
+ * As with the full version, the tasks created in this file are a good test
+ * of the scheduler context switch mechanism.  The processor has to access
+ * 32bit variables in two or four chunks (depending on the processor).  The low
+ * priority of these tasks means there is a high probability that a context
+ * switch will occur mid calculation.  See flop. c documentation for
+ * more information.
+ *
+ */
+
+/*
+Changes from V1.2.1
+
+	+ The constants used in the calculations are larger to ensure the
+	  optimiser does not truncate them to 16 bits.
+
+Changes from V1.2.3
+
+	+ uxTaskCheck is now just used as a boolean.  Instead of incrementing
+	  the variable each cycle of the task, the variable is simply set to
+	  true.  sAreIntegerMathsTaskStillRunning() sets it back to false and
+	  expects it to have been set back to true by the time it is called
+	  again.
+	+ A division has been included in the calculation.
+*/
+
+#include <stdlib.h>
+
+/* Scheduler include files. */
+#include "FreeRTOS.h"
+#include "task.h"
+
+/* Demo program include files. */
+#include "integer.h"
+
+/* The constants used in the calculation. */
+#define intgCONST1				( ( long ) 123 )
+#define intgCONST2				( ( long ) 234567 )
+#define intgCONST3				( ( long ) -3 )
+#define intgCONST4				( ( long ) 7 )
+#define intgEXPECTED_ANSWER		( ( ( intgCONST1 + intgCONST2 ) * intgCONST3 ) / intgCONST4 )
+
+#define intgSTACK_SIZE			configMINIMAL_STACK_SIZE
+
+/* As this is the minimal version, we will only create one task. */
+#define intgNUMBER_OF_TASKS		( 1 )
+
+/* The task function.  Repeatedly performs a 32 bit calculation, checking the
+result against the expected result.  If the result is incorrect then the
+context switch must have caused some corruption. */
+static portTASK_FUNCTION_PROTO(vCompeteingIntMathTask, pvParameters);
+
+/* Variables that are set to true within the calculation task to indicate
+that the task is still executing.  The check task sets the variable back to
+false, flagging an error if the variable is still false the next time it
+is called. */
+static volatile signed portBASE_TYPE xTaskCheck[ intgNUMBER_OF_TASKS ] = {(signed portBASE_TYPE) pdFALSE };
+
+/*-----------------------------------------------------------*/
+
+void vStartIntegerMathTasks(unsigned portBASE_TYPE uxPriority)
+{
+	short sTask;
+
+	for (sTask = 0; sTask < intgNUMBER_OF_TASKS; sTask++) {
+		xTaskCreate(vCompeteingIntMathTask, (signed char *) "IntMath", intgSTACK_SIZE, (void *) &(xTaskCheck[ sTask ]), uxPriority, (xTaskHandle *) NULL);
+	}
+}
+/*-----------------------------------------------------------*/
+
+static portTASK_FUNCTION(vCompeteingIntMathTask, pvParameters)
+{
+	/* These variables are all effectively set to constants so they are volatile to
+	ensure the compiler does not just get rid of them. */
+	volatile long lValue;
+	short sError = pdFALSE;
+	volatile signed portBASE_TYPE *pxTaskHasExecuted;
+
+	/* Set a pointer to the variable we are going to set to true each
+	iteration.  This is also a good test of the parameter passing mechanism
+	within each port. */
+	pxTaskHasExecuted = (volatile signed portBASE_TYPE *) pvParameters;
+
+	/* Keep performing a calculation and checking the result against a constant. */
+	for (;;) {
+		/* Perform the calculation.  This will store partial value in
+		registers, resulting in a good test of the context switch mechanism. */
+		lValue = intgCONST1;
+		lValue += intgCONST2;
+
+		/* Yield in case cooperative scheduling is being used. */
+#if configUSE_PREEMPTION == 0
+		{
+			taskYIELD();
+		}
+#endif
+
+		/* Finish off the calculation. */
+		lValue *= intgCONST3;
+		lValue /= intgCONST4;
+
+		/* If the calculation is found to be incorrect we stop setting the
+		TaskHasExecuted variable so the check task can see an error has
+		occurred. */
+		if (lValue != intgEXPECTED_ANSWER) { /*lint !e774 volatile used to prevent this being optimised out. */
+			sError = pdTRUE;
+		}
+
+		if (sError == pdFALSE) {
+			/* We have not encountered any errors, so set the flag that show
+			we are still executing.  This will be periodically cleared by
+			the check task. */
+			portENTER_CRITICAL();
+			*pxTaskHasExecuted = pdTRUE;
+			portEXIT_CRITICAL();
+		}
+
+		/* Yield in case cooperative scheduling is being used. */
+#if configUSE_PREEMPTION == 0
+		{
+			taskYIELD();
+		}
+#endif
+	}
+}
+/*-----------------------------------------------------------*/
+
+/* This is called to check that all the created tasks are still running. */
+portBASE_TYPE xAreIntegerMathsTaskStillRunning(void)
+{
+	portBASE_TYPE xReturn = pdTRUE;
+	short sTask;
+
+	/* Check the maths tasks are still running by ensuring their check variables
+	are still being set to true. */
+	for (sTask = 0; sTask < intgNUMBER_OF_TASKS; sTask++) {
+		if (xTaskCheck[ sTask ] == pdFALSE) {
+			/* The check has not incremented so an error exists. */
+			xReturn = pdFALSE;
+		}
+
+		/* Reset the check variable so we can tell if it has been set by
+		the next time around. */
+		xTaskCheck[ sTask ] = pdFALSE;
+	}
+
+	return xReturn;
+}
+
diff --git a/gyro_board/src/usb/CommonDemoTasks/recmutex.c b/gyro_board/src/usb/CommonDemoTasks/recmutex.c
new file mode 100644
index 0000000..9d163d8
--- /dev/null
+++ b/gyro_board/src/usb/CommonDemoTasks/recmutex.c
@@ -0,0 +1,334 @@
+/*
+    FreeRTOS V6.0.5 - Copyright (C) 2010 Real Time Engineers Ltd.
+
+    ***************************************************************************
+    *                                                                         *
+    * If you are:                                                             *
+    *                                                                         *
+    *    + New to FreeRTOS,                                                   *
+    *    + Wanting to learn FreeRTOS or multitasking in general quickly       *
+    *    + Looking for basic training,                                        *
+    *    + Wanting to improve your FreeRTOS skills and productivity           *
+    *                                                                         *
+    * then take a look at the FreeRTOS eBook                                  *
+    *                                                                         *
+    *        "Using the FreeRTOS Real Time Kernel - a Practical Guide"        *
+    *                  http://www.FreeRTOS.org/Documentation                  *
+    *                                                                         *
+    * A pdf reference manual is also available.  Both are usually delivered   *
+    * to your inbox within 20 minutes to two hours when purchased between 8am *
+    * and 8pm GMT (although please allow up to 24 hours in case of            *
+    * exceptional circumstances).  Thank you for your support!                *
+    *                                                                         *
+    ***************************************************************************
+
+    This file is part of the FreeRTOS distribution.
+
+    FreeRTOS is free software; you can redistribute it and/or modify it under
+    the terms of the GNU General Public License (version 2) as published by the
+    Free Software Foundation AND MODIFIED BY the FreeRTOS exception.
+    ***NOTE*** The exception to the GPL is included to allow you to distribute
+    a combined work that includes FreeRTOS without being obliged to provide the
+    source code for proprietary components outside of the FreeRTOS kernel.
+    FreeRTOS 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 and the FreeRTOS license exception along with FreeRTOS; if not it
+    can be viewed here: http://www.freertos.org/a00114.html and also obtained
+    by writing to Richard Barry, contact details for whom are available on the
+    FreeRTOS WEB site.
+
+    1 tab == 4 spaces!
+
+    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.
+*/
+
+/*
+	The tasks defined on this page demonstrate the use of recursive mutexes.
+
+	For recursive mutex functionality the created mutex should be created using
+	xSemaphoreCreateRecursiveMutex(), then be manipulated
+	using the xSemaphoreTakeRecursive() and xSemaphoreGiveRecursive() API
+	functions.
+
+	This demo creates three tasks all of which access the same recursive mutex:
+
+	prvRecursiveMutexControllingTask() has the highest priority so executes
+	first and grabs the mutex.  It then performs some recursive accesses -
+	between each of which it sleeps for a short period to let the lower
+	priority tasks execute.  When it has completed its demo functionality
+	it gives the mutex back before suspending itself.
+
+	prvRecursiveMutexBlockingTask() attempts to access the mutex by performing
+	a blocking 'take'.  The blocking task has a lower priority than the
+	controlling	task so by the time it executes the mutex has already been
+	taken by the controlling task,  causing the blocking task to block.  It
+	does not unblock until the controlling task has given the mutex back,
+	and it does not actually run until the controlling task has suspended
+	itself (due to the relative priorities).  When it eventually does obtain
+	the mutex all it does is give the mutex back prior to also suspending
+	itself.  At this point both the controlling task and the blocking task are
+	suspended.
+
+	prvRecursiveMutexPollingTask() runs at the idle priority.  It spins round
+	a tight loop attempting to obtain the mutex with a non-blocking call.  As
+	the lowest priority task it will not successfully obtain the mutex until
+	both the controlling and blocking tasks are suspended.  Once it eventually
+	does obtain the mutex it first unsuspends both the controlling task and
+	blocking task prior to giving the mutex back - resulting in the polling
+	task temporarily inheriting the controlling tasks priority.
+*/
+
+/* Scheduler include files. */
+#include "FreeRTOS.h"
+#include "task.h"
+#include "semphr.h"
+
+/* Demo app include files. */
+#include "recmutex.h"
+
+/* Priorities assigned to the three tasks. */
+#define recmuCONTROLLING_TASK_PRIORITY	( tskIDLE_PRIORITY + 2 )
+#define recmuBLOCKING_TASK_PRIORITY		( tskIDLE_PRIORITY + 1 )
+#define recmuPOLLING_TASK_PRIORITY		( tskIDLE_PRIORITY + 0 )
+
+/* The recursive call depth. */
+#define recmuMAX_COUNT					( 10 )
+
+/* Misc. */
+#define recmuSHORT_DELAY				( 20 / portTICK_RATE_MS )
+#define recmuNO_DELAY					( ( portTickType ) 0 )
+#define recmuTWO_TICK_DELAY				( ( portTickType ) 2 )
+
+/* The three tasks as described at the top of this file. */
+static void prvRecursiveMutexControllingTask(void *pvParameters);
+static void prvRecursiveMutexBlockingTask(void *pvParameters);
+static void prvRecursiveMutexPollingTask(void *pvParameters);
+
+/* The mutex used by the demo. */
+static xSemaphoreHandle xMutex;
+
+/* Variables used to detect and latch errors. */
+static volatile portBASE_TYPE xErrorOccurred = pdFALSE, xControllingIsSuspended = pdFALSE, xBlockingIsSuspended = pdFALSE;
+static volatile unsigned portBASE_TYPE uxControllingCycles = 0, uxBlockingCycles, uxPollingCycles = 0;
+
+/* Handles of the two higher priority tasks, required so they can be resumed
+(unsuspended). */
+static xTaskHandle xControllingTaskHandle, xBlockingTaskHandle;
+
+/*-----------------------------------------------------------*/
+
+void vStartRecursiveMutexTasks(void)
+{
+	/* Just creates the mutex and the three tasks. */
+
+	xMutex = xSemaphoreCreateRecursiveMutex();
+
+	/* vQueueAddToRegistry() adds the mutex to the registry, if one is
+	in use.  The registry is provided as a means for kernel aware
+	debuggers to locate mutex and has no purpose if a kernel aware debugger
+	is not being used.  The call to vQueueAddToRegistry() will be removed
+	by the pre-processor if configQUEUE_REGISTRY_SIZE is not defined or is
+	defined to be less than 1. */
+	vQueueAddToRegistry((xQueueHandle) xMutex, (signed portCHAR *) "Recursive_Mutex");
+
+
+	if (xMutex != NULL) {
+		xTaskCreate(prvRecursiveMutexControllingTask, (signed portCHAR *) "Rec1", configMINIMAL_STACK_SIZE, NULL, recmuCONTROLLING_TASK_PRIORITY, &xControllingTaskHandle);
+		xTaskCreate(prvRecursiveMutexBlockingTask, (signed portCHAR *) "Rec2", configMINIMAL_STACK_SIZE, NULL, recmuBLOCKING_TASK_PRIORITY, &xBlockingTaskHandle);
+		xTaskCreate(prvRecursiveMutexPollingTask, (signed portCHAR *) "Rec3", configMINIMAL_STACK_SIZE, NULL, recmuPOLLING_TASK_PRIORITY, NULL);
+	}
+}
+/*-----------------------------------------------------------*/
+
+static void prvRecursiveMutexControllingTask(void *pvParameters)
+{
+	unsigned portBASE_TYPE ux;
+
+	/* Just to remove compiler warning. */
+	(void) pvParameters;
+
+	for (;;) {
+		/* Should not be able to 'give' the mutex, as we have not yet 'taken'
+		it. */
+		if (xSemaphoreGiveRecursive(xMutex) == pdPASS) {
+			xErrorOccurred = pdTRUE;
+		}
+
+		for (ux = 0; ux < recmuMAX_COUNT; ux++) {
+			/* We should now be able to take the mutex as many times as
+			we like.  A one tick delay is used so the polling task will
+			inherit our priority on all but the first cycle of this task.
+			If we did not block attempting to receive the mutex then no
+			priority inheritance would occur. */
+			if (xSemaphoreTakeRecursive(xMutex, recmuTWO_TICK_DELAY) != pdPASS) {
+				xErrorOccurred = pdTRUE;
+			}
+
+			/* Ensure the other task attempting to access the mutex (and the
+			other demo tasks) are able to execute. */
+			vTaskDelay(recmuSHORT_DELAY);
+		}
+
+		/* For each time we took the mutex, give it back. */
+		for (ux = 0; ux < recmuMAX_COUNT; ux++) {
+			/* Ensure the other task attempting to access the mutex (and the
+			other demo tasks) are able to execute. */
+			vTaskDelay(recmuSHORT_DELAY);
+
+			/* We should now be able to give the mutex as many times as we
+			took it. */
+			if (xSemaphoreGiveRecursive(xMutex) != pdPASS) {
+				xErrorOccurred = pdTRUE;
+			}
+		}
+
+		/* Having given it back the same number of times as it was taken, we
+		should no longer be the mutex owner, so the next give sh ould fail. */
+		if (xSemaphoreGiveRecursive(xMutex) == pdPASS) {
+			xErrorOccurred = pdTRUE;
+		}
+
+		/* Keep count of the number of cycles this task has performed so a
+		stall can be detected. */
+		uxControllingCycles++;
+
+		/* Suspend ourselves to the blocking task can execute. */
+		xControllingIsSuspended = pdTRUE;
+		vTaskSuspend(NULL);
+		xControllingIsSuspended = pdFALSE;
+	}
+}
+/*-----------------------------------------------------------*/
+
+static void prvRecursiveMutexBlockingTask(void *pvParameters)
+{
+	/* Just to remove compiler warning. */
+	(void) pvParameters;
+
+	for (;;) {
+		/* Attempt to obtain the mutex.  We should block until the
+		controlling task has given up the mutex, and not actually execute
+		past this call until the controlling task is suspended. */
+		if (xSemaphoreTakeRecursive(xMutex, portMAX_DELAY) == pdPASS) {
+			if (xControllingIsSuspended != pdTRUE) {
+				/* Did not expect to execute until the controlling task was
+				suspended. */
+				xErrorOccurred = pdTRUE;
+			} else {
+				/* Give the mutex back before suspending ourselves to allow
+				the polling task to obtain the mutex. */
+				if (xSemaphoreGiveRecursive(xMutex) != pdPASS) {
+					xErrorOccurred = pdTRUE;
+				}
+
+				xBlockingIsSuspended = pdTRUE;
+				vTaskSuspend(NULL);
+				xBlockingIsSuspended = pdFALSE;
+			}
+		} else {
+			/* We should not leave the xSemaphoreTakeRecursive() function
+			until the mutex was obtained. */
+			xErrorOccurred = pdTRUE;
+		}
+
+		/* The controlling and blocking tasks should be in lock step. */
+		if (uxControllingCycles != (uxBlockingCycles + 1)) {
+			xErrorOccurred = pdTRUE;
+		}
+
+		/* Keep count of the number of cycles this task has performed so a
+		stall can be detected. */
+		uxBlockingCycles++;
+	}
+}
+/*-----------------------------------------------------------*/
+
+static void prvRecursiveMutexPollingTask(void *pvParameters)
+{
+	/* Just to remove compiler warning. */
+	(void) pvParameters;
+
+	for (;;) {
+		/* Keep attempting to obtain the mutex.  We should only obtain it when
+		the blocking task has suspended itself. */
+		if (xSemaphoreTakeRecursive(xMutex, recmuNO_DELAY) == pdPASS) {
+			/* Is the blocking task suspended? */
+			if (xBlockingIsSuspended != pdTRUE) {
+				xErrorOccurred = pdTRUE;
+			} else {
+				/* Keep count of the number of cycles this task has performed so
+				a stall can be detected. */
+				uxPollingCycles++;
+
+				/* We can resume the other tasks here even though they have a
+				higher priority than the polling task.  When they execute they
+				will attempt to obtain the mutex but fail because the polling
+				task is still the mutex holder.  The polling task (this task)
+				will then inherit the higher priority. */
+				vTaskResume(xBlockingTaskHandle);
+				vTaskResume(xControllingTaskHandle);
+
+				/* Release the mutex, disinheriting the higher priority again. */
+				if (xSemaphoreGiveRecursive(xMutex) != pdPASS) {
+					xErrorOccurred = pdTRUE;
+				}
+			}
+		}
+
+#if configUSE_PREEMPTION == 0
+		{
+			taskYIELD();
+		}
+#endif
+	}
+}
+/*-----------------------------------------------------------*/
+
+/* This is called to check that all the created tasks are still running. */
+portBASE_TYPE xAreRecursiveMutexTasksStillRunning(void)
+{
+	portBASE_TYPE xReturn;
+	static unsigned portBASE_TYPE uxLastControllingCycles = 0, uxLastBlockingCycles = 0, uxLastPollingCycles = 0;
+
+	/* Is the controlling task still cycling? */
+	if (uxLastControllingCycles == uxControllingCycles) {
+		xErrorOccurred = pdTRUE;
+	} else {
+		uxLastControllingCycles = uxControllingCycles;
+	}
+
+	/* Is the blocking task still cycling? */
+	if (uxLastBlockingCycles == uxBlockingCycles) {
+		xErrorOccurred = pdTRUE;
+	} else {
+		uxLastBlockingCycles = uxBlockingCycles;
+	}
+
+	/* Is the polling task still cycling? */
+	if (uxLastPollingCycles == uxPollingCycles) {
+		xErrorOccurred = pdTRUE;
+	} else {
+		uxLastPollingCycles = uxPollingCycles;
+	}
+
+	if (xErrorOccurred == pdTRUE) {
+		xReturn = pdFAIL;
+	} else {
+		xReturn = pdTRUE;
+	}
+
+	return xReturn;
+}
+
+
+
+
diff --git a/gyro_board/src/usb/CommonDemoTasks/semtest.c b/gyro_board/src/usb/CommonDemoTasks/semtest.c
new file mode 100644
index 0000000..055ed11
--- /dev/null
+++ b/gyro_board/src/usb/CommonDemoTasks/semtest.c
@@ -0,0 +1,263 @@
+/*
+    FreeRTOS V6.0.5 - Copyright (C) 2010 Real Time Engineers Ltd.
+
+    ***************************************************************************
+    *                                                                         *
+    * If you are:                                                             *
+    *                                                                         *
+    *    + New to FreeRTOS,                                                   *
+    *    + Wanting to learn FreeRTOS or multitasking in general quickly       *
+    *    + Looking for basic training,                                        *
+    *    + Wanting to improve your FreeRTOS skills and productivity           *
+    *                                                                         *
+    * then take a look at the FreeRTOS eBook                                  *
+    *                                                                         *
+    *        "Using the FreeRTOS Real Time Kernel - a Practical Guide"        *
+    *                  http://www.FreeRTOS.org/Documentation                  *
+    *                                                                         *
+    * A pdf reference manual is also available.  Both are usually delivered   *
+    * to your inbox within 20 minutes to two hours when purchased between 8am *
+    * and 8pm GMT (although please allow up to 24 hours in case of            *
+    * exceptional circumstances).  Thank you for your support!                *
+    *                                                                         *
+    ***************************************************************************
+
+    This file is part of the FreeRTOS distribution.
+
+    FreeRTOS is free software; you can redistribute it and/or modify it under
+    the terms of the GNU General Public License (version 2) as published by the
+    Free Software Foundation AND MODIFIED BY the FreeRTOS exception.
+    ***NOTE*** The exception to the GPL is included to allow you to distribute
+    a combined work that includes FreeRTOS without being obliged to provide the
+    source code for proprietary components outside of the FreeRTOS kernel.
+    FreeRTOS 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 and the FreeRTOS license exception along with FreeRTOS; if not it
+    can be viewed here: http://www.freertos.org/a00114.html and also obtained
+    by writing to Richard Barry, contact details for whom are available on the
+    FreeRTOS WEB site.
+
+    1 tab == 4 spaces!
+
+    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 two sets of two tasks.  The tasks within a set share a variable, access
+ * to which is guarded by a semaphore.
+ *
+ * Each task starts by attempting to obtain the semaphore.  On obtaining a
+ * semaphore a task checks to ensure that the guarded variable has an expected
+ * value.  It then clears the variable to zero before counting it back up to the
+ * expected value in increments of 1.  After each increment the variable is checked
+ * to ensure it contains the value to which it was just set. When the starting
+ * value is again reached the task releases the semaphore giving the other task in
+ * the set a chance to do exactly the same thing.  The starting value is high
+ * enough to ensure that a tick is likely to occur during the incrementing loop.
+ *
+ * An error is flagged if at any time during the process a shared variable is
+ * found to have a value other than that expected.  Such an occurrence would
+ * suggest an error in the mutual exclusion mechanism by which access to the
+ * variable is restricted.
+ *
+ * The first set of two tasks poll their semaphore.  The second set use blocking
+ * calls.
+ *
+ */
+
+
+#include <stdlib.h>
+
+/* Scheduler include files. */
+#include "FreeRTOS.h"
+#include "task.h"
+#include "semphr.h"
+
+/* Demo app include files. */
+#include "semtest.h"
+
+/* The value to which the shared variables are counted. */
+#define semtstBLOCKING_EXPECTED_VALUE		( ( unsigned long ) 0xfff )
+#define semtstNON_BLOCKING_EXPECTED_VALUE	( ( unsigned long ) 0xff  )
+
+#define semtstSTACK_SIZE			configMINIMAL_STACK_SIZE
+
+#define semtstNUM_TASKS				( 4 )
+
+#define semtstDELAY_FACTOR			( ( portTickType ) 10 )
+
+/* The task function as described at the top of the file. */
+static portTASK_FUNCTION_PROTO(prvSemaphoreTest, pvParameters);
+
+/* Structure used to pass parameters to each task. */
+typedef struct SEMAPHORE_PARAMETERS {
+	xSemaphoreHandle xSemaphore;
+	volatile unsigned long *pulSharedVariable;
+	portTickType xBlockTime;
+} xSemaphoreParameters;
+
+/* Variables used to check that all the tasks are still running without errors. */
+static volatile short sCheckVariables[ semtstNUM_TASKS ] = { 0 };
+static volatile short sNextCheckVariable = 0;
+
+/*-----------------------------------------------------------*/
+
+void vStartSemaphoreTasks(unsigned portBASE_TYPE uxPriority)
+{
+	xSemaphoreParameters *pxFirstSemaphoreParameters, *pxSecondSemaphoreParameters;
+	const portTickType xBlockTime = (portTickType) 100;
+
+	/* Create the structure used to pass parameters to the first two tasks. */
+	pxFirstSemaphoreParameters = (xSemaphoreParameters *) pvPortMalloc(sizeof(xSemaphoreParameters));
+
+	if (pxFirstSemaphoreParameters != NULL) {
+		/* Create the semaphore used by the first two tasks. */
+		vSemaphoreCreateBinary(pxFirstSemaphoreParameters->xSemaphore);
+
+		if (pxFirstSemaphoreParameters->xSemaphore != NULL) {
+			/* Create the variable which is to be shared by the first two tasks. */
+			pxFirstSemaphoreParameters->pulSharedVariable = (unsigned long *) pvPortMalloc(sizeof(unsigned long));
+
+			/* Initialise the share variable to the value the tasks expect. */
+			*(pxFirstSemaphoreParameters->pulSharedVariable) = semtstNON_BLOCKING_EXPECTED_VALUE;
+
+			/* The first two tasks do not block on semaphore calls. */
+			pxFirstSemaphoreParameters->xBlockTime = (portTickType) 0;
+
+			/* Spawn the first two tasks.  As they poll they operate at the idle priority. */
+			xTaskCreate(prvSemaphoreTest, (signed char *) "PolSEM1", semtstSTACK_SIZE, (void *) pxFirstSemaphoreParameters, tskIDLE_PRIORITY, (xTaskHandle *) NULL);
+			xTaskCreate(prvSemaphoreTest, (signed char *) "PolSEM2", semtstSTACK_SIZE, (void *) pxFirstSemaphoreParameters, tskIDLE_PRIORITY, (xTaskHandle *) NULL);
+		}
+	}
+
+	/* Do exactly the same to create the second set of tasks, only this time
+	provide a block time for the semaphore calls. */
+	pxSecondSemaphoreParameters = (xSemaphoreParameters *) pvPortMalloc(sizeof(xSemaphoreParameters));
+	if (pxSecondSemaphoreParameters != NULL) {
+		vSemaphoreCreateBinary(pxSecondSemaphoreParameters->xSemaphore);
+
+		if (pxSecondSemaphoreParameters->xSemaphore != NULL) {
+			pxSecondSemaphoreParameters->pulSharedVariable = (unsigned long *) pvPortMalloc(sizeof(unsigned long));
+			*(pxSecondSemaphoreParameters->pulSharedVariable) = semtstBLOCKING_EXPECTED_VALUE;
+			pxSecondSemaphoreParameters->xBlockTime = xBlockTime / portTICK_RATE_MS;
+
+			xTaskCreate(prvSemaphoreTest, (signed char *) "BlkSEM1", semtstSTACK_SIZE, (void *) pxSecondSemaphoreParameters, uxPriority, (xTaskHandle *) NULL);
+			xTaskCreate(prvSemaphoreTest, (signed char *) "BlkSEM2", semtstSTACK_SIZE, (void *) pxSecondSemaphoreParameters, uxPriority, (xTaskHandle *) NULL);
+		}
+	}
+
+	/* vQueueAddToRegistry() adds the semaphore to the registry, if one is
+	in use.  The registry is provided as a means for kernel aware
+	debuggers to locate semaphores and has no purpose if a kernel aware debugger
+	is not being used.  The call to vQueueAddToRegistry() will be removed
+	by the pre-processor if configQUEUE_REGISTRY_SIZE is not defined or is
+	defined to be less than 1. */
+	vQueueAddToRegistry((xQueueHandle) pxFirstSemaphoreParameters->xSemaphore, (signed char *) "Counting_Sem_1");
+	vQueueAddToRegistry((xQueueHandle) pxSecondSemaphoreParameters->xSemaphore, (signed char *) "Counting_Sem_2");
+}
+/*-----------------------------------------------------------*/
+
+static portTASK_FUNCTION(prvSemaphoreTest, pvParameters)
+{
+	xSemaphoreParameters *pxParameters;
+	volatile unsigned long *pulSharedVariable, ulExpectedValue;
+	unsigned long ulCounter;
+	short sError = pdFALSE, sCheckVariableToUse;
+
+	/* See which check variable to use.  sNextCheckVariable is not semaphore
+	protected! */
+	portENTER_CRITICAL();
+	sCheckVariableToUse = sNextCheckVariable;
+	sNextCheckVariable++;
+	portEXIT_CRITICAL();
+
+	/* A structure is passed in as the parameter.  This contains the shared
+	variable being guarded. */
+	pxParameters = (xSemaphoreParameters *) pvParameters;
+	pulSharedVariable = pxParameters->pulSharedVariable;
+
+	/* If we are blocking we use a much higher count to ensure loads of context
+	switches occur during the count. */
+	if (pxParameters->xBlockTime > (portTickType) 0) {
+		ulExpectedValue = semtstBLOCKING_EXPECTED_VALUE;
+	} else {
+		ulExpectedValue = semtstNON_BLOCKING_EXPECTED_VALUE;
+	}
+
+	for (;;) {
+		/* Try to obtain the semaphore. */
+		if (xSemaphoreTake(pxParameters->xSemaphore, pxParameters->xBlockTime) == pdPASS) {
+			/* We have the semaphore and so expect any other tasks using the
+			shared variable to have left it in the state we expect to find
+			it. */
+			if (*pulSharedVariable != ulExpectedValue) {
+				sError = pdTRUE;
+			}
+
+			/* Clear the variable, then count it back up to the expected value
+			before releasing the semaphore.  Would expect a context switch or
+			two during this time. */
+			for (ulCounter = (unsigned long) 0; ulCounter <= ulExpectedValue; ulCounter++) {
+				*pulSharedVariable = ulCounter;
+				if (*pulSharedVariable != ulCounter) {
+					sError = pdTRUE;
+				}
+			}
+
+			/* Release the semaphore, and if no errors have occurred increment the check
+			variable. */
+			if (xSemaphoreGive(pxParameters->xSemaphore) == pdFALSE) {
+				sError = pdTRUE;
+			}
+
+			if (sError == pdFALSE) {
+				if (sCheckVariableToUse < semtstNUM_TASKS) {
+					(sCheckVariables[ sCheckVariableToUse ])++;
+				}
+			}
+
+			/* If we have a block time then we are running at a priority higher
+			than the idle priority.  This task takes a long time to complete
+			a cycle	(deliberately so to test the guarding) so will be starving
+			out lower priority tasks.  Block for some time to allow give lower
+			priority tasks some processor time. */
+			vTaskDelay(pxParameters->xBlockTime * semtstDELAY_FACTOR);
+		} else {
+			if (pxParameters->xBlockTime == (portTickType) 0) {
+				/* We have not got the semaphore yet, so no point using the
+				processor.  We are not blocking when attempting to obtain the
+				semaphore. */
+				taskYIELD();
+			}
+		}
+	}
+}
+/*-----------------------------------------------------------*/
+
+/* This is called to check that all the created tasks are still running. */
+portBASE_TYPE xAreSemaphoreTasksStillRunning(void)
+{
+	static short sLastCheckVariables[ semtstNUM_TASKS ] = { 0 };
+	portBASE_TYPE xTask, xReturn = pdTRUE;
+
+	for (xTask = 0; xTask < semtstNUM_TASKS; xTask++) {
+		if (sLastCheckVariables[ xTask ] == sCheckVariables[ xTask ]) {
+			xReturn = pdFALSE;
+		}
+
+		sLastCheckVariables[ xTask ] = sCheckVariables[ xTask ];
+	}
+
+	return xReturn;
+}
+
+