]>
Commit | Line | Data |
---|---|---|
2ef2b01e A |
1 | /** @file\r |
2 | Serial I/O Port library functions with no library constructor/destructor\r | |
3 | \r | |
60274cca | 4 | Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>\r |
7d49ced0 | 5 | Copyright (c) 2012, ARM Ltd. All rights reserved.\r |
2ef2b01e | 6 | \r |
60274cca | 7 | This program and the accompanying materials\r |
2ef2b01e A |
8 | are licensed and made available under the terms and conditions of the BSD License\r |
9 | which accompanies this distribution. The full text of the license may be found at\r | |
10 | http://opensource.org/licenses/bsd-license.php\r | |
11 | \r | |
12 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
13 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
14 | \r | |
15 | **/\r | |
16 | \r | |
17 | #include <Base.h>\r | |
18 | \r | |
19 | \r | |
20 | #include <Library/SerialPortLib.h>\r | |
7d49ced0 | 21 | #include <Library/SerialPortExtLib.h>\r |
2ef2b01e | 22 | \r |
7d49ced0 | 23 | /**\r |
2ef2b01e A |
24 | \r |
25 | Programmed hardware of Serial port.\r | |
26 | \r | |
27 | @return Always return EFI_UNSUPPORTED.\r | |
28 | \r | |
29 | **/\r | |
30 | RETURN_STATUS\r | |
31 | EFIAPI\r | |
32 | SerialPortInitialize (\r | |
33 | VOID\r | |
34 | )\r | |
35 | {\r | |
36 | return RETURN_UNSUPPORTED;\r | |
37 | }\r | |
38 | \r | |
7d49ced0 | 39 | /**\r |
40 | Set the serial device control bits.\r | |
41 | \r | |
42 | @return Always return EFI_UNSUPPORTED.\r | |
43 | \r | |
44 | **/\r | |
45 | RETURN_STATUS\r | |
46 | EFIAPI\r | |
47 | SerialPortSetControl (\r | |
48 | IN UINT32 Control\r | |
49 | )\r | |
50 | {\r | |
51 | return RETURN_UNSUPPORTED;\r | |
52 | }\r | |
53 | \r | |
54 | /**\r | |
55 | Get the serial device control bits.\r | |
56 | \r | |
57 | @param Control Control signals read from the serial device.\r | |
58 | \r | |
59 | @retval EFI_SUCCESS The control bits were read from the serial device.\r | |
60 | @retval EFI_DEVICE_ERROR The serial device is not functioning correctly.\r | |
61 | \r | |
62 | **/\r | |
63 | RETURN_STATUS\r | |
64 | EFIAPI\r | |
65 | SerialPortGetControl (\r | |
66 | OUT UINT32 *Control\r | |
67 | )\r | |
68 | {\r | |
69 | if (SerialPortPoll ()) {\r | |
70 | // If a character is pending don't set EFI_SERIAL_INPUT_BUFFER_EMPTY\r | |
71 | *Control = EFI_SERIAL_OUTPUT_BUFFER_EMPTY;\r | |
72 | } else {\r | |
73 | *Control = EFI_SERIAL_INPUT_BUFFER_EMPTY | EFI_SERIAL_OUTPUT_BUFFER_EMPTY;\r | |
74 | }\r | |
75 | return EFI_SUCCESS;\r | |
76 | }\r | |
77 | \r | |
78 | /**\r | |
79 | Set the serial device attributes.\r | |
80 | \r | |
81 | @return Always return EFI_UNSUPPORTED.\r | |
82 | \r | |
83 | **/\r | |
84 | RETURN_STATUS\r | |
85 | EFIAPI\r | |
86 | SerialPortSetAttributes (\r | |
87 | IN OUT UINT64 *BaudRate,\r | |
88 | IN OUT UINT32 *ReceiveFifoDepth,\r | |
89 | IN OUT UINT32 *Timeout,\r | |
90 | IN OUT EFI_PARITY_TYPE *Parity,\r | |
91 | IN OUT UINT8 *DataBits,\r | |
92 | IN OUT EFI_STOP_BITS_TYPE *StopBits\r | |
93 | )\r | |
94 | {\r | |
95 | return RETURN_UNSUPPORTED;\r | |
96 | }\r | |
97 | \r | |
2ef2b01e A |
98 | /**\r |
99 | Write data to serial device.\r | |
100 | \r | |
11c20f4e | 101 | @param Buffer Point of data buffer which need to be written.\r |
2ef2b01e A |
102 | @param NumberOfBytes Number of output bytes which are cached in Buffer.\r |
103 | \r | |
104 | @retval 0 Write data failed.\r | |
11c20f4e | 105 | @retval !0 Actual number of bytes written to serial device.\r |
2ef2b01e A |
106 | \r |
107 | **/\r | |
108 | UINTN\r | |
109 | EFIAPI\r | |
110 | SerialPortWrite (\r | |
111 | IN UINT8 *Buffer,\r | |
112 | IN UINTN NumberOfBytes\r | |
7d49ced0 | 113 | )\r |
2ef2b01e A |
114 | {\r |
115 | return 0;\r | |
116 | }\r | |
117 | \r | |
118 | \r | |
119 | /**\r | |
11c20f4e | 120 | Read data from serial device and save the data in buffer.\r |
2ef2b01e | 121 | \r |
11c20f4e | 122 | @param Buffer Point of data buffer which need to be written.\r |
2ef2b01e A |
123 | @param NumberOfBytes Number of output bytes which are cached in Buffer.\r |
124 | \r | |
125 | @retval 0 Read data failed.\r | |
11c20f4e | 126 | @retval !0 Actual number of bytes read from serial device.\r |
2ef2b01e A |
127 | \r |
128 | **/\r | |
129 | UINTN\r | |
130 | EFIAPI\r | |
131 | SerialPortRead (\r | |
132 | OUT UINT8 *Buffer,\r | |
133 | IN UINTN NumberOfBytes\r | |
7d49ced0 | 134 | )\r |
2ef2b01e A |
135 | {\r |
136 | return 0;\r | |
137 | }\r | |
138 | \r | |
139 | \r | |
140 | \r | |
141 | /**\r | |
142 | Poll the serial device to see if there is any data waiting.\r | |
143 | \r | |
144 | If there is data waiting to be read from the serial port, then return\r | |
145 | TRUE. If there is no data waiting to be read from the serial port, then \r | |
146 | return FALSE.\r | |
147 | \r | |
148 | @retval TRUE Data is waiting to be read.\r | |
149 | @retval FALSE There is no data waiting to be read.\r | |
150 | \r | |
151 | **/\r | |
152 | BOOLEAN\r | |
153 | EFIAPI\r | |
154 | SerialPortPoll (\r | |
155 | VOID\r | |
156 | )\r | |
157 | {\r | |
158 | return 0;\r | |
159 | }\r | |
160 | \r |