mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-09-22 11:30:01 +08:00
Merge pull request #4846 from fenghuijie/master
修改irq handle接口rt_hw_trap_irq,支持核间IPI中断处理
This commit is contained in:
@@ -89,8 +89,8 @@ void rt_interrupt_leave(void)
|
||||
rt_interrupt_nest));
|
||||
|
||||
level = rt_hw_interrupt_disable();
|
||||
rt_interrupt_nest --;
|
||||
RT_OBJECT_HOOK_CALL(rt_interrupt_leave_hook,());
|
||||
rt_interrupt_nest --;
|
||||
rt_hw_interrupt_enable(level);
|
||||
}
|
||||
RTM_EXPORT(rt_interrupt_leave);
|
||||
|
||||
@@ -49,6 +49,7 @@ rt_uint8_t rt_current_priority;
|
||||
|
||||
#ifdef RT_USING_HOOK
|
||||
static void (*rt_scheduler_hook)(struct rt_thread *from, struct rt_thread *to);
|
||||
static void (*rt_scheduler_switch_hook)(struct rt_thread *tid);
|
||||
|
||||
/**
|
||||
* @addtogroup Hook
|
||||
@@ -68,6 +69,12 @@ rt_scheduler_sethook(void (*hook)(struct rt_thread *from, struct rt_thread *to))
|
||||
rt_scheduler_hook = hook;
|
||||
}
|
||||
|
||||
void
|
||||
rt_scheduler_switch_sethook(void (*hook)(struct rt_thread *tid))
|
||||
{
|
||||
rt_scheduler_switch_hook = hook;
|
||||
}
|
||||
|
||||
/**@}*/
|
||||
#endif /* RT_USING_HOOK */
|
||||
|
||||
@@ -364,6 +371,8 @@ void rt_schedule(void)
|
||||
_rt_scheduler_stack_check(to_thread);
|
||||
#endif /* RT_USING_OVERFLOW_CHECK */
|
||||
|
||||
RT_OBJECT_HOOK_CALL(rt_scheduler_switch_hook, (current_thread));
|
||||
|
||||
rt_hw_context_switch((rt_ubase_t)¤t_thread->sp,
|
||||
(rt_ubase_t)&to_thread->sp, to_thread);
|
||||
}
|
||||
@@ -473,6 +482,8 @@ void rt_schedule(void)
|
||||
{
|
||||
extern void rt_thread_handle_sig(rt_bool_t clean_state);
|
||||
|
||||
RT_OBJECT_HOOK_CALL(rt_scheduler_switch_hook, (from_thread));
|
||||
|
||||
rt_hw_context_switch((rt_ubase_t)&from_thread->sp,
|
||||
(rt_ubase_t)&to_thread->sp);
|
||||
|
||||
@@ -609,6 +620,8 @@ void rt_scheduler_do_irq_switch(void *context)
|
||||
current_thread->cpus_lock_nest--;
|
||||
current_thread->scheduler_lock_nest--;
|
||||
|
||||
RT_OBJECT_HOOK_CALL(rt_scheduler_switch_hook, (current_thread));
|
||||
|
||||
rt_hw_context_switch_interrupt(context, (rt_ubase_t)¤t_thread->sp,
|
||||
(rt_ubase_t)&to_thread->sp, to_thread);
|
||||
}
|
||||
|
||||
@@ -228,6 +228,10 @@ static rt_err_t _rt_thread_init(struct rt_thread *thread,
|
||||
thread->lwp = RT_NULL;
|
||||
#endif /* RT_USING_LWP */
|
||||
|
||||
#ifdef RT_USING_CPU_USAGE
|
||||
thread->duration_tick = 0;
|
||||
#endif
|
||||
|
||||
RT_OBJECT_HOOK_CALL(rt_thread_inited_hook, (thread));
|
||||
|
||||
return RT_EOK;
|
||||
|
||||
Reference in New Issue
Block a user