]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Include/Library/SerialPortLib.h
Add SerialPortPoll Api in SerialPortLib to Poll the serial device to see if there...
[mirror_edk2.git] / MdePkg / Include / Library / SerialPortLib.h
1 /** @file
2 Serial I/O Port library functions definition.
3
4 Copyright (c) 2006 - 2008, Intel Corporation
5 All rights reserved. This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
9
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12
13 **/
14
15 #ifndef __SERIAL_PORT_LIB__
16 #define __SERIAL_PORT_LIB__
17
18 /**
19
20 Programmed hardware of Serial port.
21
22 @return Status of Serial Port Device initialization.
23
24 **/
25 RETURN_STATUS
26 EFIAPI
27 SerialPortInitialize (
28 VOID
29 );
30
31 /**
32 Write data from buffer to serial device.
33
34 If the Buffer is NULL, then return 0;
35 if NumberOfBytes is zero, then return 0.
36
37 @param Buffer Point of data buffer which need to be writed.
38 @param NumberOfBytes Number of output bytes which are cached in Buffer.
39
40 @retval 0 Write data failed, or No data is to be written.
41 @retval !0 Actual number of bytes writed to serial device.
42
43 **/
44 UINTN
45 EFIAPI
46 SerialPortWrite (
47 IN UINT8 *Buffer,
48 IN UINTN NumberOfBytes
49 );
50
51
52 /**
53 Read data from serial device and save the datas in buffer.
54
55 If the Buffer is NULL, then return zero;
56 if NumberOfBytes is zero, then return zero.
57
58 @param Buffer Point of data buffer, which contains the data
59 returned from the serial device.
60 @param NumberOfBytes Number of bytes which will be read.
61
62 @retval 0 Read data failed, No data is to be read.
63 @retval !0 Aactual number of bytes read from serial device.
64
65 **/
66 UINTN
67 EFIAPI
68 SerialPortRead (
69 OUT UINT8 *Buffer,
70 IN UINTN NumberOfBytes
71 );
72
73 /**
74 Poll the serial device to see if there is any data waiting.
75
76 If there is data waiting to be read from the serial port, then return
77 TRUE. If there is no data waiting to be read from the serial port, then
78 return FALSE.
79
80 @retval TRUE Data is waiting to be read.
81 @retval FALSE There is no data waiting to be read.
82
83 **/
84 BOOLEAN
85 EFIAPI
86 SerialPortPoll (
87 VOID
88 );
89
90 #endif