]>
Commit | Line | Data |
---|---|---|
1 | /** @file\r | |
2 | This library class provides common serial I/O port functions.\r | |
3 | \r | |
4 | Copyright (c) 2006 - 2008, Intel Corporation\r | |
5 | All rights reserved. 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 __SERIAL_PORT_LIB__\r | |
16 | #define __SERIAL_PORT_LIB__\r | |
17 | \r | |
18 | /**\r | |
19 | Initialize the serial device hardware.\r | |
20 | \r | |
21 | If no initialization is required, then return RETURN_SUCCESS.\r | |
22 | If the serial device was successfuly initialized, then return RETURN_SUCCESS.\r | |
23 | If the serial device could not be initialized, then return RETURN_DEVICE_ERROR.\r | |
24 | \r | |
25 | @retval RETURN_SUCCESS The serial device was initialized.\r | |
26 | @retval RETURN_DEVICE_ERROR The serail device could not be initialized.\r | |
27 | \r | |
28 | **/\r | |
29 | RETURN_STATUS\r | |
30 | EFIAPI\r | |
31 | SerialPortInitialize (\r | |
32 | VOID\r | |
33 | );\r | |
34 | \r | |
35 | /**\r | |
36 | Write data from buffer to serial device. \r | |
37 | \r | |
38 | Writes NumberOfBytes data bytes from Buffer to the serial device. \r | |
39 | The number of bytes actually written to the serial device is returned.\r | |
40 | If the return value is less than NumberOfBytes, then the write operation failed.\r | |
41 | \r | |
42 | If Buffer is NULL, then ASSERT(). \r | |
43 | \r | |
44 | If NumberOfBytes is zero, then return 0.\r | |
45 | \r | |
46 | @param Buffer Pointer to the data buffer to be written.\r | |
47 | @param NumberOfBytes Number of bytes to written to the serial device.\r | |
48 | \r | |
49 | @retval 0 NumberOfBytes is 0.\r | |
50 | @retval >0 The number of bytes written to the serial device. \r | |
51 | If this value is less than NumberOfBytes, then the read operation failed.\r | |
52 | \r | |
53 | **/\r | |
54 | UINTN\r | |
55 | EFIAPI\r | |
56 | SerialPortWrite (\r | |
57 | IN UINT8 *Buffer,\r | |
58 | IN UINTN NumberOfBytes\r | |
59 | );\r | |
60 | \r | |
61 | \r | |
62 | /**\r | |
63 | Read data from serial device and save the datas in buffer.\r | |
64 | \r | |
65 | Reads NumberOfBytes data bytes from a serial device into the buffer\r | |
66 | specified by Buffer. The number of bytes actually read is returned. \r | |
67 | If the return value is less than NumberOfBytes, then the rest operation failed.\r | |
68 | \r | |
69 | If Buffer is NULL, then ASSERT(). \r | |
70 | \r | |
71 | If NumberOfBytes is zero, then return 0.\r | |
72 | \r | |
73 | @param Buffer Pointer to the data buffer to store the data read from the serial device.\r | |
74 | @param NumberOfBytes Number of bytes which will be read.\r | |
75 | \r | |
76 | @retval 0 Read data failed, No data is to be read.\r | |
77 | @retval !0 Aactual number of bytes read from serial device.\r | |
78 | \r | |
79 | **/\r | |
80 | UINTN\r | |
81 | EFIAPI\r | |
82 | SerialPortRead (\r | |
83 | OUT UINT8 *Buffer,\r | |
84 | IN UINTN NumberOfBytes\r | |
85 | );\r | |
86 | \r | |
87 | /**\r | |
88 | Polls a serial device to see if there is any data waiting to be read.\r | |
89 | \r | |
90 | Polls aserial device to see if there is any data waiting to be read.\r | |
91 | If there is data waiting to be read from the serial device, then TRUE is returned.\r | |
92 | If there is no data waiting to be read from the serial device, then FALSE is returned.\r | |
93 | \r | |
94 | @retval TRUE Data is waiting to be read from the serial device.\r | |
95 | @retval FALSE There is no data waiting to be read from the serial device.\r | |
96 | \r | |
97 | **/\r | |
98 | BOOLEAN\r | |
99 | EFIAPI\r | |
100 | SerialPortPoll (\r | |
101 | VOID\r | |
102 | );\r | |
103 | \r | |
104 | #endif\r |