1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
|
/***************************************************************************
* Copyright (c) 2024 Microsoft Corporation
* Copyright (c) 2026-present Eclipse ThreadX contributors
*
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
*
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** USBX Component */
/** */
/** Trace */
/** */
/**************************************************************************/
/**************************************************************************/
#ifndef UX_SOURCE_CODE
#define UX_SOURCE_CODE
#endif
/* Include necessary system files. */
#include "ux_api.h"
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _ux_trace_event_insert PORTABLE C */
/* 6.1.9 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This function inserts a USBX event into the current trace buffer. */
/* */
/* INPUT */
/* */
/* event_id User Event ID */
/* info_field_1 First information field */
/* info_field_2 First information field */
/* info_field_3 First information field */
/* info_field_4 First information field */
/* current_event Current event pointer for */
/* post event update */
/* current_timestamp Timestamp for post event */
/* update */
/* */
/* OUTPUT */
/* */
/* None */
/* */
/* CALLS */
/* */
/* None */
/* */
/* CALLED BY */
/* */
/* Internal USBX Functions */
/* */
/**************************************************************************/
#ifdef UX_ENABLE_EVENT_TRACE
VOID _ux_trace_event_insert(ULONG event_id, ULONG info_field_1, ULONG info_field_2, ULONG info_field_3, ULONG info_field_4,
ULONG filter, TX_TRACE_BUFFER_ENTRY **current_event, ULONG *current_timestamp)
{
UX_INTERRUPT_SAVE_AREA
TX_TRACE_BUFFER_ENTRY *event;
ULONG timestamp;
/* Disable interrupts. */
UX_DISABLE
/* Pickup the current event. */
event = _tx_trace_buffer_current_ptr;
/* Insert this event into the trace buffer. */
TX_TRACE_IN_LINE_INSERT(event_id, info_field_1, info_field_2, info_field_3, info_field_4, filter)
/* Initialize the timestamp to 0. */
timestamp = 0;
/* Determine if the event was inserted. */
if (event)
{
/* Was the event inserted? */
if (event -> tx_trace_buffer_entry_event_id == event_id)
{
/* Yes, the event was inserted in the event trace so pickup the timestamp. */
timestamp = event -> tx_trace_buffer_entry_time_stamp;
}
else
{
/* Event was not inserted, simply set the event pointer to NULL. */
event = UX_NULL;
}
}
/* Now determine if the caller requested the current event. */
if (current_event)
{
/* Yes, return the event pointer of potential subsequent update. */
*current_event = event;
}
/* Now determine if the current timestamp was requested. */
if (current_timestamp)
{
/* Yes, return the current timestamp. */
*current_timestamp = timestamp;
}
/* Restore interrupts. */
UX_RESTORE
}
#endif
|