diff --git a/kernel/microkernel/include/minik.h b/kernel/microkernel/include/minik.h index 49422014833..da3054bbdaf 100644 --- a/kernel/microkernel/include/minik.h +++ b/kernel/microkernel/include/minik.h @@ -73,9 +73,11 @@ extern struct nano_lifo _k_timer_free; extern void _k_timer_enlist(struct k_timer *T); extern void _k_timer_delist(struct k_timer *T); -extern void enlist_timeout(struct k_args *P); -extern void delist_timeout(struct k_timer *T); -extern void force_timeout(struct k_args *A); + +extern void _k_timeout_alloc(struct k_args *P); +extern void _k_timeout_free(struct k_timer *T); +extern void _k_timeout_cancel(struct k_args *A); + extern void _k_timer_list_update(int ticks); extern void _k_do_event_signal(kevent_t event); diff --git a/kernel/microkernel/k_event.c b/kernel/microkernel/k_event.c index 3e94a7abbff..fa13fa96157 100644 --- a/kernel/microkernel/k_event.c +++ b/kernel/microkernel/k_event.c @@ -148,7 +148,7 @@ void _k_event_test(struct k_args *A) A->Time.timer = NULL; } else { A->Comm = EVENT_TMO; - enlist_timeout(A); + _k_timeout_alloc(A); } #endif } else { @@ -217,7 +217,7 @@ void _k_do_event_signal(kevent_t event) if (((A) != NULL) && (E->status != 0)) { #ifdef CONFIG_SYS_CLOCK_EXISTS if (A->Time.timer != NULL) { - delist_timeout(A->Time.timer); + _k_timeout_free(A->Time.timer); A->Comm = NOP; } #endif diff --git a/kernel/microkernel/k_mbox.c b/kernel/microkernel/k_mbox.c index 7dc2aabe983..cd9422226b9 100644 --- a/kernel/microkernel/k_mbox.c +++ b/kernel/microkernel/k_mbox.c @@ -460,7 +460,7 @@ void _k_mbox_send_request(struct k_args *Writer) * This is a wait with timeout operation. * Enlist a new timeout. */ - enlist_timeout(CopyWriter); + _k_timeout_alloc(CopyWriter); } #endif } else { @@ -676,7 +676,7 @@ void _k_mbox_receive_request(struct k_args *Reader) * This is a wait with timeout operation. * Enlist a new timeout. */ - enlist_timeout(CopyReader); + _k_timeout_alloc(CopyReader); } #endif } else { diff --git a/kernel/microkernel/k_memmap.c b/kernel/microkernel/k_memmap.c index 8351a03851c..88e81684b31 100644 --- a/kernel/microkernel/k_memmap.c +++ b/kernel/microkernel/k_memmap.c @@ -79,7 +79,7 @@ void _k_mem_map_init(void) void _k_mem_map_alloc_timeout(struct k_args *A) { - delist_timeout(A->Time.timer); + _k_timeout_free(A->Time.timer); REMOVE_ELM(A); A->Time.rcode = RC_TIME; _k_state_bit_reset(A->Ctxt.proc, TF_ALLO); @@ -123,7 +123,7 @@ void _k_mem_map_alloc(struct k_args *A) A->Time.timer = NULL; else { A->Comm = ALLOCTMO; - enlist_timeout(A); + _k_timeout_alloc(A); } #endif } else @@ -178,7 +178,7 @@ void _k_mem_map_dealloc(struct k_args *A) #ifdef CONFIG_SYS_CLOCK_EXISTS if (X->Time.timer) { - delist_timeout(X->Time.timer); + _k_timeout_free(X->Time.timer); X->Comm = NOP; } #endif diff --git a/kernel/microkernel/k_mempool.c b/kernel/microkernel/k_mempool.c index 7857aa75071..22b2285887a 100644 --- a/kernel/microkernel/k_mempool.c +++ b/kernel/microkernel/k_mempool.c @@ -455,7 +455,7 @@ void _k_block_waiters_get(struct k_args *A) #ifdef CONFIG_SYS_CLOCK_EXISTS if (curr_task->Time.timer) { - delist_timeout(curr_task->Time.timer); + _k_timeout_free(curr_task->Time.timer); } #endif curr_task->Time.rcode = RC_OK; @@ -487,7 +487,7 @@ void _k_block_waiters_get(struct k_args *A) void _k_mem_pool_block_get_timeout_handle(struct k_args *A) { - delist_timeout(A->Time.timer); + _k_timeout_free(A->Time.timer); REMOVE_ELM(A); A->Time.rcode = RC_TIME; _k_state_bit_reset(A->Ctxt.proc, TF_GTBL); @@ -546,7 +546,7 @@ void _k_mem_pool_block_get(struct k_args *A) A->Time.timer = NULL; } else { A->Comm = GTBLTMO; - enlist_timeout(A); + _k_timeout_alloc(A); } #endif } else { diff --git a/kernel/microkernel/k_mutex.c b/kernel/microkernel/k_mutex.c index c00c71014d3..79f81524041 100644 --- a/kernel/microkernel/k_mutex.c +++ b/kernel/microkernel/k_mutex.c @@ -229,7 +229,7 @@ void _k_mutex_lock_request(struct k_args *A /* pointer to mutex lock * the request time out. */ A->Comm = LOCK_TMO; - enlist_timeout(A); + _k_timeout_alloc(A); } #endif if (A->Prio < Mutex->OwnerCurrentPrio) { @@ -364,7 +364,7 @@ void _k_mutex_unlock(struct k_args *A /* pointer to mutex unlock * Trigger a call to _k_mutex_lock_reply()--it will * send a reply with a return code of RC_OK. */ - force_timeout(X); + _k_timeout_cancel(X); X->Comm = LOCK_RPL; } else { #endif diff --git a/kernel/microkernel/k_pipe_get.c b/kernel/microkernel/k_pipe_get.c index 24aeb9bd8f5..1fac2db665b 100644 --- a/kernel/microkernel/k_pipe_get.c +++ b/kernel/microkernel/k_pipe_get.c @@ -166,7 +166,7 @@ void K_ChRecvReq(struct k_args *RequestOrig) } else #endif /* enlist a new timer into the timeout chain */ - enlist_timeout(RequestProc); + _k_timeout_alloc(RequestProc); return; } diff --git a/kernel/microkernel/k_pipe_put.c b/kernel/microkernel/k_pipe_put.c index 9b7b106d259..1a9deb25908 100644 --- a/kernel/microkernel/k_pipe_put.c +++ b/kernel/microkernel/k_pipe_put.c @@ -184,7 +184,7 @@ void K_ChSendReq(struct k_args *RequestOrig) } else #endif /* enlist a new timer into the timeout chain */ - enlist_timeout(RequestProc); + _k_timeout_alloc(RequestProc); return; } diff --git a/kernel/microkernel/k_queue.c b/kernel/microkernel/k_queue.c index 2fbdb01557b..dfe2e5a1f1a 100644 --- a/kernel/microkernel/k_queue.c +++ b/kernel/microkernel/k_queue.c @@ -88,7 +88,7 @@ void _k_fifo_enque_request(struct k_args *A) #ifdef CONFIG_SYS_CLOCK_EXISTS if (W->Time.timer) { - force_timeout(W); + _k_timeout_cancel(W); W->Comm = DEQ_RPL; } else { #endif @@ -128,7 +128,7 @@ void _k_fifo_enque_request(struct k_args *A) A->Time.timer = NULL; else { A->Comm = ENQ_TMO; - enlist_timeout(A); + _k_timeout_alloc(A); } #endif } else { @@ -231,7 +231,7 @@ void _k_fifo_deque_request(struct k_args *A) #ifdef CONFIG_SYS_CLOCK_EXISTS if (W->Time.timer) { - force_timeout(W); + _k_timeout_cancel(W); W->Comm = ENQ_RPL; } else { #endif @@ -257,7 +257,7 @@ void _k_fifo_deque_request(struct k_args *A) A->Time.timer = NULL; else { A->Comm = DEQ_TMO; - enlist_timeout(A); + _k_timeout_alloc(A); } #endif } else { @@ -317,7 +317,7 @@ void _k_fifo_ioctl(struct k_args *A) Q->Waiters = X->Forw; #ifdef CONFIG_SYS_CLOCK_EXISTS if (likely(X->Time.timer)) { - force_timeout(X); + _k_timeout_cancel(X); X->Comm = ENQ_RPL; } else { #endif diff --git a/kernel/microkernel/k_sema.c b/kernel/microkernel/k_sema.c index 1ab6186e79e..016e14370ff 100644 --- a/kernel/microkernel/k_sema.c +++ b/kernel/microkernel/k_sema.c @@ -71,7 +71,7 @@ static void signal_semaphore(int n, struct sem_struct *S) } #ifdef CONFIG_SYS_CLOCK_EXISTS if (A->Time.timer) { - force_timeout(A); + _k_timeout_cancel(A); A->Comm = WAITSRPL; } else { #endif @@ -267,7 +267,7 @@ void _k_sem_group_ready(struct k_args *R) A->Comm = WAITMTMO; #ifdef CONFIG_SYS_CLOCK_EXISTS if (A->Time.timer) { - force_timeout(A); + _k_timeout_cancel(A); } else #endif _k_sem_group_wait_timeout(A); @@ -382,7 +382,7 @@ void _k_sem_group_wait_any(struct k_args *A) A->Time.timer = NULL; } else { A->Comm = WAITMTMO; - enlist_timeout(A); + _k_timeout_alloc(A); } } #endif @@ -416,7 +416,7 @@ void _k_sem_wait_request(struct k_args *A) A->Time.timer = NULL; } else { A->Comm = WAITSTMO; - enlist_timeout(A); + _k_timeout_alloc(A); } #endif return; diff --git a/kernel/microkernel/k_timer.c b/kernel/microkernel/k_timer.c index ccbd07a2dd2..b829590d869 100644 --- a/kernel/microkernel/k_timer.c +++ b/kernel/microkernel/k_timer.c @@ -136,12 +136,14 @@ void _k_timer_delist(struct k_timer *T) /******************************************************************************* * -* enlist_timeout - allocate and insert a timer into the timer queue +* _k_timeout_alloc - allocate timer used for command packet timeout +* +* Allocates timer for command packet and inserts it into the timer queue. * * RETURNS: N/A */ -void enlist_timeout(struct k_args *P) +void _k_timeout_alloc(struct k_args *P) { struct k_timer *T; @@ -155,12 +157,18 @@ void enlist_timeout(struct k_args *P) /******************************************************************************* * -* force_timeout - remove a non-expired timer from the timer queue +* _k_timeout_cancel - cancel timer used for command packet timeout * +* Cancels timer (if not already expired), then reschedules the command packet +* for further processing. +* +* The command that is processed following cancellation is typically NOT the +* command that would have occurred had the timeout expired on its own. +* * RETURNS: N/A */ -void force_timeout(struct k_args *A) +void _k_timeout_cancel(struct k_args *A) { struct k_timer *T = A->Time.timer; @@ -172,12 +180,14 @@ void force_timeout(struct k_args *A) /******************************************************************************* * -* delist_timeout - remove a non-expired timer from the timer queue and free it +* _k_timeout_free - free timer used for command packet timeout +* +* Cancels timer (if not already expired), then frees it. * * RETURNS: N/A */ -void delist_timeout(struct k_timer *T) +void _k_timeout_free(struct k_timer *T) { if (T->duration != -1) _k_timer_delist(T);