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