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