VirtualBox

source: vbox/trunk/src/VBox/Devices/EFI/Firmware/SourceLevelDebugPkg/Include/Library/DebugCommunicationLib.h@ 107675

最後變更 在這個檔案從107675是 99404,由 vboxsync 提交於 2 年 前

Devices/EFI/FirmwareNew: Update to edk2-stable202302 and make it build, bugref:4643

  • 屬性 svn:eol-style 設為 native
檔案大小: 5.2 KB
 
1/** @file
2 Debug Communication Library definitions.
3
4 Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
6
7**/
8
9#ifndef __DEBUG_COMMUNICATION_LIB_H__
10#define __DEBUG_COMMUNICATION_LIB_H__
11
12typedef VOID *DEBUG_PORT_HANDLE;
13
14/**
15 Caller provided function to be invoked at the end of DebugPortInitialize().
16
17 Refer to the description for DebugPortInitialize() for more details.
18
19 @param[in] Context The first input argument of DebugPortInitialize().
20 @param[in] DebugPortHandle Debug port handle created by Debug Communication Library.
21
22**/
23typedef
24VOID
25(EFIAPI *DEBUG_PORT_CONTINUE)(
26 IN VOID *Context,
27 IN DEBUG_PORT_HANDLE DebugPortHandle
28 );
29
30/**
31 Initialize the debug port.
32
33 This function will initialize debug port to get it ready for data transmission. If
34 certain Debug Communication Library instance has to save some private data in the
35 stack, this function must work on the mode that doesn't return to the caller, then
36 the caller needs to wrap up all rest of logic after DebugPortInitialize() into one
37 function and pass it into DebugPortInitialize(). DebugPortInitialize() is
38 responsible to invoke the passing-in function at the end of DebugPortInitialize().
39
40 If the parameter Function is not NULL, Debug Communication Library instance will
41 invoke it by passing in the Context to be the first parameter. Debug Communication
42 Library instance could create one debug port handle to be the second parameter
43 passing into the Function. Debug Communication Library instance also could pass
44 NULL to be the second parameter if it doesn't create the debug port handle.
45
46 If the parameter Function is NULL, and Context is not NULL. At this time, Context
47 is the debug port handle created by the previous Debug Communication Library
48 instance.
49 a) If the instance can understand and continue use the private data of the previous
50 instance, it could return the same handle as passed in (as Context parameter).
51 b) If the instance does not understand, or does not want to continue use the
52 private data of the previous instance, it could ignore the input Context parameter
53 and create the new handle to be returned.
54
55 If Function() is NULL and Context is NULL, Debug Communication Library could create a
56 new handle and return it. NULL is also a valid handle to be returned.
57
58 @param[in] Context Context needed by callback function; it was optional.
59 @param[in] Function Continue function called by Debug Communication library;
60 it was optional.
61
62 @return The debug port handle created by Debug Communication Library if Function
63 is not NULL.
64
65**/
66DEBUG_PORT_HANDLE
67EFIAPI
68DebugPortInitialize (
69 IN VOID *Context,
70 IN DEBUG_PORT_CONTINUE Function
71 );
72
73/**
74 Read data from debug device and save the data in a buffer.
75
76 Reads NumberOfBytes data bytes from a debug device into the buffer
77 specified by Buffer. The number of bytes actually read is returned.
78 If the return value is less than NumberOfBytes, then the rest operation failed.
79 If NumberOfBytes is zero, then return 0.
80
81 @param Handle Debug port handle.
82 @param Buffer Pointer to the data buffer to store the data read from the debug device.
83 @param NumberOfBytes Number of bytes which will be read.
84 @param Timeout Timeout value for reading from debug device. Its unit is Microsecond.
85
86 @retval 0 Read data failed, no data is to be read.
87 @retval >0 Actual number of bytes read from debug device.
88
89**/
90UINTN
91EFIAPI
92DebugPortReadBuffer (
93 IN DEBUG_PORT_HANDLE Handle,
94 IN UINT8 *Buffer,
95 IN UINTN NumberOfBytes,
96 IN UINTN Timeout
97 );
98
99/**
100 Write data from buffer to debug device.
101
102 Writes NumberOfBytes data bytes from Buffer to the debug device.
103 The number of bytes actually written to the debug device is returned.
104 If the return value is less than NumberOfBytes, then the write operation failed.
105 If NumberOfBytes is zero, then return 0.
106
107 @param Handle Debug port handle.
108 @param Buffer Pointer to the data buffer to be written.
109 @param NumberOfBytes Number of bytes to written to the debug device.
110
111 @retval 0 NumberOfBytes is 0.
112 @retval >0 The number of bytes written to the debug device.
113 If this value is less than NumberOfBytes, then the write operation failed.
114
115**/
116UINTN
117EFIAPI
118DebugPortWriteBuffer (
119 IN DEBUG_PORT_HANDLE Handle,
120 IN UINT8 *Buffer,
121 IN UINTN NumberOfBytes
122 );
123
124/**
125 Polls a debug device to see if there is any data waiting to be read.
126
127 Polls a debug device to see if there is any data waiting to be read.
128 If there is data waiting to be read from the debug device, then TRUE is returned.
129 If there is no data waiting to be read from the debug device, then FALSE is returned.
130
131 @param Handle Debug port handle.
132
133 @retval TRUE Data is waiting to be read from the debug device.
134 @retval FALSE There is no data waiting to be read from the debug device.
135
136**/
137BOOLEAN
138EFIAPI
139DebugPortPollBuffer (
140 IN DEBUG_PORT_HANDLE Handle
141 );
142
143#endif
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette