Rohit Grover / FreeRTOS

Dependents:   Nucleo freertos_test FreeRTOS_test freertos_bluetooth ... more

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers portable.h Source File

portable.h

00001 /*
00002     FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. 
00003     All rights reserved
00004 
00005     VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
00006 
00007     ***************************************************************************
00008      *                                                                       *
00009      *    FreeRTOS provides completely free yet professionally developed,    *
00010      *    robust, strictly quality controlled, supported, and cross          *
00011      *    platform software that has become a de facto standard.             *
00012      *                                                                       *
00013      *    Help yourself get started quickly and support the FreeRTOS         *
00014      *    project by purchasing a FreeRTOS tutorial book, reference          *
00015      *    manual, or both from: http://www.FreeRTOS.org/Documentation        *
00016      *                                                                       *
00017      *    Thank you!                                                         *
00018      *                                                                       *
00019     ***************************************************************************
00020 
00021     This file is part of the FreeRTOS distribution.
00022 
00023     FreeRTOS is free software; you can redistribute it and/or modify it under
00024     the terms of the GNU General Public License (version 2) as published by the
00025     Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.
00026 
00027     >>! NOTE: The modification to the GPL is included to allow you to distribute
00028     >>! a combined work that includes FreeRTOS without being obliged to provide
00029     >>! the source code for proprietary components outside of the FreeRTOS
00030     >>! kernel.
00031 
00032     FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
00033     WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00034     FOR A PARTICULAR PURPOSE.  Full license text is available from the following
00035     link: http://www.freertos.org/a00114.html
00036 
00037     1 tab == 4 spaces!
00038 
00039     ***************************************************************************
00040      *                                                                       *
00041      *    Having a problem?  Start by reading the FAQ "My application does   *
00042      *    not run, what could be wrong?"                                     *
00043      *                                                                       *
00044      *    http://www.FreeRTOS.org/FAQHelp.html                               *
00045      *                                                                       *
00046     ***************************************************************************
00047 
00048     http://www.FreeRTOS.org - Documentation, books, training, latest versions,
00049     license and Real Time Engineers Ltd. contact details.
00050 
00051     http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
00052     including FreeRTOS+Trace - an indispensable productivity tool, a DOS
00053     compatible FAT file system, and our tiny thread aware UDP/IP stack.
00054 
00055     http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High
00056     Integrity Systems to sell under the OpenRTOS brand.  Low cost OpenRTOS
00057     licenses offer ticketed support, indemnification and middleware.
00058 
00059     http://www.SafeRTOS.com - High Integrity Systems also provide a safety
00060     engineered and independently SIL3 certified version for use in safety and
00061     mission critical applications that require provable dependability.
00062 
00063     1 tab == 4 spaces!
00064 */
00065 
00066 /*-----------------------------------------------------------
00067  * Portable layer API.  Each function must be defined for each port.
00068  *----------------------------------------------------------*/
00069 
00070 #ifndef PORTABLE_H
00071 #define PORTABLE_H
00072 
00073 /* Include the macro file relevant to the port being used. */
00074 
00075 #ifdef OPEN_WATCOM_INDUSTRIAL_PC_PORT
00076     #include "..\..\Source\portable\owatcom\16bitdos\pc\portmacro.h"
00077     typedef void ( __interrupt __far *pxISR )();
00078 #endif
00079 
00080 #ifdef OPEN_WATCOM_FLASH_LITE_186_PORT
00081     #include "..\..\Source\portable\owatcom\16bitdos\flsh186\portmacro.h"
00082     typedef void ( __interrupt __far *pxISR )();
00083 #endif
00084 
00085 #ifdef GCC_MEGA_AVR
00086     #include "../portable/GCC/ATMega323/portmacro.h"
00087 #endif
00088 
00089 #ifdef IAR_MEGA_AVR
00090     #include "../portable/IAR/ATMega323/portmacro.h"
00091 #endif
00092 
00093 #ifdef MPLAB_PIC24_PORT
00094     #include "..\..\Source\portable\MPLAB\PIC24_dsPIC\portmacro.h"
00095 #endif
00096 
00097 #ifdef MPLAB_DSPIC_PORT
00098     #include "..\..\Source\portable\MPLAB\PIC24_dsPIC\portmacro.h"
00099 #endif
00100 
00101 #ifdef MPLAB_PIC18F_PORT
00102     #include "..\..\Source\portable\MPLAB\PIC18F\portmacro.h"
00103 #endif
00104 
00105 #ifdef MPLAB_PIC32MX_PORT
00106     #include "../../Source/portable/MPLAB/PIC32MX/portmacro.h"
00107 #endif
00108 
00109 #ifdef _FEDPICC
00110     #include "libFreeRTOS/Include/portmacro.h"
00111 #endif
00112 
00113 #ifdef SDCC_CYGNAL
00114     #include "../../Source/portable/SDCC/Cygnal/portmacro.h"
00115 #endif
00116 
00117 #ifdef GCC_ARM7
00118     #include "../../Source/portable/GCC/ARM7_LPC2000/portmacro.h"
00119 #endif
00120 
00121 #ifdef GCC_ARM7_ECLIPSE
00122     #include "portmacro.h"
00123 #endif
00124 
00125 #ifdef ROWLEY_LPC23xx
00126     #include "../../Source/portable/GCC/ARM7_LPC23xx/portmacro.h"
00127 #endif
00128 
00129 #ifdef IAR_MSP430
00130     #include "..\..\Source\portable\IAR\MSP430\portmacro.h"
00131 #endif
00132 
00133 #ifdef GCC_MSP430
00134     #include "../../Source/portable/GCC/MSP430F449/portmacro.h"
00135 #endif
00136 
00137 #ifdef ROWLEY_MSP430
00138     #include "../../Source/portable/Rowley/MSP430F449/portmacro.h"
00139 #endif
00140 
00141 #ifdef ARM7_LPC21xx_KEIL_RVDS
00142     #include "..\..\Source\portable\RVDS\ARM7_LPC21xx\portmacro.h"
00143 #endif
00144 
00145 #ifdef SAM7_GCC
00146     #include "../../Source/portable/GCC/ARM7_AT91SAM7S/portmacro.h"
00147 #endif
00148 
00149 #ifdef SAM7_IAR
00150     #include "..\..\Source\portable\IAR\AtmelSAM7S64\portmacro.h"
00151 #endif
00152 
00153 #ifdef SAM9XE_IAR
00154     #include "..\..\Source\portable\IAR\AtmelSAM9XE\portmacro.h"
00155 #endif
00156 
00157 #ifdef LPC2000_IAR
00158     #include "..\..\Source\portable\IAR\LPC2000\portmacro.h"
00159 #endif
00160 
00161 #ifdef STR71X_IAR
00162     #include "..\..\Source\portable\IAR\STR71x\portmacro.h"
00163 #endif
00164 
00165 #ifdef STR75X_IAR
00166     #include "..\..\Source\portable\IAR\STR75x\portmacro.h"
00167 #endif
00168 
00169 #ifdef STR75X_GCC
00170     #include "..\..\Source\portable\GCC\STR75x\portmacro.h"
00171 #endif
00172 
00173 #ifdef STR91X_IAR
00174     #include "..\..\Source\portable\IAR\STR91x\portmacro.h"
00175 #endif
00176 
00177 #ifdef GCC_H8S
00178     #include "../../Source/portable/GCC/H8S2329/portmacro.h"
00179 #endif
00180 
00181 #ifdef GCC_AT91FR40008
00182     #include "../../Source/portable/GCC/ARM7_AT91FR40008/portmacro.h"
00183 #endif
00184 
00185 #ifdef RVDS_ARMCM3_LM3S102
00186     #include "../../Source/portable/RVDS/ARM_CM3/portmacro.h"
00187 #endif
00188 
00189 #ifdef GCC_ARMCM3_LM3S102
00190     #include "../../Source/portable/GCC/ARM_CM3/portmacro.h"
00191 #endif
00192 
00193 #ifdef GCC_ARMCM3
00194     #include "../../Source/portable/GCC/ARM_CM3/portmacro.h"
00195 #endif
00196 
00197 #ifdef IAR_ARM_CM3
00198     #include "../../Source/portable/IAR/ARM_CM3/portmacro.h"
00199 #endif
00200 
00201 #ifdef IAR_ARMCM3_LM
00202     #include "../../Source/portable/IAR/ARM_CM3/portmacro.h"
00203 #endif
00204 
00205 #ifdef HCS12_CODE_WARRIOR
00206     #include "../../Source/portable/CodeWarrior/HCS12/portmacro.h"
00207 #endif
00208 
00209 #ifdef MICROBLAZE_GCC
00210     #include "../../Source/portable/GCC/MicroBlaze/portmacro.h"
00211 #endif
00212 
00213 #ifdef TERN_EE
00214     #include "..\..\Source\portable\Paradigm\Tern_EE\small\portmacro.h"
00215 #endif
00216 
00217 #ifdef GCC_HCS12
00218     #include "../../Source/portable/GCC/HCS12/portmacro.h"
00219 #endif
00220 
00221 #ifdef GCC_MCF5235
00222     #include "../../Source/portable/GCC/MCF5235/portmacro.h"
00223 #endif
00224 
00225 #ifdef COLDFIRE_V2_GCC
00226     #include "../../../Source/portable/GCC/ColdFire_V2/portmacro.h"
00227 #endif
00228 
00229 #ifdef COLDFIRE_V2_CODEWARRIOR
00230     #include "../../Source/portable/CodeWarrior/ColdFire_V2/portmacro.h"
00231 #endif
00232 
00233 #ifdef GCC_PPC405
00234     #include "../../Source/portable/GCC/PPC405_Xilinx/portmacro.h"
00235 #endif
00236 
00237 #ifdef GCC_PPC440
00238     #include "../../Source/portable/GCC/PPC440_Xilinx/portmacro.h"
00239 #endif
00240 
00241 #ifdef _16FX_SOFTUNE
00242     #include "..\..\Source\portable\Softune\MB96340\portmacro.h"
00243 #endif
00244 
00245 #ifdef BCC_INDUSTRIAL_PC_PORT
00246     /* A short file name has to be used in place of the normal
00247     FreeRTOSConfig.h when using the Borland compiler. */
00248     #include "frconfig.h"
00249     #include "..\portable\BCC\16BitDOS\PC\prtmacro.h"
00250     typedef void ( __interrupt __far *pxISR )();
00251 #endif
00252 
00253 #ifdef BCC_FLASH_LITE_186_PORT
00254     /* A short file name has to be used in place of the normal
00255     FreeRTOSConfig.h when using the Borland compiler. */
00256     #include "frconfig.h"
00257     #include "..\portable\BCC\16BitDOS\flsh186\prtmacro.h"
00258     typedef void ( __interrupt __far *pxISR )();
00259 #endif
00260 
00261 #ifdef __GNUC__
00262    #ifdef __AVR32_AVR32A__
00263        #include "portmacro.h"
00264    #endif
00265 #endif
00266 
00267 #ifdef __ICCAVR32__
00268    #ifdef __CORE__
00269       #if __CORE__ == __AVR32A__
00270           #include "portmacro.h"
00271       #endif
00272    #endif
00273 #endif
00274 
00275 #ifdef __91467D
00276     #include "portmacro.h"
00277 #endif
00278 
00279 #ifdef __96340
00280     #include "portmacro.h"
00281 #endif
00282 
00283 
00284 #ifdef __IAR_V850ES_Fx3__
00285     #include "../../Source/portable/IAR/V850ES/portmacro.h"
00286 #endif
00287 
00288 #ifdef __IAR_V850ES_Jx3__
00289     #include "../../Source/portable/IAR/V850ES/portmacro.h"
00290 #endif
00291 
00292 #ifdef __IAR_V850ES_Jx3_L__
00293     #include "../../Source/portable/IAR/V850ES/portmacro.h"
00294 #endif
00295 
00296 #ifdef __IAR_V850ES_Jx2__
00297     #include "../../Source/portable/IAR/V850ES/portmacro.h"
00298 #endif
00299 
00300 #ifdef __IAR_V850ES_Hx2__
00301     #include "../../Source/portable/IAR/V850ES/portmacro.h"
00302 #endif
00303 
00304 #ifdef __IAR_78K0R_Kx3__
00305     #include "../../Source/portable/IAR/78K0R/portmacro.h"
00306 #endif
00307 
00308 #ifdef __IAR_78K0R_Kx3L__
00309     #include "../../Source/portable/IAR/78K0R/portmacro.h"
00310 #endif
00311 
00312 /* Catch all to ensure portmacro.h is included in the build.  Newer demos
00313 have the path as part of the project options, rather than as relative from
00314 the project location.  If portENTER_CRITICAL() has not been defined then
00315 portmacro.h has not yet been included - as every portmacro.h provides a
00316 portENTER_CRITICAL() definition.  Check the demo application for your demo
00317 to find the path to the correct portmacro.h file. */
00318 #ifndef portENTER_CRITICAL
00319     #include "portmacro.h"
00320 #endif
00321 
00322 #if portBYTE_ALIGNMENT == 8
00323     #define portBYTE_ALIGNMENT_MASK ( 0x0007 )
00324 #endif
00325 
00326 #if portBYTE_ALIGNMENT == 4
00327     #define portBYTE_ALIGNMENT_MASK ( 0x0003 )
00328 #endif
00329 
00330 #if portBYTE_ALIGNMENT == 2
00331     #define portBYTE_ALIGNMENT_MASK ( 0x0001 )
00332 #endif
00333 
00334 #if portBYTE_ALIGNMENT == 1
00335     #define portBYTE_ALIGNMENT_MASK ( 0x0000 )
00336 #endif
00337 
00338 #ifndef portBYTE_ALIGNMENT_MASK
00339     #error "Invalid portBYTE_ALIGNMENT definition"
00340 #endif
00341 
00342 #ifndef portNUM_CONFIGURABLE_REGIONS
00343     #define portNUM_CONFIGURABLE_REGIONS 1
00344 #endif
00345 
00346 #ifdef __cplusplus
00347 extern "C" {
00348 #endif
00349 
00350 #include "mpu_wrappers.h"
00351 
00352 /*
00353  * Setup the stack of a new task so it is ready to be placed under the
00354  * scheduler control.  The registers have to be placed on the stack in
00355  * the order that the port expects to find them.
00356  *
00357  */
00358 #if( portUSING_MPU_WRAPPERS == 1 )
00359     portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters, portBASE_TYPE xRunPrivileged ) PRIVILEGED_FUNCTION;
00360 #else
00361     portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) PRIVILEGED_FUNCTION;
00362 #endif
00363 
00364 /*
00365  * Map to the memory management routines required for the port.
00366  */
00367 void *pvPortMalloc( size_t xSize ) PRIVILEGED_FUNCTION;
00368 void vPortFree( void *pv ) PRIVILEGED_FUNCTION;
00369 void vPortInitialiseBlocks( void ) PRIVILEGED_FUNCTION;
00370 size_t xPortGetFreeHeapSize( void ) PRIVILEGED_FUNCTION;
00371 
00372 /*
00373  * Setup the hardware ready for the scheduler to take control.  This generally
00374  * sets up a tick interrupt and sets timers for the correct tick frequency.
00375  */
00376 portBASE_TYPE xPortStartScheduler( void ) PRIVILEGED_FUNCTION;
00377 
00378 /*
00379  * Undo any hardware/ISR setup that was performed by xPortStartScheduler() so
00380  * the hardware is left in its original condition after the scheduler stops
00381  * executing.
00382  */
00383 void vPortEndScheduler( void ) PRIVILEGED_FUNCTION;
00384 
00385 /*
00386  * The structures and methods of manipulating the MPU are contained within the
00387  * port layer.
00388  *
00389  * Fills the xMPUSettings structure with the memory region information
00390  * contained in xRegions.
00391  */
00392 #if( portUSING_MPU_WRAPPERS == 1 )
00393     struct xMEMORY_REGION;
00394     void vPortStoreTaskMPUSettings( xMPU_SETTINGS *xMPUSettings, const struct xMEMORY_REGION * const xRegions, portSTACK_TYPE *pxBottomOfStack, unsigned short usStackDepth ) PRIVILEGED_FUNCTION;
00395 #endif
00396 
00397 #ifdef __cplusplus
00398 }
00399 #endif
00400 
00401 #endif /* PORTABLE_H */
00402