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