diff options
| author | Yuxin Zhou <[email protected]> | 2021-10-14 00:51:26 +0000 |
|---|---|---|
| committer | Yuxin Zhou <[email protected]> | 2021-10-14 00:51:26 +0000 |
| commit | 1af8404c54f9c8d3caa2ac3523c2a5f014aecb1c (patch) | |
| tree | 93e4f4d64ec8c21c01b77f19b8e7326e85227e3d /common_smp/src/tx_timer_deactivate.c | |
| parent | 215df45d4b59d4ce8606a88f566d1d426e64a84c (diff) | |
Release 6.1.9
Diffstat (limited to 'common_smp/src/tx_timer_deactivate.c')
| -rw-r--r-- | common_smp/src/tx_timer_deactivate.c | 102 |
1 files changed, 52 insertions, 50 deletions
diff --git a/common_smp/src/tx_timer_deactivate.c b/common_smp/src/tx_timer_deactivate.c index 9dd6bb5b..25175cc6 100644 --- a/common_smp/src/tx_timer_deactivate.c +++ b/common_smp/src/tx_timer_deactivate.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Timer */ /** */ @@ -30,55 +30,57 @@ #include "tx_timer.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_timer_deactivate PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_timer_deactivate PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function deactivates the specified application timer. */ -/* */ -/* INPUT */ -/* */ -/* timer_ptr Pointer to timer control block */ -/* */ -/* OUTPUT */ -/* */ -/* TX_SUCCESS Always returns success */ -/* */ -/* CALLS */ -/* */ -/* None */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function deactivates the specified application timer. */ +/* */ +/* INPUT */ +/* */ +/* timer_ptr Pointer to timer control block */ +/* */ +/* OUTPUT */ +/* */ +/* TX_SUCCESS Always returns success */ +/* */ +/* CALLS */ +/* */ +/* None */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ UINT _tx_timer_deactivate(TX_TIMER *timer_ptr) { TX_INTERRUPT_SAVE_AREA -TX_TIMER_INTERNAL *internal_ptr; +TX_TIMER_INTERNAL *internal_ptr; TX_TIMER_INTERNAL **list_head; -TX_TIMER_INTERNAL *next_timer; -TX_TIMER_INTERNAL *previous_timer; -ULONG ticks_left; +TX_TIMER_INTERNAL *next_timer; +TX_TIMER_INTERNAL *previous_timer; +ULONG ticks_left; UINT active_timer_list; - + /* Setup internal timer pointer. */ internal_ptr = &(timer_ptr -> tx_timer_internal); @@ -123,7 +125,7 @@ UINT active_timer_list; active_timer_list = TX_TRUE; } } - + /* Determine if the timer is on active timer list. */ if (active_timer_list == TX_TRUE) { @@ -137,7 +139,7 @@ UINT active_timer_list; if (TX_TIMER_INDIRECT_TO_VOID_POINTER_CONVERT(list_head) >= TX_TIMER_INDIRECT_TO_VOID_POINTER_CONVERT(_tx_timer_current_ptr)) { - /* Calculate ticks left to expiration - just the difference between this + /* Calculate ticks left to expiration - just the difference between this timer's entry and the current timer pointer. */ ticks_left = (ULONG) (TX_TIMER_POINTER_DIF(list_head,_tx_timer_current_ptr)) + ((ULONG) 1); } @@ -146,57 +148,57 @@ UINT active_timer_list; /* Calculate the ticks left with a wrapped list condition. */ ticks_left = (ULONG) (TX_TIMER_POINTER_DIF(list_head,_tx_timer_list_start)); - + ticks_left = ticks_left + (ULONG) ((TX_TIMER_POINTER_DIF(_tx_timer_list_end, _tx_timer_current_ptr)) + ((ULONG) 1)); } /* Adjust the remaining ticks accordingly. */ if (internal_ptr -> tx_timer_internal_remaining_ticks > TX_TIMER_ENTRIES) { - + /* Subtract off the last full pass through the timer list and add the time left. */ - internal_ptr -> tx_timer_internal_remaining_ticks = + internal_ptr -> tx_timer_internal_remaining_ticks = (internal_ptr -> tx_timer_internal_remaining_ticks - TX_TIMER_ENTRIES) + ticks_left; } else { - + /* Just put the ticks left into the timer's remaining ticks. */ internal_ptr -> tx_timer_internal_remaining_ticks = ticks_left; } } else { - + /* Determine if this is timer has just expired. */ if (_tx_timer_expired_timer_ptr != internal_ptr) { - + /* No, it hasn't expired. Now check for remaining time greater than the list size. */ if (internal_ptr -> tx_timer_internal_remaining_ticks > TX_TIMER_ENTRIES) { - + /* Adjust the remaining ticks. */ - internal_ptr -> tx_timer_internal_remaining_ticks = + internal_ptr -> tx_timer_internal_remaining_ticks = internal_ptr -> tx_timer_internal_remaining_ticks - TX_TIMER_ENTRIES; } else { - + /* Set the remaining time to the reactivation time. */ internal_ptr -> tx_timer_internal_remaining_ticks = internal_ptr -> tx_timer_internal_re_initialize_ticks; } } else { - + /* Set the remaining time to the reactivation time. */ internal_ptr -> tx_timer_internal_remaining_ticks = internal_ptr -> tx_timer_internal_re_initialize_ticks; - } - } - + } + } + /* Pickup the next timer. */ next_timer = internal_ptr -> tx_timer_internal_active_next; @@ -228,7 +230,7 @@ UINT active_timer_list; if (*(list_head) == internal_ptr) { - /* Update the next timer in the list with the list head + /* Update the next timer in the list with the list head pointer. */ next_timer -> tx_timer_internal_list_head = list_head; |
