2 FreeRTOS V7.0.2 - Copyright (C) 2011 Real Time Engineers Ltd.
5 FreeRTOS supports many tools and architectures. V7.0.0 is sponsored by:
6 Atollic AB - Atollic provides professional embedded systems development
7 tools for C/C++ development, code analysis and test automation.
8 See http://www.atollic.com
11 ***************************************************************************
13 * FreeRTOS tutorial books are available in pdf and paperback. *
14 * Complete, revised, and edited pdf reference manuals are also *
17 * Purchasing FreeRTOS documentation will not only help you, by *
18 * ensuring you get running as quickly as possible and with an *
19 * in-depth knowledge of how to use FreeRTOS, it will also help *
20 * the FreeRTOS project to continue with its mission of providing *
21 * professional grade, cross platform, de facto standard solutions *
22 * for microcontrollers - completely free of charge! *
24 * >>> See http://www.FreeRTOS.org/Documentation for details. <<< *
26 * Thank you for using FreeRTOS, and thank you for your support! *
28 ***************************************************************************
31 This file is part of the FreeRTOS distribution.
33 FreeRTOS is free software; you can redistribute it and/or modify it under
34 the terms of the GNU General Public License (version 2) as published by the
35 Free Software Foundation AND MODIFIED BY the FreeRTOS exception.
36 >>>NOTE<<< The modification to the GPL is included to allow you to
37 distribute a combined work that includes FreeRTOS without being obliged to
38 provide the source code for proprietary components outside of the FreeRTOS
39 kernel. FreeRTOS is distributed in the hope that it will be useful, but
40 WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
41 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
42 more details. You should have received a copy of the GNU General Public
43 License and the FreeRTOS license exception along with FreeRTOS; if not it
44 can be viewed here: http://www.freertos.org/a00114.html and also obtained
45 by writing to Richard Barry, contact details for whom are available on the
50 http://www.FreeRTOS.org - Documentation, latest information, license and
53 http://www.SafeRTOS.com - A version that is certified for use in safety
56 http://www.OpenRTOS.com - Commercial support, development, porting,
57 licensing and training services.
60 #ifndef __OS_PORTMACRO_H__
61 #define __OS_PORTMACRO_H__
64 /*----------------------------------------------------------------------------*/
65 /* RTI Register Frame Definition */
104 #define RTI ((volatile struct rti *)0xFFFFFC00U)
106 /*----------------------------------------------------------------------------*/
107 /* Type Definitions */
109 #define portCHAR char
110 #define portFLOAT float
111 #define portDOUBLE double
112 #define portLONG long
113 #define portSHORT short
114 #define portSTACK_TYPE unsigned long
115 #define portBASE_TYPE long
117 #if (configUSE_16_BIT_TICKS == 1)
118 typedef unsigned portSHORT portTickType;
119 #define portMAX_DELAY (portTickType) 0xFFFF
121 typedef unsigned portLONG portTickType;
122 #define portMAX_DELAY (portTickType) 0xFFFFFFFFF
126 /*----------------------------------------------------------------------------*/
127 /* Architecture Definitions */
129 #define portSTACK_GROWTH (-1)
130 #define portTICK_RATE_MS ((portTickType) 1000 / configTICK_RATE_HZ)
131 #define portBYTE_ALIGNMENT 8
133 /*----------------------------------------------------------------------------*/
134 /* External Functions */
136 extern void vPortEnterCritical(void);
137 extern void vPortExitCritical(void);
139 /*----------------------------------------------------------------------------*/
140 /* Functions Macros */
142 #define portNOP() asm (" nop")
143 #define portYIELD() _call_swi(0)
144 #define portYIELD_FROM_ISR() vTaskSwitchContext()
145 #define portENTER_CRITICAL() vPortEnterCritical()
146 #define portEXIT_CRITICAL() vPortExitCritical()
147 #define portDISABLE_INTERRUPTS() asm (" CPSID if")
148 #define portENABLE_INTERRUPTS() asm (" CPSIE if")
150 #define portTASK_FUNCTION(vFunction, pvParameters) void vFunction(void *pvParameters)
151 #define portTASK_FUNCTION_PROTO(vFunction, pvParameters) void vFunction(void *pvParameters)
153 #if (configGENERATE_RUN_TIME_STATS == 1)
154 #define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS() \
156 RTI->GCTRL = 0x00000000U; \
157 RTI->TBCTRL = 0x00000000U; \
158 RTI->COMPCTRL = 0x00000000U; \
159 RTI->CNT[1U].UCx = 0x00000000U; \
160 RTI->CNT[1U].FRCx = 0x00000000U; \
161 RTI->CNT[1U].CPUCx = (configCPU_CLOCK_HZ / 2 / configTICK_RATE_HZ) / 16; \
162 RTI->CMP[1U].UDCPx = (configCPU_CLOCK_HZ / 2 / configTICK_RATE_HZ) / 16; \
163 RTI->GCTRL = 0x00000002U; \
165 #define portGET_RUN_TIME_COUNTER_VALUE() (RTI->CNT[1].FRCx)
170 /*----------------------------------------------------------------------------*/