/*\r
- FreeRTOS V8.2.0 - Copyright (C) 2015 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
- 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
- ***************************************************************************\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
-\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 on the following\r
- link: http://www.freertos.org/a00114.html\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
- http://www.FreeRTOS.org/FAQHelp.html - Having a problem? Start by reading\r
- the FAQ page "My application does not run, what could be wrong?". Have you\r
- defined configASSERT()?\r
-\r
- http://www.FreeRTOS.org/support - In return for receiving this top quality\r
- embedded software for free we request you assist our global community by\r
- participating in the support forum.\r
-\r
- http://www.FreeRTOS.org/training - Investing in training allows your team to\r
- be as productive as possible as early as possible. Now you can receive\r
- FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers\r
- Ltd, and the world's leading authority on the world's leading RTOS.\r
-\r
- http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,\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 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
- mission critical applications that require provable dependability.\r
-\r
- 1 tab == 4 spaces!\r
-*/\r
+ * FreeRTOS Kernel V10.2.0\r
+ * Copyright (C) 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.\r
+ *\r
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of\r
+ * this software and associated documentation files (the "Software"), to deal in\r
+ * the Software without restriction, including without limitation the rights to\r
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\r
+ * the Software, and to permit persons to whom the Software is furnished to do so,\r
+ * subject to the following conditions:\r
+ *\r
+ * The above copyright notice and this permission notice shall be included in all\r
+ * copies or substantial portions of the Software.\r
+ *\r
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\r
+ * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\r
+ * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\r
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
+ *\r
+ * http://www.FreeRTOS.org\r
+ * http://aws.amazon.com/freertos\r
+ *\r
+ * 1 tab == 4 spaces!\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
#include "xtmrctr.h"\r
#include "xil_cache.h"\r
\r
-/* mainCREATE_SIMPLE_BLINKY_DEMO_ONLY is used to select between the simply\r
- * blinky demo and the comprehensive test and demo application.\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 mainCREATE_SIMPLE_BLINKY_DEMO_ONLY is set to 1 the simple blinky example\r
- * will be run.\r
+ * When mainSELECTED_APPLICATION is set to 1 the comprehensive test and demo\r
+ * application will be run.\r
*\r
- * When mainCREATE_SIMPLE_BLINKY_DEMO_ONLY is set to 0 the comprehensive test\r
- * and demo application will be run.\r
+ * When mainSELECTED_APPLICATION is set to 2 the lwIP example will be run.\r
*/\r
-#define mainCREATE_SIMPLE_BLINKY_DEMO_ONLY 0\r
+#define mainSELECTED_APPLICATION 0\r
\r
/*-----------------------------------------------------------*/\r
\r
static void prvSetupHardware( void );\r
\r
/*\r
- * See the comments at the top of this file and above the\r
- * mainCREATE_SIMPLE_BLINKY_DEMO_ONLY definition.\r
- */\r
-#if ( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 )\r
+* See the comments at the top of this file and above the\r
+* mainSELECTED_APPLICATION definition.\r
+*/\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
+#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
/* Prototypes for the standard FreeRTOS callback/hook functions implemented\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
#if defined( XPAR_MICROBLAZE_USE_ICACHE ) && ( XPAR_MICROBLAZE_USE_ICACHE != 0 )\r
{\r
+ Xil_ICacheInvalidate();\r
Xil_ICacheEnable();\r
}\r
#endif\r
\r
#if defined( XPAR_MICROBLAZE_USE_DCACHE ) && ( XPAR_MICROBLAZE_USE_DCACHE != 0 )\r
{\r
+ Xil_DCacheInvalidate();\r
Xil_DCacheEnable();\r
}\r
#endif\r
/* Run time stack overflow checking is performed if\r
configCHECK_FOR_STACK_OVERFLOW is defined to 1 or 2. This hook\r
function is called if a stack overflow is detected. Force an assertion\r
- failuse. */\r
+ failure. */\r
configASSERT( ( char * ) pxTask == pcTaskName );\r
}\r
/*-----------------------------------------------------------*/\r
\r
void vApplicationIdleHook( void )\r
{\r
- #if( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 0 )\r
+ #if( mainSELECTED_APPLICATION == 1 )\r
{\r
extern void vFullDemoIdleHook( void );\r
\r
\r
void vApplicationTickHook( void )\r
{\r
- #if( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 0 )\r
+ #if( mainSELECTED_APPLICATION == 1 )\r
{\r
extern void vFullDemoTickHook( void );\r
\r
purpose. */\r
vPortEnableInterrupt( XPAR_INTC_0_TMRCTR_0_VEC_ID );\r
\r
- /* Configure the timer interrupt handler. */\r
+ /* Configure the timer interrupt handler. This installs the handler\r
+ directly, rather than through the Xilinx driver. This is done for\r
+ efficiency. */\r
XTmrCtr_SetHandler( &xTickTimerInstance, ( void * ) vPortTickISR, NULL );\r
\r
/* Set the correct period for the timer. */\r
\r
if( ulTimeNow < ulLastTime )\r
{\r
- ulOverflows += ( 1UL << ulPrescale );\r
+ /* 32 as its a 32-bit number. */\r
+ ulOverflows += ( 1UL << ( 32 - ulPrescale ) );\r
}\r
+ ulLastTime = ulTimeNow;\r
\r
ulReturn = ( ulTimeNow >> ulPrescale ) + ulOverflows;\r
\r
return ulReturn;\r
}\r
+/*-----------------------------------------------------------*/\r
+\r
+\r