/*\r
- FreeRTOS V8.0.0 - Copyright (C) 2014 Real Time Engineers Ltd.\r
+ FreeRTOS V8.2.0rc1 - Copyright (C) 2014 Real Time Engineers Ltd.\r
All rights reserved\r
\r
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.\r
\r
- ***************************************************************************\r
- * *\r
- * FreeRTOS provides completely free yet professionally developed, *\r
- * robust, strictly quality controlled, supported, and cross *\r
- * platform software that has become a de facto standard. *\r
- * *\r
- * Help yourself get started quickly and support the FreeRTOS *\r
- * project by purchasing a FreeRTOS tutorial book, reference *\r
- * manual, or both from: http://www.FreeRTOS.org/Documentation *\r
- * *\r
- * Thank you! *\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 distribute\r
- >>! a combined work that includes FreeRTOS without being obliged to provide\r
- >>! the source code for proprietary components outside of the FreeRTOS\r
- >>! kernel.\r
+ >>! NOTE: The modification to the GPL is included to allow you to !<<\r
+ >>! distribute a combined work that includes FreeRTOS without being !<<\r
+ >>! obliged to provide the source code for proprietary components !<<\r
+ >>! outside of the FreeRTOS 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. Full license text is available from the following\r
+ FOR A PARTICULAR PURPOSE. Full license text is available on the following\r
link: http://www.freertos.org/a00114.html\r
\r
1 tab == 4 spaces!\r
***************************************************************************\r
* *\r
* Having a problem? Start by reading the FAQ "My application does *\r
- * not run, what could be wrong?" *\r
+ * not run, what could be wrong?". Have you defined configASSERT()? *\r
* *\r
* http://www.FreeRTOS.org/FAQHelp.html *\r
* *\r
***************************************************************************\r
\r
+ ***************************************************************************\r
+ * *\r
+ * FreeRTOS provides completely free yet professionally developed, *\r
+ * robust, strictly quality controlled, supported, and cross *\r
+ * platform software that is more than just the market leader, it *\r
+ * is the industry's de facto standard. *\r
+ * *\r
+ * Help yourself get started quickly while simultaneously helping *\r
+ * to support the FreeRTOS project by purchasing a FreeRTOS *\r
+ * tutorial book, reference manual, or both: *\r
+ * http://www.FreeRTOS.org/Documentation *\r
+ * *\r
+ ***************************************************************************\r
+\r
+ ***************************************************************************\r
+ * *\r
+ * Investing in training allows your team to be as productive as *\r
+ * possible as early as possible, lowering your overall development *\r
+ * cost, and enabling you to bring a more robust product to market *\r
+ * earlier than would otherwise be possible. Richard Barry is both *\r
+ * the architect and key author of FreeRTOS, and so also the world's *\r
+ * leading authority on what is the world's most popular real time *\r
+ * kernel for deeply embedded MCU designs. Obtaining your training *\r
+ * from Richard ensures your team will gain directly from his in-depth *\r
+ * product knowledge and years of usage experience. Contact Real Time *\r
+ * Engineers Ltd to enquire about the FreeRTOS Masterclass, presented *\r
+ * by Richard Barry: http://www.FreeRTOS.org/contact\r
+ * *\r
+ ***************************************************************************\r
+\r
+ ***************************************************************************\r
+ * *\r
+ * You are receiving this top quality software for free. Please play *\r
+ * fair and reciprocate by reporting any suspected issues and *\r
+ * participating in the community forum: *\r
+ * http://www.FreeRTOS.org/support *\r
+ * *\r
+ * Thank you! *\r
+ * *\r
+ ***************************************************************************\r
+\r
http://www.FreeRTOS.org - Documentation, books, training, latest versions,\r
license and Real Time Engineers Ltd. contact details.\r
\r
including FreeRTOS+Trace - an indispensable productivity tool, a DOS\r
compatible FAT file system, and our tiny thread aware UDP/IP stack.\r
\r
+ http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate.\r
+ Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS.\r
+\r
http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High\r
- Integrity Systems to sell under the OpenRTOS brand. Low cost OpenRTOS\r
- licenses offer ticketed support, indemnification and middleware.\r
+ Integrity Systems ltd. to sell under the OpenRTOS brand. Low cost OpenRTOS\r
+ licenses offer ticketed support, indemnification and commercial middleware.\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
*/\r
\r
/******************************************************************************\r
- * This project provides two demo applications. A simple blinky style project,\r
- * and a more comprehensive test and demo application. The\r
- * mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting (defined in this file) is used to\r
- * select between the two. The simply blinky demo is implemented and described\r
- * in main_blinky.c. The more comprehensive test and demo application is\r
- * implemented and described in main_full.c.\r
+ * This project provides three demo applications. A simple blinky style\r
+ * project, a more comprehensive test and demo application, and an lwIP example.\r
+ * The mainSELECTED_APPLICATION setting (defined in this file) is used to\r
+ * select between the three. The simply blinky demo is implemented and\r
+ * described in main_blinky.c. The more comprehensive test and demo application\r
+ * is implemented and described in main_full.c. The lwIP example is implemented\r
+ * and described in main_lwIP.c.\r
*\r
* This file implements the code that is not demo specific, including the\r
* hardware setup and FreeRTOS hook functions.\r
* point registers. To avoid this causing corruption it is necessary to avoid\r
* their use. For this reason main.c contains very basic C implementations of\r
* the standard C library functions memset(), memcpy() and memcmp(), which are\r
- * are used by FreeRTOS itself. Defining these functions in the project \r
+ * are used by FreeRTOS itself. Defining these functions in the project\r
* prevents the linker pulling them in from the library. Any other standard C\r
* library functions that are used by the application must likewise be defined\r
* in C.\r
\r
/* Standard includes. */\r
#include <stdio.h>\r
+#include <limits.h>\r
\r
/* Scheduler include files. */\r
#include "FreeRTOS.h"\r
#include "TimerDemo.h"\r
#include "QueueOverwrite.h"\r
#include "EventGroupsDemo.h"\r
+#include "TaskNotify.h"\r
+#include "IntSemTest.h"\r
\r
/* Xilinx includes. */\r
#include "platform.h"\r
#include "xscugic.h"\r
#include "xil_exception.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
-#define mainCREATE_SIMPLE_BLINKY_DEMO_ONLY 0\r
+/* mainSELECTED_APPLICATION is used to select between three demo applications,\r
+ * as described at the top of this file.\r
+ *\r
+ * When mainSELECTED_APPLICATION is set to 0 the simple blinky example will\r
+ * be run.\r
+ *\r
+ * When mainSELECTED_APPLICATION is set to 1 the comprehensive test and demo\r
+ * application will be run.\r
+ *\r
+ * When mainSELECTED_APPLICATION is set to 2 the lwIP example will be run.\r
+ */\r
+#define mainSELECTED_APPLICATION 0\r
\r
/*-----------------------------------------------------------*/\r
\r
static void prvSetupHardware( void );\r
\r
/*\r
- * main_blinky() is used when mainCREATE_SIMPLE_BLINKY_DEMO_ONLY is set to 1.\r
- * main_full() is used when mainCREATE_SIMPLE_BLINKY_DEMO_ONLY is set to 0.\r
+ * See the comments at the top of this file and above the\r
+ * mainSELECTED_APPLICATION definition.\r
*/\r
-#if mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1\r
+#if ( mainSELECTED_APPLICATION == 0 )\r
extern void main_blinky( void );\r
-#else\r
+#elif ( mainSELECTED_APPLICATION == 1 )\r
extern void main_full( void );\r
-#endif /* #if mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 */\r
+#elif ( mainSELECTED_APPLICATION == 2 )\r
+ extern void main_lwIP( void );\r
+#else\r
+ #error Invalid mainSELECTED_APPLICATION setting. See the comments at the top of this file and above the mainSELECTED_APPLICATION definition.\r
+#endif\r
\r
/*\r
* The Xilinx projects use a BSP that do not allow the start up code to be\r
void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName );\r
void vApplicationTickHook( void );\r
\r
+/* The private watchdog is used as the timer that generates run time\r
+stats. This frequency means it will overflow quite quickly. */\r
+XScuWdt xWatchDogInstance;\r
+\r
/*-----------------------------------------------------------*/\r
\r
/* The interrupt controller is initialised in this file, and made available to\r
/* Configure the hardware ready to run the demo. */\r
prvSetupHardware();\r
\r
- /* The mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting is described at the top\r
+ /* The mainSELECTED_APPLICATION setting is described at the top\r
of this file. */\r
- #if( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 )\r
+ #if( mainSELECTED_APPLICATION == 0 )\r
{\r
main_blinky();\r
}\r
- #else\r
+ #elif( mainSELECTED_APPLICATION == 1 )\r
{\r
main_full();\r
}\r
+ #else\r
+ {\r
+ main_lwIP();\r
+ }\r
#endif\r
\r
/* Don't expect to reach here. */\r
\r
void vApplicationTickHook( void )\r
{\r
- #if( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 0 )\r
+ #if( mainSELECTED_APPLICATION == 1 )\r
{\r
/* The full demo includes a software timer demo/test that requires\r
prodding periodically from the tick interrupt. */\r
\r
/* Call the periodic event group from ISR demo. */\r
vPeriodicEventGroupsProcessing();\r
+\r
+ /* Use task notifications from an interrupt. */\r
+ xNotifyTaskFromISR();\r
+\r
+ /* Use mutexes from interrupts. */\r
+ vInterruptSemaphorePeriodicTest();\r
}\r
#endif\r
}\r
\r
return ulBytes - x;\r
}\r
+/*-----------------------------------------------------------*/\r
+\r
+void vInitialiseTimerForRunTimeStats( void )\r
+{\r
+XScuWdt_Config *pxWatchDogInstance;\r
+uint32_t ulValue;\r
+const uint32_t ulMaxDivisor = 0xff, ulDivisorShift = 0x08;\r
+\r
+ pxWatchDogInstance = XScuWdt_LookupConfig( XPAR_SCUWDT_0_DEVICE_ID );\r
+ XScuWdt_CfgInitialize( &xWatchDogInstance, pxWatchDogInstance, pxWatchDogInstance->BaseAddr );\r
+\r
+ ulValue = XScuWdt_GetControlReg( &xWatchDogInstance );\r
+ ulValue |= ulMaxDivisor << ulDivisorShift;\r
+ XScuWdt_SetControlReg( &xWatchDogInstance, ulValue );\r
+\r
+ XScuWdt_LoadWdt( &xWatchDogInstance, UINT_MAX );\r
+ XScuWdt_SetTimerMode( &xWatchDogInstance );\r
+ XScuWdt_Start( &xWatchDogInstance );\r
+}\r
+\r
\r
\r