2010-04-20 11:26:11 +08:00
|
|
|
/*
|
|
|
|
* File : interrupt.s34
|
|
|
|
* This file is part of RT-Thread RTOS
|
|
|
|
* COPYRIGHT (C) 2009, RT-Thread Development Team
|
|
|
|
*
|
|
|
|
* The license and distribution terms for this file may be
|
|
|
|
* found in the file LICENSE in this distribution or at
|
|
|
|
* http://www.rt-thread.org/license/LICENSE
|
|
|
|
*
|
|
|
|
* Change Logs:
|
|
|
|
* Date Author Notes
|
2011-09-01 16:05:21 +08:00
|
|
|
* 2010-04-20 fify the first version
|
2010-04-20 11:26:11 +08:00
|
|
|
*
|
|
|
|
* For : Renesas M16C
|
|
|
|
* Toolchain : IAR's EW for M16C v3.401
|
2011-09-01 16:05:21 +08:00
|
|
|
*/
|
2010-04-20 11:26:11 +08:00
|
|
|
|
2011-09-01 16:25:54 +08:00
|
|
|
PUBLIC rt_hw_timer_handler
|
|
|
|
PUBLIC rt_hw_uart0_receive_handler
|
2010-04-20 11:26:11 +08:00
|
|
|
|
2011-09-09 15:30:39 +08:00
|
|
|
EXTERN rt_thread_switch_interrupt_flag
|
2011-09-01 16:25:54 +08:00
|
|
|
EXTERN rt_interrupt_from_thread
|
|
|
|
EXTERN rt_interrupt_to_thread
|
|
|
|
EXTERN rt_interrupt_enter
|
|
|
|
EXTERN rt_interrupt_leave
|
|
|
|
EXTERN rt_tick_increase
|
|
|
|
EXTERN u0rec_handler
|
2010-04-20 11:26:11 +08:00
|
|
|
|
2011-09-01 16:25:54 +08:00
|
|
|
RSEG CSTACK
|
|
|
|
RSEG ISTACK
|
|
|
|
RSEG CODE:CODE:NOROOT(2)
|
2010-04-20 11:26:11 +08:00
|
|
|
|
|
|
|
rt_hw_context_switch_interrupt_do
|
2011-10-07 11:04:15 +08:00
|
|
|
MOV.B #0, rt_thread_switch_interrupt_flag
|
2011-09-01 16:25:54 +08:00
|
|
|
MOV.W rt_interrupt_from_thread, A0
|
|
|
|
STC ISP, [A0]
|
2010-04-20 11:26:11 +08:00
|
|
|
|
2011-09-01 16:25:54 +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
|
2010-04-20 11:26:11 +08:00
|
|
|
REIT
|
|
|
|
|
|
|
|
.EVEN
|
|
|
|
rt_hw_timer_handler:
|
2011-09-01 16:25:54 +08:00
|
|
|
PUSHM R0,R1,R2,R3,A0,A1,SB,FB ; Save current task's registers
|
|
|
|
JSR rt_interrupt_enter
|
|
|
|
JSR rt_tick_increase
|
|
|
|
JSR rt_interrupt_leave
|
2010-04-20 11:26:11 +08:00
|
|
|
|
2011-10-07 11:04:15 +08:00
|
|
|
CMP.B #1, rt_thread_switch_interrupt_flag
|
2011-09-01 16:25:54 +08:00
|
|
|
JEQ rt_hw_context_switch_interrupt_do
|
2010-04-20 11:26:11 +08:00
|
|
|
|
2011-09-01 16:25:54 +08:00
|
|
|
POPM R0,R1,R2,R3,A0,A1,SB,FB ; Restore current task's registers
|
|
|
|
REIT ; Return from interrup
|
2010-04-20 11:26:11 +08:00
|
|
|
|
|
|
|
.EVEN
|
|
|
|
rt_hw_uart0_receive_handler:
|
2011-09-01 16:25:54 +08:00
|
|
|
PUSHM R0,R1,R2,R3,A0,A1,SB,FB ; Save current task's registers
|
|
|
|
JSR rt_interrupt_enter
|
|
|
|
JSR u0rec_handler
|
|
|
|
JSR rt_interrupt_leave
|
2010-04-20 11:26:11 +08:00
|
|
|
|
2011-10-07 11:04:15 +08:00
|
|
|
CMP.B #1, rt_thread_switch_interrupt_flag
|
2011-09-01 16:25:54 +08:00
|
|
|
JEQ rt_hw_context_switch_interrupt_do
|
2010-04-20 11:26:11 +08:00
|
|
|
|
2011-09-01 16:25:54 +08:00
|
|
|
POPM R0,R1,R2,R3,A0,A1,SB,FB ; Restore current task's registers
|
|
|
|
REIT ; Return from interrup
|
2010-04-20 11:26:11 +08:00
|
|
|
|
2011-09-01 16:25:54 +08:00
|
|
|
END
|