1 /**************************************************************************/
2 /*                                                                        */
3 /*       Copyright (c) Microsoft Corporation. All rights reserved.        */
4 /*                                                                        */
5 /*       This software is licensed under the Microsoft Software License   */
6 /*       Terms for Microsoft Azure RTOS. Full text of the license can be  */
7 /*       found in the LICENSE file at https://aka.ms/AzureRTOS_EULA       */
8 /*       and in the root directory of this software.                      */
9 /*                                                                        */
10 /**************************************************************************/
11 
12 
13 /**************************************************************************/
14 /**************************************************************************/
15 /**                                                                       */
16 /** USBX Component                                                        */
17 /**                                                                       */
18 /**   Trace                                                               */
19 /**                                                                       */
20 /**************************************************************************/
21 /**************************************************************************/
22 
23 #ifndef UX_SOURCE_CODE
24 #define UX_SOURCE_CODE
25 #endif
26 
27 
28 /* Include necessary system files.  */
29 
30 #include "ux_api.h"
31 
32 
33 /**************************************************************************/
34 /*                                                                        */
35 /*  FUNCTION                                               RELEASE        */
36 /*                                                                        */
37 /*    _ux_trace_event_update                              PORTABLE C      */
38 /*                                                           6.1.9        */
39 /*  AUTHOR                                                                */
40 /*                                                                        */
41 /*    Chaoqiong Xiao, Microsoft Corporation                               */
42 /*                                                                        */
43 /*  DESCRIPTION                                                           */
44 /*                                                                        */
45 /*    This function inserts a USBX event into the current trace 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 USBX Functions                                             */
68 /*                                                                        */
69 /*  RELEASE HISTORY                                                       */
70 /*                                                                        */
71 /*    DATE              NAME                      DESCRIPTION             */
72 /*                                                                        */
73 /*  05-19-2020     Chaoqiong Xiao           Initial Version 6.0           */
74 /*  09-30-2020     Chaoqiong Xiao           Modified comment(s),          */
75 /*                                            used UX prefix to refer to  */
76 /*                                            TX symbols instead of using */
77 /*                                            them directly,              */
78 /*                                            resulting in version 6.1    */
79 /*  10-15-2021     Chaoqiong Xiao           Modified comment(s),          */
80 /*                                            improved traceX support,    */
81 /*                                            resulting in version 6.1.9  */
82 /*                                                                        */
83 /**************************************************************************/
84 #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)85 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)
86 {
87 
88 UX_INTERRUPT_SAVE_AREA
89 
90 
91     /* Disable interrupts.  */
92     UX_DISABLE
93 
94     /* Determine if the event exists and is still the event originally inserted into the trace.  */
95     if ((event) && (event -> tx_trace_buffer_entry_event_id == event_id) && (event -> tx_trace_buffer_entry_time_stamp == timestamp))
96     {
97 
98         /* Yes, update this trace entry based on the info input parameters.  */
99 
100         /* Check for info field 1 update.  */
101         if (info_field_1)
102         {
103 
104             /* Yes, update info field 1.  */
105             event -> tx_trace_buffer_entry_information_field_1 =  info_field_1;
106         }
107 
108         /* Check for info field 2 update.  */
109         if (info_field_2)
110         {
111 
112             /* Yes, update info field 2.  */
113             event -> tx_trace_buffer_entry_information_field_2 =  info_field_2;
114         }
115 
116         /* Check for info field 3 update.  */
117         if (info_field_3)
118         {
119 
120             /* Yes, update info field 3.  */
121             event -> tx_trace_buffer_entry_information_field_3 =  info_field_3;
122         }
123 
124         /* Check for info field 4 update.  */
125         if (info_field_4)
126         {
127 
128             /* Yes, update info field 4.  */
129             event -> tx_trace_buffer_entry_information_field_4 =  info_field_4;
130         }
131     }
132     /* Restore interrupts.  */
133     UX_RESTORE
134 }
135 #endif
136 
137