]> git.sur5r.net Git - freertos/blob - FreeRTOS/Source/include/portable.h
Update version number to 8.1.2 after moving the defaulting of configUSE_PORT_OPTIMISE...
[freertos] / FreeRTOS / Source / include / portable.h
1 /*\r
2     FreeRTOS V8.1.2 - Copyright (C) 2014 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     !<<\r
28     >>!   distribute a combined work that includes FreeRTOS without being   !<<\r
29     >>!   obliged to provide the source code for proprietary components     !<<\r
30     >>!   outside of the FreeRTOS 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 NOTE:  The following definitions are *DEPRECATED* as it is preferred to instead\r
75 just add the path to the correct portmacro.h header file to the compiler's\r
76 include path. */\r
77 #ifdef OPEN_WATCOM_INDUSTRIAL_PC_PORT\r
78         #include "..\..\Source\portable\owatcom\16bitdos\pc\portmacro.h"\r
79         typedef void ( __interrupt __far *pxISR )();\r
80 #endif\r
81 \r
82 #ifdef OPEN_WATCOM_FLASH_LITE_186_PORT\r
83         #include "..\..\Source\portable\owatcom\16bitdos\flsh186\portmacro.h"\r
84         typedef void ( __interrupt __far *pxISR )();\r
85 #endif\r
86 \r
87 #ifdef GCC_MEGA_AVR\r
88         #include "../portable/GCC/ATMega323/portmacro.h"\r
89 #endif\r
90 \r
91 #ifdef IAR_MEGA_AVR\r
92         #include "../portable/IAR/ATMega323/portmacro.h"\r
93 #endif\r
94 \r
95 #ifdef MPLAB_PIC24_PORT\r
96         #include "../../Source/portable/MPLAB/PIC24_dsPIC/portmacro.h"\r
97 #endif\r
98 \r
99 #ifdef MPLAB_DSPIC_PORT\r
100         #include "../../Source/portable/MPLAB/PIC24_dsPIC/portmacro.h"\r
101 #endif\r
102 \r
103 #ifdef MPLAB_PIC18F_PORT\r
104         #include "../../Source/portable/MPLAB/PIC18F/portmacro.h"\r
105 #endif\r
106 \r
107 #ifdef MPLAB_PIC32MX_PORT\r
108         #include "../../Source/portable/MPLAB/PIC32MX/portmacro.h"\r
109 #endif\r
110 \r
111 #ifdef _FEDPICC\r
112         #include "libFreeRTOS/Include/portmacro.h"\r
113 #endif\r
114 \r
115 #ifdef SDCC_CYGNAL\r
116         #include "../../Source/portable/SDCC/Cygnal/portmacro.h"\r
117 #endif\r
118 \r
119 #ifdef GCC_ARM7\r
120         #include "../../Source/portable/GCC/ARM7_LPC2000/portmacro.h"\r
121 #endif\r
122 \r
123 #ifdef GCC_ARM7_ECLIPSE\r
124         #include "portmacro.h"\r
125 #endif\r
126 \r
127 #ifdef ROWLEY_LPC23xx\r
128         #include "../../Source/portable/GCC/ARM7_LPC23xx/portmacro.h"\r
129 #endif\r
130 \r
131 #ifdef IAR_MSP430\r
132         #include "..\..\Source\portable\IAR\MSP430\portmacro.h"\r
133 #endif\r
134 \r
135 #ifdef GCC_MSP430\r
136         #include "../../Source/portable/GCC/MSP430F449/portmacro.h"\r
137 #endif\r
138 \r
139 #ifdef ROWLEY_MSP430\r
140         #include "../../Source/portable/Rowley/MSP430F449/portmacro.h"\r
141 #endif\r
142 \r
143 #ifdef ARM7_LPC21xx_KEIL_RVDS\r
144         #include "..\..\Source\portable\RVDS\ARM7_LPC21xx\portmacro.h"\r
145 #endif\r
146 \r
147 #ifdef SAM7_GCC\r
148         #include "../../Source/portable/GCC/ARM7_AT91SAM7S/portmacro.h"\r
149 #endif\r
150 \r
151 #ifdef SAM7_IAR\r
152         #include "..\..\Source\portable\IAR\AtmelSAM7S64\portmacro.h"\r
153 #endif\r
154 \r
155 #ifdef SAM9XE_IAR\r
156         #include "..\..\Source\portable\IAR\AtmelSAM9XE\portmacro.h"\r
157 #endif\r
158 \r
159 #ifdef LPC2000_IAR\r
160         #include "..\..\Source\portable\IAR\LPC2000\portmacro.h"\r
161 #endif\r
162 \r
163 #ifdef STR71X_IAR\r
164         #include "..\..\Source\portable\IAR\STR71x\portmacro.h"\r
165 #endif\r
166 \r
167 #ifdef STR75X_IAR\r
168         #include "..\..\Source\portable\IAR\STR75x\portmacro.h"\r
169 #endif\r
170 \r
171 #ifdef STR75X_GCC\r
172         #include "..\..\Source\portable\GCC\STR75x\portmacro.h"\r
173 #endif\r
174 \r
175 #ifdef STR91X_IAR\r
176         #include "..\..\Source\portable\IAR\STR91x\portmacro.h"\r
177 #endif\r
178 \r
179 #ifdef GCC_H8S\r
180         #include "../../Source/portable/GCC/H8S2329/portmacro.h"\r
181 #endif\r
182 \r
183 #ifdef GCC_AT91FR40008\r
184         #include "../../Source/portable/GCC/ARM7_AT91FR40008/portmacro.h"\r
185 #endif\r
186 \r
187 #ifdef RVDS_ARMCM3_LM3S102\r
188         #include "../../Source/portable/RVDS/ARM_CM3/portmacro.h"\r
189 #endif\r
190 \r
191 #ifdef GCC_ARMCM3_LM3S102\r
192         #include "../../Source/portable/GCC/ARM_CM3/portmacro.h"\r
193 #endif\r
194 \r
195 #ifdef GCC_ARMCM3\r
196         #include "../../Source/portable/GCC/ARM_CM3/portmacro.h"\r
197 #endif\r
198 \r
199 #ifdef IAR_ARM_CM3\r
200         #include "../../Source/portable/IAR/ARM_CM3/portmacro.h"\r
201 #endif\r
202 \r
203 #ifdef IAR_ARMCM3_LM\r
204         #include "../../Source/portable/IAR/ARM_CM3/portmacro.h"\r
205 #endif\r
206 \r
207 #ifdef HCS12_CODE_WARRIOR\r
208         #include "../../Source/portable/CodeWarrior/HCS12/portmacro.h"\r
209 #endif\r
210 \r
211 #ifdef MICROBLAZE_GCC\r
212         #include "../../Source/portable/GCC/MicroBlaze/portmacro.h"\r
213 #endif\r
214 \r
215 #ifdef TERN_EE\r
216         #include "..\..\Source\portable\Paradigm\Tern_EE\small\portmacro.h"\r
217 #endif\r
218 \r
219 #ifdef GCC_HCS12\r
220         #include "../../Source/portable/GCC/HCS12/portmacro.h"\r
221 #endif\r
222 \r
223 #ifdef GCC_MCF5235\r
224     #include "../../Source/portable/GCC/MCF5235/portmacro.h"\r
225 #endif\r
226 \r
227 #ifdef COLDFIRE_V2_GCC\r
228         #include "../../../Source/portable/GCC/ColdFire_V2/portmacro.h"\r
229 #endif\r
230 \r
231 #ifdef COLDFIRE_V2_CODEWARRIOR\r
232         #include "../../Source/portable/CodeWarrior/ColdFire_V2/portmacro.h"\r
233 #endif\r
234 \r
235 #ifdef GCC_PPC405\r
236         #include "../../Source/portable/GCC/PPC405_Xilinx/portmacro.h"\r
237 #endif\r
238 \r
239 #ifdef GCC_PPC440\r
240         #include "../../Source/portable/GCC/PPC440_Xilinx/portmacro.h"\r
241 #endif\r
242 \r
243 #ifdef _16FX_SOFTUNE\r
244         #include "..\..\Source\portable\Softune\MB96340\portmacro.h"\r
245 #endif\r
246 \r
247 #ifdef BCC_INDUSTRIAL_PC_PORT\r
248         /* A short file name has to be used in place of the normal\r
249         FreeRTOSConfig.h when using the Borland compiler. */\r
250         #include "frconfig.h"\r
251         #include "..\portable\BCC\16BitDOS\PC\prtmacro.h"\r
252     typedef void ( __interrupt __far *pxISR )();\r
253 #endif\r
254 \r
255 #ifdef BCC_FLASH_LITE_186_PORT\r
256         /* A short file name has to be used in place of the normal\r
257         FreeRTOSConfig.h when using the Borland compiler. */\r
258         #include "frconfig.h"\r
259         #include "..\portable\BCC\16BitDOS\flsh186\prtmacro.h"\r
260     typedef void ( __interrupt __far *pxISR )();\r
261 #endif\r
262 \r
263 #ifdef __GNUC__\r
264    #ifdef __AVR32_AVR32A__\r
265            #include "portmacro.h"\r
266    #endif\r
267 #endif\r
268 \r
269 #ifdef __ICCAVR32__\r
270    #ifdef __CORE__\r
271       #if __CORE__ == __AVR32A__\r
272               #include "portmacro.h"\r
273       #endif\r
274    #endif\r
275 #endif\r
276 \r
277 #ifdef __91467D\r
278         #include "portmacro.h"\r
279 #endif\r
280 \r
281 #ifdef __96340\r
282         #include "portmacro.h"\r
283 #endif\r
284 \r
285 \r
286 #ifdef __IAR_V850ES_Fx3__\r
287         #include "../../Source/portable/IAR/V850ES/portmacro.h"\r
288 #endif\r
289 \r
290 #ifdef __IAR_V850ES_Jx3__\r
291         #include "../../Source/portable/IAR/V850ES/portmacro.h"\r
292 #endif\r
293 \r
294 #ifdef __IAR_V850ES_Jx3_L__\r
295         #include "../../Source/portable/IAR/V850ES/portmacro.h"\r
296 #endif\r
297 \r
298 #ifdef __IAR_V850ES_Jx2__\r
299         #include "../../Source/portable/IAR/V850ES/portmacro.h"\r
300 #endif\r
301 \r
302 #ifdef __IAR_V850ES_Hx2__\r
303         #include "../../Source/portable/IAR/V850ES/portmacro.h"\r
304 #endif\r
305 \r
306 #ifdef __IAR_78K0R_Kx3__\r
307         #include "../../Source/portable/IAR/78K0R/portmacro.h"\r
308 #endif\r
309 \r
310 #ifdef __IAR_78K0R_Kx3L__\r
311         #include "../../Source/portable/IAR/78K0R/portmacro.h"\r
312 #endif\r
313 \r
314 /* Catch all to ensure portmacro.h is included in the build.  Newer demos\r
315 have the path as part of the project options, rather than as relative from\r
316 the project location.  If portENTER_CRITICAL() has not been defined then\r
317 portmacro.h has not yet been included - as every portmacro.h provides a\r
318 portENTER_CRITICAL() definition.  Check the demo application for your demo\r
319 to find the path to the correct portmacro.h file. */\r
320 #ifndef portENTER_CRITICAL\r
321         #include "portmacro.h"\r
322 #endif\r
323 \r
324 #if portBYTE_ALIGNMENT == 8\r
325         #define portBYTE_ALIGNMENT_MASK ( 0x0007U )\r
326 #endif\r
327 \r
328 #if portBYTE_ALIGNMENT == 4\r
329         #define portBYTE_ALIGNMENT_MASK ( 0x0003 )\r
330 #endif\r
331 \r
332 #if portBYTE_ALIGNMENT == 2\r
333         #define portBYTE_ALIGNMENT_MASK ( 0x0001 )\r
334 #endif\r
335 \r
336 #if portBYTE_ALIGNMENT == 1\r
337         #define portBYTE_ALIGNMENT_MASK ( 0x0000 )\r
338 #endif\r
339 \r
340 #ifndef portBYTE_ALIGNMENT_MASK\r
341         #error "Invalid portBYTE_ALIGNMENT definition"\r
342 #endif\r
343 \r
344 #ifndef portNUM_CONFIGURABLE_REGIONS\r
345         #define portNUM_CONFIGURABLE_REGIONS 1\r
346 #endif\r
347 \r
348 #ifdef __cplusplus\r
349 extern "C" {\r
350 #endif\r
351 \r
352 #include "mpu_wrappers.h"\r
353 \r
354 /*\r
355  * Setup the stack of a new task so it is ready to be placed under the\r
356  * scheduler control.  The registers have to be placed on the stack in\r
357  * the order that the port expects to find them.\r
358  *\r
359  */\r
360 #if( portUSING_MPU_WRAPPERS == 1 )\r
361         StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, TaskFunction_t pxCode, void *pvParameters, BaseType_t xRunPrivileged ) PRIVILEGED_FUNCTION;\r
362 #else\r
363         StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, TaskFunction_t pxCode, void *pvParameters ) PRIVILEGED_FUNCTION;\r
364 #endif\r
365 \r
366 /* Used by heap_5.c. */\r
367 typedef struct HeapRegion\r
368 {\r
369         uint8_t *pucStartAddress;\r
370         size_t xSizeInBytes;\r
371 } HeapRegion_t;\r
372 \r
373 /* \r
374  * Used to define multiple heap regions for use by heap_5.c.  This function\r
375  * must be called before any calls to pvPortMalloc() - not creating a task,\r
376  * queue, semaphore, mutex, software timer, event group, etc. will result in\r
377  * pvPortMalloc being called.\r
378  *\r
379  * pxHeapRegions passes in an array of HeapRegion_t structures - each of which\r
380  * defines a region of memory that can be used as the heap.  The array is \r
381  * terminated by a HeapRegions_t structure that has a size of 0.  The region \r
382  * with the lowest start address must appear first in the array.\r
383  */\r
384 void vPortDefineHeapRegions( const HeapRegion_t * const pxHeapRegions );\r
385 \r
386 \r
387 /*\r
388  * Map to the memory management routines required for the port.\r
389  */\r
390 void *pvPortMalloc( size_t xSize ) PRIVILEGED_FUNCTION;\r
391 void vPortFree( void *pv ) PRIVILEGED_FUNCTION;\r
392 void vPortInitialiseBlocks( void ) PRIVILEGED_FUNCTION;\r
393 size_t xPortGetFreeHeapSize( void ) PRIVILEGED_FUNCTION;\r
394 size_t xPortGetMinimumEverFreeHeapSize( void ) PRIVILEGED_FUNCTION;\r
395 \r
396 /*\r
397  * Setup the hardware ready for the scheduler to take control.  This generally\r
398  * sets up a tick interrupt and sets timers for the correct tick frequency.\r
399  */\r
400 BaseType_t xPortStartScheduler( void ) PRIVILEGED_FUNCTION;\r
401 \r
402 /*\r
403  * Undo any hardware/ISR setup that was performed by xPortStartScheduler() so\r
404  * the hardware is left in its original condition after the scheduler stops\r
405  * executing.\r
406  */\r
407 void vPortEndScheduler( void ) PRIVILEGED_FUNCTION;\r
408 \r
409 /*\r
410  * The structures and methods of manipulating the MPU are contained within the\r
411  * port layer.\r
412  *\r
413  * Fills the xMPUSettings structure with the memory region information\r
414  * contained in xRegions.\r
415  */\r
416 #if( portUSING_MPU_WRAPPERS == 1 )\r
417         struct xMEMORY_REGION;\r
418         void vPortStoreTaskMPUSettings( xMPU_SETTINGS *xMPUSettings, const struct xMEMORY_REGION * const xRegions, StackType_t *pxBottomOfStack, uint16_t usStackDepth ) PRIVILEGED_FUNCTION;\r
419 #endif\r
420 \r
421 #ifdef __cplusplus\r
422 }\r
423 #endif\r
424 \r
425 #endif /* PORTABLE_H */\r
426 \r