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_expiration_process.c | |
| parent | 215df45d4b59d4ce8606a88f566d1d426e64a84c (diff) | |
Release 6.1.9
Diffstat (limited to 'common_smp/src/tx_timer_expiration_process.c')
| -rw-r--r-- | common_smp/src/tx_timer_expiration_process.c | 148 |
1 files changed, 74 insertions, 74 deletions
diff --git a/common_smp/src/tx_timer_expiration_process.c b/common_smp/src/tx_timer_expiration_process.c index 235d82ca..de91ea8a 100644 --- a/common_smp/src/tx_timer_expiration_process.c +++ b/common_smp/src/tx_timer_expiration_process.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Timer */ /** */ @@ -30,45 +30,45 @@ #include "tx_thread.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_timer_expiration_process PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_timer_expiration_process PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function processes thread and application timer expirations. */ -/* It is called from the _tx_timer_interrupt handler and either */ -/* processes the timer expiration in the ISR or defers to the system */ -/* timer thread. The actual processing is determined during */ -/* compilation. */ -/* */ -/* INPUT */ -/* */ -/* None */ -/* */ -/* OUTPUT */ -/* */ -/* None */ -/* */ -/* CALLS */ -/* */ -/* _tx_thread_system_resume Thread resume processing */ -/* _tx_thread_system_ni_resume Non-interruptable resume thread */ -/* _tx_timer_system_activate Timer reactivate processing */ -/* Timer Expiration Function */ -/* */ -/* CALLED BY */ -/* */ -/* _tx_timer_interrupt Timer interrupt handler */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function processes thread and application timer expirations. */ +/* It is called from the _tx_timer_interrupt handler and either */ +/* processes the timer expiration in the ISR or defers to the system */ +/* timer thread. The actual processing is determined during */ +/* compilation. */ +/* */ +/* INPUT */ +/* */ +/* None */ +/* */ +/* OUTPUT */ +/* */ +/* None */ +/* */ +/* CALLS */ +/* */ +/* _tx_thread_system_resume Thread resume processing */ +/* _tx_thread_system_ni_resume Non-interruptable resume thread */ +/* _tx_timer_system_activate Timer reactivate processing */ +/* Timer Expiration Function */ +/* */ +/* CALLED BY */ +/* */ +/* _tx_timer_interrupt Timer interrupt handler */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ /* 09-30-2020 William E. Lamie Initial Version 6.1 */ @@ -81,8 +81,8 @@ TX_INTERRUPT_SAVE_AREA #ifdef TX_TIMER_PROCESS_IN_ISR -TX_TIMER_INTERNAL *expired_timers; -TX_TIMER_INTERNAL *reactivate_timer; +TX_TIMER_INTERNAL *expired_timers; +TX_TIMER_INTERNAL *reactivate_timer; TX_TIMER_INTERNAL *next_timer; TX_TIMER_INTERNAL *previous_timer; #ifdef TX_REACTIVATE_INLINE @@ -90,9 +90,9 @@ TX_TIMER_INTERNAL **timer_list; /* Timer list pointer UINT expiration_time; /* Value used for pointer offset*/ ULONG delta; #endif -TX_TIMER_INTERNAL *current_timer; -VOID (*timeout_function)(ULONG id); -ULONG timeout_param = ((ULONG) 0); +TX_TIMER_INTERNAL *current_timer; +VOID (*timeout_function)(ULONG id); +ULONG timeout_param = ((ULONG) 0); #ifdef TX_TIMER_ENABLE_PERFORMANCE_INFO TX_TIMER *timer_ptr; #endif @@ -100,7 +100,7 @@ TX_TIMER *timer_ptr; #ifndef TX_TIMER_PROCESS_IN_ISR - /* Don't process in the ISR, wakeup the system timer thread to process the + /* Don't process in the ISR, wakeup the system timer thread to process the timer expiration. */ /* Disable interrupts. */ @@ -127,8 +127,8 @@ TX_TIMER *timer_ptr; #else - /* Process the timer expiration directly in the ISR. This increases the interrupt - processing, however, it eliminates the need for a system timer thread and associated + /* Process the timer expiration directly in the ISR. This increases the interrupt + processing, however, it eliminates the need for a system timer thread and associated resources. */ /* Disable interrupts. */ @@ -146,7 +146,7 @@ TX_TIMER *timer_ptr; { /* Proceed with timer processing. */ - + /* Set the timer interrupt processing active flag. */ _tx_timer_processing_active = TX_TRUE; @@ -154,7 +154,7 @@ TX_TIMER *timer_ptr; do { - /* First, move the current list pointer and clear the timer + /* First, move the current list pointer and clear the timer expired value. This allows the interrupt handling portion to continue looking for timer expirations. */ @@ -165,19 +165,19 @@ TX_TIMER *timer_ptr; is one! */ if (expired_timers != TX_NULL) { - + expired_timers -> tx_timer_internal_list_head = &expired_timers; } /* Set the current list pointer to NULL. */ *_tx_timer_current_ptr = TX_NULL; - /* Move the current pointer up one timer entry wrap if we get to + /* Move the current pointer up one timer entry wrap if we get to the end of the list. */ _tx_timer_current_ptr = TX_TIMER_POINTER_ADD(_tx_timer_current_ptr, 1); if (_tx_timer_current_ptr == _tx_timer_list_end) { - + _tx_timer_current_ptr = _tx_timer_list_start; } @@ -197,19 +197,19 @@ TX_TIMER *timer_ptr; /* Something is on the list. Remove it and process the expiration. */ current_timer = expired_timers; - + /* Pickup the next timer. */ next_timer = expired_timers -> tx_timer_internal_active_next; - + /* Set the reactivate timer to NULL. */ reactivate_timer = TX_NULL; /* Determine if this is the only timer. */ if (current_timer == next_timer) - { + { /* Yes, this is the only timer in the list. */ - + /* Set the head pointer to NULL. */ expired_timers = TX_NULL; } @@ -217,7 +217,7 @@ TX_TIMER *timer_ptr; { /* No, not the only expired timer. */ - + /* Remove this timer from the expired list. */ previous_timer = current_timer -> tx_timer_internal_active_previous; next_timer -> tx_timer_internal_active_previous = previous_timer; @@ -232,7 +232,7 @@ TX_TIMER *timer_ptr; /* In any case, the timer is now off of the expired list. */ - /* Determine if the timer has expired or if it is just a really + /* Determine if the timer has expired or if it is just a really big timer that needs to be placed in the list again. */ if (current_timer -> tx_timer_internal_remaining_ticks > TX_TIMER_ENTRIES) { @@ -248,25 +248,25 @@ TX_TIMER *timer_ptr; /* Determine if this is an application timer. */ if (current_timer -> tx_timer_internal_timeout_function != &_tx_thread_timeout) { - + /* Derive the application timer pointer. */ - + /* Pickup the application timer pointer. */ TX_USER_TIMER_POINTER_GET(current_timer, timer_ptr) /* Increment the number of expiration adjustments on this timer. */ if (timer_ptr -> tx_timer_id == TX_TIMER_ID) { - + timer_ptr -> tx_timer_performance__expiration_adjust_count++; } } #endif /* Decrement the remaining ticks of the timer. */ - current_timer -> tx_timer_internal_remaining_ticks = + current_timer -> tx_timer_internal_remaining_ticks = current_timer -> tx_timer_internal_remaining_ticks - TX_TIMER_ENTRIES; - + /* Set the timeout function to NULL in order to bypass the expiration. */ timeout_function = TX_NULL; @@ -283,8 +283,8 @@ TX_TIMER *timer_ptr; else { - /* Timer did expire. */ - + /* Timer did expire. */ + #ifdef TX_TIMER_ENABLE_PERFORMANCE_INFO /* Increment the total expirations counter. */ @@ -293,22 +293,22 @@ TX_TIMER *timer_ptr; /* Determine if this is an application timer. */ if (current_timer -> tx_timer_internal_timeout_function != &_tx_thread_timeout) { - + /* Derive the application timer pointer. */ - + /* Pickup the application timer pointer. */ TX_USER_TIMER_POINTER_GET(current_timer, timer_ptr) /* Increment the number of expirations on this timer. */ if (timer_ptr -> tx_timer_id == TX_TIMER_ID) { - + timer_ptr -> tx_timer_performance_expiration_count++; } } #endif - /* Copy the calling function and ID into local variables before interrupts + /* Copy the calling function and ID into local variables before interrupts are re-enabled. */ timeout_function = current_timer -> tx_timer_internal_timeout_function; timeout_param = current_timer -> tx_timer_internal_timeout_param; @@ -321,7 +321,7 @@ TX_TIMER *timer_ptr; { /* Make the timer appear that it is still active while processing - the expiration routine and with interrupts enabled. This will + the expiration routine and with interrupts enabled. This will permit proper processing of a timer deactivate from both the expiration routine and an ISR. */ current_timer -> tx_timer_internal_list_head = &reactivate_timer; @@ -348,7 +348,7 @@ TX_TIMER *timer_ptr; /* Call the timer-expiration function, if non-NULL. */ if (timeout_function != TX_NULL) { - + (timeout_function) (timeout_param); } @@ -376,16 +376,16 @@ TX_TIMER *timer_ptr; /* Determine if this is an application timer. */ if (current_timer -> tx_timer_internal_timeout_function != &_tx_thread_timeout) { - + /* Derive the application timer pointer. */ - + /* Pickup the application timer pointer. */ TX_USER_TIMER_POINTER_GET(current_timer, timer_ptr) /* Increment the number of expirations on this timer. */ if (timer_ptr -> tx_timer_id == TX_TIMER_ID) { - + timer_ptr -> tx_timer_performance_reactivate_count++; } } @@ -413,7 +413,7 @@ TX_TIMER *timer_ptr; /* At this point, we are ready to put the timer back on one of the timer lists. */ - + /* Calculate the proper place for the timer. */ timer_list = TX_TIMER_POINTER_ADD(_tx_timer_current_ptr, expiration_time); if (TX_TIMER_INDIRECT_TO_VOID_POINTER_CONVERT(timer_list) >= TX_TIMER_INDIRECT_TO_VOID_POINTER_CONVERT(_tx_timer_list_end)) @@ -427,13 +427,13 @@ TX_TIMER *timer_ptr; /* Now put the timer on this list. */ if ((*timer_list) == TX_NULL) { - + /* This list is NULL, just put the new timer on it. */ /* Setup the links in this timer. */ current_timer -> tx_timer_internal_active_next = current_timer; current_timer -> tx_timer_internal_active_previous = current_timer; - + /* Setup the list head pointer. */ *timer_list = current_timer; } @@ -469,7 +469,7 @@ TX_TIMER *timer_ptr; _tx_timer_processing_active = TX_FALSE; } } - + /* Restore interrupts. */ TX_RESTORE #endif |
