Select one of the symbols to view example projects that use it.
 
Outline
...
...
...
#define TX_SOURCE_CODE
#include "tx_api.h"
#include "tx_timer.h"
...
...
_tx_timer_system_activate(TX_TIMER_INTERNAL *)
Files
loading...
CodeScopeSTM32 Libraries and Samplesthreadxcommon/src/tx_timer_system_activate.c
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
/**************************************************************************/ /* */ /* Copyright (c) Microsoft Corporation. All rights reserved. */ /* */ /* This software is licensed under the Microsoft Software License */ /* Terms for Microsoft Azure RTOS. Full text of the license can be */ /* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ /* and in the root directory of this software. */ /* */... /**************************************************************************/ ... /**************************************************************************/ /**************************************************************************/ /** */ /** ThreadX Component */ /** */ /** Timer */ /** */... /**************************************************************************/ /**************************************************************************/ #define TX_SOURCE_CODE #ifndef TX_NO_TIMER /* Include necessary system files. */ #include "tx_api.h" #include "tx_timer.h" /**************************************************************************/ /* */ /* FUNCTION RELEASE */ /* */ /* _tx_timer_system_activate PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ /* */ /* This function places the specified internal timer in the proper */ /* place in the timer expiration list. If the timer is already active */ /* this function does nothing. */ /* */ /* INPUT */ /* */ /* timer_ptr Pointer to timer control block */ /* */ /* OUTPUT */ /* */ /* TX_SUCCESS Always returns success */ /* */ /* CALLS */ /* */ /* None */ /* */ /* CALLED BY */ /* */ /* _tx_thread_system_suspend Thread suspend function */ /* _tx_thread_system_ni_suspend Non-interruptable suspend thread */ /* _tx_timer_thread_entry Timer thread processing */ /* _tx_timer_activate Application timer activate */ /* */ /* RELEASE HISTORY */ /* */ /* DATE NAME DESCRIPTION */ /* */ /* 05-19-2020 William E. Lamie Initial Version 6.0 */ /* 09-30-2020 Scott Larson Modified comment(s), and */ /* opt out of function when */ /* TX_NO_TIMER is defined, */ /* resulting in version 6.1 */ /* */... /**************************************************************************/ VOID _tx_timer_system_activate(TX_TIMER_INTERNAL *timer_ptr) { TX_TIMER_INTERNAL **timer_list; TX_TIMER_INTERNAL *next_timer; TX_TIMER_INTERNAL *previous_timer; ULONG delta; ULONG remaining_ticks; ULONG expiration_time; /* Pickup the remaining ticks. */ remaining_ticks = timer_ptr -> tx_timer_internal_remaining_ticks; /* Determine if there is a timer to activate. */ if (remaining_ticks != ((ULONG) 0)) { /* Determine if the timer is set to wait forever. */ if (remaining_ticks != TX_WAIT_FOREVER) { /* Valid timer activate request. */ /* Determine if the timer still needs activation. */ if (timer_ptr -> tx_timer_internal_list_head == TX_NULL) { /* Activate the timer. */ /* Calculate the amount of time remaining for the timer. */ if (remaining_ticks > TX_TIMER_ENTRIES) { /* Set expiration time to the maximum number of entries. */ expiration_time = TX_TIMER_ENTRIES - ((ULONG) 1); }if (remaining_ticks > TX_TIMER_ENTRIES) { ... } else { /* Timer value fits in the timer entries. */ /* Set the expiration time. */ expiration_time = (remaining_ticks - ((ULONG) 1)); }else { ... } /* At this point, we are ready to put the timer 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)) { /* Wrap from the beginning of the list. */ delta = TX_TIMER_POINTER_DIF(timer_list, _tx_timer_list_end); timer_list = TX_TIMER_POINTER_ADD(_tx_timer_list_start, delta); }if (TX_TIMER_INDIRECT_TO_VOID_POINTER_CONVERT(timer_list) >= TX_TIMER_INDIRECT_TO_VOID_POINTER_CONVERT(_tx_timer_list_end)) { ... } /* 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. */ timer_ptr -> tx_timer_internal_active_next = timer_ptr; timer_ptr -> tx_timer_internal_active_previous = timer_ptr; /* Setup the list head pointer. */ *timer_list = timer_ptr; }if ((*timer_list) == TX_NULL) { ... } else { /* This list is not NULL, add current timer to the end. */ next_timer = *timer_list; previous_timer = next_timer -> tx_timer_internal_active_previous; previous_timer -> tx_timer_internal_active_next = timer_ptr; next_timer -> tx_timer_internal_active_previous = timer_ptr; timer_ptr -> tx_timer_internal_active_next = next_timer; timer_ptr -> tx_timer_internal_active_previous = previous_timer; }else { ... } /* Setup list head pointer. */ timer_ptr -> tx_timer_internal_list_head = timer_list; }if (timer_ptr -> tx_timer_internal_list_head == TX_NULL) { ... } }if (remaining_ticks != TX_WAIT_FOREVER) { ... } }if (remaining_ticks != ((ULONG) 0)) { ... } }{ ... } ...#endif/* ... */