FreeRTOS Real Time Operating System, Modified from Kenji Arai's initial port. See freertos.org for full documentation.
Fork of FreeRTOS_on_mbed_v1 by
portmacro.h
00001 /* 00002 FreeRTOS V6.0.3 - Copyright (C) 2010 Real Time Engineers Ltd. 00003 00004 *************************************************************************** 00005 * * 00006 * If you are: * 00007 * * 00008 * + New to FreeRTOS, * 00009 * + Wanting to learn FreeRTOS or multitasking in general quickly * 00010 * + Looking for basic training, * 00011 * + Wanting to improve your FreeRTOS skills and productivity * 00012 * * 00013 * then take a look at the FreeRTOS eBook * 00014 * * 00015 * "Using the FreeRTOS Real Time Kernel - a Practical Guide" * 00016 * http://www.FreeRTOS.org/Documentation * 00017 * * 00018 * A pdf reference manual is also available. Both are usually delivered * 00019 * to your inbox within 20 minutes to two hours when purchased between 8am * 00020 * and 8pm GMT (although please allow up to 24 hours in case of * 00021 * exceptional circumstances). Thank you for your support! * 00022 * * 00023 *************************************************************************** 00024 00025 This file is part of the FreeRTOS distribution. 00026 00027 FreeRTOS is free software; you can redistribute it and/or modify it under 00028 the terms of the GNU General Public License (version 2) as published by the 00029 Free Software Foundation AND MODIFIED BY the FreeRTOS exception. 00030 ***NOTE*** The exception to the GPL is included to allow you to distribute 00031 a combined work that includes FreeRTOS without being obliged to provide the 00032 source code for proprietary components outside of the FreeRTOS kernel. 00033 FreeRTOS is distributed in the hope that it will be useful, but WITHOUT 00034 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00035 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 00036 more details. You should have received a copy of the GNU General Public 00037 License and the FreeRTOS license exception along with FreeRTOS; if not it 00038 can be viewed here: http://www.freertos.org/a00114.html and also obtained 00039 by writing to Richard Barry, contact details for whom are available on the 00040 FreeRTOS WEB site. 00041 00042 1 tab == 4 spaces! 00043 00044 http://www.FreeRTOS.org - Documentation, latest information, license and 00045 contact details. 00046 00047 http://www.SafeRTOS.com - A version that is certified for use in safety 00048 critical systems. 00049 00050 http://www.OpenRTOS.com - Commercial support, development, porting, 00051 licensing and training services. 00052 */ 00053 // Modified by Kenji Arai / JH1PJL, October 30th,2010 00054 00055 #ifndef PORTMACRO_H 00056 #define PORTMACRO_H 00057 00058 #ifdef __cplusplus 00059 extern "C" { 00060 #endif 00061 00062 /*----------------------------------------------------------- 00063 * Port specific definitions. 00064 * 00065 * The settings in this file configure FreeRTOS correctly for the 00066 * given hardware and compiler. 00067 * 00068 * These settings should not be altered. 00069 *----------------------------------------------------------- 00070 */ 00071 00072 /* Type definitions. */ 00073 #define portCHAR char 00074 #define portFLOAT float 00075 #define portDOUBLE double 00076 #define portLONG long 00077 #define portSHORT short 00078 #define portSTACK_TYPE unsigned portLONG 00079 #define portBASE_TYPE long 00080 00081 #if( configUSE_16_BIT_TICKS == 1 ) 00082 typedef unsigned portSHORT portTickType; 00083 #define portMAX_DELAY ( portTickType ) 0xffff 00084 #else 00085 typedef unsigned portLONG portTickType; 00086 #define portMAX_DELAY ( portTickType ) 0xffffffff 00087 #endif 00088 /*-----------------------------------------------------------*/ 00089 00090 /* Architecture specifics. */ 00091 #define portSTACK_GROWTH ( -1 ) 00092 #define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ ) 00093 #define portBYTE_ALIGNMENT 8 00094 /*-----------------------------------------------------------*/ 00095 00096 00097 /* Scheduler utilities. */ 00098 extern void vPortYieldFromISR( void ); 00099 00100 #define portYIELD() vPortYieldFromISR() 00101 00102 #define portEND_SWITCHING_ISR( xSwitchRequired ) if( xSwitchRequired ) vPortYieldFromISR() 00103 /*-----------------------------------------------------------*/ 00104 00105 // Modified by Kenji Arai / JH1PJL, October 30th,2010 00106 #if 0 00107 /* Critical section management. */ 00108 00109 /* 00110 * Set basepri to portMAX_SYSCALL_INTERRUPT_PRIORITY without effecting other 00111 * registers. r0 is clobbered. 00112 */ 00113 //#define portSET_INTERRUPT_MASK() \ 00114 __asm volatile \ 00115 ( \ 00116 " mov r0, %0 \n" \ 00117 " msr basepri, r0 \n" \ 00118 ::"i"(configMAX_SYSCALL_INTERRUPT_PRIORITY):"r0" \ 00119 ) 00120 00121 /* 00122 * Set basepri back to 0 without effective other registers. 00123 * r0 is clobbered. 00124 */ 00125 //#define portCLEAR_INTERRUPT_MASK() \ 00126 __asm volatile \ 00127 ( \ 00128 " mov r0, #0 \n" \ 00129 " msr basepri, r0 \n" \ 00130 :::"r0" \ 00131 ) 00132 00133 //#define portSET_INTERRUPT_MASK_FROM_ISR() 0;portSET_INTERRUPT_MASK() 00134 //#define portCLEAR_INTERRUPT_MASK_FROM_ISR(x) portCLEAR_INTERRUPT_MASK();(void)x 00135 00136 extern void vPortEnterCritical( void ); 00137 extern void vPortExitCritical( void ); 00138 00139 #define portDISABLE_INTERRUPTS() portSET_INTERRUPT_MASK() 00140 #define portENABLE_INTERRUPTS() portCLEAR_INTERRUPT_MASK() 00141 #define portENTER_CRITICAL() vPortEnterCritical() 00142 #define portEXIT_CRITICAL() vPortExitCritical() 00143 #else 00144 00145 /* Critical section management. */ 00146 00147 /* 00148 * Set basepri to portMAX_SYSCALL_INTERRUPT_PRIORITY without effecting other 00149 * registers. r0 is clobbered. 00150 */ 00151 #define portSET_INTERRUPT_MASK() \ 00152 __asm volatile \ 00153 ( \ 00154 " mov r0, %0 \n" \ 00155 " msr basepri, r0 \n" \ 00156 ::"i"(configMAX_SYSCALL_INTERRUPT_PRIORITY):"r0" \ 00157 ) 00158 00159 00160 /* 00161 * Set basepri back to 0 without effective other registers. 00162 * r0 is clobbered. 00163 */ 00164 #define portCLEAR_INTERRUPT_MASK() \ 00165 __asm volatile \ 00166 ( \ 00167 " mov r0, #0 \n" \ 00168 " msr basepri, r0 \n" \ 00169 :::"r0" \ 00170 ) 00171 00172 00173 #define portSET_INTERRUPT_MASK_FROM_ISR() 0;portSET_INTERRUPT_MASK() 00174 #define portCLEAR_INTERRUPT_MASK_FROM_ISR(x) portCLEAR_INTERRUPT_MASK();(void)x 00175 00176 extern void vPortEnterCritical( void ); 00177 extern void vPortExitCritical( void ); 00178 00179 #define portDISABLE_INTERRUPTS() portSET_INTERRUPT_MASK() 00180 #define portENABLE_INTERRUPTS() portCLEAR_INTERRUPT_MASK() 00181 #define portENTER_CRITICAL() vPortEnterCritical() 00182 #define portEXIT_CRITICAL() vPortExitCritical() 00183 00184 #if 0 00185 /* Critical section management. */ 00186 00187 /* 00188 * Set basepri to portMAX_SYSCALL_INTERRUPT_PRIORITY without effecting other 00189 * registers. r0 is clobbered. 00190 */ 00191 extern void portSET_INTERRUPT_MASK( unsigned portBASE_TYPE ); 00192 /* 00193 * Set basepri back to 0 without effective other registers. 00194 * r0 is clobbered. 00195 */ 00196 extern void portCLEAR_INTERRUPT_MASK( unsigned portBASE_TYPE ); 00197 00198 //extern void portCLEAR_INTERRUPT_MASK_FROM_ISR( unsigned portBASE_TYPE ); 00199 00200 extern void vPortEnterCritical( void ); 00201 extern void vPortExitCritical( void ); 00202 00203 #define portSET_INTERRUPT_MASK_FROM_ISR() portSET_INTERRUPT_MASK(0) 00204 #define portCLEAR_INTERRUPT_MASK_FROM_ISR(x) portCLEAR_INTERRUPT_MASK(); 00205 #define portDISABLE_INTERRUPTS() portSET_INTERRUPT_MASK() 00206 #define portENABLE_INTERRUPTS() portCLEAR_INTERRUPT_MASK() 00207 #define portENTER_CRITICAL() vPortEnterCritical() 00208 #define portEXIT_CRITICAL() vPortExitCritical() 00209 #endif 00210 00211 00212 #endif 00213 /*-----------------------------------------------------------*/ 00214 00215 /* Task function macros as described on the FreeRTOS.org WEB site. */ 00216 #define portTASK_FUNCTION_PROTO( vFunction, pvParameters ) void vFunction( void *pvParameters ) 00217 #define portTASK_FUNCTION( vFunction, pvParameters ) void vFunction( void *pvParameters ) 00218 00219 #define portNOP() 00220 00221 #ifdef __cplusplus 00222 } 00223 #endif 00224 00225 #endif /* PORTMACRO_H */ 00226
Generated on Fri Jul 15 2022 10:21:25 by
1.7.2
