2 ; * FreeRTOS Kernel V10.3.0
\r
3 ; * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
\r
5 ; * Permission is hereby granted, free of charge, to any person obtaining a copy of
\r
6 ; * this software and associated documentation files (the "Software"), to deal in
\r
7 ; * the Software without restriction, including without limitation the rights to
\r
8 ; * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
\r
9 ; * the Software, and to permit persons to whom the Software is furnished to do so,
\r
10 ; * subject to the following conditions:
\r
12 ; * The above copyright notice and this permission notice shall be included in all
\r
13 ; * copies or substantial portions of the Software.
\r
15 ; * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
\r
16 ; * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
\r
17 ; * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
\r
18 ; * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
\r
19 ; * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
\r
20 ; * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
\r
22 ; * http://www.FreeRTOS.org
\r
23 ; * http://aws.amazon.com/freertos
\r
25 ; * 1 tab == 4 spaces!
\r
29 .extern pxCurrentTCB
\r
30 .extern vTaskSwitchContext
\r
31 .extern ulMaxSyscallInterruptPriorityConst
\r
34 .global _lc_ref__vector_pp_14
\r
36 .global vPortStartFirstTask
\r
37 .global vPortEnableVFP
\r
38 .global ulPortSetInterruptMask
\r
39 .global vPortClearInterruptMask
\r
41 ;-----------------------------------------------------------
\r
46 _vector_14: .type func
\r
51 ;Get the location of the current TCB.
\r
52 ldr.w r3, =pxCurrentTCB
\r
55 ;Is the task using the FPU context? If so, push high vfp registers.
\r
58 vstmdbeq r0!, {s16-s31}
\r
60 ;Save the core registers.
\r
61 stmdb r0!, {r4-r11, r14}
\r
63 ;Save the new top of stack into the first member of the TCB.
\r
67 ldr.w r0, =ulMaxSyscallInterruptPriorityConst
\r
70 bl vTaskSwitchContext
\r
75 ;The first item in pxCurrentTCB is the task top of stack.
\r
79 ;Pop the core registers.
\r
80 ldmia r0!, {r4-r11, r14}
\r
82 ;Is the task using the FPU context? If so, pop the high vfp registers too.
\r
85 vldmiaeq r0!, {s16-s31}
\r
91 .size _vector_14, $-_vector_14
\r
94 ;-----------------------------------------------------------
\r
96 ; This function is an XMC4000 silicon errata workaround. It will get used when
\r
97 ; the SILICON_BUG_PMC_CM_001 linker macro is defined.
\r
101 _lc_ref__vector_pp_14: .type func
\r
106 ;Get the location of the current TCB.
\r
107 ldr.w r3, =pxCurrentTCB
\r
110 ;Is the task using the FPU context? If so, push high vfp registers.
\r
113 vstmdbeq r0!, {s16-s31}
\r
115 ;Save the core registers.
\r
116 stmdb r0!, {r4-r11, r14}
\r
118 ;Save the new top of stack into the first member of the TCB.
\r
122 ldr.w r0, =ulMaxSyscallInterruptPriorityConst
\r
125 bl vTaskSwitchContext
\r
130 ;The first item in pxCurrentTCB is the task top of stack.
\r
134 ;Pop the core registers.
\r
135 ldmia r0!, {r4-r11, r14}
\r
137 ;Is the task using the FPU context? If so, pop the high vfp registers too.
\r
140 vldmiaeq r0!, {s16-s31}
\r
145 pop { pc } ; XMC4000 specific errata workaround. Do not used "bx lr" here.
\r
147 .size _lc_ref__vector_pp_14, $-_lc_ref__vector_pp_14
\r
150 ;-----------------------------------------------------------
\r
155 SVC_Handler: .type func
\r
156 ;Get the location of the current TCB.
\r
157 ldr.w r3, =pxCurrentTCB
\r
160 ;Pop the core registers.
\r
161 ldmia r0!, {r4-r11, r14}
\r
167 .size SVC_Handler, $-SVC_Handler
\r
170 ;-----------------------------------------------------------
\r
175 vPortStartFirstTask .type func
\r
176 ;Use the NVIC offset register to locate the stack.
\r
177 ldr.w r0, =0xE000ED08
\r
180 ;Set the msp back to the start of the stack.
\r
182 ;Call SVC to start the first task.
\r
188 .size vPortStartFirstTask, $-vPortStartFirstTask
\r
191 ;-----------------------------------------------------------
\r
196 vPortEnableVFP .type func
\r
197 ;The FPU enable bits are in the CPACR.
\r
198 ldr.w r0, =0xE000ED88
\r
201 ;Enable CP10 and CP11 coprocessors, then save back.
\r
202 orr r1, r1, #( 0xf << 20 )
\r
205 .size vPortEnableVFP, $-vPortEnableVFP
\r
208 ;-----------------------------------------------------------
\r
213 ulPortSetInterruptMask:
\r
215 ldr.w r1, =ulMaxSyscallInterruptPriorityConst
\r
219 .size ulPortSetInterruptMask, $-ulPortSetInterruptMask
\r
222 ;-----------------------------------------------------------
\r
227 vPortClearInterruptMask:
\r
230 .size vPortClearInterruptMask, $-vPortClearInterruptMask
\r
233 ;-----------------------------------------------------------
\r