]> git.sur5r.net Git - freertos/blob - FreeRTOS/Source/include/portable.h
9af5eb27db00ce6981f23def6a3f0c7254aa62cd
[freertos] / FreeRTOS / Source / include / portable.h
1 /*\r
2     FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.\r
3     All rights reserved\r
4 \r
5     VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.\r
6 \r
7     ***************************************************************************\r
8      *                                                                       *\r
9      *    FreeRTOS provides completely free yet professionally developed,    *\r
10      *    robust, strictly quality controlled, supported, and cross          *\r
11      *    platform software that has become a de facto standard.             *\r
12      *                                                                       *\r
13      *    Help yourself get started quickly and support the FreeRTOS         *\r
14      *    project by purchasing a FreeRTOS tutorial book, reference          *\r
15      *    manual, or both from: http://www.FreeRTOS.org/Documentation        *\r
16      *                                                                       *\r
17      *    Thank you!                                                         *\r
18      *                                                                       *\r
19     ***************************************************************************\r
20 \r
21     This file is part of the FreeRTOS distribution.\r
22 \r
23     FreeRTOS is free software; you can redistribute it and/or modify it under\r
24     the terms of the GNU General Public License (version 2) as published by the\r
25     Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.\r
26 \r
27     >>! NOTE: The modification to the GPL is included to allow you to distribute\r
28     >>! a combined work that includes FreeRTOS without being obliged to provide\r
29     >>! the source code for proprietary components outside of the FreeRTOS\r
30     >>! kernel.\r
31 \r
32     FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY\r
33     WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\r
34     FOR A PARTICULAR PURPOSE.  Full license text is available from the following\r
35     link: http://www.freertos.org/a00114.html\r
36 \r
37     1 tab == 4 spaces!\r
38 \r
39     ***************************************************************************\r
40      *                                                                       *\r
41      *    Having a problem?  Start by reading the FAQ "My application does   *\r
42      *    not run, what could be wrong?"                                     *\r
43      *                                                                       *\r
44      *    http://www.FreeRTOS.org/FAQHelp.html                               *\r
45      *                                                                       *\r
46     ***************************************************************************\r
47 \r
48     http://www.FreeRTOS.org - Documentation, books, training, latest versions,\r
49     license and Real Time Engineers Ltd. contact details.\r
50 \r
51     http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,\r
52     including FreeRTOS+Trace - an indispensable productivity tool, a DOS\r
53     compatible FAT file system, and our tiny thread aware UDP/IP stack.\r
54 \r
55     http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High\r
56     Integrity Systems to sell under the OpenRTOS brand.  Low cost OpenRTOS\r
57     licenses offer ticketed support, indemnification and middleware.\r
58 \r
59     http://www.SafeRTOS.com - High Integrity Systems also provide a safety\r
60     engineered and independently SIL3 certified version for use in safety and\r
61     mission critical applications that require provable dependability.\r
62 \r
63     1 tab == 4 spaces!\r
64 */\r
65 \r
66 /*-----------------------------------------------------------\r
67  * Portable layer API.  Each function must be defined for each port.\r
68  *----------------------------------------------------------*/\r
69 \r
70 #ifndef PORTABLE_H\r
71 #define PORTABLE_H\r
72 \r
73 /* Include the macro file relevant to the port being used. */\r
74 \r
75 #ifdef OPEN_WATCOM_INDUSTRIAL_PC_PORT\r
76         #include "..\..\Source\portable\owatcom\16bitdos\pc\portmacro.h"\r
77         typedef void ( __interrupt __far *pxISR )();\r
78 #endif\r
79 \r
80 #ifdef OPEN_WATCOM_FLASH_LITE_186_PORT\r
81         #include "..\..\Source\portable\owatcom\16bitdos\flsh186\portmacro.h"\r
82         typedef void ( __interrupt __far *pxISR )();\r
83 #endif\r
84 \r
85 #ifdef GCC_MEGA_AVR\r
86         #include "../portable/GCC/ATMega323/portmacro.h"\r
87 #endif\r
88 \r
89 #ifdef IAR_MEGA_AVR\r
90         #include "../portable/IAR/ATMega323/portmacro.h"\r
91 #endif\r
92 \r
93 #ifdef MPLAB_PIC24_PORT\r
94         #include "../../Source/portable/MPLAB/PIC24_dsPIC/portmacro.h"\r
95 #endif\r
96 \r
97 #ifdef MPLAB_DSPIC_PORT\r
98         #include "../../Source/portable/MPLAB/PIC24_dsPIC/portmacro.h"\r
99 #endif\r
100 \r
101 #ifdef MPLAB_PIC18F_PORT\r
102         #include "../../Source/portable/MPLAB/PIC18F/portmacro.h"\r
103 #endif\r
104 \r
105 #ifdef MPLAB_PIC32MX_PORT\r
106         #include "../../Source/portable/MPLAB/PIC32MX/portmacro.h"\r
107 #endif\r
108 \r
109 #ifdef _FEDPICC\r
110         #include "libFreeRTOS/Include/portmacro.h"\r
111 #endif\r
112 \r
113 #ifdef SDCC_CYGNAL\r
114         #include "../../Source/portable/SDCC/Cygnal/portmacro.h"\r
115 #endif\r
116 \r
117 #ifdef GCC_ARM7\r
118         #include "../../Source/portable/GCC/ARM7_LPC2000/portmacro.h"\r
119 #endif\r
120 \r
121 #ifdef GCC_ARM7_ECLIPSE\r
122         #include "portmacro.h"\r
123 #endif\r
124 \r
125 #ifdef ROWLEY_LPC23xx\r
126         #include "../../Source/portable/GCC/ARM7_LPC23xx/portmacro.h"\r
127 #endif\r
128 \r
129 #ifdef IAR_MSP430\r
130         #include "..\..\Source\portable\IAR\MSP430\portmacro.h"\r
131 #endif\r
132 \r
133 #ifdef GCC_MSP430\r
134         #include "../../Source/portable/GCC/MSP430F449/portmacro.h"\r
135 #endif\r
136 \r
137 #ifdef ROWLEY_MSP430\r
138         #include "../../Source/portable/Rowley/MSP430F449/portmacro.h"\r
139 #endif\r
140 \r
141 #ifdef ARM7_LPC21xx_KEIL_RVDS\r
142         #include "..\..\Source\portable\RVDS\ARM7_LPC21xx\portmacro.h"\r
143 #endif\r
144 \r
145 #ifdef SAM7_GCC\r
146         #include "../../Source/portable/GCC/ARM7_AT91SAM7S/portmacro.h"\r
147 #endif\r
148 \r
149 #ifdef SAM7_IAR\r
150         #include "..\..\Source\portable\IAR\AtmelSAM7S64\portmacro.h"\r
151 #endif\r
152 \r
153 #ifdef SAM9XE_IAR\r
154         #include "..\..\Source\portable\IAR\AtmelSAM9XE\portmacro.h"\r
155 #endif\r
156 \r
157 #ifdef LPC2000_IAR\r
158         #include "..\..\Source\portable\IAR\LPC2000\portmacro.h"\r
159 #endif\r
160 \r
161 #ifdef STR71X_IAR\r
162         #include "..\..\Source\portable\IAR\STR71x\portmacro.h"\r
163 #endif\r
164 \r
165 #ifdef STR75X_IAR\r
166         #include "..\..\Source\portable\IAR\STR75x\portmacro.h"\r
167 #endif\r
168 \r
169 #ifdef STR75X_GCC\r
170         #include "..\..\Source\portable\GCC\STR75x\portmacro.h"\r
171 #endif\r
172 \r
173 #ifdef STR91X_IAR\r
174         #include "..\..\Source\portable\IAR\STR91x\portmacro.h"\r
175 #endif\r
176 \r
177 #ifdef GCC_H8S\r
178         #include "../../Source/portable/GCC/H8S2329/portmacro.h"\r
179 #endif\r
180 \r
181 #ifdef GCC_AT91FR40008\r
182         #include "../../Source/portable/GCC/ARM7_AT91FR40008/portmacro.h"\r
183 #endif\r
184 \r
185 #ifdef RVDS_ARMCM3_LM3S102\r
186         #include "../../Source/portable/RVDS/ARM_CM3/portmacro.h"\r
187 #endif\r
188 \r
189 #ifdef GCC_ARMCM3_LM3S102\r
190         #include "../../Source/portable/GCC/ARM_CM3/portmacro.h"\r
191 #endif\r
192 \r
193 #ifdef GCC_ARMCM3\r
194         #include "../../Source/portable/GCC/ARM_CM3/portmacro.h"\r
195 #endif\r
196 \r
197 #ifdef IAR_ARM_CM3\r
198         #include "../../Source/portable/IAR/ARM_CM3/portmacro.h"\r
199 #endif\r
200 \r
201 #ifdef IAR_ARMCM3_LM\r
202         #include "../../Source/portable/IAR/ARM_CM3/portmacro.h"\r
203 #endif\r
204 \r
205 #ifdef HCS12_CODE_WARRIOR\r
206         #include "../../Source/portable/CodeWarrior/HCS12/portmacro.h"\r
207 #endif\r
208 \r
209 #ifdef MICROBLAZE_GCC\r
210         #include "../../Source/portable/GCC/MicroBlaze/portmacro.h"\r
211 #endif\r
212 \r
213 #ifdef TERN_EE\r
214         #include "..\..\Source\portable\Paradigm\Tern_EE\small\portmacro.h"\r
215 #endif\r
216 \r
217 #ifdef GCC_HCS12\r
218         #include "../../Source/portable/GCC/HCS12/portmacro.h"\r
219 #endif\r
220 \r
221 #ifdef GCC_MCF5235\r
222     #include "../../Source/portable/GCC/MCF5235/portmacro.h"\r
223 #endif\r
224 \r
225 #ifdef COLDFIRE_V2_GCC\r
226         #include "../../../Source/portable/GCC/ColdFire_V2/portmacro.h"\r
227 #endif\r
228 \r
229 #ifdef COLDFIRE_V2_CODEWARRIOR\r
230         #include "../../Source/portable/CodeWarrior/ColdFire_V2/portmacro.h"\r
231 #endif\r
232 \r
233 #ifdef GCC_PPC405\r
234         #include "../../Source/portable/GCC/PPC405_Xilinx/portmacro.h"\r
235 #endif\r
236 \r
237 #ifdef GCC_PPC440\r
238         #include "../../Source/portable/GCC/PPC440_Xilinx/portmacro.h"\r
239 #endif\r
240 \r
241 #ifdef _16FX_SOFTUNE\r
242         #include "..\..\Source\portable\Softune\MB96340\portmacro.h"\r
243 #endif\r
244 \r
245 #ifdef BCC_INDUSTRIAL_PC_PORT\r
246         /* A short file name has to be used in place of the normal\r
247         FreeRTOSConfig.h when using the Borland compiler. */\r
248         #include "frconfig.h"\r
249         #include "..\portable\BCC\16BitDOS\PC\prtmacro.h"\r
250     typedef void ( __interrupt __far *pxISR )();\r
251 #endif\r
252 \r
253 #ifdef BCC_FLASH_LITE_186_PORT\r
254         /* A short file name has to be used in place of the normal\r
255         FreeRTOSConfig.h when using the Borland compiler. */\r
256         #include "frconfig.h"\r
257         #include "..\portable\BCC\16BitDOS\flsh186\prtmacro.h"\r
258     typedef void ( __interrupt __far *pxISR )();\r
259 #endif\r
260 \r
261 #ifdef __GNUC__\r
262    #ifdef __AVR32_AVR32A__\r
263            #include "portmacro.h"\r
264    #endif\r
265 #endif\r
266 \r
267 #ifdef __ICCAVR32__\r
268    #ifdef __CORE__\r
269       #if __CORE__ == __AVR32A__\r
270               #include "portmacro.h"\r
271       #endif\r
272    #endif\r
273 #endif\r
274 \r
275 #ifdef __91467D\r
276         #include "portmacro.h"\r
277 #endif\r
278 \r
279 #ifdef __96340\r
280         #include "portmacro.h"\r
281 #endif\r
282 \r
283 \r
284 #ifdef __IAR_V850ES_Fx3__\r
285         #include "../../Source/portable/IAR/V850ES/portmacro.h"\r
286 #endif\r
287 \r
288 #ifdef __IAR_V850ES_Jx3__\r
289         #include "../../Source/portable/IAR/V850ES/portmacro.h"\r
290 #endif\r
291 \r
292 #ifdef __IAR_V850ES_Jx3_L__\r
293         #include "../../Source/portable/IAR/V850ES/portmacro.h"\r
294 #endif\r
295 \r
296 #ifdef __IAR_V850ES_Jx2__\r
297         #include "../../Source/portable/IAR/V850ES/portmacro.h"\r
298 #endif\r
299 \r
300 #ifdef __IAR_V850ES_Hx2__\r
301         #include "../../Source/portable/IAR/V850ES/portmacro.h"\r
302 #endif\r
303 \r
304 #ifdef __IAR_78K0R_Kx3__\r
305         #include "../../Source/portable/IAR/78K0R/portmacro.h"\r
306 #endif\r
307 \r
308 #ifdef __IAR_78K0R_Kx3L__\r
309         #include "../../Source/portable/IAR/78K0R/portmacro.h"\r
310 #endif\r
311 \r
312 /* Catch all to ensure portmacro.h is included in the build.  Newer demos\r
313 have the path as part of the project options, rather than as relative from\r
314 the project location.  If portENTER_CRITICAL() has not been defined then\r
315 portmacro.h has not yet been included - as every portmacro.h provides a\r
316 portENTER_CRITICAL() definition.  Check the demo application for your demo\r
317 to find the path to the correct portmacro.h file. */\r
318 #ifndef portENTER_CRITICAL\r
319         #include "portmacro.h"\r
320 #endif\r
321 \r
322 #if portBYTE_ALIGNMENT == 8\r
323         #define portBYTE_ALIGNMENT_MASK ( 0x0007 )\r
324 #endif\r
325 \r
326 #if portBYTE_ALIGNMENT == 4\r
327         #define portBYTE_ALIGNMENT_MASK ( 0x0003 )\r
328 #endif\r
329 \r
330 #if portBYTE_ALIGNMENT == 2\r
331         #define portBYTE_ALIGNMENT_MASK ( 0x0001 )\r
332 #endif\r
333 \r
334 #if portBYTE_ALIGNMENT == 1\r
335         #define portBYTE_ALIGNMENT_MASK ( 0x0000 )\r
336 #endif\r
337 \r
338 #ifndef portBYTE_ALIGNMENT_MASK\r
339         #error "Invalid portBYTE_ALIGNMENT definition"\r
340 #endif\r
341 \r
342 #ifndef portNUM_CONFIGURABLE_REGIONS\r
343         #define portNUM_CONFIGURABLE_REGIONS 1\r
344 #endif\r
345 \r
346 #ifdef __cplusplus\r
347 extern "C" {\r
348 #endif\r
349 \r
350 #include "mpu_wrappers.h"\r
351 \r
352 /*\r
353  * Setup the stack of a new task so it is ready to be placed under the\r
354  * scheduler control.  The registers have to be placed on the stack in\r
355  * the order that the port expects to find them.\r
356  *\r
357  */\r
358 #if( portUSING_MPU_WRAPPERS == 1 )\r
359         portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters, portBASE_TYPE xRunPrivileged ) PRIVILEGED_FUNCTION;\r
360 #else\r
361         portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) PRIVILEGED_FUNCTION;\r
362 #endif\r
363 \r
364 /*\r
365  * Map to the memory management routines required for the port.\r
366  */\r
367 void *pvPortMalloc( size_t xSize ) PRIVILEGED_FUNCTION;\r
368 void vPortFree( void *pv ) PRIVILEGED_FUNCTION;\r
369 void vPortInitialiseBlocks( void ) PRIVILEGED_FUNCTION;\r
370 size_t xPortGetFreeHeapSize( void ) PRIVILEGED_FUNCTION;\r
371 size_t xPortGetMinimumEverFreeHeapSize( void ) PRIVILEGED_FUNCTION;\r
372 \r
373 /*\r
374  * Setup the hardware ready for the scheduler to take control.  This generally\r
375  * sets up a tick interrupt and sets timers for the correct tick frequency.\r
376  */\r
377 portBASE_TYPE xPortStartScheduler( void ) PRIVILEGED_FUNCTION;\r
378 \r
379 /*\r
380  * Undo any hardware/ISR setup that was performed by xPortStartScheduler() so\r
381  * the hardware is left in its original condition after the scheduler stops\r
382  * executing.\r
383  */\r
384 void vPortEndScheduler( void ) PRIVILEGED_FUNCTION;\r
385 \r
386 /*\r
387  * The structures and methods of manipulating the MPU are contained within the\r
388  * port layer.\r
389  *\r
390  * Fills the xMPUSettings structure with the memory region information\r
391  * contained in xRegions.\r
392  */\r
393 #if( portUSING_MPU_WRAPPERS == 1 )\r
394         struct xMEMORY_REGION;\r
395         void vPortStoreTaskMPUSettings( xMPU_SETTINGS *xMPUSettings, const struct xMEMORY_REGION * const xRegions, portSTACK_TYPE *pxBottomOfStack, unsigned short usStackDepth ) PRIVILEGED_FUNCTION;\r
396 #endif\r
397 \r
398 #ifdef __cplusplus\r
399 }\r
400 #endif\r
401 \r
402 #endif /* PORTABLE_H */\r
403 \r