FreeRTOS Real Time Operating System, Modified from Kenji Arai's initial port. See freertos.org for full documentation.

Fork of FreeRTOS_on_mbed_v1 by Kenji Arai

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers portable.h Source File

portable.h

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