2 ; * FreeRTOS Kernel <DEVELOPMENT BRANCH>
3 ; * Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5 ; * SPDX-License-Identifier: MIT
7 ; * Permission is hereby granted, free of charge, to any person obtaining a copy of
8 ; * this software and associated documentation files (the "Software"), to deal in
9 ; * the Software without restriction, including without limitation the rights to
10 ; * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
11 ; * the Software, and to permit persons to whom the Software is furnished to do so,
12 ; * subject to the following conditions:
14 ; * The above copyright notice and this permission notice shall be included in all
15 ; * copies or substantial portions of the Software.
17 ; * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 ; * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
19 ; * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
20 ; * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
21 ; * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 ; * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24 ; * https://www.FreeRTOS.org
25 ; * https://github.com/FreeRTOS
31 .extern vTaskSwitchContext
32 .extern ulMaxSyscallInterruptPriorityConst
35 .global _lc_ref__vector_pp_14
37 .global vPortStartFirstTask
38 .global vPortEnableVFP
39 .global ulPortSetInterruptMask
40 .global vPortClearInterruptMask
42 ;-----------------------------------------------------------
47 _vector_14: .type func
52 ;Get the location of the current TCB.
53 ldr.w r3, =pxCurrentTCB
56 ;Is the task using the FPU context? If so, push high vfp registers.
59 vstmdbeq r0!, {s16-s31}
61 ;Save the core registers.
62 stmdb r0!, {r4-r11, r14}
64 ;Save the new top of stack into the first member of the TCB.
68 ldr.w r0, =ulMaxSyscallInterruptPriorityConst
76 ;The first item in pxCurrentTCB is the task top of stack.
80 ;Pop the core registers.
81 ldmia r0!, {r4-r11, r14}
83 ;Is the task using the FPU context? If so, pop the high vfp registers too.
86 vldmiaeq r0!, {s16-s31}
92 .size _vector_14, $-_vector_14
95 ;-----------------------------------------------------------
97 ; This function is an XMC4000 silicon errata workaround. It will get used when
98 ; the SILICON_BUG_PMC_CM_001 linker macro is defined.
102 _lc_ref__vector_pp_14: .type func
107 ;Get the location of the current TCB.
108 ldr.w r3, =pxCurrentTCB
111 ;Is the task using the FPU context? If so, push high vfp registers.
114 vstmdbeq r0!, {s16-s31}
116 ;Save the core registers.
117 stmdb r0!, {r4-r11, r14}
119 ;Save the new top of stack into the first member of the TCB.
123 ldr.w r0, =ulMaxSyscallInterruptPriorityConst
126 bl vTaskSwitchContext
131 ;The first item in pxCurrentTCB is the task top of stack.
135 ;Pop the core registers.
136 ldmia r0!, {r4-r11, r14}
138 ;Is the task using the FPU context? If so, pop the high vfp registers too.
141 vldmiaeq r0!, {s16-s31}
146 pop { pc } ; XMC4000 specific errata workaround. Do not used "bx lr" here.
148 .size _lc_ref__vector_pp_14, $-_lc_ref__vector_pp_14
151 ;-----------------------------------------------------------
156 SVC_Handler: .type func
157 ;Get the location of the current TCB.
158 ldr.w r3, =pxCurrentTCB
161 ;Pop the core registers.
162 ldmia r0!, {r4-r11, r14}
168 .size SVC_Handler, $-SVC_Handler
171 ;-----------------------------------------------------------
176 vPortStartFirstTask .type func
177 ;Use the NVIC offset register to locate the stack.
178 ldr.w r0, =0xE000ED08
181 ;Set the msp back to the start of the stack.
183 ;Call SVC to start the first task.
189 .size vPortStartFirstTask, $-vPortStartFirstTask
192 ;-----------------------------------------------------------
197 vPortEnableVFP .type func
198 ;The FPU enable bits are in the CPACR.
199 ldr.w r0, =0xE000ED88
202 ;Enable CP10 and CP11 coprocessors, then save back.
203 orr r1, r1, #( 0xf << 20 )
206 .size vPortEnableVFP, $-vPortEnableVFP
209 ;-----------------------------------------------------------
214 ulPortSetInterruptMask:
216 ldr.w r1, =ulMaxSyscallInterruptPriorityConst
220 .size ulPortSetInterruptMask, $-ulPortSetInterruptMask
223 ;-----------------------------------------------------------
228 vPortClearInterruptMask:
231 .size vPortClearInterruptMask, $-vPortClearInterruptMask
234 ;-----------------------------------------------------------