1 |
/* |
---|
2 |
FreeRTOS V5.4.1 - Copyright (C) 2009 Real Time Engineers Ltd. |
---|
3 |
|
---|
4 |
This file is part of the FreeRTOS distribution. |
---|
5 |
|
---|
6 |
FreeRTOS is free software; you can redistribute it and/or modify it under |
---|
7 |
the terms of the GNU General Public License (version 2) as published by the |
---|
8 |
Free Software Foundation and modified by the FreeRTOS exception. |
---|
9 |
**NOTE** The exception to the GPL is included to allow you to distribute a |
---|
10 |
combined work that includes FreeRTOS without being obliged to provide the |
---|
11 |
source code for proprietary components outside of the FreeRTOS kernel. |
---|
12 |
Alternative commercial license and support terms are also available upon |
---|
13 |
request. See the licensing section of http://www.FreeRTOS.org for full |
---|
14 |
license details. |
---|
15 |
|
---|
16 |
FreeRTOS is distributed in the hope that it will be useful, but WITHOUT |
---|
17 |
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
---|
18 |
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
---|
19 |
more details. |
---|
20 |
|
---|
21 |
You should have received a copy of the GNU General Public License along |
---|
22 |
with FreeRTOS; if not, write to the Free Software Foundation, Inc., 59 |
---|
23 |
Temple Place, Suite 330, Boston, MA 02111-1307 USA. |
---|
24 |
|
---|
25 |
|
---|
26 |
*************************************************************************** |
---|
27 |
* * |
---|
28 |
* Looking for a quick start? Then check out the FreeRTOS eBook! * |
---|
29 |
* See http://www.FreeRTOS.org/Documentation for details * |
---|
30 |
* * |
---|
31 |
*************************************************************************** |
---|
32 |
|
---|
33 |
1 tab == 4 spaces! |
---|
34 |
|
---|
35 |
Please ensure to read the configuration and relevant port sections of the |
---|
36 |
online documentation. |
---|
37 |
|
---|
38 |
http://www.FreeRTOS.org - Documentation, latest information, license and |
---|
39 |
contact details. |
---|
40 |
|
---|
41 |
http://www.SafeRTOS.com - A version that is certified for use in safety |
---|
42 |
critical systems. |
---|
43 |
|
---|
44 |
http://www.OpenRTOS.com - Commercial support, development, porting, |
---|
45 |
licensing and training services. |
---|
46 |
*/ |
---|
47 |
|
---|
48 |
#ifndef PORTMACRO_H |
---|
49 |
#define PORTMACRO_H |
---|
50 |
|
---|
51 |
/*----------------------------------------------------------- |
---|
52 |
* Port specific definitions. |
---|
53 |
* |
---|
54 |
* The settings in this file configure FreeRTOS correctly for the |
---|
55 |
* given hardware and compiler. |
---|
56 |
* |
---|
57 |
* These settings should not be altered. |
---|
58 |
*----------------------------------------------------------- |
---|
59 |
*/ |
---|
60 |
|
---|
61 |
/* Type definitions. */ |
---|
62 |
#define portCHAR char |
---|
63 |
#define portFLOAT float |
---|
64 |
#define portDOUBLE double |
---|
65 |
#define portLONG long |
---|
66 |
#define portSHORT int |
---|
67 |
#define portSTACK_TYPE unsigned portSHORT |
---|
68 |
#define portBASE_TYPE portSHORT |
---|
69 |
|
---|
70 |
#if( configUSE_16_BIT_TICKS == 1 ) |
---|
71 |
typedef unsigned portSHORT portTickType; |
---|
72 |
#define portMAX_DELAY ( portTickType ) 0xffff |
---|
73 |
#else |
---|
74 |
typedef unsigned portLONG portTickType; |
---|
75 |
#define portMAX_DELAY ( portTickType ) 0xffffffff |
---|
76 |
#endif |
---|
77 |
|
---|
78 |
/*-----------------------------------------------------------*/ |
---|
79 |
|
---|
80 |
/* Interrupt control macros. */ |
---|
81 |
#define portDISABLE_INTERRUPTS() _DINT(); |
---|
82 |
#define portENABLE_INTERRUPTS() _EINT(); |
---|
83 |
/*-----------------------------------------------------------*/ |
---|
84 |
|
---|
85 |
/* Critical section control macros. */ |
---|
86 |
#define portNO_CRITICAL_SECTION_NESTING ( ( unsigned portSHORT ) 0 ) |
---|
87 |
|
---|
88 |
#define portENTER_CRITICAL() \ |
---|
89 |
{ \ |
---|
90 |
extern volatile unsigned portSHORT usCriticalNesting; \ |
---|
91 |
\ |
---|
92 |
portDISABLE_INTERRUPTS(); \ |
---|
93 |
\ |
---|
94 |
/* Now interrupts are disabled usCriticalNesting can be accessed */ \ |
---|
95 |
/* directly. Increment ulCriticalNesting to keep a count of how many */ \ |
---|
96 |
/* times portENTER_CRITICAL() has been called. */ \ |
---|
97 |
usCriticalNesting++; \ |
---|
98 |
} |
---|
99 |
|
---|
100 |
#define portEXIT_CRITICAL() \ |
---|
101 |
{ \ |
---|
102 |
extern volatile unsigned portSHORT usCriticalNesting; \ |
---|
103 |
\ |
---|
104 |
if( usCriticalNesting > portNO_CRITICAL_SECTION_NESTING ) \ |
---|
105 |
{ \ |
---|
106 |
/* Decrement the nesting count as we are leaving a critical section. */ \ |
---|
107 |
usCriticalNesting--; \ |
---|
108 |
\ |
---|
109 |
/* If the nesting level has reached zero then interrupts should be */ \ |
---|
110 |
/* re-enabled. */ \ |
---|
111 |
if( usCriticalNesting == portNO_CRITICAL_SECTION_NESTING ) \ |
---|
112 |
{ \ |
---|
113 |
portENABLE_INTERRUPTS(); \ |
---|
114 |
} \ |
---|
115 |
} \ |
---|
116 |
} |
---|
117 |
/*-----------------------------------------------------------*/ |
---|
118 |
|
---|
119 |
/* Task utilities. */ |
---|
120 |
|
---|
121 |
/* |
---|
122 |
* Manual context switch called by portYIELD or taskYIELD. |
---|
123 |
*/ |
---|
124 |
extern void vPortYield( void ); |
---|
125 |
#define portYIELD() vPortYield() |
---|
126 |
/*-----------------------------------------------------------*/ |
---|
127 |
|
---|
128 |
/* Hardware specifics. */ |
---|
129 |
#define portBYTE_ALIGNMENT 2 |
---|
130 |
#define portSTACK_GROWTH ( -1 ) |
---|
131 |
#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ ) |
---|
132 |
#define portNOP() |
---|
133 |
/*-----------------------------------------------------------*/ |
---|
134 |
|
---|
135 |
/* Task function macros as described on the FreeRTOS.org WEB site. */ |
---|
136 |
#define portTASK_FUNCTION_PROTO( vFunction, pvParameters ) void vFunction( void *pvParameters ) |
---|
137 |
#define portTASK_FUNCTION( vFunction, pvParameters ) void vFunction( void *pvParameters ) __toplevel |
---|
138 |
|
---|
139 |
#if configINTERRUPT_EXAMPLE_METHOD == 2 |
---|
140 |
|
---|
141 |
extern void vTaskSwitchContext( void ); |
---|
142 |
#define portYIELD_FROM_ISR( x ) if( x ) vTaskSwitchContext() |
---|
143 |
|
---|
144 |
#endif |
---|
145 |
|
---|
146 |
#endif /* PORTMACRO_H */ |
---|
147 |
|
---|