2 ; FreeRTOS V7.5.3 - Copyright (C) 2013 Real Time Engineers Ltd.
\r
3 ; All rights reserved
\r
6 ; ***************************************************************************
\r
8 ; * FreeRTOS tutorial books are available in pdf and paperback. *
\r
9 ; * Complete, revised, and edited pdf reference manuals are also *
\r
12 ; * Purchasing FreeRTOS documentation will not only help you, by *
\r
13 ; * ensuring you get running as quickly as possible and with an *
\r
14 ; * in-depth knowledge of how to use FreeRTOS, it will also help *
\r
15 ; * the FreeRTOS project to continue with its mission of providing *
\r
16 ; * professional grade, cross platform, de facto standard solutions *
\r
17 ; * for microcontrollers - completely free of charge! *
\r
19 ; * >>> See http://www.FreeRTOS.org/Documentation for details. <<< *
\r
21 ; * Thank you for using FreeRTOS, and thank you for your support! *
\r
23 ; ***************************************************************************
\r
26 ; This file is part of the FreeRTOS distribution.
\r
28 ; FreeRTOS is free software; you can redistribute it and/or modify it under
\r
29 ; the terms of the GNU General Public License (version 2) as published by the
\r
30 ; Free Software Foundation AND MODIFIED BY the FreeRTOS exception.
\r
31 ; >>>NOTE<<< The modification to the GPL is included to allow you to
\r
32 ; distribute a combined work that includes FreeRTOS without being obliged to
\r
33 ; provide the source code for proprietary components outside of the FreeRTOS
\r
34 ; kernel. FreeRTOS is distributed in the hope that it will be useful, but
\r
35 ; WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
\r
36 ; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
\r
37 ; more details. You should have received a copy of the GNU General Public
\r
38 ; License and the FreeRTOS license exception along with FreeRTOS; if not it
\r
39 ; can be viewed here: http://www.freertos.org/a00114.html and also obtained
\r
40 ; by writing to Richard Barry, contact details for whom are available on the
\r
41 ; FreeRTOS WEB site.
\r
43 ; 1 tab == 4 spaces!
\r
45 ; http://www.FreeRTOS.org - Documentation, latest information, license and
\r
48 ; http://www.SafeRTOS.com - A version that is certified for use in safety
\r
51 ; http://www.OpenRTOS.com - Commercial support, development, porting,
\r
52 ; licensing and training services.
\r
56 .extern pxCurrentTCB
\r
57 .extern vTaskSwitchContext
\r
58 .extern ulMaxSyscallInterruptPriorityConst
\r
61 .global _lc_ref__vector_pp_14
\r
63 .global vPortStartFirstTask
\r
64 .global vPortEnableVFP
\r
65 .global ulPortSetInterruptMask
\r
66 .global vPortClearInterruptMask
\r
68 ;-----------------------------------------------------------
\r
73 _vector_14: .type func
\r
77 ;Get the location of the current TCB.
\r
78 ldr.w r3, =pxCurrentTCB
\r
81 ;Is the task using the FPU context? If so, push high vfp registers.
\r
84 vstmdbeq r0!, {s16-s31}
\r
86 ;Save the core registers.
\r
87 stmdb r0!, {r4-r11, r14}
\r
89 ;Save the new top of stack into the first member of the TCB.
\r
92 stmdb sp!, {r3, r14}
\r
93 ldr.w r0, =ulMaxSyscallInterruptPriorityConst
\r
95 bl vTaskSwitchContext
\r
98 ldmia sp!, {r3, r14}
\r
100 ;The first item in pxCurrentTCB is the task top of stack.
\r
104 ;Pop the core registers.
\r
105 ldmia r0!, {r4-r11, r14}
\r
107 ;Is the task using the FPU context? If so, pop the high vfp registers too.
\r
110 vldmiaeq r0!, {s16-s31}
\r
115 .size _vector_14, $-_vector_14
\r
118 ;-----------------------------------------------------------
\r
120 ; This function is an XMC4000 silicon errata workaround. It will get used when
\r
121 ; the SILICON_BUG_PMC_CM_001 linker macro is defined.
\r
125 _lc_ref__vector_pp_14: .type func
\r
129 ;Get the location of the current TCB.
\r
130 ldr.w r3, =pxCurrentTCB
\r
133 ;Is the task using the FPU context? If so, push high vfp registers.
\r
136 vstmdbeq r0!, {s16-s31}
\r
138 ;Save the core registers.
\r
139 stmdb r0!, {r4-r11, r14}
\r
141 ;Save the new top of stack into the first member of the TCB.
\r
144 stmdb sp!, {r3, r14}
\r
145 ldr.w r0, =ulMaxSyscallInterruptPriorityConst
\r
147 bl vTaskSwitchContext
\r
150 ldmia sp!, {r3, r14}
\r
152 ;The first item in pxCurrentTCB is the task top of stack.
\r
156 ;Pop the core registers.
\r
157 ldmia r0!, {r4-r11, r14}
\r
159 ;Is the task using the FPU context? If so, pop the high vfp registers too.
\r
162 vldmiaeq r0!, {s16-s31}
\r
166 pop { pc } ; XMC4000 specific errata workaround. Do not used "bx lr" here.
\r
168 .size _lc_ref__vector_pp_14, $-_lc_ref__vector_pp_14
\r
171 ;-----------------------------------------------------------
\r
176 SVC_Handler: .type func
\r
177 ;Get the location of the current TCB.
\r
178 ldr.w r3, =pxCurrentTCB
\r
181 ;Pop the core registers.
\r
182 ldmia r0!, {r4-r11, r14}
\r
187 .size SVC_Handler, $-SVC_Handler
\r
190 ;-----------------------------------------------------------
\r
195 vPortStartFirstTask .type func
\r
196 ;Use the NVIC offset register to locate the stack.
\r
197 ldr.w r0, =0xE000ED08
\r
200 ;Set the msp back to the start of the stack.
\r
202 ;Call SVC to start the first task.
\r
205 .size vPortStartFirstTask, $-vPortStartFirstTask
\r
208 ;-----------------------------------------------------------
\r
213 vPortEnableVFP .type func
\r
214 ;The FPU enable bits are in the CPACR.
\r
215 ldr.w r0, =0xE000ED88
\r
218 ;Enable CP10 and CP11 coprocessors, then save back.
\r
219 orr r1, r1, #( 0xf << 20 )
\r
222 .size vPortEnableVFP, $-vPortEnableVFP
\r
225 ;-----------------------------------------------------------
\r
230 ulPortSetInterruptMask:
\r
232 ldr.w r1, =ulMaxSyscallInterruptPriorityConst
\r
235 .size ulPortSetInterruptMask, $-ulPortSetInterruptMask
\r
238 ;-----------------------------------------------------------
\r
243 vPortClearInterruptMask:
\r
246 .size vPortClearInterruptMask, $-vPortClearInterruptMask
\r
249 ;-----------------------------------------------------------
\r