]> git.sur5r.net Git - freertos/blob - Source/portable/IAR/STR71x/portmacro.h
a4b3c46cfab415fd56e4bbd1cad1141aa42f1a4d
[freertos] / Source / portable / IAR / STR71x / portmacro.h
1 /*\r
2         FreeRTOS.org V4.6.1 - Copyright (C) 2003-2007 Richard Barry.\r
3 \r
4         This file is part of the FreeRTOS.org distribution.\r
5 \r
6         FreeRTOS.org is free software; you can redistribute it and/or modify\r
7         it under the terms of the GNU General Public License as published by\r
8         the Free Software Foundation; either version 2 of the License, or\r
9         (at your option) any later version.\r
10 \r
11         FreeRTOS.org is distributed in the hope that it will be useful,\r
12         but WITHOUT ANY WARRANTY; without even the implied warranty of\r
13         MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
14         GNU General Public License for more details.\r
15 \r
16         You should have received a copy of the GNU General Public License\r
17         along with FreeRTOS.org; if not, write to the Free Software\r
18         Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
19 \r
20         A special exception to the GPL can be applied should you wish to distribute\r
21         a combined work that includes FreeRTOS.org, without being obliged to provide\r
22         the source code for any proprietary components.  See the licensing section\r
23         of http://www.FreeRTOS.org for full details of how and when the exception\r
24         can be applied.\r
25 \r
26         ***************************************************************************\r
27         See http://www.FreeRTOS.org for documentation, latest information, license\r
28         and contact details.  Please ensure to read the configuration and relevant\r
29         port sections of the online documentation.\r
30 \r
31         Also see http://www.SafeRTOS.com a version that has been certified for use\r
32         in safety critical systems, plus commercial licensing, development and\r
33         support options.\r
34         ***************************************************************************\r
35 */\r
36 \r
37 \r
38 #ifndef PORTMACRO_H\r
39 #define PORTMACRO_H\r
40 \r
41 /*-----------------------------------------------------------\r
42  * Port specific definitions.\r
43  *\r
44  * The settings in this file configure FreeRTOS correctly for the\r
45  * given hardware and compiler.\r
46  *\r
47  * These settings should not be altered.\r
48  *-----------------------------------------------------------\r
49  */\r
50 \r
51 #include <intrinsic.h>\r
52 \r
53 #ifdef __cplusplus\r
54 extern "C" {\r
55 #endif\r
56 \r
57 \r
58 /* Type definitions. */\r
59 #define portCHAR                char\r
60 #define portFLOAT               float\r
61 #define portDOUBLE              double\r
62 #define portLONG                long\r
63 #define portSHORT               short\r
64 #define portSTACK_TYPE  unsigned portLONG\r
65 #define portBASE_TYPE   portLONG\r
66 \r
67 #if( configUSE_16_BIT_TICKS == 1 )\r
68         typedef unsigned portSHORT portTickType;\r
69         #define portMAX_DELAY ( portTickType ) 0xffff\r
70 #else\r
71         typedef unsigned portLONG portTickType;\r
72         #define portMAX_DELAY ( portTickType ) 0xffffffff\r
73 #endif\r
74 /*-----------------------------------------------------------*/ \r
75 \r
76 /* Hardware specifics. */\r
77 #define portSTACK_GROWTH                        ( -1 )\r
78 #define portTICK_RATE_MS                        ( ( portTickType ) 1000 / configTICK_RATE_HZ )          \r
79 #define portBYTE_ALIGNMENT                      4\r
80 #define portYIELD()                                     asm ( "SWI 0" )\r
81 #define portNOP()                                       asm ( "NOP" )\r
82 /*-----------------------------------------------------------*/ \r
83 \r
84 /* Critical section handling. */\r
85 __arm __interwork void vPortDisableInterruptsFromThumb( void );\r
86 __arm __interwork void vPortEnableInterruptsFromThumb( void );\r
87 __arm __interwork void vPortEnterCritical( void );\r
88 __arm __interwork void vPortExitCritical( void );\r
89 \r
90 #define portDISABLE_INTERRUPTS()        __disable_interrupt()\r
91 #define portENABLE_INTERRUPTS()         __enable_interrupt()\r
92 #define portENTER_CRITICAL()            vPortEnterCritical()\r
93 #define portEXIT_CRITICAL()                     vPortExitCritical()\r
94 /*-----------------------------------------------------------*/ \r
95 \r
96 /* Task utilities. */\r
97 #define portEND_SWITCHING_ISR( xSwitchRequired )        \\r
98 {                                                                                                       \\r
99 extern void vTaskSwitchContext( void );                         \\r
100                                                                                                         \\r
101         if( xSwitchRequired )                                                   \\r
102         {                                                                                               \\r
103                 vTaskSwitchContext();                                           \\r
104         }                                                                                               \\r
105 }\r
106 /*-----------------------------------------------------------*/ \r
107 \r
108 /* EIC utilities. */\r
109 #define portEIC_CICR_ADDR               *( ( unsigned portLONG * ) 0xFFFFF804 )\r
110 #define portEIC_IPR_ADDR                *( ( unsigned portLONG * ) 0xFFFFF840 )\r
111 #define portCLEAR_EIC()                 portEIC_IPR_ADDR = 0x01 << portEIC_CICR_ADDR\r
112 \r
113 /*-----------------------------------------------------------*/ \r
114 \r
115 /* Compiler specifics */\r
116 #define inline\r
117 \r
118 /* Task function macros as described on the FreeRTOS.org WEB site. */\r
119 #define portTASK_FUNCTION_PROTO( vFunction, pvParameters ) void vFunction( void * pvParameters )\r
120 #define portTASK_FUNCTION( vFunction, pvParameters ) void vFunction( void * pvParameters )\r
121 \r
122 #ifdef __cplusplus\r
123 }\r
124 #endif\r
125 \r
126 #endif /* PORTMACRO_H */\r
127 \r
128 \r