mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-08-20 21:29:42 +08:00
improve NEC V850 porting
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@1705 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
+1
-45
@@ -40,8 +40,6 @@
|
||||
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 OSCtxSW
|
||||
PUBLIC OS_Restore_CPU_Context
|
||||
|
||||
@@ -121,14 +119,6 @@ rt_hw_context_switch_to:
|
||||
|
||||
OSCtxSW:
|
||||
SAVE_CPU_CTX ;Save all CPU registers
|
||||
|
||||
mov rt_thread_switch_interrupt_flag, r1
|
||||
ld.w 0[r1],r5
|
||||
cmp 0, r5
|
||||
be exit
|
||||
|
||||
mov 0, r5
|
||||
st.b r5, 0[r1]
|
||||
|
||||
mov rt_interrupt_from_thread, r21
|
||||
ld.w 0[r21], r21
|
||||
@@ -138,44 +128,10 @@ OSCtxSW:
|
||||
ld.w 0[r1], r1
|
||||
ld.w 0[r1], sp
|
||||
|
||||
exit:
|
||||
;Restore all Processor registers from stack and return from interrupt
|
||||
jr OS_Restore_CPU_Context
|
||||
|
||||
;R1 -> rt_interrupt_from_thread
|
||||
;R5 -> rt_interrupt_to_thread
|
||||
rt_hw_context_switch:
|
||||
mov rt_thread_switch_interrupt_flag, r8
|
||||
ld.w 0[r8],r9
|
||||
cmp 1, r9
|
||||
be jump1
|
||||
;mov rt_thread_switch_interrupt_flag, r1
|
||||
mov 1, r9
|
||||
st.b r9, 0[r8]
|
||||
mov rt_interrupt_from_thread, r10
|
||||
st.w r1, 0[r10]
|
||||
jump1
|
||||
mov rt_interrupt_to_thread, r11
|
||||
st.w r5, 0[r11]
|
||||
trap 0x10
|
||||
jmp [lp]
|
||||
|
||||
rt_hw_context_switch_interrupt:
|
||||
mov rt_thread_switch_interrupt_flag, r8
|
||||
ld.w 0[r8],r9
|
||||
cmp 1, r9
|
||||
be jump2
|
||||
;mov rt_thread_switch_interrupt_flag, r1
|
||||
mov 1, r9
|
||||
st.b r9, 0[r8]
|
||||
mov rt_interrupt_from_thread, r10
|
||||
st.w r1, 0[r10]
|
||||
jump2
|
||||
mov rt_interrupt_to_thread, r11
|
||||
st.w r5, 0[r11]
|
||||
jmp [lp]
|
||||
|
||||
rt_hw_context_switch_interrupt_do
|
||||
rt_hw_context_switch_interrupt_do:
|
||||
mov rt_thread_switch_interrupt_flag, r8
|
||||
mov 0, r9
|
||||
st.b r9, 0[r8]
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* File : stack.c
|
||||
* File : cpuport.c
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2009, RT-Thread Development Team
|
||||
* COPYRIGHT (C) 2009 - 2011, RT-Thread Development Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
@@ -9,14 +9,30 @@
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2010-06-29 lgnq the first version
|
||||
*
|
||||
* For : NEC V850E
|
||||
* Toolchain : IAR Embedded Workbench for V850 v3.71
|
||||
*/
|
||||
* 2011-02-23 Bernard the first version
|
||||
*/
|
||||
|
||||
#include <rtthread.h>
|
||||
|
||||
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_interrupt_flag;
|
||||
|
||||
/**
|
||||
* This function will initialize hardware interrupt
|
||||
*/
|
||||
void rt_hw_interrupt_init(void)
|
||||
{
|
||||
/* init interrupt nest, and context in thread sp */
|
||||
rt_interrupt_nest = 0;
|
||||
rt_interrupt_from_thread = 0;
|
||||
rt_interrupt_to_thread = 0;
|
||||
rt_thread_switch_interrupt_flag = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function will initialize thread stack
|
||||
*
|
||||
@@ -59,3 +75,20 @@ rt_uint8_t *rt_hw_stack_init(void *tentry, void *parameter, rt_uint8_t *stack_ad
|
||||
*(--stk) = (rt_uint32_t) parameter; /* r1 */
|
||||
return ((rt_uint8_t *)stk);
|
||||
}
|
||||
|
||||
void rt_hw_context_switch(rt_uint32_t from, rt_uint32_t to)
|
||||
{
|
||||
rt_interrupt_from_thread = from;
|
||||
rt_interrupt_to_thread = to;
|
||||
asm("trap 0x10");
|
||||
}
|
||||
|
||||
void rt_hw_context_switch_interrupt(rt_uint32_t from, rt_uint32_t to)
|
||||
{
|
||||
if (rt_thread_switch_interrupt_flag != 1)
|
||||
{
|
||||
rt_thread_switch_interrupt_flag = 1;
|
||||
rt_interrupt_from_thread = from;
|
||||
}
|
||||
rt_interrupt_to_thread = to;
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
/*
|
||||
* File : interrupt.c
|
||||
* 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
|
||||
* 2010-06-29 lgnq the first version
|
||||
*
|
||||
* For : NEC V850E
|
||||
* Toolchain : IAR Embedded Workbench for V850 v3.71
|
||||
*/
|
||||
|
||||
#include <rtthread.h>
|
||||
|
||||
rt_uint32_t rt_interrupt_from_thread;
|
||||
rt_uint32_t rt_interrupt_to_thread;
|
||||
rt_uint32_t rt_thread_switch_interrupt_flag;
|
||||
Reference in New Issue
Block a user