2 FreeRTOS V7.5.1 - Copyright (C) 2013 Real Time Engineers Ltd.
\r
4 VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
\r
6 ***************************************************************************
\r
8 * FreeRTOS provides completely free yet professionally developed, *
\r
9 * robust, strictly quality controlled, supported, and cross *
\r
10 * platform software that has become a de facto standard. *
\r
12 * Help yourself get started quickly and support the FreeRTOS *
\r
13 * project by purchasing a FreeRTOS tutorial book, reference *
\r
14 * manual, or both from: http://www.FreeRTOS.org/Documentation *
\r
18 ***************************************************************************
\r
20 This file is part of the FreeRTOS distribution.
\r
22 FreeRTOS is free software; you can redistribute it and/or modify it under
\r
23 the terms of the GNU General Public License (version 2) as published by the
\r
24 Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.
\r
26 >>! NOTE: The modification to the GPL is included to allow you to distribute
\r
27 >>! a combined work that includes FreeRTOS without being obliged to provide
\r
28 >>! the source code for proprietary components outside of the FreeRTOS
\r
31 FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
\r
32 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
\r
33 FOR A PARTICULAR PURPOSE. Full license text is available from the following
\r
34 link: http://www.freertos.org/a00114.html
\r
38 ***************************************************************************
\r
40 * Having a problem? Start by reading the FAQ "My application does *
\r
41 * not run, what could be wrong?" *
\r
43 * http://www.FreeRTOS.org/FAQHelp.html *
\r
45 ***************************************************************************
\r
47 http://www.FreeRTOS.org - Documentation, books, training, latest versions,
\r
48 license and Real Time Engineers Ltd. contact details.
\r
50 http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
\r
51 including FreeRTOS+Trace - an indispensable productivity tool, a DOS
\r
52 compatible FAT file system, and our tiny thread aware UDP/IP stack.
\r
54 http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High
\r
55 Integrity Systems to sell under the OpenRTOS brand. Low cost OpenRTOS
\r
56 licenses offer ticketed support, indemnification and middleware.
\r
58 http://www.SafeRTOS.com - High Integrity Systems also provide a safety
\r
59 engineered and independently SIL3 certified version for use in safety and
\r
60 mission critical applications that require provable dependability.
\r
72 /* System Includes. */
\r
74 #include <machine/intrinsics.h>
\r
76 /*-----------------------------------------------------------
\r
77 * Port specific definitions.
\r
79 * The settings in this file configure FreeRTOS correctly for the
\r
80 * given hardware and compiler.
\r
82 * These settings should not be altered.
\r
83 *-----------------------------------------------------------
\r
86 /* Type definitions. */
\r
87 #define portCHAR char
\r
88 #define portFLOAT float
\r
89 #define portDOUBLE double
\r
90 #define portLONG long
\r
91 #define portSHORT short
\r
92 #define portSTACK_TYPE unsigned long
\r
93 #define portBASE_TYPE long
\r
95 #if( configUSE_16_BIT_TICKS == 1 )
\r
96 typedef unsigned portSHORT portTickType;
\r
97 #define portMAX_DELAY ( portTickType ) 0xffff
\r
99 typedef unsigned portLONG portTickType;
\r
100 #define portMAX_DELAY ( portTickType ) 0xffffffff
\r
102 /*---------------------------------------------------------------------------*/
\r
104 /* Architecture specifics. */
\r
105 #define portSTACK_GROWTH ( -1 )
\r
106 #define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ )
\r
107 #define portBYTE_ALIGNMENT 4
\r
108 #define portNOP() __asm volatile( " nop " )
\r
109 #define portCRITICAL_NESTING_IN_TCB 1
\r
110 #define portRESTORE_FIRST_TASK_PRIORITY_LEVEL 1
\r
113 /*---------------------------------------------------------------------------*/
\r
115 typedef struct MPU_SETTINGS { unsigned long ulNotUsed; } xMPU_SETTINGS;
\r
117 /* Define away the instruction from the Restore Context Macro. */
\r
118 #define portPRIVILEGE_BIT 0x0UL
\r
120 #define portCCPN_MASK ( 0x000000FFUL )
\r
122 extern void vTaskEnterCritical( void );
\r
123 extern void vTaskExitCritical( void );
\r
124 #define portENTER_CRITICAL() vTaskEnterCritical()
\r
125 #define portEXIT_CRITICAL() vTaskExitCritical()
\r
126 /*---------------------------------------------------------------------------*/
\r
128 /* CSA Manipulation. */
\r
129 #define portCSA_TO_ADDRESS( pCSA ) ( ( unsigned long * )( ( ( ( pCSA ) & 0x000F0000 ) << 12 ) | ( ( ( pCSA ) & 0x0000FFFF ) << 6 ) ) )
\r
130 #define portADDRESS_TO_CSA( pAddress ) ( ( unsigned long )( ( ( ( (unsigned long)( pAddress ) ) & 0xF0000000 ) >> 12 ) | ( ( ( unsigned long )( pAddress ) & 0x003FFFC0 ) >> 6 ) ) )
\r
131 /*---------------------------------------------------------------------------*/
\r
133 #define portYIELD() _syscall( 0 )
\r
134 /* Port Restore is implicit in the platform when the function is returned from the original PSW is automatically replaced. */
\r
135 #define portSYSCALL_TASK_YIELD 0
\r
136 #define portSYSCALL_RAISE_PRIORITY 1
\r
137 /*---------------------------------------------------------------------------*/
\r
139 /* Critical section management. */
\r
141 /* Set ICR.CCPN to configMAX_SYSCALL_INTERRUPT_PRIORITY. */
\r
142 #define portDISABLE_INTERRUPTS() { \
\r
143 unsigned long ulICR; \
\r
145 ulICR = _mfcr( $ICR ); /* Get current ICR value. */ \
\r
146 ulICR &= ~portCCPN_MASK; /* Clear down mask bits. */ \
\r
147 ulICR |= configMAX_SYSCALL_INTERRUPT_PRIORITY; /* Set mask bits to required priority mask. */ \
\r
148 _mtcr( $ICR, ulICR ); /* Write back updated ICR. */ \
\r
153 /* Clear ICR.CCPN to allow all interrupt priorities. */
\r
154 #define portENABLE_INTERRUPTS() { \
\r
155 unsigned long ulICR; \
\r
157 ulICR = _mfcr( $ICR ); /* Get current ICR value. */ \
\r
158 ulICR &= ~portCCPN_MASK; /* Clear down mask bits. */ \
\r
159 _mtcr( $ICR, ulICR ); /* Write back updated ICR. */ \
\r
164 /* Set ICR.CCPN to uxSavedMaskValue. */
\r
165 #define portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedMaskValue ) { \
\r
166 unsigned long ulICR; \
\r
168 ulICR = _mfcr( $ICR ); /* Get current ICR value. */ \
\r
169 ulICR &= ~portCCPN_MASK; /* Clear down mask bits. */ \
\r
170 ulICR |= uxSavedMaskValue; /* Set mask bits to previously saved mask value. */ \
\r
171 _mtcr( $ICR, ulICR ); /* Write back updated ICR. */ \
\r
177 /* Set ICR.CCPN to configMAX_SYSCALL_INTERRUPT_PRIORITY */
\r
178 extern unsigned long uxPortSetInterruptMaskFromISR( void );
\r
179 #define portSET_INTERRUPT_MASK_FROM_ISR() uxPortSetInterruptMaskFromISR()
\r
181 /* Pend a priority 1 interrupt, which will take care of the context switch. */
\r
182 #define portYIELD_FROM_ISR( xHigherPriorityTaskWoken ) if( xHigherPriorityTaskWoken != pdFALSE ) { CPU_SRC0.bits.SETR = 1; _isync(); }
\r
184 /*---------------------------------------------------------------------------*/
\r
186 /* Task function macros as described on the FreeRTOS.org WEB site. */
\r
187 #define portTASK_FUNCTION_PROTO( vFunction, pvParameters ) void vFunction( void *pvParameters )
\r
188 #define portTASK_FUNCTION( vFunction, pvParameters ) void vFunction( void *pvParameters )
\r
189 /*---------------------------------------------------------------------------*/
\r
192 * Port specific clean up macro required to free the CSAs that were consumed by
\r
193 * a task that has since been deleted.
\r
195 void vPortReclaimCSA( unsigned long *pxTCB );
\r
196 #define portCLEAN_UP_TCB( pxTCB ) vPortReclaimCSA( ( unsigned long * ) ( pxTCB ) )
\r
202 #endif /* PORTMACRO_H */
\r