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