1
10
13
14
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
120
127
128
130
137
138
139
145
146
147
148
149
150
151
155
156
157
158
159
160
161
162
163
167
168
169
170
171
172
173
174
180
181
182
183
184
185
186
187
188
189
190
191
197
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
259
260
261
262
263
292
293
...
...
...
#define TX_SOURCE_CODE
#include "tx_api.h"
#include "tx_trace.h"
...
...
VOID _tx_trace_object_register(UCHAR object_type, VOID *object_ptr, CHAR *object_name, ULONG parameter_1, ULONG parameter_2)
{
#ifdef TX_ENABLE_EVENT_TRACE
UINT i, entries;
UINT found, loop_break;
TX_THREAD *thread_ptr;
UCHAR *work_ptr;
TX_TRACE_OBJECT_ENTRY *entry_ptr;
if (_tx_trace_registry_start_ptr != TX_NULL)
{
entries = _tx_trace_total_registry_entries;
if (_tx_trace_available_registry_entries != ((ULONG) 0))
{
found = entries;
loop_break = TX_FALSE;
i = _tx_trace_registry_search_start;
do
{
work_ptr = TX_OBJECT_TO_UCHAR_POINTER_CONVERT(_tx_trace_registry_start_ptr);
work_ptr = TX_UCHAR_POINTER_ADD(work_ptr, ((sizeof(TX_TRACE_OBJECT_ENTRY))*i));
entry_ptr = TX_UCHAR_TO_OBJECT_POINTER_CONVERT(work_ptr);
/* ... */
if (entry_ptr -> tx_trace_object_entry_thread_pointer == (ULONG) 0)
{
found = i;
loop_break = TX_TRUE;
}if (entry_ptr -> tx_trace_object_entry_thread_pointer == (ULONG) 0) { ... }
/* ... */
if (entry_ptr -> tx_trace_object_entry_thread_pointer == TX_POINTER_TO_ULONG_CONVERT(object_ptr))
{
found = i;
loop_break = TX_TRUE;
}if (entry_ptr -> tx_trace_object_entry_thread_pointer == TX_POINTER_TO_ULONG_CONVERT(object_ptr)) { ... }
if (loop_break == TX_TRUE)
{
break;
}if (loop_break == TX_TRUE) { ... }
if (entry_ptr -> tx_trace_object_entry_available == TX_TRUE)
{
if (found == entries)
{
found = i;
}if (found == entries) { ... }
else
{
work_ptr = TX_OBJECT_TO_UCHAR_POINTER_CONVERT(_tx_trace_registry_start_ptr);
work_ptr = TX_UCHAR_POINTER_ADD(work_ptr, ((sizeof(TX_TRACE_OBJECT_ENTRY))*found));
entry_ptr = TX_UCHAR_TO_OBJECT_POINTER_CONVERT(work_ptr);
if (entry_ptr -> tx_trace_object_entry_type != ((UCHAR) 0))
{
found = i;
}if (entry_ptr -> tx_trace_object_entry_type != ((UCHAR) 0)) { ... }
}else { ... }
}if (entry_ptr -> tx_trace_object_entry_available == TX_TRUE) { ... }
i++;
if (i >= entries)
{
i = ((ULONG) 0);
}if (i >= entries) { ... }
...} while (i != _tx_trace_registry_search_start);
if (found < entries)
{
_tx_trace_available_registry_entries--;
if ((found + ((ULONG) 1)) < entries)
{
_tx_trace_registry_search_start = found + ((ULONG) 1);
}if ((found + ((ULONG) 1)) < entries) { ... }
else
{
_tx_trace_registry_search_start = ((ULONG) 0);
}else { ... }
work_ptr = TX_OBJECT_TO_UCHAR_POINTER_CONVERT(_tx_trace_registry_start_ptr);
work_ptr = TX_UCHAR_POINTER_ADD(work_ptr, ((sizeof(TX_TRACE_OBJECT_ENTRY))*found));
entry_ptr = TX_UCHAR_TO_OBJECT_POINTER_CONVERT(work_ptr);
entry_ptr -> tx_trace_object_entry_available = ((UCHAR) TX_FALSE);
entry_ptr -> tx_trace_object_entry_type = object_type;
entry_ptr -> tx_trace_object_entry_thread_pointer = TX_POINTER_TO_ULONG_CONVERT(object_ptr);
entry_ptr -> tx_trace_object_entry_param_1 = parameter_1;
entry_ptr -> tx_trace_object_entry_param_2 = parameter_2;
for (i = ((ULONG) 0); i < (((ULONG) TX_TRACE_OBJECT_REGISTRY_NAME)-((ULONG) 1)); i++)
{
work_ptr = TX_CHAR_TO_UCHAR_POINTER_CONVERT(object_name);
work_ptr = TX_UCHAR_POINTER_ADD(work_ptr, i);
entry_ptr -> tx_trace_object_entry_name[i] = (UCHAR) *work_ptr;
if (*work_ptr == ((UCHAR) 0))
{
break;
}if (*work_ptr == ((UCHAR) 0)) { ... }
}for (i = ((ULONG) 0); i < (((ULONG) TX_TRACE_OBJECT_REGISTRY_NAME)-((ULONG) 1)); i++) { ... }
entry_ptr -> tx_trace_object_entry_name[i] = (UCHAR) 0;
if (object_type == TX_TRACE_OBJECT_TYPE_THREAD)
{
thread_ptr = TX_VOID_TO_THREAD_POINTER_CONVERT(object_ptr);
entry_ptr -> tx_trace_object_entry_reserved1 = ((UCHAR) 0x80) | ((UCHAR) (thread_ptr -> tx_thread_priority >> ((UCHAR) 8)));
entry_ptr -> tx_trace_object_entry_reserved2 = (UCHAR) (thread_ptr -> tx_thread_priority & ((UCHAR) 0xFF));
}if (object_type == TX_TRACE_OBJECT_TYPE_THREAD) { ... }
else
{
entry_ptr -> tx_trace_object_entry_reserved1 = ((UCHAR) 0);
entry_ptr -> tx_trace_object_entry_reserved2 = ((UCHAR) 0);
}else { ... }
}if (found < entries) { ... }
}if (_tx_trace_available_registry_entries != ((ULONG) 0)) { ... }
}if (_tx_trace_registry_start_ptr != TX_NULL) { ... }
/* ... */#else
TX_INTERRUPT_SAVE_AREA
if (object_type != ((UCHAR) 0))
{
if (object_ptr != TX_NULL)
{
if (object_name != TX_NULL)
{
if (parameter_1 != ((ULONG) 0))
{
if (parameter_2 != ((ULONG) 0))
{
TX_DISABLE
TX_RESTORE
}if (parameter_2 != ((ULONG) 0)) { ... }
}if (parameter_1 != ((ULONG) 0)) { ... }
}if (object_name != TX_NULL) { ... }
}if (object_ptr != TX_NULL) { ... }
}if (object_type != ((UCHAR) 0)) { ... }
/* ... */#endif
}{ ... }