]> git.sur5r.net Git - freertos/blobdiff - FreeRTOS/Source/include/portable.h
Update to MIT licensed FreeRTOS V10.0.0 - see https://www.freertos.org/History.txt
[freertos] / FreeRTOS / Source / include / portable.h
index 1240ecf60fa5fb4ea1f6fab17f116f8dc31bc550..8bfb28530f18c1a690b91a9fc75656ae30c71f72 100644 (file)
@@ -1,67 +1,30 @@
 /*\r
-    FreeRTOS V7.6.0 - Copyright (C) 2013 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
-\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
-    link: http://www.freertos.org/a00114.html\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
-    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, a DOS\r
-    compatible FAT file system, and our tiny thread aware UDP/IP stack.\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
-\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.0.0\r
+ * Copyright (C) 2017 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. If you wish to use our Amazon\r
+ * FreeRTOS name, please do so in a fair use way that does not cause confusion.\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
  * Portable layer API.  Each function must be defined for each port.\r
 #ifndef PORTABLE_H\r
 #define PORTABLE_H\r
 \r
-/* Include the macro file relevant to the port being used. */\r
-\r
-#ifdef OPEN_WATCOM_INDUSTRIAL_PC_PORT\r
-       #include "..\..\Source\portable\owatcom\16bitdos\pc\portmacro.h"\r
-       typedef void ( __interrupt __far *pxISR )();\r
-#endif\r
-\r
-#ifdef OPEN_WATCOM_FLASH_LITE_186_PORT\r
-       #include "..\..\Source\portable\owatcom\16bitdos\flsh186\portmacro.h"\r
-       typedef void ( __interrupt __far *pxISR )();\r
-#endif\r
-\r
-#ifdef GCC_MEGA_AVR\r
-       #include "../portable/GCC/ATMega323/portmacro.h"\r
-#endif\r
-\r
-#ifdef IAR_MEGA_AVR\r
-       #include "../portable/IAR/ATMega323/portmacro.h"\r
-#endif\r
-\r
-#ifdef MPLAB_PIC24_PORT\r
-       #include "../../Source/portable/MPLAB/PIC24_dsPIC/portmacro.h"\r
-#endif\r
-\r
-#ifdef MPLAB_DSPIC_PORT\r
-       #include "../../Source/portable/MPLAB/PIC24_dsPIC/portmacro.h"\r
-#endif\r
-\r
-#ifdef MPLAB_PIC18F_PORT\r
-       #include "../../Source/portable/MPLAB/PIC18F/portmacro.h"\r
-#endif\r
-\r
-#ifdef MPLAB_PIC32MX_PORT\r
-       #include "../../Source/portable/MPLAB/PIC32MX/portmacro.h"\r
-#endif\r
-\r
-#ifdef _FEDPICC\r
-       #include "libFreeRTOS/Include/portmacro.h"\r
-#endif\r
-\r
-#ifdef SDCC_CYGNAL\r
-       #include "../../Source/portable/SDCC/Cygnal/portmacro.h"\r
-#endif\r
-\r
-#ifdef GCC_ARM7\r
-       #include "../../Source/portable/GCC/ARM7_LPC2000/portmacro.h"\r
-#endif\r
-\r
-#ifdef GCC_ARM7_ECLIPSE\r
-       #include "portmacro.h"\r
-#endif\r
-\r
-#ifdef ROWLEY_LPC23xx\r
-       #include "../../Source/portable/GCC/ARM7_LPC23xx/portmacro.h"\r
-#endif\r
-\r
-#ifdef IAR_MSP430\r
-       #include "..\..\Source\portable\IAR\MSP430\portmacro.h"\r
-#endif\r
-\r
-#ifdef GCC_MSP430\r
-       #include "../../Source/portable/GCC/MSP430F449/portmacro.h"\r
-#endif\r
-\r
-#ifdef ROWLEY_MSP430\r
-       #include "../../Source/portable/Rowley/MSP430F449/portmacro.h"\r
-#endif\r
-\r
-#ifdef ARM7_LPC21xx_KEIL_RVDS\r
-       #include "..\..\Source\portable\RVDS\ARM7_LPC21xx\portmacro.h"\r
-#endif\r
-\r
-#ifdef SAM7_GCC\r
-       #include "../../Source/portable/GCC/ARM7_AT91SAM7S/portmacro.h"\r
-#endif\r
-\r
-#ifdef SAM7_IAR\r
-       #include "..\..\Source\portable\IAR\AtmelSAM7S64\portmacro.h"\r
-#endif\r
-\r
-#ifdef SAM9XE_IAR\r
-       #include "..\..\Source\portable\IAR\AtmelSAM9XE\portmacro.h"\r
-#endif\r
-\r
-#ifdef LPC2000_IAR\r
-       #include "..\..\Source\portable\IAR\LPC2000\portmacro.h"\r
-#endif\r
-\r
-#ifdef STR71X_IAR\r
-       #include "..\..\Source\portable\IAR\STR71x\portmacro.h"\r
-#endif\r
-\r
-#ifdef STR75X_IAR\r
-       #include "..\..\Source\portable\IAR\STR75x\portmacro.h"\r
-#endif\r
-\r
-#ifdef STR75X_GCC\r
-       #include "..\..\Source\portable\GCC\STR75x\portmacro.h"\r
-#endif\r
-\r
-#ifdef STR91X_IAR\r
-       #include "..\..\Source\portable\IAR\STR91x\portmacro.h"\r
-#endif\r
-\r
-#ifdef GCC_H8S\r
-       #include "../../Source/portable/GCC/H8S2329/portmacro.h"\r
-#endif\r
-\r
-#ifdef GCC_AT91FR40008\r
-       #include "../../Source/portable/GCC/ARM7_AT91FR40008/portmacro.h"\r
-#endif\r
-\r
-#ifdef RVDS_ARMCM3_LM3S102\r
-       #include "../../Source/portable/RVDS/ARM_CM3/portmacro.h"\r
-#endif\r
-\r
-#ifdef GCC_ARMCM3_LM3S102\r
-       #include "../../Source/portable/GCC/ARM_CM3/portmacro.h"\r
-#endif\r
-\r
-#ifdef GCC_ARMCM3\r
-       #include "../../Source/portable/GCC/ARM_CM3/portmacro.h"\r
-#endif\r
-\r
-#ifdef IAR_ARM_CM3\r
-       #include "../../Source/portable/IAR/ARM_CM3/portmacro.h"\r
-#endif\r
-\r
-#ifdef IAR_ARMCM3_LM\r
-       #include "../../Source/portable/IAR/ARM_CM3/portmacro.h"\r
-#endif\r
-\r
-#ifdef HCS12_CODE_WARRIOR\r
-       #include "../../Source/portable/CodeWarrior/HCS12/portmacro.h"\r
-#endif\r
-\r
-#ifdef MICROBLAZE_GCC\r
-       #include "../../Source/portable/GCC/MicroBlaze/portmacro.h"\r
-#endif\r
-\r
-#ifdef TERN_EE\r
-       #include "..\..\Source\portable\Paradigm\Tern_EE\small\portmacro.h"\r
-#endif\r
-\r
-#ifdef GCC_HCS12\r
-       #include "../../Source/portable/GCC/HCS12/portmacro.h"\r
-#endif\r
-\r
-#ifdef GCC_MCF5235\r
-    #include "../../Source/portable/GCC/MCF5235/portmacro.h"\r
-#endif\r
-\r
-#ifdef COLDFIRE_V2_GCC\r
-       #include "../../../Source/portable/GCC/ColdFire_V2/portmacro.h"\r
-#endif\r
-\r
-#ifdef COLDFIRE_V2_CODEWARRIOR\r
-       #include "../../Source/portable/CodeWarrior/ColdFire_V2/portmacro.h"\r
-#endif\r
-\r
-#ifdef GCC_PPC405\r
-       #include "../../Source/portable/GCC/PPC405_Xilinx/portmacro.h"\r
-#endif\r
-\r
-#ifdef GCC_PPC440\r
-       #include "../../Source/portable/GCC/PPC440_Xilinx/portmacro.h"\r
-#endif\r
-\r
-#ifdef _16FX_SOFTUNE\r
-       #include "..\..\Source\portable\Softune\MB96340\portmacro.h"\r
-#endif\r
-\r
-#ifdef BCC_INDUSTRIAL_PC_PORT\r
-       /* A short file name has to be used in place of the normal\r
-       FreeRTOSConfig.h when using the Borland compiler. */\r
-       #include "frconfig.h"\r
-       #include "..\portable\BCC\16BitDOS\PC\prtmacro.h"\r
-    typedef void ( __interrupt __far *pxISR )();\r
-#endif\r
-\r
-#ifdef BCC_FLASH_LITE_186_PORT\r
-       /* A short file name has to be used in place of the normal\r
-       FreeRTOSConfig.h when using the Borland compiler. */\r
-       #include "frconfig.h"\r
-       #include "..\portable\BCC\16BitDOS\flsh186\prtmacro.h"\r
-    typedef void ( __interrupt __far *pxISR )();\r
-#endif\r
-\r
-#ifdef __GNUC__\r
-   #ifdef __AVR32_AVR32A__\r
-          #include "portmacro.h"\r
-   #endif\r
-#endif\r
-\r
-#ifdef __ICCAVR32__\r
-   #ifdef __CORE__\r
-      #if __CORE__ == __AVR32A__\r
-             #include "portmacro.h"\r
-      #endif\r
-   #endif\r
-#endif\r
-\r
-#ifdef __91467D\r
-       #include "portmacro.h"\r
-#endif\r
-\r
-#ifdef __96340\r
+/* Each FreeRTOS port has a unique portmacro.h header file.  Originally a\r
+pre-processor definition was used to ensure the pre-processor found the correct\r
+portmacro.h file for the port being used.  That scheme was deprecated in favour\r
+of setting the compiler's include path such that it found the correct\r
+portmacro.h file - removing the need for the constant and allowing the\r
+portmacro.h file to be located anywhere in relation to the port being used.\r
+Purely for reasons of backward compatibility the old method is still valid, but\r
+to make it clear that new projects should not use it, support for the port\r
+specific constants has been moved into the deprecated_definitions.h header\r
+file. */\r
+#include "deprecated_definitions.h"\r
+\r
+/* If portENTER_CRITICAL is not defined then including deprecated_definitions.h\r
+did not result in a portmacro.h header file being included - and it should be\r
+included here.  In this case the path to the correct portmacro.h header file\r
+must be set in the compiler's include path. */\r
+#ifndef portENTER_CRITICAL\r
        #include "portmacro.h"\r
 #endif\r
 \r
-\r
-#ifdef __IAR_V850ES_Fx3__\r
-       #include "../../Source/portable/IAR/V850ES/portmacro.h"\r
-#endif\r
-\r
-#ifdef __IAR_V850ES_Jx3__\r
-       #include "../../Source/portable/IAR/V850ES/portmacro.h"\r
-#endif\r
-\r
-#ifdef __IAR_V850ES_Jx3_L__\r
-       #include "../../Source/portable/IAR/V850ES/portmacro.h"\r
-#endif\r
-\r
-#ifdef __IAR_V850ES_Jx2__\r
-       #include "../../Source/portable/IAR/V850ES/portmacro.h"\r
-#endif\r
-\r
-#ifdef __IAR_V850ES_Hx2__\r
-       #include "../../Source/portable/IAR/V850ES/portmacro.h"\r
+#if portBYTE_ALIGNMENT == 32\r
+       #define portBYTE_ALIGNMENT_MASK ( 0x001f )\r
 #endif\r
 \r
-#ifdef __IAR_78K0R_Kx3__\r
-       #include "../../Source/portable/IAR/78K0R/portmacro.h"\r
-#endif\r
-\r
-#ifdef __IAR_78K0R_Kx3L__\r
-       #include "../../Source/portable/IAR/78K0R/portmacro.h"\r
-#endif\r
-\r
-/* Catch all to ensure portmacro.h is included in the build.  Newer demos\r
-have the path as part of the project options, rather than as relative from\r
-the project location.  If portENTER_CRITICAL() has not been defined then\r
-portmacro.h has not yet been included - as every portmacro.h provides a\r
-portENTER_CRITICAL() definition.  Check the demo application for your demo\r
-to find the path to the correct portmacro.h file. */\r
-#ifndef portENTER_CRITICAL\r
-       #include "portmacro.h"\r
+#if portBYTE_ALIGNMENT == 16\r
+       #define portBYTE_ALIGNMENT_MASK ( 0x000f )\r
 #endif\r
 \r
 #if portBYTE_ALIGNMENT == 8\r
@@ -356,11 +98,32 @@ extern "C" {
  *\r
  */\r
 #if( portUSING_MPU_WRAPPERS == 1 )\r
-       portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters, portBASE_TYPE xRunPrivileged ) PRIVILEGED_FUNCTION;\r
+       StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, TaskFunction_t pxCode, void *pvParameters, BaseType_t xRunPrivileged ) PRIVILEGED_FUNCTION;\r
 #else\r
-       portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) PRIVILEGED_FUNCTION;\r
+       StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, TaskFunction_t pxCode, void *pvParameters ) PRIVILEGED_FUNCTION;\r
 #endif\r
 \r
+/* Used by heap_5.c. */\r
+typedef struct HeapRegion\r
+{\r
+       uint8_t *pucStartAddress;\r
+       size_t xSizeInBytes;\r
+} HeapRegion_t;\r
+\r
+/*\r
+ * Used to define multiple heap regions for use by heap_5.c.  This function\r
+ * must be called before any calls to pvPortMalloc() - not creating a task,\r
+ * queue, semaphore, mutex, software timer, event group, etc. will result in\r
+ * pvPortMalloc being called.\r
+ *\r
+ * pxHeapRegions passes in an array of HeapRegion_t structures - each of which\r
+ * defines a region of memory that can be used as the heap.  The array is\r
+ * terminated by a HeapRegions_t structure that has a size of 0.  The region\r
+ * with the lowest start address must appear first in the array.\r
+ */\r
+void vPortDefineHeapRegions( const HeapRegion_t * const pxHeapRegions ) PRIVILEGED_FUNCTION;\r
+\r
+\r
 /*\r
  * Map to the memory management routines required for the port.\r
  */\r
@@ -368,12 +131,13 @@ void *pvPortMalloc( size_t xSize ) PRIVILEGED_FUNCTION;
 void vPortFree( void *pv ) PRIVILEGED_FUNCTION;\r
 void vPortInitialiseBlocks( void ) PRIVILEGED_FUNCTION;\r
 size_t xPortGetFreeHeapSize( void ) PRIVILEGED_FUNCTION;\r
+size_t xPortGetMinimumEverFreeHeapSize( void ) PRIVILEGED_FUNCTION;\r
 \r
 /*\r
  * Setup the hardware ready for the scheduler to take control.  This generally\r
  * sets up a tick interrupt and sets timers for the correct tick frequency.\r
  */\r
-portBASE_TYPE xPortStartScheduler( void ) PRIVILEGED_FUNCTION;\r
+BaseType_t xPortStartScheduler( void ) PRIVILEGED_FUNCTION;\r
 \r
 /*\r
  * Undo any hardware/ISR setup that was performed by xPortStartScheduler() so\r
@@ -391,7 +155,7 @@ void vPortEndScheduler( void ) PRIVILEGED_FUNCTION;
  */\r
 #if( portUSING_MPU_WRAPPERS == 1 )\r
        struct xMEMORY_REGION;\r
-       void vPortStoreTaskMPUSettings( xMPU_SETTINGS *xMPUSettings, const struct xMEMORY_REGION * const xRegions, portSTACK_TYPE *pxBottomOfStack, unsigned short usStackDepth ) PRIVILEGED_FUNCTION;\r
+       void vPortStoreTaskMPUSettings( xMPU_SETTINGS *xMPUSettings, const struct xMEMORY_REGION * const xRegions, StackType_t *pxBottomOfStack, uint32_t ulStackDepth ) PRIVILEGED_FUNCTION;\r
 #endif\r
 \r
 #ifdef __cplusplus\r