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