2013-01-08 21:05:02 +08:00
|
|
|
/*
|
2022-04-05 19:34:30 +08:00
|
|
|
* Copyright (c) 2006-2022, RT-Thread Development Team
|
2013-01-08 21:05:02 +08:00
|
|
|
*
|
2022-04-05 19:34:30 +08:00
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
2013-01-08 21:05:02 +08:00
|
|
|
*
|
|
|
|
* Change Logs:
|
|
|
|
* Date Author Notes
|
|
|
|
* 2010-04-09 fify the first version
|
|
|
|
* 2010-04-19 fify rewrite rt_hw_interrupt_disable/enable fuction
|
2022-01-18 13:35:13 +08:00
|
|
|
* 2010-04-20 fify move peripheral ISR to bsp/interrupts.s34
|
2013-01-08 21:05:02 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
.section .text
|
2022-01-18 13:35:13 +08:00
|
|
|
|
2013-01-08 21:05:02 +08:00
|
|
|
.globl _rt_interrupt_from_thread
|
|
|
|
.globl _rt_interrupt_to_thread
|
2022-01-18 13:35:13 +08:00
|
|
|
.global _os_context_switch
|
|
|
|
.type _os_context_switch, @function
|
2013-01-08 21:05:02 +08:00
|
|
|
_os_context_switch:
|
|
|
|
PUSHM R0,R1,R2,R3,A0,A1,SB,FB
|
2022-01-18 13:35:13 +08:00
|
|
|
|
2013-01-08 21:05:02 +08:00
|
|
|
MOV.W _rt_interrupt_from_thread, A0
|
|
|
|
STC ISP, [A0]
|
|
|
|
MOV.W _rt_interrupt_to_thread, A0
|
|
|
|
LDC [A0], ISP
|
|
|
|
|
|
|
|
POPM R0,R1,R2,R3,A0,A1,SB,FB ; Restore registers from the new task's stack
|
2022-01-18 13:35:13 +08:00
|
|
|
REIT ; Return from interrup
|
|
|
|
|
2013-01-08 21:05:02 +08:00
|
|
|
/*
|
|
|
|
* void rt_hw_context_switch_to(rt_uint32 to);
|
|
|
|
* this fucntion is used to perform the first thread switch
|
|
|
|
*/
|
2022-01-18 13:35:13 +08:00
|
|
|
.global _rt_hw_context_switch_to
|
|
|
|
.type _rt_hw_context_switch_to, @function
|
2013-01-08 21:05:02 +08:00
|
|
|
_rt_hw_context_switch_to:
|
|
|
|
ENTER #0x0
|
|
|
|
MOV.W 0x5[FB], A0
|
|
|
|
LDC [A0], ISP
|
|
|
|
POPM R0,R1,R2,R3,A0,A1,SB,FB
|
|
|
|
REIT
|
|
|
|
|
|
|
|
.end
|