diff options
| author | Shicheng Chu <[email protected]> | 2023-06-29 23:24:25 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-06-29 11:24:25 -0400 |
| commit | e2c031643c8dec7c9ea1581216e19bf19c8f73f0 (patch) | |
| tree | 926536732e7472c5e86ac5198b239d82f9f55da4 /src/ipc.c | |
| parent | 148ae53cf8d3abc2c2e11c94c171b123b950b2fc (diff) | |
[include][dbg]update: no longer use RT_DEBUG_LOG in rtdebug.h (#7750)
Diffstat (limited to 'src/ipc.c')
| -rw-r--r-- | src/ipc.c | 77 |
1 files changed, 40 insertions, 37 deletions
@@ -50,6 +50,14 @@ #include <rtthread.h> #include <rthw.h> +#define DBG_TAG "kernel.ipc" +#ifdef RT_DEBUG_IPC +#define DBG_LVL DBG_LOG +#else +#define DBG_LVL DBG_WARNING +#endif /* defined (RT_DEBUG_IPC) */ +#include <rtdbg.h> + #ifndef __on_rt_object_trytake_hook #define __on_rt_object_trytake_hook(parent) __ON_HOOK_ARGS(rt_object_trytake_hook, (parent)) #endif @@ -211,7 +219,7 @@ rt_inline rt_err_t _ipc_list_resume(rt_list_t *list) thread->error = RT_EOK; - RT_DEBUG_LOG(RT_DEBUG_IPC, ("resume thread:%s\n", thread->parent.name)); + LOG_D("resume thread:%s\n", thread->parent.name); /* resume it */ rt_thread_resume(thread); @@ -513,10 +521,10 @@ static rt_err_t _rt_sem_take(rt_sem_t sem, rt_int32_t timeout, int suspend_flag) /* disable interrupt */ level = rt_hw_interrupt_disable(); - RT_DEBUG_LOG(RT_DEBUG_IPC, ("thread %s take sem:%s, which value is: %d\n", - rt_thread_self()->parent.name, - sem->parent.parent.name, - sem->value)); + LOG_D("thread %s take sem:%s, which value is: %d", + rt_thread_self()->parent.name, + sem->parent.parent.name, + sem->value); if (sem->value > 0) { @@ -544,7 +552,7 @@ static rt_err_t _rt_sem_take(rt_sem_t sem, rt_int32_t timeout, int suspend_flag) /* reset thread error number */ thread->error = -RT_EINTR; - RT_DEBUG_LOG(RT_DEBUG_IPC, ("sem take: suspend thread - %s\n", thread->parent.name)); + LOG_D("sem take: suspend thread - %s", thread->parent.name); /* suspend thread */ ret = _ipc_list_suspend(&(sem->parent.suspend_thread), @@ -560,7 +568,7 @@ static rt_err_t _rt_sem_take(rt_sem_t sem, rt_int32_t timeout, int suspend_flag) /* has waiting time, start thread timer */ if (timeout > 0) { - RT_DEBUG_LOG(RT_DEBUG_IPC, ("set thread:%s to timer list\n", thread->parent.name)); + LOG_D("set thread:%s to timer list", thread->parent.name); /* reset the timeout of thread timer and start it */ rt_timer_control(&(thread->thread_timer), @@ -654,10 +662,10 @@ rt_err_t rt_sem_release(rt_sem_t sem) /* disable interrupt */ level = rt_hw_interrupt_disable(); - RT_DEBUG_LOG(RT_DEBUG_IPC, ("thread %s releases sem:%s, which value is: %d\n", - rt_thread_self()->parent.name, - sem->parent.parent.name, - sem->value)); + LOG_D("thread %s releases sem:%s, which value is: %d", + rt_thread_self()->parent.name, + sem->parent.parent.name, + sem->value); if (!rt_list_isempty(&sem->parent.suspend_thread)) { @@ -788,8 +796,7 @@ rt_inline rt_uint8_t _thread_get_mutex_priority(struct rt_thread* thread) rt_inline void _thread_update_priority(struct rt_thread *thread, rt_uint8_t priority, int suspend_flag) { rt_err_t ret; - RT_DEBUG_LOG(RT_DEBUG_IPC, - ("thread:%s priority -> %d\n", thread->parent.name, priority)); + LOG_D("thread:%s priority -> %d", thread->parent.name, priority); /* change priority of the thread */ rt_thread_control(thread, @@ -822,9 +829,8 @@ rt_inline void _thread_update_priority(struct rt_thread *thread, rt_uint8_t prio /* update priority */ _mutex_update_priority(pending_mutex); /* change the priority of mutex owner thread */ - RT_DEBUG_LOG(RT_DEBUG_IPC, - ("mutex: %s priority -> %d\n", pending_mutex->parent.parent.name, - pending_mutex->priority)); + LOG_D("mutex: %s priority -> %d", pending_mutex->parent.parent.name, + pending_mutex->priority); mutex_priority = _thread_get_mutex_priority(pending_mutex->owner); if (mutex_priority != pending_mutex->owner->current_priority) @@ -1180,9 +1186,8 @@ static rt_err_t _rt_mutex_take(rt_mutex_t mutex, rt_int32_t timeout, int suspend RT_OBJECT_HOOK_CALL(rt_object_trytake_hook, (&(mutex->parent.parent))); - RT_DEBUG_LOG(RT_DEBUG_IPC, - ("mutex_take: current thread %s, hold: %d\n", - thread->parent.name, mutex->hold)); + LOG_D("mutex_take: current thread %s, hold: %d", + thread->parent.name, mutex->hold); /* reset thread error */ thread->error = RT_EOK; @@ -1238,8 +1243,8 @@ static rt_err_t _rt_mutex_take(rt_mutex_t mutex, rt_int32_t timeout, int suspend rt_uint8_t priority = thread->current_priority; /* mutex is unavailable, push to suspend list */ - RT_DEBUG_LOG(RT_DEBUG_IPC, ("mutex_take: suspend thread: %s\n", - thread->parent.name)); + LOG_D("mutex_take: suspend thread: %s", + thread->parent.name); /* suspend current thread */ ret = _ipc_list_suspend(&(mutex->parent.suspend_thread), @@ -1268,9 +1273,8 @@ static rt_err_t _rt_mutex_take(rt_mutex_t mutex, rt_int32_t timeout, int suspend /* has waiting time, start thread timer */ if (timeout > 0) { - RT_DEBUG_LOG(RT_DEBUG_IPC, - ("mutex_take: start the timer of thread:%s\n", - thread->parent.name)); + LOG_D("mutex_take: start the timer of thread:%s", + thread->parent.name); /* reset the timeout of thread timer and start it */ rt_timer_control(&(thread->thread_timer), @@ -1422,9 +1426,8 @@ rt_err_t rt_mutex_release(rt_mutex_t mutex) /* disable interrupt */ level = rt_hw_interrupt_disable(); - RT_DEBUG_LOG(RT_DEBUG_IPC, - ("mutex_release:current thread %s, hold: %d\n", - thread->parent.name, mutex->hold)); + LOG_D("mutex_release:current thread %s, hold: %d", + thread->parent.name, mutex->hold); RT_OBJECT_HOOK_CALL(rt_object_put_hook, (&(mutex->parent.parent))); @@ -1470,8 +1473,8 @@ rt_err_t rt_mutex_release(rt_mutex_t mutex) struct rt_thread, tlist); - RT_DEBUG_LOG(RT_DEBUG_IPC, ("mutex_release: resume thread: %s\n", - next_thread->parent.name)); + LOG_D("mutex_release: resume thread: %s", + next_thread->parent.name); /* remove the thread from the suspended list of mutex */ rt_list_remove(&(next_thread->tlist)); @@ -2417,8 +2420,8 @@ static rt_err_t _rt_mb_send_wait(rt_mailbox_t mb, /* get the start tick of timer */ tick_delta = rt_tick_get(); - RT_DEBUG_LOG(RT_DEBUG_IPC, ("mb_send_wait: start timer of thread:%s\n", - thread->parent.name)); + LOG_D("mb_send_wait: start timer of thread:%s", + thread->parent.name); /* reset the timeout of thread timer and start it */ rt_timer_control(&(thread->thread_timer), @@ -2711,8 +2714,8 @@ static rt_err_t _rt_mb_recv(rt_mailbox_t mb, rt_ubase_t *value, rt_int32_t timeo /* get the start tick of timer */ tick_delta = rt_tick_get(); - RT_DEBUG_LOG(RT_DEBUG_IPC, ("mb_recv: start timer of thread:%s\n", - thread->parent.name)); + LOG_D("mb_recv: start timer of thread:%s", + thread->parent.name); /* reset the timeout of thread timer and start it */ rt_timer_control(&(thread->thread_timer), @@ -3256,8 +3259,8 @@ static rt_err_t _rt_mq_send_wait(rt_mq_t mq, /* get the start tick of timer */ tick_delta = rt_tick_get(); - RT_DEBUG_LOG(RT_DEBUG_IPC, ("mq_send_wait: start timer of thread:%s\n", - thread->parent.name)); + LOG_D("mq_send_wait: start timer of thread:%s", + thread->parent.name); /* reset the timeout of thread timer and start it */ rt_timer_control(&(thread->thread_timer), @@ -3649,8 +3652,8 @@ static rt_ssize_t _rt_mq_recv(rt_mq_t mq, /* get the start tick of timer */ tick_delta = rt_tick_get(); - RT_DEBUG_LOG(RT_DEBUG_IPC, ("set thread:%s to timer list\n", - thread->parent.name)); + LOG_D("set thread:%s to timer list", + thread->parent.name); /* reset the timeout of thread timer and start it */ rt_timer_control(&(thread->thread_timer), |
