1 /***************************************************************************
2  * Copyright (c) 2024 Microsoft Corporation
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the MIT License which is available at
6  * https://opensource.org/licenses/MIT.
7  *
8  * SPDX-License-Identifier: MIT
9  **************************************************************************/
10 
11 
12 /**************************************************************************/
13 /**************************************************************************/
14 /**                                                                       */
15 /** ThreadX Component                                                     */
16 /**                                                                       */
17 /**   ThreadX/GHS Event Log (EL)                                          */
18 /**                                                                       */
19 /**************************************************************************/
20 /**************************************************************************/
21 
22 
23 /**************************************************************************/
24 /*                                                                        */
25 /*  COMPONENT DEFINITION                                   RELEASE        */
26 /*                                                                        */
27 /*    tx_el.h                                          PORTABLE C/GHS     */
28 /*                                                           6.1          */
29 /*  AUTHOR                                                                */
30 /*                                                                        */
31 /*    William E. Lamie, Microsoft Corporation                             */
32 /*                                                                        */
33 /*  DESCRIPTION                                                           */
34 /*                                                                        */
35 /*    This file defines the ThreadX event log functions for the GHS MULTI */
36 /*    EventAnalyzer.  It is assumed that tx_api.h and tx_port.h have      */
37 /*    already been included.                                              */
38 /*                                                                        */
39 /*  RELEASE HISTORY                                                       */
40 /*                                                                        */
41 /*    DATE              NAME                      DESCRIPTION             */
42 /*                                                                        */
43 /*  09-30-2020     William E. Lamie         Initial Version 6.1           */
44 /*                                                                        */
45 /**************************************************************************/
46 
47 #ifndef TX_EL_H
48 #define TX_EL_H
49 
50 
51 /* Define Event Log specific data definitions.  */
52 
53 #define TX_EL_VERSION_ID                                    2           /* Event log version ID             */
54 #define TX_EL_HEADER_SIZE                                   24          /* Event log header size            */
55 #define TX_EL_TNIS                                          16          /* Number of thread names supported */
56                                                                         /*   If the application needs to    */
57                                                                         /*   track more thread names, just  */
58                                                                         /*   increase this number and re-   */
59                                                                         /*   build the ThreadX library.     */
60 #define TX_EL_TNI_ENTRY_SIZE                                44          /* Thread name entries are 44 bytes */
61 #define TX_EL_TNI_NAME_SIZE                                 34          /* Thread name size in TNI          */
62 #define TX_EL_NO_MORE_TNI_ROOM                              1           /* Error return from thread register*/
63 #define TX_EL_NAME_NOT_FOUND                                2           /* Error return from un-register    */
64 #define TX_EL_EVENT_SIZE                                    32          /* Number of bytes in each event    */
65 #define TX_EL_VALID_ENTRY                                   1           /* Valid log entry                  */
66 #define TX_EL_INVALID_ENTRY                                 0           /* Invalid log entry                */
67 
68 
69 /* Define necessary offsets.  */
70 
71 #define TX_EL_TNI_VALID_OFFSET                              34
72 #define TX_EL_TNI_THREAD_ID_OFFSET                          36
73 #define TX_EL_TNI_THREAD_PRIORITY_OFF                       40
74 #define TX_EL_EVENT_TYPE_OFFSET                             0
75 #define TX_EL_EVENT_SUBTYPE_OFFSET                          2
76 #define TX_EL_EVENT_TIME_UPPER_OFFSET                       4
77 #define TX_EL_EVENT_TIME_LOWER_OFFSET                       8
78 #define TX_EL_EVENT_THREAD_OFFSET                           12
79 #define TX_EL_EVENT_INFO_1_OFFSET                           16
80 #define TX_EL_EVENT_INFO_2_OFFSET                           20
81 #define TX_EL_EVENT_INFO_3_OFFSET                           24
82 #define TX_EL_EVENT_INFO_4_OFFSET                           28
83 
84 
85 /* Undefine constants that might be been defined previously by tx_api.h.  */
86 
87 #undef TX_EL_INITIALIZE
88 #undef TX_EL_THREAD_REGISTER
89 #undef TX_EL_THREAD_UNREGISTER
90 #undef TX_EL_THREAD_STATUS_CHANGE_INSERT
91 #undef TX_EL_BYTE_ALLOCATE_INSERT
92 #undef TX_EL_BYTE_POOL_CREATE_INSERT
93 #undef TX_EL_BYTE_POOL_DELETE_INSERT
94 #undef TX_EL_BYTE_RELEASE_INSERT
95 #undef TX_EL_BLOCK_ALLOCATE_INSERT
96 #undef TX_EL_BLOCK_POOL_CREATE_INSERT
97 #undef TX_EL_BLOCK_POOL_DELETE_INSERT
98 #undef TX_EL_BLOCK_RELEASE_INSERT
99 #undef TX_EL_EVENT_FLAGS_CREATE_INSERT
100 #undef TX_EL_EVENT_FLAGS_DELETE_INSERT
101 #undef TX_EL_EVENT_FLAGS_GET_INSERT
102 #undef TX_EL_EVENT_FLAGS_SET_INSERT
103 #undef TX_EL_INTERRUPT_CONTROL_INSERT
104 #undef TX_EL_QUEUE_CREATE_INSERT
105 #undef TX_EL_QUEUE_DELETE_INSERT
106 #undef TX_EL_QUEUE_FLUSH_INSERT
107 #undef TX_EL_QUEUE_RECEIVE_INSERT
108 #undef TX_EL_QUEUE_SEND_INSERT
109 #undef TX_EL_SEMAPHORE_CREATE_INSERT
110 #undef TX_EL_SEMAPHORE_DELETE_INSERT
111 #undef TX_EL_SEMAPHORE_GET_INSERT
112 #undef TX_EL_SEMAPHORE_PUT_INSERT
113 #undef TX_EL_THREAD_CREATE_INSERT
114 #undef TX_EL_THREAD_DELETE_INSERT
115 #undef TX_EL_THREAD_IDENTIFY_INSERT
116 #undef TX_EL_THREAD_PREEMPTION_CHANGE_INSERT
117 #undef TX_EL_THREAD_PRIORITY_CHANGE_INSERT
118 #undef TX_EL_THREAD_RELINQUISH_INSERT
119 #undef TX_EL_THREAD_RESUME_INSERT
120 #undef TX_EL_THREAD_SLEEP_INSERT
121 #undef TX_EL_THREAD_SUSPEND_INSERT
122 #undef TX_EL_THREAD_TERMINATE_INSERT
123 #undef TX_EL_THREAD_TIME_SLICE_CHANGE_INSERT
124 #undef TX_EL_TIME_GET_INSERT
125 #undef TX_EL_TIME_SET_INSERT
126 #undef TX_EL_TIMER_ACTIVATE_INSERT
127 #undef TX_EL_TIMER_CHANGE_INSERT
128 #undef TX_EL_TIMER_CREATE_INSERT
129 #undef TX_EL_TIMER_DEACTIVATE_INSERT
130 #undef TX_EL_TIMER_DELETE_INSERT
131 #undef TX_EL_BLOCK_POOL_INFO_GET_INSERT
132 #undef TX_EL_BLOCK_POOL_PRIORITIZE_INSERT
133 #undef TX_EL_BYTE_POOL_INFO_GET_INSERT
134 #undef TX_EL_BYTE_POOL_PRIORITIZE_INSERT
135 #undef TX_EL_EVENT_FLAGS_INFO_GET_INSERT
136 #undef TX_EL_MUTEX_CREATE_INSERT
137 #undef TX_EL_MUTEX_DELETE_INSERT
138 #undef TX_EL_MUTEX_GET_INSERT
139 #undef TX_EL_MUTEX_INFO_GET_INSERT
140 #undef TX_EL_MUTEX_PRIORITIZE_INSERT
141 #undef TX_EL_MUTEX_PUT_INSERT
142 #undef TX_EL_QUEUE_INFO_GET_INSERT
143 #undef TX_EL_QUEUE_FRONT_SEND_INSERT
144 #undef TX_EL_QUEUE_PRIORITIZE_INSERT
145 #undef TX_EL_SEMAPHORE_INFO_GET_INSERT
146 #undef TX_EL_SEMAPHORE_PRIORITIZE_INSERT
147 #undef TX_EL_THREAD_INFO_GET_INSERT
148 #undef TX_EL_THREAD_WAIT_ABORT_INSERT
149 #undef TX_EL_TIMER_INFO_GET_INSERT
150 #undef TX_EL_BLOCK_POOL_PERFORMANCE_INFO_GET_INSERT
151 #undef TX_EL_BLOCK_POOL_PERFORMANCE_SYSTEM_INFO_GET_INSERT
152 #undef TX_EL_BYTE_POOL_PERFORMANCE_INFO_GET_INSERT
153 #undef TX_EL_BYTE_POOL_PERFORMANCE_SYSTEM_INFO_GET_INSERT
154 #undef TX_EL_EVENT_FLAGS_PERFORMANCE_INFO_GET_INSERT
155 #undef TX_EL_EVENT_FLAGS_PERFORMANCE_SYSTEM_INFO_GET_INSERT
156 #undef TX_EL_EVENT_FLAGS_SET_NOTIFY_INSERT
157 #undef TX_EL_MUTEX_PERFORMANCE_INFO_GET_INSERT
158 #undef TX_EL_MUTEX_PERFORMANCE_SYSTEM_INFO_GET_INSERT
159 #undef TX_EL_QUEUE_PERFORMANCE_INFO_GET_INSERT
160 #undef TX_EL_QUEUE_PERFORMANCE_SYSTEM_INFO_GET_INSERT
161 #undef TX_EL_QUEUE_SEND_NOTIFY_INSERT
162 #undef TX_EL_SEMAPHORE_CEILING_PUT_INSERT
163 #undef TX_EL_SEMAPHORE_PERFORMANCE_INFO_GET_INSERT
164 #undef TX_EL_SEMAPHORE_PERFORMANCE_SYSTEM_INFO_GET_INSERT
165 #undef TX_EL_SEMAPHORE_PUT_NOTIFY_INSERT
166 #undef TX_EL_THREAD_ENTRY_EXIT_NOTIFY_INSERT
167 #undef TX_EL_THREAD_RESET_INSERT
168 #undef TX_EL_THREAD_PERFORMANCE_INFO_GET_INSERT
169 #undef TX_EL_THREAD_PERFORMANCE_SYSTEM_INFO_GET_INSERT
170 #undef TX_EL_THREAD_STACK_ERROR_NOTIFY_INSERT
171 #undef TX_EL_TIMER_PERFORMANCE_INFO_GET_INSERT
172 #undef TX_EL_TIMER_PERFORMANCE_SYSTEM_INFO_GET_INSERT
173 
174 
175 /* Define Event Types.  */
176 
177 #define TX_EL_THREAD_CHANGE                                 1
178 #define TX_EL_INTERRUPT                                     2
179 #define TX_EL_THREADX_CALL                                  3
180 #define TX_EL_USER_EVENT                                    4
181 #define TX_EL_THREAD_STATUS_CHANGE                          5
182 #define TX_EL_REFRESH                                       6           /* Not implemented                  */
183 #define TX_EL_TIMER                                         7           /* Not implemented                  */
184 #define TX_EL_TIMESOURCE_DELTA                              8           /* Not implemented                  */
185 
186 
187 /* Define TX_EL_THREADX_CALL event sub-types.  */
188 
189 #define TX_EL_BYTE_ALLOCATE                                 0
190 #define TX_EL_BYTE_POOL_CREATE                              1
191 #define TX_EL_BYTE_POOL_DELETE                              2
192 #define TX_EL_BYTE_RELEASE                                  3
193 #define TX_EL_BLOCK_ALLOCATE                                4
194 #define TX_EL_BLOCK_POOL_CREATE                             5
195 #define TX_EL_BLOCK_POOL_DELETE                             6
196 #define TX_EL_BLOCK_RELEASE                                 7
197 #define TX_EL_EVENT_FLAGS_CREATE                            8
198 #define TX_EL_EVENT_FLAGS_DELETE                            9
199 #define TX_EL_EVENT_FLAGS_GET                               10
200 #define TX_EL_EVENT_FLAGS_SET                               11
201 #define TX_EL_INTERRUPT_CONTROL                             12
202 #define TX_EL_QUEUE_CREATE                                  13
203 #define TX_EL_QUEUE_DELETE                                  14
204 #define TX_EL_QUEUE_FLUSH                                   15
205 #define TX_EL_QUEUE_RECEIVE                                 16
206 #define TX_EL_QUEUE_SEND                                    17
207 #define TX_EL_SEMAPHORE_CREATE                              18
208 #define TX_EL_SEMAPHORE_DELETE                              19
209 #define TX_EL_SEMAPHORE_GET                                 20
210 #define TX_EL_SEMAPHORE_PUT                                 21
211 #define TX_EL_THREAD_CREATE                                 22
212 #define TX_EL_THREAD_DELETE                                 23
213 #define TX_EL_THREAD_IDENTIFY                               24
214 #define TX_EL_THREAD_PREEMPTION_CHANGE                      25
215 #define TX_EL_THREAD_PRIORITY_CHANGE                        26
216 #define TX_EL_THREAD_RELINQUISH                             27
217 #define TX_EL_THREAD_RESUME                                 28
218 #define TX_EL_THREAD_SLEEP                                  29
219 #define TX_EL_THREAD_SUSPEND                                30
220 #define TX_EL_THREAD_TERMINATE                              31
221 #define TX_EL_THREAD_TIME_SLICE_CHANGE                      32
222 #define TX_EL_TIME_GET                                      33
223 #define TX_EL_TIME_SET                                      34
224 #define TX_EL_TIMER_ACTIVATE                                35
225 #define TX_EL_TIMER_CHANGE                                  36
226 #define TX_EL_TIMER_CREATE                                  37
227 #define TX_EL_TIMER_DEACTIVATE                              38
228 #define TX_EL_TIMER_DELETE                                  39
229 #define TX_EL_BLOCK_POOL_INFO_GET                           40
230 #define TX_EL_BLOCK_POOL_PRIORITIZE                         41
231 #define TX_EL_BYTE_POOL_INFO_GET                            42
232 #define TX_EL_BYTE_POOL_PRIORITIZE                          43
233 #define TX_EL_EVENT_FLAGS_INFO_GET                          44
234 #define TX_EL_MUTEX_CREATE                                  45
235 #define TX_EL_MUTEX_DELETE                                  46
236 #define TX_EL_MUTEX_GET                                     47
237 #define TX_EL_MUTEX_INFO_GET                                48
238 #define TX_EL_MUTEX_PRIORITIZE                              49
239 #define TX_EL_MUTEX_PUT                                     50
240 #define TX_EL_QUEUE_INFO_GET                                51
241 #define TX_EL_QUEUE_FRONT_SEND                              52
242 #define TX_EL_QUEUE_PRIORITIZE                              53
243 #define TX_EL_SEMAPHORE_INFO_GET                            54
244 #define TX_EL_SEMAPHORE_PRIORITIZE                          55
245 #define TX_EL_THREAD_INFO_GET                               56
246 #define TX_EL_THREAD_WAIT_ABORT                             57
247 #define TX_EL_TIMER_INFO_GET                                58
248 #define TX_EL_BLOCK_POOL_PERFORMANCE_INFO_GET               59
249 #define TX_EL_BLOCK_POOL_PERFORMANCE_SYSTEM_INFO_GET        60
250 #define TX_EL_BYTE_POOL_PERFORMANCE_INFO_GET                61
251 #define TX_EL_BYTE_POOL_PERFORMANCE_SYSTEM_INFO_GET         62
252 #define TX_EL_EVENT_FLAGS_PERFORMANCE_INFO_GET              63
253 #define TX_EL_EVENT_FLAGS_PERFORMANCE_SYSTEM_INFO_GET       64
254 #define TX_EL_EVENT_FLAGS_SET_NOTIFY                        65
255 #define TX_EL_MUTEX_PERFORMANCE_INFO_GET                    66
256 #define TX_EL_MUTEX_PERFORMANCE_SYSTEM_INFO_GET             67
257 #define TX_EL_QUEUE_PERFORMANCE_INFO_GET                    68
258 #define TX_EL_QUEUE_PERFORMANCE_SYSTEM_INFO_GET             69
259 #define TX_EL_QUEUE_SEND_NOTIFY                             70
260 #define TX_EL_SEMAPHORE_CEILING_PUT                         71
261 #define TX_EL_SEMAPHORE_PERFORMANCE_INFO_GET                72
262 #define TX_EL_SEMAPHORE_PERFORMANCE_SYSTEM_INFO_GET         73
263 #define TX_EL_SEMAPHORE_PUT_NOTIFY                          74
264 #define TX_EL_THREAD_ENTRY_EXIT_NOTIFY                      75
265 #define TX_EL_THREAD_RESET                                  76
266 #define TX_EL_THREAD_PERFORMANCE_INFO_GET                   77
267 #define TX_EL_THREAD_PERFORMANCE_SYSTEM_INFO_GET            78
268 #define TX_EL_THREAD_STACK_ERROR_NOTIFY                     79
269 #define TX_EL_TIMER_PERFORMANCE_INFO_GET                    80
270 #define TX_EL_TIMER_PERFORMANCE_SYSTEM_INFO_GET             81
271 
272 
273 /* Define ThreadX sub-types.  */
274 
275 #define TX_EL_INTERRUPT_SUB_TYPE                            1
276 #define TX_EL_END_OF_INTERRUPT                              3
277 
278 
279 /* Define event logging filters, which may be used by the application program to
280    dynamically enable/disable events in run-time.  */
281 
282 #define TX_EL_FILTER_STATUS_CHANGE                          0x0001
283 #define TX_EL_FILTER_INTERRUPTS                             0x0002
284 #define TX_EL_FILTER_THREAD_CALLS                           0x0004
285 #define TX_EL_FILTER_TIMER_CALLS                            0x0008
286 #define TX_EL_FILTER_EVENT_FLAG_CALLS                       0x0010
287 #define TX_EL_FILTER_SEMAPHORE_CALLS                        0x0020
288 #define TX_EL_FILTER_QUEUE_CALLS                            0x0040
289 #define TX_EL_FILTER_BLOCK_CALLS                            0x0080
290 #define TX_EL_FILTER_BYTE_CALLS                             0x0100
291 #define TX_EL_FILTER_MUTEX_CALLS                            0x0200
292 #define TX_EL_FILTER_ALL_EVENTS                             0xFFFF
293 #define TX_EL_ENABLE_ALL_EVENTS                             0x0000
294 
295 
296 /* Define filter macros that are inserted in-line with the other macros below.  */
297 
298 #ifdef TX_ENABLE_EVENT_FILTERS
299 #define TX_EL_NO_STATUS_EVENTS      if (!(_tx_el_event_filter & TX_EL_FILTER_STATUS_CHANGE)) {
300 #define TX_EL_NO_INTERRUPT_EVENTS   if (!(_tx_el_event_filter & TX_EL_FILTER_INTERRUPTS)) {
301 #define TX_EL_NO_THREAD_EVENTS      if (!(_tx_el_event_filter & TX_EL_FILTER_THREAD_CALLS)) {
302 #define TX_EL_NO_TIMER_EVENTS       if (!(_tx_el_event_filter & TX_EL_FILTER_TIMER_CALLS)) {
303 #define TX_EL_NO_EVENT_FLAG_EVENTS  if (!(_tx_el_event_filter & TX_EL_FILTER_EVENT_FLAG_CALLS)) {
304 #define TX_EL_NO_SEMAPHORE_EVENTS   if (!(_tx_el_event_filter & TX_EL_FILTER_SEMAPHORE_CALLS)) {
305 #define TX_EL_NO_QUEUE_EVENTS       if (!(_tx_el_event_filter & TX_EL_FILTER_QUEUE_CALLS)) {
306 #define TX_EL_NO_BLOCK_EVENTS       if (!(_tx_el_event_filter & TX_EL_FILTER_BLOCK_CALLS)) {
307 #define TX_EL_NO_BYTE_EVENTS        if (!(_tx_el_event_filter & TX_EL_FILTER_BYTE_CALLS)) {
308 #define TX_EL_NO_MUTEX_EVENTS       if (!(_tx_el_event_filter & TX_EL_FILTER_MUTEX_CALLS)) {
309 #define TX_EL_END_FILTER            }
310 #else
311 #define TX_EL_NO_STATUS_EVENTS
312 #define TX_EL_NO_INTERRUPT_EVENTS
313 #define TX_EL_NO_THREAD_EVENTS
314 #define TX_EL_NO_TIMER_EVENTS
315 #define TX_EL_NO_EVENT_FLAG_EVENTS
316 #define TX_EL_NO_SEMAPHORE_EVENTS
317 #define TX_EL_NO_QUEUE_EVENTS
318 #define TX_EL_NO_BLOCK_EVENTS
319 #define TX_EL_NO_BYTE_EVENTS
320 #define TX_EL_NO_MUTEX_EVENTS
321 #define TX_EL_END_FILTER
322 #endif
323 
324 /* Define externs and constants for non-event log source modules.  This is for
325    the in-line macros below.  */
326 
327 #ifndef TX_EL_SOURCE_CODE
328 extern UCHAR            *_tx_el_tni_start;
329 extern UCHAR            **_tx_el_current_event;
330 extern UCHAR            *_tx_el_event_area_start;
331 extern UCHAR            *_tx_el_event_area_end;
332 extern UINT             _tx_el_maximum_events;
333 extern ULONG            _tx_el_total_events;
334 extern TX_THREAD        *_tx_thread_current_ptr;
335 extern UINT             _tx_el_event_filter;
336 extern ULONG            _tx_el_time_base_upper;
337 extern ULONG            _tx_el_time_base_lower;
338 
339 
340 /* Define macros for event logging functions.  */
341 
342 #define TX_EL_THREAD_CREATE_INSERT                              TX_EL_NO_THREAD_EVENTS      TX_EL_KERNEL_CALL_EVENT_INSERT_INFO4(TX_EL_THREAD_CREATE, thread_ptr, stack_start, stack_size, priority); TX_EL_END_FILTER
343 #define TX_EL_EVENT_FLAGS_SET_INSERT                            TX_EL_NO_EVENT_FLAG_EVENTS  TX_EL_KERNEL_CALL_EVENT_INSERT_INFO3(TX_EL_EVENT_FLAGS_SET, group_ptr, flags_to_set, set_option); TX_EL_END_FILTER
344 #define TX_EL_THREAD_DELETE_INSERT                              TX_EL_NO_THREAD_EVENTS      TX_EL_KERNEL_CALL_EVENT_INSERT_INFO1(TX_EL_THREAD_DELETE, thread_ptr); TX_EL_END_FILTER
345 #define TX_EL_THREAD_INFO_GET_INSERT                            TX_EL_NO_THREAD_EVENTS      TX_EL_KERNEL_CALL_EVENT_INSERT_INFO1(TX_EL_THREAD_INFO_GET, thread_ptr); TX_EL_END_FILTER
346 #define TX_EL_THREAD_TIME_SLICE_CHANGE_INSERT                   TX_EL_NO_THREAD_EVENTS      TX_EL_KERNEL_CALL_EVENT_INSERT_INFO3(TX_EL_THREAD_TIME_SLICE_CHANGE, thread_ptr, thread_ptr -> tx_thread_new_time_slice, new_time_slice); TX_EL_END_FILTER
347 #define TX_EL_THREAD_TERMINATE_INSERT                           TX_EL_NO_THREAD_EVENTS      TX_EL_KERNEL_CALL_EVENT_INSERT_INFO1(TX_EL_THREAD_TERMINATE, thread_ptr); TX_EL_END_FILTER
348 #define TX_EL_THREAD_SLEEP_INSERT                               TX_EL_NO_THREAD_EVENTS      TX_EL_KERNEL_CALL_EVENT_INSERT_INFO1(TX_EL_THREAD_SLEEP, timer_ticks); TX_EL_END_FILTER
349 #define TX_EL_THREAD_SUSPEND_INSERT                             TX_EL_NO_THREAD_EVENTS      TX_EL_KERNEL_CALL_EVENT_INSERT_INFO1(TX_EL_THREAD_SUSPEND, thread_ptr); TX_EL_END_FILTER
350 #define TX_EL_THREAD_RELINQUISH_INSERT                          TX_EL_NO_THREAD_EVENTS      TX_EL_KERNEL_CALL_EVENT_INSERT_INFO0(TX_EL_THREAD_RELINQUISH); TX_EL_END_FILTER
351 #define TX_EL_THREAD_RESUME_INSERT                              TX_EL_NO_THREAD_EVENTS      TX_EL_KERNEL_CALL_EVENT_INSERT_INFO1(TX_EL_THREAD_RESUME, thread_ptr); TX_EL_END_FILTER
352 #define TX_EL_THREAD_PRIORITY_CHANGE_INSERT                     TX_EL_NO_THREAD_EVENTS      TX_EL_KERNEL_CALL_EVENT_INSERT_INFO3(TX_EL_THREAD_PRIORITY_CHANGE, thread_ptr, thread_ptr -> tx_thread_priority, new_priority); TX_EL_END_FILTER
353 #define TX_EL_THREAD_PREEMPTION_CHANGE_INSERT                   TX_EL_NO_THREAD_EVENTS      TX_EL_KERNEL_CALL_EVENT_INSERT_INFO3(TX_EL_THREAD_PREEMPTION_CHANGE, thread_ptr, thread_ptr -> tx_thread_preempt_threshold, new_threshold); TX_EL_END_FILTER
354 #define TX_EL_THREAD_WAIT_ABORT_INSERT                          TX_EL_NO_THREAD_EVENTS      TX_EL_KERNEL_CALL_EVENT_INSERT_INFO1(TX_EL_THREAD_WAIT_ABORT, thread_ptr); TX_EL_END_FILTER
355 #define TX_EL_THREAD_ENTRY_EXIT_NOTIFY_INSERT                   TX_EL_NO_THREAD_EVENTS      TX_EL_KERNEL_CALL_EVENT_INSERT_INFO2(TX_EL_THREAD_ENTRY_EXIT_NOTIFY, thread_ptr, thread_entry_exit_notify); TX_EL_END_FILTER
356 #define TX_EL_THREAD_RESET_INSERT                               TX_EL_NO_THREAD_EVENTS      TX_EL_KERNEL_CALL_EVENT_INSERT_INFO1(TX_EL_THREAD_RESET, thread_ptr); TX_EL_END_FILTER
357 #define TX_EL_THREAD_PERFORMANCE_INFO_GET_INSERT                TX_EL_NO_THREAD_EVENTS      TX_EL_KERNEL_CALL_EVENT_INSERT_INFO1(TX_EL_THREAD_PERFORMANCE_INFO_GET, thread_ptr); TX_EL_END_FILTER
358 #define TX_EL_THREAD_PERFORMANCE_SYSTEM_INFO_GET_INSERT         TX_EL_NO_THREAD_EVENTS      TX_EL_KERNEL_CALL_EVENT_INSERT_INFO0(TX_EL_THREAD_PERFORMANCE_SYSTEM_INFO_GET); TX_EL_END_FILTER
359 #define TX_EL_THREAD_STACK_ERROR_NOTIFY_INSERT                  TX_EL_NO_THREAD_EVENTS      TX_EL_KERNEL_CALL_EVENT_INSERT_INFO1(TX_EL_THREAD_STACK_ERROR_NOTIFY, stack_error_handler); TX_EL_END_FILTER
360 #define TX_EL_TIME_SET_INSERT                                   TX_EL_NO_TIMER_EVENTS       TX_EL_KERNEL_CALL_EVENT_INSERT_INFO1(TX_EL_TIME_SET, new_time); TX_EL_END_FILTER
361 #define TX_EL_TIME_GET_INSERT                                   TX_EL_NO_TIMER_EVENTS       TX_EL_KERNEL_CALL_EVENT_INSERT_INFO1(TX_EL_TIME_GET, _tx_timer_system_clock); TX_EL_END_FILTER
362 #define TX_EL_TIMER_DELETE_INSERT                               TX_EL_NO_TIMER_EVENTS       TX_EL_KERNEL_CALL_EVENT_INSERT_INFO1(TX_EL_TIMER_DELETE, timer_ptr); TX_EL_END_FILTER
363 #define TX_EL_TIMER_CREATE_INSERT                               TX_EL_NO_TIMER_EVENTS       TX_EL_KERNEL_CALL_EVENT_INSERT_INFO4(TX_EL_TIMER_CREATE, timer_ptr, initial_ticks, reschedule_ticks, auto_activate); TX_EL_END_FILTER
364 #define TX_EL_TIMER_CHANGE_INSERT                               TX_EL_NO_TIMER_EVENTS       TX_EL_KERNEL_CALL_EVENT_INSERT_INFO3(TX_EL_TIMER_CHANGE, timer_ptr, initial_ticks, reschedule_ticks); TX_EL_END_FILTER
365 #define TX_EL_THREAD_IDENTIFY_INSERT                            TX_EL_NO_THREAD_EVENTS      TX_EL_KERNEL_CALL_EVENT_INSERT_INFO0(TX_EL_THREAD_IDENTIFY); TX_EL_END_FILTER
366 #define TX_EL_TIMER_DEACTIVATE_INSERT                           TX_EL_NO_TIMER_EVENTS       TX_EL_KERNEL_CALL_EVENT_INSERT_INFO1(TX_EL_TIMER_DEACTIVATE, timer_ptr); TX_EL_END_FILTER
367 #define TX_EL_TIMER_ACTIVATE_INSERT                             TX_EL_NO_TIMER_EVENTS       TX_EL_KERNEL_CALL_EVENT_INSERT_INFO1(TX_EL_TIMER_ACTIVATE, timer_ptr); TX_EL_END_FILTER
368 #define TX_EL_TIMER_INFO_GET_INSERT                             TX_EL_NO_TIMER_EVENTS       TX_EL_KERNEL_CALL_EVENT_INSERT_INFO1(TX_EL_TIMER_INFO_GET, timer_ptr); TX_EL_END_FILTER
369 #define TX_EL_TIMER_PERFORMANCE_INFO_GET_INSERT                 TX_EL_NO_TIMER_EVENTS       TX_EL_KERNEL_CALL_EVENT_INSERT_INFO1(TX_EL_TIMER_PERFORMANCE_INFO_GET, timer_ptr); TX_EL_END_FILTER
370 #define TX_EL_TIMER_PERFORMANCE_SYSTEM_INFO_GET_INSERT          TX_EL_NO_TIMER_EVENTS       TX_EL_KERNEL_CALL_EVENT_INSERT_INFO0(TX_EL_TIMER_PERFORMANCE_SYSTEM_INFO_GET); TX_EL_END_FILTER
371 #define TX_EL_SEMAPHORE_PUT_INSERT                              TX_EL_NO_SEMAPHORE_EVENTS   TX_EL_KERNEL_CALL_EVENT_INSERT_INFO2(TX_EL_SEMAPHORE_PUT, semaphore_ptr, semaphore_ptr -> tx_semaphore_count); TX_EL_END_FILTER
372 #define TX_EL_SEMAPHORE_GET_INSERT                              TX_EL_NO_SEMAPHORE_EVENTS   TX_EL_KERNEL_CALL_EVENT_INSERT_INFO2(TX_EL_SEMAPHORE_GET, semaphore_ptr, semaphore_ptr -> tx_semaphore_count); TX_EL_END_FILTER
373 #define TX_EL_SEMAPHORE_DELETE_INSERT                           TX_EL_NO_SEMAPHORE_EVENTS   TX_EL_KERNEL_CALL_EVENT_INSERT_INFO1(TX_EL_SEMAPHORE_DELETE, semaphore_ptr); TX_EL_END_FILTER
374 #define TX_EL_SEMAPHORE_CREATE_INSERT                           TX_EL_NO_SEMAPHORE_EVENTS   TX_EL_KERNEL_CALL_EVENT_INSERT_INFO2(TX_EL_SEMAPHORE_CREATE, semaphore_ptr, initial_count); TX_EL_END_FILTER
375 #define TX_EL_SEMAPHORE_INFO_GET_INSERT                         TX_EL_NO_SEMAPHORE_EVENTS   TX_EL_KERNEL_CALL_EVENT_INSERT_INFO1(TX_EL_SEMAPHORE_INFO_GET, semaphore_ptr); TX_EL_END_FILTER
376 #define TX_EL_SEMAPHORE_PRIORITIZE_INSERT                       TX_EL_NO_SEMAPHORE_EVENTS   TX_EL_KERNEL_CALL_EVENT_INSERT_INFO1(TX_EL_SEMAPHORE_PRIORITIZE, semaphore_ptr); TX_EL_END_FILTER
377 #define TX_EL_SEMAPHORE_CEILING_PUT_INSERT                      TX_EL_NO_SEMAPHORE_EVENTS   TX_EL_KERNEL_CALL_EVENT_INSERT_INFO3(TX_EL_SEMAPHORE_CEILING_PUT, semaphore_ptr, semaphore_ptr -> tx_semaphore_count, ceiling); TX_EL_END_FILTER
378 #define TX_EL_SEMAPHORE_PERFORMANCE_INFO_GET_INSERT             TX_EL_NO_SEMAPHORE_EVENTS   TX_EL_KERNEL_CALL_EVENT_INSERT_INFO1(TX_EL_SEMAPHORE_PERFORMANCE_INFO_GET, semaphore_ptr); TX_EL_END_FILTER
379 #define TX_EL_SEMAPHORE_PERFORMANCE_SYSTEM_INFO_GET_INSERT      TX_EL_NO_SEMAPHORE_EVENTS   TX_EL_KERNEL_CALL_EVENT_INSERT_INFO0(TX_EL_SEMAPHORE_PERFORMANCE_SYSTEM_INFO_GET); TX_EL_END_FILTER
380 #define TX_EL_SEMAPHORE_PUT_NOTIFY_INSERT                       TX_EL_NO_SEMAPHORE_EVENTS   TX_EL_KERNEL_CALL_EVENT_INSERT_INFO2(TX_EL_SEMAPHORE_PUT_NOTIFY, semaphore_ptr, semaphore_put_notify); TX_EL_END_FILTER
381 #define TX_EL_QUEUE_FRONT_SEND_INSERT                           TX_EL_NO_QUEUE_EVENTS       TX_EL_KERNEL_CALL_EVENT_INSERT_INFO2(TX_EL_QUEUE_FRONT_SEND, queue_ptr, source_ptr); TX_EL_END_FILTER
382 #define TX_EL_QUEUE_SEND_INSERT                                 TX_EL_NO_QUEUE_EVENTS       TX_EL_KERNEL_CALL_EVENT_INSERT_INFO2(TX_EL_QUEUE_SEND, queue_ptr, source_ptr); TX_EL_END_FILTER
383 #define TX_EL_QUEUE_RECEIVE_INSERT                              TX_EL_NO_QUEUE_EVENTS       TX_EL_KERNEL_CALL_EVENT_INSERT_INFO2(TX_EL_QUEUE_RECEIVE, queue_ptr, destination_ptr); TX_EL_END_FILTER
384 #define TX_EL_QUEUE_FLUSH_INSERT                                TX_EL_NO_QUEUE_EVENTS       TX_EL_KERNEL_CALL_EVENT_INSERT_INFO1(TX_EL_QUEUE_FLUSH, queue_ptr); TX_EL_END_FILTER
385 #define TX_EL_QUEUE_DELETE_INSERT                               TX_EL_NO_QUEUE_EVENTS       TX_EL_KERNEL_CALL_EVENT_INSERT_INFO1(TX_EL_QUEUE_DELETE, queue_ptr); TX_EL_END_FILTER
386 #define TX_EL_QUEUE_CREATE_INSERT                               TX_EL_NO_QUEUE_EVENTS       TX_EL_KERNEL_CALL_EVENT_INSERT_INFO4(TX_EL_QUEUE_CREATE, queue_ptr, queue_start, queue_size, message_size); TX_EL_END_FILTER
387 #define TX_EL_QUEUE_INFO_GET_INSERT                             TX_EL_NO_QUEUE_EVENTS       TX_EL_KERNEL_CALL_EVENT_INSERT_INFO1(TX_EL_QUEUE_INFO_GET, queue_ptr); TX_EL_END_FILTER
388 #define TX_EL_QUEUE_PRIORITIZE_INSERT                           TX_EL_NO_QUEUE_EVENTS       TX_EL_KERNEL_CALL_EVENT_INSERT_INFO1(TX_EL_QUEUE_PRIORITIZE, queue_ptr); TX_EL_END_FILTER
389 #define TX_EL_QUEUE_PERFORMANCE_INFO_GET_INSERT                 TX_EL_NO_QUEUE_EVENTS       TX_EL_KERNEL_CALL_EVENT_INSERT_INFO1(TX_EL_QUEUE_PERFORMANCE_INFO_GET, queue_ptr); TX_EL_END_FILTER
390 #define TX_EL_QUEUE_PERFORMANCE_SYSTEM_INFO_GET_INSERT          TX_EL_NO_QUEUE_EVENTS       TX_EL_KERNEL_CALL_EVENT_INSERT_INFO0(TX_EL_QUEUE_PERFORMANCE_SYSTEM_INFO_GET); TX_EL_END_FILTER
391 #define TX_EL_QUEUE_SEND_NOTIFY_INSERT                          TX_EL_NO_QUEUE_EVENTS       TX_EL_KERNEL_CALL_EVENT_INSERT_INFO2(TX_EL_QUEUE_SEND_NOTIFY, queue_ptr, queue_send_notify); TX_EL_END_FILTER
392 #define TX_EL_EVENT_FLAGS_GET_INSERT                            TX_EL_NO_EVENT_FLAG_EVENTS  TX_EL_KERNEL_CALL_EVENT_INSERT_INFO3(TX_EL_EVENT_FLAGS_GET, group_ptr, requested_flags, get_option); TX_EL_END_FILTER
393 #define TX_EL_EVENT_FLAGS_DELETE_INSERT                         TX_EL_NO_EVENT_FLAG_EVENTS  TX_EL_KERNEL_CALL_EVENT_INSERT_INFO1(TX_EL_EVENT_FLAGS_DELETE, group_ptr); TX_EL_END_FILTER
394 #define TX_EL_EVENT_FLAGS_CREATE_INSERT                         TX_EL_NO_EVENT_FLAG_EVENTS  TX_EL_KERNEL_CALL_EVENT_INSERT_INFO1(TX_EL_EVENT_FLAGS_CREATE, group_ptr); TX_EL_END_FILTER
395 #define TX_EL_EVENT_FLAGS_INFO_GET_INSERT                       TX_EL_NO_EVENT_FLAG_EVENTS  TX_EL_KERNEL_CALL_EVENT_INSERT_INFO1(TX_EL_EVENT_FLAGS_INFO_GET, group_ptr); TX_EL_END_FILTER
396 #define TX_EL_EVENT_FLAGS_PERFORMANCE_INFO_GET_INSERT           TX_EL_NO_EVENT_FLAG_EVENTS  TX_EL_KERNEL_CALL_EVENT_INSERT_INFO1(TX_EL_EVENT_FLAGS_PERFORMANCE_INFO_GET, group_ptr); TX_EL_END_FILTER
397 #define TX_EL_EVENT_FLAGS_PERFORMANCE_SYSTEM_INFO_GET_INSERT    TX_EL_NO_EVENT_FLAG_EVENTS  TX_EL_KERNEL_CALL_EVENT_INSERT_INFO0(TX_EL_EVENT_FLAGS_PERFORMANCE_SYSTEM_INFO_GET); TX_EL_END_FILTER
398 #define TX_EL_EVENT_FLAGS_SET_NOTIFY_INSERT                     TX_EL_NO_EVENT_FLAG_EVENTS  TX_EL_KERNEL_CALL_EVENT_INSERT_INFO2(TX_EL_EVENT_FLAGS_SET_NOTIFY, group_ptr, events_set_notify); TX_EL_END_FILTER
399 #define TX_EL_BYTE_RELEASE_INSERT                               TX_EL_NO_BYTE_EVENTS        TX_EL_KERNEL_CALL_EVENT_INSERT_INFO2(TX_EL_BYTE_RELEASE, pool_ptr, memory_ptr); TX_EL_END_FILTER
400 #define TX_EL_BYTE_POOL_DELETE_INSERT                           TX_EL_NO_BYTE_EVENTS        TX_EL_KERNEL_CALL_EVENT_INSERT_INFO1(TX_EL_BYTE_POOL_DELETE, pool_ptr); TX_EL_END_FILTER
401 #define TX_EL_BYTE_POOL_CREATE_INSERT                           TX_EL_NO_BYTE_EVENTS        TX_EL_KERNEL_CALL_EVENT_INSERT_INFO3(TX_EL_BYTE_POOL_CREATE, pool_ptr, pool_start, pool_size); TX_EL_END_FILTER
402 #define TX_EL_BYTE_POOL_INFO_GET_INSERT                         TX_EL_NO_BYTE_EVENTS        TX_EL_KERNEL_CALL_EVENT_INSERT_INFO1(TX_EL_BYTE_POOL_INFO_GET, pool_ptr); TX_EL_END_FILTER
403 #define TX_EL_BYTE_POOL_PRIORITIZE_INSERT                       TX_EL_NO_BYTE_EVENTS        TX_EL_KERNEL_CALL_EVENT_INSERT_INFO1(TX_EL_BYTE_POOL_PRIORITIZE, pool_ptr); TX_EL_END_FILTER
404 #define TX_EL_BYTE_ALLOCATE_INSERT                              TX_EL_NO_BYTE_EVENTS        TX_EL_KERNEL_CALL_EVENT_INSERT_INFO3(TX_EL_BYTE_ALLOCATE, pool_ptr, memory_ptr, memory_size); TX_EL_END_FILTER
405 #define TX_EL_BYTE_POOL_PERFORMANCE_INFO_GET_INSERT             TX_EL_NO_BYTE_EVENTS        TX_EL_KERNEL_CALL_EVENT_INSERT_INFO1(TX_EL_BYTE_POOL_PERFORMANCE_INFO_GET, pool_ptr); TX_EL_END_FILTER
406 #define TX_EL_BYTE_POOL_PERFORMANCE_SYSTEM_INFO_GET_INSERT      TX_EL_NO_BYTE_EVENTS        TX_EL_KERNEL_CALL_EVENT_INSERT_INFO0(TX_EL_BYTE_POOL_PERFORMANCE_SYSTEM_INFO_GET); TX_EL_END_FILTER
407 #define TX_EL_BLOCK_RELEASE_INSERT                              TX_EL_NO_BLOCK_EVENTS       TX_EL_KERNEL_CALL_EVENT_INSERT_INFO2(TX_EL_BLOCK_RELEASE, pool_ptr, block_ptr); TX_EL_END_FILTER
408 #define TX_EL_BLOCK_POOL_DELETE_INSERT                          TX_EL_NO_BLOCK_EVENTS       TX_EL_KERNEL_CALL_EVENT_INSERT_INFO1(TX_EL_BLOCK_POOL_DELETE, pool_ptr); TX_EL_END_FILTER
409 #define TX_EL_BLOCK_POOL_CREATE_INSERT                          TX_EL_NO_BLOCK_EVENTS       TX_EL_KERNEL_CALL_EVENT_INSERT_INFO4(TX_EL_BLOCK_POOL_CREATE, pool_ptr, pool_start, pool_size, block_size); TX_EL_END_FILTER
410 #define TX_EL_BLOCK_POOL_INFO_GET_INSERT                        TX_EL_NO_BLOCK_EVENTS       TX_EL_KERNEL_CALL_EVENT_INSERT_INFO1(TX_EL_BLOCK_POOL_INFO_GET, pool_ptr); TX_EL_END_FILTER
411 #define TX_EL_BLOCK_POOL_PRIORITIZE_INSERT                      TX_EL_NO_BLOCK_EVENTS       TX_EL_KERNEL_CALL_EVENT_INSERT_INFO1(TX_EL_BLOCK_POOL_PRIORITIZE, pool_ptr); TX_EL_END_FILTER
412 #define TX_EL_BLOCK_ALLOCATE_INSERT                             TX_EL_NO_BLOCK_EVENTS       TX_EL_KERNEL_CALL_EVENT_INSERT_INFO2(TX_EL_BLOCK_ALLOCATE, pool_ptr, block_ptr); TX_EL_END_FILTER
413 #define TX_EL_BLOCK_POOL_PERFORMANCE_INFO_GET_INSERT            TX_EL_NO_BLOCK_EVENTS       TX_EL_KERNEL_CALL_EVENT_INSERT_INFO1(TX_EL_BLOCK_POOL_PERFORMANCE_INFO_GET, pool_ptr); TX_EL_END_FILTER
414 #define TX_EL_BLOCK_POOL_PERFORMANCE_SYSTEM_INFO_GET_INSERT     TX_EL_NO_BLOCK_EVENTS       TX_EL_KERNEL_CALL_EVENT_INSERT_INFO0(TX_EL_BLOCK_POOL_PERFORMANCE_SYSTEM_INFO_GET); TX_EL_END_FILTER
415 #define TX_EL_MUTEX_CREATE_INSERT                               TX_EL_NO_MUTEX_EVENTS       TX_EL_KERNEL_CALL_EVENT_INSERT_INFO2(TX_EL_MUTEX_CREATE, mutex_ptr, inherit); TX_EL_END_FILTER
416 #define TX_EL_MUTEX_DELETE_INSERT                               TX_EL_NO_MUTEX_EVENTS       TX_EL_KERNEL_CALL_EVENT_INSERT_INFO1(TX_EL_MUTEX_DELETE, mutex_ptr); TX_EL_END_FILTER
417 #define TX_EL_MUTEX_GET_INSERT                                  TX_EL_NO_MUTEX_EVENTS       TX_EL_KERNEL_CALL_EVENT_INSERT_INFO3(TX_EL_MUTEX_GET, mutex_ptr, mutex_ptr -> tx_mutex_owner, mutex_ptr -> tx_mutex_ownership_count); TX_EL_END_FILTER
418 #define TX_EL_MUTEX_INFO_GET_INSERT                             TX_EL_NO_MUTEX_EVENTS       TX_EL_KERNEL_CALL_EVENT_INSERT_INFO1(TX_EL_MUTEX_INFO_GET, mutex_ptr); TX_EL_END_FILTER
419 #define TX_EL_MUTEX_PRIORITIZE_INSERT                           TX_EL_NO_MUTEX_EVENTS       TX_EL_KERNEL_CALL_EVENT_INSERT_INFO1(TX_EL_MUTEX_PRIORITIZE, mutex_ptr); TX_EL_END_FILTER
420 #define TX_EL_MUTEX_PUT_INSERT                                  TX_EL_NO_MUTEX_EVENTS       TX_EL_KERNEL_CALL_EVENT_INSERT_INFO3(TX_EL_MUTEX_PUT, mutex_ptr, mutex_ptr -> tx_mutex_owner, mutex_ptr -> tx_mutex_ownership_count); TX_EL_END_FILTER
421 #define TX_EL_MUTEX_PERFORMANCE_INFO_GET_INSERT                 TX_EL_NO_MUTEX_EVENTS       TX_EL_KERNEL_CALL_EVENT_INSERT_INFO1(TX_EL_MUTEX_PERFORMANCE_INFO_GET, mutex_ptr); TX_EL_END_FILTER
422 #define TX_EL_MUTEX_PERFORMANCE_SYSTEM_INFO_GET_INSERT          TX_EL_NO_MUTEX_EVENTS       TX_EL_KERNEL_CALL_EVENT_INSERT_INFO0(TX_EL_MUTEX_PERFORMANCE_SYSTEM_INFO_GET); TX_EL_END_FILTER
423 
424 
425 #endif
426 
427 
428 /* Define Event Log function prototypes.  */
429 
430 VOID        _tx_el_initialize(VOID);
431 UINT        _tx_el_thread_register(TX_THREAD *thread_ptr);
432 UINT        _tx_el_thread_unregister(TX_THREAD *thread_ptr);
433 VOID        _tx_el_user_event_insert(UINT sub_type, ULONG info_1, ULONG info_2,
434                                                     ULONG info_3, ULONG info_4);
435 VOID        _tx_el_thread_running(TX_THREAD *thread_ptr);
436 VOID        _tx_el_thread_preempted(TX_THREAD *thread_ptr);
437 VOID        _tx_el_interrupt(UINT interrupt_number);
438 VOID        _tx_el_interrupt_end(UINT interrupt_number);
439 VOID        _tx_el_interrupt_control_call(void);
440 VOID        _tx_el_event_log_on(void);
441 VOID        _tx_el_event_log_off(void);
442 VOID        _tx_el_event_filter_set(UINT filter);
443 
444 
445 /* Define macros that are used inside the ThreadX source code.
446    If event logging is disabled, these macros will be defined
447    as white space.  */
448 
449 #ifdef TX_ENABLE_EVENT_LOGGING
450 #ifndef TX_NO_EVENT_INFO
451 #define TX_EL_KERNEL_CALL_EVENT_INSERT_INFO4(a, b, c, d, e)  \
452                         {  \
453                         UCHAR   *entry_ptr; \
454                         ULONG   upper_tbu; \
455                         entry_ptr =  *_tx_el_current_event; \
456                         *((unsigned short *) entry_ptr) =  TX_EL_THREADX_CALL; \
457                         *((unsigned short *) (entry_ptr + TX_EL_EVENT_SUBTYPE_OFFSET)) = (unsigned short) a; \
458                         do { \
459                         upper_tbu =  read_tbu(); \
460                         *((ULONG *) (entry_ptr + TX_EL_EVENT_TIME_UPPER_OFFSET)) = upper_tbu; \
461                         *((ULONG *) (entry_ptr + TX_EL_EVENT_TIME_LOWER_OFFSET)) =\
462                                 (ULONG) read_tbl();\
463                         } while (upper_tbu != read_tbu()); \
464                         *((ULONG *) (entry_ptr + TX_EL_EVENT_THREAD_OFFSET)) =\
465                                 (ULONG) _tx_thread_current_ptr;\
466                         *((ULONG *) (entry_ptr + TX_EL_EVENT_INFO_1_OFFSET)) =\
467                                 (ULONG) b;\
468                         *((ULONG *) (entry_ptr + TX_EL_EVENT_INFO_2_OFFSET)) =\
469                                 (ULONG) c;\
470                         *((ULONG *) (entry_ptr + TX_EL_EVENT_INFO_3_OFFSET)) =\
471                                 (ULONG) d;\
472                         *((ULONG *) (entry_ptr + TX_EL_EVENT_INFO_4_OFFSET)) =\
473                                 (ULONG) e;\
474                         entry_ptr =  entry_ptr + TX_EL_EVENT_SIZE;\
475                         if (entry_ptr >= _tx_el_event_area_end) \
476                         {\
477                                 entry_ptr =  _tx_el_event_area_start;\
478                         }\
479                         *_tx_el_current_event =  entry_ptr;\
480                         }
481 #define TX_EL_KERNEL_CALL_EVENT_INSERT_INFO3(a, b, c, d) \
482                         {  \
483                         UCHAR   *entry_ptr; \
484                         ULONG   upper_tbu; \
485                         entry_ptr =  *_tx_el_current_event; \
486                         *((unsigned short *) entry_ptr) =  TX_EL_THREADX_CALL; \
487                         *((unsigned short *) (entry_ptr + TX_EL_EVENT_SUBTYPE_OFFSET)) = (unsigned short) a; \
488                         do { \
489                         upper_tbu =  read_tbu(); \
490                         *((ULONG *) (entry_ptr + TX_EL_EVENT_TIME_UPPER_OFFSET)) = upper_tbu; \
491                         *((ULONG *) (entry_ptr + TX_EL_EVENT_TIME_LOWER_OFFSET)) =\
492                                 (ULONG) read_tbl();\
493                         } while (upper_tbu != read_tbu()); \
494                         *((ULONG *) (entry_ptr + TX_EL_EVENT_THREAD_OFFSET)) =\
495                                 (ULONG) _tx_thread_current_ptr;\
496                         *((ULONG *) (entry_ptr + TX_EL_EVENT_INFO_1_OFFSET)) =\
497                                 (ULONG) b;\
498                         *((ULONG *) (entry_ptr + TX_EL_EVENT_INFO_2_OFFSET)) =\
499                                 (ULONG) c;\
500                         *((ULONG *) (entry_ptr + TX_EL_EVENT_INFO_3_OFFSET)) =\
501                                 (ULONG) d;\
502                         entry_ptr =  entry_ptr + TX_EL_EVENT_SIZE;\
503                         if (entry_ptr >= _tx_el_event_area_end) \
504                         {\
505                                 entry_ptr =  _tx_el_event_area_start;\
506                         }\
507                         *_tx_el_current_event =  entry_ptr;\
508                         }
509 #define TX_EL_KERNEL_CALL_EVENT_INSERT_INFO2(a, b, c) \
510                         {  \
511                         UCHAR   *entry_ptr; \
512                         ULONG   upper_tbu; \
513                         entry_ptr =  *_tx_el_current_event; \
514                         *((unsigned short *) entry_ptr) =  TX_EL_THREADX_CALL; \
515                         *((unsigned short *) (entry_ptr + TX_EL_EVENT_SUBTYPE_OFFSET)) = (unsigned short) a; \
516                         do { \
517                         upper_tbu =  read_tbu(); \
518                         *((ULONG *) (entry_ptr + TX_EL_EVENT_TIME_UPPER_OFFSET)) = upper_tbu; \
519                         *((ULONG *) (entry_ptr + TX_EL_EVENT_TIME_LOWER_OFFSET)) =\
520                                 (ULONG) read_tbl();\
521                         } while (upper_tbu != read_tbu()); \
522                         *((ULONG *) (entry_ptr + TX_EL_EVENT_THREAD_OFFSET)) =\
523                                 (ULONG) _tx_thread_current_ptr;\
524                         *((ULONG *) (entry_ptr + TX_EL_EVENT_INFO_1_OFFSET)) =\
525                                 (ULONG) b;\
526                         *((ULONG *) (entry_ptr + TX_EL_EVENT_INFO_2_OFFSET)) =\
527                                 (ULONG) c;\
528                         entry_ptr =  entry_ptr + TX_EL_EVENT_SIZE;\
529                         if (entry_ptr >= _tx_el_event_area_end) \
530                         {\
531                                 entry_ptr =  _tx_el_event_area_start;\
532                         }\
533                         *_tx_el_current_event =  entry_ptr;\
534                         }
535 #define TX_EL_KERNEL_CALL_EVENT_INSERT_INFO1(a, b) \
536                         {  \
537                         UCHAR   *entry_ptr; \
538                         ULONG   upper_tbu; \
539                         entry_ptr =  *_tx_el_current_event; \
540                         *((unsigned short *) entry_ptr) =  TX_EL_THREADX_CALL; \
541                         *((unsigned short *) (entry_ptr + TX_EL_EVENT_SUBTYPE_OFFSET)) = (unsigned short) a; \
542                         do { \
543                         upper_tbu =  read_tbu(); \
544                         *((ULONG *) (entry_ptr + TX_EL_EVENT_TIME_UPPER_OFFSET)) = upper_tbu; \
545                         *((ULONG *) (entry_ptr + TX_EL_EVENT_TIME_LOWER_OFFSET)) =\
546                                 (ULONG) read_tbl();\
547                         } while (upper_tbu != read_tbu()); \
548                         *((ULONG *) (entry_ptr + TX_EL_EVENT_THREAD_OFFSET)) =\
549                                 (ULONG) _tx_thread_current_ptr;\
550                         *((ULONG *) (entry_ptr + TX_EL_EVENT_INFO_1_OFFSET)) =\
551                                 (ULONG) b;\
552                         entry_ptr =  entry_ptr + TX_EL_EVENT_SIZE;\
553                         if (entry_ptr >= _tx_el_event_area_end) \
554                         {\
555                                 entry_ptr =  _tx_el_event_area_start;\
556                         }\
557                         *_tx_el_current_event =  entry_ptr;\
558                         }
559 #define TX_EL_KERNEL_CALL_EVENT_INSERT_INFO0(a) \
560                         {  \
561                         UCHAR   *entry_ptr; \
562                         ULONG   upper_tbu; \
563                         entry_ptr =  *_tx_el_current_event; \
564                         *((unsigned short *) entry_ptr) =  TX_EL_THREADX_CALL; \
565                         *((unsigned short *) (entry_ptr + TX_EL_EVENT_SUBTYPE_OFFSET)) = (unsigned short) a; \
566                         do { \
567                         upper_tbu =  read_tbu(); \
568                         *((ULONG *) (entry_ptr + TX_EL_EVENT_TIME_UPPER_OFFSET)) = upper_tbu; \
569                         *((ULONG *) (entry_ptr + TX_EL_EVENT_TIME_LOWER_OFFSET)) =\
570                                 (ULONG) read_tbl();\
571                         } while (upper_tbu != read_tbu()); \
572                         *((ULONG *) (entry_ptr + TX_EL_EVENT_THREAD_OFFSET)) =\
573                                 (ULONG) _tx_thread_current_ptr;\
574                         entry_ptr =  entry_ptr + TX_EL_EVENT_SIZE;\
575                         if (entry_ptr >= _tx_el_event_area_end) \
576                         {\
577                                 entry_ptr =  _tx_el_event_area_start;\
578                         }\
579                         *_tx_el_current_event =  entry_ptr;\
580                         }
581 #define TX_EL_THREAD_STATUS_CHANGE_INSERT(a, b) \
582                         {  \
583                         UCHAR   *entry_ptr; \
584                         ULONG   upper_tbu; \
585                         TX_EL_NO_STATUS_EVENTS \
586                         entry_ptr =  *_tx_el_current_event; \
587                         *((unsigned short *) entry_ptr) =  TX_EL_THREAD_STATUS_CHANGE; \
588                         *((unsigned short *) (entry_ptr + TX_EL_EVENT_SUBTYPE_OFFSET)) = (unsigned short) b; \
589                         do { \
590                         upper_tbu =  read_tbu(); \
591                         *((ULONG *) (entry_ptr + TX_EL_EVENT_TIME_UPPER_OFFSET)) = upper_tbu; \
592                         *((ULONG *) (entry_ptr + TX_EL_EVENT_TIME_LOWER_OFFSET)) =\
593                                 (ULONG) read_tbl();\
594                         } while (upper_tbu != read_tbu()); \
595                         *((ULONG *) (entry_ptr + TX_EL_EVENT_THREAD_OFFSET)) =\
596                                 (ULONG) a;\
597                         entry_ptr =  entry_ptr + TX_EL_EVENT_SIZE;\
598                         if (entry_ptr >= _tx_el_event_area_end) \
599                         {\
600                                 entry_ptr =  _tx_el_event_area_start;\
601                         }\
602                         *_tx_el_current_event =  entry_ptr;\
603                         TX_EL_END_FILTER \
604                         }
605 #define TX_EL_THREAD_REGISTER(a) \
606                                 _tx_el_thread_register(a);
607 #define TX_EL_THREAD_UNREGISTER(a) \
608                                 _tx_el_thread_unregister(a);
609 #define TX_EL_INITIALIZE        _tx_el_initialize();
610 #else
611 #define TX_EL_KERNEL_CALL_EVENT_INSERT_INFO4(a, b, c, d, e)  \
612                         {  \
613                         UCHAR   *entry_ptr; \
614                         ULONG   upper_tbu; \
615                         entry_ptr =  *_tx_el_current_event; \
616                         *((unsigned short *) entry_ptr) =  TX_EL_THREADX_CALL; \
617                         *((unsigned short *) (entry_ptr + TX_EL_EVENT_SUBTYPE_OFFSET)) = (unsigned short) a; \
618                         do { \
619                         upper_tbu =  read_tbu(); \
620                         *((ULONG *) (entry_ptr + TX_EL_EVENT_TIME_UPPER_OFFSET)) = upper_tbu; \
621                         *((ULONG *) (entry_ptr + TX_EL_EVENT_TIME_LOWER_OFFSET)) =\
622                                 (ULONG) read_tbl();\
623                         } while (upper_tbu != read_tbu()); \
624                         *((ULONG *) (entry_ptr + TX_EL_EVENT_THREAD_OFFSET)) =\
625                                 (ULONG) _tx_thread_current_ptr;\
626                         entry_ptr =  entry_ptr + TX_EL_EVENT_SIZE;\
627                         if (entry_ptr >= _tx_el_event_area_end) \
628                         {\
629                                 entry_ptr =  _tx_el_event_area_start;\
630                         }\
631                         *_tx_el_current_event =  entry_ptr;\
632                         }
633 #define TX_EL_KERNEL_CALL_EVENT_INSERT_INFO3(a, b, c, d) \
634                         {  \
635                         UCHAR   *entry_ptr; \
636                         ULONG   upper_tbu; \
637                         entry_ptr =  *_tx_el_current_event; \
638                         *((unsigned short *) entry_ptr) =  TX_EL_THREADX_CALL; \
639                         *((unsigned short *) (entry_ptr + TX_EL_EVENT_SUBTYPE_OFFSET)) = (unsigned short) a; \
640                         do { \
641                         upper_tbu =  read_tbu(); \
642                         *((ULONG *) (entry_ptr + TX_EL_EVENT_TIME_UPPER_OFFSET)) = upper_tbu; \
643                         *((ULONG *) (entry_ptr + TX_EL_EVENT_TIME_LOWER_OFFSET)) =\
644                                 (ULONG) read_tbl();\
645                         } while (upper_tbu != read_tbu()); \
646                         *((ULONG *) (entry_ptr + TX_EL_EVENT_THREAD_OFFSET)) =\
647                                 (ULONG) _tx_thread_current_ptr;\
648                         entry_ptr =  entry_ptr + TX_EL_EVENT_SIZE;\
649                         if (entry_ptr >= _tx_el_event_area_end) \
650                         {\
651                                 entry_ptr =  _tx_el_event_area_start;\
652                         }\
653                         *_tx_el_current_event =  entry_ptr;\
654                         }
655 #define TX_EL_KERNEL_CALL_EVENT_INSERT_INFO2(a, b, c) \
656                         {  \
657                         UCHAR   *entry_ptr; \
658                         ULONG   upper_tbu; \
659                         entry_ptr =  *_tx_el_current_event; \
660                         *((unsigned short *) entry_ptr) =  TX_EL_THREADX_CALL; \
661                         *((unsigned short *) (entry_ptr + TX_EL_EVENT_SUBTYPE_OFFSET)) = (unsigned short) a; \
662                         do { \
663                         upper_tbu =  read_tbu(); \
664                         *((ULONG *) (entry_ptr + TX_EL_EVENT_TIME_UPPER_OFFSET)) = upper_tbu; \
665                         *((ULONG *) (entry_ptr + TX_EL_EVENT_TIME_LOWER_OFFSET)) =\
666                                 (ULONG) read_tbl();\
667                         } while (upper_tbu != read_tbu()); \
668                         *((ULONG *) (entry_ptr + TX_EL_EVENT_THREAD_OFFSET)) =\
669                                 (ULONG) _tx_thread_current_ptr;\
670                         entry_ptr =  entry_ptr + TX_EL_EVENT_SIZE;\
671                         if (entry_ptr >= _tx_el_event_area_end) \
672                         {\
673                                 entry_ptr =  _tx_el_event_area_start;\
674                         }\
675                         *_tx_el_current_event =  entry_ptr;\
676                         }
677 #define TX_EL_KERNEL_CALL_EVENT_INSERT_INFO1(a, b) \
678                         {  \
679                         UCHAR   *entry_ptr; \
680                         ULONG   upper_tbu; \
681                         entry_ptr =  *_tx_el_current_event; \
682                         *((unsigned short *) entry_ptr) =  TX_EL_THREADX_CALL; \
683                         *((unsigned short *) (entry_ptr + TX_EL_EVENT_SUBTYPE_OFFSET)) = (unsigned short) a; \
684                         do { \
685                         upper_tbu =  read_tbu(); \
686                         *((ULONG *) (entry_ptr + TX_EL_EVENT_TIME_UPPER_OFFSET)) = upper_tbu; \
687                         *((ULONG *) (entry_ptr + TX_EL_EVENT_TIME_LOWER_OFFSET)) =\
688                                 (ULONG) read_tbl();\
689                         } while (upper_tbu != read_tbu()); \
690                         *((ULONG *) (entry_ptr + TX_EL_EVENT_THREAD_OFFSET)) =\
691                                 (ULONG) _tx_thread_current_ptr;\
692                         entry_ptr =  entry_ptr + TX_EL_EVENT_SIZE;\
693                         if (entry_ptr >= _tx_el_event_area_end) \
694                         {\
695                                 entry_ptr =  _tx_el_event_area_start;\
696                         }\
697                         *_tx_el_current_event =  entry_ptr;\
698                         }
699 #define TX_EL_KERNEL_CALL_EVENT_INSERT_INFO0(a) \
700                         {  \
701                         UCHAR   *entry_ptr; \
702                         ULONG   upper_tbu; \
703                         entry_ptr =  *_tx_el_current_event; \
704                         *((unsigned short *) entry_ptr) =  TX_EL_THREADX_CALL; \
705                         *((unsigned short *) (entry_ptr + TX_EL_EVENT_SUBTYPE_OFFSET)) = (unsigned short) a; \
706                         do { \
707                         upper_tbu =  read_tbu(); \
708                         *((ULONG *) (entry_ptr + TX_EL_EVENT_TIME_UPPER_OFFSET)) = upper_tbu; \
709                         *((ULONG *) (entry_ptr + TX_EL_EVENT_TIME_LOWER_OFFSET)) =\
710                                 (ULONG) read_tbl();\
711                         } while (upper_tbu != read_tbu()); \
712                         *((ULONG *) (entry_ptr + TX_EL_EVENT_THREAD_OFFSET)) =\
713                                 (ULONG) _tx_thread_current_ptr;\
714                         entry_ptr =  entry_ptr + TX_EL_EVENT_SIZE;\
715                         if (entry_ptr >= _tx_el_event_area_end) \
716                         {\
717                                 entry_ptr =  _tx_el_event_area_start;\
718                         }\
719                         *_tx_el_current_event =  entry_ptr;\
720                         }
721 #define TX_EL_THREAD_STATUS_CHANGE_INSERT(a, b) \
722                         {  \
723                         UCHAR   *entry_ptr; \
724                         ULONG   upper_tbu; \
725                         TX_EL_NO_STATUS_EVENTS \
726                         entry_ptr =  *_tx_el_current_event; \
727                         *((unsigned short *) entry_ptr) =  TX_EL_THREAD_STATUS_CHANGE; \
728                         *((unsigned short *) (entry_ptr + TX_EL_EVENT_SUBTYPE_OFFSET)) = (unsigned short) b; \
729                         do { \
730                         upper_tbu =  read_tbu(); \
731                         *((ULONG *) (entry_ptr + TX_EL_EVENT_TIME_UPPER_OFFSET)) = upper_tbu; \
732                         *((ULONG *) (entry_ptr + TX_EL_EVENT_TIME_LOWER_OFFSET)) =\
733                                 (ULONG) read_tbl();\
734                         } while (upper_tbu != read_tbu()); \
735                         *((ULONG *) (entry_ptr + TX_EL_EVENT_THREAD_OFFSET)) =\
736                                 (ULONG) a;\
737                         entry_ptr =  entry_ptr + TX_EL_EVENT_SIZE;\
738                         if (entry_ptr >= _tx_el_event_area_end) \
739                         {\
740                                 entry_ptr =  _tx_el_event_area_start;\
741                         }\
742                         *_tx_el_current_event =  entry_ptr;\
743                         TX_EL_END_FILTER \
744                         }
745 #define TX_EL_THREAD_REGISTER(a) \
746                                 _tx_el_thread_register(a);
747 #define TX_EL_THREAD_UNREGISTER(a) \
748                                 _tx_el_thread_unregister(a);
749 #define TX_EL_INITIALIZE        _tx_el_initialize();
750 #endif
751 #else
752 #define TX_EL_KERNEL_CALL_EVENT_INSERT_INFO4(a, b, c, d, e)
753 #define TX_EL_KERNEL_CALL_EVENT_INSERT_INFO3(a, b, c, d)
754 #define TX_EL_KERNEL_CALL_EVENT_INSERT_INFO2(a, b, c)
755 #define TX_EL_KERNEL_CALL_EVENT_INSERT_INFO1(a, b)
756 #define TX_EL_KERNEL_CALL_EVENT_INSERT_INFO0(a)
757 #define TX_EL_THREAD_STATUS_CHANGE_INSERT(a, b)
758 #define TX_EL_THREAD_REGISTER(a)
759 #define TX_EL_THREAD_UNREGISTER(a)
760 #define TX_EL_INITIALIZE
761 #endif
762 
763 #endif
764 
765