]> git.proxmox.com Git - mirror_edk2.git/blob - EmulatorPkg/Library/DxeEmuStdErrSerialPortLib/DxeEmuStdErrSerialPortLib.c
EmulatorPkg: Remove all trailing whitespace
[mirror_edk2.git] / EmulatorPkg / Library / DxeEmuStdErrSerialPortLib / DxeEmuStdErrSerialPortLib.c
1 /** @file
2 Serial Port Lib that thunks back to Emulator services to write to StdErr.
3 All read functions are stubed out.
4
5 Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
6 Portions copyright (c) 2011, Apple Inc. All rights reserved.<BR>
7 This program and the accompanying materials
8 are licensed and made available under the terms and conditions of the BSD License
9 which accompanies this distribution. The full text of the license may be found at
10 http://opensource.org/licenses/bsd-license.php.
11
12 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
13 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
14
15 **/
16
17
18 #include <PiDxe.h>
19 #include <Library/SerialPortLib.h>
20 #include <Library/EmuThunkLib.h>
21
22
23
24
25 /**
26 Initialize the serial device hardware.
27
28 If no initialization is required, then return RETURN_SUCCESS.
29 If the serial device was successfully initialized, then return RETURN_SUCCESS.
30 If the serial device could not be initialized, then return RETURN_DEVICE_ERROR.
31
32 @retval RETURN_SUCCESS The serial device was initialized.
33 @retval RETURN_DEVICE_ERROR The serial device could not be initialized.
34
35 **/
36 RETURN_STATUS
37 EFIAPI
38 SerialPortInitialize (
39 VOID
40 )
41 {
42 return RETURN_SUCCESS;
43 }
44
45 /**
46 Write data from buffer to serial device.
47
48 Writes NumberOfBytes data bytes from Buffer to the serial device.
49 The number of bytes actually written to the serial device is returned.
50 If the return value is less than NumberOfBytes, then the write operation failed.
51 If Buffer is NULL, then ASSERT().
52 If NumberOfBytes is zero, then return 0.
53
54 @param Buffer The pointer to the data buffer to be written.
55 @param NumberOfBytes The number of bytes to written to the serial device.
56
57 @retval 0 NumberOfBytes is 0.
58 @retval >0 The number of bytes written to the serial device.
59 If this value is less than NumberOfBytes, then the read operation failed.
60
61 **/
62 UINTN
63 EFIAPI
64 SerialPortWrite (
65 IN UINT8 *Buffer,
66 IN UINTN NumberOfBytes
67 )
68 {
69 return gEmuThunk->WriteStdErr (Buffer, NumberOfBytes);
70 }
71
72
73 /**
74 Read data from serial device and save the datas in buffer.
75
76 Reads NumberOfBytes data bytes from a serial 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 Buffer is NULL, then ASSERT().
80 If NumberOfBytes is zero, then return 0.
81
82 @param Buffer The pointer to the data buffer to store the data read from the serial device.
83 @param NumberOfBytes The number of bytes which will be read.
84
85 @retval 0 Read data failed; No data is to be read.
86 @retval >0 The actual number of bytes read from serial device.
87
88 **/
89 UINTN
90 EFIAPI
91 SerialPortRead (
92 OUT UINT8 *Buffer,
93 IN UINTN NumberOfBytes
94 )
95 {
96 return 0;
97 }
98
99 /**
100 Polls a serial device to see if there is any data waiting to be read.
101
102 Polls a serial device to see if there is any data waiting to be read.
103 If there is data waiting to be read from the serial device, then TRUE is returned.
104 If there is no data waiting to be read from the serial device, then FALSE is returned.
105
106 @retval TRUE Data is waiting to be read from the serial device.
107 @retval FALSE There is no data waiting to be read from the serial device.
108
109 **/
110 BOOLEAN
111 EFIAPI
112 SerialPortPoll (
113 VOID
114 )
115 {
116 return FALSE;
117 }
118
119