提交 55a2684e 编写于 作者: D dzzxzz

improve the renesas M16C porting

it can be worked in NORMAL or SIMPLE calling convention
and in all the optimize level(none, low, medium, high)

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@1691 bbd45198-f89e-11dd-88c7-29a3b14d5316
上级 b69ec549
......@@ -23,15 +23,12 @@
RSEG CODE(1)
EXTERN rt_thread_switch_interrput_flag
EXTERN rt_interrupt_from_thread
EXTERN rt_interrupt_to_thread
PUBLIC rt_hw_interrupt_disable
PUBLIC rt_hw_interrupt_enable
PUBLIC rt_hw_context_switch_to
PUBLIC rt_hw_context_switch
PUBLIC rt_hw_context_switch_interrupt
PUBLIC os_context_switch
rt_hw_interrupt_disable:
......@@ -66,19 +63,4 @@ rt_hw_context_switch_to:
POPM R0,R1,R2,R3,A0,A1,SB,FB
REIT
rt_hw_context_switch:
MOV.W R0, rt_interrupt_from_thread
MOV.W R1, rt_interrupt_to_thread
INT #0 ;software interrupt 0
RTS
rt_hw_context_switch_interrupt:
CMP.W #1, rt_thread_switch_interrput_flag
JEQ jump
MOV.W #1, rt_thread_switch_interrput_flag
MOV.W R0, rt_interrupt_from_thread
jump
MOV.W R1, rt_interrupt_to_thread
RTS
END
......@@ -19,7 +19,7 @@ extern volatile rt_uint8_t rt_interrupt_nest;
/* switch flag on interrupt and thread pointer to save switch record */
rt_uint32_t rt_interrupt_from_thread;
rt_uint32_t rt_interrupt_to_thread;
rt_uint32_t rt_thread_switch_interrput_flag;
rt_uint8_t rt_thread_switch_interrput_flag;
/**
* This function will initialize hardware interrupt
......@@ -71,3 +71,20 @@ rt_uint8_t *rt_hw_stack_init(void *tentry, void *parameter, rt_uint8_t *stack_ad
/* return task's current stack address */
return (rt_uint8_t *)pstk16;
}
void rt_hw_context_switch(rt_uint32_t from, rt_uint32_t to)
{
rt_interrupt_from_thread = from;
rt_interrupt_to_thread = to;
asm("INT #0");
}
void rt_hw_context_switch_interrupt(rt_uint32_t from, rt_uint32_t to)
{
if (rt_thread_switch_interrput_flag != 1)
{
rt_thread_switch_interrput_flag = 1;
rt_interrupt_from_thread = from;
}
rt_interrupt_to_thread = to;
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册