]> git.proxmox.com Git - mirror_edk2.git/blame - SourceLevelDebugPkg/Include/Library/DebugCommunicationLib.h
SourceLevelDebugPkg: Fix typos in comments
[mirror_edk2.git] / SourceLevelDebugPkg / Include / Library / DebugCommunicationLib.h
CommitLineData
18b144ea 1/** @file\r
2 Debug Communication Library definitions.\r
3\r
f95e6f6b 4 Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved.<BR>\r
18b144ea 5 This program and the accompanying materials\r
6 are licensed and made available under the terms and conditions of the BSD License\r
7 which accompanies this distribution. The full text of the license may be found at\r
8 http://opensource.org/licenses/bsd-license.php.\r
9\r
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12\r
13**/\r
14\r
15#ifndef __DEBUG_COMMUNICATION_LIB_H__\r
16#define __DEBUG_COMMUNICATION_LIB_H__\r
17\r
18typedef VOID * DEBUG_PORT_HANDLE;\r
19\r
20/**\r
21 Caller provided function to be invoked at the end of DebugPortInitialize().\r
22\r
74cdb367 23 Refer to the description for DebugPortInitialize() for more details.\r
18b144ea 24\r
25 @param[in] Context The first input argument of DebugPortInitialize().\r
74cdb367 26 @param[in] DebugPortHandle Debug port handle created by Debug Communication Library.\r
18b144ea 27\r
28**/\r
29typedef\r
30VOID\r
31(EFIAPI * DEBUG_PORT_CONTINUE)(\r
32 IN VOID *Context,\r
33 IN DEBUG_PORT_HANDLE DebugPortHandle\r
34 );\r
35\r
36/**\r
37 Initialize the debug port.\r
38\r
39 This function will initialize debug port to get it ready for data transmition. If\r
40 certain Debug Communication Library instance has to save some private data in the\r
41 stack, this function must work on the mode that doesn't return to the caller, then\r
42 the caller needs to wrap up all rest of logic after DebugPortInitialize() into one\r
43 function and pass it into DebugPortInitialize(). DebugPortInitialize() is\r
74cdb367 44 responsible to invoke the passing-in function at the end of DebugPortInitialize().\r
18b144ea 45\r
74cdb367 46 If the parameter Function is not NULL, Debug Communication Library instance will\r
18b144ea 47 invoke it by passing in the Context to be the first parameter. Debug Communication\r
48 Library instance could create one debug port handle to be the second parameter\r
49 passing into the Function. Debug Communication Library instance also could pass\r
50 NULL to be the second parameter if it doesn't create the debug port handle.\r
51\r
52 If the parameter Function is NULL, and Context is not NULL. At this time, Context\r
53 is the debug port handle created by the previous Debug Communication Library\r
54 instance.\r
55 a) If the instance can understand and continue use the private data of the previous\r
56 instance, it could return the same handle as passed in (as Context parameter).\r
57 b) If the instance does not understand, or does not want to continue use the\r
58 private data of the previous instance, it could ignore the input Context parameter\r
f95e6f6b 59 and create the new handle to be returned.\r
18b144ea 60\r
61 If Function() is NULL and Context is NULL, Debug Communication Library could create a\r
62 new handle and return it. NULL is also a valid handle to be returned.\r
63\r
64 @param[in] Context Context needed by callback function; it was optional.\r
65 @param[in] Function Continue function called by Debug Communication library;\r
66 it was optional.\r
67\r
68 @return The debug port handle created by Debug Communication Library if Function\r
69 is not NULL.\r
70\r
71**/\r
72DEBUG_PORT_HANDLE\r
73EFIAPI\r
74DebugPortInitialize (\r
75 IN VOID *Context,\r
76 IN DEBUG_PORT_CONTINUE Function\r
77 );\r
78\r
79\r
80/**\r
81 Read data from debug device and save the datas in buffer.\r
82\r
83 Reads NumberOfBytes data bytes from a debug device into the buffer\r
84 specified by Buffer. The number of bytes actually read is returned.\r
85 If the return value is less than NumberOfBytes, then the rest operation failed.\r
86 If NumberOfBytes is zero, then return 0.\r
87\r
88 @param Handle Debug port handle.\r
89 @param Buffer Pointer to the data buffer to store the data read from the debug device.\r
90 @param NumberOfBytes Number of bytes which will be read.\r
91 @param Timeout Timeout value for reading from debug device. It unit is Microsecond.\r
92\r
93 @retval 0 Read data failed, no data is to be read.\r
94 @retval >0 Actual number of bytes read from debug device.\r
95\r
96**/\r
97UINTN\r
98EFIAPI\r
99DebugPortReadBuffer (\r
100 IN DEBUG_PORT_HANDLE Handle,\r
101 IN UINT8 *Buffer,\r
102 IN UINTN NumberOfBytes,\r
103 IN UINTN Timeout\r
104 );\r
105\r
106\r
107/**\r
108 Write data from buffer to debug device.\r
109\r
110 Writes NumberOfBytes data bytes from Buffer to the debug device.\r
111 The number of bytes actually written to the debug device is returned.\r
112 If the return value is less than NumberOfBytes, then the write operation failed.\r
113 If NumberOfBytes is zero, then return 0.\r
114\r
115 @param Handle Debug port handle.\r
116 @param Buffer Pointer to the data buffer to be written.\r
117 @param NumberOfBytes Number of bytes to written to the debug device.\r
118\r
119 @retval 0 NumberOfBytes is 0.\r
120 @retval >0 The number of bytes written to the debug device.\r
121 If this value is less than NumberOfBytes, then the read operation failed.\r
122\r
123**/\r
124UINTN\r
125EFIAPI\r
126DebugPortWriteBuffer (\r
127 IN DEBUG_PORT_HANDLE Handle,\r
128 IN UINT8 *Buffer,\r
129 IN UINTN NumberOfBytes\r
130 );\r
131\r
132/**\r
133 Polls a debug device to see if there is any data waiting to be read.\r
134\r
135 Polls a debug device to see if there is any data waiting to be read.\r
136 If there is data waiting to be read from the debug device, then TRUE is returned.\r
137 If there is no data waiting to be read from the debug device, then FALSE is returned.\r
138\r
139 @param Handle Debug port handle.\r
140\r
141 @retval TRUE Data is waiting to be read from the debug device.\r
142 @retval FALSE There is no data waiting to be read from the serial device.\r
143\r
144**/\r
145BOOLEAN\r
146EFIAPI\r
147DebugPortPollBuffer (\r
148 IN DEBUG_PORT_HANDLE Handle\r
149 );\r
150\r
151#endif\r
152\r