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 /** NetX Duo Component */
15 /** */
16 /** Trace */
17 /** */
18 /**************************************************************************/
19 /**************************************************************************/
20
21 #ifndef NX_SOURCE_CODE
22 #define NX_SOURCE_CODE
23 #endif
24
25
26 /* Include necessary system files. */
27
28 #include "nx_api.h"
29
30
31 #ifdef TX_ENABLE_EVENT_TRACE
32 /**************************************************************************/
33 /* */
34 /* FUNCTION RELEASE */
35 /* */
36 /* _nx_trace_event_update PORTABLE C */
37 /* 6.1 */
38 /* AUTHOR */
39 /* */
40 /* Yuxin Zhou, Microsoft Corporation */
41 /* */
42 /* DESCRIPTION */
43 /* */
44 /* This function inserts a NetX Duo event into the current trace */
45 /* buffer. */
46 /* */
47 /* INPUT */
48 /* */
49 /* event Event pointer */
50 /* timestamp Timestamp of the event */
51 /* event_id User Event ID */
52 /* info_field_1 First information field */
53 /* info_field_2 First information field */
54 /* info_field_3 First information field */
55 /* info_field_4 First information field */
56 /* */
57 /* OUTPUT */
58 /* */
59 /* None */
60 /* */
61 /* CALLS */
62 /* */
63 /* None */
64 /* */
65 /* CALLED BY */
66 /* */
67 /* Internal NetX Duo Functions */
68 /* */
69 /* RELEASE HISTORY */
70 /* */
71 /* DATE NAME DESCRIPTION */
72 /* */
73 /* 05-19-2020 Yuxin Zhou Initial Version 6.0 */
74 /* 09-30-2020 Yuxin Zhou Modified comment(s), */
75 /* resulting in version 6.1 */
76 /* */
77 /**************************************************************************/
_nx_trace_event_update(TX_TRACE_BUFFER_ENTRY * event,ULONG timestamp,ULONG event_id,ULONG info_field_1,ULONG info_field_2,ULONG info_field_3,ULONG info_field_4)78 VOID _nx_trace_event_update(TX_TRACE_BUFFER_ENTRY *event, ULONG timestamp, ULONG event_id, ULONG info_field_1, ULONG info_field_2, ULONG info_field_3, ULONG info_field_4)
79 {
80
81 TX_INTERRUPT_SAVE_AREA
82
83
84 /* Disable interrupts. */
85 TX_DISABLE
86
87 /* Determine if the event exists and is still the event originally inserted into the trace. */
88 if ((event) && (event -> tx_trace_buffer_entry_event_id == event_id) && (event -> tx_trace_buffer_entry_time_stamp == timestamp))
89 {
90
91 /* Yes, update this trace entry based on the info input parameters. */
92
93 /* Check for info field 1 update. */
94 if (info_field_1)
95 {
96
97 /* Yes, update info field 1. */
98 event -> tx_trace_buffer_entry_information_field_1 = info_field_1;
99 }
100
101 /* Check for info field 2 update. */
102 if (info_field_2)
103 {
104
105 /* Yes, update info field 2. */
106 event -> tx_trace_buffer_entry_information_field_2 = info_field_2;
107 }
108
109 /* Check for info field 3 update. */
110 if (info_field_3)
111 {
112
113 /* Yes, update info field 3. */
114 event -> tx_trace_buffer_entry_information_field_3 = info_field_3;
115 }
116
117 /* Check for info field 4 update. */
118 if (info_field_4)
119 {
120
121 /* Yes, update info field 4. */
122 event -> tx_trace_buffer_entry_information_field_4 = info_field_4;
123 }
124 }
125 /* Restore interrupts. */
126 TX_RESTORE
127 }
128 #endif
129
130