2013-01-08 22:40:58 +08:00
|
|
|
/*
|
2021-04-09 10:52:34 +08:00
|
|
|
* Copyright (c) 2006-2021, RT-Thread Development Team
|
2013-01-08 22:40:58 +08:00
|
|
|
*
|
2021-04-09 10:52:34 +08:00
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
2013-01-08 22:40:58 +08:00
|
|
|
*
|
|
|
|
* Change Logs:
|
|
|
|
* Date Author Notes
|
|
|
|
* 2010-04-20 fify the first version
|
|
|
|
*
|
|
|
|
* For : Renesas M16C
|
|
|
|
* Toolchain : IAR's EW for M16C v3.401
|
|
|
|
*/
|
|
|
|
|
2021-04-09 10:52:34 +08:00
|
|
|
.text
|
2013-01-08 22:40:58 +08:00
|
|
|
|
2021-04-09 10:52:34 +08:00
|
|
|
.globl _rt_hw_context_switch_interrupt_do
|
|
|
|
.type _rt_hw_context_switch_interrupt_do, #function
|
2013-01-08 22:40:58 +08:00
|
|
|
_rt_hw_context_switch_interrupt_do:
|
|
|
|
MOV.B #0, _rt_thread_switch_interrupt_flag
|
|
|
|
MOV.W _rt_interrupt_from_thread, A0
|
|
|
|
STC ISP, [A0]
|
2021-04-09 10:52:34 +08:00
|
|
|
|
2013-01-08 22:40:58 +08:00
|
|
|
MOV.W _rt_interrupt_to_thread, A0
|
|
|
|
LDC [A0], ISP
|
|
|
|
POPM R0,R1,R2,R3,A0,A1,SB,FB ; Restore all processor registers from the new task's stack
|
|
|
|
REIT
|
2021-04-09 10:52:34 +08:00
|
|
|
|
|
|
|
.text
|
|
|
|
.globl _rt_hw_timer_handler
|
|
|
|
.type _rt_hw_timer_handler, #function
|
2013-01-08 22:40:58 +08:00
|
|
|
_rt_hw_timer_handler:
|
|
|
|
PUSHM R0,R1,R2,R3,A0,A1,SB,FB ; Save current task's registers
|
|
|
|
jsr.a _rt_interrupt_enter
|
|
|
|
jsr.a _rt_tick_increase
|
|
|
|
jsr.a _rt_interrupt_leave
|
|
|
|
|
|
|
|
CMP.B #1, _rt_thread_switch_interrupt_flag
|
|
|
|
JEQ _rt_hw_context_switch_interrupt_do
|
2021-04-09 10:52:34 +08:00
|
|
|
|
2013-01-08 22:40:58 +08:00
|
|
|
POPM R0,R1,R2,R3,A0,A1,SB,FB ; Restore current task's registers
|
|
|
|
REIT ; Return from interrup
|
|
|
|
|
2021-04-09 10:52:34 +08:00
|
|
|
.text
|
|
|
|
.globl _rt_hw_uart0_receive_handler
|
|
|
|
.type _rt_hw_uart0_receive_handler, #function
|
2013-01-08 22:40:58 +08:00
|
|
|
_rt_hw_uart0_receive_handler:
|
|
|
|
PUSHM R0,R1,R2,R3,A0,A1,SB,FB ; Save current task's registers
|
2021-04-09 10:52:34 +08:00
|
|
|
jsr.a _rt_interrupt_enter
|
2013-01-08 22:40:58 +08:00
|
|
|
jsr.a _u0rec_handler
|
|
|
|
jsr.a _rt_interrupt_leave
|
|
|
|
|
|
|
|
CMP.B #1, _rt_thread_switch_interrupt_flag
|
|
|
|
JEQ _rt_hw_context_switch_interrupt_do
|
2021-04-09 10:52:34 +08:00
|
|
|
|
2013-01-08 22:40:58 +08:00
|
|
|
POPM R0,R1,R2,R3,A0,A1,SB,FB ; Restore current task's registers
|
|
|
|
REIT ; Return from interrup
|
|
|
|
|