1 | /* $Id: DrvIfsTrace-serial.cpp 106061 2024-09-16 14:03:52Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBox interface callback tracing driver.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2020-2024 Oracle and/or its affiliates.
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox base platform packages, as
|
---|
10 | * available from https://www.virtualbox.org.
|
---|
11 | *
|
---|
12 | * This program is free software; you can redistribute it and/or
|
---|
13 | * modify it under the terms of the GNU General Public License
|
---|
14 | * as published by the Free Software Foundation, in version 3 of the
|
---|
15 | * License.
|
---|
16 | *
|
---|
17 | * This program is distributed in the hope that it will be useful, but
|
---|
18 | * WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
20 | * General Public License for more details.
|
---|
21 | *
|
---|
22 | * You should have received a copy of the GNU General Public License
|
---|
23 | * along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
24 | *
|
---|
25 | * SPDX-License-Identifier: GPL-3.0-only
|
---|
26 | */
|
---|
27 |
|
---|
28 |
|
---|
29 | /*********************************************************************************************************************************
|
---|
30 | * Header Files *
|
---|
31 | *********************************************************************************************************************************/
|
---|
32 | #define LOG_GROUP LOG_GROUP_MISC
|
---|
33 | #include <VBox/log.h>
|
---|
34 | #include <VBox/version.h>
|
---|
35 |
|
---|
36 | #include <iprt/errcore.h>
|
---|
37 | #include <iprt/tracelog.h>
|
---|
38 |
|
---|
39 | #include "DrvIfsTraceInternal.h"
|
---|
40 |
|
---|
41 |
|
---|
42 | /*
|
---|
43 | *
|
---|
44 | * ISerialPort Implementation.
|
---|
45 | *
|
---|
46 | */
|
---|
47 | static const RTTRACELOGEVTITEMDESC g_ISerialPortDataAvailRdrNotifyEvtItems[] =
|
---|
48 | {
|
---|
49 | {"cbAvail", "Number of bytes available", RTTRACELOGTYPE_SIZE, 0},
|
---|
50 | {"rc", "Status code returned by the upper device/driver", RTTRACELOGTYPE_INT32, 0}
|
---|
51 | };
|
---|
52 |
|
---|
53 | static const RTTRACELOGEVTDESC g_ISerialPortDataAvailRdrNotifyEvtDesc =
|
---|
54 | {
|
---|
55 | "ISerialPort.DataAvailRdrNotify",
|
---|
56 | "",
|
---|
57 | RTTRACELOGEVTSEVERITY_DEBUG,
|
---|
58 | RT_ELEMENTS(g_ISerialPortDataAvailRdrNotifyEvtItems),
|
---|
59 | g_ISerialPortDataAvailRdrNotifyEvtItems
|
---|
60 | };
|
---|
61 |
|
---|
62 | /**
|
---|
63 | * @interface_method_impl{PDMISERIALPORT,pfnDataAvailRdrNotify}
|
---|
64 | */
|
---|
65 | static DECLCALLBACK(int) drvIfTraceISerialPort_DataAvailRdrNotify(PPDMISERIALPORT pInterface, size_t cbAvail)
|
---|
66 | {
|
---|
67 | PDRVIFTRACE pThis = RT_FROM_MEMBER(pInterface, DRVIFTRACE, ISerialPort);
|
---|
68 | int rc = pThis->pISerialPortAbove->pfnDataAvailRdrNotify(pThis->pISerialPortAbove, cbAvail);
|
---|
69 |
|
---|
70 | int rcTraceLog = RTTraceLogWrEvtAddL(pThis->hTraceLog, &g_ISerialPortDataAvailRdrNotifyEvtDesc, 0, 0, 0, cbAvail, rc);
|
---|
71 | if (RT_FAILURE(rcTraceLog))
|
---|
72 | LogRelMax(10, ("DrvIfTrace#%d: Failed to add event to trace log %Rrc\n", pThis->pDrvIns->iInstance, rcTraceLog));
|
---|
73 |
|
---|
74 | return rc;
|
---|
75 | }
|
---|
76 |
|
---|
77 |
|
---|
78 | static const RTTRACELOGEVTITEMDESC g_ISerialPortDataSentNotifyEvtItems[] =
|
---|
79 | {
|
---|
80 | {"rc", "Status code returned by the upper device/driver", RTTRACELOGTYPE_INT32, 0}
|
---|
81 | };
|
---|
82 |
|
---|
83 | static const RTTRACELOGEVTDESC g_ISerialPortDataSentNotifyEvtDesc =
|
---|
84 | {
|
---|
85 | "ISerialPort.DataSentNotify",
|
---|
86 | "",
|
---|
87 | RTTRACELOGEVTSEVERITY_DEBUG,
|
---|
88 | RT_ELEMENTS(g_ISerialPortDataSentNotifyEvtItems),
|
---|
89 | g_ISerialPortDataSentNotifyEvtItems
|
---|
90 | };
|
---|
91 |
|
---|
92 | /**
|
---|
93 | * @interface_method_impl{PDMISERIALPORT,pfnDataSentNotify}
|
---|
94 | */
|
---|
95 | static DECLCALLBACK(int) drvIfTraceISerialPort_DataSentNotify(PPDMISERIALPORT pInterface)
|
---|
96 | {
|
---|
97 | PDRVIFTRACE pThis = RT_FROM_MEMBER(pInterface, DRVIFTRACE, ISerialPort);
|
---|
98 | int rc = pThis->pISerialPortAbove->pfnDataSentNotify(pThis->pISerialPortAbove);
|
---|
99 |
|
---|
100 | int rcTraceLog = RTTraceLogWrEvtAddL(pThis->hTraceLog, &g_ISerialPortDataSentNotifyEvtDesc, 0, 0, 0, rc);
|
---|
101 | if (RT_FAILURE(rcTraceLog))
|
---|
102 | LogRelMax(10, ("DrvIfTrace#%d: Failed to add event to trace log %Rrc\n", pThis->pDrvIns->iInstance, rcTraceLog));
|
---|
103 |
|
---|
104 | return rc;
|
---|
105 | }
|
---|
106 |
|
---|
107 |
|
---|
108 | static const RTTRACELOGEVTITEMDESC g_ISerialPortReadWrEvtItems[] =
|
---|
109 | {
|
---|
110 | {"cbRead", "Number of bytes to read max", RTTRACELOGTYPE_SIZE, 0},
|
---|
111 | {"pcbRead", "Number of bytes actually read", RTTRACELOGTYPE_SIZE, 0},
|
---|
112 | {"rc", "Status code returned by the upper device/driver", RTTRACELOGTYPE_INT32, 0}
|
---|
113 | };
|
---|
114 |
|
---|
115 | static const RTTRACELOGEVTDESC g_ISerialPortReadWrEvtDesc =
|
---|
116 | {
|
---|
117 | "ISerialPort.ReadWr",
|
---|
118 | "",
|
---|
119 | RTTRACELOGEVTSEVERITY_DEBUG,
|
---|
120 | RT_ELEMENTS(g_ISerialPortReadWrEvtItems),
|
---|
121 | g_ISerialPortReadWrEvtItems
|
---|
122 | };
|
---|
123 |
|
---|
124 | /**
|
---|
125 | * @interface_method_impl{PDMISERIALPORT,pfnReadWr}
|
---|
126 | */
|
---|
127 | static DECLCALLBACK(int) drvIfTraceISerialPort_ReadWr(PPDMISERIALPORT pInterface, void *pvBuf, size_t cbRead, size_t *pcbRead)
|
---|
128 | {
|
---|
129 | PDRVIFTRACE pThis = RT_FROM_MEMBER(pInterface, DRVIFTRACE, ISerialPort);
|
---|
130 | int rc = pThis->pISerialPortAbove->pfnReadWr(pThis->pISerialPortAbove, pvBuf, cbRead, pcbRead);
|
---|
131 |
|
---|
132 | int rcTraceLog = RTTraceLogWrEvtAddL(pThis->hTraceLog, &g_ISerialPortReadWrEvtDesc, 0, 0, 0, cbRead, *pcbRead, rc);
|
---|
133 | if (RT_FAILURE(rcTraceLog))
|
---|
134 | LogRelMax(10, ("DrvIfTrace#%d: Failed to add event to trace log %Rrc\n", pThis->pDrvIns->iInstance, rcTraceLog));
|
---|
135 |
|
---|
136 | return rc;
|
---|
137 | }
|
---|
138 |
|
---|
139 |
|
---|
140 | static const RTTRACELOGEVTITEMDESC g_ISerialPortNotifyStsLinesChangedEvtItems[] =
|
---|
141 | {
|
---|
142 | {"fNewStsLines", "Status line mask", RTTRACELOGTYPE_UINT32, 0},
|
---|
143 | {"rc", "Status code returned by the upper device/driver", RTTRACELOGTYPE_INT32, 0}
|
---|
144 | };
|
---|
145 |
|
---|
146 | static const RTTRACELOGEVTDESC g_ISerialPortNotifyStsLinesChangedEvtDesc =
|
---|
147 | {
|
---|
148 | "ISerialPort.NotifyStsLinesChanged",
|
---|
149 | "",
|
---|
150 | RTTRACELOGEVTSEVERITY_DEBUG,
|
---|
151 | RT_ELEMENTS(g_ISerialPortNotifyStsLinesChangedEvtItems),
|
---|
152 | g_ISerialPortNotifyStsLinesChangedEvtItems
|
---|
153 | };
|
---|
154 |
|
---|
155 | /**
|
---|
156 | * @interface_method_impl{PDMISERIALPORT,pfnNotifyStsLinesChanged}
|
---|
157 | */
|
---|
158 | static DECLCALLBACK(int) drvIfTraceISerialPort_NotifyStsLinesChanged(PPDMISERIALPORT pInterface, uint32_t fNewStatusLines)
|
---|
159 | {
|
---|
160 | PDRVIFTRACE pThis = RT_FROM_MEMBER(pInterface, DRVIFTRACE, ISerialPort);
|
---|
161 | int rc = pThis->pISerialPortAbove->pfnNotifyStsLinesChanged(pThis->pISerialPortAbove, fNewStatusLines);
|
---|
162 |
|
---|
163 | int rcTraceLog = RTTraceLogWrEvtAddL(pThis->hTraceLog, &g_ISerialPortNotifyStsLinesChangedEvtDesc, 0, 0, 0, fNewStatusLines, rc);
|
---|
164 | if (RT_FAILURE(rcTraceLog))
|
---|
165 | LogRelMax(10, ("DrvIfTrace#%d: Failed to add event to trace log %Rrc\n", pThis->pDrvIns->iInstance, rcTraceLog));
|
---|
166 |
|
---|
167 | return rc;
|
---|
168 | }
|
---|
169 |
|
---|
170 |
|
---|
171 | static const RTTRACELOGEVTITEMDESC g_ISerialPortNotifyBrkEvtItems[] =
|
---|
172 | {
|
---|
173 | {"rc", "Status code returned by the upper device/driver", RTTRACELOGTYPE_INT32, 0}
|
---|
174 | };
|
---|
175 |
|
---|
176 | static const RTTRACELOGEVTDESC g_ISerialPortNotifyBrkEvtDesc =
|
---|
177 | {
|
---|
178 | "ISerialPort.NotifyBrk",
|
---|
179 | "",
|
---|
180 | RTTRACELOGEVTSEVERITY_DEBUG,
|
---|
181 | RT_ELEMENTS(g_ISerialPortNotifyBrkEvtItems),
|
---|
182 | g_ISerialPortNotifyBrkEvtItems
|
---|
183 | };
|
---|
184 |
|
---|
185 | /**
|
---|
186 | * @interface_method_impl{PDMISERIALPORT,pfnNotifyBrk}
|
---|
187 | */
|
---|
188 | static DECLCALLBACK(int) drvIfTraceISerialPort_NotifyBrk(PPDMISERIALPORT pInterface)
|
---|
189 | {
|
---|
190 | PDRVIFTRACE pThis = RT_FROM_MEMBER(pInterface, DRVIFTRACE, ISerialPort);
|
---|
191 | int rc = pThis->pISerialPortAbove->pfnNotifyBrk(pThis->pISerialPortAbove);
|
---|
192 |
|
---|
193 | int rcTraceLog = RTTraceLogWrEvtAddL(pThis->hTraceLog, &g_ISerialPortNotifyBrkEvtDesc, 0, 0, 0, rc);
|
---|
194 | if (RT_FAILURE(rcTraceLog))
|
---|
195 | LogRelMax(10, ("DrvIfTrace#%d: Failed to add event to trace log %Rrc\n", pThis->pDrvIns->iInstance, rcTraceLog));
|
---|
196 |
|
---|
197 | return rc;
|
---|
198 | }
|
---|
199 |
|
---|
200 |
|
---|
201 | /*
|
---|
202 | *
|
---|
203 | * ISerialConnector Implementation.
|
---|
204 | *
|
---|
205 | */
|
---|
206 | static const RTTRACELOGEVTITEMDESC g_ISerialConnectorDataAvailWrNotifyEvtItems[] =
|
---|
207 | {
|
---|
208 | {"rc", "Status code returned by the lower driver", RTTRACELOGTYPE_INT32, 0}
|
---|
209 | };
|
---|
210 |
|
---|
211 | static const RTTRACELOGEVTDESC g_ISerialConnectorDataAvailWrNotifyEvtDesc =
|
---|
212 | {
|
---|
213 | "ISerialConnector.DataAvailWrNotify",
|
---|
214 | "",
|
---|
215 | RTTRACELOGEVTSEVERITY_DEBUG,
|
---|
216 | RT_ELEMENTS(g_ISerialConnectorDataAvailWrNotifyEvtItems),
|
---|
217 | g_ISerialConnectorDataAvailWrNotifyEvtItems
|
---|
218 | };
|
---|
219 |
|
---|
220 | /** @interface_method_impl{PDMISERIALCONNECTOR,pfnDataAvailWrNotify} */
|
---|
221 | static DECLCALLBACK(int) drvIfTraceISerialConnector_DataAvailWrNotify(PPDMISERIALCONNECTOR pInterface)
|
---|
222 | {
|
---|
223 | PDRVIFTRACE pThis = RT_FROM_MEMBER(pInterface, DRVIFTRACE, ISerialConnector);
|
---|
224 | int rc = pThis->pISerialConBelow->pfnDataAvailWrNotify(pThis->pISerialConBelow);
|
---|
225 |
|
---|
226 | int rcTraceLog = RTTraceLogWrEvtAddL(pThis->hTraceLog, &g_ISerialConnectorDataAvailWrNotifyEvtDesc, 0, 0, 0, rc);
|
---|
227 | if (RT_FAILURE(rcTraceLog))
|
---|
228 | LogRelMax(10, ("DrvIfTrace#%d: Failed to add event to trace log %Rrc\n", pThis->pDrvIns->iInstance, rcTraceLog));
|
---|
229 |
|
---|
230 | return rc;
|
---|
231 | }
|
---|
232 |
|
---|
233 |
|
---|
234 | static const RTTRACELOGEVTITEMDESC g_ISerialConnectorReadRdrEvtItems[] =
|
---|
235 | {
|
---|
236 | {"cbRead", "Number of bytes to read max", RTTRACELOGTYPE_SIZE, 0},
|
---|
237 | {"pcbRead", "Number of bytes actually read", RTTRACELOGTYPE_SIZE, 0},
|
---|
238 | {"rc", "Status code returned by the lower driver", RTTRACELOGTYPE_INT32, 0}
|
---|
239 | };
|
---|
240 |
|
---|
241 | static const RTTRACELOGEVTDESC g_ISerialConnectorReadRdrEvtDesc =
|
---|
242 | {
|
---|
243 | "ISerialConnector.ReadRdr",
|
---|
244 | "",
|
---|
245 | RTTRACELOGEVTSEVERITY_DEBUG,
|
---|
246 | RT_ELEMENTS(g_ISerialConnectorReadRdrEvtItems),
|
---|
247 | g_ISerialConnectorReadRdrEvtItems
|
---|
248 | };
|
---|
249 |
|
---|
250 | /**
|
---|
251 | * @interface_method_impl{PDMISERIALCONNECTOR,pfnReadRdr}
|
---|
252 | */
|
---|
253 | static DECLCALLBACK(int) drvIfTraceISerialConnector_ReadRdr(PPDMISERIALCONNECTOR pInterface, void *pvBuf,
|
---|
254 | size_t cbRead, size_t *pcbRead)
|
---|
255 | {
|
---|
256 | PDRVIFTRACE pThis = RT_FROM_MEMBER(pInterface, DRVIFTRACE, ISerialConnector);
|
---|
257 | int rc = pThis->pISerialConBelow->pfnReadRdr(pThis->pISerialConBelow, pvBuf, cbRead, pcbRead);
|
---|
258 |
|
---|
259 | int rcTraceLog = RTTraceLogWrEvtAddL(pThis->hTraceLog, &g_ISerialConnectorReadRdrEvtDesc, 0, 0, 0, cbRead, *pcbRead, rc);
|
---|
260 | if (RT_FAILURE(rcTraceLog))
|
---|
261 | LogRelMax(10, ("DrvIfTrace#%d: Failed to add event to trace log %Rrc\n", pThis->pDrvIns->iInstance, rcTraceLog));
|
---|
262 |
|
---|
263 | return rc;
|
---|
264 | }
|
---|
265 |
|
---|
266 |
|
---|
267 | static const RTTRACELOGEVTITEMDESC g_ISerialConnectorChgParamsEvtItems[] =
|
---|
268 | {
|
---|
269 | {"uBps", "Baudrate", RTTRACELOGTYPE_UINT32, 0},
|
---|
270 | {"enmParity", "The parity to configure", RTTRACELOGTYPE_UINT32, 0},
|
---|
271 | {"cDataBits", "Number of data bits for each symbol", RTTRACELOGTYPE_UINT32, 0},
|
---|
272 | {"enmStopBits", "Number of stop bits for each symbol", RTTRACELOGTYPE_UINT32, 0},
|
---|
273 | {"rc", "Status code returned by the lower driver", RTTRACELOGTYPE_INT32, 0}
|
---|
274 | };
|
---|
275 |
|
---|
276 | static const RTTRACELOGEVTDESC g_ISerialConnectorChgParamsEvtDesc =
|
---|
277 | {
|
---|
278 | "ISerialConnector.ChgParams",
|
---|
279 | "",
|
---|
280 | RTTRACELOGEVTSEVERITY_DEBUG,
|
---|
281 | RT_ELEMENTS(g_ISerialConnectorChgParamsEvtItems),
|
---|
282 | g_ISerialConnectorChgParamsEvtItems
|
---|
283 | };
|
---|
284 |
|
---|
285 | /**
|
---|
286 | * @interface_method_impl{PDMISERIALCONNECTOR,pfnChgParams}
|
---|
287 | */
|
---|
288 | static DECLCALLBACK(int) drvIfTraceISerialConnector_ChgParams(PPDMISERIALCONNECTOR pInterface, uint32_t uBps,
|
---|
289 | PDMSERIALPARITY enmParity, unsigned cDataBits,
|
---|
290 | PDMSERIALSTOPBITS enmStopBits)
|
---|
291 | {
|
---|
292 | PDRVIFTRACE pThis = RT_FROM_MEMBER(pInterface, DRVIFTRACE, ISerialConnector);
|
---|
293 | int rc = pThis->pISerialConBelow->pfnChgParams(pThis->pISerialConBelow, uBps, enmParity, cDataBits, enmStopBits);
|
---|
294 |
|
---|
295 | int rcTraceLog = RTTraceLogWrEvtAddL(pThis->hTraceLog, &g_ISerialConnectorChgParamsEvtDesc, 0, 0, 0,
|
---|
296 | uBps, enmParity, cDataBits, enmStopBits, rc);
|
---|
297 | if (RT_FAILURE(rcTraceLog))
|
---|
298 | LogRelMax(10, ("DrvIfTrace#%d: Failed to add event to trace log %Rrc\n", pThis->pDrvIns->iInstance, rcTraceLog));
|
---|
299 |
|
---|
300 | return rc;
|
---|
301 | }
|
---|
302 |
|
---|
303 |
|
---|
304 | static const RTTRACELOGEVTITEMDESC g_ISerialConnectorChgModemLinesEvtItems[] =
|
---|
305 | {
|
---|
306 | {"fRts", "State of RTS line", RTTRACELOGTYPE_BOOL, 0},
|
---|
307 | {"fDtr", "State of DTR line", RTTRACELOGTYPE_BOOL, 0},
|
---|
308 | {"rc", "Status code returned by the lower driver", RTTRACELOGTYPE_INT32, 0}
|
---|
309 | };
|
---|
310 |
|
---|
311 | static const RTTRACELOGEVTDESC g_ISerialConnectorChgModemLinesEvtDesc =
|
---|
312 | {
|
---|
313 | "ISerialConnector.ChgModemLines",
|
---|
314 | "",
|
---|
315 | RTTRACELOGEVTSEVERITY_DEBUG,
|
---|
316 | RT_ELEMENTS(g_ISerialConnectorChgModemLinesEvtItems),
|
---|
317 | g_ISerialConnectorChgModemLinesEvtItems
|
---|
318 | };
|
---|
319 |
|
---|
320 | /**
|
---|
321 | * @interface_method_impl{PDMISERIALCONNECTOR,pfnChgModemLines}
|
---|
322 | */
|
---|
323 | static DECLCALLBACK(int) drvIfTraceISerialConnector_ChgModemLines(PPDMISERIALCONNECTOR pInterface, bool fRts, bool fDtr)
|
---|
324 | {
|
---|
325 | PDRVIFTRACE pThis = RT_FROM_MEMBER(pInterface, DRVIFTRACE, ISerialConnector);
|
---|
326 | int rc = pThis->pISerialConBelow->pfnChgModemLines(pThis->pISerialConBelow, fRts, fDtr);
|
---|
327 |
|
---|
328 | int rcTraceLog = RTTraceLogWrEvtAddL(pThis->hTraceLog, &g_ISerialConnectorChgModemLinesEvtDesc, 0, 0, 0, fRts, fDtr, rc);
|
---|
329 | if (RT_FAILURE(rcTraceLog))
|
---|
330 | LogRelMax(10, ("DrvIfTrace#%d: Failed to add event to trace log %Rrc\n", pThis->pDrvIns->iInstance, rcTraceLog));
|
---|
331 |
|
---|
332 | return rc;
|
---|
333 | }
|
---|
334 |
|
---|
335 |
|
---|
336 | static const RTTRACELOGEVTITEMDESC g_ISerialConnectorChgBrkEvtItems[] =
|
---|
337 | {
|
---|
338 | {"fBrk", "Signal break flag", RTTRACELOGTYPE_BOOL, 0},
|
---|
339 | {"rc", "Status code returned by the lower driver", RTTRACELOGTYPE_INT32, 0}
|
---|
340 | };
|
---|
341 |
|
---|
342 | static const RTTRACELOGEVTDESC g_ISerialConnectorChgBrkEvtDesc =
|
---|
343 | {
|
---|
344 | "ISerialConnector.ChgBrk",
|
---|
345 | "",
|
---|
346 | RTTRACELOGEVTSEVERITY_DEBUG,
|
---|
347 | RT_ELEMENTS(g_ISerialConnectorChgBrkEvtItems),
|
---|
348 | g_ISerialConnectorChgBrkEvtItems
|
---|
349 | };
|
---|
350 |
|
---|
351 | /**
|
---|
352 | * @interface_method_impl{PDMISERIALCONNECTOR,pfnChgBrk}
|
---|
353 | */
|
---|
354 | static DECLCALLBACK(int) drvIfTraceISerialConnector_ChgBrk(PPDMISERIALCONNECTOR pInterface, bool fBrk)
|
---|
355 | {
|
---|
356 | PDRVIFTRACE pThis = RT_FROM_MEMBER(pInterface, DRVIFTRACE, ISerialConnector);
|
---|
357 | int rc = pThis->pISerialConBelow->pfnChgBrk(pThis->pISerialConBelow, fBrk);
|
---|
358 |
|
---|
359 | int rcTraceLog = RTTraceLogWrEvtAddL(pThis->hTraceLog, &g_ISerialConnectorChgBrkEvtDesc, 0, 0, 0, fBrk, rc);
|
---|
360 | if (RT_FAILURE(rcTraceLog))
|
---|
361 | LogRelMax(10, ("DrvIfTrace#%d: Failed to add event to trace log %Rrc\n", pThis->pDrvIns->iInstance, rcTraceLog));
|
---|
362 |
|
---|
363 | return rc;
|
---|
364 | }
|
---|
365 |
|
---|
366 |
|
---|
367 | static const RTTRACELOGEVTITEMDESC g_ISerialConnectorQueryStsLinesEvtItems[] =
|
---|
368 | {
|
---|
369 | {"fStsLines", "Status line flags", RTTRACELOGTYPE_UINT32, 0},
|
---|
370 | {"rc", "Status code returned by the lower driver", RTTRACELOGTYPE_INT32, 0}
|
---|
371 | };
|
---|
372 |
|
---|
373 | static const RTTRACELOGEVTDESC g_ISerialConnectorQueryStsLinesEvtDesc =
|
---|
374 | {
|
---|
375 | "ISerialConnector.QueryStsLines",
|
---|
376 | "",
|
---|
377 | RTTRACELOGEVTSEVERITY_DEBUG,
|
---|
378 | RT_ELEMENTS(g_ISerialConnectorQueryStsLinesEvtItems),
|
---|
379 | g_ISerialConnectorQueryStsLinesEvtItems
|
---|
380 | };
|
---|
381 |
|
---|
382 | /**
|
---|
383 | * @interface_method_impl{PDMISERIALCONNECTOR,pfnQueryStsLines}
|
---|
384 | */
|
---|
385 | static DECLCALLBACK(int) drvIfTraceISerialConnector_QueryStsLines(PPDMISERIALCONNECTOR pInterface, uint32_t *pfStsLines)
|
---|
386 | {
|
---|
387 | PDRVIFTRACE pThis = RT_FROM_MEMBER(pInterface, DRVIFTRACE, ISerialConnector);
|
---|
388 | int rc = pThis->pISerialConBelow->pfnQueryStsLines(pThis->pISerialConBelow, pfStsLines);
|
---|
389 |
|
---|
390 | int rcTraceLog = RTTraceLogWrEvtAddL(pThis->hTraceLog, &g_ISerialConnectorQueryStsLinesEvtDesc, 0, 0, 0, *pfStsLines, rc);
|
---|
391 | if (RT_FAILURE(rcTraceLog))
|
---|
392 | LogRelMax(10, ("DrvIfTrace#%d: Failed to add event to trace log %Rrc\n", pThis->pDrvIns->iInstance, rcTraceLog));
|
---|
393 |
|
---|
394 | return rc;
|
---|
395 | }
|
---|
396 |
|
---|
397 |
|
---|
398 | static const RTTRACELOGEVTITEMDESC g_ISerialConnectorQueuesFlushEvtItems[] =
|
---|
399 | {
|
---|
400 | {"fQueueRecv", "Whether to flush the receive queue", RTTRACELOGTYPE_BOOL, 0},
|
---|
401 | {"fQueueXmit", "Whether to flush the transmit queue", RTTRACELOGTYPE_BOOL, 0},
|
---|
402 | {"rc", "Status code returned by the lower driver", RTTRACELOGTYPE_INT32, 0}
|
---|
403 | };
|
---|
404 |
|
---|
405 | static const RTTRACELOGEVTDESC g_ISerialConnectorQueuesFlushEvtDesc =
|
---|
406 | {
|
---|
407 | "ISerialConnector.QueuesFlush",
|
---|
408 | "",
|
---|
409 | RTTRACELOGEVTSEVERITY_DEBUG,
|
---|
410 | RT_ELEMENTS(g_ISerialConnectorQueuesFlushEvtItems),
|
---|
411 | g_ISerialConnectorQueuesFlushEvtItems
|
---|
412 | };
|
---|
413 |
|
---|
414 | /**
|
---|
415 | * @callback_method_impl{PDMISERIALCONNECTOR,pfnQueuesFlush}
|
---|
416 | */
|
---|
417 | static DECLCALLBACK(int) drvIfTraceISerialConnector_QueuesFlush(PPDMISERIALCONNECTOR pInterface, bool fQueueRecv, bool fQueueXmit)
|
---|
418 | {
|
---|
419 | PDRVIFTRACE pThis = RT_FROM_MEMBER(pInterface, DRVIFTRACE, ISerialConnector);
|
---|
420 | int rc = pThis->pISerialConBelow->pfnQueuesFlush(pThis->pISerialConBelow, fQueueRecv, fQueueXmit);
|
---|
421 |
|
---|
422 | int rcTraceLog = RTTraceLogWrEvtAddL(pThis->hTraceLog, &g_ISerialConnectorQueuesFlushEvtDesc, 0, 0, 0, fQueueRecv, fQueueXmit, rc);
|
---|
423 | if (RT_FAILURE(rcTraceLog))
|
---|
424 | LogRelMax(10, ("DrvIfTrace#%d: Failed to add event to trace log %Rrc\n", pThis->pDrvIns->iInstance, rcTraceLog));
|
---|
425 |
|
---|
426 | return rc;
|
---|
427 | }
|
---|
428 |
|
---|
429 |
|
---|
430 | /**
|
---|
431 | * Initializes serial port relaated interfaces.
|
---|
432 | *
|
---|
433 | * @param pThis The interface callback trace driver instance.
|
---|
434 | */
|
---|
435 | DECLHIDDEN(void) drvIfsTrace_SerialIfInit(PDRVIFTRACE pThis)
|
---|
436 | {
|
---|
437 | pThis->ISerialPort.pfnDataAvailRdrNotify = drvIfTraceISerialPort_DataAvailRdrNotify;
|
---|
438 | pThis->ISerialPort.pfnDataSentNotify = drvIfTraceISerialPort_DataSentNotify;
|
---|
439 | pThis->ISerialPort.pfnReadWr = drvIfTraceISerialPort_ReadWr;
|
---|
440 | pThis->ISerialPort.pfnNotifyStsLinesChanged = drvIfTraceISerialPort_NotifyStsLinesChanged;
|
---|
441 | pThis->ISerialPort.pfnNotifyBrk = drvIfTraceISerialPort_NotifyBrk;
|
---|
442 |
|
---|
443 | pThis->ISerialConnector.pfnDataAvailWrNotify = drvIfTraceISerialConnector_DataAvailWrNotify;
|
---|
444 | pThis->ISerialConnector.pfnReadRdr = drvIfTraceISerialConnector_ReadRdr;
|
---|
445 | pThis->ISerialConnector.pfnChgParams = drvIfTraceISerialConnector_ChgParams;
|
---|
446 | pThis->ISerialConnector.pfnChgModemLines = drvIfTraceISerialConnector_ChgModemLines;
|
---|
447 | pThis->ISerialConnector.pfnChgBrk = drvIfTraceISerialConnector_ChgBrk;
|
---|
448 | pThis->ISerialConnector.pfnQueryStsLines = drvIfTraceISerialConnector_QueryStsLines;
|
---|
449 | pThis->ISerialConnector.pfnQueuesFlush = drvIfTraceISerialConnector_QueuesFlush;
|
---|
450 | }
|
---|
451 |
|
---|