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