--- /dev/null
+/*\r
+ FreeRTOS V7.4.0 - Copyright (C) 2013 Real Time Engineers Ltd.\r
+\r
+ FEATURES AND PORTS ARE ADDED TO FREERTOS ALL THE TIME. PLEASE VISIT\r
+ http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.\r
+\r
+ ***************************************************************************\r
+ * *\r
+ * FreeRTOS tutorial books are available in pdf and paperback. *\r
+ * Complete, revised, and edited pdf reference manuals are also *\r
+ * available. *\r
+ * *\r
+ * Purchasing FreeRTOS documentation will not only help you, by *\r
+ * ensuring you get running as quickly as possible and with an *\r
+ * in-depth knowledge of how to use FreeRTOS, it will also help *\r
+ * the FreeRTOS project to continue with its mission of providing *\r
+ * professional grade, cross platform, de facto standard solutions *\r
+ * for microcontrollers - completely free of charge! *\r
+ * *\r
+ * >>> See http://www.FreeRTOS.org/Documentation for details. <<< *\r
+ * *\r
+ * Thank you for using FreeRTOS, and thank you for your support! *\r
+ * *\r
+ ***************************************************************************\r
+\r
+\r
+ This file is part of the FreeRTOS distribution.\r
+\r
+ FreeRTOS is free software; you can redistribute it and/or modify it under\r
+ the terms of the GNU General Public License (version 2) as published by the\r
+ Free Software Foundation AND MODIFIED BY the FreeRTOS exception.\r
+\r
+ >>>>>>NOTE<<<<<< The modification to the GPL is included to allow you to\r
+ distribute a combined work that includes FreeRTOS without being obliged to\r
+ provide the source code for proprietary components outside of the FreeRTOS\r
+ kernel.\r
+\r
+ FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY\r
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\r
+ FOR A PARTICULAR PURPOSE. See the GNU General Public License for more\r
+ details. You should have received a copy of the GNU General Public License\r
+ and the FreeRTOS license exception along with FreeRTOS; if not itcan be\r
+ viewed here: http://www.freertos.org/a00114.html and also obtained by\r
+ writing to Real Time Engineers Ltd., contact details for whom are available\r
+ on the FreeRTOS WEB site.\r
+\r
+ 1 tab == 4 spaces!\r
+\r
+ ***************************************************************************\r
+ * *\r
+ * Having a problem? Start by reading the FAQ "My application does *\r
+ * not run, what could be wrong?" *\r
+ * *\r
+ * http://www.FreeRTOS.org/FAQHelp.html *\r
+ * *\r
+ ***************************************************************************\r
+\r
+\r
+ http://www.FreeRTOS.org - Documentation, books, training, latest versions,\r
+ license and Real Time Engineers Ltd. contact details.\r
+\r
+ http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,\r
+ including FreeRTOS+Trace - an indispensable productivity tool, and our new\r
+ fully thread aware and reentrant UDP/IP stack.\r
+\r
+ http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High\r
+ Integrity Systems, who sell the code with commercial support,\r
+ indemnification and middleware, under the OpenRTOS brand.\r
+\r
+ http://www.SafeRTOS.com - High Integrity Systems also provide a safety\r
+ engineered and independently SIL3 certified version for use in safety and\r
+ mission critical applications that require provable dependability.\r
+*/\r
+\r
+/*\r
+ * This file defines the RegTest tasks as described at the top of main.c\r
+ */\r
+\r
+/* ISR_Support.h contains the definitions of portSAVE_CONTEXT() and\r
+portRESTORE_CONTEXT(). */\r
+#include "ISR_Support.h"\r
+\r
+ .global _vANExampleISR_ASM_Wrapper\r
+ .extern _vAnExampleISR_C_Handler\r
+\r
+ .text\r
+\r
+ /*\r
+ * This demo does not include a functional interrupt service routine - so\r
+ * this dummy handler (which is not actually installed) is provided as an\r
+ * example of how an ISR that needs to cause a context switch needs to be\r
+ * implemented. ISRs that do not cause a context switch have no special\r
+ * requirements and can be written as per the compiler documentation.\r
+ *\r
+ * This assembly wrapper function calls the main handler, which is called\r
+ * vAnExampleISR_C_Handler(), and is implemented in main.c. See the\r
+ * documentation page for this demo on the FreeRTOS.org website for full\r
+ * instructions.\r
+ *\r
+ * NOTE: vANExampleISR_ASM_Wrapper needs to be installed into the relevant\r
+ * vector within vector_table.c.\r
+ */\r
+\r
+ vANExampleISR_ASM_Wrapper:\r
+\r
+ /* portSAVE_CONTEXT() must be the first thing called in the ASM\r
+ wrapper. */\r
+ portSAVE_CONTEXT\r
+\r
+ /* Once the context has been saved the C handler can be called. */\r
+ call !!_vAnExampleISR_C_Handler\r
+\r
+ /* Finally the ISR must end with a call to portRESTORE_CONTEXT()\r
+ followed by a reti instruction to return from the interrupt to whichever\r
+ task is now the task selected to run (which may be different to the task\r
+ that was running before the interrupt started). */\r
+ portRESTORE_CONTEXT\r
+ reti\r
+\r
+ .end\r
+\r
* This file implements the code that is not demo specific, including the\r
* hardware setup and FreeRTOS hook functions.\r
*\r
+ * This project does not provide an example of how to write an RTOS compatible\r
+ * interrupt service routine (other than the tick interrupt itself), so this\r
+ * file contains the function vAnExampleISR_C_Handler() as a dummy example (that\r
+ * is not actually installed) that can be used as a reference. Also see the\r
+ * file ExampleISR.S, and the documentation page for this demo on the\r
+ * FreeRTOS.org website for full instructions.\r
*\r
* ENSURE TO READ THE DOCUMENTATION PAGE FOR THIS PORT AND DEMO APPLICATION ON\r
* THE http://www.FreeRTOS.org WEB SITE FOR FULL INFORMATION ON USING THIS DEMO\r
/* Scheduler include files. */\r
#include "FreeRTOS.h"\r
#include "task.h"\r
+#include "semphr.h"\r
\r
/* Set mainCREATE_SIMPLE_BLINKY_DEMO_ONLY to one to run the simple blinky demo,\r
or 0 to run the more comprehensive test and demo application. */\r
void vApplicationStackOverflowHook( xTaskHandle pxTask, signed char *pcTaskName );\r
void vApplicationTickHook( void );\r
\r
+/* This variable is not actually used, but provided to allow an example of how\r
+to write an ISR to be included in this file. */\r
+static xSemaphoreHandle xSemaphore = NULL;\r
/*-----------------------------------------------------------*/\r
\r
int main( void )\r
}\r
/*-----------------------------------------------------------*/\r
\r
+void vAnExampleISR_C_Handler( void )\r
+{\r
+ /*\r
+ * This demo does not include a functional interrupt service routine - so\r
+ * this dummy handler (which is not actually installed) is provided as an\r
+ * example of how an ISR that needs to cause a context switch needs to be\r
+ * implemented. ISRs that do not cause a context switch have no special\r
+ * requirements and can be written as per the compiler documentation.\r
+ *\r
+ * This C function is called from a wrapper function that is implemented\r
+ * in assembly code. See vANExampleISR_ASM_Wrapper() in ExampleISR.S. Also\r
+ * see the documentation page for this demo on the FreeRTOS.org website for\r
+ * full instructions.\r
+ */\r
+short sHigherPriorityTaskWoken = pdFALSE;\r
+\r
+ /* Handler code goes here...*/\r
+\r
+ /* For purposes of demonstration, assume at some point the hander calls\r
+ xSemaphoreGiveFromISR().*/\r
+ xSemaphoreGiveFromISR( xSemaphore, &sHigherPriorityTaskWoken );\r
+\r
+ /* If giving the semaphore unblocked a task, and the unblocked task has a\r
+ priority higher than or equal to the currently running task, then\r
+ sHigherPriorityTaskWoken will have been set to pdTRUE internally within the\r
+ xSemaphoreGiveFromISR() function. Passing a pdTRUE value to\r
+ portYIELD_FROM_ISR() will cause this interrupt to return directly to the\r
+ higher priority unblocked task. */\r
+ portYIELD_FROM_ISR( sHigherPriorityTaskWoken );\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
void vApplicationMallocFailedHook( void )\r
{\r
/* Called if a call to pvPortMalloc() fails because there is insufficient\r