]>
Commit | Line | Data |
---|---|---|
fd7a76af | 1 | /** @file\r |
eceb3a4c | 2 | Serial I/O Port library functions definition.\r |
fd7a76af | 3 | \r |
eceb3a4c | 4 | Copyright (c) 2006 - 2008, Intel Corporation\r |
fd7a76af | 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 | |
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 | |
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 | |
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 | |
41 | \r | |
42 | If Buffer is NULL, then ASSERT(). \r | |
fd7a76af | 43 | \r |
d69107aa | 44 | If NumberOfBytes is zero, then return 0.\r |
fd7a76af | 45 | \r |
d69107aa | 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 | |
fd7a76af | 52 | \r |
53 | **/\r | |
54 | UINTN\r | |
55 | EFIAPI\r | |
56 | SerialPortWrite (\r | |
57 | IN UINT8 *Buffer,\r | |
58 | IN UINTN NumberOfBytes\r | |
ef4ce186 | 59 | );\r |
fd7a76af | 60 | \r |
61 | \r | |
62 | /**\r | |
63 | Read data from serial device and save the datas in buffer.\r | |
64 | \r | |
d69107aa | 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 | |
fd7a76af | 72 | \r |
d69107aa | 73 | @param Buffer Pointer to the data buffer to store the data read from the serial device.\r |
eceb3a4c | 74 | @param NumberOfBytes Number of bytes which will be read.\r |
fd7a76af | 75 | \r |
eceb3a4c | 76 | @retval 0 Read data failed, No data is to be read.\r |
fd7a76af | 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 | |
ef4ce186 | 85 | );\r |
fd7a76af | 86 | \r |
a2ddd00b | 87 | /**\r |
07974e78 | 88 | Polls a serial device to see if there is any data waiting to be read.\r |
a2ddd00b | 89 | \r |
07974e78 | 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 | |
a2ddd00b | 93 | \r |
07974e78 | 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 | |
a2ddd00b LG |
96 | \r |
97 | **/\r | |
98 | BOOLEAN\r | |
99 | EFIAPI\r | |
100 | SerialPortPoll (\r | |
101 | VOID\r | |
102 | );\r | |
fd7a76af | 103 | \r |
104 | #endif\r |