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
Main Page
Related Pages
Modules
Classes
Files
File List
File Members
All
Classes
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Modules
StackMacros.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
#ifndef STACK_MACROS_H
67
#define STACK_MACROS_H
68
69
/*
70
* Call the stack overflow hook function if the stack of the task being swapped
71
* out is currently overflowed, or looks like it might have overflowed in the
72
* past.
73
*
74
* Setting configCHECK_FOR_STACK_OVERFLOW to 1 will cause the macro to check
75
* the current stack state only - comparing the current top of stack value to
76
* the stack limit. Setting configCHECK_FOR_STACK_OVERFLOW to greater than 1
77
* will also cause the last few stack bytes to be checked to ensure the value
78
* to which the bytes were set when the task was created have not been
79
* overwritten. Note this second test does not guarantee that an overflowed
80
* stack will always be recognised.
81
*/
82
83
/*-----------------------------------------------------------*/
84
85
#if( configCHECK_FOR_STACK_OVERFLOW == 0 )
86
87
/* FreeRTOSConfig.h is not set to check for stack overflows. */
88
#define taskFIRST_CHECK_FOR_STACK_OVERFLOW()
89
#define taskSECOND_CHECK_FOR_STACK_OVERFLOW()
90
91
#endif
/* configCHECK_FOR_STACK_OVERFLOW == 0 */
92
/*-----------------------------------------------------------*/
93
94
#if( configCHECK_FOR_STACK_OVERFLOW == 1 )
95
96
/* FreeRTOSConfig.h is only set to use the first method of
97
overflow checking. */
98
#define taskSECOND_CHECK_FOR_STACK_OVERFLOW()
99
100
#endif
101
/*-----------------------------------------------------------*/
102
103
#if( ( configCHECK_FOR_STACK_OVERFLOW > 0 ) && ( portSTACK_GROWTH < 0 ) )
104
105
/* Only the current stack state is to be checked. */
106
#define taskFIRST_CHECK_FOR_STACK_OVERFLOW() \
107
{ \
108
/* Is the currently saved stack pointer within the stack limit? */
\
109
if( pxCurrentTCB->pxTopOfStack <= pxCurrentTCB->pxStack ) \
110
{ \
111
vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pxCurrentTCB->pcTaskName ); \
112
} \
113
}
114
115
#endif
/* configCHECK_FOR_STACK_OVERFLOW > 0 */
116
/*-----------------------------------------------------------*/
117
118
#if( ( configCHECK_FOR_STACK_OVERFLOW > 0 ) && ( portSTACK_GROWTH > 0 ) )
119
120
/* Only the current stack state is to be checked. */
121
#define taskFIRST_CHECK_FOR_STACK_OVERFLOW() \
122
{ \
123
\
124
/* Is the currently saved stack pointer within the stack limit? */
\
125
if( pxCurrentTCB->pxTopOfStack >= pxCurrentTCB->pxEndOfStack ) \
126
{ \
127
vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pxCurrentTCB->pcTaskName ); \
128
} \
129
}
130
131
#endif
/* configCHECK_FOR_STACK_OVERFLOW == 1 */
132
/*-----------------------------------------------------------*/
133
134
#if( ( configCHECK_FOR_STACK_OVERFLOW > 1 ) && ( portSTACK_GROWTH < 0 ) )
135
136
#define taskSECOND_CHECK_FOR_STACK_OVERFLOW() \
137
{ \
138
static const uint8_t ucExpectedStackBytes[] = { tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \
139
tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \
140
tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \
141
tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \
142
tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE }; \
143
\
144
\
145
/* Has the extremity of the task stack ever been written over? */
\
146
if( memcmp( ( void * ) pxCurrentTCB->pxStack, ( void * ) ucExpectedStackBytes, sizeof( ucExpectedStackBytes ) ) != 0 ) \
147
{ \
148
vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pxCurrentTCB->pcTaskName ); \
149
} \
150
}
151
152
#endif
/* #if( configCHECK_FOR_STACK_OVERFLOW > 1 ) */
153
/*-----------------------------------------------------------*/
154
155
#if( ( configCHECK_FOR_STACK_OVERFLOW > 1 ) && ( portSTACK_GROWTH > 0 ) )
156
157
#define taskSECOND_CHECK_FOR_STACK_OVERFLOW() \
158
{ \
159
int8_t *pcEndOfStack = ( int8_t * ) pxCurrentTCB->pxEndOfStack; \
160
static const uint8_t ucExpectedStackBytes[] = { tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \
161
tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \
162
tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \
163
tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \
164
tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE }; \
165
\
166
\
167
pcEndOfStack -= sizeof( ucExpectedStackBytes ); \
168
\
169
/* Has the extremity of the task stack ever been written over? */
\
170
if( memcmp( ( void * ) pcEndOfStack, ( void * ) ucExpectedStackBytes, sizeof( ucExpectedStackBytes ) ) != 0 ) \
171
{ \
172
vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pxCurrentTCB->pcTaskName ); \
173
} \
174
}
175
176
#endif
/* #if( configCHECK_FOR_STACK_OVERFLOW > 1 ) */
177
/*-----------------------------------------------------------*/
178
179
#endif
/* STACK_MACROS_H */
180
cmsis
src
freertos
freertos-v8.0.1
source
include
StackMacros.h
Generated on Thu Oct 16 2014 15:19:16 for SAM4S-EK_FreeRTOS+FAT-SL by
1.8.8