]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Include/Protocol/DebugPort.h
ceffaf695489b79c950a97d6fa0ef0a17306e1b8
[mirror_edk2.git] / MdePkg / Include / Protocol / DebugPort.h
1 /** @file
2 Copyright (c) 2006, Intel Corporation
3 All rights reserved. This program and the accompanying materials
4 are licensed and made available under the terms and conditions of the BSD License
5 which accompanies this distribution. The full text of the license may be found at
6 http://opensource.org/licenses/bsd-license.php
7
8 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
9 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
10
11 Module Name: DebugPort.h
12
13 **/
14
15 #ifndef __DEBUG_PORT_H__
16 #define __DEBUG_PORT_H__
17
18
19 //
20 // DebugPortIo protocol {EBA4E8D2-3858-41EC-A281-2647BA9660D0}
21 //
22 #define EFI_DEBUGPORT_PROTOCOL_GUID \
23 { \
24 0xEBA4E8D2, 0x3858, 0x41EC, {0xA2, 0x81, 0x26, 0x47, 0xBA, 0x96, 0x60, 0xD0 } \
25 }
26
27 extern EFI_GUID gEfiDebugPortProtocolGuid;
28
29 typedef struct _EFI_DEBUGPORT_PROTOCOL EFI_DEBUGPORT_PROTOCOL;
30
31 //
32 // DebugPort member functions
33 //
34
35 /**
36 Resets the debugport.
37
38 @param This A pointer to the EFI_DEBUGPORT_PROTOCOL instance.
39
40 @retval EFI_SUCCESS The debugport device was reset and is in usable state.
41 @retval EFI_DEVICE_ERROR The debugport device could not be reset and is unusable.
42
43 **/
44 typedef
45 EFI_STATUS
46 (EFIAPI *EFI_DEBUGPORT_RESET) (
47 IN EFI_DEBUGPORT_PROTOCOL *This
48 );
49
50 /**
51 Writes data to the debugport.
52
53 @param This A pointer to the EFI_DEBUGPORT_PROTOCOL instance.
54 @param Timeout The number of microseconds to wait before timing out a write operation.
55 @param BufferSize On input, the requested number of bytes of data to write. On output, the
56 number of bytes of data actually written.
57 @param Buffer A pointer to a buffer containing the data to write.
58
59 @retval EFI_SUCCESS The data was written.
60 @retval EFI_DEVICE_ERROR The device reported an error.
61 @retval EFI_TIMEOUT The data write was stopped due to a timeout.
62
63 **/
64 typedef
65 EFI_STATUS
66 (EFIAPI *EFI_DEBUGPORT_WRITE) (
67 IN EFI_DEBUGPORT_PROTOCOL *This,
68 IN UINT32 Timeout,
69 IN OUT UINTN *BufferSize,
70 IN VOID *Buffer
71 );
72
73 /**
74 Reads data from the debugport.
75
76 @param This A pointer to the EFI_DEBUGPORT_PROTOCOL instance.
77 @param Timeout The number of microseconds to wait before timing out a read operation.
78 @param BufferSize On input, the requested number of bytes of data to read. On output, the
79 number of bytes of data actually number of bytes
80 of data read and returned in Buffer.
81 @param Buffer A pointer to a buffer into which the data read will be saved.
82
83 @retval EFI_SUCCESS The data was read.
84 @retval EFI_DEVICE_ERROR The device reported an error.
85 @retval EFI_TIMEOUT The operation was stopped due to a timeout or overrun.
86
87 **/
88 typedef
89 EFI_STATUS
90 (EFIAPI *EFI_DEBUGPORT_READ) (
91 IN EFI_DEBUGPORT_PROTOCOL *This,
92 IN UINT32 Timeout,
93 IN OUT UINTN *BufferSize,
94 OUT VOID *Buffer
95 );
96
97 /**
98 Checks to see if any data is available to be read from the debugport device.
99
100 @param This A pointer to the EFI_DEBUGPORT_PROTOCOL instance.
101
102 @retval EFI_SUCCESS At least one byte of data is available to be read.
103 @retval EFI_DEVICE_ERROR The debugport device is not functioning correctly.
104 @retval EFI_NOT_READY No data is available to be read.
105
106 **/
107 typedef
108 EFI_STATUS
109 (EFIAPI *EFI_DEBUGPORT_POLL) (
110 IN EFI_DEBUGPORT_PROTOCOL *This
111 );
112
113 //
114 // DebugPort protocol definition
115 //
116 struct _EFI_DEBUGPORT_PROTOCOL {
117 EFI_DEBUGPORT_RESET Reset;
118 EFI_DEBUGPORT_WRITE Write;
119 EFI_DEBUGPORT_READ Read;
120 EFI_DEBUGPORT_POLL Poll;
121 };
122
123 //
124 // DEBUGPORT variable definitions...
125 //
126 #define EFI_DEBUGPORT_VARIABLE_NAME L"DEBUGPORT"
127 #define EFI_DEBUGPORT_VARIABLE_GUID EFI_DEBUGPORT_PROTOCOL_GUID
128 #define gEfiDebugPortVariableGuid gEfiDebugPortProtocolGuid
129
130 //
131 // DebugPort device path definitions...
132 //
133 #define DEVICE_PATH_MESSAGING_DEBUGPORT EFI_DEBUGPORT_PROTOCOL_GUID
134 #define gEfiDebugPortDevicePathGuid gEfiDebugPortProtocolGuid
135
136 typedef struct {
137 EFI_DEVICE_PATH_PROTOCOL Header;
138 EFI_GUID Guid;
139 } DEBUGPORT_DEVICE_PATH;
140
141 #endif