diff options
Diffstat (limited to 'libcpu/sim')
| -rw-r--r-- | libcpu/sim/posix/cpu_port.c | 22 | ||||
| -rw-r--r-- | libcpu/sim/posix/startup.c | 13 |
2 files changed, 24 insertions, 11 deletions
diff --git a/libcpu/sim/posix/cpu_port.c b/libcpu/sim/posix/cpu_port.c index 9561fe9f6c..f95eee2bbc 100644 --- a/libcpu/sim/posix/cpu_port.c +++ b/libcpu/sim/posix/cpu_port.c @@ -49,8 +49,8 @@ static long interrupt_disable_flag; //static int systick_signal_flag; /* flag in interrupt handling */ -rt_uint32_t rt_interrupt_from_thread, rt_interrupt_to_thread; -rt_uint32_t rt_thread_switch_interrupt_flag; +rt_ubase_t rt_interrupt_from_thread, rt_interrupt_to_thread; +rt_ubase_t rt_thread_switch_interrupt_flag; /* interrupt event mutex */ static pthread_mutex_t *ptr_int_mutex; @@ -363,8 +363,8 @@ void rt_hw_interrupt_enable(rt_base_t level) /*TODO: It may need to unmask the signal */ } -void rt_hw_context_switch(rt_uint32_t from, - rt_uint32_t to) +void rt_hw_context_switch(rt_ubase_t from, + rt_ubase_t to) { struct rt_thread * tid; pthread_t pid; @@ -380,12 +380,12 @@ void rt_hw_context_switch(rt_uint32_t from, rt_thread_switch_interrupt_flag = 1; // set rt_interrupt_from_thread - rt_interrupt_from_thread = *((rt_uint32_t *)from); + rt_interrupt_from_thread = *((rt_ubase_t *)from); } #endif pthread_mutex_lock(ptr_int_mutex); - rt_interrupt_from_thread = *((rt_uint32_t *)from); - rt_interrupt_to_thread = *((rt_uint32_t *)to); + rt_interrupt_from_thread = *((rt_ubase_t *)from); + rt_interrupt_to_thread = *((rt_ubase_t *)to); /* 这个函数只是并不会真正执行中断处理函数,而只是简单的 * 设置一下中断挂起标志位 @@ -394,16 +394,16 @@ void rt_hw_context_switch(rt_uint32_t from, pthread_mutex_unlock(ptr_int_mutex); } -void rt_hw_context_switch_interrupt(rt_uint32_t from, - rt_uint32_t to) +void rt_hw_context_switch_interrupt(rt_ubase_t from, + rt_ubase_t to) { rt_hw_context_switch(from, to); } -void rt_hw_context_switch_to(rt_uint32_t to) +void rt_hw_context_switch_to(rt_ubase_t to) { //set to thread - rt_interrupt_to_thread = *((rt_uint32_t *)(to)); + rt_interrupt_to_thread = *((rt_ubase_t *)(to)); //clear from thread rt_interrupt_from_thread = 0; diff --git a/libcpu/sim/posix/startup.c b/libcpu/sim/posix/startup.c new file mode 100644 index 0000000000..83dc4e6be3 --- /dev/null +++ b/libcpu/sim/posix/startup.c @@ -0,0 +1,13 @@ +#include <rtthread.h> + +#if defined(__GNUC__) + +int rtthread_startup(void); + +static int start(void) +{ + rtthread_startup(); + return 0; +} +__attribute__((section(".init_array"))) typeof(start) *__init = start; +#endif |
