From 66b2bcc080b39750cc69a2f00f0d951f94967712 Mon Sep 17 00:00:00 2001 From: Yonggang Luo Date: Mon, 22 Sep 2025 01:04:46 +0800 Subject: [PATCH] RT_TIMER_CTRL_SET_TIME only accept rt_tick_t, pass rt_tick_t instead int/rt_int32_t --- bsp/at91/at91sam9260/drivers/at91_mci.c | 2 +- bsp/at91/at91sam9g45/drivers/at91_mci.c | 2 +- components/drivers/ipc/completion_mp.c | 3 ++- components/drivers/ipc/completion_up.c | 3 ++- components/drivers/ipc/dataqueue.c | 6 ++++-- components/libc/posix/io/epoll/epoll.c | 3 ++- components/libc/posix/io/poll/poll.c | 3 ++- components/libc/posix/pthreads/pthread_cond.c | 3 ++- components/lwp/lwp_ipc.c | 9 +++++--- components/utilities/rt-link/src/rtlink.c | 6 +++--- components/vbus/prio_queue.c | 3 ++- components/vbus/vbus.c | 3 ++- components/vbus/watermark_queue.h | 3 ++- src/ipc.c | 21 ++++++++++++------- src/mempool.c | 3 ++- src/signal.c | 3 ++- 16 files changed, 49 insertions(+), 27 deletions(-) diff --git a/bsp/at91/at91sam9260/drivers/at91_mci.c b/bsp/at91/at91sam9260/drivers/at91_mci.c index 0855b61386..93ed7a2bdb 100644 --- a/bsp/at91/at91sam9260/drivers/at91_mci.c +++ b/bsp/at91/at91sam9260/drivers/at91_mci.c @@ -430,7 +430,7 @@ static void at91_mci_process_next(struct at91_mci *mci) */ static void at91_mci_request(struct rt_mmcsd_host *host, struct rt_mmcsd_req *req) { - rt_uint32_t timeout = RT_TICK_PER_SECOND; + rt_tick_t timeout = RT_TICK_PER_SECOND; struct at91_mci *mci = host->private_data; mci->req = req; mci->current_status = REQ_ST_INIT; diff --git a/bsp/at91/at91sam9g45/drivers/at91_mci.c b/bsp/at91/at91sam9g45/drivers/at91_mci.c index d465d49a8c..0942e8aafe 100644 --- a/bsp/at91/at91sam9g45/drivers/at91_mci.c +++ b/bsp/at91/at91sam9g45/drivers/at91_mci.c @@ -430,7 +430,7 @@ static void at91_mci_process_next(struct at91_mci *mci) */ static void at91_mci_request(struct rt_mmcsd_host *host, struct rt_mmcsd_req *req) { - rt_uint32_t timeout = RT_TICK_PER_SECOND; + rt_tick_t timeout = RT_TICK_PER_SECOND; struct at91_mci *mci = host->private_data; mci->req = req; mci->current_status = REQ_ST_INIT; diff --git a/components/drivers/ipc/completion_mp.c b/components/drivers/ipc/completion_mp.c index 38ffc6f3fd..3c9c65d58b 100644 --- a/components/drivers/ipc/completion_mp.c +++ b/components/drivers/ipc/completion_mp.c @@ -242,10 +242,11 @@ static rt_err_t _comp_susp_thread(struct rt_completion *completion, /* start timer */ if (timeout > 0) { + rt_tick_t timeout_tick = timeout; /* reset the timeout of thread timer and start it */ rt_timer_control(&(thread->thread_timer), RT_TIMER_CTRL_SET_TIME, - &timeout); + &timeout_tick); rt_timer_start(&(thread->thread_timer)); } diff --git a/components/drivers/ipc/completion_up.c b/components/drivers/ipc/completion_up.c index 8c3bbbffa1..ce11bd00af 100644 --- a/components/drivers/ipc/completion_up.c +++ b/components/drivers/ipc/completion_up.c @@ -108,10 +108,11 @@ __try_again: /* start timer */ if (timeout > 0) { + rt_tick_t timeout_tick = timeout; /* reset the timeout of thread timer and start it */ rt_timer_control(&(thread->thread_timer), RT_TIMER_CTRL_SET_TIME, - &timeout); + &timeout_tick); rt_timer_start(&(thread->thread_timer)); } /* enable interrupt */ diff --git a/components/drivers/ipc/dataqueue.c b/components/drivers/ipc/dataqueue.c index 337c5114bf..f1ee2bd576 100644 --- a/components/drivers/ipc/dataqueue.c +++ b/components/drivers/ipc/dataqueue.c @@ -129,10 +129,11 @@ rt_err_t rt_data_queue_push(struct rt_data_queue *queue, /* start timer */ if (timeout > 0) { + rt_tick_t timeout_tick = timeout; /* reset the timeout of thread timer and start it */ rt_timer_control(&(thread->thread_timer), RT_TIMER_CTRL_SET_TIME, - &timeout); + &timeout_tick); rt_timer_start(&(thread->thread_timer)); } @@ -247,10 +248,11 @@ rt_err_t rt_data_queue_pop(struct rt_data_queue *queue, /* start timer */ if (timeout > 0) { + rt_tick_t timeout_tick = timeout; /* reset the timeout of thread timer and start it */ rt_timer_control(&(thread->thread_timer), RT_TIMER_CTRL_SET_TIME, - &timeout); + &timeout_tick); rt_timer_start(&(thread->thread_timer)); } diff --git a/components/libc/posix/io/epoll/epoll.c b/components/libc/posix/io/epoll/epoll.c index 7677b8deea..a4c9dcfc06 100644 --- a/components/libc/posix/io/epoll/epoll.c +++ b/components/libc/posix/io/epoll/epoll.c @@ -700,9 +700,10 @@ static int epoll_wait_timeout(struct rt_eventpoll *ep, int msec) { if (timeout > 0) { + rt_tick_t timeout_tick = timeout; rt_timer_control(&(thread->thread_timer), RT_TIMER_CTRL_SET_TIME, - &timeout); + &timeout_tick); rt_timer_start(&(thread->thread_timer)); } diff --git a/components/libc/posix/io/poll/poll.c b/components/libc/posix/io/poll/poll.c index 8be654ed3b..3667216081 100644 --- a/components/libc/posix/io/poll/poll.c +++ b/components/libc/posix/io/poll/poll.c @@ -158,9 +158,10 @@ static int poll_wait_timeout(struct rt_poll_table *pt, int msec) { if (timeout > 0) { + rt_tick_t timeout_tick = timeout; rt_timer_control(&(thread->thread_timer), RT_TIMER_CTRL_SET_TIME, - &timeout); + &timeout_tick); rt_timer_start(&(thread->thread_timer)); rt_set_errno(RT_ETIMEOUT); } diff --git a/components/libc/posix/pthreads/pthread_cond.c b/components/libc/posix/pthreads/pthread_cond.c index caedec7601..69cad1fa2e 100644 --- a/components/libc/posix/pthreads/pthread_cond.c +++ b/components/libc/posix/pthreads/pthread_cond.c @@ -418,10 +418,11 @@ rt_err_t _pthread_cond_timedwait(pthread_cond_t *cond, /* has waiting time, start thread timer */ if (time > 0) { + rt_tick_t time_tick = time; /* reset the timeout of thread timer and start it */ rt_timer_control(&(thread->thread_timer), RT_TIMER_CTRL_SET_TIME, - &time); + &time_tick); rt_timer_start(&(thread->thread_timer)); } diff --git a/components/lwp/lwp_ipc.c b/components/lwp/lwp_ipc.c index f75597376d..b995188b0c 100644 --- a/components/lwp/lwp_ipc.c +++ b/components/lwp/lwp_ipc.c @@ -553,6 +553,7 @@ static rt_err_t _do_send_recv_timeout(rt_channel_t ch, rt_channel_msg_t data, in rt_thread_wakeup_set(thread_send, wakeup_sender_wait_recv, (void *)ch); if (time > 0) { + rt_tick_t time_tick = time; rt_timer_control(&(thread_send->thread_timer), RT_TIMER_CTRL_GET_FUNC, &old_timeout_func); @@ -562,7 +563,7 @@ static rt_err_t _do_send_recv_timeout(rt_channel_t ch, rt_channel_msg_t data, in /* reset the timeout of thread timer and start it */ rt_timer_control(&(thread_send->thread_timer), RT_TIMER_CTRL_SET_TIME, - &time); + &time_tick); rt_timer_start(&(thread_send->thread_timer)); } } @@ -597,6 +598,7 @@ static rt_err_t _do_send_recv_timeout(rt_channel_t ch, rt_channel_msg_t data, in rt_thread_wakeup_set(thread_send, wakeup_sender_wait_reply, (void *)ch); if (time > 0) { + rt_tick_t time_tick = time; rt_timer_control(&(thread_send->thread_timer), RT_TIMER_CTRL_GET_FUNC, &old_timeout_func); @@ -606,7 +608,7 @@ static rt_err_t _do_send_recv_timeout(rt_channel_t ch, rt_channel_msg_t data, in /* reset the timeout of thread timer and start it */ rt_timer_control(&(thread_send->thread_timer), RT_TIMER_CTRL_SET_TIME, - &time); + &time_tick); rt_timer_start(&(thread_send->thread_timer)); } } @@ -870,6 +872,7 @@ static rt_err_t _rt_raw_channel_recv_timeout(rt_channel_t ch, rt_channel_msg_t d thread->error = RT_EOK; if (time > 0) { + rt_tick_t time_tick = time; rt_timer_control(&(thread->thread_timer), RT_TIMER_CTRL_GET_FUNC, &old_timeout_func); @@ -879,7 +882,7 @@ static rt_err_t _rt_raw_channel_recv_timeout(rt_channel_t ch, rt_channel_msg_t d /* reset the timeout of thread timer and start it */ rt_timer_control(&(thread->thread_timer), RT_TIMER_CTRL_SET_TIME, - &time); + &time_tick); rt_timer_start(&(thread->thread_timer)); } rt_spin_unlock_irqrestore(&ch->slock, level); diff --git a/components/utilities/rt-link/src/rtlink.c b/components/utilities/rt-link/src/rtlink.c index 48d91fc94b..9c7bc1513c 100644 --- a/components/utilities/rt-link/src/rtlink.c +++ b/components/utilities/rt-link/src/rtlink.c @@ -302,7 +302,7 @@ static rt_err_t rt_link_frame_send(rt_slist_t *slist) } else { - rt_int32_t timeout = RT_LINK_SENT_FRAME_TIMEOUT; + rt_tick_t timeout = RT_LINK_SENT_FRAME_TIMEOUT; rt_timer_control(&rt_link_scb->sendtimer, RT_TIMER_CTRL_SET_TIME, &timeout); rt_timer_start(&rt_link_scb->sendtimer); } @@ -536,7 +536,7 @@ static void _long_handle_second(struct rt_link_frame *receive_frame) } else if (rt_link_hw_recv_len(rt_link_scb->rx_buffer) < (receive_frame->data_len % RT_LINK_MAX_DATA_LENGTH)) { - rt_int32_t timeout = RT_LINK_LONG_FRAME_TIMEOUT; + rt_tick_t timeout = RT_LINK_LONG_FRAME_TIMEOUT; rt_timer_control(&rt_link_scb->longframetimer, RT_TIMER_CTRL_SET_TIME, &timeout); rt_timer_start(&rt_link_scb->longframetimer); } @@ -879,7 +879,7 @@ static void rt_link_send_ready(void) rt_link_command_frame_send(RT_LINK_SERVICE_RTLINK, seq, RT_LINK_HANDSHAKE_FRAME, rt_link_scb->rx_record.rx_seq); - rt_int32_t timeout = 50; + rt_tick_t timeout = 50; rt_timer_control(&rt_link_scb->sendtimer, RT_TIMER_CTRL_SET_TIME, &timeout); rt_timer_start(&rt_link_scb->sendtimer); } diff --git a/components/vbus/prio_queue.c b/components/vbus/prio_queue.c index f7691f49cd..9c8dca5157 100644 --- a/components/vbus/prio_queue.c +++ b/components/vbus/prio_queue.c @@ -209,9 +209,10 @@ rt_err_t rt_prio_queue_pop(struct rt_prio_queue *que, if (timeout > 0) { + rt_tick_t timeout_tick = timeout; rt_timer_control(&(thread->thread_timer), RT_TIMER_CTRL_SET_TIME, - &timeout); + &timeout_tick); rt_timer_start(&(thread->thread_timer)); } diff --git a/components/vbus/vbus.c b/components/vbus/vbus.c index 46edd63a4f..2adaac8dda 100644 --- a/components/vbus/vbus.c +++ b/components/vbus/vbus.c @@ -339,9 +339,10 @@ rt_err_t rt_vbus_post(rt_uint8_t id, rt_list_insert_after(&_chn_suspended_threads[id], &RT_THREAD_LIST_NODE(thread)); if (timeout > 0) { + rt_tick_t timeout_tick = timeout; rt_timer_control(&(thread->thread_timer), RT_TIMER_CTRL_SET_TIME, - &timeout); + &timeout_tick); rt_timer_start(&(thread->thread_timer)); } /* rt_exit_critical will do schedule on need. */ diff --git a/components/vbus/watermark_queue.h b/components/vbus/watermark_queue.h index 2e659058dd..d03ef9eeba 100644 --- a/components/vbus/watermark_queue.h +++ b/components/vbus/watermark_queue.h @@ -67,9 +67,10 @@ rt_inline rt_err_t rt_wm_que_inc(struct rt_watermark_queue *wg, rt_list_insert_after(&wg->suspended_threads, &RT_THREAD_LIST_NODE(thread)); if (timeout > 0) { + rt_tick_t timeout_tick = timeout; rt_timer_control(&(thread->thread_timer), RT_TIMER_CTRL_SET_TIME, - &timeout); + &timeout_tick); rt_timer_start(&(thread->thread_timer)); } rt_hw_interrupt_enable(level); diff --git a/src/ipc.c b/src/ipc.c index fdf33b2e33..7c52956b1c 100644 --- a/src/ipc.c +++ b/src/ipc.c @@ -614,12 +614,13 @@ 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_tick_t timeout_tick = timeout; 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), RT_TIMER_CTRL_SET_TIME, - &timeout); + &timeout_tick); rt_timer_start(&(thread->thread_timer)); } @@ -1433,13 +1434,14 @@ 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_tick_t timeout_tick = timeout; 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), RT_TIMER_CTRL_SET_TIME, - &timeout); + &timeout_tick); rt_timer_start(&(thread->thread_timer)); } @@ -2186,10 +2188,11 @@ static rt_err_t _rt_event_recv(rt_event_t event, /* if there is a waiting timeout, active thread timer */ if (timeout > 0) { + rt_tick_t timeout_tick = timeout; /* reset the timeout of thread timer and start it */ rt_timer_control(&(thread->thread_timer), RT_TIMER_CTRL_SET_TIME, - &timeout); + &timeout_tick); rt_timer_start(&(thread->thread_timer)); } @@ -2621,6 +2624,7 @@ static rt_err_t _rt_mb_send_wait(rt_mailbox_t mb, /* has waiting time, start thread timer */ if (timeout > 0) { + rt_tick_t timeout_tick = timeout; /* get the start tick of timer */ tick_delta = rt_tick_get(); @@ -2630,7 +2634,7 @@ static rt_err_t _rt_mb_send_wait(rt_mailbox_t mb, /* reset the timeout of thread timer and start it */ rt_timer_control(&(thread->thread_timer), RT_TIMER_CTRL_SET_TIME, - &timeout); + &timeout_tick); rt_timer_start(&(thread->thread_timer)); } rt_spin_unlock_irqrestore(&(mb->spinlock), level); @@ -2901,6 +2905,7 @@ static rt_err_t _rt_mb_recv(rt_mailbox_t mb, rt_ubase_t *value, rt_int32_t timeo /* has waiting time, start thread timer */ if (timeout > 0) { + rt_tick_t timeout_tick = timeout; /* get the start tick of timer */ tick_delta = rt_tick_get(); @@ -2910,7 +2915,7 @@ static rt_err_t _rt_mb_recv(rt_mailbox_t mb, rt_ubase_t *value, rt_int32_t timeo /* reset the timeout of thread timer and start it */ rt_timer_control(&(thread->thread_timer), RT_TIMER_CTRL_SET_TIME, - &timeout); + &timeout_tick); rt_timer_start(&(thread->thread_timer)); } @@ -3446,6 +3451,7 @@ static rt_err_t _rt_mq_send_wait(rt_mq_t mq, /* has waiting time, start thread timer */ if (timeout > 0) { + rt_tick_t timeout_tick = timeout; /* get the start tick of timer */ tick_delta = rt_tick_get(); @@ -3455,7 +3461,7 @@ static rt_err_t _rt_mq_send_wait(rt_mq_t mq, /* reset the timeout of thread timer and start it */ rt_timer_control(&(thread->thread_timer), RT_TIMER_CTRL_SET_TIME, - &timeout); + &timeout_tick); rt_timer_start(&(thread->thread_timer)); } @@ -3825,6 +3831,7 @@ static rt_ssize_t _rt_mq_recv(rt_mq_t mq, /* has waiting time, start thread timer */ if (timeout > 0) { + rt_tick_t timeout_tick = timeout; /* get the start tick of timer */ tick_delta = rt_tick_get(); @@ -3834,7 +3841,7 @@ static rt_ssize_t _rt_mq_recv(rt_mq_t mq, /* reset the timeout of thread timer and start it */ rt_timer_control(&(thread->thread_timer), RT_TIMER_CTRL_SET_TIME, - &timeout); + &timeout_tick); rt_timer_start(&(thread->thread_timer)); } diff --git a/src/mempool.c b/src/mempool.c index d0308eb216..b980a08aa5 100644 --- a/src/mempool.c +++ b/src/mempool.c @@ -314,13 +314,14 @@ void *rt_mp_alloc(rt_mp_t mp, rt_int32_t time) if (time > 0) { + rt_tick_t time_tick = time; /* get the start tick of timer */ before_sleep = rt_tick_get(); /* init thread timer and start it */ rt_timer_control(&(thread->thread_timer), RT_TIMER_CTRL_SET_TIME, - &time); + &time_tick); rt_timer_start(&(thread->thread_timer)); } diff --git a/src/signal.c b/src/signal.c index d4a4e2ef4d..125f388b38 100644 --- a/src/signal.c +++ b/src/signal.c @@ -369,10 +369,11 @@ int rt_signal_wait(const rt_sigset_t *set, rt_siginfo_t *si, rt_int32_t timeout) /* start timeout timer */ if (timeout != RT_WAITING_FOREVER) { + rt_tick_t timeout_tick = timeout; /* reset the timeout of thread timer and start it */ rt_timer_control(&(tid->thread_timer), RT_TIMER_CTRL_SET_TIME, - &timeout); + &timeout_tick); rt_timer_start(&(tid->thread_timer)); } rt_spin_unlock_irqrestore(&_thread_signal_lock, level);